LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
hit::RawHitFinder Class Reference
Inheritance diagram for hit::RawHitFinder:
art::EDProducer art::detail::Producer art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Public Types

using ModuleType = EDProducer
 
template<typename UserConfig , typename KeysToIgnore = void>
using Table = Modifier::Table< UserConfig, KeysToIgnore >
 

Public Member Functions

 RawHitFinder (fhicl::ParameterSet const &pset)
 
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)
 
void fillProductDescriptions ()
 
void registerProducts (ProductDescriptions &productsToRegister)
 
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

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 produce (art::Event &evt) override
 

Private Attributes

unsigned int fDataSize
 
art::InputTag fDigitModuleLabel
 
std::string fSpillName
 
std::string fCalDataModuleLabel
 
std::string fHitLabelName
 
double fMinSigInd
 
double fMinSigCol
 
double fIndWidth
 
double fColWidth
 
double fIndMinWidth
 
double fColMinWidth
 
int fMaxMultiHit
 
int fAreaMethod
 
std::vector< double > fAreaNorms
 
bool fUncompressWithPed
 
bool fSkipInd
 
double fIncludeMoreTail
 
int fColMinWindow
 
int fIndCutoff
 

Detailed Description

Definition at line 36 of file RawHitFinder_module.cc.

Member Typedef Documentation

Definition at line 17 of file EDProducer.h.

template<typename UserConfig , typename KeysToIgnore = void>
using art::detail::Producer::Table = Modifier::Table<UserConfig, KeysToIgnore>
inherited

Definition at line 26 of file Producer.h.

Constructor & Destructor Documentation

hit::RawHitFinder::RawHitFinder ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 70 of file RawHitFinder_module.cc.

References recob::HitAndAssociationsWriterBase::declare_products(), fAreaMethod, fAreaNorms, fCalDataModuleLabel, fColMinWidth, fColMinWindow, fColWidth, fDigitModuleLabel, fIncludeMoreTail, fIndCutoff, fIndMinWidth, fIndWidth, fMaxMultiHit, fMinSigCol, fMinSigInd, fSkipInd, fUncompressWithPed, and art::ProductRegistryHelper::producesCollector().

70  : EDProducer{pset}
71  {
72  fDigitModuleLabel = pset.get<art::InputTag>("DigitModuleLabel", "daq");
73  fCalDataModuleLabel = pset.get<std::string>("CalDataModuleLabel");
74  fMinSigInd = pset.get<double>("MinSigInd");
75  fMinSigCol = pset.get<double>("MinSigCol");
76  fIncludeMoreTail = pset.get<double>("IncludeMoreTail", 0.);
77  fIndWidth = pset.get<int>("IndWidth", 20);
78  fColWidth = pset.get<double>("ColWidth");
79  fIndMinWidth = pset.get<double>("IndMinWidth");
80  fColMinWidth = pset.get<double>("ColMinWidth", 0.);
81  fMaxMultiHit = pset.get<int>("MaxMultiHit");
82  fAreaMethod = pset.get<int>("AreaMethod");
83  fAreaNorms = pset.get<std::vector<double>>("AreaNorms");
84  fUncompressWithPed = pset.get<bool>("UncompressWithPed", true);
85  fSkipInd = pset.get<bool>("SkipInd", false);
86  fColMinWindow = pset.get<int>("ColMinWindow", 0);
87  fIndCutoff = pset.get<int>("IndCutoff", 20);
88  mf::LogInfo("RawHitFinder_module") << "fDigitModuleLabel: " << fDigitModuleLabel << std::endl;
89 
90  //LET HITCOLLECTIONCREATOR DECLARE THAT WE ARE GOING TO PRODUCE
91  //HITS AND ASSOCIATIONS TO RAW DIGITS BUT NOT ASSOCIATIONS TO WIRES
92  //(WITH NO PARTICULAR PRODUCT LABEL).
94  /*instance_name*/ "",
95  /*doWireAssns*/ false,
96  /*doRawDigitAssns*/ true);
97  }
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.cc:6
std::vector< double > fAreaNorms
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:261
ProducesCollector & producesCollector() noexcept
std::string fCalDataModuleLabel
art::InputTag fDigitModuleLabel

Member Function Documentation

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::Producer::doBeginJob ( SharedResources const &  resources)
inherited

