LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
larg4::LArG4Ana Class Reference
Inheritance diagram for larg4::LArG4Ana:
art::EDAnalyzer art::EventObserverBase art::Consumer art::EngineCreator

Public Types

using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 

Public Member Functions

 LArG4Ana (fhicl::ParameterSet const &pset)
 Standard constructor and destructor for an FMWK module. More...
 
virtual ~LArG4Ana ()
 
void analyze (const art::Event &evt)
 
void beginJob ()
 
void reconfigure (fhicl::ParameterSet const &pset)
 
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 fG4ModuleLabel
 module label for the Geant More...
 
std::string fTruthModuleLabel
 module label for the Geant More...
 
TH1D * fPDGCodes
 
TH1D * fPi0Momentum
 
TH1D * fnEnergy
 
TH1D * fnDist
 
TH1D * fnumChannels
 The number of channels recieving charge per event. More...
 
TProfile * fnumIDEs
 Number of drift electrons per channel. More...
 
TH1D * fEventCharge
 Charge collected per event. More...
 
TH1D * fEventEnergy
 Energy collected per event. More...
 
TProfile * fChannelCharge
 Charge per channel. More...
 
TProfile * fChannelEnergy
 Energy per channel. More...
 
TTree * fTree
 
Int_t fTEvt
 
Int_t fTSub
 
Int_t fTRun
 
Int_t fTPdg
 
Int_t fTID
 
Int_t fTNds
 
Int_t fTNdsOriginal
 
Int_t fTNds4
 
Int_t * fTDID
 
Int_t * fTDPdg
 
Float_t * fTDWt
 
Char_t fTProcess [35]
 
Char_t fTVolume [35]
 
Char_t fTTVolume [35]
 
Char_t fTMaterial [35]
 
Char_t fTDProcess [200][35]
 
Int_t fTParentID
 
Int_t fTStatus
 
Float_t fTWeight
 
Float_t * fT4Origin
 
Float_t * fT4DOrigin
 
Float_t * fT4Termination
 
Float_t * fT4Momentum
 
Float_t * fT4DMomentum
 

Detailed Description

Definition at line 56 of file LArG4Ana_module.cc.

Member Typedef Documentation

Definition at line 39 of file EDAnalyzer.h.

Definition at line 38 of file EDAnalyzer.h.

Constructor & Destructor Documentation

larg4::LArG4Ana::LArG4Ana ( fhicl::ParameterSet const &  pset)
explicit

Standard constructor and destructor for an FMWK module.

Definition at line 119 of file LArG4Ana_module.cc.

References reconfigure().

120  : EDAnalyzer(pset)
121  {
122  this->reconfigure(pset);
123  }
void reconfigure(fhicl::ParameterSet const &pset)
EDAnalyzer(Table< Config > const &config)
Definition: EDAnalyzer.h:100
larg4::LArG4Ana::~LArG4Ana ( )
virtual

Definition at line 127 of file LArG4Ana_module.cc.

128  {
129  }

Member Function Documentation

void larg4::LArG4Ana::analyze ( const art::Event evt)

Definition at line 218 of file LArG4Ana_module.cc.

References d, DEFINE_ART_MODULE, E, sim::ParticleList::end(), art::EventID::event(), fChannelCharge, fChannelEnergy, fEventCharge, fEventEnergy, fG4ModuleLabel, sim::ParticleList::find(), fnDist, fnEnergy, fnumChannels, fnumIDEs, fPDGCodes, fPi0Momentum, fT4DMomentum, fT4DOrigin, fT4Momentum, fT4Origin, fT4Termination, fTDID, fTDPdg, fTDProcess, fTDWt, fTEvt, fTID, fTMaterial, fTNds, fTNdsOriginal, fTParentID, fTPdg, fTProcess, fTree, fTRun, fTStatus, fTSub, fTTVolume, fTVolume, fTWeight, art::DataViewImpl::getView(), art::Event::id(), geo::GeometryCore::MaterialName(), sim::NoParticleId, cheat::ParticleInventoryService::ParticleList(), art::Event::run(), s, sim::ParticleList::size(), art::Event::subRun(), and geo::GeometryCore::VolumeName().

