LArSoft  v09_90_00
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:248
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(), geo::GeometryCore::ChannelToWire(), raw::RawDigit::Compression(), DEFINE_ART_MODULE, recob::HitCollectionCreator::emplace_back(), util::end(), fColMinWindow, fDataSize, fDigitModuleLabel, fIncludeMoreTail, fIndCutoff, fMinSigCol, fMinSigInd, fSkipInd, fUncompressWithPed, art::ProductRetriever::getByLabel(), raw::RawDigit::GetPedestal(), geo::kCollection, geo::kInduction, recob::HitCollectionCreator::put_into(), recob::HitCollectionCreator::reserve(), raw::RawDigit::Samples(), geo::GeometryCore::SignalType(), and raw::Uncompress().

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