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

Public Types

using ModuleType = EDAnalyzer
 

Public Member Functions

 EvaluateROIEff (fhicl::ParameterSet const &p)
 
 EvaluateROIEff (EvaluateROIEff const &)=delete
 
 EvaluateROIEff (EvaluateROIEff &&)=delete
 
EvaluateROIEffoperator= (EvaluateROIEff const &)=delete
 
EvaluateROIEffoperator= (EvaluateROIEff &&)=delete
 
void analyze (art::Event const &e) override
 
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 beginJob () override
 
void endJob () override
 
bool isSignalInROI (int starttick, int endtick, int maxtick, int roistart, int roiend)
 

Private Attributes

art::InputTag fWireProducerLabel
 
art::InputTag fSimulationProducerLabel
 
TH1D * h_energy [3]
 
TH1D * h_energy_roi [3]
 
TEfficiency * eff_energy [3]
 
TH1D * h_purity [3]
 
TH1D * h_purity_all
 
TH1D * h_roi [3]
 
TH1D * h1_roi_max [3]
 
TH1D * h1_roi_max_sim [3]
 
TH1D * h1_tickdiff_max [3]
 
int fCount_Roi_sig [3] = {0, 0, 0}
 
int fCount_Roi_total [3] = {0, 0, 0}
 

Detailed Description

Definition at line 48 of file EvaluateROIEff_module.cc.

Member Typedef Documentation

Definition at line 22 of file EDAnalyzer.h.

Constructor & Destructor Documentation

nnet::EvaluateROIEff::EvaluateROIEff ( fhicl::ParameterSet const &  p)
explicit

Definition at line 90 of file EvaluateROIEff_module.cc.

References fSimulationProducerLabel, and fWireProducerLabel.

91  : EDAnalyzer{p}
92  , fWireProducerLabel(p.get<art::InputTag>("WireProducerLabel", ""))
93  , fSimulationProducerLabel(p.get<art::InputTag>("SimulationProducerLabel", "largeant"))
94 // More initializers here.
95 {
96  // Call appropriate consumes<>() for any products to be retrieved by this module.
97 }
art::InputTag fSimulationProducerLabel
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.cc:6
nnet::EvaluateROIEff::EvaluateROIEff ( EvaluateROIEff const &  )
delete
nnet::EvaluateROIEff::EvaluateROIEff ( EvaluateROIEff &&  )
delete

Member Function Documentation

void nnet::EvaluateROIEff::analyze ( art::Event const &  e)
overridevirtual

Implements art::EDAnalyzer.

Definition at line 99 of file EvaluateROIEff_module.cc.

References util::abs(), fCount_Roi_sig, fCount_Roi_total, art::fill_ptr_vector(), fSimulationProducerLabel, fWireProducerLabel, lar::sparse_vector< T >::get_ranges(), art::ProductRetriever::getByLabel(), art::ProductRetriever::getValidHandle(), h1_roi_max, h1_roi_max_sim, h1_tickdiff_max, h_energy, h_energy_roi, h_purity, h_purity_all, h_roi, isSignalInROI(), and maxE.