219  {
220 
221  //get the list of particles from this event
223  const sim::ParticleList& plist = pi_serv->ParticleList();
225 
226  // loop over all sim::SimChannels in the event and make sure there are no
227  // sim::IDEs with trackID values that are not in the sim::ParticleList
228  std::vector<const sim::SimChannel*> sccol;
229  evt.getView(fG4ModuleLabel, sccol);
230 
231  double totalCharge=0.0;
232  double totalEnergy=0.0;
233  fnumChannels->Fill(sccol.size());
234  for(size_t sc = 0; sc < sccol.size(); ++sc){
235  double numIDEs=0.0;
236  double scCharge=0.0;
237  double scEnergy=0.0;
238  const auto & tdcidemap = sccol[sc]->TDCIDEMap();
239  for(auto mapitr = tdcidemap.begin(); mapitr != tdcidemap.end(); mapitr++){
240  const std::vector<sim::IDE> idevec = (*mapitr).second;
241  numIDEs += idevec.size();
242  for(size_t iv = 0; iv < idevec.size(); ++iv){
243  if(plist.find( idevec[iv].trackID ) == plist.end()
244  && idevec[iv].trackID != sim::NoParticleId)
245  mf::LogWarning("LArG4Ana") << idevec[iv].trackID << " is not in particle list";
246  totalCharge +=idevec[iv].numElectrons;
247  scCharge += idevec[iv].numElectrons;
248  totalEnergy +=idevec[iv].energy;
249  scEnergy += idevec[iv].energy;
250  }
251  }
252  fnumIDEs->Fill(sc,numIDEs);
253  fChannelCharge->Fill(sc,scCharge);
254  fChannelEnergy->Fill(sc,scEnergy);
255  }
256  fEventCharge->Fill(totalCharge);
257  fEventEnergy->Fill(totalEnergy);
258 
259  // get the particles from the back tracker
260  const sim::ParticleList& Particles = pi_serv->ParticleList();
261  std::vector<const simb::MCParticle*> pvec;
262  pvec.reserve(Particles.size());
263  for (const auto& PartPair: Particles) {
264  pvec.push_back(PartPair.second);
265  fPDGCodes->Fill(PartPair.second->PdgCode());
266  }
267 
268  // now look for pi0's that decay to 2 gammas
269  int pi0loc = -1;
270  int numpi0gamma = 0;
271  for(unsigned int i = 0; i < pvec.size(); ++i){
272  if(pvec[i]->PdgCode() == 111) pi0loc = i;
273  if(pvec[i]->Mother() == pi0loc+1 &&
274  pi0loc > 0 &&
275  pvec[i]->PdgCode() == 22){
276  mf::LogInfo("LArG4Ana") << pvec[i]->E() << " gamma energy ";
277  ++numpi0gamma;
278  }
279 
280  // n,Lambda,K0s,K0L,K0
281  if (pvec[i]->PdgCode() == 2112 ||
282  pvec[i]->PdgCode() == 3122 ||
283  pvec[i]->PdgCode() == 130 ||
284  pvec[i]->PdgCode() == 310 ||
285  pvec[i]->PdgCode() == 311 ) {
286  fnEnergy->Fill(pvec[i]->E(),pvec[i]->Weight());
287  fnDist->Fill(pvec[i]->Vx(),pvec[i]->Weight());
288  }
289 
290  fTPdg = pvec[i]->PdgCode();
291  fTID = pvec[i]->TrackId();
292  // 0 out strings, else there may be cruft in here from prev evt.
293  for (unsigned int s = 0; s < 35; ++s){
294  *(fTProcess+s) = 0;
295  *(fTProcess+s) = 0;
296  *(fTMaterial+s) = 0;
297  *(fTMaterial+s) = 0;
298  *(fTVolume+s) = 0;
299  *(fTVolume+s) = 0;
300  *(fTTVolume+s) = 0;
301  *(fTTVolume+s) = 0;
302  }
303 
304  for(unsigned int s = 0; s < pvec[i]->Process().length(); ++s) *(fTProcess+s) = pvec[i]->Process()[s];
305 
306  TVector3 dum = pvec[i]->Position().Vect();
307 
308  for (unsigned int s = 0; s < geom->MaterialName(pvec[i]->Position().Vect()).length(); ++s)
309  *(fTMaterial+s) = geom->MaterialName(pvec[i]->Position().Vect())[s];
310 
311  for (unsigned int s = 0; s < geom->VolumeName(pvec[i]->Position().Vect()).length(); ++s)
312  *(fTVolume+s) = geom->VolumeName(pvec[i]->Position().Vect())[s];
313 
314  for (unsigned int s = 0; s < geom->VolumeName(pvec[i]->EndPosition().Vect()).length(); ++s)
315  *(fTTVolume+s) = geom->VolumeName(pvec[i]->EndPosition().Vect())[s];
316 
317  fTEvt = evt.id().event();
318  fTSub = evt.subRun();
319  fTRun = evt.run();
320  fTParentID = pvec[i]->Mother();
321  fTStatus = pvec[i]->StatusCode();
322  int daughter = 9999;
323  fTNds = TMath::Min(pvec[i]->NumberDaughters(),fTNdsOriginal);
324  for( int d = 0; d < fTNds; d++ ){
325  daughter = pvec[i]->Daughter(d);
326  fTDID[d] = daughter;
327  // zero it out.
328  for (unsigned int s = 0; s < 35; ++s) *(fTDProcess[d]+s) = 0;
329 
330  for(unsigned int jj = i; jj < pvec.size(); ++jj){ // Don't look below i.
331 
332  if (fTDID[d] == pvec[jj]->TrackId()){
333  fTDPdg[d] = pvec[jj]->PdgCode(); // get the pointer,
334  fTDWt[d] = pvec[jj]->Weight();
335 
336  for (unsigned int s = 0; s < pvec[jj]->Process().length(); ++s)
337  *(fTDProcess[d]+s) = pvec[jj]->Process()[s];
338 
339  for (unsigned int kk = 0; kk < 4; ++kk){
340  fT4DOrigin[d*4+kk] = pvec[jj]->Position()[kk];
341  fT4DMomentum[d*4+kk] = pvec[jj]->Momentum()[kk];
342  }
343  break;
344  }
345  }
346  }//end loop over d
347 
348  for (unsigned int ii = 0; ii < 4; ++ii){
349  fT4Termination[ii] = 1e9;
350  fT4Origin[ii] = pvec[i]->Position()[ii];
351  if (ii!=3) fT4Termination[ii] = pvec[i]->EndPosition()[ii];
352  if (ii==4) fT4Termination[ii] = pvec[i]->Momentum()[ii]; // yes, odd
353  fT4Momentum[ii] = pvec[i]->Momentum()[ii];
354  }
355 
356  fTWeight = pvec[i]->Weight();
357  fTree->Fill();
358 
359  } // end loop on particles in list
360  if(numpi0gamma == 2 && pi0loc > 0){
361  mf::LogInfo("LArG4Ana") << pvec[pi0loc]->E();
362  fPi0Momentum->Fill(pvec[pi0loc]->E());
363  }
364 
365  return;
366  }
Float_t s
Definition: plot.C:23
SubRunNumber_t subRun() const
Definition: Event.h:72
TProfile * fChannelCharge
Charge per channel.
std::string fG4ModuleLabel
module label for the Geant
Float_t E
Definition: plot.C:23
TH1D * fnumChannels
The number of channels recieving charge per event.
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
Float_t * fT4Termination
Char_t fTTVolume[35]
Char_t fTMaterial[35]
TH1D * fEventEnergy
Energy collected per event.
Char_t fTVolume[35]
iterator find(const key_type &key)
Definition: ParticleList.h:318
TProfile * fChannelEnergy
Energy per channel.
std::size_t getView(std::string const &moduleLabel, std::string const &productInstanceName, std::vector< ELEMENT const * > &result) const
Definition: DataViewImpl.h:474
Char_t fTDProcess[200][35]
Float_t * fT4DMomentum
static const int NoParticleId
Definition: sim.h:28
Float_t d
Definition: plot.C:237
Char_t fTProcess[35]
TH1D * fEventCharge
Charge collected per event.
EventNumber_t event() const
Definition: EventID.h:117
std::string MaterialName(TVector3 const &point) const
Name of the deepest material containing the point xyz.
RunNumber_t run() const
Definition: Event.h:77
size_type size() const
Definition: ParticleList.h:313
std::string VolumeName(geo::Point_t const &point) const
Returns the name of the deepest volume containing specified point.
EventID id() const
Definition: Event.h:56
TProfile * fnumIDEs
Number of drift electrons per channel.
void larg4::LArG4Ana::beginJob ( )
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 132 of file LArG4Ana_module.cc.