Definition at line 22 of file Producer.cc.

References art::detail::Producer::beginJobWithFrame(), and art::detail::Producer::setupQueues().

23  {
24  setupQueues(resources);
25  ProcessingFrame const frame{ScheduleID{}};
26  beginJobWithFrame(frame);
27  }
virtual void setupQueues(SharedResources const &)=0
virtual void beginJobWithFrame(ProcessingFrame const &)=0
bool art::detail::Producer::doBeginRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited

Definition at line 65 of file Producer.cc.

References art::detail::Producer::beginRunWithFrame(), art::RangeSet::forRun(), art::RunPrincipal::makeRun(), r, art::RunPrincipal::runID(), and art::ModuleContext::scheduleID().

66  {
67  auto r = rp.makeRun(mc, RangeSet::forRun(rp.runID()));
68  ProcessingFrame const frame{mc.scheduleID()};
69  beginRunWithFrame(r, frame);
70  r.commitProducts();
71  return true;
72  }
TRandom r
Definition: spectrum.C:23
virtual void beginRunWithFrame(Run &, ProcessingFrame const &)=0
static RangeSet forRun(RunID)
Definition: RangeSet.cc:51
bool art::detail::Producer::doBeginSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited

Definition at line 85 of file Producer.cc.

References art::detail::Producer::beginSubRunWithFrame(), art::RangeSet::forSubRun(), art::SubRunPrincipal::makeSubRun(), art::ModuleContext::scheduleID(), and art::SubRunPrincipal::subRunID().

86  {
87  auto sr = srp.makeSubRun(mc, RangeSet::forSubRun(srp.subRunID()));
88  ProcessingFrame const frame{mc.scheduleID()};
89  beginSubRunWithFrame(sr, frame);
90  sr.commitProducts();
91  return true;
92  }
virtual void beginSubRunWithFrame(SubRun &, ProcessingFrame const &)=0
static RangeSet forSubRun(SubRunID)
Definition: RangeSet.cc:57
void art::detail::Producer::doEndJob ( )
inherited

Definition at line 30 of file Producer.cc.

References art::detail::Producer::endJobWithFrame().

31  {
32  ProcessingFrame const frame{ScheduleID{}};
33  endJobWithFrame(frame);
34  }
virtual void endJobWithFrame(ProcessingFrame const &)=0
bool art::detail::Producer::doEndRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited

Definition at line 75 of file Producer.cc.

References art::detail::Producer::endRunWithFrame(), art::RunPrincipal::makeRun(), r, art::ModuleContext::scheduleID(), and art::Principal::seenRanges().

76  {
77  auto r = rp.makeRun(mc, rp.seenRanges());
78  ProcessingFrame const frame{mc.scheduleID()};
79  endRunWithFrame(r, frame);
80  r.commitProducts();
81  return true;
82  }
TRandom r
Definition: spectrum.C:23
virtual void endRunWithFrame(Run &, ProcessingFrame const &)=0
bool art::detail::Producer::doEndSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited

Definition at line 95 of file Producer.cc.

References art::detail::Producer::endSubRunWithFrame(), art::SubRunPrincipal::makeSubRun(), art::ModuleContext::scheduleID(), and art::Principal::seenRanges().

96  {
97  auto sr = srp.makeSubRun(mc, srp.seenRanges());
98  ProcessingFrame const frame{mc.scheduleID()};
99  endSubRunWithFrame(sr, frame);
100  sr.commitProducts();
101  return true;
102  }
virtual void endSubRunWithFrame(SubRun &, ProcessingFrame const &)=0
bool art::detail::Producer::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 105 of file Producer.cc.

References art::detail::Producer::checkPutProducts_, e, art::EventPrincipal::makeEvent(), art::detail::Producer::produceWithFrame(), and art::ModuleContext::scheduleID().

110  {
111  auto e = ep.makeEvent(mc);
112  ++counts_run;
113  ProcessingFrame const frame{mc.scheduleID()};
114  produceWithFrame(e, frame);
115  e.commitProducts(checkPutProducts_, &expectedProducts<InEvent>());
116  ++counts_passed;
117  return true;
118  }
bool const checkPutProducts_
Definition: Producer.h:70
Float_t e
Definition: plot.C:35
virtual void produceWithFrame(Event &, ProcessingFrame const &)=0
void art::detail::Producer::doRespondToCloseInputFile ( FileBlock const &  fb)
inherited

