LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
hit::GausHitFinderAna Class Reference

Base class for creation of raw signals on wires. More...

Inheritance diagram for hit::GausHitFinderAna:
art::EDAnalyzer art::EventObserverBase art::Consumer art::EngineCreator

Public Types

using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 

Public Member Functions

 GausHitFinderAna (fhicl::ParameterSet const &pset)
 
virtual ~GausHitFinderAna ()
 
void analyze (const art::Event &evt)
 read/write access to event More...
 
void beginJob ()
 
void reconfigure (fhicl::ParameterSet const &p)
 
std::string workerType () const
 
bool modifiesEvent () const
 
void registerProducts (MasterProductRegistry &, ProductDescriptions &, ModuleDescription const &)
 
std::string const & processName () const
 
bool wantAllEvents () const
 
bool wantEvent (Event const &e)
 
fhicl::ParameterSetID selectorConfig () const
 
art::Handle< art::TriggerResultsgetTriggerResults (Event const &e) 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
 
detail::CachedProducts & cachedProducts ()
 
void validateConsumedProduct (BranchType const bt, ProductInfo const &pi)
 
void prepareForJob (fhicl::ParameterSet const &pset)
 
void showMissingConsumes () const
 

Private Attributes

std::string fHitFinderModuleLabel
 
std::string fLArG4ModuleLabel
 
std::string fCalDataModuleLabel
 
TH1F * fHitResidualAll
 
TH1F * fHitResidualAllAlt
 
TH1F * fNumberOfHitsPerEvent
 
TH2F * fPeakTimeVsWire
 
TTree * fHTree
 
Int_t fRun
 
Int_t fEvt
 
Float_t fWireTotalCharge
 
Int_t fnHits
 
Int_t fWire [kMaxHits]
 
Float_t fStartTime [kMaxHits]
 
Float_t fEndTime [kMaxHits]
 
Float_t fPeakTime [kMaxHits]
 
Float_t fPeakTimeUncert [kMaxHits]
 
Float_t fCharge [kMaxHits]
 
Float_t fChargeUncert [kMaxHits]
 
Int_t fMultiplicity [kMaxHits]
 
Float_t fGOF [kMaxHits]
 
Float_t fTotalHitChargePerEvent
 
Float_t fTruePeakPos [kMaxHits]
 

Detailed Description

Base class for creation of raw signals on wires.

Definition at line 66 of file GausHitFinderAna_module.cc.

Member Typedef Documentation

Definition at line 39 of file EDAnalyzer.h.

Definition at line 38 of file EDAnalyzer.h.

Constructor & Destructor Documentation

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

Definition at line 132 of file GausHitFinderAna_module.cc.

References reconfigure().

133  : EDAnalyzer(pset)
134  {
135  this->reconfigure(pset);
136  }
void reconfigure(fhicl::ParameterSet const &p)
EDAnalyzer(Table< Config > const &config)
Definition: EDAnalyzer.h:100
hit::GausHitFinderAna::~GausHitFinderAna ( )
virtual

Definition at line 139 of file GausHitFinderAna_module.cc.

140  {
141  }

Member Function Documentation

void hit::GausHitFinderAna::analyze ( const art::Event evt)

read/write access to event

Definition at line 201 of file GausHitFinderAna_module.cc.