References fChannelCharge, fChannelEnergy, fEventCharge, fEventEnergy, fnDist, fnEnergy, fnumChannels, fnumIDEs, fPDGCodes, fPi0Momentum, fT4DMomentum, fT4DOrigin, fT4Momentum, fT4Origin, fT4Termination, fTDID, fTDPdg, fTDProcess, fTDWt, fTEvt, fTID, fTMaterial, fTNds, fTNds4, fTParentID, fTPdg, fTProcess, fTree, fTRun, fTStatus, fTSub, fTTVolume, fTVolume, fTWeight, art::TFileDirectory::make(), and geo::GeometryCore::Nchannels().

133  {
136 
137  fPDGCodes = tfs->make<TH1D>("pdgcodes", ";PDG Code;", 5000, -2500, 2500);
138  fPi0Momentum = tfs->make<TH1D>("pi0mom", ";#pi^{0} Momentum (GeV);", 1000, 0., 1000.);
139 
140  fTree = tfs->make<TTree>("MCTTree","MCTTree");
141  fnEnergy = tfs->make<TH1D>("nEnergy", ";n,#Lambda^{0},K^{0} Momentum (GeV);", 100, 0., 10.);
142  fnDist = tfs->make<TH1D>("nDistance", ";n,#Lambda^{0},K^{0} Distance (m);", 200, -30000.0, +30000.);
143 
144 
145  // Some histograms relating to drift electrons, active detector
146  // channels and charge/energy on channels
147  fnumChannels = tfs->make<TH1D>("fnumChannels",
148  "Active channels;Active channels;# events",
149  256, 0, geo->Nchannels());
150  fnumIDEs = tfs->make<TProfile>("fnumIDEs",
151  "Drift Electrons per channel;Channel;Drift electrons",
152  geo->Nchannels()+1, 0, geo->Nchannels(),
153  0, 1e4);
154  fEventCharge = tfs->make<TH1D>("fEventCharge",
155  "Charge in event;Total charge per event;# events",
156  100, 0, 2.5e8);
157  fEventEnergy = tfs->make<TH1D>("fEventEnergy",
158  "Energy in event;Total energy per event;# events",
159  100, 0, 1e4);
160  fChannelCharge = tfs->make<TProfile>("fChannelCharge",
161  "Charge on channel;Channel;Total charge per channel",
162  geo->Nchannels()+1,0,geo->Nchannels(),
163  0,1e5);
164  fChannelEnergy = tfs->make<TProfile>("fChannelEnergy",
165  "Energy on channel;Channel;Total energy per channel",
166  geo->Nchannels()+1,0,geo->Nchannels(),
167  0, 1e3);
168 
169 
170  fT4Origin = new Float_t[4];
171  fT4DOrigin = new Float_t[fTNds*4];
172  fT4Termination = new Float_t[4];
173  fT4Momentum = new Float_t[4];
174  fT4DMomentum = new Float_t[fTNds*4];
175  fTDID = new Int_t[fTNds];
176  fTDPdg = new Int_t[fTNds];
177  fTDWt = new Float_t[fTNds];
178  fTNds4 = fTNds*4; // TTree/Branch requirement to store this.
179 
180  fTree->Branch("MCEvt", &fTEvt, "MCEvt/I");
181  fTree->Branch("MCSub", &fTSub, "MCSub/I");
182  fTree->Branch("MCRun", &fTRun, "MCRun/I");
183  fTree->Branch("MCWt", &fTWeight, "MCWt/F");
184  fTree->Branch("MCPdg", &fTPdg, "MCPdg/I");
185  fTree->Branch("MCID", &fTID, "MCID/I");
186  fTree->Branch("MCParentID", &fTParentID, "MCParentID/I");
187  fTree->Branch("MCNumDs", &fTNds, "MCNumDs/I");
188  fTree->Branch("MCNumDs4", &fTNds4, "MCNumDs4/I");
189  fTree->Branch("MCDID", fTDID, "MCDID[MCNumDs]/I");
190  fTree->Branch("MCDPdg", fTDPdg, "MCDPdg[MCNumDs]/I");
191  fTree->Branch("MCDWt", fTDWt, "MCDWt[MCNumDs]/I");
192  fTree->Branch("MCProcess", fTProcess, "MCProcess/C");
193  fTree->Branch("MCVolume", fTVolume, "MCVolume/C");
194  fTree->Branch("MCTVolume", fTTVolume, "MCTVolume/C");
195  fTree->Branch("MCMaterial", fTMaterial, "MCMaterial/C");
196  fTree->Branch("MCDProcess", fTDProcess, "MCDProcess[MCNumDs]/C");
197  fTree->Branch("MCStatus", &fTStatus, "MCStatus/I");
198  fTree->Branch("MCOrigin", fT4Origin, "MCOrigin[4]/F");
199  fTree->Branch("MCDOrigin", fT4DOrigin, "MCDOrigin[MCNumDs4]/F");
200  fTree->Branch("MCTermination", fT4Termination, "MCTermination[4]/F");
201  fTree->Branch("MCMomentum", fT4Momentum, "MCMomentum[4]/F");
202  fTree->Branch("MCDMomentum", fT4DMomentum, "MCDMomentum[MCNumDs4]/F");
203 
204  }
TProfile * fChannelCharge
Charge per channel.
TH1D * fnumChannels
The number of channels recieving charge per event.
Float_t * fT4Termination
Char_t fTTVolume[35]
Char_t fTMaterial[35]
TH1D * fEventEnergy
Energy collected per event.
Char_t fTVolume[35]
TProfile * fChannelEnergy
Energy per channel.
Char_t fTDProcess[200][35]
Float_t * fT4DMomentum
Char_t fTProcess[35]
TH1D * fEventCharge
Charge collected per event.
T * make(ARGS...args) const
Namespace collecting geometry-related classes utilities.
TProfile * fnumIDEs
Number of drift electrons per channel.
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 larg4::LArG4Ana::reconfigure ( fhicl::ParameterSet const &  pset)