Definition at line 44 of file Producer.cc.

References art::detail::Producer::respondToCloseInputFileWithFrame().

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

Definition at line 58 of file Producer.cc.

References art::detail::Producer::respondToCloseOutputFilesWithFrame().

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

Definition at line 37 of file Producer.cc.

References art::detail::Producer::respondToOpenInputFileWithFrame().

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

Definition at line 51 of file Producer.cc.

References art::detail::Producer::respondToOpenOutputFilesWithFrame().

52  {
53  ProcessingFrame const frame{ScheduleID{}};
55  }
virtual void respondToOpenOutputFilesWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void art::Modifier::fillProductDescriptions ( )
inherited

Definition at line 10 of file Modifier.cc.

References art::ProductRegistryHelper::fillDescriptions(), and art::ModuleBase::moduleDescription().

11  {
13  }
void fillDescriptions(ModuleDescription const &md)
ModuleDescription const & moduleDescription() const
Definition: ModuleBase.cc:13
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
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
void hit::RawHitFinder::produce ( art::Event evt)
overrideprivatevirtual

Implements art::EDProducer.

Definition at line 100 of file RawHitFinder_module.cc.

References raw::RawDigit::ADCs(), bin, raw::RawDigit::Channel(), raw::RawDigit::Compression(), DEFINE_ART_MODULE, recob::HitCollectionCreator::emplace_back(), util::end(), fColMinWindow, fDataSize, fDigitModuleLabel, fIncludeMoreTail, fIndCutoff, fMinSigCol, fMinSigInd, fSkipInd, fUncompressWithPed, Get, art::ProductRetriever::getByLabel(), raw::RawDigit::GetPedestal(), geo::kCollection, geo::kInduction, recob::HitCollectionCreator::put_into(), recob::HitCollectionCreator::reserve(), raw::RawDigit::Samples(), and raw::Uncompress().

