LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
hit::HitCheater Class Reference
Inheritance diagram for hit::HitCheater:
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

 HitCheater (fhicl::ParameterSet const &p)
 
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 &e) override
 
void FindHitsOnChannel (const sim::SimChannel *sc, std::vector< recob::Hit > &hits, int spill)
 

Private Attributes

std::string fG4ModuleLabel
 label name for module making sim::SimChannels More...
 
std::string fWireModuleLabel
 label name for module making recob::Wires More...
 
double fMinCharge
 Minimum charge required to make a hit. More...
 
double fElectronsToADC
 Conversion factor of electrons to ADC counts. More...
 
std::string fCalDataProductInstanceName
 label name for module making recob::Wires More...
 
int fReadOutWindowSize
 Number of samples in a readout window; NOT total samples. More...
 
int fNumberTimeSamples
 Number of total time samples (N*readoutwindowsize) More...
 
double fSamplingRate
 from detinfo::DetectorPropertiesService More...
 
int fTriggerOffset
 from detinfo::DetectorPropertiesService More...
 
int fNewHitTDCGap
 gap allowed in tdcs without charge before making a new hit More...
 

Detailed Description

Definition at line 42 of file HitCheater_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::HitCheater::HitCheater ( fhicl::ParameterSet const &  p)
explicit

Definition at line 64 of file HitCheater_module.cc.

References recob::HitAndAssociationsWriterBase::declare_products(), fCalDataProductInstanceName, fElectronsToADC, fG4ModuleLabel, fMinCharge, fNewHitTDCGap, fNumberTimeSamples, fReadOutWindowSize, fSamplingRate, fTriggerOffset, fWireModuleLabel, art::ProductRegistryHelper::producesCollector(), detinfo::sampling_rate(), and detinfo::trigger_offset().

64  : EDProducer{p}
65 {
66  fG4ModuleLabel = p.get<std::string>("G4ModuleLabel", "largeant");
67  fWireModuleLabel = p.get<std::string>("WireModuleLabel", "caldata");
68  fMinCharge = p.get<double>("MinimumCharge", 5.);
69  fNewHitTDCGap = p.get<int>("NewHitTDCGap", 1);
70 
71  auto const clock_data = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataForJob();
72  auto const det_prop =
74  fElectronsToADC = det_prop.ElectronsToADC();
75  fSamplingRate = sampling_rate(clock_data);
76  fTriggerOffset = trigger_offset(clock_data);
77 
79  size_t pos = fWireModuleLabel.find(":");
80  if (pos != std::string::npos) {
82  fWireModuleLabel = fWireModuleLabel.substr(0, pos);
83  }
84 
85  fReadOutWindowSize = det_prop.ReadOutWindowSize();
86  fNumberTimeSamples = det_prop.NumberTimeSamples();
87 
88  // let HitCollectionCreator declare that we are going to produce
89  // hits and associations with wires and raw digits
90  // (with no particular product label)
92 }
int fTriggerOffset
from detinfo::DetectorPropertiesService
double fSamplingRate
from detinfo::DetectorPropertiesService
std::string fWireModuleLabel
label name for module making recob::Wires
int fNumberTimeSamples
Number of total time samples (N*readoutwindowsize)
int fNewHitTDCGap
gap allowed in tdcs without charge before making a new hit
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.cc:6
std::string fCalDataProductInstanceName
label name for module making recob::Wires
double fMinCharge
Minimum charge required to make a hit.
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
std::string fG4ModuleLabel
label name for module making sim::SimChannels
ProducesCollector & producesCollector() noexcept
int fReadOutWindowSize
Number of samples in a readout window; NOT total samples.
int trigger_offset(DetectorClocksData const &data)
double fElectronsToADC
Conversion factor of electrons to ADC counts.
double sampling_rate(DetectorClocksData const &data)
Returns the period of the TPC readout electronics clock.

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
void hit::HitCheater::FindHitsOnChannel ( const sim::SimChannel sc,
std::vector< recob::Hit > &  hits,
int  spill 
)
private

Definition at line 155 of file HitCheater_module.cc.

References lar::util::StatCollector< T, W >::add(), sim::SimChannel::Channel(), lar::util::StatCollector< T, W >::clear(), geo::CryostatID::Cryostat, DEFINE_ART_MODULE, edep, fElectronsToADC, geo::GeometryCore::FindTPCAtPosition(), fMinCharge, fNewHitTDCGap, fNumberTimeSamples, fReadOutWindowSize, Get, geo::CryostatID::isValid, art::errors::LogicError, MF_LOG_DEBUG, lar::util::StatCollector< T, W >::RMS(), sim::SimChannel::TDCIDEMap(), and geo::TPCID::TPC.