Definition at line 207 of file LArG4Ana_module.cc.

References fG4ModuleLabel, fTNds, fTNdsOriginal, fTruthModuleLabel, and fhicl::ParameterSet::get().

Referenced by LArG4Ana().

208  {
209  fG4ModuleLabel = p.get< std::string >("GeantModuleLabel");
210  fTNdsOriginal = p.get< int >("Ndaughters" );
211  fTruthModuleLabel = p.get< std::string >("TruthModuleLabel");
213 
214  return;
215  }
std::string fG4ModuleLabel
module label for the Geant
std::string fTruthModuleLabel
module label for the Geant
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

TProfile* larg4::LArG4Ana::fChannelCharge
private

Charge per channel.

Definition at line 81 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

TProfile* larg4::LArG4Ana::fChannelEnergy
private

Energy per channel.

Definition at line 82 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

TH1D* larg4::LArG4Ana::fEventCharge
private

Charge collected per event.

Definition at line 79 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

TH1D* larg4::LArG4Ana::fEventEnergy
private

Energy collected per event.

Definition at line 80 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

std::string larg4::LArG4Ana::fG4ModuleLabel
private

module label for the Geant

Definition at line 69 of file LArG4Ana_module.cc.

Referenced by analyze(), and reconfigure().

TH1D* larg4::LArG4Ana::fnDist
private