101  {
102  //READ IN THE DIGIT LIST OBJECTS(S).
104 
105  bool retVal = evt.getByLabel(fDigitModuleLabel, digitVecHandle);
106  if (retVal == true)
107  mf::LogInfo("RawHitFinder_module")
108  << "I got fDigitModuleLabel: " << fDigitModuleLabel << std::endl;
109  else
110  mf::LogWarning("RawHitFinder_module")
111  << "Could not get fDigitModuleLabel: " << fDigitModuleLabel << std::endl;
112 
113  std::vector<float> holder; //HOLDS SIGNAL DATA.
114  std::vector<short> rawadc; //UNCOMPRESSED ADC VALUES.
115 
116  // ###############################################
117  // ### Making a ptr vector to put on the event ###
118  // ###############################################
119  // THIS CONTAINS THE HIT COLLECTION AND ITS ASSOCIATIONS TO WIRES AND RAW DIGITS.
120  recob::HitCollectionCreator hcol(evt, false /* doWireAssns */, true /* doRawDigitAssns */);
121 
122  std::vector<float> startTimes; //STORES TIME OF WINDOW START.
123  std::vector<float> maxTimes; //STORES TIME OF LOCAL MAXIMUM.
124  std::vector<float> endTimes; //STORES TIME OF WINDOW END.
125  std::vector<float> peakHeight; //STORES ADC COUNT AT THE MAXIMUM.
126  std::vector<float> hitrms; //STORES CHARGE WEIGHTED RMS OF TIME ACROSS THE HIT.
127  std::vector<double> charge; //STORES THE TOTAL CHARGE ASSOCIATED WITH THE HIT.
128 
129  uint32_t channel = 0; //CHANNEL NUMBER.
130  double threshold = 0; //MINIMUM SIGNAL SIZE FOR ID'ING A HIT.
131  double totSig = 0;
132  double myrms = 0;
133  double mynorm = 0;
135  std::stringstream numConv;
136 
137  hcol.reserve(digitVecHandle->size());
138  auto const& wireReadoutGeom = art::ServiceHandle<geo::WireReadout const>()->Get();
139  for (size_t rdIter = 0; rdIter < digitVecHandle->size(); ++rdIter) {
140  holder.clear();
141 
142  //GET THE REFERENCE TO THE CURRENT raw::RawDigit.
143  art::Ptr<raw::RawDigit> digitVec(digitVecHandle, rdIter);
144  channel = digitVec->Channel();
145  fDataSize = digitVec->Samples();
146 
147  rawadc.resize(fDataSize);
148  holder.resize(fDataSize);
149 
150  //UNCOMPRESS THE DATA.
151  if (fUncompressWithPed) {
152  int pedestal = (int)digitVec->GetPedestal();
153  raw::Uncompress(digitVec->ADCs(), rawadc, pedestal, digitVec->Compression());
154  }
155  else {
156  raw::Uncompress(digitVec->ADCs(), rawadc, digitVec->Compression());
157  }
158 
159  //GET THE LIST OF BAD CHANNELS.
160  lariov::ChannelStatusProvider const& channelStatus =
162 
163  lariov::ChannelStatusProvider::ChannelSet_t const BadChannels = channelStatus.BadChannels();
164 
165  for (unsigned int bin = 0; bin < fDataSize; ++bin) {
166  holder[bin] = (rawadc[bin] - digitVec->GetPedestal());
167  }
168 
169  sigType = wireReadoutGeom.SignalType(channel);
170 
171  peakHeight.clear();
172  endTimes.clear();
173  startTimes.clear();
174  maxTimes.clear();
175  charge.clear();
176  hitrms.clear();
177 
178  bool channelSwitch = false;
179 
180  for (auto it = BadChannels.begin(); it != BadChannels.end(); it++) {
181  if (channel == *it) {
182  channelSwitch = true;
183  break;
184  }
185  }
186 
187  if (channelSwitch == false) {
188  // ###############################################
189  // ### Induction Planes ###
190  // ###############################################
191 
192  //THE INDUCTION PLANE METHOD HAS NOT YET BEEN MODIFIED AND TESTED FOR REAL DATA.
193  // Or for detectors without a grid plane
194  //
195  if (sigType == geo::kInduction && !fSkipInd) {
196  threshold = fMinSigInd;
197  float negthr = -1.0 * threshold;
198  unsigned int bin = 1;
199  float minadc = 0;
200 
201  // find the dips
202  while (bin < (fDataSize - 1)) { // loop over ticks
203  float thisadc = holder[bin];
204  float nextadc = holder[bin + 1];
205  if (thisadc < negthr &&
206  nextadc < negthr) { // new region, require two ticks above threshold
207  // step back to find zero crossing
208  unsigned int place = bin;
209  while (thisadc <= 0 && bin > 0) {
210  bin--;
211  thisadc = holder[bin];
212  }
213  float hittime = bin + thisadc / (thisadc - holder[bin + 1]);
214  maxTimes.push_back(hittime);
215 
216  // step back more to find the hit start time
217  uint32_t stop;
218  if (fIndCutoff < (int)bin) { stop = bin - fIndCutoff; }
219  else {
220  stop = 0;
221  }
222  while (thisadc < threshold && bin > stop) {
223  bin--;
224  thisadc = holder[bin];
225  }
226  if (bin >= 2) bin -= 2;
227  while (thisadc > threshold && bin > stop) {
228  bin--;
229  thisadc = holder[bin];
230  }
231  startTimes.push_back(bin + 1);
232  // now step forward from hit time to find end time, area of dip
233  bin = place;
234  thisadc = holder[bin];
235  minadc = thisadc;
236  bin++;
237  totSig = fabs(thisadc);
238  while (thisadc < negthr && bin < fDataSize) {
239  totSig += fabs(thisadc);
240  thisadc = holder[bin];
241  if (thisadc < minadc) minadc = thisadc;
242  bin++;
243  }
244  endTimes.push_back(bin - 1);
245  peakHeight.push_back(-1.0 * minadc);
246  charge.push_back(totSig);
247  hitrms.push_back(5.0);
248 
249  // don't look for a new hit until it returns to baseline
250  while (thisadc < 0 && bin < fDataSize) {
251  bin++;
252  if (bin == fDataSize) break;
253  thisadc = holder[bin];
254  }
255  } // end region
256  bin++;
257  } // loop over ticks
258  }
259 
260  // ###############################################
261  // ### Collection Plane ###
262  // ###############################################
263 
264  else if (sigType == geo::kCollection) {
265  threshold = fMinSigCol;
266 
267  float madc = threshold;
268  int ibin = 0;
269  int start = 0;
270  int end = 0;
271  unsigned int bin = 0;
272 
273  while (bin < fDataSize) {
274  float thisadc = holder[bin];
275  madc = threshold;
276  ibin = 0;
277 
278  if (thisadc > madc) {
279  start = bin;
280 
281  if (thisadc > threshold && bin < fDataSize) {
282  while (thisadc > threshold && bin < fDataSize) {
283  if (thisadc > madc) {
284  ibin = bin;
285  madc = thisadc;
286  }
287  bin++;
288  if (bin == fDataSize) break;
289  thisadc = holder[bin];
290  }
291  }
292  else {
293  bin++;
294  }
295 
296  end = bin - 1;
297 
298  if (start != end) {
299  maxTimes.push_back(ibin);
300  peakHeight.push_back(madc);
301  startTimes.push_back(start);
302  endTimes.push_back(end);
303 
304  totSig = 0;
305  myrms = 0;
306  mynorm = 0;
307 
308  int moreTail = std::ceil(fIncludeMoreTail * (end - start));
309  if (moreTail < fColMinWindow) moreTail = fColMinWindow;
310 
311  for (int i = start - moreTail; i <= end + moreTail; i++) {
312  if (i < (int)(holder.size()) && i >= 0) {
313  float temp = ibin - i;
314  myrms += temp * temp * holder[i];
315 
316  totSig += holder[i];
317  }
318  }
319 
320  charge.push_back(totSig);
321  mynorm = totSig;
322  myrms /= mynorm;
323  hitrms.push_back(sqrt(myrms));
324  }
325  }
326  start = 0;
327  end = 0;
328  bin++;
329  }
330  }
331  }
332 
333  int numHits(0); //NUMBER OF CONSECUTIVE HITS BEING FITTED.
334  int hitIndex(0); //INDEX OF CURRENT HIT IN SEQUENCE.
335  double amplitude(0), position(0); //FIT PARAMETERS.
336  double start(0), end(0);
337  double amplitudeErr(0), positionErr(0); //FIT ERRORS.
338  double goodnessOfFit(0), chargeErr(0); //CHI2/NDF and error on charge.
339  double hrms(0);
340 
341  numHits = maxTimes.size();
342  for (int i = 0; i < numHits; ++i) {
343  amplitude = peakHeight[i];
344  position = maxTimes[i];
345  start = startTimes[i];
346  end = endTimes[i];
347  hrms = hitrms[i];
348  amplitudeErr = -1;
349  positionErr = 1.0;
350  goodnessOfFit = -1;
351  chargeErr = -1;
352  totSig = charge[i];
353 
354  std::vector<geo::WireID> wids = wireReadoutGeom.ChannelToWire(channel);
355  geo::WireID wid = wids[0];
356 
357  if (start >= end) {
358  mf::LogWarning("RawHitFinder_module")
359  << "Hit start " << start << " is >= hit end " << end;
360  continue;
361  }
362 
363  recob::HitCreator hit(*digitVec, //RAW DIGIT REFERENCE.
364  wid, //WIRE ID.
365  start, //START TICK.
366  end, //END TICK.
367  hrms, //RMS.
368  position, //PEAK_TIME.
369  positionErr, //SIGMA_PEAK_TIME.
370  amplitude, //PEAK_AMPLITUDE.
371  amplitudeErr, //SIGMA_PEAK_AMPLITUDE.
372  totSig, //HIT_INTEGRAL.
373  chargeErr, //HIT_SIGMA_INTEGRAL.
374  std::accumulate(holder.begin() + (int)start,
375  holder.begin() + (int)end,
376  0.), //SUMMED CHARGE.
377  std::accumulate(holder.begin() + (int)start,
378  holder.begin() + (int)end,
379  0.), //SUMMED CHARGE. TO BE MODIFIED
380  1, //MULTIPLICITY.
381  -1, //LOCAL_INDEX.
382  goodnessOfFit, //WIRE ID.
383  int(end - start + 1) //DEGREES OF FREEDOM.
384  );
385  hcol.emplace_back(hit.move(), digitVec);
386 
387  ++hitIndex;
388  }
389  }
390 
391  hcol.put_into(evt);
392  }
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
cout<< "Opened file "<< fin<< " ixs= "<< ixs<< endl;if(ixs==0) hhh=(TH1F *) fff-> Get("h1")
Definition: AddMC.C:8
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
Class managing the creation of a new recob::Hit object.
Definition: HitCreator.h:87
A class handling a collection of hits and its associations.
Definition: HitCreator.h:489
Signal from induction planes.
Definition: geo_types.h:147
enum geo::_plane_sigtype SigType_t
Enumerate the possible plane projections.
float bin[41]
Definition: plottest35.C:14
Detector simulation of raw signals on wires.
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
art::InputTag fDigitModuleLabel
void Uncompress(const std::vector< short > &adc, std::vector< short > &uncompressed, raw::Compress_t compress)
Uncompresses a raw data buffer.
Definition: raw.cxx:744
Signal from collection planes.
Definition: geo_types.h:148
void art::Modifier::registerProducts ( ProductDescriptions productsToRegister)
inherited

