LArSoft  v09_90_00
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 41 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 63 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().

63  : EDProducer{p}
64 {
65  fG4ModuleLabel = p.get<std::string>("G4ModuleLabel", "largeant");
66  fWireModuleLabel = p.get<std::string>("WireModuleLabel", "caldata");
67  fMinCharge = p.get<double>("MinimumCharge", 5.);
68  fNewHitTDCGap = p.get<int>("NewHitTDCGap", 1);
69 
70  auto const clock_data = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataForJob();
71  auto const det_prop =
73  fElectronsToADC = det_prop.ElectronsToADC();
74  fSamplingRate = sampling_rate(clock_data);
75  fTriggerOffset = trigger_offset(clock_data);
76 
78  size_t pos = fWireModuleLabel.find(":");
79  if (pos != std::string::npos) {
81  fWireModuleLabel = fWireModuleLabel.substr(0, pos);
82  }
83 
84  fReadOutWindowSize = det_prop.ReadOutWindowSize();
85  fNumberTimeSamples = det_prop.NumberTimeSamples();
86 
87  // let HitCollectionCreator declare that we are going to produce
88  // hits and associations with wires and raw digits
89  // (with no particular product label)
91 }
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:248
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 154 of file HitCheater_module.cc.

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

Referenced by produce().