Definition at line 76 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

TH1D* larg4::LArG4Ana::fnEnergy
private

Definition at line 75 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

TH1D* larg4::LArG4Ana::fnumChannels
private

The number of channels recieving charge per event.

Definition at line 77 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

TProfile* larg4::LArG4Ana::fnumIDEs
private

Number of drift electrons per channel.

Definition at line 78 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

TH1D* larg4::LArG4Ana::fPDGCodes
private

Definition at line 73 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

TH1D* larg4::LArG4Ana::fPi0Momentum
private

Definition at line 74 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

Float_t* larg4::LArG4Ana::fT4DMomentum
private

Definition at line 110 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

Float_t* larg4::LArG4Ana::fT4DOrigin
private

Definition at line 107 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

Float_t* larg4::LArG4Ana::fT4Momentum
private

Definition at line 109 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

Float_t* larg4::LArG4Ana::fT4Origin
private

Definition at line 106 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

Float_t* larg4::LArG4Ana::fT4Termination
private

Definition at line 108 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

Int_t* larg4::LArG4Ana::fTDID
private

Definition at line 95 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

Int_t* larg4::LArG4Ana::fTDPdg
private

Definition at line 96 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

Char_t larg4::LArG4Ana::fTDProcess[200][35]
private

Definition at line 102 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