Referenced by produce().

158 {
160  auto const& wireReadoutGeom = art::ServiceHandle<geo::WireReadout const>()->Get();
161  raw::ChannelID_t channel = sc->Channel();
162  geo::SigType_t signal_type = wireReadoutGeom.SignalType(channel);
163  geo::View_t view = wireReadoutGeom.View(channel);
164 
165  // determine the possible geo::WireIDs for this particular channel
166  // then make a map of tdc to electrons for each one of those geo::WireIDs
167  // then find hits on each geo::WireID
168  std::vector<geo::WireID> wireids = wireReadoutGeom.ChannelToWire(channel);
169 
170  std::map<geo::WireID, std::map<unsigned int, double>> wireIDSignals;
171 
172  auto const& idemap = sc->TDCIDEMap();
173 
174  for (auto const& mapitr : idemap) {
175  unsigned short tdc = mapitr.first;
176 
178  if (tdc < spill * fReadOutWindowSize || tdc > (spill + 1) * fReadOutWindowSize) continue;
179  }
180  else {
181  if (tdc > fReadOutWindowSize) continue;
182  }
183 
184  // figure out which TPC we are in for each voxel
185 
186  for (auto const& ideitr : mapitr.second) {
187 
188  const float edep = ideitr.numElectrons;
189 
190  geo::Point_t const pos{ideitr.x, ideitr.y, ideitr.z};
191 
192  geo::TPCID tpcID = geo->FindTPCAtPosition(pos);
193  if (!tpcID.isValid) {
194  mf::LogWarning("HitCheater")
195  << "TPC for position ( " << pos.X() << " ; " << pos.Y() << " ; " << pos.Z() << " )"
196  << " in no TPC; move on to the next sim::IDE";
197  continue;
198  }
199  const unsigned int tpc = tpcID.TPC;
200  const unsigned int cstat = tpcID.Cryostat;
201 
202  for (auto const& wid : wireids) {
203  if (wid.TPC == tpc && wid.Cryostat == cstat) {
204  // in the right TPC, now figure out which wire we want
205  // this works because there is only one plane option for
206  // each WireID in each TPC
207  if (wid.Wire == wireReadoutGeom.Plane(wid).NearestWireID(pos).Wire)
208  wireIDSignals[wid][tdc] += edep;
209  } // end if in the correct TPC and Cryostat
210  } // end loop over wireids for this channel
211  } // end loop over ides for this channel
212  } // end loop over tdcs for this channel
213 
214  // now loop over each wire ID and determine where the hits are
215  for (auto const& widitr : wireIDSignals) {
216 
217  // get the first tdc in the
218  unsigned short prev = widitr.second.begin()->first;
219  unsigned short startTime = prev;
220  double totCharge = 0.;
221  double maxCharge = -1.;
222  double peakTime = 0.;
223  int multiplicity = 1;
224  lar::util::StatCollector<double> time; // reduce rounding errors
225 
226  // loop over all the tdcs for this geo::WireID
227  for (auto tdcitr : widitr.second) {
228  unsigned short tdc = tdcitr.first;
229  if (tdc < prev) {
230  throw art::Exception(art::errors::LogicError) << "SimChannel TDCs going backward!";
231  }
232 
233  // more than a one tdc gap between times with
234  // signal, start a new hit
235  if (tdc - prev > fNewHitTDCGap) {
236 
237  if (totCharge > fMinCharge) {
238  hits.emplace_back(channel, // channel
239  (raw::TDCtick_t)startTime, // start_tick
240  (raw::TDCtick_t)prev, // end_tick
241  peakTime, // peak_time
242  1., // sigma_peak_time
243  time.RMS(), // RMS
244  maxCharge, // peak_amplitude
245  std::sqrt(maxCharge), // sigma_peak_amplitude
246  totCharge, // ROIsummedADC
247  totCharge, // HitsummedADC
248  totCharge, // hit_integral
249  std::sqrt(totCharge), // hit_sigma_integral
250  multiplicity, // multiplicity
251  0, // local_index
252  1., // goodness_of_fit
253  0., // dof
254  view, // view
255  signal_type, // signal_type
256  widitr.first // wireID
257  );
258 
259  MF_LOG_DEBUG("HitCheater") << "new hit is " << hits.back();
260 
261  } // end if charge is large enough
262 
263  // reset the variables for each hit
264  startTime = tdc;
265  peakTime = tdc;
266  totCharge = 0.;
267  maxCharge = -1.;
268  time.clear();
269 
270  } // end if need to start a new hit
271 
272  const double adc = fElectronsToADC * tdcitr.second;
273 
274  totCharge += adc;
275  // use ADC as weight; the shift reduces the precision needed;
276  // average would need to be shifted back: time.Averatge() + startTime
277  // but RMS is not affected
278  time.add(tdc - startTime, adc);
279  if (adc > maxCharge) {
280  maxCharge = adc;
281  peakTime = tdc;
282  }
283 
284  prev = tdc;
285 
286  } // end loop over tdc values for the current geo::WireID
287 
288  // We might have missed the last hit, so do it now
289  if (totCharge > fMinCharge) {
290  hits.emplace_back(channel, // channel
291  (raw::TDCtick_t)startTime, // start_tick
292  (raw::TDCtick_t)prev + 1, // end_tick; prev included in the hit
293  peakTime, // peak_time
294  1., // sigma_peak_time
295  time.RMS(), // RMS
296  maxCharge, // peak_amplitude
297  std::sqrt(maxCharge), // sigma_peak_amplitude
298  totCharge, // ROIsummedADC
299  totCharge, // HitsummedADC
300  totCharge, // hit_integral
301  std::sqrt(totCharge), // hit_sigma_integral
302  multiplicity, // multiplicity
303  0, // local_index
304  1., // goodness_of_fit
305  0., // dof
306  view, // view
307  signal_type, // signal_type
308  widitr.first // wireID
309  );
310 
311  MF_LOG_DEBUG("HitCheater") << "last hit is " << hits.back();
312 
313  } // end if charge is large enough
314 
315  } // end loop over map of geo::WireID to map<tdc,electrons>
316 
317  return;
318 }
int fNumberTimeSamples
Number of total time samples (N*readoutwindowsize)
int fNewHitTDCGap
gap allowed in tdcs without charge before making a new hit
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
bool isValid
Whether this ID points to a valid element.
Definition: geo_types.h:194
CryostatID_t Cryostat
Index of cryostat.
Definition: geo_types.h:195
cout<< "Opened file "<< fin<< " ixs= "<< ixs<< endl;if(ixs==0) hhh=(TH1F *) fff-> Get("h1")
Definition: AddMC.C:8
Weight_t RMS() const
Returns the root mean square.
double fMinCharge
Minimum charge required to make a hit.
int TDCtick_t
Type representing a TDC tick.
Definition: RawTypes.h:25
TPCID FindTPCAtPosition(Point_t const &point) const
Returns the ID of the TPC at specified location.
enum geo::_plane_sigtype SigType_t
Enumerate the possible plane projections.
The data type to uniquely identify a TPC.
Definition: geo_types.h:306
Double_t edep
Definition: macro.C:13
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
raw::ChannelID_t Channel() const
Returns the readout channel this object describes.
Definition: SimChannel.h:323
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Definition: geo_vectors.h:180
int fReadOutWindowSize
Number of samples in a readout window; NOT total samples.
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
#define MF_LOG_DEBUG(id)
TDCIDEs_t const & TDCIDEMap() const
Returns all the deposited energy information as stored.
Definition: SimChannel.h:319
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
double fElectronsToADC
Conversion factor of electrons to ADC counts.
TPCID_t TPC
Index of the TPC within its cryostat.
Definition: geo_types.h:315
void clear()
Clears all the statistics.
ROOT libraries.
Collects statistics on a single quantity (weighted)
void add(Data_t value, Weight_t weight=Weight_t(1.0))
Adds one entry with specified value and weight.
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::HitCheater::produce ( art::Event e)
overrideprivatevirtual

