Public Member Functions | Private Member Functions | Private Attributes | List of all members
reco3d::PlotSpacePoints Class Reference
Inheritance diagram for reco3d::PlotSpacePoints:
art::EDAnalyzer art::detail::Analyzer art::detail::LegacyModule art::Observer art::ModuleBase

Public Member Functions

 PlotSpacePoints (const fhicl::ParameterSet &pset)
 
- Public Member Functions inherited from art::EDAnalyzer
 EDAnalyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDAnalyzer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Analyzer
virtual ~Analyzer () noexcept
 
 Analyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 Analyzer (Table< Config > const &config)
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
- Public Member Functions inherited from art::Observer
 ~Observer () noexcept
 
 Observer (Observer const &)=delete
 
 Observer (Observer &&)=delete
 
Observeroperator= (Observer const &)=delete
 
Observeroperator= (Observer &&)=delete
 
void registerProducts (ProductDescriptions &, ModuleDescription const &)
 
void fillDescriptions (ModuleDescription const &)
 
fhicl::ParameterSetID selectorConfig () const
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Private Member Functions

void analyze (const art::Event &evt) override
 
void Plot (const std::vector< recob::SpacePoint > &pts, const std::string &suffix) const
 
void Plot3D (const std::vector< recob::SpacePoint > &pts, const std::string &suffix) const
 
std::vector< recob::SpacePointTrueSpacePoints (detinfo::DetectorClocksData const &clockData, art::Handle< std::vector< recob::Hit >> hits) const
 

Private Attributes

art::InputTag fSpacePointTag
 
std::string fHitLabel
 
std::string fSuffix
 
bool fPlots
 
bool fPlots3D
 
bool fPlotsTrue
 

Additional Inherited Members

- Public Types inherited from art::EDAnalyzer
using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 
- Protected Member Functions inherited from art::Observer
std::string const & processName () const
 
bool wantAllEvents () const noexcept
 
bool wantEvent (ScheduleID id, Event const &e) const
 
Handle< TriggerResultsgetTriggerResults (Event const &e) const
 
 Observer (fhicl::ParameterSet const &config)
 
 Observer (std::vector< std::string > const &select_paths, std::vector< std::string > const &reject_paths, fhicl::ParameterSet const &config)
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Detailed Description

Definition at line 24 of file PlotSpacePoints_module.cc.

Constructor & Destructor Documentation

reco3d::PlotSpacePoints::PlotSpacePoints ( const fhicl::ParameterSet pset)
explicit

Definition at line 52 of file PlotSpacePoints_module.cc.

53  : EDAnalyzer(pset)
54  , fSpacePointTag(art::InputTag(pset.get<std::string>("SpacePointLabel"),
55  pset.get<std::string>("SpacePointInstanceLabel")))
56  , fHitLabel(pset.get<std::string>("HitLabel"))
57  , fSuffix(pset.get<std::string>("Suffix"))
58  , fPlots(pset.get<bool>("Plots"))
59  , fPlots3D(pset.get<bool>("Plots3D"))
60  , fPlotsTrue(pset.get<bool>("PlotsTrue"))
61  {
62  if (!fSuffix.empty()) fSuffix = "_" + fSuffix;
63  }
std::string string
Definition: nybbler.cc:12
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
T get(std::string const &key) const
Definition: ParameterSet.h:271

Member Function Documentation

void reco3d::PlotSpacePoints::analyze ( const art::Event evt)
overrideprivate

Definition at line 173 of file PlotSpacePoints_module.cc.

174  {
175  if (fPlots) {
177  evt.getByLabel(fSpacePointTag, pts);
178 
179  const std::string suffix = TString::Format("%s_%d", fSuffix.c_str(), evt.event()).Data();
180 
181  if (!pts->empty()) {
182  Plot(*pts, suffix);
183 
184  if (fPlots3D) Plot3D(*pts, suffix);
185  }
186  }
187 
188  if (fPlotsTrue) {
190  evt.getByLabel(fHitLabel, hits);
191  auto const clockData =
193  const std::vector<recob::SpacePoint> pts = TrueSpacePoints(clockData, hits);
194 
195  const std::string suffix = TString::Format("%s_true_%d", fSuffix.c_str(), evt.event()).Data();
196 
197  Plot(pts, suffix);
198 
199  if (fPlots3D) Plot3D(pts, suffix);
200  }
201  }
std::vector< recob::SpacePoint > TrueSpacePoints(detinfo::DetectorClocksData const &clockData, art::Handle< std::vector< recob::Hit >> hits) const
EventNumber_t event() const
Definition: DataViewImpl.cc:85
Format
Definition: utils.h:7
std::string string
Definition: nybbler.cc:12
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Definition: DataViewImpl.h:633
void Plot3D(const std::vector< recob::SpacePoint > &pts, const std::string &suffix) const
Fw2dFFT::Data Data
void Plot(const std::vector< recob::SpacePoint > &pts, const std::string &suffix) const
void reco3d::PlotSpacePoints::Plot ( const std::vector< recob::SpacePoint > &  pts,
const std::string suffix 
) const
private

Definition at line 67 of file PlotSpacePoints_module.cc.