Float_t* larg4::LArG4Ana::fTDWt
private

Definition at line 97 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

Int_t larg4::LArG4Ana::fTEvt
private

Definition at line 87 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

Int_t larg4::LArG4Ana::fTID
private

Definition at line 91 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

Char_t larg4::LArG4Ana::fTMaterial[35]
private

Definition at line 101 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

Int_t larg4::LArG4Ana::fTNds
private

Definition at line 92 of file LArG4Ana_module.cc.

Referenced by analyze(), beginJob(), and reconfigure().

Int_t larg4::LArG4Ana::fTNds4
private

Definition at line 94 of file LArG4Ana_module.cc.

Referenced by beginJob().

Int_t larg4::LArG4Ana::fTNdsOriginal
private

Definition at line 93 of file LArG4Ana_module.cc.

Referenced by analyze(), and reconfigure().

Int_t larg4::LArG4Ana::fTParentID
private

Definition at line 103 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

Int_t larg4::LArG4Ana::fTPdg
private

Definition at line 90 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

Char_t larg4::LArG4Ana::fTProcess[35]
private

Definition at line 98 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

TTree* larg4::LArG4Ana::fTree
private

Definition at line 86 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

Int_t larg4::LArG4Ana::fTRun
private

Definition at line 89 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

std::string larg4::LArG4Ana::fTruthModuleLabel
private

module label for the Geant

Definition at line 70 of file LArG4Ana_module.cc.

Referenced by reconfigure().

Int_t larg4::LArG4Ana::fTStatus
private

Definition at line 104 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

Int_t larg4::LArG4Ana::fTSub
private

Definition at line 88 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

Char_t larg4::LArG4Ana::fTTVolume[35]
private

Definition at line 100 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

Char_t larg4::LArG4Ana::fTVolume[35]
private

Definition at line 99 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

Float_t larg4::LArG4Ana::fTWeight
private

Definition at line 105 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().


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