References detinfo::DetectorProperties::ConvertXToTicks(), geo::CryostatID::Cryostat, DEFINE_ART_MODULE, detinfo::DetectorProperties::DriftVelocity(), e, detinfo::DetectorProperties::Efield(), art::EventID::event(), fCalDataModuleLabel, fCharge, fChargeUncert, fEndTime, fEvt, fGOF, fHitFinderModuleLabel, fHitResidualAll, fHitResidualAllAlt, fHTree, art::fill_ptr_vector(), fMultiplicity, fnHits, fNumberOfHitsPerEvent, fPeakTime, fPeakTimeUncert, fPeakTimeVsWire, fRun, fStartTime, fTotalHitChargePerEvent, fTruePeakPos, fWire, fWireTotalCharge, art::DataViewImpl::getByLabel(), recob::Hit::GoodnessOfFit(), hits(), cheat::BackTrackerService::HitToTrackIDEs(), cheat::BackTrackerService::HitToXYZ(), art::Event::id(), recob::Hit::Integral(), geo::PlaneGeo::LocalToWorld(), recob::Hit::Multiplicity(), geo::origin(), recob::Hit::PeakTime(), recob::Hit::PeakTimeMinusRMS(), recob::Hit::PeakTimePlusRMS(), geo::PlaneID::Plane, geo::GeometryCore::Plane(), art::Event::run(), detinfo::DetectorProperties::SamplingRate(), recob::Hit::SigmaIntegral(), recob::Hit::SigmaPeakTime(), recob::Wire::Signal(), detinfo::DetectorProperties::Temperature(), geo::TPCID::TPC, geo::WireID::Wire, and recob::Hit::WireID().