157 {
159 
160  raw::ChannelID_t channel = sc->Channel();
161  geo::SigType_t signal_type = geo->SignalType(channel);
162  geo::View_t view = geo->View(channel);
163 
164  // determine the possible geo::WireIDs for this particular channel
165  // then make a map of tdc to electrons for each one of those geo::WireIDs
166  // then find hits on each geo::WireID
167  std::vector<geo::WireID> wireids = geo->ChannelToWire(channel);
168 
169  std::map<geo::WireID, std::map<unsigned int, double>> wireIDSignals;
170 
171  auto const& idemap = sc->TDCIDEMap();
172 
173  for (auto const& mapitr : idemap) {
174  unsigned short tdc = mapitr.first;
175 
177  if (tdc < spill * fReadOutWindowSize || tdc > (spill + 1) * fReadOutWindowSize) continue;
178  }
179  else {
180  if (tdc > fReadOutWindowSize) continue;
181  }
182 
183  // figure out which TPC we are in for each voxel
184 
185  for (auto const& ideitr : mapitr.second) {
186 
187  const float edep = ideitr.numElectrons;
188 
189  geo::Point_t const pos{ideitr.x, ideitr.y, ideitr.z};
190 
191  geo::TPCID tpcID = geo->FindTPCAtPosition(pos);
192  if (!tpcID.isValid) {
193  mf::LogWarning("HitCheater")
194  << "TPC for position ( " << pos.X() << " ; " << pos.Y() << " ; " << pos.Z() << " )"
195  << " in no TPC; move on to the next sim::IDE";
196  continue;
197  }
198  const unsigned int tpc = tpcID.TPC;
199  const unsigned int cstat = tpcID.Cryostat;
200 
201  for (auto const& wid : wireids) {
202  if (wid.TPC == tpc && wid.Cryostat == cstat) {
203  // in the right TPC, now figure out which wire we want
204  // this works because there is only one plane option for
205  // each WireID in each TPC
206  if (wid.Wire == geo->NearestWireID(pos, wid).Wire) wireIDSignals[wid][tdc] += edep;
207  } // end if in the correct TPC and Cryostat
208  } // end loop over wireids for this channel
209  } // end loop over ides for this channel
210  } // end loop over tdcs for this channel
211 
212  // now loop over each wire ID and determine where the hits are
213  for (auto const& widitr : wireIDSignals) {
214 
215  // get the first tdc in the
216  unsigned short prev = widitr.second.begin()->first;
217  unsigned short startTime = prev;
218  double totCharge = 0.;
219  double maxCharge = -1.;
220  double peakTime = 0.;
221  int multiplicity = 1;
222  lar::util::StatCollector<double> time; // reduce rounding errors
223 
224  // loop over all the tdcs for this geo::WireID
225  for (auto tdcitr : widitr.second) {
226  unsigned short tdc = tdcitr.first;
227  if (tdc < prev) {
228  throw art::Exception(art::errors::LogicError) << "SimChannel TDCs going backward!";
229  }
230 
231  // more than a one tdc gap between times with
232  // signal, start a new hit
233  if (tdc - prev > fNewHitTDCGap) {
234 
235  if (totCharge > fMinCharge) {
236  hits.emplace_back(channel, // channel
237  (raw::TDCtick_t)startTime, // start_tick
238  (raw::TDCtick_t)prev, // end_tick
239  peakTime, // peak_time
240  1., // sigma_peak_time
241  time.RMS(), // RMS
242  maxCharge, // peak_amplitude
243  std::sqrt(maxCharge), // sigma_peak_amplitude
244  totCharge, // summedADC
245  totCharge, // hit_integral
246  std::sqrt(totCharge), // hit_sigma_integral
247  multiplicity, // multiplicity
248  0, // local_index
249  1., // goodness_of_fit
250  0., // dof
251  view, // view
252  signal_type, // signal_type
253  widitr.first // wireID
254  );
255 
256  MF_LOG_DEBUG("HitCheater") << "new hit is " << hits.back();
257 
258  } // end if charge is large enough
259 
260  // reset the variables for each hit
261  startTime = tdc;
262  peakTime = tdc;
263  totCharge = 0.;
264  maxCharge = -1.;
265  time.clear();
266 
267  } // end if need to start a new hit
268 
269  const double adc = fElectronsToADC * tdcitr.second;
270 
271  totCharge += adc;
272  // use ADC as weight; the shift reduces the precision needed;
273  // average would need to be shifted back: time.Averatge() + startTime
274  // but RMS is not affected
275  time.add(tdc - startTime, adc);
276  if (adc > maxCharge) {
277  maxCharge = adc;
278  peakTime = tdc;
279  }
280 
281  prev = tdc;
282 
283  } // end loop over tdc values for the current geo::WireID
284 
285  // We might have missed the last hit, so do it now
286  if (totCharge > fMinCharge) {
287  hits.emplace_back(channel, // channel
288  (raw::TDCtick_t)startTime, // start_tick
289  (raw::TDCtick_t)prev + 1, // end_tick; prev included in the hit
290  peakTime, // peak_time
291  1., // sigma_peak_time
292  time.RMS(), // RMS
293  maxCharge, // peak_amplitude
294  std::sqrt(maxCharge), // sigma_peak_amplitude
295  totCharge, // summedADC
296  totCharge, // hit_integral
297  std::sqrt(totCharge), // hit_sigma_integral
298  multiplicity, // multiplicity
299  0, // local_index
300  1., // goodness_of_fit
301  0., // dof
302  view, // view
303  signal_type, // signal_type
304  widitr.first // wireID
305  );
306 
307  MF_LOG_DEBUG("HitCheater") << "last hit is " << hits.back();
308 
309  } // end if charge is large enough
310 
311  } // end loop over map of geo::WireID to map<tdc,electrons>
312 
313  return;
314 }
std::vector< WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
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:210
CryostatID_t Cryostat
Index of cryostat.
Definition: geo_types.h:211
WireID_t Wire
Index of the wire within its plane.
Definition: geo_types.h:563
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:381
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
SigType_t SignalType(PlaneID const &pid) const
Returns the type of signal on the channels of specified TPC plane.
WireID NearestWireID(Point_t const &point, PlaneID const &planeid) const
Returns the ID of wire closest to position in the specified TPC.
int fReadOutWindowSize
Number of samples in a readout window; NOT total samples.
View_t View(PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
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:399
void clear()
Clears all the statistics.
Namespace collecting geometry-related classes utilities.
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 94 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().

95 {
96  // this object contains the hit collection
97  // and its associations to wires and raw digits:
99 
100  // Read in the wire List object(s).
103  e.getValidHandle<std::vector<recob::Wire>>(WireInputTag);
104 
105  int whatSpill = 1;
106  if (!fCalDataProductInstanceName.empty()) {
107  if (fCalDataProductInstanceName.find("ost") != std::string::npos)
108  whatSpill = 2;
109  else
110  whatSpill = 0;
111  }
112 
113  // also get the raw digits associated with the wires;
114  // we assume they have been created by the same module as the wires
115  art::FindOneP<raw::RawDigit> WireToRawDigits(wHandle, e, WireInputTag);
116 
117  // make a map of wires to channel numbers
118  std::map<raw::ChannelID_t, art::Ptr<recob::Wire>> wireMap;
119 
120  for (size_t wc = 0; wc < wHandle->size(); ++wc) {
121  art::Ptr<recob::Wire> wire(wHandle, wc);
122  wireMap[wire->Channel()] = wire;
123  }
124 
125  // get the sim::SimChannels out of the event
126  std::vector<const sim::SimChannel*> sccol;
127  e.getView(fG4ModuleLabel, sccol);
128 
129  // find the hits on each channel
130  for (sim::SimChannel const* sc : sccol) {
131  std::vector<recob::Hit> hits_on_channel;
132 
133  FindHitsOnChannel(sc, hits_on_channel, whatSpill);
134 
135  art::Ptr<recob::Wire> const& wire = wireMap[sc->Channel()];
136  art::Ptr<raw::RawDigit> rawdigits; // null by default
137  if (wire.isNonnull()) rawdigits = WireToRawDigits.at(wire.key());
138 
139  // add all the hits found on this channel to the data product,
140  // all associated to the same hit and wire
141  for (recob::Hit& hit : hits_on_channel)
142  hits.emplace_back(std::move(hit), wire, rawdigits);
143 
144  } // end loop over SimChannels
145 
146  // put the cheated hits into the event
147  MF_LOG_DEBUG("HitCheater") << "putting " << hits.size() << " hits into the event";
148  hits.put_into(e);
149 
150  return;
151 }
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:481
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 54 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 53 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 50 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 52 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 59 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 56 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 55 of file HitCheater_module.cc.

Referenced by FindHitsOnChannel(), and HitCheater().

double hit::HitCheater::fSamplingRate
private

from detinfo::DetectorPropertiesService

Definition at line 57 of file HitCheater_module.cc.

Referenced by HitCheater().

int hit::HitCheater::fTriggerOffset
private

from detinfo::DetectorPropertiesService

Definition at line 58 of file HitCheater_module.cc.

Referenced by HitCheater().

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

label name for module making recob::Wires

Definition at line 51 of file HitCheater_module.cc.

Referenced by HitCheater(), and produce().


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