LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
larg4::LArG4Ana Class Reference
Inheritance diagram for larg4::LArG4Ana:
art::EDAnalyzer art::detail::Analyzer art::detail::LegacyModule art::Observer art::ModuleBase

Public Types

using ModuleType = EDAnalyzer
 

Public Member Functions

 LArG4Ana (fhicl::ParameterSet const &pset)
 Standard constructor and destructor for an FMWK module. More...
 
void analyze (const art::Event &evt)
 
void beginJob ()
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
std::unique_ptr< Worker > makeWorker (WorkerParams const &wp)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Protected Member Functions

std::string const & processName () const
 
bool wantAllEvents () const noexcept
 
bool wantEvent (ScheduleID id, Event const &e) const
 
Handle< TriggerResults > getTriggerResults (Event const &e) const
 
ConsumesCollector & consumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Private 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 fTNdsOriginal
 
Int_t fTNds
 
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 38 of file LArG4Ana_module.cc.

Member Typedef Documentation

Definition at line 22 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 96 of file LArG4Ana_module.cc.

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

97  : EDAnalyzer(pset)
98  , fG4ModuleLabel{pset.get<std::string>("GeantModuleLabel")}
99  , fTruthModuleLabel{pset.get<std::string>("TruthModuleLabel")}
100  , fTNdsOriginal{pset.get<int>("Ndaughters")}
102  {}
std::string fG4ModuleLabel
module label for the Geant
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.cc:6
std::string fTruthModuleLabel
module label for the Geant

Member Function Documentation

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

Definition at line 184 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::ProductRetriever::getView(), art::Event::id(), geo::GeometryCore::MaterialName(), sim::NoParticleId, cheat::ParticleInventoryService::ParticleList(), art::Event::run(), sc, sim::ParticleList::size(), art::Event::subRun(), geo::vect::toPoint(), and geo::GeometryCore::VolumeName().