100 {
101 
102  auto const* geo = lar::providerFrom<geo::Geometry>();
103  auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService>()->DataFor(e);
104  auto const detProp =
106  auto const& chStatus = art::ServiceHandle<lariov::ChannelStatusService>()->GetProvider();
107 
108  art::Handle<std::vector<recob::Wire>> wireListHandle;
109  std::vector<art::Ptr<recob::Wire>> wires;
110  if (e.getByLabel(fWireProducerLabel, wireListHandle)) {
111  art::fill_ptr_vector(wires, wireListHandle);
112  }
113 
114  auto simChannelHandle = e.getValidHandle<std::vector<sim::SimChannel>>(fSimulationProducerLabel);
115 
116  // efficiency: according to each simulated energy deposit
117  // ... Loop over simChannels
118  for (auto const& channel : (*simChannelHandle)) {
119 
120  // .. get simChannel channel number
121  const raw::ChannelID_t ch1 = channel.Channel();
122  if (chStatus.IsBad(ch1)) continue;
123 
124  if (ch1 % 1000 == 0) mf::LogInfo("EvaluateROIEFF") << ch1;
125  int view = geo->View(ch1);
126  auto const& timeSlices = channel.TDCIDEMap();
127 
128  // time slice from simChannel is for individual tick
129  // group neighboring time slices into a "signal"
130  int tdctick_previous = -999;
131  double totalE = 0.;
132  double maxE = -999.;
133  int maxEtick = -999;
134  std::vector<int> signal_starttick;
135  std::vector<int> signal_endtick;
136  std::vector<double> signal_energydeposits;
137  std::vector<double> signal_energy_max;
138  std::vector<double> signal_max_tdctick;
139 
140  for (auto const& timeSlice : timeSlices) {
141  auto const tpctime = timeSlice.first;
142  auto const& energyDeposits = timeSlice.second;
143  int tdctick = static_cast<int>(clockData.TPCTDC2Tick(double(tpctime)));
144  if (tdctick < 0 || tdctick > int(detProp.ReadOutWindowSize()) - 1) continue;
145 
146  // for a time slice, there may exist more than one energy deposit.
147  double e_deposit = 0;
148  for (auto const& energyDeposit : energyDeposits) {
149  e_deposit += energyDeposit.energy;
150  }
151 
152  if (tdctick_previous == -999) {
153  signal_starttick.push_back(tdctick);
154  totalE += e_deposit;
155  maxE = e_deposit;
156  maxEtick = tdctick;
157  }
158  else if (tdctick - tdctick_previous != 1) {
159  signal_starttick.push_back(tdctick);
160  signal_endtick.push_back(tdctick_previous);
161  signal_energydeposits.push_back(totalE);
162  signal_energy_max.push_back(maxE);
163  signal_max_tdctick.push_back(maxEtick);
164  totalE = e_deposit;
165  maxE = e_deposit;
166  maxEtick = tdctick;
167  }
168  else if (tdctick - tdctick_previous == 1) {
169  totalE += e_deposit;
170  if (maxE < e_deposit) {
171  maxE = e_deposit;
172  maxEtick = tdctick;
173  }
174  }
175 
176  tdctick_previous = tdctick;
177 
178  } // loop over timeSlices timeSlice
179 
180  signal_endtick.push_back(tdctick_previous); // for last one
181  signal_energydeposits.push_back(totalE); // for last one
182  signal_energy_max.push_back(maxE); // for last one
183  signal_max_tdctick.push_back(maxEtick); // for last one
184 
185  if (signal_starttick.size() == 0 ||
186  (signal_endtick.size() == 1 && signal_endtick.back() == -999))
187  continue;
188 
189  for (auto& wire : wires) {
190  if (wire->Channel() != ch1) continue;
191 
192  const recob::Wire::RegionsOfInterest_t& signalROI = wire->SignalROI();
193 
194  std::vector<float> vecADC =
195  wire->Signal(); // a zero-padded full length vector filled with RoI signal.
196 
197  // loop over signals:
198  // a) if signal s is not in any ROI (including the case no ROI), fill h_energy
199  // with signal_energy_max[s];
200  // b) if signal s is in a ROI, check following signals that are also in this ROI,
201  // then use the maximum of signal_energy_max to fill h_energy and h_energy_roi.
202  // After this, the loop will skip to the signal that is not in this ROI.
203  for (size_t s = 0; s < signal_starttick.size(); s++) {
204  // case a: signal is not in any ROI
205  bool IsSignalOutside = true;
206  for (const auto& range : signalROI.get_ranges()) {
207  //const auto& waveform = range.data();
208  raw::TDCtick_t roiFirstBinTick = range.begin_index();
209  raw::TDCtick_t roiLastBinTick = range.end_index();
210 
211  if (isSignalInROI(signal_starttick[s],
212  signal_endtick[s],
213  signal_max_tdctick[s],
214  roiFirstBinTick,
215  roiLastBinTick)) {
216  IsSignalOutside = false;
217  break;
218  }
219  } // loop over range
220 
221  if (IsSignalOutside) {
222  //cout << "This signal is not in any ROI: " << signal_starttick[s] << " -> " << signal_endtick[s] << endl;
223  h_energy[view]->Fill(signal_energy_max[s]);
224  h1_tickdiff_max[view]->Fill(-99);
225  continue;
226  }
227 
228  // signal is in one ROI
229  for (const auto& range : signalROI.get_ranges()) {
230  //const auto& waveform = range.data();
231  raw::TDCtick_t roiFirstBinTick = range.begin_index();
232  raw::TDCtick_t roiLastBinTick = range.end_index();
233 
234  if (isSignalInROI(signal_starttick[s],
235  signal_endtick[s],
236  signal_max_tdctick[s],
237  roiFirstBinTick,
238  roiLastBinTick)) {
239  // maximum pulse height and postion for this ROI
240  double maxadc_sig = 0;
241  int maxadc_tick = -99;
242  for (int k = roiFirstBinTick; k < roiLastBinTick; k++) {
243  if (vecADC[k] > maxadc_sig) {
244  maxadc_sig = vecADC[k];
245  maxadc_tick = k;
246  }
247  }
248 
249  double maxE_roi = -999.;
250  double maxE_roi_tick = -999.;
251 
252  if (maxE_roi < signal_energy_max[s]) {
253  maxE_roi = signal_energy_max[s];
254  maxE_roi_tick = signal_max_tdctick[s];
255  }
256 
257  // check the following signals in the same ROI
258  for (size_t s2 = s + 1; s2 < signal_starttick.size(); s2++) {
259  if (isSignalInROI(signal_starttick[s2],
260  signal_endtick[s2],
261  signal_max_tdctick[s2],
262  roiFirstBinTick,
263  roiLastBinTick)) {
264  if (maxE_roi < signal_energy_max[s2]) {
265  maxE_roi = signal_energy_max[s2];
266  maxE_roi_tick = signal_max_tdctick[s2];
267  }
268  if (s2 == signal_starttick.size() - 1) { s = s2; }
269  }
270  else {
271  s = s2 - 1;
272  break;
273  }
274  } // loop over s2
275 
276  // finish this ROI
277  h_energy[view]->Fill(maxE_roi);
278  h_energy_roi[view]->Fill(maxE_roi);
279  h1_tickdiff_max[view]->Fill(maxE_roi_tick - maxadc_tick);
280  break;
281  } // isSignalInROI
282  } // loop over range
283 
284  } // loop over signals s
285  } // loop over wires wire
286  } // loop simChannels
287 
288  // purity: # signals in ROI / (#signals in ROI + #non-signals in ROI). Because we only consider the maximum signal in the ROI, this is quivalent to purity of ( number of ROIs with signal / number of ROIs)
289  double roi_sig[3] = {0., 0., 0.}; // number of roi contains signal in an event
290  double roi_total[3] = {0., 0., 0.}; // number of roi in an event
291 
292  for (auto& wire : wires) {
293  const raw::ChannelID_t wirechannel = wire->Channel();
294  if (chStatus.IsBad(wirechannel)) continue;
295 
296  int view = wire->View();
297 
298  const recob::Wire::RegionsOfInterest_t& signalROI = wire->SignalROI();
299 
300  if (signalROI.get_ranges().empty()) continue;
301 
302  std::vector<float> vecADC =
303  wire->Signal(); // a zero-padded full length vector filled with RoI signal.
304 
305  roi_total[view] += signalROI.get_ranges().size();
306  fCount_Roi_total[view] += signalROI.get_ranges().size();
307 
308  for (const auto& range : signalROI.get_ranges()) {
309  bool IsSigROI = false;
310 
311  raw::TDCtick_t roiFirstBinTick = range.begin_index();
312  raw::TDCtick_t roiLastBinTick = range.end_index();
313 
314  double maxadc_sig = -99.;
315  for (int k = roiFirstBinTick; k < roiLastBinTick; k++) {
316  if (std::abs(vecADC[k]) > maxadc_sig) maxadc_sig = std::abs(vecADC[k]);
317  }
318  h1_roi_max[view]->Fill(maxadc_sig);
319 
320  // check simulation: ideally we could put this part outside loop over range to make the algorithm more efficient. However, as there are only one or two ROIs in a channel for most of cases, we keep this style to make the algorithm more readable. Also, signal information are kept here.
321  for (auto const& channel : (*simChannelHandle)) {
322  if (wirechannel != channel.Channel()) continue;
323 
324  int tdctick_previous = -999;
325  double totalE = 0.;
326  double maxE = -999.;
327  int maxEtick = -999;
328  std::vector<int> signal_starttick;
329  std::vector<int> signal_endtick;
330  std::vector<double> signal_energydeposits;
331  std::vector<double> signal_energy_max;
332  std::vector<double> signal_max_tdctick;
333 
334  auto const& timeSlices = channel.TDCIDEMap();
335 
336  for (auto const& timeSlice : timeSlices) {
337  auto const tpctime = timeSlice.first;
338  auto const& energyDeposits = timeSlice.second;
339  int tdctick = static_cast<int>(clockData.TPCTDC2Tick(double(tpctime)));
340  if (tdctick < 0 || tdctick > int(detProp.ReadOutWindowSize()) - 1) continue;
341 
342  double e_deposit = 0;
343  for (auto const& energyDeposit : energyDeposits) {
344  e_deposit += energyDeposit.energy;
345  }
346 
347  if (tdctick_previous == -999) {
348  signal_starttick.push_back(tdctick);
349  totalE += e_deposit;
350  maxE = e_deposit;
351  maxEtick = tdctick;
352  }
353  else if (tdctick - tdctick_previous != 1) {
354  signal_starttick.push_back(tdctick);
355  signal_endtick.push_back(tdctick_previous);
356  signal_energydeposits.push_back(totalE);
357  signal_energy_max.push_back(maxE);
358  signal_max_tdctick.push_back(maxEtick);
359  totalE = e_deposit;
360  maxE = e_deposit;
361  maxEtick = tdctick;
362  }
363  else if (tdctick - tdctick_previous == 1) {
364  totalE += e_deposit;
365  if (maxE < e_deposit) {
366  maxE = e_deposit;
367  maxEtick = tdctick;
368  }
369  }
370 
371  tdctick_previous = tdctick;
372 
373  } // loop over timeSlices timeSlice
374 
375  signal_endtick.push_back(tdctick_previous); // for last one
376  signal_energydeposits.push_back(totalE); // for last one
377  signal_energy_max.push_back(maxE); // for last one
378  signal_max_tdctick.push_back(maxEtick); // for last one
379 
380  if (signal_starttick.size() == 0 ||
381  (signal_endtick.size() == 1 && signal_endtick.back() == -999))
382  continue;
383 
384  // check if signal/signals in this ROI
385  for (size_t s = 0; s < signal_starttick.size(); s++) {
386  if (isSignalInROI(signal_starttick[s],
387  signal_endtick[s],
388  signal_max_tdctick[s],
389  roiFirstBinTick,
390  roiLastBinTick)) {
391  IsSigROI = true;
392  break;
393  }
394  } // loop over s
395  } // loop simChannels
396 
397  h_roi[view]->Fill(0); // total roi
398  if (IsSigROI) {
399  roi_sig[view] += 1.;
400  fCount_Roi_sig[view] += 1;
401  h_roi[view]->Fill(1); // sig roi
402  h1_roi_max_sim[view]->Fill(maxadc_sig);
403  }
404  } // loop ranges of signalROI
405  } // loop wires
406 
407  // purity of each plane for each event
408  for (int i = 0; i < 3; i++) {
409  if (roi_total[i]) {
410  double purity = roi_sig[i] / roi_total[i];
411  if (purity == 1) purity = 1. - 1.e-6;
412  h_purity[i]->Fill(purity);
413  }
414  }
415 
416  // combined purity for each event
417  if (roi_total[0] + roi_total[1] + roi_total[2]) {
418  double purity =
419  (roi_sig[0] + roi_sig[1] + roi_sig[2]) / (roi_total[0] + roi_total[1] + roi_total[2]);
420  if (purity == 1) purity = 1. - 1.e-6;
421  h_purity_all->Fill(purity);
422  }
423 }
art::InputTag fSimulationProducerLabel
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
constexpr auto abs(T v)
Returns the absolute value of the argument.
const range_list_t & get_ranges() const
Returns the internal list of non-void ranges.
int TDCtick_t
Type representing a TDC tick.
Definition: RawTypes.h:25
bool isSignalInROI(int starttick, int endtick, int maxtick, int roistart, int roiend)
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:306
double maxE
Definition: plot_hist.C:8
Float_t e
Definition: plot.C:35
Namespace collecting geometry-related classes utilities.
void nnet::EvaluateROIEff::beginJob ( )
overrideprivatevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 425 of file EvaluateROIEff_module.cc.

