LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
GausHitFinder_module.cc
Go to the documentation of this file.
1 //
3 // GaussHitFinder class
4 //
5 // jaasaadi@syr.edu
6 //
7 // This algorithm is designed to find hits on wires after deconvolution.
8 // -----------------------------------
9 // This algorithm is based on the FFTHitFinder written by Brian Page,
10 // Michigan State University, for the ArgoNeuT experiment.
11 //
12 //
13 // The algorithm walks along the wire and looks for pulses above threshold
14 // The algorithm then attempts to fit n-gaussians to these pulses where n
15 // is set by the number of peaks found in the pulse
16 // If the Chi2/NDF returned is "bad" it attempts to fit n+1 gaussians to
17 // the pulse. If this is a better fit it then uses the parameters of the
18 // Gaussian fit to characterize the "hit" object
19 //
20 // To use this simply include the following in your producers:
21 // gaushit: @local::microboone_gaushitfinder
22 // gaushit: @local::argoneut_gaushitfinder
24 
25 // C/C++ standard library
26 #include <algorithm> // std::accumulate()
27 #include <atomic>
28 #include <memory> // std::unique_ptr()
29 #include <string>
30 #include <utility> // std::move()
31 
32 // Framework includes
37 #include "art/Utilities/Globals.h"
39 #include "art_root_io/TFileService.h"
41 #include "fhiclcpp/ParameterSet.h"
42 
43 // LArSoft Includes
45 #include "larcoreobj/SimpleTypesAndConstants/RawTypes.h" // raw::ChannelID_t
50 
53 
54 // ROOT Includes
55 #include "TH1F.h"
56 #include "TMath.h"
57 
58 #include "tbb/concurrent_vector.h"
59 #include "tbb/parallel_for.h"
60 
61 namespace hit {
63  public:
64  explicit GausHitFinder(fhicl::ParameterSet const& pset, art::ProcessingFrame const&);
65 
66  private:
67  void produce(art::Event& evt, art::ProcessingFrame const&) override;
68  void beginJob(art::ProcessingFrame const&) override;
69 
70  std::vector<double> FillOutHitParameterVector(const std::vector<double>& input);
71 
72  const bool fFilterHits;
73  const bool fFillHists;
74 
75  const std::string fCalDataModuleLabel;
76  const std::string fAllHitsInstanceName;
77 
78  const std::vector<int> fLongMaxHitsVec;
79  const std::vector<int> fLongPulseWidthVec;
80 
81  const size_t fMaxMultiHit;
82  const int fAreaMethod;
83  const std::vector<double>
85  const double fChi2NDF;
86 
87  const std::vector<float> fPulseHeightCuts;
88  const std::vector<float> fPulseWidthCuts;
89  const std::vector<float> fPulseRatioCuts;
90 
91  std::atomic<size_t> fEventCount{0};
92 
93  //only Standard and Morphological implementation is threadsafe.
94  std::vector<std::unique_ptr<reco_tool::ICandidateHitFinder>>
96  // only Marqdt implementation is threadsafe.
97  std::unique_ptr<reco_tool::IPeakFitter> fPeakFitterTool;
98  //HitFilterAlg implementation is threadsafe.
99  std::unique_ptr<HitFilterAlg> fHitFilterAlg;
100 
101  //only used when fFillHists is true and in single threaded mode.
102  TH1F* fFirstChi2;
103  TH1F* fChi2;
104 
105  }; // class GausHitFinder
106 
107  //-------------------------------------------------
108  //-------------------------------------------------
110  : SharedProducer{pset}
111  , fFilterHits(pset.get<bool>("FilterHits", false))
112  , fFillHists(pset.get<bool>("FillHists", false))
113  , fCalDataModuleLabel(pset.get<std::string>("CalDataModuleLabel"))
114  , fAllHitsInstanceName(pset.get<std::string>("AllHitsInstanceName", ""))
115  , fLongMaxHitsVec(pset.get<std::vector<int>>("LongMaxHits", std::vector<int>() = {25, 25, 25}))
117  pset.get<std::vector<int>>("LongPulseWidth", std::vector<int>() = {16, 16, 16}))
118  , fMaxMultiHit(pset.get<int>("MaxMultiHit"))
119  , fAreaMethod(pset.get<int>("AreaMethod"))
120  , fAreaNormsVec(FillOutHitParameterVector(pset.get<std::vector<double>>("AreaNorms")))
121  , fChi2NDF(pset.get<double>("Chi2NDF"))
123  pset.get<std::vector<float>>("PulseHeightCuts", std::vector<float>() = {3.0, 3.0, 3.0}))
124  , fPulseWidthCuts(
125  pset.get<std::vector<float>>("PulseWidthCuts", std::vector<float>() = {2.0, 1.5, 1.0}))
126  , fPulseRatioCuts(
127  pset.get<std::vector<float>>("PulseRatioCuts", std::vector<float>() = {0.35, 0.40, 0.20}))
128  {
129  if (fFillHists && art::Globals::instance()->nthreads() > 1u) {
131  << "Cannot fill histograms when multiple threads configured, please set fFillHists to "
132  "false or change number of threads to 1\n";
133  }
134  async<art::InEvent>();
135  if (fFilterHits) {
136  fHitFilterAlg = std::make_unique<HitFilterAlg>(pset.get<fhicl::ParameterSet>("HitFilterAlg"));
137  }
138 
139  // recover the tool to do the candidate hit finding
140  // Recover the vector of fhicl parameters for the ROI tools
141  const fhicl::ParameterSet& hitFinderTools = pset.get<fhicl::ParameterSet>("HitFinderToolVec");
142 
143  fHitFinderToolVec.resize(hitFinderTools.get_pset_names().size());
144 
145  for (const std::string& hitFinderTool : hitFinderTools.get_pset_names()) {
146  const fhicl::ParameterSet& hitFinderToolParamSet =
147  hitFinderTools.get<fhicl::ParameterSet>(hitFinderTool);
148  size_t planeIdx = hitFinderToolParamSet.get<size_t>("Plane");
149 
150  fHitFinderToolVec.at(planeIdx) =
151  art::make_tool<reco_tool::ICandidateHitFinder>(hitFinderToolParamSet);
152  }
153 
154  // Recover the peak fitting tool
156  art::make_tool<reco_tool::IPeakFitter>(pset.get<fhicl::ParameterSet>("PeakFitter"));
157 
158  // let HitCollectionCreator declare that we are going to produce
159  // hits and associations with wires and raw digits
160  // We want the option to output two hit collections, one filtered
161  // and one with all hits. The key to doing this will be a non-null
162  // instance name for the second collection
163  // (with no particular product label)
165  producesCollector(), fAllHitsInstanceName, true, false); //fMakeRawDigitAssns);
166 
167  // and now the filtered hits...
168  if (fAllHitsInstanceName != "")
170  producesCollector(), "", true, false); //fMakeRawDigitAssns);
171 
172  return;
173  } // GausHitFinder::GausHitFinder()
174 
175  //-------------------------------------------------
176  //-------------------------------------------------
177  std::vector<double> GausHitFinder::FillOutHitParameterVector(const std::vector<double>& input)
178  {
179  if (input.size() == 0)
180  throw std::runtime_error(
181  "GausHitFinder::FillOutHitParameterVector ERROR! Input config vector has zero size.");
182 
183  std::vector<double> output;
185  const unsigned int N_PLANES = geom->Nplanes();
186 
187  if (input.size() == 1)
188  output.resize(N_PLANES, input[0]);
189  else if (input.size() == N_PLANES)
190  output = input;
191  else
192  throw std::runtime_error("GausHitFinder::FillOutHitParameterVector ERROR! Input config "
193  "vector size !=1 and !=N_PLANES.");
194  return output;
195  }
196 
197  //-------------------------------------------------
198  //-------------------------------------------------
200  {
201  // get access to the TFile service
203 
204  // ======================================
205  // === Hit Information for Histograms ===
206  if (fFillHists) {
207  fFirstChi2 = tfs->make<TH1F>("fFirstChi2", "#chi^{2}", 10000, 0, 5000);
208  fChi2 = tfs->make<TH1F>("fChi2", "#chi^{2}", 10000, 0, 5000);
209  }
210  }
211 
212  // This algorithm uses the fact that deconvolved signals are very smooth
213  // and looks for hits as areas between local minima that have signal above
214  // threshold.
215  //-------------------------------------------------
217  {
218  unsigned int count = fEventCount.fetch_add(1);
219  //==================================================================================================
220 
221  TH1::AddDirectory(kFALSE);
222 
223  // Instantiate and Reset a stop watch
224  //TStopwatch StopWatch;
225  //StopWatch.Reset();
226 
227  // ################################
228  // ### Calling Geometry service ###
229  // ################################
231 
232  // ###############################################
233  // ### Making a ptr vector to put on the event ###
234  // ###############################################
235  // this contains the hit collection
236  // and its associations to wires and raw digits
237  recob::HitCollectionCreator allHitCol(evt, fAllHitsInstanceName, true, false);
238 
239  // Handle the filtered hits collection...
240  recob::HitCollectionCreator hcol(evt, "", true, false);
241  recob::HitCollectionCreator* filteredHitCol = 0;
242 
243  if (fFilterHits) filteredHitCol = &hcol;
244 
245  //store in a thread safe way
246  struct hitstruct {
247  recob::Hit hit_tbb;
248  art::Ptr<recob::Wire> wire_tbb;
249  };
250 
251  tbb::concurrent_vector<hitstruct> hitstruct_vec;
252  tbb::concurrent_vector<hitstruct> filthitstruct_vec;
253 
254  // if (fAllHitsInstanceName != "") filteredHitCol = &hcol;
255 
256  // ##########################################
257  // ### Reading in the Wire List object(s) ###
258  // ##########################################
260  evt.getByLabel(fCalDataModuleLabel, wireVecHandle);
261 
262  //#################################################
263  //### Set the charge determination method ###
264  //### Default is to compute the normalized area ###
265  //#################################################
266  std::function<double(double, double, double, double, int, int)> chargeFunc =
267  [](double /* peakMean */,
268  double peakAmp,
269  double peakWidth,
270  double areaNorm,
271  int /* low */,
272  int /* hi */) { return std::sqrt(2 * TMath::Pi()) * peakAmp * peakWidth / areaNorm; };
273 
274  //##############################################
275  //### Alternative is to integrate over pulse ###
276  //##############################################
277  if (fAreaMethod == 0)
278  chargeFunc = [](double peakMean,
279  double peakAmp,
280  double peakWidth,
281  double /* areaNorm */,
282  int low,
283  int hi) {
284  double charge(0);
285  for (int sigPos = low; sigPos < hi; sigPos++)
286  charge += peakAmp * TMath::Gaus(sigPos, peakMean, peakWidth);
287  return charge;
288  };
289 
290  //##############################
291  //### Looping over the wires ###
292  //##############################
293  //for(size_t wireIter = 0; wireIter < wireVecHandle->size(); wireIter++)
294  //{
295  tbb::parallel_for(
296  static_cast<std::size_t>(0),
297  wireVecHandle->size(),
298  [&](size_t& wireIter) {
299  // ####################################
300  // ### Getting this particular wire ###
301  // ####################################
302  art::Ptr<recob::Wire> wire(wireVecHandle, wireIter);
303 
304  // --- Setting Channel Number and Signal type ---
305 
306  raw::ChannelID_t channel = wire->Channel();
307 
308  // get the WireID for this hit
309  std::vector<geo::WireID> wids = geom->ChannelToWire(channel);
310  // for now, just take the first option returned from ChannelToWire
311  geo::WireID wid = wids[0];
312  // We need to know the plane to look up parameters
313  geo::PlaneID::PlaneID_t plane = wid.Plane;
314 
315  // ----------------------------------------------------------
316  // -- Setting the appropriate signal widths and thresholds --
317  // -- for the right plane. --
318  // ----------------------------------------------------------
319 
320  // #################################################
321  // ### Set up to loop over ROI's for this wire ###
322  // #################################################
323  const recob::Wire::RegionsOfInterest_t& signalROI = wire->SignalROI();
324 
325  // for (const auto& range : signalROI.get_ranges()) {
326  tbb::parallel_for(
327  static_cast<std::size_t>(0),
328  signalROI.n_ranges(),
329  [&](size_t& rangeIter) {
330  const auto& range = signalROI.range(rangeIter);
331  // ROI start time
332  raw::TDCtick_t roiFirstBinTick = range.begin_index();
333 
334  // ###########################################################
335  // ### Scan the waveform and find candidate peaks + merge ###
336  // ###########################################################
337 
340 
341  fHitFinderToolVec.at(plane)->findHitCandidates(
342  range, 0, channel, count, hitCandidateVec);
343  fHitFinderToolVec.at(plane)->MergeHitCandidates(
344  range, hitCandidateVec, mergedCandidateHitVec);
345 
346  // #######################################################
347  // ### Lets loop over the pulses we found on this wire ###
348  // #######################################################
349 
350  for (auto& mergedCands : mergedCandidateHitVec) {
351  int startT = mergedCands.front().startTick;
352  int endT = mergedCands.back().stopTick;
353 
354  // ### Putting in a protection in case things went wrong ###
355  // ### In the end, this primarily catches the case where ###
356  // ### a fake pulse is at the start of the ROI ###
357  if (endT - startT < 5) continue;
358 
359  // #######################################################
360  // ### Clearing the parameter vector for the new pulse ###
361  // #######################################################
362 
363  // === Setting the number of Gaussians to try ===
364  int nGausForFit = mergedCands.size();
365 
366  // ##################################################
367  // ### Calling the function for fitting Gaussians ###
368  // ##################################################
369  double chi2PerNDF(0.);
370  int NDF(1);
371  /*stand alone
372  reco_tool::IPeakFitter::PeakParamsVec peakParamsVec(nGausForFit);
373  */
375 
376  // #######################################################
377  // ### If # requested Gaussians is too large then punt ###
378  // #######################################################
379  if (mergedCands.size() <= fMaxMultiHit) {
380  fPeakFitterTool->findPeakParameters(
381  range.data(), mergedCands, peakParamsVec, chi2PerNDF, NDF);
382 
383  // If the chi2 is infinite then there is a real problem so we bail
384  if (!(chi2PerNDF < std::numeric_limits<double>::infinity())) {
385  chi2PerNDF = 2. * fChi2NDF;
386  NDF = 2;
387  }
388 
389  if (fFillHists) fFirstChi2->Fill(chi2PerNDF);
390  }
391 
392  // #######################################################
393  // ### If too large then force alternate solution ###
394  // ### - Make n hits from pulse train where n will ###
395  // ### depend on the fhicl parameter fLongPulseWidth ###
396  // ### Also do this if chi^2 is too large ###
397  // #######################################################
398  if (mergedCands.size() > fMaxMultiHit || nGausForFit * chi2PerNDF > fChi2NDF) {
399  int longPulseWidth = fLongPulseWidthVec.at(plane);
400  int nHitsThisPulse = (endT - startT) / longPulseWidth;
401 
402  if (nHitsThisPulse > fLongMaxHitsVec.at(plane)) {
403  nHitsThisPulse = fLongMaxHitsVec.at(plane);
404  longPulseWidth = (endT - startT) / nHitsThisPulse;
405  }
406 
407  if (nHitsThisPulse * longPulseWidth < endT - startT) nHitsThisPulse++;
408 
409  int firstTick = startT;
410  int lastTick = std::min(firstTick + longPulseWidth, endT);
411 
412  peakParamsVec.clear();
413  nGausForFit = nHitsThisPulse;
414  NDF = 1.;
415  chi2PerNDF = chi2PerNDF > fChi2NDF ? chi2PerNDF : -1.;
416 
417  for (int hitIdx = 0; hitIdx < nHitsThisPulse; hitIdx++) {
418  // This hit parameters
419  double sumADC =
420  std::accumulate(range.begin() + firstTick, range.begin() + lastTick, 0.);
421  double peakSigma = (lastTick - firstTick) / 3.; // Set the width...
422  double peakAmp = 0.3989 * sumADC / peakSigma; // Use gaussian formulation
423  double peakMean = (firstTick + lastTick) / 2.;
424 
425  // Store hit params
427 
428  peakParams.peakCenter = peakMean;
429  peakParams.peakCenterError = 0.1 * peakMean;
430  peakParams.peakSigma = peakSigma;
431  peakParams.peakSigmaError = 0.1 * peakSigma;
432  peakParams.peakAmplitude = peakAmp;
433  peakParams.peakAmplitudeError = 0.1 * peakAmp;
434 
435  peakParamsVec.push_back(peakParams);
436 
437  // set for next loop
438  firstTick = lastTick;
439  lastTick = std::min(lastTick + longPulseWidth, endT);
440  }
441  }
442 
443  // #######################################################
444  // ### Loop through returned peaks and make recob hits ###
445  // #######################################################
446 
447  int numHits(0);
448 
449  // Make a container for what will be the filtered collection
450  std::vector<recob::Hit> filteredHitVec;
451 
452  for (const auto& peakParams : peakParamsVec) {
453  // Extract values for this hit
454  float peakAmp = peakParams.peakAmplitude;
455  float peakMean = peakParams.peakCenter;
456  float peakWidth = peakParams.peakSigma;
457 
458  // Place one bit of protection here
459  if (std::isnan(peakAmp)) {
460  std::cout << "**** hit peak amplitude is a nan! Channel: " << channel
461  << ", start tick: " << startT << std::endl;
462  continue;
463  }
464 
465  // Extract errors
466  float peakAmpErr = peakParams.peakAmplitudeError;
467  float peakMeanErr = peakParams.peakCenterError;
468  float peakWidthErr = peakParams.peakSigmaError;
469 
470  // ### Charge ###
471  float charge =
472  chargeFunc(peakMean, peakAmp, peakWidth, fAreaNormsVec[plane], startT, endT);
473  ;
474  float chargeErr =
475  std::sqrt(TMath::Pi()) * (peakAmpErr * peakWidthErr + peakWidthErr * peakAmpErr);
476 
477  // ### limits for getting sums
478  std::vector<float>::const_iterator sumStartItr = range.begin() + startT;
479  std::vector<float>::const_iterator sumEndItr = range.begin() + endT;
480 
481  // ### Sum of ADC counts
482  double sumADC = std::accumulate(sumStartItr, sumEndItr, 0.);
483 
484  // ok, now create the hit
485  recob::HitCreator hitcreator(
486  *wire, // wire reference
487  wid, // wire ID
488  startT + roiFirstBinTick, // start_tick TODO check
489  endT + roiFirstBinTick, // end_tick TODO check
490  peakWidth, // rms
491  peakMean + roiFirstBinTick, // peak_time
492  peakMeanErr, // sigma_peak_time
493  peakAmp, // peak_amplitude
494  peakAmpErr, // sigma_peak_amplitude
495  charge, // hit_integral
496  chargeErr, // hit_sigma_integral
497  sumADC, // summedADC FIXME
498  nGausForFit, // multiplicity
499  numHits, // local_index TODO check that the order is correct
500  chi2PerNDF, // goodness_of_fit
501  NDF // dof
502  );
503 
504  if (filteredHitCol) filteredHitVec.push_back(hitcreator.copy());
505 
506  const recob::Hit hit(hitcreator.move());
507 
508  // This loop will store ALL hits
509  hitstruct tmp{std::move(hit), wire};
510  hitstruct_vec.push_back(std::move(tmp));
511 
512  numHits++;
513  } // <---End loop over gaussians
514 
515  // Should we filter hits?
516  if (filteredHitCol && !filteredHitVec.empty()) {
517  // #######################################################################
518  // Is all this sorting really necessary? Would it be faster to just loop
519  // through the hits and perform simple cuts on amplitude and width on a
520  // hit-by-hit basis, either here in the module (using fPulseHeightCuts and
521  // fPulseWidthCuts) or in HitFilterAlg?
522  // #######################################################################
523 
524  // Sort in ascending peak height
525  std::sort(filteredHitVec.begin(),
526  filteredHitVec.end(),
527  [](const auto& left, const auto& right) {
528  return left.PeakAmplitude() > right.PeakAmplitude();
529  });
530 
531  // Reject if the first hit fails the PH/wid cuts
532  if (filteredHitVec.front().PeakAmplitude() < fPulseHeightCuts.at(plane) ||
533  filteredHitVec.front().RMS() < fPulseWidthCuts.at(plane))
534  filteredHitVec.clear();
535 
536  // Now check other hits in the snippet
537  if (filteredHitVec.size() > 1) {
538  // The largest pulse height will now be at the front...
539  float largestPH = filteredHitVec.front().PeakAmplitude();
540 
541  // Find where the pulse heights drop below threshold
542  float threshold(fPulseRatioCuts.at(plane));
543 
545  std::find_if(filteredHitVec.begin(),
546  filteredHitVec.end(),
547  [largestPH, threshold](const auto& hit) {
548  return hit.PeakAmplitude() < 8. &&
549  hit.PeakAmplitude() / largestPH < threshold;
550  });
551 
552  // Shrink to fit
553  if (smallHitItr != filteredHitVec.end())
554  filteredHitVec.resize(std::distance(filteredHitVec.begin(), smallHitItr));
555 
556  // Resort in time order
557  std::sort(filteredHitVec.begin(),
558  filteredHitVec.end(),
559  [](const auto& left, const auto& right) {
560  return left.PeakTime() < right.PeakTime();
561  });
562  }
563 
564  // Copy the hits we want to keep to the filtered hit collection
565  for (const auto& filteredHit : filteredHitVec)
566  if (!fHitFilterAlg || fHitFilterAlg->IsGoodHit(filteredHit)) {
567  hitstruct tmp{std::move(filteredHit), wire};
568  filthitstruct_vec.push_back(std::move(tmp));
569  }
570 
571  if (fFillHists) fChi2->Fill(chi2PerNDF);
572  }
573  } //<---End loop over merged candidate hits
574  } //<---End looping over ROI's
575  ); //end tbb parallel for
576  } //<---End looping over all the wires
577  ); //end tbb parallel for
578 
579  for (size_t i = 0; i < hitstruct_vec.size(); i++) {
580  allHitCol.emplace_back(hitstruct_vec[i].hit_tbb, hitstruct_vec[i].wire_tbb);
581  }
582 
583  for (size_t j = 0; j < filthitstruct_vec.size(); j++) {
584  filteredHitCol->emplace_back(filthitstruct_vec[j].hit_tbb, filthitstruct_vec[j].wire_tbb);
585  }
586 
587  //==================================================================================================
588  // End of the event -- move the hit collection and the associations into the event
589 
590  if (filteredHitCol) {
591 
592  // If we filtered hits but no instance name was
593  // specified for the "all hits" collection, then
594  // only save the filtered hits to the event
595  if (fAllHitsInstanceName == "") {
596  filteredHitCol->put_into(evt);
597 
598  // otherwise, save both
599  }
600  else {
601  filteredHitCol->put_into(evt);
602  allHitCol.put_into(evt);
603  }
604  }
605  else {
606  allHitCol.put_into(evt);
607  }
608 
609  // Keep track of events processed
610  //fEventCount++;
611 
612  } // End of produce()
613 
615 
616 } // end of hit namespace
intermediate_table::iterator iterator
const datarange_t & range(size_t i) const
Returns the i-th non-void range (zero-based)
size_type n_ranges() const
Returns the internal list of non-void ranges.
constexpr auto const & right(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:102
std::vector< WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
recob::Hit const & copy() const
Returns the constructed wire.
Definition: HitCreator.h:347
std::unique_ptr< HitFilterAlg > fHitFilterAlg
algorithm used to filter out noise hits
Declaration of signal hit object.
void produce(art::Event &evt, art::ProcessingFrame const &) override
GausHitFinder(fhicl::ParameterSet const &pset, art::ProcessingFrame const &)
unsigned int PlaneID_t
Type for the ID number.
Definition: geo_types.h:464
intermediate_table::const_iterator const_iterator
Float_t tmp
Definition: plot.C:35
const std::vector< int > fLongPulseWidthVec
Sets width of hits used to describe long pulses.
static void declare_products(art::ProducesCollector &collector, std::string instance_name="", bool doWireAssns=true, bool doRawDigitAssns=true)
Declares the hit products we are going to fill.
Definition: HitCreator.cxx:248
std::unique_ptr< reco_tool::IPeakFitter > fPeakFitterTool
Perform fit to candidate peaks.
const int fAreaMethod
Type of area calculation.
const std::string fCalDataModuleLabel
const std::vector< float > fPulseWidthCuts
int TDCtick_t
Type representing a TDC tick.
Definition: RawTypes.h:25
Class managing the creation of a new recob::Hit object.
Definition: HitCreator.h:87
std::vector< std::string > get_pset_names() const
Helper functions to create a hit.
A class handling a collection of hits and its associations.
Definition: HitCreator.h:481
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:65
raw::ChannelID_t Channel() const
Returns the ID of the channel (or InvalidChannelID)
Definition: Wire.h:223
SharedProducer(fhicl::ParameterSet const &pset)
std::vector< double > FillOutHitParameterVector(const std::vector< double > &input)
std::atomic< size_t > fEventCount
T get(std::string const &key) const
Definition: ParameterSet.h:314
const size_t fMaxMultiHit
maximum hits for multi fit
const std::vector< int > fLongMaxHitsVec
Maximum number hits on a really long pulse train.
const RegionsOfInterest_t & SignalROI() const
Returns the list of regions of interest.
Definition: Wire.h:211
void beginJob(art::ProcessingFrame const &) override
void emplace_back(recob::Hit &&hit, art::Ptr< recob::Wire > const &wire=art::Ptr< recob::Wire >(), art::Ptr< raw::RawDigit > const &digits=art::Ptr< raw::RawDigit >())
Adds the specified hit to the data collection.
Definition: HitCreator.cxx:286
PlaneID_t Plane
Index of the plane within its TPC.
Definition: geo_types.h:481
void put_into(art::Event &)
Moves the data into an event.
Definition: HitCreator.h:614
Detector simulation of raw signals on wires.
ProducesCollector & producesCollector() noexcept
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::vector< PeakFitParams_t > PeakParamsVec
Definition: IPeakFitter.h:34
constexpr auto const & left(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:94
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
This provides an interface for tools which are tasked with fitting peaks on input waveforms...
const std::vector< float > fPulseRatioCuts
This provides an interface for tools which are tasked with finding candidate hits on input waveforms...
const std::vector< float > fPulseHeightCuts
maximum Chisquared / NDF allowed for a hit to be saved
unsigned int Nplanes(TPCID const &tpcid=tpc_zero) const
Returns the total number of planes in the specified TPC.
Definition: GeometryCore.h:977
Declaration of basic channel signal object.
const std::string fAllHitsInstanceName
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:46
const std::vector< double > fAreaNormsVec
factors for converting area to same units as peak height
static Globals * instance()
Definition: Globals.cc:17
TCEvent evt
Definition: DataStructs.cxx:8
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
std::vector< HitCandidateVec > MergeHitCandidateVec
recob::Hit && move()
Prepares the constructed hit to be moved away.
Definition: HitCreator.h:330
Definition: fwd.h:26
art framework interface to geometry description
std::vector< std::unique_ptr< reco_tool::ICandidateHitFinder > > fHitFinderToolVec
For finding candidate hits.
std::vector< HitCandidate > HitCandidateVec