202  {
203 
204  // ##############################################
205  // ### Outputting Run Number and Event Number ###
206  // ##############################################
207  //std::cout << "run : " << evt.run() <<" event : "<<evt.id().event() << std::endl;
208 
209  // ### TTree Run/Event ###
210  fEvt = evt.id().event();
211  fRun = evt.run();
212 
213  // ####################################
214  // ### Getting Geometry Information ###
215  // ####################################
217 
218  // ###################################
219  // ### Getting Detector Properties ###
220  // ###################################
221  const detinfo::DetectorProperties* detp = lar::providerFrom<detinfo::DetectorPropertiesService>();
222 
223  // ##########################################
224  // ### Reading in the Wire List object(s) ###
225  // ##########################################
227  evt.getByLabel(fCalDataModuleLabel,wireVecHandle);
228 
231 
232  float TotWireCharge = 0;
233 
234  //##############################
235  //### Looping over the wires ###
236  //##############################
237  for(size_t wireIter = 0; wireIter < wireVecHandle->size(); wireIter++)
238  {
239  art::Ptr<recob::Wire> wire(wireVecHandle, wireIter);
240  // #################################################
241  // ### Getting a vector of signals for this wire ###
242  // #################################################
243  std::vector<float> signal(wire->Signal());
244 
245  // ##########################################################
246  // ### Making an iterator for the time ticks of this wire ###
247  // ##########################################################
248  std::vector<float>::iterator timeIter; // iterator for time bins
249 
250 
251 
252  // ##################################
253  // ### Looping over Signal Vector ###
254  // ##################################
255  for(timeIter = signal.begin(); timeIter+2<signal.end(); timeIter++)
256  {
257 
258  // ###########################################################
259  // ### If the ADC value is less than 2 skip this time tick ###
260  // ###########################################################
261  if(*timeIter < 2) {continue;}
262 
263  // ### Filling Total Wire Charge ###
264  TotWireCharge += *timeIter;
265 
266 
267  }//<---End timeIter loop
268 
269 
270  }//<---End wireIter loop
271 
272  // ~~~ Filling the total charge in the event ~~~
273  //std::cout<<"Total Real Charge = "<<TotWireCharge<<std::endl;
274  fWireTotalCharge = TotWireCharge;
275 
278 
279  // ##################################################
280  // ### Getting the Reconstructed Hits (hitHandle) ###
281  // ##################################################
283  evt.getByLabel(fHitFinderModuleLabel,hitHandle);
284 
285  // #########################################
286  // ### Putting Hits into a vector (hits) ###
287  // #########################################
288  std::vector< art::Ptr<recob::Hit> > hits;
289  art::fill_ptr_vector(hits, hitHandle);
290 
291  float TotCharge = 0;
292  int hitCount = 0;
293  // ### Number of Hits in the event ###
294  fnHits = hitHandle->size();
295  fNumberOfHitsPerEvent->Fill(hitHandle->size());
296  // #########################
297  // ### Looping over Hits ###
298  // #########################
299  for(size_t numHit = 0; numHit < hitHandle->size(); ++numHit)
300  {
301  // === Finding Channel associated with the hit ===
302  art::Ptr<recob::Hit> hit(hitHandle, numHit);
303 
304  fWire[hitCount] = hit->WireID().Wire;
305  fStartTime[hitCount] = hit->PeakTimeMinusRMS();
306  fEndTime[hitCount] = hit->PeakTimePlusRMS();
307  fPeakTime[hitCount] = hit->PeakTime();
308  fPeakTimeUncert[hitCount]= hit->SigmaPeakTime();
309  fCharge[hitCount] = hit->Integral();
310  fChargeUncert[hitCount] = hit->SigmaIntegral();
311  fMultiplicity[hitCount] = hit->Multiplicity();
312  fGOF[hitCount] = hit->GoodnessOfFit();
313  //std::cout<<"Hit Charge = "<<hit->Charge()<<std::endl;
314  //std::cout<<"StartTime = "<<hit->StartTime()<<std::endl;
315 
316  hitCount++;
317  TotCharge += hit->Integral();
318 
319  fPeakTimeVsWire->Fill(hit->WireID().Wire, hit->PeakTime());
320  }//<---End numHit
321  //std::cout<<"Total Reco Charge = "<<TotCharge<<std::endl;
322  fTotalHitChargePerEvent = TotCharge;
323 
326 
327  // ###############################################################
328  // ### Integers used for setting Channel, TPC, Plane, and Wire ###
329  // ###############################################################
330  unsigned int plane = 0;
331 
332  // ############################################
333  // ### Variables used for Truth Calculation ###
334  // ############################################
335  Float_t TruthHitTime = 0 , TruthHitCalculated = 0;
336  int count = 0;
337 
338  // ================================================
339  // === Calculating Time Tick and Drift Velocity ===
340  // ================================================
341  double time_tick = detp->SamplingRate()/1000.;
342  double drift_velocity = detp->DriftVelocity(detp->Efield(),detp->Temperature());
343 
344  for(size_t nh = 0; nh < hitHandle->size(); nh++)
345  {
346  // === Finding Channel associated with the hit ===
347  art::Ptr<recob::Hit> hitPoint(hitHandle, nh);
348  plane = hitPoint->WireID().Plane;
349  //wire = hitPoint->WireID().Wire;
350 
351 
352  // ===================================================================
353  // Using Track IDE's to locate the XYZ location from truth information
354  // ===================================================================
355  std::vector<sim::TrackIDE> trackides;
356  std::vector<double> xyz;
357  try
358  {
359  // ####################################
360  // ### Using BackTrackerService HitCheater ###
361  // ####################################
363 
364  trackides = bt_serv->HitToTrackIDEs(hitPoint);
365  xyz = bt_serv->HitToXYZ(hitPoint);
366  }
367  catch(cet::exception e)
368  {mf::LogWarning("GausHitFinderAna") << "BackTrackerService Failed";
369  continue;}
370 
371 
372  // ==============================================================
373  // Calculating the truth tick position of the hit using 2 methods
374  // Method 1: ConvertXtoTicks from the detector properties package
375  // Method 2: Actually do the calculation myself to double check things
376  // ==============================================================
377 
378  // ### Method 1 ###
379  TruthHitTime = detp->ConvertXToTicks(xyz[0], plane, hitPoint->WireID().TPC, hitPoint->WireID().Cryostat);
380 
381  // ### Method 2 ###
382  // ================================================
383  // Establishing the x-position of the current plane
384  // ================================================
385  const double origin[3] = {0.};
386  double pos[3];
387  geom->Plane(plane).LocalToWorld(origin, pos);
388  double planePos_timeCorr = (pos[0]/drift_velocity)*(1./time_tick)+60;
389  //<---x position of plane / drift velocity + 60 (Trigger offset)
390 
391  TruthHitCalculated = ( (xyz[0]) / (drift_velocity * time_tick) ) + planePos_timeCorr;
392 
393  fTruePeakPos[count] = TruthHitTime;
394  count++;
395  double hitresid = ( ( TruthHitTime - hitPoint->PeakTime() ) / hitPoint->SigmaPeakTime() );
396  fHitResidualAll->Fill( hitresid );
397 
398  double hitresidAlt = ( ( TruthHitCalculated - hitPoint->PeakTime() ) / hitPoint->SigmaPeakTime() );
399  fHitResidualAllAlt->Fill(hitresidAlt);
400 
401  }//<---End nh loop
402 
403  fHTree->Fill();
404  return;
405 
406  }//end analyze method
PlaneGeo const & Plane(unsigned int const p, unsigned int const tpc=0, unsigned int const cstat=0) const
Returns the specified wire.
const std::vector< double > HitToXYZ(const recob::Hit &hit)
intermediate_table::iterator iterator
const std::vector< sim::TrackIDE > HitToTrackIDEs(recob::Hit const &hit)
virtual double SamplingRate() const =0
Returns the period of the TPC readout electronics clock.
virtual double ConvertXToTicks(double X, int p, int t, int c) const =0
void hits()
Definition: readHits.C:15
virtual double Temperature() const =0
Detector simulation of raw signals on wires.
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
virtual double DriftVelocity(double efield=0., double temperature=0.) const =0
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
EventNumber_t event() const
Definition: EventID.h:117
virtual double Efield(unsigned int planegap=0) const =0
Returns the nominal electric field in the specified volume.
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:464
Float_t e
Definition: plot.C:34
RunNumber_t run() const
Definition: Event.h:77
Definition: fwd.h:25
void LocalToWorld(const double *plane, double *world) const
Transform point from local plane frame to world frame.
Definition: PlaneGeo.h:1124
EventID id() const
Definition: Event.h:56
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:230
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
void hit::GausHitFinderAna::beginJob ( )
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 151 of file GausHitFinderAna_module.cc.

