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

Reimplemented from art::EDAnalyzer.

Definition at line 422 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.

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

References eff_energy, h_energy, and h_energy_roi.

456 {
458 
459  for (int i = 0; i < 3; ++i) {
460  if (TEfficiency::CheckConsistency(*(h_energy_roi[i]), *(h_energy[i]))) {
461  eff_energy[i] = tfs->make<TEfficiency>(*(h_energy_roi[i]), *(h_energy[i]));
462  eff_energy[i]->Write(Form("eff_energy_%d", i));
463  }
464  }
465 }
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 467 of file EvaluateROIEff_module.cc.

References DEFINE_ART_MODULE.

Referenced by analyze().

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