References h1_roi_max, h1_roi_max_sim, h1_tickdiff_max, h_energy, h_energy_roi, h_purity, h_purity_all, and h_roi.

426 {
427 
429 
430  for (int i = 0; i < 3; ++i) {
431  h_energy[i] =
432  tfs->make<TH1D>(Form("h_energy_%d", i), Form("Plane %d; Energy (MeV);", i), 100, 0, 1);
433  h_energy_roi[i] =
434  tfs->make<TH1D>(Form("h_energy_roi_%d", i), Form("Plane %d; Energy (MeV);", i), 100, 0, 1);
435 
436  h_purity[i] = tfs->make<TH1D>(Form("h_purity_%d", i), Form("Plane %d; Purity;", i), 20, 0, 1);
437  h_roi[i] = tfs->make<TH1D>(Form("h_roi_%d", i),
438  Form("Plane %d; Purity;", i),
439  5,
440  0,
441  5); // index 0: total rois; index 1: total sig rois
442 
443  h1_roi_max[i] =
444  tfs->make<TH1D>(Form("h1_roi_max_%d", i), Form("Plane %d; Max adc;", i), 50, 0, 50);
445  h1_roi_max_sim[i] =
446  tfs->make<TH1D>(Form("h1_roi_max_sim_%d", i), Form("Plane %d; Max adc;", i), 50, 0, 50);
447 
448  h1_tickdiff_max[i] = tfs->make<TH1D>(Form("h1_tickdiff_max_%d", i),
449  Form("Plane %d; tick diff (maxE - max pulse);", i),
450  100,
451  -50,
452  50);
453  }
454 
455  h_purity_all = tfs->make<TH1D>("h_purity_all", "All Planes; Purity;", 20, 0, 1);
456 }
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")
void nnet::EvaluateROIEff::endJob ( )
overrideprivatevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 458 of file EvaluateROIEff_module.cc.