185  {
186 
187  //get the list of particles from this event
189  const sim::ParticleList& plist = pi_serv->ParticleList();
191 
192  // loop over all sim::SimChannels in the event and make sure there are no
193  // sim::IDEs with trackID values that are not in the sim::ParticleList
194  std::vector<const sim::SimChannel*> sccol;
195  evt.getView(fG4ModuleLabel, sccol);
196 
197  double totalCharge = 0.0;
198  double totalEnergy = 0.0;
199  fnumChannels->Fill(sccol.size());
200  for (size_t sc = 0; sc < sccol.size(); ++sc) {
201  double numIDEs = 0.0;
202  double scCharge = 0.0;
203  double scEnergy = 0.0;
204  const auto& tdcidemap = sccol[sc]->TDCIDEMap();
205  for (auto mapitr = tdcidemap.begin(); mapitr != tdcidemap.end(); mapitr++) {
206  const std::vector<sim::IDE> idevec = (*mapitr).second;
207  numIDEs += idevec.size();
208  for (size_t iv = 0; iv < idevec.size(); ++iv) {
209  if (plist.find(idevec[iv].trackID) == plist.end() &&
210  idevec[iv].trackID != sim::NoParticleId)
211  mf::LogWarning("LArG4Ana") << idevec[iv].trackID << " is not in particle list";
212  totalCharge += idevec[iv].numElectrons;
213  scCharge += idevec[iv].numElectrons;
214  totalEnergy += idevec[iv].energy;
215  scEnergy += idevec[iv].energy;
216  }
217  }
218  fnumIDEs->Fill(sc, numIDEs);
219  fChannelCharge->Fill(sc, scCharge);
220  fChannelEnergy->Fill(sc, scEnergy);
221  }
222  fEventCharge->Fill(totalCharge);
223  fEventEnergy->Fill(totalEnergy);
224 
225  // get the particles from the back tracker
226  const sim::ParticleList& Particles = pi_serv->ParticleList();
227  std::vector<const simb::MCParticle*> pvec;
228  pvec.reserve(Particles.size());
229  for (const auto& PartPair : Particles) {
230  pvec.push_back(PartPair.second);
231  fPDGCodes->Fill(PartPair.second->PdgCode());
232  }
233 
234  // now look for pi0's that decay to 2 gammas
235  int pi0loc = -1;
236  int numpi0gamma = 0;
237  for (unsigned int i = 0; i < pvec.size(); ++i) {
238  if (pvec[i]->PdgCode() == 111) pi0loc = i;
239  if (pvec[i]->Mother() == pi0loc + 1 && pi0loc > 0 && pvec[i]->PdgCode() == 22) {
240  mf::LogInfo("LArG4Ana") << pvec[i]->E() << " gamma energy ";
241  ++numpi0gamma;
242  }
243 
244  // n,Lambda,K0s,K0L,K0
245  if (pvec[i]->PdgCode() == 2112 || pvec[i]->PdgCode() == 3122 || pvec[i]->PdgCode() == 130 ||
246  pvec[i]->PdgCode() == 310 || pvec[i]->PdgCode() == 311) {
247  fnEnergy->Fill(pvec[i]->E(), pvec[i]->Weight());
248  fnDist->Fill(pvec[i]->Vx(), pvec[i]->Weight());
249  }
250 
251  fTPdg = pvec[i]->PdgCode();
252  fTID = pvec[i]->TrackId();
253  // 0 out strings, else there may be cruft in here from prev evt.
254  for (unsigned int s = 0; s < 35; ++s) {
255  *(fTProcess + s) = 0;
256  *(fTProcess + s) = 0;
257  *(fTMaterial + s) = 0;
258  *(fTMaterial + s) = 0;
259  *(fTVolume + s) = 0;
260  *(fTVolume + s) = 0;
261  *(fTTVolume + s) = 0;
262  *(fTTVolume + s) = 0;
263  }
264 
265  for (unsigned int s = 0; s < pvec[i]->Process().length(); ++s)
266  *(fTProcess + s) = pvec[i]->Process()[s];
267 
268  TVector3 dum = pvec[i]->Position().Vect();
269 
270  using geo::vect::toPoint;
271  auto const material_at_pos = geom->MaterialName(toPoint(pvec[i]->Position().Vect()));
272  for (unsigned int s = 0; s < material_at_pos.length(); ++s)
273  *(fTMaterial + s) = material_at_pos[s];
274 
275  auto const volume_at_pos = geom->VolumeName(toPoint(pvec[i]->Position().Vect()));
276  for (unsigned int s = 0; s < volume_at_pos.length(); ++s)
277  *(fTVolume + s) = volume_at_pos[s];
278 
279  auto const volume_at_end = geom->VolumeName(toPoint(pvec[i]->EndPosition().Vect()));
280  for (unsigned int s = 0; s < volume_at_end.length(); ++s)
281  *(fTTVolume + s) = volume_at_end[s];
282 
283  fTEvt = evt.id().event();
284  fTSub = evt.subRun();
285  fTRun = evt.run();
286  fTParentID = pvec[i]->Mother();
287  fTStatus = pvec[i]->StatusCode();
288  int daughter = 9999;
289  fTNds = TMath::Min(pvec[i]->NumberDaughters(), fTNdsOriginal);
290  for (int d = 0; d < fTNds; d++) {
291  daughter = pvec[i]->Daughter(d);
292  fTDID[d] = daughter;
293  // zero it out.
294  for (unsigned int s = 0; s < 35; ++s)
295  *(fTDProcess[d] + s) = 0;
296 
297  for (unsigned int jj = i; jj < pvec.size(); ++jj) { // Don't look below i.
298 
299  if (fTDID[d] == pvec[jj]->TrackId()) {
300  fTDPdg[d] = pvec[jj]->PdgCode(); // get the pointer,
301  fTDWt[d] = pvec[jj]->Weight();
302 
303  for (unsigned int s = 0; s < pvec[jj]->Process().length(); ++s)
304  *(fTDProcess[d] + s) = pvec[jj]->Process()[s];
305 
306  for (unsigned int kk = 0; kk < 4; ++kk) {
307  fT4DOrigin[d * 4 + kk] = pvec[jj]->Position()[kk];
308  fT4DMomentum[d * 4 + kk] = pvec[jj]->Momentum()[kk];
309  }
310  break;
311  }
312  }
313  } //end loop over d
314 
315  for (unsigned int ii = 0; ii < 4; ++ii) {
316  fT4Termination[ii] = 1e9;
317  fT4Origin[ii] = pvec[i]->Position()[ii];
318  if (ii != 3) fT4Termination[ii] = pvec[i]->EndPosition()[ii];
319  if (ii == 4) fT4Termination[ii] = pvec[i]->Momentum()[ii]; // yes, odd
320  fT4Momentum[ii] = pvec[i]->Momentum()[ii];
321  }
322 
323  fTWeight = pvec[i]->Weight();
324  fTree->Fill();
325 
326  } // end loop on particles in list
327  if (numpi0gamma == 2 && pi0loc > 0) {
328  mf::LogInfo("LArG4Ana") << pvec[pi0loc]->E();
329  fPi0Momentum->Fill(pvec[pi0loc]->E());
330  }
331 
332  return;
333  }
SubRunNumber_t subRun() const
Definition: Event.cc:35
TProfile * fChannelCharge
Charge per channel.
std::string fG4ModuleLabel
module label for the Geant
TH1D * fnumChannels
The number of channels recieving charge per event.
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
Float_t * fT4Termination
Char_t fTTVolume[35]
::geo::Point_t toPoint(Point const &p)
Convert the specified point into a geo::Point_t.
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.
Char_t fTDProcess[200][35]
std::string VolumeName(Point_t const &point) const
Returns the name of the deepest volume containing specified point.
Float_t * fT4DMomentum
Float_t E
Definition: plot.C:20
static const int NoParticleId
Definition: sim.h:21
std::string MaterialName(Point_t const &point) const
Name of the deepest material containing the point xyz.
Float_t d
Definition: plot.C:235
Char_t fTProcess[35]
TH1D * fEventCharge
Charge collected per event.
const sim::ParticleList & ParticleList() const
std::size_t getView(std::string const &moduleLabel, std::string const &productInstanceName, std::string const &processName, std::vector< ELEMENT const * > &result) const
Float_t sc
Definition: plot.C:23
EventNumber_t event() const
Definition: EventID.h:116
RunNumber_t run() const
Definition: Event.cc:29
size_type size() const
Definition: ParticleList.h:313
Float_t * fT4DOrigin
EventID id() const
Definition: Event.cc:23
TProfile * fnumIDEs
Number of drift electrons per channel.
Float_t * fT4Momentum
void larg4::LArG4Ana::beginJob ( )
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 105 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, and geo::GeometryCore::Nchannels().

