LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
hit::MCHitAnaExample Class Reference
Inheritance diagram for hit::MCHitAnaExample:
art::EDAnalyzer art::detail::Analyzer art::detail::LegacyModule art::Observer art::ModuleBase

Public Types

using ModuleType = EDAnalyzer
 

Public Member Functions

 MCHitAnaExample (fhicl::ParameterSet const &p)
 
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)
 
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)
 
std::unique_ptr< Worker > makeWorker (WorkerParams const &wp)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Protected Member Functions

std::string const & processName () const
 
bool wantAllEvents () const noexcept
 
bool wantEvent (ScheduleID id, Event const &e) const
 
Handle< TriggerResults > getTriggerResults (Event const &e) const
 
ConsumesCollector & consumesCollector ()
 
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 ()
 

Private Member Functions

void analyze (art::Event const &e) override
 

Private Attributes

std::string fRecoHitModuleName
 Producer module for recob::Hit. More...
 
std::string fMCHitModuleName
 Producer module for MCHit. More...
 
TStopwatch fAnaWatch
 
TStopwatch fSearchWatch
 
TStopwatch fReadWatch
 
TH1D * hRecoHitReadTime
 Time to read recob::Hit from disk. More...
 
TH1D * hMCHitReadTime
 Time to read MCHit from disk. More...
 
TH1D * hAnalysisTime
 Time to run analyze() function. More...
 
TH1D * hMCHitSearchTime
 Time to search for corresponding MCHit per RecoHit. More...
 
TH1D * hMCHitSearchTimeSum
 Time to search for corresponding MCHit per RecoHit summed over all RecoHits (per event) More...
 
std::vector< TH1D * > hMCHitQ_v
 Histogram (per plane) for all MCHit charge. More...
 
std::vector< TH1D * > hMCHitMult_v
 Histogram (per plane) for MCHit multiplicity in each event. More...
 
std::vector< TH1D * > hRecoHitQ_v
 Histogram (per plane) for RecoHit charge. More...
 
std::vector< TH1D * > hRecoHitMult_v
 Histogram (per plane) for RecoHit multiplicity in each event. More...
 
std::vector< TH2D * > hCorrMult_v
 Histogram (per plane) for # of MCHit vs. # of RecoHit. More...
 
std::vector< TH1D * > hVoidHitQ_v
 Histogram (per plane) for charge of some RecoHit that has no corresponding MCHit. More...
 
std::vector< TH2D * > hCorrQ_v
 Histogram (per plane) for charge of one MCHit that is closest (in time) to one RecoHit. More...
 
std::vector< TH2D * > hCorrQSum_v
 Histogram (per plane) for charge sum of multiple MCHit found within start=>end time of one RecoHit. More...
 
std::vector< TH1D * > hQRatio_v
 Histogram (per plane) for a ratio of RecoHit charge to the closest (in time) RecoHit charge. More...
 
std::vector< TH1D * > hQSumRatio_v
 
std::vector< TH1D * > hDT_v
 Histogram (per plane) for time-diff between one Reco hit and the closest (in time) RecoHit. More...
 
std::vector< TH1D * > hMCHitMultPerRecoHit_v
 Histogram (per plane) for MCHit multiplicity within start=>end time region of RecoHit. More...
 

Detailed Description

Definition at line 28 of file MCHitAnaExample_module.cc.

Member Typedef Documentation

Definition at line 22 of file EDAnalyzer.h.

Constructor & Destructor Documentation

hit::MCHitAnaExample::MCHitAnaExample ( fhicl::ParameterSet const &  p)
explicit

Definition at line 121 of file MCHitAnaExample_module.cc.

References fMCHitModuleName, fRecoHitModuleName, Get, fhicl::ParameterSet::get(), hAnalysisTime, hCorrMult_v, hCorrQ_v, hCorrQSum_v, hDT_v, hMCHitMult_v, hMCHitMultPerRecoHit_v, hMCHitQ_v, hMCHitReadTime, hMCHitSearchTime, hMCHitSearchTimeSum, hQRatio_v, hQSumRatio_v, hRecoHitMult_v, hRecoHitQ_v, hRecoHitReadTime, and hVoidHitQ_v.