Implements art::EDProducer.

Definition at line 95 of file HitCheater_module.cc.

References recob::Wire::Channel(), recob::HitCollectionCreator::emplace_back(), fCalDataProductInstanceName, fG4ModuleLabel, FindHitsOnChannel(), fWireModuleLabel, art::ProductRetriever::getValidHandle(), art::ProductRetriever::getView(), hits(), art::Ptr< T >::isNonnull(), art::Ptr< T >::key(), MF_LOG_DEBUG, recob::HitCollectionCreator::put_into(), sc, and recob::HitCollectionCreator::size().

96 {
97  // this object contains the hit collection
98  // and its associations to wires and raw digits:
100 
101  // Read in the wire List object(s).
104  e.getValidHandle<std::vector<recob::Wire>>(WireInputTag);
105 
106  int whatSpill = 1;
107  if (!fCalDataProductInstanceName.empty()) {
108  if (fCalDataProductInstanceName.find("ost") != std::string::npos)
109  whatSpill = 2;
110  else
111  whatSpill = 0;
112  }
113 
114  // also get the raw digits associated with the wires;
115  // we assume they have been created by the same module as the wires
116  art::FindOneP<raw::RawDigit> WireToRawDigits(wHandle, e, WireInputTag);
117 
118  // make a map of wires to channel numbers
119  std::map<raw::ChannelID_t, art::Ptr<recob::Wire>> wireMap;
120 
121  for (size_t wc = 0; wc < wHandle->size(); ++wc) {
122  art::Ptr<recob::Wire> wire(wHandle, wc);
123  wireMap[wire->Channel()] = wire;
124  }
125 
126  // get the sim::SimChannels out of the event
127  std::vector<const sim::SimChannel*> sccol;
128  e.getView(fG4ModuleLabel, sccol);
129 
130  // find the hits on each channel
131  for (sim::SimChannel const* sc : sccol) {
132  std::vector<recob::Hit> hits_on_channel;
133 
134  FindHitsOnChannel(sc, hits_on_channel, whatSpill);
135 
136  art::Ptr<recob::Wire> const& wire = wireMap[sc->Channel()];
137  art::Ptr<raw::RawDigit> rawdigits; // null by default
138  if (wire.isNonnull()) rawdigits = WireToRawDigits.at(wire.key());
139 
140  // add all the hits found on this channel to the data product,
141  // all associated to the same hit and wire
142  for (recob::Hit& hit : hits_on_channel)
143  hits.emplace_back(std::move(hit), wire, rawdigits);
144 
145  } // end loop over SimChannels
146 
147  // put the cheated hits into the event
148  MF_LOG_DEBUG("HitCheater") << "putting " << hits.size() << " hits into the event";
149  hits.put_into(e);
150 
151  return;
152 }
std::string fWireModuleLabel
label name for module making recob::Wires
Energy deposited on a readout channel by simulated tracks.
Definition: SimChannel.h:136
void FindHitsOnChannel(const sim::SimChannel *sc, std::vector< recob::Hit > &hits, int spill)
std::string fCalDataProductInstanceName
label name for module making recob::Wires
void hits()
Definition: readHits.C:15
A class handling a collection of hits and its associations.
Definition: HitCreator.h:489
std::string fG4ModuleLabel
label name for module making sim::SimChannels
key_type key() const noexcept
Definition: Ptr.h:166
Detector simulation of raw signals on wires.
std::size_t getView(std::string const &moduleLabel, std::string const &productInstanceName, std::string const &processName, std::vector< ELEMENT const * > &result) const
bool isNonnull() const noexcept
Definition: Ptr.h:204
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
Float_t sc
Definition: plot.C:23
#define MF_LOG_DEBUG(id)
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:46
Definition: fwd.h:26
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