106  {
109 
110  fPDGCodes = tfs->make<TH1D>("pdgcodes", ";PDG Code;", 5000, -2500, 2500);
111  fPi0Momentum = tfs->make<TH1D>("pi0mom", ";#pi^{0} Momentum (GeV);", 1000, 0., 1000.);
112 
113  fTree = tfs->make<TTree>("MCTTree", "MCTTree");
114  fnEnergy = tfs->make<TH1D>("nEnergy", ";n,#Lambda^{0},K^{0} Momentum (GeV);", 100, 0., 10.);
115  fnDist =
116  tfs->make<TH1D>("nDistance", ";n,#Lambda^{0},K^{0} Distance (m);", 200, -30000.0, +30000.);
117 
118  // Some histograms relating to drift electrons, active detector
119  // channels and charge/energy on channels
120  fnumChannels = tfs->make<TH1D>(
121  "fnumChannels", "Active channels;Active channels;# events", 256, 0, geo->Nchannels());
122  fnumIDEs = tfs->make<TProfile>("fnumIDEs",
123  "Drift Electrons per channel;Channel;Drift electrons",
124  geo->Nchannels() + 1,
125  0,
126  geo->Nchannels(),
127  0,
128  1e4);
129  fEventCharge = tfs->make<TH1D>(
130  "fEventCharge", "Charge in event;Total charge per event;# events", 100, 0, 2.5e8);
131  fEventEnergy = tfs->make<TH1D>(
132  "fEventEnergy", "Energy in event;Total energy per event;# events", 100, 0, 1e4);
133  fChannelCharge = tfs->make<TProfile>("fChannelCharge",
134  "Charge on channel;Channel;Total charge per channel",
135  geo->Nchannels() + 1,
136  0,
137  geo->Nchannels(),
138  0,
139  1e5);
140  fChannelEnergy = tfs->make<TProfile>("fChannelEnergy",
141  "Energy on channel;Channel;Total energy per channel",
142  geo->Nchannels() + 1,
143  0,
144  geo->Nchannels(),
145  0,
146  1e3);
147 
148  fT4Origin = new Float_t[4];
149  fT4DOrigin = new Float_t[fTNds * 4];
150  fT4Termination = new Float_t[4];
151  fT4Momentum = new Float_t[4];
152  fT4DMomentum = new Float_t[fTNds * 4];
153  fTDID = new Int_t[fTNds];
154  fTDPdg = new Int_t[fTNds];
155  fTDWt = new Float_t[fTNds];
156  fTNds4 = fTNds * 4; // TTree/Branch requirement to store this.
157 
158  fTree->Branch("MCEvt", &fTEvt, "MCEvt/I");
159  fTree->Branch("MCSub", &fTSub, "MCSub/I");
160  fTree->Branch("MCRun", &fTRun, "MCRun/I");
161  fTree->Branch("MCWt", &fTWeight, "MCWt/F");
162  fTree->Branch("MCPdg", &fTPdg, "MCPdg/I");
163  fTree->Branch("MCID", &fTID, "MCID/I");
164  fTree->Branch("MCParentID", &fTParentID, "MCParentID/I");
165  fTree->Branch("MCNumDs", &fTNds, "MCNumDs/I");
166  fTree->Branch("MCNumDs4", &fTNds4, "MCNumDs4/I");
167  fTree->Branch("MCDID", fTDID, "MCDID[MCNumDs]/I");
168  fTree->Branch("MCDPdg", fTDPdg, "MCDPdg[MCNumDs]/I");
169  fTree->Branch("MCDWt", fTDWt, "MCDWt[MCNumDs]/I");
170  fTree->Branch("MCProcess", fTProcess, "MCProcess/C");
171  fTree->Branch("MCVolume", fTVolume, "MCVolume/C");
172  fTree->Branch("MCTVolume", fTTVolume, "MCTVolume/C");
173  fTree->Branch("MCMaterial", fTMaterial, "MCMaterial/C");
174  fTree->Branch("MCDProcess", fTDProcess, "MCDProcess[MCNumDs]/C");
175  fTree->Branch("MCStatus", &fTStatus, "MCStatus/I");
176  fTree->Branch("MCOrigin", fT4Origin, "MCOrigin[4]/F");
177  fTree->Branch("MCDOrigin", fT4DOrigin, "MCDOrigin[MCNumDs4]/F");
178  fTree->Branch("MCTermination", fT4Termination, "MCTermination[4]/F");
179  fTree->Branch("MCMomentum", fT4Momentum, "MCMomentum[4]/F");
180  fTree->Branch("MCDMomentum", fT4DMomentum, "MCDMomentum[MCNumDs4]/F");
181  }
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.
Namespace collecting geometry-related classes utilities.
Float_t * fT4DOrigin
TProfile * fnumIDEs
Number of drift electrons per channel.
Float_t * fT4Momentum
template<typename T , BranchType BT>
ProductToken< T > art::ModuleBase::consumes ( InputTag const &  tag)
protectedinherited