121  : EDAnalyzer(p) // ,
122 
123  {
124  fRecoHitModuleName = p.get<std::string>("RecoHitModuleName");
125  fMCHitModuleName = p.get<std::string>("MCHitModuleName");
126 
128 
129  auto const& wireReadoutGeom = art::ServiceHandle<geo::WireReadout>()->Get();
130 
131  for (unsigned char plane = 0; plane < wireReadoutGeom.Nplanes(); ++plane) {
132 
133  hMCHitQ_v.push_back(
134  fs->make<TH1D>(Form("hMCHitQ_%d", plane),
135  Form("MCHit Charge (Plane %d); Charge [ADC]; # MCHit", plane),
136  250,
137  0,
138  2000));
139 
140  hMCHitMult_v.push_back(
141  fs->make<TH1D>(Form("hMCHitMult_%d", plane),
142  Form("MCHit Multiplicity (Plane %d); Multiplicity; # MCHit", plane),
143  250,
144  0,
145  5000));
146 
147  hRecoHitQ_v.push_back(
148  fs->make<TH1D>(Form("hRecoHitQ_%d", plane),
149  Form("RecoHit Charge (Plane %d); Charge [ADC]; # RecoHits", plane),
150  250,
151  0,
152  2000));
153 
154  hRecoHitMult_v.push_back(
155  fs->make<TH1D>(Form("hRecoHitMult_%d", plane),
156  Form("RecoHit Multiplicity (Plane %d); Multiplicity; # RecoHits", plane),
157  200,
158  0,
159  2000));
160 
161  hCorrMult_v.push_back(
162  fs->make<TH2D>(Form("hCorrMult_%d", plane),
163  Form("# MCHits vs. # RecoHits (Plane %d); # MCHits; # RecoHits", plane),
164  250,
165  0,
166  5000,
167  200,
168  0,
169  2000));
170 
171  hVoidHitQ_v.push_back(fs->make<TH1D>(
172  Form("hVoidHitQ_%d", plane),
173  Form("RecoHit Charge (No Corresponding MCHit)) (Plane %d); Charge [ADC]; # RecoHits",
174  plane),
175  250,
176  0,
177  2000));
178 
179  hCorrQ_v.push_back(fs->make<TH2D>(
180  Form("hCorrQ_%d", plane),
181  Form("RecoHit Q vs. Closest MCHit Q (Plane %d); MCHit Charge [ADC]; RecoHit Charge [ADC]",
182  plane),
183  250,
184  0,
185  2000,
186  250,
187  0,
188  2000));
189 
190  hCorrQSum_v.push_back(
191  fs->make<TH2D>(Form("hCorrQSum_%d", plane),
192  Form("RecoHit Q vs. MCHit QSum Within Start=>End (Plane %d); MCHit Charge "
193  "[ADC]; RecoHit Charge [ADC]",
194  plane),
195  250,
196  0,
197  2000,
198  250,
199  0,
200  2000));
201 
202  hQRatio_v.push_back(
203  fs->make<TH1D>(Form("hQRatio_%d", plane),
204  Form("Reco/MCHit Charge (Plane %d); Ratio; # RecoHits", plane),
205  200,
206  0,
207  2));
208 
209  hQSumRatio_v.push_back(
210  fs->make<TH1D>(Form("hQSumRatio_%d", plane),
211  Form("Reco/MCHit Charge (Plane %d); Ratio; # RecoHits", plane),
212  200,
213  0,
214  2));
215 
216  hDT_v.push_back(fs->make<TH1D>(
217  Form("hDT_%d", plane),
218  Form("#DeltaT btw Reco and Closest MCHit (Plane %d); #DeltaT; # RecoHits", plane),
219  190,
220  -9.5,
221  9.5));
222 
223  hMCHitMultPerRecoHit_v.push_back(fs->make<TH1D>(
224  Form("hMCHitMultPerRecoHit_%d", plane),
225  Form("MCHit Multiplicity per RecoHit (Plane %d); Multiplicity; # RecoHits", plane),
226  21,
227  -1.5,
228  19.5));
229  }
230 
232  fs->make<TH1D>("hRecoHitReadTime",
233  "Real Time to Read recob::Hit From Disk; Real Time [ms]; Events",
234  200,
235  0,
236  1000);
237 
239  fs->make<TH1D>("hMCHitReadTime",
240  "Real Time to Read sim::MCHit From Disk; Real Time [ms]; Events",
241  200,
242  0,
243  1000);
244 
245  hAnalysisTime =
246  fs->make<TH1D>("hAnalysisTime",
247  "Analysis Time to Run analyze() Function; Real Time [ms]; Events",
248  200,
249  0,
250  1000);
251 
253  fs->make<TH1D>("hMCHitSearchTime",
254  "Time to Search Multiple sim::MCHit Per RecoHit; RealTime [us]; # RecoHit",
255  200,
256  0,
257  200);
258 
259  hMCHitSearchTimeSum = fs->make<TH1D>(
260  "hMCHitSearchTimeSum",
261  "Time to Search Multiple sim::MCHit for All RecoHit in Event; RealTime [ms]; # Event",
262  200,
263  0,
264  200);
265  }
TH1D * hMCHitSearchTimeSum
Time to search for corresponding MCHit per RecoHit summed over all RecoHits (per event) ...
std::vector< TH1D * > hQRatio_v
Histogram (per plane) for a ratio of RecoHit charge to the closest (in time) RecoHit charge...
cout<< "Opened file "<< fin<< " ixs= "<< ixs<< endl;if(ixs==0) hhh=(TH1F *) fff-> Get("h1")
Definition: AddMC.C:8
std::vector< TH2D * > hCorrMult_v
Histogram (per plane) for # of MCHit vs. # of RecoHit.
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.cc:6
TH1D * hMCHitReadTime
Time to read MCHit from disk.
std::vector< TH1D * > hDT_v
Histogram (per plane) for time-diff between one Reco hit and the closest (in time) RecoHit...
std::string fMCHitModuleName
Producer module for MCHit.
std::vector< TH1D * > hRecoHitMult_v
Histogram (per plane) for RecoHit multiplicity in each event.
std::vector< TH1D * > hRecoHitQ_v
Histogram (per plane) for RecoHit charge.
std::string fRecoHitModuleName
Producer module for recob::Hit.
std::vector< TH1D * > hQSumRatio_v
std::vector< TH1D * > hMCHitMultPerRecoHit_v
Histogram (per plane) for MCHit multiplicity within start=>end time region of RecoHit.
std::vector< TH2D * > hCorrQ_v
Histogram (per plane) for charge of one MCHit that is closest (in time) to one RecoHit.
TH1D * hMCHitSearchTime
Time to search for corresponding MCHit per RecoHit.
std::vector< TH1D * > hMCHitQ_v
Histogram (per plane) for all MCHit charge.
TH1D * hRecoHitReadTime
Time to read recob::Hit from disk.
std::vector< TH1D * > hMCHitMult_v
Histogram (per plane) for MCHit multiplicity in each event.
TH1D * hAnalysisTime
Time to run analyze() function.
std::vector< TH2D * > hCorrQSum_v
Histogram (per plane) for charge sum of multiple MCHit found within start=>end time of one RecoHit...
std::vector< TH1D * > hVoidHitQ_v
Histogram (per plane) for charge of some RecoHit that has no corresponding MCHit. ...