References fCharge, fChargeUncert, fEndTime, fEvt, fGOF, fHitResidualAll, fHitResidualAllAlt, fHTree, fMultiplicity, fnHits, fNumberOfHitsPerEvent, fPeakTime, fPeakTimeUncert, fPeakTimeVsWire, fRun, fStartTime, fTotalHitChargePerEvent, fTruePeakPos, fWire, fWireTotalCharge, and art::TFileDirectory::make().

152  {
153  // get access to the TFile service
155 
156 
157  // ======================================
158  // === Hit Information for Histograms ===
159  fHitResidualAll = tfs->make<TH1F>("fHitResidualAll", "Hit Residual All", 1600, -400, 400);
160  fHitResidualAllAlt = tfs->make<TH1F>("fHitResidualAllAlt", "Hit Residual All", 1600, -400, 400);
161  fNumberOfHitsPerEvent= tfs->make<TH1F>("fNumberOfHitsPerEvent", "Number of Hits in Each Event", 10000, 0, 10000);
162  fPeakTimeVsWire = tfs->make<TH2F>("fPeakTimeVsWire", "Peak Time vs Wire Number", 3200, 0, 3200, 9500, 0, 9500);
163 
164 
165 
166 
167  // ##############
168  // ### TTree ####
169  fHTree = tfs->make<TTree>("HTree","HTree");
170 
171  // === Event Info ====
172  fHTree->Branch("Evt", &fEvt, "Evt/I");
173  fHTree->Branch("Run", &fRun, "Run/I");
174 
175  // === Wire Info ===
176  fHTree->Branch("WireTotalCharge", &fWireTotalCharge, "WireTotalCharge/F");
177 
178  // === Hit Info ===
179  fHTree->Branch("nHits", &fnHits, "nHits/I");
180  fHTree->Branch("Wire", &fWire, "Wire[nHits]/I");
181  fHTree->Branch("StartTime", &fStartTime, "fStartTime[nHits]/F");
182  fHTree->Branch("EndTime", &fEndTime, "fEndTime[nHits]/F");
183  fHTree->Branch("PeakTime", &fPeakTime, "fPeakTime[nHits]/F");
184  fHTree->Branch("PeakTimeUncert", &fPeakTimeUncert, "fPeakTimeUncert[nHits]/F");
185  fHTree->Branch("Charge", &fCharge, "fCharge[nHits]/F");
186  fHTree->Branch("ChargeUncert", &fChargeUncert, "fChargeUncert[nHits]/F");
187  fHTree->Branch("Multiplicity", &fMultiplicity, "fMultiplicity[nHits]/I");
188  fHTree->Branch("GOF", &fGOF, "fGOF[nHits]/F");
189 
190  // === Total Hit Information ===
191  fHTree->Branch("TotalHitChargePerEvent", &fTotalHitChargePerEvent, "TotalHitChargePerEvent/F");
192 
193  // === Truth Hit Information from BackTrackerService ===
194  fHTree->Branch("TruePeakPos", &fTruePeakPos, "fTruePeakPos[nHits]/F");
195 
196  return;
197 
198  }
T * make(ARGS...args) const
detail::CachedProducts& art::EventObserverBase::cachedProducts ( )
inlineprotectedinherited