Definition at line 61 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::consumes().

62  {
63  return collector_.consumes<T, BT>(tag);
64  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
ProductToken< T > consumes(InputTag const &)
ConsumesCollector & art::ModuleBase::consumesCollector ( )
protectedinherited

Definition at line 57 of file ModuleBase.cc.

References art::ModuleBase::collector_.

58  {
59  return collector_;
60  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename T , BranchType BT>
void art::ModuleBase::consumesMany ( )
protectedinherited

Definition at line 75 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::consumesMany().

76  {
77  collector_.consumesMany<T, BT>();
78  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::ModuleBase::consumesView ( InputTag const &  )
protectedinherited
template<typename T , BranchType BT>
ViewToken<T> art::ModuleBase::consumesView ( InputTag const &  tag)
inherited

Definition at line 68 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::consumesView().

69  {
70  return collector_.consumesView<T, BT>(tag);
71  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
ViewToken< Element > consumesView(InputTag const &)
void art::detail::Analyzer::doBeginJob ( SharedResources const &  resources)
inherited

Definition at line 25 of file Analyzer.cc.

Referenced by art::detail::Analyzer::Analyzer().

26  {
27  setupQueues(resources);
28  ProcessingFrame const frame{ScheduleID{}};
29  beginJobWithFrame(frame);
30  }
virtual void beginJobWithFrame(ProcessingFrame const &)=0
virtual void setupQueues(SharedResources const &)=0
bool art::detail::Analyzer::doBeginRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited

Definition at line 68 of file Analyzer.cc.

References art::ModuleContext::scheduleID().

Referenced by art::detail::Analyzer::Analyzer().

69  {
70  ProcessingFrame const frame{mc.scheduleID()};
71  beginRunWithFrame(std::as_const(rp).makeRun(mc), frame);
72  return true;
73  }
virtual void beginRunWithFrame(Run const &, ProcessingFrame const &)=0
bool art::detail::Analyzer::doBeginSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited

Definition at line 84 of file Analyzer.cc.

References art::ModuleContext::scheduleID().

Referenced by art::detail::Analyzer::Analyzer().

85  {
86  ProcessingFrame const frame{mc.scheduleID()};
87  beginSubRunWithFrame(std::as_const(srp).makeSubRun(mc), frame);
88  return true;
89  }
virtual void beginSubRunWithFrame(SubRun const &, ProcessingFrame const &)=0
void art::detail::Analyzer::doEndJob ( )
inherited

Definition at line 33 of file Analyzer.cc.

Referenced by art::detail::Analyzer::Analyzer().

34  {
35  ProcessingFrame const frame{ScheduleID{}};
36  endJobWithFrame(frame);
37  }
virtual void endJobWithFrame(ProcessingFrame const &)=0
bool art::detail::Analyzer::doEndRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited

Definition at line 76 of file Analyzer.cc.

References art::ModuleContext::scheduleID().

Referenced by art::detail::Analyzer::Analyzer().

77  {
78  ProcessingFrame const frame{mc.scheduleID()};
79  endRunWithFrame(std::as_const(rp).makeRun(mc), frame);
80  return true;
81  }
virtual void endRunWithFrame(Run const &, ProcessingFrame const &)=0
bool art::detail::Analyzer::doEndSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited

Definition at line 92 of file Analyzer.cc.

References art::ModuleContext::scheduleID().

Referenced by art::detail::Analyzer::Analyzer().

93  {
94  ProcessingFrame const frame{mc.scheduleID()};
95  endSubRunWithFrame(std::as_const(srp).makeSubRun(mc), frame);
96  return true;
97  }
virtual void endSubRunWithFrame(SubRun const &, ProcessingFrame const &)=0
bool art::detail::Analyzer::doEvent ( EventPrincipal ep,
ModuleContext const &  mc,
std::atomic< std::size_t > &  counts_run,
std::atomic< std::size_t > &  counts_passed,
std::atomic< std::size_t > &  counts_failed 
)
inherited

Definition at line 100 of file Analyzer.cc.

References e, and art::ModuleContext::scheduleID().

Referenced by art::detail::Analyzer::Analyzer().

105  {
106  auto const e = std::as_const(ep).makeEvent(mc);
107  if (wantEvent(mc.scheduleID(), e)) {
108  ++counts_run;
109  ProcessingFrame const frame{mc.scheduleID()};
110  analyzeWithFrame(e, frame);
111  ++counts_passed;
112  }
113  return true;
114  }
bool wantEvent(ScheduleID id, Event const &e) const
Definition: Observer.cc:63
Float_t e
Definition: plot.C:35
virtual void analyzeWithFrame(Event const &, ProcessingFrame const &)=0
void art::detail::Analyzer::doRespondToCloseInputFile ( FileBlock const &  fb)
inherited

Definition at line 47 of file Analyzer.cc.

Referenced by art::detail::Analyzer::Analyzer().

48  {
49  ProcessingFrame const frame{ScheduleID{}};
51  }
TFile fb("Li6.root")
virtual void respondToCloseInputFileWithFrame(FileBlock const &, ProcessingFrame const &)=0
void art::detail::Analyzer::doRespondToCloseOutputFiles ( FileBlock const &  fb)
inherited

Definition at line 61 of file Analyzer.cc.

Referenced by art::detail::Analyzer::Analyzer().

62  {
63  ProcessingFrame const frame{ScheduleID{}};
65  }
virtual void respondToCloseOutputFilesWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void art::detail::Analyzer::doRespondToOpenInputFile ( FileBlock const &  fb)
inherited

Definition at line 40 of file Analyzer.cc.

Referenced by art::detail::Analyzer::Analyzer().

41  {
42  ProcessingFrame const frame{ScheduleID{}};
44  }
TFile fb("Li6.root")
virtual void respondToOpenInputFileWithFrame(FileBlock const &, ProcessingFrame const &)=0
void art::detail::Analyzer::doRespondToOpenOutputFiles ( FileBlock const &  fb)
inherited

Definition at line 54 of file Analyzer.cc.

Referenced by art::detail::Analyzer::Analyzer().

55  {
56  ProcessingFrame const frame{ScheduleID{}};
58  }
virtual void respondToOpenOutputFilesWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
std::array< std::vector< ProductInfo >, NumBranchTypes > const & art::ModuleBase::getConsumables ( ) const
inherited

Definition at line 43 of file ModuleBase.cc.

References art::ModuleBase::collector_, and art::ConsumesCollector::getConsumables().

44  {
45  return collector_.getConsumables();
46  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables() const
Handle< TriggerResults > art::Observer::getTriggerResults ( Event const &  e) const
protectedinherited

Definition at line 75 of file Observer.cc.

References art::ProductRetriever::get(), and art::Observer::selectors_.

Referenced by art::OutputModule::doWriteEvent(), and art::Observer::wantAllEvents().

76  {
77  if (selectors_) {
78  return selectors_->getOneTriggerResults(e);
79  }
80 
81  // The following applies for cases where no SelectEvents entries
82  // exist.
83  Handle<TriggerResults> h;
84  if (e.get(empty_process_name, h)) {
85  return h;
86  }
87  return Handle<TriggerResults>{};
88  }
Float_t e
Definition: plot.C:35
std::optional< detail::ProcessAndEventSelectors > selectors_
Definition: Observer.h:79
std::unique_ptr< Worker > art::ModuleBase::makeWorker ( WorkerParams const &  wp)
inherited

Definition at line 37 of file ModuleBase.cc.

References art::ModuleBase::doMakeWorker(), and art::NumBranchTypes.

38  {
39  return doMakeWorker(wp);
40  }
virtual std::unique_ptr< Worker > doMakeWorker(WorkerParams const &wp)=0
template<typename T , BranchType BT>
ProductToken< T > art::ModuleBase::mayConsume ( InputTag const &  tag)
protectedinherited

Definition at line 82 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::mayConsume().

83  {
84  return collector_.mayConsume<T, BT>(tag);
85  }
ProductToken< T > mayConsume(InputTag const &)
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename T , BranchType BT>
void art::ModuleBase::mayConsumeMany ( )
protectedinherited

Definition at line 96 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::mayConsumeMany().

97  {
98  collector_.mayConsumeMany<T, BT>();
99  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::ModuleBase::mayConsumeView ( InputTag const &  )
protectedinherited
template<typename T , BranchType BT>
ViewToken<T> art::ModuleBase::mayConsumeView ( InputTag const &  tag)
inherited

Definition at line 89 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::mayConsumeView().

90  {
91  return collector_.mayConsumeView<T, BT>(tag);
92  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
ViewToken< Element > mayConsumeView(InputTag const &)
ModuleDescription const & art::ModuleBase::moduleDescription ( ) const
inherited

Definition at line 13 of file ModuleBase.cc.

References art::errors::LogicError.

Referenced by art::OutputModule::doRespondToOpenInputFile(), art::OutputModule::doWriteEvent(), art::Modifier::fillProductDescriptions(), art::OutputModule::makePlugins_(), art::OutputWorker::OutputWorker(), reco::shower::LArPandoraModularShowerCreation::produce(), art::Modifier::registerProducts(), and art::OutputModule::registerProducts().

14  {
15  if (md_.has_value()) {
16  return *md_;
17  }
18 
20  "There was an error while calling moduleDescription().\n"}
21  << "The moduleDescription() base-class member function cannot be called\n"
22  "during module construction. To determine which module is "
23  "responsible\n"
24  "for calling it, find the '<module type>:<module "
25  "label>@Construction'\n"
26  "tag in the message prefix above. Please contact artists@fnal.gov\n"
27  "for guidance.\n";
28  }
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::optional< ModuleDescription > md_
Definition: ModuleBase.h:55
string const & art::Observer::processName ( ) const
protectedinherited

Definition at line 57 of file Observer.cc.

References art::Observer::process_name_.

Referenced by art::FileDumperOutput::printPrincipal().

58  {
59  return process_name_;
60  }
std::string process_name_
Definition: Observer.h:76
void art::ModuleBase::setModuleDescription ( ModuleDescription const &  md)
inherited

Definition at line 31 of file ModuleBase.cc.

References art::ModuleBase::md_.

32  {
33  md_ = md;
34  }
std::optional< ModuleDescription > md_
Definition: ModuleBase.h:55
void art::ModuleBase::sortConsumables ( std::string const &  current_process_name)
inherited

Definition at line 49 of file ModuleBase.cc.

References art::ModuleBase::collector_, and art::ConsumesCollector::sortConsumables().

50  {
51  // Now that we know we have seen all the consumes declarations,
52  // sort the results for fast lookup later.
53  collector_.sortConsumables(current_process_name);
54  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
void sortConsumables(std::string const &current_process_name)
bool art::Observer::wantAllEvents ( ) const
inlineprotectednoexceptinherited

Definition at line 31 of file Observer.h.

References e, art::Observer::getTriggerResults(), art::Observer::wantAllEvents_, and art::Observer::wantEvent().

32  {
33  return wantAllEvents_;
34  }
bool wantAllEvents_
Definition: Observer.h:75
bool art::Observer::wantEvent ( ScheduleID  id,
Event const &  e 
) const
protectedinherited

Definition at line 63 of file Observer.cc.

References art::Observer::rejectors_, art::Observer::selectors_, and art::Observer::wantAllEvents_.

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

64  {
65  if (wantAllEvents_) {
66  return true;
67  }
68  bool const select_event = selectors_ ? selectors_->matchEvent(id, e) : true;
69  bool const reject_event =
70  rejectors_ ? rejectors_->matchEvent(id, e) : false;
71  return select_event and not reject_event;
72  }
bool wantAllEvents_
Definition: Observer.h:75
std::optional< detail::ProcessAndEventSelectors > rejectors_
Definition: Observer.h:80
Float_t e
Definition: plot.C:35
std::optional< detail::ProcessAndEventSelectors > selectors_
Definition: Observer.h:79

Member Data Documentation

TProfile* larg4::LArG4Ana::fChannelCharge
private

Charge per channel.

Definition at line 58 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

TProfile* larg4::LArG4Ana::fChannelEnergy
private

Energy per channel.

Definition at line 59 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

TH1D* larg4::LArG4Ana::fEventCharge
private

Charge collected per event.

Definition at line 56 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

TH1D* larg4::LArG4Ana::fEventEnergy
private

Energy collected per event.

Definition at line 57 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

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

module label for the Geant

Definition at line 47 of file LArG4Ana_module.cc.

Referenced by analyze().

TH1D* larg4::LArG4Ana::fnDist
private

Definition at line 53 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

TH1D* larg4::LArG4Ana::fnEnergy
private

Definition at line 52 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 54 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

TProfile* larg4::LArG4Ana::fnumIDEs
private

Number of drift electrons per channel.

Definition at line 55 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

TH1D* larg4::LArG4Ana::fPDGCodes
private

Definition at line 50 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

TH1D* larg4::LArG4Ana::fPi0Momentum
private

Definition at line 51 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

Float_t* larg4::LArG4Ana::fT4DMomentum
private

Definition at line 87 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

Float_t* larg4::LArG4Ana::fT4DOrigin
private

Definition at line 84 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

Float_t* larg4::LArG4Ana::fT4Momentum
private

Definition at line 86 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

Float_t* larg4::LArG4Ana::fT4Origin
private

Definition at line 83 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

Float_t* larg4::LArG4Ana::fT4Termination
private

Definition at line 85 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

Int_t* larg4::LArG4Ana::fTDID
private

Definition at line 72 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

Int_t* larg4::LArG4Ana::fTDPdg
private

Definition at line 73 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

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

Definition at line 79 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

Float_t* larg4::LArG4Ana::fTDWt
private

Definition at line 74 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

Int_t larg4::LArG4Ana::fTEvt
private

Definition at line 64 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

Int_t larg4::LArG4Ana::fTID
private

Definition at line 68 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

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

Definition at line 78 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

Int_t larg4::LArG4Ana::fTNds
private

Definition at line 70 of file LArG4Ana_module.cc.

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

Int_t larg4::LArG4Ana::fTNds4
private

Definition at line 71 of file LArG4Ana_module.cc.

Referenced by beginJob().

Int_t larg4::LArG4Ana::fTNdsOriginal
private

Definition at line 69 of file LArG4Ana_module.cc.

Referenced by analyze(), and LArG4Ana().

Int_t larg4::LArG4Ana::fTParentID
private

Definition at line 80 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

Int_t larg4::LArG4Ana::fTPdg
private

Definition at line 67 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

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

Definition at line 75 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

TTree* larg4::LArG4Ana::fTree
private

Definition at line 63 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

Int_t larg4::LArG4Ana::fTRun
private

Definition at line 66 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

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

module label for the Geant

Definition at line 48 of file LArG4Ana_module.cc.

Referenced by LArG4Ana().

Int_t larg4::LArG4Ana::fTStatus
private

Definition at line 81 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

Int_t larg4::LArG4Ana::fTSub
private

Definition at line 65 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

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

Definition at line 77 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

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

Definition at line 76 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().

Float_t larg4::LArG4Ana::fTWeight
private

Definition at line 82 of file LArG4Ana_module.cc.

Referenced by analyze(), and beginJob().


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