Definition at line 16 of file Modifier.cc.

References art::ModuleBase::moduleDescription(), and art::ProductRegistryHelper::registerProducts().

17  {
18  ProductRegistryHelper::registerProducts(productsToRegister,
20  }
void registerProducts(ProductDescriptions &productsToRegister, ModuleDescription const &md)
ModuleDescription const & moduleDescription() const
Definition: ModuleBase.cc:13
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)

Member Data Documentation

int hit::RawHitFinder::fAreaMethod
private

Definition at line 58 of file RawHitFinder_module.cc.

Referenced by RawHitFinder().

std::vector<double> hit::RawHitFinder::fAreaNorms
private

Definition at line 59 of file RawHitFinder_module.cc.

Referenced by RawHitFinder().

std::string hit::RawHitFinder::fCalDataModuleLabel
private

Definition at line 49 of file RawHitFinder_module.cc.

Referenced by RawHitFinder().

double hit::RawHitFinder::fColMinWidth
private

Definition at line 56 of file RawHitFinder_module.cc.

Referenced by RawHitFinder().

int hit::RawHitFinder::fColMinWindow
private

Definition at line 64 of file RawHitFinder_module.cc.

Referenced by produce(), and RawHitFinder().

double hit::RawHitFinder::fColWidth
private

Definition at line 54 of file RawHitFinder_module.cc.