Definition at line 79 of file EventObserverBase.h.

References art::EventObserverBase::selectors_.

Referenced by art::EDAnalyzer::doEvent(), and art::OutputModule::doWriteEvent().

80  {
81  return selectors_;
82  }
detail::CachedProducts selectors_
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::EDAnalyzer::currentContext ( ) const
protectedinherited

Definition at line 114 of file EDAnalyzer.cc.

References art::EDAnalyzer::current_context_.

Referenced by art::EDAnalyzer::workerType().

115  {
116  return current_context_.get();
117  }
CPC_exempt_ptr current_context_
Definition: EDAnalyzer.h:179
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 }
art::Handle<art::TriggerResults> art::EventObserverBase::getTriggerResults ( Event const &  e) const
inlineinherited

Definition at line 61 of file EventObserverBase.h.

References art::detail::CachedProducts::getOneTriggerResults(), and art::EventObserverBase::selectors_.

Referenced by art::OutputModule::doWriteEvent().

62  {
64  }
detail::CachedProducts selectors_
art::Handle< art::TriggerResults > getOneTriggerResults(Event const &) const
Float_t e
Definition: plot.C:34
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::EventObserverBase::modifiesEvent ( ) const
inlineinherited

Definition at line 25 of file EventObserverBase.h.

26  {
27  return false;
28  }
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
std::string const& art::EventObserverBase::processName ( ) const
inlineinherited
void hit::GausHitFinderAna::reconfigure ( fhicl::ParameterSet const &  p)

Definition at line 143 of file GausHitFinderAna_module.cc.

References fCalDataModuleLabel, fHitFinderModuleLabel, fLArG4ModuleLabel, and fhicl::ParameterSet::get().

Referenced by GausHitFinderAna().

144  {
145  fHitFinderModuleLabel = p.get< std::string >("HitsModuleLabel");
146  fLArG4ModuleLabel = p.get< std::string >("LArGeantModuleLabel");
147  fCalDataModuleLabel = p.get< std::string >("CalDataModuleLabel");
148  return;
149  }
void art::EventObserverBase::registerProducts ( MasterProductRegistry ,
ProductDescriptions ,
ModuleDescription const &   
)
inlineinherited

Definition at line 33 of file EventObserverBase.h.

36  {}
fhicl::ParameterSetID art::EventObserverBase::selectorConfig ( ) const
inlineinherited

Definition at line 56 of file EventObserverBase.h.

References art::EventObserverBase::selector_config_id_.

Referenced by art::RootOutputFile::writeOne().

57  {
58  return selector_config_id_;
59  }
fhicl::ParameterSetID selector_config_id_
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
bool art::EventObserverBase::wantAllEvents ( ) const
inlineinherited
bool art::EventObserverBase::wantEvent ( Event const &  e)
inlineinherited
std::string art::EDAnalyzer::workerType ( ) const
inlineinherited

Definition at line 109 of file EDAnalyzer.h.

References art::EDAnalyzer::currentContext().

110  {
111  return "WorkerT<EDAnalyzer>";
112  }

Member Data Documentation

std::string hit::GausHitFinderAna::fCalDataModuleLabel
private

Definition at line 82 of file GausHitFinderAna_module.cc.

Referenced by analyze(), and reconfigure().