References eff_energy, h_energy, and h_energy_roi.

459 {
461 
462  for (int i = 0; i < 3; ++i) {
463  if (TEfficiency::CheckConsistency(*(h_energy_roi[i]), *(h_energy[i]))) {
464  eff_energy[i] = tfs->make<TEfficiency>(*(h_energy_roi[i]), *(h_energy[i]));
465  eff_energy[i]->Write(Form("eff_energy_%d", i));
466  }
467  }
468 }
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
bool nnet::EvaluateROIEff::isSignalInROI ( int  starttick,
int  endtick,
int  maxtick,
int  roistart,
int  roiend 
)
private

Definition at line 470 of file EvaluateROIEff_module.cc.

References DEFINE_ART_MODULE.

Referenced by analyze().

475 {
476  // For a signal in the ROI, two cases are considered:
477  // (i) signal is totally in the ROI
478  // (ii) signal is partially in the ROI
479  // Equivalently, we can just check whether the maxtick is in the ROI (simple one).
480  return roistart <= maxtick && maxtick < roiend;
481 }
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
EvaluateROIEff& nnet::EvaluateROIEff::operator= ( EvaluateROIEff const &  )
delete
EvaluateROIEff& nnet::EvaluateROIEff::operator= ( EvaluateROIEff &&  )
delete
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