Member Function Documentation

void hit::MCHitAnaExample::analyze ( art::Event const &  e)
overrideprivatevirtual

Implements art::EDAnalyzer.

Definition at line 267 of file MCHitAnaExample_module.cc.

References DEFINE_ART_MODULE, fAnaWatch, fMCHitModuleName, fReadWatch, fRecoHitModuleName, fSearchWatch, Get, art::ProductRetriever::getValidHandle(), hAnalysisTime, hCorrMult_v, hCorrQ_v, hCorrQSum_v, hDT_v, hMCHitMult_v, hMCHitMultPerRecoHit_v, hMCHitQ_v, hMCHitReadTime, hMCHitSearchTime, hMCHitSearchTimeSum, hQRatio_v, hQSumRatio_v, hRecoHitMult_v, hRecoHitQ_v, hRecoHitReadTime, hVoidHitQ_v, sim::MCHit::PeakTime(), and sim::MCHit::SetTime().

268  {
269  fAnaWatch.Start();
270 
271  auto const& wireReadoutGeom = art::ServiceHandle<geo::WireReadout const>()->Get();
272  auto const clock_data = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(e);
273 
274  fReadWatch.Start();
275  auto const& mchits_v = *e.getValidHandle<std::vector<sim::MCHitCollection>>(fMCHitModuleName);
276  hMCHitReadTime->Fill(fReadWatch.RealTime() * 1.e3);
277 
278  fReadWatch.Start();
279  auto const& recohits = *e.getValidHandle<std::vector<recob::Hit>>(fRecoHitModuleName);
280  hRecoHitReadTime->Fill(fReadWatch.RealTime() * 1.e3);
281 
282  //
283  // Work on purely MCHit info
284  //
285  std::vector<size_t> mchit_mult(wireReadoutGeom.Nplanes(), 0);
286  for (auto const& mchits : mchits_v) {
287  auto plane = wireReadoutGeom.ChannelToWire(mchits.Channel()).at(0).Plane;
288  mchit_mult.at(plane) += mchits.size();
289 
290  for (auto const& mchit : mchits)
291  hMCHitQ_v.at(plane)->Fill(mchit.Charge(true));
292  }
293 
294  std::vector<size_t> recohit_mult(wireReadoutGeom.Nplanes(), 0);
295 
296  double search_time_sum = 0;
297 
298  // Loop over RecoHit
299  for (size_t hit_index = 0; hit_index < recohits.size(); ++hit_index) {
300  auto const& hit = recohits.at(hit_index);
301 
302  auto const& wire_id = hit.WireID();
303 
304  // Fill purly RecoHit info
305  hRecoHitQ_v.at(wire_id.Plane)->Fill(hit.PeakAmplitude());
306  recohit_mult.at(wire_id.Plane) += 1;
307 
308  // Figure out channel & retrieve MCHitCollection for this channel
309  auto ch = wireReadoutGeom.PlaneWireToChannel(wire_id);
310 
311  if (mchits_v.size() <= ch)
312  throw cet::exception(__PRETTY_FUNCTION__)
313  << "Channel " << ch << " not found in MCHit vector!" << std::endl;
314 
315  // Found MCHitCollection
316  auto const& mchits = mchits_v.at(ch);
317 
318  if (ch != mchits.Channel())
319  throw cet::exception(__PRETTY_FUNCTION__)
320  << "MCHit channel & vector index mismatch: " << mchits.Channel() << " != " << ch
321  << std::endl;
322 
323  // Locate corresponding MCHit(s) to this RecoHit
324  sim::MCHit start_time, end_time, peak_time;
325 
326  start_time.SetTime(clock_data.TPCTick2TDC(hit.PeakTimeMinusRMS()), 0);
327  peak_time.SetTime(clock_data.TPCTick2TDC(hit.PeakTime()), 0);
328  end_time.SetTime(clock_data.TPCTick2TDC(hit.PeakTimePlusRMS()), 0);
329 
330  fSearchWatch.Start();
331  auto start_iter = std::lower_bound(mchits.begin(), mchits.end(), start_time);
332  auto end_iter = std::upper_bound(mchits.begin(), mchits.end(), end_time);
333  search_time_sum += fSearchWatch.RealTime() * 1.e3;
334  hMCHitSearchTime->Fill(fSearchWatch.RealTime() * 1.e6);
335 
336  double reco_q = hit.PeakAmplitude();
337  double mc_qsum = 0;
338  double mc_q = 0;
339  double mult = 0;
340  double dt_min = 0;
341  double abs_dt_min = 1e9;
342 
343  // Loop over MCHit(s) that reside in start=>end time of MCHit
344  while (start_iter != end_iter) {
345  mc_qsum += (*start_iter).Charge(true);
346  ++mult;
347  double dt = (*start_iter).PeakTime() - peak_time.PeakTime();
348  double abs_dt = dt;
349  if (abs_dt < 0) abs_dt *= -1;
350 
351  if (abs_dt < abs_dt_min) {
352  abs_dt_min = abs_dt;
353  dt_min = dt;
354  mc_q = (*start_iter).Charge(true);
355  }
356  ++start_iter;
357  }
358 
359  // Fill histograms
360  hMCHitMultPerRecoHit_v.at(wire_id.Plane)->Fill(mult);
361 
362  if (!mc_qsum)
363  hVoidHitQ_v.at(wire_id.Plane)->Fill(reco_q);
364 
365  else {
366 
367  hRecoHitQ_v.at(wire_id.Plane)->Fill(reco_q);
368  hCorrQ_v.at(wire_id.Plane)->Fill(mc_q, reco_q);
369  hCorrQSum_v.at(wire_id.Plane)->Fill(mc_qsum, reco_q);
370  hQSumRatio_v.at(wire_id.Plane)->Fill(reco_q / mc_qsum);
371  hQRatio_v.at(wire_id.Plane)->Fill(reco_q / mc_q);
372  hDT_v.at(wire_id.Plane)->Fill(dt_min);
373  }
374 
375  } // end looping over hits
376 
377  // Fill purely-MCHit and purely-RecoHit multiplicity histograms
378  for (unsigned char plane = 0; plane < wireReadoutGeom.Nplanes(); ++plane) {
379  std::cout << mchit_mult.at(plane) << std::endl;
380  hMCHitMult_v.at(plane)->Fill(mchit_mult.at(plane));
381  hRecoHitMult_v.at(plane)->Fill(recohit_mult.at(plane));
382  hCorrMult_v.at(plane)->Fill(mchit_mult.at(plane), recohit_mult.at(plane));
383  }
384 
385  hAnalysisTime->Fill(fAnaWatch.RealTime() * 1.e3);
386  hMCHitSearchTimeSum->Fill(search_time_sum);
387  }
float PeakTime() const
Getter for start time.
Definition: MCHit.h:70
TH1D * hMCHitSearchTimeSum
Time to search for corresponding MCHit per RecoHit summed over all RecoHits (per event) ...
void SetTime(const float peak, const float width)
Setter function for time.
Definition: MCHit.h:54
std::vector< TH1D * > hQRatio_v
Histogram (per plane) for a ratio of RecoHit charge to the closest (in time) RecoHit charge...
cout<< "Opened file "<< fin<< " ixs= "<< ixs<< endl;if(ixs==0) hhh=(TH1F *) fff-> Get("h1")
Definition: AddMC.C:8
std::vector< TH2D * > hCorrMult_v
Histogram (per plane) for # of MCHit vs. # of RecoHit.
TH1D * hMCHitReadTime
Time to read MCHit from disk.
std::vector< TH1D * > hDT_v
Histogram (per plane) for time-diff between one Reco hit and the closest (in time) RecoHit...
std::string fMCHitModuleName
Producer module for MCHit.
std::vector< TH1D * > hRecoHitMult_v
Histogram (per plane) for RecoHit multiplicity in each event.
std::vector< TH1D * > hRecoHitQ_v
Histogram (per plane) for RecoHit charge.
std::string fRecoHitModuleName
Producer module for recob::Hit.
std::vector< TH1D * > hQSumRatio_v
std::vector< TH1D * > hMCHitMultPerRecoHit_v
Histogram (per plane) for MCHit multiplicity within start=>end time region of RecoHit.
Detector simulation of raw signals on wires.
std::vector< TH2D * > hCorrQ_v
Histogram (per plane) for charge of one MCHit that is closest (in time) to one RecoHit.
TH1D * hMCHitSearchTime
Time to search for corresponding MCHit per RecoHit.
std::vector< TH1D * > hMCHitQ_v
Histogram (per plane) for all MCHit charge.
TH1D * hRecoHitReadTime
Time to read recob::Hit from disk.
Float_t e
Definition: plot.C:35
std::vector< TH1D * > hMCHitMult_v
Histogram (per plane) for MCHit multiplicity in each event.
TH1D * hAnalysisTime
Time to run analyze() function.
std::vector< TH2D * > hCorrQSum_v
Histogram (per plane) for charge sum of multiple MCHit found within start=>end time of one RecoHit...
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
std::vector< TH1D * > hVoidHitQ_v
Histogram (per plane) for charge of some RecoHit that has no corresponding MCHit. ...
template<typename T , BranchType BT>
ProductToken< T > art::ModuleBase::consumes ( InputTag const &  tag)
protectedinherited