Float_t hit::GausHitFinderAna::fCharge[kMaxHits]
private

Definition at line 112 of file GausHitFinderAna_module.cc.

Referenced by analyze(), and beginJob().

Float_t hit::GausHitFinderAna::fChargeUncert[kMaxHits]
private

Definition at line 113 of file GausHitFinderAna_module.cc.

Referenced by analyze(), and beginJob().

Float_t hit::GausHitFinderAna::fEndTime[kMaxHits]
private

Definition at line 109 of file GausHitFinderAna_module.cc.

Referenced by analyze(), and beginJob().

Int_t hit::GausHitFinderAna::fEvt
private

Definition at line 98 of file GausHitFinderAna_module.cc.

Referenced by analyze(), and beginJob().

Float_t hit::GausHitFinderAna::fGOF[kMaxHits]
private

Definition at line 115 of file GausHitFinderAna_module.cc.

Referenced by analyze(), and beginJob().

std::string hit::GausHitFinderAna::fHitFinderModuleLabel
private

Definition at line 80 of file GausHitFinderAna_module.cc.

Referenced by analyze(), and reconfigure().

TH1F* hit::GausHitFinderAna::fHitResidualAll
private

Definition at line 87 of file GausHitFinderAna_module.cc.

Referenced by analyze(), and beginJob().

TH1F* hit::GausHitFinderAna::fHitResidualAllAlt
private

Definition at line 88 of file GausHitFinderAna_module.cc.

Referenced by analyze(), and beginJob().

TTree* hit::GausHitFinderAna::fHTree
private

Definition at line 95 of file GausHitFinderAna_module.cc.

Referenced by analyze(), and beginJob().

std::string hit::GausHitFinderAna::fLArG4ModuleLabel
private

Definition at line 81 of file GausHitFinderAna_module.cc.

Referenced by reconfigure().

Int_t hit::GausHitFinderAna::fMultiplicity[kMaxHits]
private

Definition at line 114 of file GausHitFinderAna_module.cc.

Referenced by analyze(), and beginJob().

Int_t hit::GausHitFinderAna::fnHits
private

Definition at line 106 of file GausHitFinderAna_module.cc.

Referenced by analyze(), and beginJob().

TH1F* hit::GausHitFinderAna::fNumberOfHitsPerEvent
private

Definition at line 89 of file GausHitFinderAna_module.cc.

Referenced by analyze(), and beginJob().

Float_t hit::GausHitFinderAna::fPeakTime[kMaxHits]
private

Definition at line 110 of file GausHitFinderAna_module.cc.

Referenced by analyze(), and beginJob().

Float_t hit::GausHitFinderAna::fPeakTimeUncert[kMaxHits]
private

Definition at line 111 of file GausHitFinderAna_module.cc.

Referenced by analyze(), and beginJob().

TH2F* hit::GausHitFinderAna::fPeakTimeVsWire
private

Definition at line 90 of file GausHitFinderAna_module.cc.

Referenced by analyze(), and beginJob().

Int_t hit::GausHitFinderAna::fRun
private

Definition at line 97 of file GausHitFinderAna_module.cc.

Referenced by analyze(), and beginJob().

Float_t hit::GausHitFinderAna::fStartTime[kMaxHits]
private

Definition at line 108 of file GausHitFinderAna_module.cc.

Referenced by analyze(), and beginJob().

Float_t hit::GausHitFinderAna::fTotalHitChargePerEvent
private

Definition at line 118 of file GausHitFinderAna_module.cc.

Referenced by analyze(), and beginJob().

Float_t hit::GausHitFinderAna::fTruePeakPos[kMaxHits]
private

Definition at line 121 of file GausHitFinderAna_module.cc.

Referenced by analyze(), and beginJob().

Int_t hit::GausHitFinderAna::fWire[kMaxHits]
private

Definition at line 107 of file GausHitFinderAna_module.cc.

Referenced by analyze(), and beginJob().

Float_t hit::GausHitFinderAna::fWireTotalCharge
private

Definition at line 102 of file GausHitFinderAna_module.cc.

Referenced by analyze(), and beginJob().


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