TEfficiency* nnet::EvaluateROIEff::eff_energy[3]
private

Definition at line 75 of file EvaluateROIEff_module.cc.

Referenced by endJob().

int nnet::EvaluateROIEff::fCount_Roi_sig[3] = {0, 0, 0}
private

Definition at line 86 of file EvaluateROIEff_module.cc.

Referenced by analyze().

int nnet::EvaluateROIEff::fCount_Roi_total[3] = {0, 0, 0}
private

Definition at line 87 of file EvaluateROIEff_module.cc.

Referenced by analyze().

art::InputTag nnet::EvaluateROIEff::fSimulationProducerLabel
private

Definition at line 70 of file EvaluateROIEff_module.cc.

Referenced by analyze(), and EvaluateROIEff().

art::InputTag nnet::EvaluateROIEff::fWireProducerLabel
private

Definition at line 68 of file EvaluateROIEff_module.cc.

Referenced by analyze(), and EvaluateROIEff().

TH1D* nnet::EvaluateROIEff::h1_roi_max[3]
private

Definition at line 81 of file EvaluateROIEff_module.cc.

Referenced by analyze(), and beginJob().

TH1D* nnet::EvaluateROIEff::h1_roi_max_sim[3]
private

Definition at line 82 of file EvaluateROIEff_module.cc.

Referenced by analyze(), and beginJob().

TH1D* nnet::EvaluateROIEff::h1_tickdiff_max[3]
private

Definition at line 84 of file EvaluateROIEff_module.cc.

Referenced by analyze(), and beginJob().

TH1D* nnet::EvaluateROIEff::h_energy[3]
private

Definition at line 72 of file EvaluateROIEff_module.cc.

Referenced by analyze(), beginJob(), and endJob().

TH1D* nnet::EvaluateROIEff::h_energy_roi[3]
private

Definition at line 73 of file EvaluateROIEff_module.cc.

Referenced by analyze(), beginJob(), and endJob().

TH1D* nnet::EvaluateROIEff::h_purity[3]
private

Definition at line 77 of file EvaluateROIEff_module.cc.

Referenced by analyze(), and beginJob().

TH1D* nnet::EvaluateROIEff::h_purity_all
private

Definition at line 78 of file EvaluateROIEff_module.cc.

Referenced by analyze(), and beginJob().

TH1D* nnet::EvaluateROIEff::h_roi[3]
private

Definition at line 80 of file EvaluateROIEff_module.cc.

Referenced by analyze(), and beginJob().


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