std::string hit::HitCheater::fCalDataProductInstanceName
private

label name for module making recob::Wires

Definition at line 55 of file HitCheater_module.cc.

Referenced by HitCheater(), and produce().

double hit::HitCheater::fElectronsToADC
private

Conversion factor of electrons to ADC counts.

Definition at line 54 of file HitCheater_module.cc.

Referenced by FindHitsOnChannel(), and HitCheater().

std::string hit::HitCheater::fG4ModuleLabel
private

label name for module making sim::SimChannels

Definition at line 51 of file HitCheater_module.cc.

Referenced by HitCheater(), and produce().

double hit::HitCheater::fMinCharge
private

Minimum charge required to make a hit.

Definition at line 53 of file HitCheater_module.cc.

Referenced by FindHitsOnChannel(), and HitCheater().

int hit::HitCheater::fNewHitTDCGap
private

gap allowed in tdcs without charge before making a new hit

Definition at line 60 of file HitCheater_module.cc.

Referenced by FindHitsOnChannel(), and HitCheater().

int hit::HitCheater::fNumberTimeSamples
private

Number of total time samples (N*readoutwindowsize)

Definition at line 57 of file HitCheater_module.cc.

Referenced by FindHitsOnChannel(), and HitCheater().

int hit::HitCheater::fReadOutWindowSize
private

Number of samples in a readout window; NOT total samples.

Definition at line 56 of file HitCheater_module.cc.

Referenced by FindHitsOnChannel(), and HitCheater().

double hit::HitCheater::fSamplingRate
private

from detinfo::DetectorPropertiesService

Definition at line 58 of file HitCheater_module.cc.

Referenced by HitCheater().

int hit::HitCheater::fTriggerOffset
private

from detinfo::DetectorPropertiesService

Definition at line 59 of file HitCheater_module.cc.

Referenced by HitCheater().

std::string hit::HitCheater::fWireModuleLabel
private

label name for module making recob::Wires

Definition at line 52 of file HitCheater_module.cc.

Referenced by HitCheater(), and produce().


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