68  {
69  TGraph gZX;
70  TGraph gYX;
71  TGraph gZY;
72 
73  gZX.SetTitle(";z;x");
74  gYX.SetTitle(";y;x");
75  gZY.SetTitle(";z;y");
76 
77  for (const recob::SpacePoint& pt : pts) {
78  const double* xyz = pt.XYZ();
79  const double x = xyz[0];
80  const double y = xyz[1];
81  const double z = xyz[2];
82  gZX.SetPoint(gZX.GetN(), z, x);
83  gYX.SetPoint(gYX.GetN(), y, x);
84  gZY.SetPoint(gZY.GetN(), z, y);
85  }
86 
87  if (gZX.GetN() == 0) gZX.SetPoint(0, 0, 0);
88  if (gYX.GetN() == 0) gYX.SetPoint(0, 0, 0);
89  if (gZY.GetN() == 0) gZY.SetPoint(0, 0, 0);
90 
91  gZX.Draw("ap");
92  gPad->Print(("plots/evd" + suffix + ".png").c_str());
93 
94  gYX.Draw("ap");
95  gPad->Print(("plots/evd_ortho" + suffix + ".png").c_str());
96  gZY.Draw("ap");
97  gPad->Print(("plots/evd_zy" + suffix + ".png").c_str());
98  }
list x
Definition: train.py:276
void reco3d::PlotSpacePoints::Plot3D ( const std::vector< recob::SpacePoint > &  pts,
const std::string suffix 
) const
private

Definition at line 126 of file PlotSpacePoints_module.cc.

128  {
129  int frame = 0;
130  for (int phase = 0; phase < 4; ++phase) {
131  const int Nang = 20;
132  for (int iang = 0; iang < Nang; ++iang) {
133  const double ang = M_PI / 2 * iang / double(Nang);
134 
135  TGraph g;
136 
137  for (const recob::SpacePoint& p : pts) {
138  const double* xyz = p.XYZ();
139 
140  double x{}, y{};
141  if (phase == 0) {
142  x = cos(ang) * xyz[1] + sin(ang) * xyz[2];
143  y = xyz[0];
144  }
145  if (phase == 1) {
146  x = xyz[2];
147  y = cos(ang) * xyz[0] + sin(ang) * xyz[1];
148  }
149  if (phase == 2) {
150  x = cos(ang) * xyz[2] - sin(ang) * xyz[0];
151  y = xyz[1];
152  }
153  if (phase == 3) {
154  x = -cos(ang) * xyz[0] + sin(ang) * xyz[1];
155  y = cos(ang) * xyz[1] + sin(ang) * xyz[0];
156  }
157 
158  // const double phi = phase/3.*M_PI/2 + ang/3;
159  const double phi = 0;
160  g.SetPoint(g.GetN(), cos(phi) * x + sin(phi) * y, cos(phi) * y - sin(phi) * x);
161  }
162 
164  TString::Format(("anim/evd3d" + suffix + "_%03d.png").c_str(), frame++).Data();
165  g.SetTitle(fname.c_str());
166  if (g.GetN()) g.Draw("ap");
167  gPad->Print(fname.c_str());
168  }
169  }
170  }
Format
Definition: utils.h:7
static constexpr double g
Definition: Units.h:144
std::string string
Definition: nybbler.cc:12
p
Definition: test.py:223
#define M_PI
Definition: includeROOT.h:54
list x
Definition: train.py:276
std::vector< recob::SpacePoint > reco3d::PlotSpacePoints::TrueSpacePoints ( detinfo::DetectorClocksData const &  clockData,
art::Handle< std::vector< recob::Hit >>  hits 
) const
private

Definition at line 102 of file PlotSpacePoints_module.cc.

104  {
105  std::vector<recob::SpacePoint> pts_true;
106 
107  const double err[6] = {
108  0,
109  };
110 
112  for (unsigned int i = 0; i < hits->size(); ++i) {
113  try {
114  const std::vector<double> xyz = bt_serv->HitToXYZ(clockData, art::Ptr<recob::Hit>(hits, i));
115  pts_true.emplace_back(&xyz[0], err, 0);
116  }
117  catch (...) {
118  } // some hits have no electrons?
119  }
120 
121  return pts_true;
122  }
std::vector< double > HitToXYZ(detinfo::DetectorClocksData const &clockData, const recob::Hit &hit) const
void err(const char *fmt,...)
Definition: message.cpp:226

Member Data Documentation

std::string reco3d::PlotSpacePoints::fHitLabel
private

Definition at line 40 of file PlotSpacePoints_module.cc.

bool reco3d::PlotSpacePoints::fPlots
private

Definition at line 44 of file PlotSpacePoints_module.cc.

bool reco3d::PlotSpacePoints::fPlots3D
private

Definition at line 45 of file PlotSpacePoints_module.cc.

bool reco3d::PlotSpacePoints::fPlotsTrue
private

Definition at line 46 of file PlotSpacePoints_module.cc.

art::InputTag reco3d::PlotSpacePoints::fSpacePointTag
private

Definition at line 38 of file PlotSpacePoints_module.cc.

std::string reco3d::PlotSpacePoints::fSuffix
private

Definition at line 42 of file PlotSpacePoints_module.cc.


The documentation for this class was generated from the following file: