LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
hit::HitCheater Class Reference
Inheritance diagram for hit::HitCheater:
art::EDProducer art::ProducerBase art::Consumer art::EngineCreator art::ProductRegistryHelper

Public Types

using ModuleType = EDProducer
 
using WorkerType = WorkerT< EDProducer >
 
template<typename UserConfig , typename KeysToIgnore = void>
using Table = ProducerBase::Table< UserConfig, KeysToIgnore >
 

Public Member Functions

 HitCheater (fhicl::ParameterSet const &p)
 
virtual ~HitCheater ()
 
virtual void produce (art::Event &e)
 
virtual void beginJob ()
 
virtual void reconfigure (fhicl::ParameterSet const &p)
 
template<typename PROD , BranchType B = InEvent>
ProductID getProductID (std::string const &instanceName={}) const
 
template<typename PROD , BranchType B>
ProductID getProductID (ModuleDescription const &moduleDescription, std::string const &instanceName) const
 
bool modifiesEvent () const
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< T > consumes (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< T > consumesView (InputTag const &it)
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< T > mayConsume (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< T > mayConsumeView (InputTag const &it)
 
base_engine_tcreateEngine (seed_t seed)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make, label_t const &engine_label)
 
seed_t get_seed_value (fhicl::ParameterSet const &pset, char const key[]="seed", seed_t const implicit_seed=-1)
 

Static Public Member Functions

static cet::exempt_ptr< Consumernon_module_context ()
 

Protected Member Functions

CurrentProcessingContext const * currentContext () const
 
void validateConsumedProduct (BranchType const bt, ProductInfo const &pi)
 
void prepareForJob (fhicl::ParameterSet const &pset)
 
void showMissingConsumes () const
 

Private Member Functions

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 45 of file HitCheater_module.cc.

Member Typedef Documentation

using art::EDProducer::ModuleType = EDProducer
inherited

Definition at line 34 of file EDProducer.h.

template<typename UserConfig , typename KeysToIgnore = void>
using art::EDProducer::Table = ProducerBase::Table<UserConfig, KeysToIgnore>
inherited

Definition at line 43 of file EDProducer.h.

using art::EDProducer::WorkerType = WorkerT<EDProducer>
inherited

Definition at line 35 of file EDProducer.h.

Constructor & Destructor Documentation

hit::HitCheater::HitCheater ( fhicl::ParameterSet const &  p)
explicit

Definition at line 77 of file HitCheater_module.cc.

References recob::HitAndAssociationsWriterBase::declare_products(), and reconfigure().

78 {
79  this->reconfigure(p);
80 
81  // let HitCollectionCreator declare that we are going to produce
82  // hits and associations with wires and raw digits
83  // (with no particular product label)
85 }
static void declare_products(ModuleType &producer, std::string instance_name="", bool doWireAssns=true, bool doRawDigitAssns=true)
Declares the hit products we are going to fill.
Definition: HitCreator.h:1117
virtual void reconfigure(fhicl::ParameterSet const &p)
hit::HitCheater::~HitCheater ( )
virtual

Definition at line 88 of file HitCheater_module.cc.

89 {
90 }

Member Function Documentation

void hit::HitCheater::beginJob ( )
virtual

Reimplemented from art::EDProducer.

Definition at line 324 of file HitCheater_module.cc.

325 {
326  return;
327 }
template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::consumes ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::consumes ( InputTag const &  it)
inherited

Definition at line 147 of file Consumer.h.

References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().

148 {
149  if (!moduleContext_)
150  return ProductToken<T>::invalid();
151 
152  consumables_[BT].emplace_back(ConsumableType::Product,
153  TypeID{typeid(T)},
154  it.label(),
155  it.instance(),
156  it.process());
157  return ProductToken<T>{it};
158 }
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
template<typename T , art::BranchType BT>
void art::Consumer::consumesMany ( )
inherited

Definition at line 162 of file Consumer.h.

163 {
164  if (!moduleContext_)
165  return;
166 
167  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
168 }
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::consumesView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::consumesView ( InputTag const &  it)
inherited

Definition at line 172 of file Consumer.h.

References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().

173 {
174  if (!moduleContext_)
175  return ViewToken<T>::invalid();
176 
177  consumables_[BT].emplace_back(ConsumableType::ViewElement,
178  TypeID{typeid(T)},
179  it.label(),
180  it.instance(),
181  it.process());
182  return ViewToken<T>{it};
183 }
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
EngineCreator::base_engine_t & EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make 
)
inherited

Definition at line 32 of file EngineCreator.cc.

References art::EngineCreator::rng().

34 {
35  return rng()->createEngine(
36  placeholder_schedule_id(), seed, kind_of_engine_to_make);
37 }
long seed
Definition: chem4.cc:68
static art::ServiceHandle< art::RandomNumberGenerator > & rng()
EngineCreator::base_engine_t & EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make,
label_t const &  engine_label 
)
inherited

Definition at line 40 of file EngineCreator.cc.

References art::EngineCreator::rng().

43 {
44  return rng()->createEngine(
45  placeholder_schedule_id(), seed, kind_of_engine_to_make, engine_label);
46 }
long seed
Definition: chem4.cc:68
static art::ServiceHandle< art::RandomNumberGenerator > & rng()
CurrentProcessingContext const * art::EDProducer::currentContext ( ) const
protectedinherited

Definition at line 120 of file EDProducer.cc.

References art::EDProducer::current_context_.

121  {
122  return current_context_.get();
123  }
CPC_exempt_ptr current_context_
Definition: EDProducer.h:116
void hit::HitCheater::FindHitsOnChannel ( const sim::SimChannel sc,
std::vector< recob::Hit > &  hits,
int  spill 
)
private

Definition at line 151 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, edep, fElectronsToADC, geo::GeometryCore::FindTPCAtPosition(), fMinCharge, fNewHitTDCGap, fNumberTimeSamples, fReadOutWindowSize, geo::CryostatID::isValid, LOG_DEBUG, art::errors::LogicError, geo::GeometryCore::NearestWire(), lar::util::StatCollector< T, W >::RMS(), geo::GeometryCore::SignalType(), sim::SimChannel::TDCIDEMap(), geo::TPCID::TPC, and geo::GeometryCore::View().

Referenced by produce().

154 {
156 
157  raw::ChannelID_t channel = sc->Channel();
158  geo::SigType_t signal_type = geo->SignalType(channel);
159  geo::View_t view = geo->View(channel);
160 
161 
162  // determine the possible geo::WireIDs for this particular channel
163  // then make a map of tdc to electrons for each one of those geo::WireIDs
164  // then find hits on each geo::WireID
165  std::vector<geo::WireID> wireids = geo->ChannelToWire(channel);
166 
167  std::map<geo::WireID, std::map< unsigned int, double> > wireIDSignals;
168 
169  auto const& idemap = sc->TDCIDEMap();
170 
171  for(auto const& mapitr : idemap){
172  unsigned short tdc = mapitr.first;
173 
175  if( tdc < spill*fReadOutWindowSize ||
176  tdc > (spill+1)*fReadOutWindowSize ) continue;
177  } else {
178  if ( tdc < 0 || tdc > fReadOutWindowSize) continue;
179  }
180 
181  // figure out which TPC we are in for each voxel
182 
183  for(auto const& ideitr : mapitr.second){
184 
185  const float edep = ideitr.numElectrons;
186 
187  std::array<double, 3> pos;
188  pos[0] = ideitr.x;
189  pos[1] = ideitr.y;
190  pos[2] = ideitr.z;
191 
192  geo::TPCID tpcID = geo->FindTPCAtPosition(pos.data());
193  if (!tpcID.isValid) {
194  mf::LogWarning("HitCheater") << "TPC for position ( "
195  << pos[0] << " ; " << pos[1] << " ; " << pos[2] << " )"
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 == geo->NearestWire(pos.data(), wid.Plane, wid.TPC, wid.Cryostat))
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) {
231  << "SimChannel TDCs going backward!";
232  }
233 
234  // more than a one tdc gap between times with
235  // signal, start a new hit
236  if(tdc - prev > fNewHitTDCGap){
237 
238  if(totCharge > fMinCharge){
239  hits.emplace_back(
240  channel, // channel
241  (raw::TDCtick_t) startTime, // start_tick
242  (raw::TDCtick_t) prev, // end_tick
243  peakTime, // peak_time
244  1., // sigma_peak_time
245  time.RMS(), // RMS
246  maxCharge, // peak_amplitude
247  std::sqrt(maxCharge), // sigma_peak_amplitude
248  totCharge, // summedADC
249  totCharge, // hit_integral
250  std::sqrt(totCharge), // hit_sigma_integral
251  multiplicity, // multiplicity
252  0, // local_index
253  1., // goodness_of_fit
254  0., // dof
255  view, // view
256  signal_type, // signal_type
257  widitr.first // wireID
258  );
259 
260  LOG_DEBUG("HitCheater") << "new hit is " << hits.back();
261 
262  }// end if charge is large enough
263 
264  // reset the variables for each hit
265  startTime = tdc;
266  peakTime = tdc;
267  totCharge = 0.;
268  maxCharge = -1.;
269  time.clear();
270 
271  }// end if need to start a new hit
272 
273  const double adc = fElectronsToADC*tdcitr.second;
274 
275  totCharge += adc;
276  // use ADC as weight; the shift reduces the precision needed;
277  // average would need to be shifted back: time.Averatge() + startTime
278  // but RMS is not affected
279  time.add(tdc - startTime, adc);
280  if(adc > maxCharge){
281  maxCharge = adc;
282  peakTime = tdc;
283  }
284 
285  prev = tdc;
286 
287  }// end loop over tdc values for the current geo::WireID
288 
289 
290  // We might have missed the last hit, so do it now
291  if(totCharge > fMinCharge){
292  hits.emplace_back(
293  channel, // channel
294  (raw::TDCtick_t) startTime, // start_tick
295  (raw::TDCtick_t) prev + 1, // end_tick; prev included in the hit
296  peakTime, // peak_time
297  1., // sigma_peak_time
298  time.RMS(), // RMS
299  maxCharge, // peak_amplitude
300  std::sqrt(maxCharge), // sigma_peak_amplitude
301  totCharge, // summedADC
302  totCharge, // hit_integral
303  std::sqrt(totCharge), // hit_sigma_integral
304  multiplicity, // multiplicity
305  0, // local_index
306  1., // goodness_of_fit
307  0., // dof
308  view, // view
309  signal_type, // signal_type
310  widitr.first // wireID
311  );
312 
313  LOG_DEBUG("HitCheater") << "last hit is " << hits.back();
314 
315  }// end if charge is large enough
316 
317  }// end loop over map of geo::WireID to map<tdc,electrons>
318 
319 
320  return;
321 }
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:129
std::vector< geo::WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
CryostatID_t Cryostat
Index of cryostat.
Definition: geo_types.h:130
SigType_t SignalType(geo::PlaneID const &pid) const
Returns the type of signal on the channels of specified TPC plane.
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:24
geo::TPCID FindTPCAtPosition(double const worldLoc[3]) const
Returns the ID of the TPC at specified location.
enum geo::_plane_sigtype SigType_t
Enumerate the possible plane projections.
geo::WireID::WireID_t NearestWire(geo::Point_t const &point, geo::PlaneID const &planeid) const
Returns the index of wire closest to position in the specified TPC.
The data type to uniquely identify a TPC.
Definition: geo_types.h:195
Double_t edep
Definition: macro.C:13
View_t View(geo::PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
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:332
int fReadOutWindowSize
Number of samples in a readout window; NOT total samples.
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
#define LOG_DEBUG(id)
TDCIDEs_t const & TDCIDEMap() const
Returns all the deposited energy information as stored.
Definition: SimChannel.h:331
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:27
double fElectronsToADC
Conversion factor of electrons to ADC counts.
TPCID_t TPC
Index of the TPC within its cryostat.
Definition: geo_types.h:203
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.
EngineCreator::seed_t EngineCreator::get_seed_value ( fhicl::ParameterSet const &  pset,
char const  key[] = "seed",
seed_t const  implicit_seed = -1 
)
inherited

Definition at line 49 of file EngineCreator.cc.

References fhicl::ParameterSet::get().

Referenced by art::MixFilter< T >::initEngine_().

52 {
53  auto const& explicit_seeds = pset.get<std::vector<int>>(key, {});
54  return explicit_seeds.empty() ? implicit_seed : explicit_seeds.front();
55 }
template<typename PROD , BranchType B>
ProductID art::EDProducer::getProductID ( std::string const &  instanceName = {}) const
inlineinherited

Definition at line 123 of file EDProducer.h.

References art::EDProducer::moduleDescription_.

124  {
125  return ProducerBase::getProductID<PROD, B>(moduleDescription_,
126  instanceName);
127  }
ModuleDescription moduleDescription_
Definition: EDProducer.h:115
template<typename PROD , BranchType B>
ProductID art::ProducerBase::getProductID ( ModuleDescription const &  moduleDescription,
std::string const &  instanceName 
) const
inherited

Definition at line 56 of file ProducerBase.h.

References B, and art::ModuleDescription::moduleLabel().

Referenced by art::ProducerBase::modifiesEvent().

58  {
59  auto const& pd =
60  get_ProductDescription<PROD>(B, md.moduleLabel(), instanceName);
61  return pd.productID();
62  }
Int_t B
Definition: plot.C:25
template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::mayConsume ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::mayConsume ( InputTag const &  it)
inherited

Definition at line 190 of file Consumer.h.

References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().

191 {
192  if (!moduleContext_)
193  return ProductToken<T>::invalid();
194 
195  consumables_[BT].emplace_back(ConsumableType::Product,
196  TypeID{typeid(T)},
197  it.label(),
198  it.instance(),
199  it.process());
200  return ProductToken<T>{it};
201 }
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
template<typename T , art::BranchType BT>
void art::Consumer::mayConsumeMany ( )
inherited

Definition at line 205 of file Consumer.h.

206 {
207  if (!moduleContext_)
208  return;
209 
210  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
211 }
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::mayConsumeView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::mayConsumeView ( InputTag const &  it)
inherited

Definition at line 215 of file Consumer.h.

References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().

216 {
217  if (!moduleContext_)
218  return ViewToken<T>::invalid();
219 
220  consumables_[BT].emplace_back(ConsumableType::ViewElement,
221  TypeID{typeid(T)},
222  it.label(),
223  it.instance(),
224  it.process());
225  return ViewToken<T>{it};
226 }
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
bool art::ProducerBase::modifiesEvent ( ) const
inlineinherited

Definition at line 40 of file ProducerBase.h.

References art::ProducerBase::getProductID().

41  {
42  return true;
43  }
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited

Definition at line 89 of file Consumer.cc.

References fhicl::ParameterSet::get_if_present().

Referenced by art::EDProducer::doBeginJob(), art::EDFilter::doBeginJob(), and art::EDAnalyzer::doBeginJob().

90 {
91  if (!moduleContext_)
92  return;
93 
94  pset.get_if_present("errorOnMissingConsumes", requireConsumes_);
95  for (auto& consumablesPerBranch : consumables_) {
96  cet::sort_all(consumablesPerBranch);
97  }
98 }
bool requireConsumes_
Definition: Consumer.h:137
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
void hit::HitCheater::produce ( art::Event e)
virtual

Implements art::EDProducer.

Definition at line 93 of file HitCheater_module.cc.

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

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

Definition at line 330 of file HitCheater_module.cc.

References DEFINE_ART_MODULE, fCalDataProductInstanceName, fElectronsToADC, fG4ModuleLabel, fMinCharge, fNewHitTDCGap, fNumberTimeSamples, fReadOutWindowSize, fSamplingRate, fTriggerOffset, fWireModuleLabel, and fhicl::ParameterSet::get().

Referenced by HitCheater().

331 {
332  fG4ModuleLabel = p.get< std::string >("G4ModuleLabel", "largeant");
333  fWireModuleLabel = p.get< std::string >("WireModuleLabel", "caldata" );
334  fMinCharge = p.get< double >("MinimumCharge", 5. );
335  fNewHitTDCGap = p.get< int >("NewHitTDCGap", 1 );
336 
337  const detinfo::DetectorProperties* detprop = lar::providerFrom<detinfo::DetectorPropertiesService>();
338  fElectronsToADC = detprop->ElectronsToADC();
339  fSamplingRate = detprop->SamplingRate();
340  fTriggerOffset = detprop->TriggerOffset();
341 
343  size_t pos = fWireModuleLabel.find(":");
344  if( pos!=std::string::npos ) {
345  fCalDataProductInstanceName = fWireModuleLabel.substr( pos+1 );
346  fWireModuleLabel = fWireModuleLabel.substr( 0, pos );
347  }
348 
349  fReadOutWindowSize = detprop->ReadOutWindowSize();
350  fNumberTimeSamples = detprop->NumberTimeSamples();
351 
352  return;
353 }
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
std::string fCalDataProductInstanceName
label name for module making recob::Wires
double fMinCharge
Minimum charge required to make a hit.
std::string fG4ModuleLabel
label name for module making sim::SimChannels
int fReadOutWindowSize
Number of samples in a readout window; NOT total samples.
double fElectronsToADC
Conversion factor of electrons to ADC counts.
void art::Consumer::showMissingConsumes ( ) const
protectedinherited

Definition at line 125 of file Consumer.cc.

Referenced by art::EDProducer::doEndJob(), art::EDFilter::doEndJob(), art::EDAnalyzer::doEndJob(), and art::RootOutput::endJob().

126 {
127  if (!moduleContext_)
128  return;
129 
130  // If none of the branches have missing consumes statements, exit early.
131  if (std::all_of(cbegin(missingConsumes_),
132  cend(missingConsumes_),
133  [](auto const& perBranch) { return perBranch.empty(); }))
134  return;
135 
136  constexpr cet::HorizontalRule rule{60};
137  mf::LogPrint log{"MTdiagnostics"};
138  log << '\n'
139  << rule('=') << '\n'
140  << "The following consumes (or mayConsume) statements are missing from\n"
141  << module_context(moduleDescription_) << '\n'
142  << rule('-') << '\n';
143 
144  cet::for_all_with_index(
145  missingConsumes_, [&log](std::size_t const i, auto const& perBranch) {
146  for (auto const& pi : perBranch) {
147  log << " "
148  << assemble_consumes_statement(static_cast<BranchType>(i), pi)
149  << '\n';
150  }
151  });
152  log << rule('=');
153 }
cet::exempt_ptr< ModuleDescription const > moduleDescription_
Definition: Consumer.h:140
constexpr T pi()
Returns the constant pi (up to 35 decimal digits of precision)
bool moduleContext_
Definition: Consumer.h:136
ConsumableProductSets missingConsumes_
Definition: Consumer.h:139
void art::Consumer::validateConsumedProduct ( BranchType const  bt,
ProductInfo const &  pi 
)
protectedinherited

Definition at line 101 of file Consumer.cc.

References art::errors::ProductRegistrationFailure.

103 {
104  // Early exits if consumes tracking has been disabled or if the
105  // consumed product is an allowed consumable.
106  if (!moduleContext_)
107  return;
108 
109  if (cet::binary_search_all(consumables_[bt], pi))
110  return;
111 
112  if (requireConsumes_) {
114  "Consumer: an error occurred during validation of a "
115  "retrieved product\n\n")
116  << "The following consumes (or mayConsume) statement is missing from\n"
117  << module_context(moduleDescription_) << ":\n\n"
118  << " " << assemble_consumes_statement(bt, pi) << "\n\n";
119  }
120 
121  missingConsumes_[bt].insert(pi);
122 }
cet::exempt_ptr< ModuleDescription const > moduleDescription_
Definition: Consumer.h:140
bool requireConsumes_
Definition: Consumer.h:137
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
constexpr T pi()
Returns the constant pi (up to 35 decimal digits of precision)
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
ConsumableProductSets missingConsumes_
Definition: Consumer.h:139

Member Data Documentation

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

label name for module making recob::Wires

Definition at line 68 of file HitCheater_module.cc.

Referenced by produce(), and reconfigure().

double hit::HitCheater::fElectronsToADC
private

Conversion factor of electrons to ADC counts.

Definition at line 67 of file HitCheater_module.cc.

Referenced by FindHitsOnChannel(), and reconfigure().

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

label name for module making sim::SimChannels

Definition at line 64 of file HitCheater_module.cc.

Referenced by produce(), and reconfigure().

double hit::HitCheater::fMinCharge
private

Minimum charge required to make a hit.

Definition at line 66 of file HitCheater_module.cc.

Referenced by FindHitsOnChannel(), and reconfigure().

int hit::HitCheater::fNewHitTDCGap
private

gap allowed in tdcs without charge before making a new hit

Definition at line 73 of file HitCheater_module.cc.

Referenced by FindHitsOnChannel(), and reconfigure().

int hit::HitCheater::fNumberTimeSamples
private

Number of total time samples (N*readoutwindowsize)

Definition at line 70 of file HitCheater_module.cc.

Referenced by FindHitsOnChannel(), and reconfigure().

int hit::HitCheater::fReadOutWindowSize
private

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

Definition at line 69 of file HitCheater_module.cc.

Referenced by FindHitsOnChannel(), and reconfigure().

double hit::HitCheater::fSamplingRate
private

from detinfo::DetectorPropertiesService

Definition at line 71 of file HitCheater_module.cc.

Referenced by reconfigure().

int hit::HitCheater::fTriggerOffset
private

from detinfo::DetectorPropertiesService

Definition at line 72 of file HitCheater_module.cc.

Referenced by reconfigure().

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

label name for module making recob::Wires

Definition at line 65 of file HitCheater_module.cc.

Referenced by produce(), and reconfigure().


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