Referenced by RawHitFinder().

unsigned int hit::RawHitFinder::fDataSize
private

Definition at line 44 of file RawHitFinder_module.cc.

Referenced by produce().

art::InputTag hit::RawHitFinder::fDigitModuleLabel
private

Definition at line 45 of file RawHitFinder_module.cc.

Referenced by produce(), and RawHitFinder().

std::string hit::RawHitFinder::fHitLabelName
private

Definition at line 50 of file RawHitFinder_module.cc.

double hit::RawHitFinder::fIncludeMoreTail
private

Definition at line 62 of file RawHitFinder_module.cc.

Referenced by produce(), and RawHitFinder().

int hit::RawHitFinder::fIndCutoff
private

Definition at line 65 of file RawHitFinder_module.cc.

Referenced by produce(), and RawHitFinder().

double hit::RawHitFinder::fIndMinWidth
private

Definition at line 55 of file RawHitFinder_module.cc.

Referenced by RawHitFinder().

double hit::RawHitFinder::fIndWidth
private

Definition at line 53 of file RawHitFinder_module.cc.

Referenced by RawHitFinder().

int hit::RawHitFinder::fMaxMultiHit
private

Definition at line 57 of file RawHitFinder_module.cc.

Referenced by RawHitFinder().

double hit::RawHitFinder::fMinSigCol
private

Definition at line 52 of file RawHitFinder_module.cc.

Referenced by produce(), and RawHitFinder().

double hit::RawHitFinder::fMinSigInd
private

Definition at line 51 of file RawHitFinder_module.cc.

Referenced by produce(), and RawHitFinder().

bool hit::RawHitFinder::fSkipInd
private

Definition at line 61 of file RawHitFinder_module.cc.

Referenced by produce(), and RawHitFinder().

std::string hit::RawHitFinder::fSpillName
private

Definition at line 46 of file RawHitFinder_module.cc.

bool hit::RawHitFinder::fUncompressWithPed
private

Definition at line 60 of file RawHitFinder_module.cc.

Referenced by produce(), and RawHitFinder().


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