Definition at line 61 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::consumes().

62  {
63  return collector_.consumes<T, BT>(tag);
64  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
ProductToken< T > consumes(InputTag const &)
ConsumesCollector & art::ModuleBase::consumesCollector ( )
protectedinherited

Definition at line 57 of file ModuleBase.cc.

References art::ModuleBase::collector_.

58  {
59  return collector_;
60  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename T , BranchType BT>
void art::ModuleBase::consumesMany ( )
protectedinherited

Definition at line 75 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::consumesMany().

76  {
77  collector_.consumesMany<T, BT>();
78  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::ModuleBase::consumesView ( InputTag const &  )
protectedinherited
template<typename T , BranchType BT>
ViewToken<T> art::ModuleBase::consumesView ( InputTag const &  tag)
inherited

Definition at line 68 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::consumesView().

69  {
70  return collector_.consumesView<T, BT>(tag);
71  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
ViewToken< Element > consumesView(InputTag const &)
void art::detail::Analyzer::doBeginJob ( SharedResources const &  resources)
inherited

Definition at line 25 of file Analyzer.cc.

Referenced by art::detail::Analyzer::Analyzer().

26  {
27  setupQueues(resources);
28  ProcessingFrame const frame{ScheduleID{}};
29  beginJobWithFrame(frame);
30  }
virtual void beginJobWithFrame(ProcessingFrame const &)=0
virtual void setupQueues(SharedResources const &)=0
bool art::detail::Analyzer::doBeginRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited

Definition at line 68 of file Analyzer.cc.

References art::ModuleContext::scheduleID().

Referenced by art::detail::Analyzer::Analyzer().

69  {
70  ProcessingFrame const frame{mc.scheduleID()};
71  beginRunWithFrame(std::as_const(rp).makeRun(mc), frame);
72  return true;
73  }
virtual void beginRunWithFrame(Run const &, ProcessingFrame const &)=0
bool art::detail::Analyzer::doBeginSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited

Definition at line 84 of file Analyzer.cc.

References art::ModuleContext::scheduleID().

Referenced by art::detail::Analyzer::Analyzer().

85  {
86  ProcessingFrame const frame{mc.scheduleID()};
87  beginSubRunWithFrame(std::as_const(srp).makeSubRun(mc), frame);
88  return true;
89  }
virtual void beginSubRunWithFrame(SubRun const &, ProcessingFrame const &)=0
void art::detail::Analyzer::doEndJob ( )
inherited

Definition at line 33 of file Analyzer.cc.

Referenced by art::detail::Analyzer::Analyzer().

34  {
35  ProcessingFrame const frame{ScheduleID{}};
36  endJobWithFrame(frame);
37  }
virtual void endJobWithFrame(ProcessingFrame const &)=0
bool art::detail::Analyzer::doEndRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited

Definition at line 76 of file Analyzer.cc.

References art::ModuleContext::scheduleID().

Referenced by art::detail::Analyzer::Analyzer().

77  {
78  ProcessingFrame const frame{mc.scheduleID()};
79  endRunWithFrame(std::as_const(rp).makeRun(mc), frame);
80  return true;
81  }
virtual void endRunWithFrame(Run const &, ProcessingFrame const &)=0
bool art::detail::Analyzer::doEndSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited

Definition at line 92 of file Analyzer.cc.

References art::ModuleContext::scheduleID().

Referenced by art::detail::Analyzer::Analyzer().

93  {
94  ProcessingFrame const frame{mc.scheduleID()};
95  endSubRunWithFrame(std::as_const(srp).makeSubRun(mc), frame);
96  return true;
97  }
virtual void endSubRunWithFrame(SubRun const &, ProcessingFrame const &)=0
bool art::detail::Analyzer::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 
)
inherited

Definition at line 100 of file Analyzer.cc.

References e, and art::ModuleContext::scheduleID().

Referenced by art::detail::Analyzer::Analyzer().

105  {
106  auto const e = std::as_const(ep).makeEvent(mc);
107  if (wantEvent(mc.scheduleID(), e)) {
108  ++counts_run;
109  ProcessingFrame const frame{mc.scheduleID()};
110  analyzeWithFrame(e, frame);
111  ++counts_passed;
112  }
113  return true;
114  }
bool wantEvent(ScheduleID id, Event const &e) const
Definition: Observer.cc:63
Float_t e
Definition: plot.C:35
virtual void analyzeWithFrame(Event const &, ProcessingFrame const &)=0
void art::detail::Analyzer::doRespondToCloseInputFile ( FileBlock const &  fb)
inherited

Definition at line 47 of file Analyzer.cc.

Referenced by art::detail::Analyzer::Analyzer().

48  {
49  ProcessingFrame const frame{ScheduleID{}};
51  }
TFile fb("Li6.root")
virtual void respondToCloseInputFileWithFrame(FileBlock const &, ProcessingFrame const &)=0
void art::detail::Analyzer::doRespondToCloseOutputFiles ( FileBlock const &  fb)
inherited

Definition at line 61 of file Analyzer.cc.

Referenced by art::detail::Analyzer::Analyzer().

62  {
63  ProcessingFrame const frame{ScheduleID{}};
65  }
virtual void respondToCloseOutputFilesWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void art::detail::Analyzer::doRespondToOpenInputFile ( FileBlock const &  fb)
inherited

Definition at line 40 of file Analyzer.cc.

Referenced by art::detail::Analyzer::Analyzer().

41  {
42  ProcessingFrame const frame{ScheduleID{}};
44  }
TFile fb("Li6.root")
virtual void respondToOpenInputFileWithFrame(FileBlock const &, ProcessingFrame const &)=0
void art::detail::Analyzer::doRespondToOpenOutputFiles ( FileBlock const &  fb)
inherited

Definition at line 54 of file Analyzer.cc.

Referenced by art::detail::Analyzer::Analyzer().

55  {
56  ProcessingFrame const frame{ScheduleID{}};
58  }
virtual void respondToOpenOutputFilesWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
std::array< std::vector< ProductInfo >, NumBranchTypes > const & art::ModuleBase::getConsumables ( ) const
inherited

Definition at line 43 of file ModuleBase.cc.

References art::ModuleBase::collector_, and art::ConsumesCollector::getConsumables().

44  {
45  return collector_.getConsumables();
46  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables() const
Handle< TriggerResults > art::Observer::getTriggerResults ( Event const &  e) const
protectedinherited

Definition at line 75 of file Observer.cc.

References art::ProductRetriever::get(), and art::Observer::selectors_.

Referenced by art::OutputModule::doWriteEvent(), and art::Observer::wantAllEvents().

76  {
77  if (selectors_) {
78  return selectors_->getOneTriggerResults(e);
79  }
80 
81  // The following applies for cases where no SelectEvents entries
82  // exist.
83  Handle<TriggerResults> h;
84  if (e.get(empty_process_name, h)) {
85  return h;
86  }
87  return Handle<TriggerResults>{};
88  }
Float_t e
Definition: plot.C:35
std::optional< detail::ProcessAndEventSelectors > selectors_
Definition: Observer.h:79
std::unique_ptr< Worker > art::ModuleBase::makeWorker ( WorkerParams const &  wp)
inherited

Definition at line 37 of file ModuleBase.cc.

References art::ModuleBase::doMakeWorker(), and art::NumBranchTypes.

38  {
39  return doMakeWorker(wp);
40  }
virtual std::unique_ptr< Worker > doMakeWorker(WorkerParams const &wp)=0
template<typename T , BranchType BT>
ProductToken< T > art::ModuleBase::mayConsume ( InputTag const &  tag)
protectedinherited

Definition at line 82 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::mayConsume().

83  {
84  return collector_.mayConsume<T, BT>(tag);
85  }
ProductToken< T > mayConsume(InputTag const &)
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename T , BranchType BT>
void art::ModuleBase::mayConsumeMany ( )
protectedinherited

Definition at line 96 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::mayConsumeMany().

97  {
98  collector_.mayConsumeMany<T, BT>();
99  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::ModuleBase::mayConsumeView ( InputTag const &  )
protectedinherited
template<typename T , BranchType BT>
ViewToken<T> art::ModuleBase::mayConsumeView ( InputTag const &  tag)
inherited

Definition at line 89 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::mayConsumeView().

90  {
91  return collector_.mayConsumeView<T, BT>(tag);
92  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
ViewToken< Element > mayConsumeView(InputTag const &)
ModuleDescription const & art::ModuleBase::moduleDescription ( ) const
inherited

Definition at line 13 of file ModuleBase.cc.

References art::errors::LogicError.

Referenced by art::OutputModule::doRespondToOpenInputFile(), art::OutputModule::doWriteEvent(), art::Modifier::fillProductDescriptions(), art::OutputModule::makePlugins_(), art::OutputWorker::OutputWorker(), reco::shower::LArPandoraModularShowerCreation::produce(), art::Modifier::registerProducts(), and art::OutputModule::registerProducts().

14  {
15  if (md_.has_value()) {
16  return *md_;
17  }
18 
20  "There was an error while calling moduleDescription().\n"}
21  << "The moduleDescription() base-class member function cannot be called\n"
22  "during module construction. To determine which module is "
23  "responsible\n"
24  "for calling it, find the '<module type>:<module "
25  "label>@Construction'\n"
26  "tag in the message prefix above. Please contact artists@fnal.gov\n"
27  "for guidance.\n";
28  }
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::optional< ModuleDescription > md_
Definition: ModuleBase.h:55
string const & art::Observer::processName ( ) const
protectedinherited

Definition at line 57 of file Observer.cc.

References art::Observer::process_name_.

Referenced by art::FileDumperOutput::printPrincipal().

58  {
59  return process_name_;
60  }
std::string process_name_
Definition: Observer.h:76
void art::ModuleBase::setModuleDescription ( ModuleDescription const &  md)
inherited

Definition at line 31 of file ModuleBase.cc.

References art::ModuleBase::md_.

32  {
33  md_ = md;
34  }
std::optional< ModuleDescription > md_
Definition: ModuleBase.h:55
void art::ModuleBase::sortConsumables ( std::string const &  current_process_name)
inherited

Definition at line 49 of file ModuleBase.cc.

References art::ModuleBase::collector_, and art::ConsumesCollector::sortConsumables().

50  {
51  // Now that we know we have seen all the consumes declarations,
52  // sort the results for fast lookup later.
53  collector_.sortConsumables(current_process_name);
54  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
void sortConsumables(std::string const &current_process_name)
bool art::Observer::wantAllEvents ( ) const
inlineprotectednoexceptinherited

Definition at line 31 of file Observer.h.

References e, art::Observer::getTriggerResults(), art::Observer::wantAllEvents_, and art::Observer::wantEvent().

32  {
33  return wantAllEvents_;
34  }
bool wantAllEvents_
Definition: Observer.h:75
bool art::Observer::wantEvent ( ScheduleID  id,
Event const &  e 
) const
protectedinherited

Definition at line 63 of file Observer.cc.

References art::Observer::rejectors_, art::Observer::selectors_, and art::Observer::wantAllEvents_.

Referenced by art::OutputModule::doEvent(), art::OutputModule::doWriteEvent(), and art::Observer::wantAllEvents().

64  {
65  if (wantAllEvents_) {
66  return true;
67  }
68  bool const select_event = selectors_ ? selectors_->matchEvent(id, e) : true;
69  bool const reject_event =
70  rejectors_ ? rejectors_->matchEvent(id, e) : false;
71  return select_event and not reject_event;
72  }
bool wantAllEvents_
Definition: Observer.h:75
std::optional< detail::ProcessAndEventSelectors > rejectors_
Definition: Observer.h:80
Float_t e
Definition: plot.C:35
std::optional< detail::ProcessAndEventSelectors > selectors_
Definition: Observer.h:79

Member Data Documentation

TStopwatch hit::MCHitAnaExample::fAnaWatch
private

Definition at line 48 of file MCHitAnaExample_module.cc.

Referenced by analyze().

std::string hit::MCHitAnaExample::fMCHitModuleName
private

Producer module for MCHit.

Definition at line 43 of file MCHitAnaExample_module.cc.

Referenced by analyze(), and MCHitAnaExample().

TStopwatch hit::MCHitAnaExample::fReadWatch
private

Definition at line 48 of file MCHitAnaExample_module.cc.

Referenced by analyze().

std::string hit::MCHitAnaExample::fRecoHitModuleName
private

Producer module for recob::Hit.

Definition at line 40 of file MCHitAnaExample_module.cc.

Referenced by analyze(), and MCHitAnaExample().

TStopwatch hit::MCHitAnaExample::fSearchWatch
private

Definition at line 48 of file MCHitAnaExample_module.cc.

Referenced by analyze().

TH1D* hit::MCHitAnaExample::hAnalysisTime
private

Time to run analyze() function.

Definition at line 61 of file MCHitAnaExample_module.cc.

Referenced by analyze(), and MCHitAnaExample().

std::vector<TH2D*> hit::MCHitAnaExample::hCorrMult_v
private

Histogram (per plane) for # of MCHit vs. # of RecoHit.

Definition at line 94 of file MCHitAnaExample_module.cc.

Referenced by analyze(), and MCHitAnaExample().

std::vector<TH2D*> hit::MCHitAnaExample::hCorrQ_v
private

Histogram (per plane) for charge of one MCHit that is closest (in time) to one RecoHit.

Definition at line 100 of file MCHitAnaExample_module.cc.

Referenced by analyze(), and MCHitAnaExample().

std::vector<TH2D*> hit::MCHitAnaExample::hCorrQSum_v
private

Histogram (per plane) for charge sum of multiple MCHit found within start=>end time of one RecoHit.

Definition at line 103 of file MCHitAnaExample_module.cc.

Referenced by analyze(), and MCHitAnaExample().

std::vector<TH1D*> hit::MCHitAnaExample::hDT_v
private

Histogram (per plane) for time-diff between one Reco hit and the closest (in time) RecoHit.

Definition at line 115 of file MCHitAnaExample_module.cc.

Referenced by analyze(), and MCHitAnaExample().

std::vector<TH1D*> hit::MCHitAnaExample::hMCHitMult_v
private

Histogram (per plane) for MCHit multiplicity in each event.

Definition at line 77 of file MCHitAnaExample_module.cc.

Referenced by analyze(), and MCHitAnaExample().

std::vector<TH1D*> hit::MCHitAnaExample::hMCHitMultPerRecoHit_v
private

Histogram (per plane) for MCHit multiplicity within start=>end time region of RecoHit.

Definition at line 118 of file MCHitAnaExample_module.cc.

Referenced by analyze(), and MCHitAnaExample().

std::vector<TH1D*> hit::MCHitAnaExample::hMCHitQ_v
private

Histogram (per plane) for all MCHit charge.

Definition at line 74 of file MCHitAnaExample_module.cc.

Referenced by analyze(), and MCHitAnaExample().

TH1D* hit::MCHitAnaExample::hMCHitReadTime
private

Time to read MCHit from disk.

Definition at line 58 of file MCHitAnaExample_module.cc.

Referenced by analyze(), and MCHitAnaExample().

TH1D* hit::MCHitAnaExample::hMCHitSearchTime
private

Time to search for corresponding MCHit per RecoHit.

Definition at line 64 of file MCHitAnaExample_module.cc.

Referenced by analyze(), and MCHitAnaExample().

TH1D* hit::MCHitAnaExample::hMCHitSearchTimeSum
private

Time to search for corresponding MCHit per RecoHit summed over all RecoHits (per event)

Definition at line 67 of file MCHitAnaExample_module.cc.

Referenced by analyze(), and MCHitAnaExample().

std::vector<TH1D*> hit::MCHitAnaExample::hQRatio_v
private

Histogram (per plane) for a ratio of RecoHit charge to the closest (in time) RecoHit charge.

Definition at line 106 of file MCHitAnaExample_module.cc.

Referenced by analyze(), and MCHitAnaExample().

std::vector<TH1D*> hit::MCHitAnaExample::hQSumRatio_v
private

Histogram (per plane) for a ratio of charge sum of multiple MCHit to one RecoHit. Multiple MCHits are found within start=>end time of RecoHit.

Definition at line 112 of file MCHitAnaExample_module.cc.

Referenced by analyze(), and MCHitAnaExample().

std::vector<TH1D*> hit::MCHitAnaExample::hRecoHitMult_v
private

Histogram (per plane) for RecoHit multiplicity in each event.

Definition at line 87 of file MCHitAnaExample_module.cc.

Referenced by analyze(), and MCHitAnaExample().

std::vector<TH1D*> hit::MCHitAnaExample::hRecoHitQ_v
private

Histogram (per plane) for RecoHit charge.

Definition at line 84 of file MCHitAnaExample_module.cc.

Referenced by analyze(), and MCHitAnaExample().

TH1D* hit::MCHitAnaExample::hRecoHitReadTime
private

Time to read recob::Hit from disk.

Definition at line 55 of file MCHitAnaExample_module.cc.

Referenced by analyze(), and MCHitAnaExample().

std::vector<TH1D*> hit::MCHitAnaExample::hVoidHitQ_v
private

Histogram (per plane) for charge of some RecoHit that has no corresponding MCHit.

Definition at line 97 of file MCHitAnaExample_module.cc.

Referenced by analyze(), and MCHitAnaExample().


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