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

Public Types

using ModuleType = EDAnalyzer
 

Public Member Functions

 PFPAna (fhicl::ParameterSet const &pset)
 
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 Member Functions

void analyze (const art::Event &evt) override
 
void beginJob () override
 

Private Attributes

TH1F * fNClusters
 
TH1F * fNHitInCluster
 
TH1F * fCREP2
 
TH1F * fCRE
 
TH1F * fCRP
 
TH1F * fNuKE_elec
 
TH1F * fNuKE_muon
 
TH1F * fNuKE_pion
 
TH1F * fNuKE_kaon
 
TH1F * fNuKE_prot
 
TH1F * fNuEP2_elec
 
TH1F * fNuEP2_muon
 
TH1F * fNuEP2_pion
 
TH1F * fNuEP2_kaon
 
TH1F * fNuEP2_prot
 
TH1F * fNuE_elec
 
TH1F * fNuE_muon
 
TH1F * fNuE_pion
 
TH1F * fNuE_kaon
 
TH1F * fNuE_prot
 
TH1F * fNuP_elec
 
TH1F * fNuP_muon
 
TH1F * fNuP_pion
 
TH1F * fNuP_kaon
 
TH1F * fNuP_prot
 
TH1F * fNuVtx_dx
 
TH1F * fNuVtx_dy
 
TH1F * fNuVtx_dz
 
TProfile * fNuEP2_KE_elec
 
TProfile * fNuEP2_KE_muon
 
TProfile * fNuEP2_KE_pion
 
TProfile * fNuEP2_KE_kaon
 
TProfile * fNuEP2_KE_prot
 
std::string fHitsModuleLabel
 
std::string fClusterModuleLabel
 
std::string fTrackModuleLabel
 
std::string fPFParticleModuleLabel
 
std::string fVertexModuleLabel
 
std::vector< float > fElecKERange
 
std::vector< float > fMuonKERange
 
std::vector< float > fPionKERange
 
std::vector< float > fKaonKERange
 
std::vector< float > fProtKERange
 
short fTrackWeightOption
 
bool fMergeDaughters
 
bool fSkipCosmics
 
short fPrintLevel
 

Detailed Description

Definition at line 43 of file PFPAna_module.cc.

Member Typedef Documentation

Definition at line 22 of file EDAnalyzer.h.

Constructor & Destructor Documentation

pfpf::PFPAna::PFPAna ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 107 of file PFPAna_module.cc.

108  : EDAnalyzer(pset)
109  , fHitsModuleLabel(pset.get<std::string>("HitsModuleLabel"))
110  , fClusterModuleLabel(pset.get<std::string>("ClusterModuleLabel"))
111  , fTrackModuleLabel(pset.get<std::string>("TrackModuleLabel"))
112  , fPFParticleModuleLabel(pset.get<std::string>("PFParticleModuleLabel"))
113  , fVertexModuleLabel(pset.get<std::string>("VertexModuleLabel"))
114  , fElecKERange(pset.get<std::vector<float>>("ElecKERange"))
115  , fMuonKERange(pset.get<std::vector<float>>("MuonKERange"))
116  , fPionKERange(pset.get<std::vector<float>>("PionKERange"))
117  , fKaonKERange(pset.get<std::vector<float>>("KaonKERange"))
118  , fProtKERange(pset.get<std::vector<float>>("ProtKERange"))
119  , fTrackWeightOption(pset.get<short>("TrackWeightOption"))
120  , fMergeDaughters(pset.get<bool>("MergeDaughters"))
121  , fSkipCosmics(pset.get<bool>("SkipCosmics"))
122  , fPrintLevel(pset.get<short>("PrintLevel"))
123  {}
std::vector< float > fElecKERange
std::string fVertexModuleLabel
std::string fHitsModuleLabel
std::vector< float > fProtKERange
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.cc:6
std::string fClusterModuleLabel
std::vector< float > fPionKERange
short fTrackWeightOption
std::string fPFParticleModuleLabel
std::vector< float > fMuonKERange
std::string fTrackModuleLabel
std::vector< float > fKaonKERange

Member Function Documentation

void pfpf::PFPAna::analyze ( const art::Event evt)
overrideprivate

Definition at line 176 of file PFPAna_module.cc.

References util::abs(), sim::ParticleList::begin(), simb::MCNeutrino::CCNC(), DEFINE_ART_MODULE, simb::MCParticle::E(), util::empty(), sim::ParticleList::end(), art::EventID::event(), fClusterModuleLabel, fCRE, fCREP2, fCRP, fElecKERange, fHitsModuleLabel, art::fill_ptr_vector(), fKaonKERange, fMergeDaughters, fMuonKERange, fNClusters, fNHitInCluster, fNuE_elec, fNuE_kaon, fNuE_muon, fNuE_pion, fNuE_prot, fNuEP2_elec, fNuEP2_kaon, fNuEP2_KE_elec, fNuEP2_KE_kaon, fNuEP2_KE_muon, fNuEP2_KE_pion, fNuEP2_KE_prot, fNuEP2_muon, fNuEP2_pion, fNuEP2_prot, fNuKE_elec, fNuKE_kaon, fNuKE_muon, fNuKE_pion, fNuKE_prot, fNuP_elec, fNuP_kaon, fNuP_muon, fNuP_pion, fNuP_prot, fNuVtx_dx, fNuVtx_dy, fNuVtx_dz, fPFParticleModuleLabel, fPionKERange, fPrintLevel, fProtKERange, fSkipCosmics, fTrackWeightOption, fVertexModuleLabel, art::ProductRetriever::getByLabel(), simb::MCTruth::GetNeutrino(), art::Event::id(), simb::MCNeutrino::InteractionType(), ipart, geo::GeometryCore::Iterate(), simb::kBeamNeutrino, simb::kCC, simb::kCosmicRay, simb::kNC, simb::MCParticle::Mass(), mfp, simb::MCParticle::Mother(), geo::GeometryCore::Nplanes(), simb::MCNeutrino::Nu(), simb::MCTruth::Origin(), part, cheat::ParticleInventoryService::ParticleList(), recob::PFParticle::PdgCode(), simb::MCParticle::PdgCode(), recob::Hit::PeakTime(), simb::MCParticle::Process(), art::PtrVector< T >::push_back(), art::right(), art::PtrVector< T >::size(), util::size(), simb::MCParticle::TrackId(), cheat::BackTrackerService::TrackIdsToHits_Ps(), cheat::ParticleInventoryService::TrackIdToMCTruth_P(), simb::MCParticle::Vx(), simb::MCParticle::Vy(), simb::MCParticle::Vz(), geo::WireID::Wire, recob::Hit::WireID(), and recob::Vertex::XYZ().

177  {
178  // code stolen from TrackAna_module.cc
180  if (geom->Nplanes() > 3) return;
181 
182  // get all hits in the event
184  evt.getByLabel(fHitsModuleLabel, hitListHandle);
185  std::vector<art::Ptr<recob::Hit>> allhits;
186  art::fill_ptr_vector(allhits, hitListHandle);
187  if (empty(allhits)) return;
188 
189  // get clusters and cluster-hit associations
190  art::Handle<std::vector<recob::Cluster>> clusterListHandle;
191  evt.getByLabel(fClusterModuleLabel, clusterListHandle);
192  art::FindManyP<recob::Hit> fmh(clusterListHandle, evt, fClusterModuleLabel);
193  if (clusterListHandle->size() == 0) return;
194 
195  // get 3D vertices
196  art::Handle<std::vector<recob::Vertex>> vertexListHandle;
197  evt.getByLabel(fVertexModuleLabel, vertexListHandle);
198  art::PtrVector<recob::Vertex> recoVtxList;
199  double xyz[3] = {0, 0, 0};
200  for (unsigned int ii = 0; ii < vertexListHandle->size(); ++ii) {
201  art::Ptr<recob::Vertex> vertex(vertexListHandle, ii);
202  recoVtxList.push_back(vertex);
203  vertex->XYZ(xyz);
204  }
205 
206  // get PFParticles
208  evt.getByLabel(fPFParticleModuleLabel, PFPListHandle);
210  for (unsigned int ii = 0; ii < PFPListHandle->size(); ++ii) {
211  art::Ptr<recob::PFParticle> pfp(PFPListHandle, ii);
212  recoPFPList.push_back(pfp);
213  mf::LogVerbatim("PFPAna") << "PFParticle PDG " << pfp->PdgCode();
214  }
215 
216  // list of all true particles
219  sim::ParticleList const& plist = pi_serv->ParticleList();
220  // list of all true particles that will be considered
221  std::vector<const simb::MCParticle*> plist2;
222  // true (reconstructed) hits for each particle in plist2
223  std::vector<std::vector<art::Ptr<recob::Hit>>> hlist2;
224  // index of cluster matched to each particle in plist2 in each plane
225  std::vector<std::vector<short>> truToCl;
226  // number of true hits in each plane and cluster
227  std::vector<std::vector<unsigned short>> nTruHitInCl;
228  //number of reconstructed hits in all clusters
229  std::vector<unsigned short> nRecHitInCl;
230 
231  // calculate average EP2 for every event to facilitate code development
232  // Beam Neutrinos - muons and not-muons
233 
234  float aveNuEP2mu = 0.;
235  float numNuEP2mu = 0.;
236  float aveNuEP2nm = 0.;
237  float numNuEP2nm = 0.;
238  // Cosmic Rays
239  float aveCREP2 = 0.;
240  float numCREP2 = 0.;
241 
242  // track ID of the neutrino
243  int neutTrackID = -1;
244  std::vector<int> tidlist;
245  float neutEnergy = -1.;
246  int neutIntType = -1;
247  int neutCCNC = -1;
248 
249  auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(evt);
250 
251  for (sim::ParticleList::const_iterator ipart = plist.begin(); ipart != plist.end(); ++ipart) {
252  const simb::MCParticle* part = (*ipart).second;
253  assert(part != 0);
254  int pdg = abs(part->PdgCode());
255  int trackID = part->TrackId();
256  art::Ptr<simb::MCTruth> theTruth = pi_serv->TrackIdToMCTruth_P(trackID);
257  if (fSkipCosmics && theTruth->Origin() == simb::kCosmicRay) continue;
258 
259  if (fPrintLevel > 3)
260  mf::LogVerbatim("PFPAna") << "Pre-Cuts origin " << theTruth->Origin() << " trackID "
261  << trackID << " PDG " << part->PdgCode() << " E " << part->E()
262  << " mass " << part->Mass() << " Mother "
263  << part->Mother() + neutTrackID << " Proc " << part->Process();
264 
265  // Get the neutrino track ID. Assume that there is only one neutrino
266  // interaction and it is first in the list of BeamNeutrino particles
267  if (theTruth->Origin() == simb::kBeamNeutrino && neutTrackID < 0) {
268  neutTrackID = trackID;
269  simb::MCNeutrino theNeutrino = theTruth->GetNeutrino();
270  neutEnergy = 1000. * theNeutrino.Nu().E();
271  neutIntType = theNeutrino.InteractionType();
272  neutCCNC = theNeutrino.CCNC();
273  for (unsigned short iv = 0; iv < recoVtxList.size(); ++iv) {
274  recoVtxList[iv]->XYZ(xyz);
275  fNuVtx_dx->Fill(part->Vx() - xyz[0]);
276  fNuVtx_dy->Fill(part->Vy() - xyz[1]);
277  fNuVtx_dz->Fill(part->Vz() - xyz[2]);
278  } // iv
279  } // theTruth->Origin() == simb::kBeamNeutrino && neutTrackID <
280 
281  bool isCharged = (pdg == 11) || (pdg == 13) || (pdg == 211) || (pdg == 321) || (pdg == 2212);
282 
283  if (!isCharged) continue;
284 
285  float KE = 1000 * (part->E() - part->Mass());
286  // KE (MeV) cuts
287  if (pdg == 11) {
288  if (fElecKERange[0] < 0) continue;
289  // only allow primary electrons
290  if (part->Process() != "primary") continue;
291  if (KE < fElecKERange[0] || KE > fElecKERange[1]) continue;
292  }
293  if (pdg == 13) {
294  if (fMuonKERange[0] < 0) continue;
295  if (KE < fMuonKERange[0] || KE > fMuonKERange[1]) continue;
296  }
297  if (pdg == 211) {
298  if (fPionKERange[0] < 0) continue;
299  if (KE < fPionKERange[0] || KE > fPionKERange[1]) continue;
300  }
301  if (pdg == 321) {
302  if (fKaonKERange[0] < 0) continue;
303  if (KE < fKaonKERange[0] || KE > fKaonKERange[1]) continue;
304  }
305  if (pdg == 2212) {
306  if (fProtKERange[0] < 0) continue;
307  if (KE < fProtKERange[0] || KE > fProtKERange[1]) continue;
308  }
309  // ignore secondaries from neutron interactions
310  if (part->Process() == "NeutronInelastic") continue;
311  plist2.push_back(part);
312  tidlist.push_back(trackID);
313  // initialize the true->(cluster,plane) association
314  std::vector<short> temp{-1, -1, -1};
315  truToCl.push_back(temp);
316  // initialize the true hit count
317  std::vector<unsigned short> temp2(3);
318  nTruHitInCl.push_back(temp2);
319 
320  if (fPrintLevel > 2)
321  mf::LogVerbatim("PFPAna") << plist2.size() - 1 << " Origin " << theTruth->Origin()
322  << " trackID " << trackID << " PDG " << part->PdgCode() << " KE "
323  << (int)KE << " Mother " << part->Mother() + neutTrackID
324  << " Proc " << part->Process();
325  }
326 
327  if (empty(plist2)) return;
328 
329  // get the hits (in all planes) that are matched to the true tracks
330  hlist2 = bt_serv->TrackIdsToHits_Ps(clockData, tidlist, allhits);
331  if (hlist2.size() != plist2.size()) {
332  mf::LogError("PFPAna") << "MC particle list size " << plist2.size()
333  << " != size of MC particle true hits lists " << hlist2.size();
334  return;
335  }
336  tidlist.clear();
337 
338  // vector of (mother, daughter) pairs
339  std::vector<std::pair<unsigned short, unsigned short>> moda;
340  // Deal with mother-daughter tracks
341  if (fMergeDaughters && neutTrackID >= 0) {
342  // Assume that daughters appear later in the list. Step backwards
343  // to accumulate all generations of daughters
344  for (unsigned short dpl = plist2.size() - 1; dpl > 0; --dpl) {
345  // no mother
346  if (plist2[dpl]->Mother() == 0) continue;
347  // electron
348  if (abs(plist2[dpl]->PdgCode()) == 11) continue;
349  // the actual mother trackID is offset from the neutrino trackID
350  int motherID = neutTrackID + plist2[dpl]->Mother() - 1;
351  // ensure that we are only looking at BeamNeutrino daughters
352  if (motherID < 0) continue;
353  // count the number of daughters
354  int ndtr = 0;
355  for (unsigned short kpl = 0; kpl < plist2.size(); ++kpl) {
356  if (plist2[kpl]->Mother() == motherID) ++ndtr;
357  }
358  // require only one daughter
359  if (ndtr > 1) continue;
360  // find the mother in the list
361  int mpl = -1;
362  for (unsigned short jpl = dpl - 1; jpl > 0; --jpl) {
363  if (plist2[jpl]->TrackId() == motherID) {
364  mpl = jpl;
365  break;
366  }
367  } // jpl
368  // mother not found for some reason
369  if (mpl < 0) continue;
370  // ensure that PDG code for mother and daughter are the same
371  if (plist2[dpl]->PdgCode() != plist2[mpl]->PdgCode()) continue;
372  moda.push_back(std::make_pair(mpl, dpl));
373  } // dpl
374  } // MergeDaughters
375 
376  // Now match reconstructed clusters to true particles.
378  for (unsigned int ii = 0; ii < clusterListHandle->size(); ++ii) {
379  art::Ptr<recob::Cluster> clusterHolder(clusterListHandle, ii);
380  clusters.push_back(clusterHolder);
381  }
382 
383  fNClusters->Fill(clusterListHandle->size());
384  nRecHitInCl.resize(clusters.size());
385 
386  // get the plane from the view. Perhaps there is a method that does
387  // this somewhere...
388  std::map<geo::View_t, unsigned int> ViewToPlane;
389  for (auto const& plane : geom->Iterate<geo::PlaneGeo>(geo::TPCID{0, 0})) {
390  geo::View_t view = plane.View();
391  ViewToPlane[view] = plane.ID().Plane;
392  }
393  for (size_t icl = 0; icl < clusters.size(); ++icl) {
394  unsigned int plane = ViewToPlane[clusters[icl]->View()];
395  std::vector<art::Ptr<recob::Hit>> cluhits = fmh.at(icl);
396  fNHitInCluster->Fill(cluhits.size());
397  nRecHitInCl[icl] = cluhits.size();
398  // count the number of hits matched to each true particle in plist2
399  std::vector<unsigned short> nHitInPl2(plist2.size());
400  for (size_t iht = 0; iht < cluhits.size(); ++iht) {
401  // look for this hit in all of the truth hit lists
402  short hitInPl2 = -1;
403  for (unsigned short ipl = 0; ipl < plist2.size(); ++ipl) {
404  unsigned short imat = 0;
405  for (imat = 0; imat < hlist2[ipl].size(); ++imat) {
406  if (cluhits[iht] == hlist2[ipl][imat]) break;
407  } // imat
408  if (imat < hlist2[ipl].size()) {
409  hitInPl2 = ipl;
410  break;
411  }
412  } // ipl
413  if (hitInPl2 < 0) continue;
414  // Assign the hit count to the mother if this is a daughter.
415  // Mother-daughter pairs are entered in the moda vector in reverse
416  // order, so assign daughter hits to the highest generation mother.
417  for (unsigned short imd = 0; imd < moda.size(); ++imd) {
418  if (moda[imd].second == hitInPl2) hitInPl2 = moda[imd].first;
419  }
420  // count
421  ++nHitInPl2[hitInPl2];
422  } // iht
423  // Associate the cluster with the truth particle that has the highest
424  // number of cluster hits
425  unsigned short nhit = 0;
426  short imtru = -1;
427  for (unsigned int ipl = 0; ipl < nHitInPl2.size(); ++ipl) {
428  if (nHitInPl2[ipl] > nhit) {
429  nhit = nHitInPl2[ipl];
430  imtru = ipl;
431  }
432  } // ipl
433  // make the cluster->(true,plane) association and save the
434  // number of true hits in the cluster
435  if (imtru != -1) {
436  // clobber a previously made association?
437  if (nhit > nTruHitInCl[imtru][plane]) {
438  truToCl[imtru][plane] = icl;
439  nTruHitInCl[imtru][plane] = nhit;
440  }
441  } // imtru != 1
442  } // icl
443 
444  // ready to calculate Efficiency, Purity in each plane and EP2
445  for (unsigned short ipl = 0; ipl < plist2.size(); ++ipl) {
446  // ignore daughters
447  bool skipit = false;
448  for (unsigned short ii = 0; ii < moda.size(); ++ii) {
449  if (moda[ii].second == ipl) {
450  skipit = true;
451  break;
452  }
453  } // ii
454  if (skipit) continue;
455  // ignore true particles with few true hits. Outside the detector
456  // or not reconstructable?
457  if (hlist2[ipl].size() < 3) continue;
458 
459  int trackID = plist2[ipl]->TrackId();
460  art::Ptr<simb::MCTruth> theTruth = pi_serv->TrackIdToMCTruth_P(trackID);
461  bool isCosmic = (theTruth->Origin() == simb::kCosmicRay);
462  float KE = 1000 * (plist2[ipl]->E() - plist2[ipl]->Mass());
463  int PDG = abs(plist2[ipl]->PdgCode());
464 
465  std::vector<short> nTru(geom->Nplanes());
466  std::vector<short> nRec(geom->Nplanes());
467  std::vector<short> nTruRec(geom->Nplanes());
468  std::vector<float> eff(geom->Nplanes());
469  std::vector<float> pur(geom->Nplanes());
470  std::vector<float> ep(geom->Nplanes());
471  for (unsigned int plane = 0; plane < geom->Nplanes(); ++plane) {
472  // count the number of true hits in this plane for the true particle.
473  // First count the mother hits
474  for (unsigned short ii = 0; ii < hlist2[ipl].size(); ++ii) {
475  if (ViewToPlane[hlist2[ipl][ii]->View()] == plane) ++nTru[plane];
476  } // ii
477  // next look for daughters and count those hits in all generations
478  unsigned short mom = ipl;
479  std::vector<std::pair<unsigned short, unsigned short>>::reverse_iterator rit =
480  moda.rbegin();
481  while (rit != moda.rend()) {
482  if ((*rit).first == mom) {
483  unsigned short dau = (*rit).second;
484  for (unsigned short jj = 0; jj < hlist2[dau].size(); ++jj) {
485  if (ViewToPlane[hlist2[dau][jj]->View()] == plane) ++nTru[plane];
486  } // jj
487  // It is likely that one hit appears in the mother list
488  // as well as the daughter list, so subtract one from the count
489  --nTru[plane];
490  mom = (*rit).second;
491  } // (*rit).first == mom
492  ++rit;
493  } // rit
494  if (nTru[plane] == 0) { continue; }
495  short icl = truToCl[ipl][plane];
496  nRec[plane] = nRecHitInCl[icl];
497  nTruRec[plane] = nTruHitInCl[ipl][plane];
498  if (nTru[plane] > 0) eff[plane] = (float)nTruRec[plane] / (float)nTru[plane];
499  if (nRec[plane] > 0) pur[plane] = (float)nTruRec[plane] / (float)nRec[plane];
500  ep[plane] = eff[plane] * pur[plane];
501  } // plane
502  // sort the ep values in ascending order
503  std::vector<float> temp;
504  temp = ep;
505  std::sort(temp.begin(), temp.end());
506  // EP2 is the second highest value
507  unsigned short ii = temp.size() - 2;
508  float ep2 = temp[ii];
509  // find the plane that defined EP2
510  short ep2Plane = 0;
511  short ep2Cluster = 0;
512  for (unsigned short jj = 0; jj < temp.size(); ++jj) {
513  if (ep[jj] == ep2) {
514  ep2Plane = jj;
515  ep2Cluster = truToCl[ipl][ep2Plane];
516  break;
517  }
518  } // jj
519  // find the US and DS ends of the cluster for printing
520  std::array<double, 2> clBeg, clEnd;
521  if (ep2Cluster >= 0) {
522  clBeg[0] = clusters[ep2Cluster]->StartWire();
523  clBeg[1] = clusters[ep2Cluster]->StartTick();
524  clEnd[0] = clusters[ep2Cluster]->EndWire();
525  clEnd[1] = clusters[ep2Cluster]->EndTick();
526  }
527  else {
528  clBeg.fill(0.);
529  clEnd.fill(0.);
530  }
531  // fill histograms
532  if (isCosmic) {
533  fCREP2->Fill(ep2);
534  fCRE->Fill(eff[ep2Plane]);
535  fCRP->Fill(pur[ep2Plane]);
536  aveCREP2 += ep2;
537  numCREP2 += 1.;
538  if (fPrintLevel > 1)
539  mf::LogVerbatim("PFPAna")
540  << ">>>CREP2 " << std::fixed << std::setprecision(2) << ep2 << " E " << eff[ep2Plane]
541  << std::setprecision(2) << " P " << pur[ep2Plane] << " P:W:T " << ep2Plane << ":"
542  << (int)clBeg[0] << ":" << (int)clBeg[1] << "-" << ep2Plane << ":" << (int)clEnd[0]
543  << ":" << (int)clEnd[1] << " PDG " << PDG << " KE " << (int)KE << " MeV";
544  } // isCosmic
545  else {
546  float wght = 1.;
547  if (fTrackWeightOption == 1) wght = KE;
548  // accumulate statistics for muons and not-muons
549  if (PDG == 13) {
550  aveNuEP2mu += ep2 * wght;
551  numNuEP2mu += wght;
552  }
553  else {
554  aveNuEP2nm += ep2 * wght;
555  numNuEP2nm += wght;
556  }
557  if (PDG == 11) {
558  fNuKE_elec->Fill(KE, wght);
559  fNuE_elec->Fill(eff[ep2Plane], wght);
560  fNuP_elec->Fill(pur[ep2Plane], wght);
561  fNuEP2_elec->Fill(ep2, wght);
562  fNuEP2_KE_elec->Fill(KE, ep2, wght);
563  }
564  else if (PDG == 13) {
565  fNuKE_muon->Fill(KE, wght);
566  fNuE_muon->Fill(eff[ep2Plane], wght);
567  fNuP_muon->Fill(pur[ep2Plane], wght);
568  fNuEP2_muon->Fill(ep2, wght);
569  fNuEP2_KE_muon->Fill(KE, ep2, wght);
570  }
571  else if (PDG == 211) {
572  fNuKE_pion->Fill(KE, wght);
573  fNuE_pion->Fill(eff[ep2Plane], wght);
574  fNuP_pion->Fill(pur[ep2Plane], wght);
575  fNuEP2_pion->Fill(ep2, wght);
576  fNuEP2_KE_pion->Fill(KE, ep2, wght);
577  }
578  else if (PDG == 321) {
579  fNuKE_kaon->Fill(KE, wght);
580  fNuE_kaon->Fill(eff[ep2Plane], wght);
581  fNuP_kaon->Fill(pur[ep2Plane], wght);
582  fNuEP2_kaon->Fill(ep2, wght);
583  fNuEP2_KE_kaon->Fill(KE, ep2, wght);
584  }
585  else if (PDG == 2212) {
586  fNuKE_prot->Fill(KE, wght);
587  fNuE_prot->Fill(eff[ep2Plane], wght);
588  fNuP_prot->Fill(pur[ep2Plane], wght);
589  fNuEP2_prot->Fill(ep2, wght);
590  fNuEP2_KE_prot->Fill(KE, ep2, wght);
591  }
592  if (fPrintLevel > 1)
593  mf::LogVerbatim("PFPAna")
594  << ">>>NuEP2 " << std::fixed << std::setprecision(2) << ep2 << " E " << eff[ep2Plane]
595  << std::setprecision(2) << " P " << pur[ep2Plane] << " P:W:T " << ep2Plane << ":"
596  << (int)clBeg[0] << ":" << (int)clBeg[1] << "-" << ep2Plane << ":" << (int)clEnd[0]
597  << ":" << (int)clEnd[1] << " PDG " << PDG << " KE " << (int)KE << " MeV ";
598  if (fPrintLevel > 2) {
599  // print out the begin/end true hits
600  mf::LogVerbatim mfp("PFPAna");
601  mfp << " Truth P:W:T ";
602  for (unsigned int plane = 0; plane < geom->Nplanes(); ++plane) {
603  unsigned short loW = 9999;
604  unsigned short loT = 0;
605  unsigned short hiW = 0;
606  unsigned short hiT = 0;
607  for (unsigned short ii = 0; ii < hlist2[ipl].size(); ++ii) {
608  if (ViewToPlane[hlist2[ipl][ii]->View()] == plane) {
609  art::Ptr<recob::Hit> theHit = hlist2[ipl][ii];
610  if (theHit->WireID().Wire < loW) {
611  loW = theHit->WireID().Wire;
612  loT = theHit->PeakTime();
613  }
614  if (theHit->WireID().Wire > hiW) {
615  hiW = theHit->WireID().Wire;
616  hiT = theHit->PeakTime();
617  }
618  } // correct view
619  } // ii
620  mfp << plane << ":" << loW << ":" << loT << "-" << plane << ":" << hiW << ":" << hiT
621  << " ";
622  } // plane
623  } // fPrintLevel > 2
624  } // !isCosmic
625  } // ipl
626 
627  float ave1 = -1.;
628  if (numNuEP2mu > 0.) ave1 = aveNuEP2mu / numNuEP2mu;
629 
630  float ave2 = -1.;
631  if (numNuEP2nm > 0.) ave2 = aveNuEP2nm / numNuEP2nm;
632 
633  float ave3 = -1.;
634  if (numCREP2 > 0.) ave3 = aveCREP2 / numCREP2;
635 
636  if (fPrintLevel > 0) {
637  std::string nuType = "Other";
638  if (neutCCNC == simb::kCC) {
639  if (neutIntType == 1001) nuType = "CCQE";
640  if (neutIntType == 1091) nuType = "DIS";
641  if (neutIntType == 1097) nuType = "COH";
642  if (neutIntType > 1002 && neutIntType < 1091) nuType = "RES";
643  }
644  else if (neutCCNC == simb::kNC) {
645  nuType = "NC";
646  }
647  else {
648  nuType = "Unknown";
649  }
650  mf::LogVerbatim("PFPAna") << "EvtEP2 " << evt.id().event() << " NuType " << nuType << " Enu "
651  << std::fixed << std::setprecision(0) << neutEnergy << std::right
652  << std::fixed << std::setprecision(2) << " NuMuons " << ave1
653  << " NuPiKp " << ave2 << " CosmicRays " << ave3 << " CCNC "
654  << neutCCNC << " IntType " << neutIntType;
655  }
656  } // analyze
double E(const int i=0) const
Definition: MCParticle.h:234
details::range_type< T > Iterate() const
Initializes the specified ID with the ID of the first cryostat.
Definition: GeometryCore.h:541
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
std::vector< float > fElecKERange
int PdgCode() const
Definition: MCParticle.h:213
int CCNC() const
Definition: MCNeutrino.h:148
const simb::MCNeutrino & GetNeutrino() const
Definition: MCTruth.h:77
constexpr auto const & right(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:102
Float_t mfp
Definition: plot.C:20
TH1F * fNuEP2_prot
Int_t ipart
Definition: Style.C:10
std::string fVertexModuleLabel
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
int Mother() const
Definition: MCParticle.h:214
const simb::MCParticle & Nu() const
Definition: MCNeutrino.h:146
list_type::const_iterator const_iterator
Definition: ParticleList.h:132
simb::Origin_t Origin() const
Definition: MCTruth.h:74
double Mass() const
Definition: MCParticle.h:240
TH1F * fNuP_kaon
std::string fHitsModuleLabel
TH1F * fNuKE_prot
std::vector< float > fProtKERange
constexpr auto abs(T v)
Returns the absolute value of the argument.
WireID_t Wire
Index of the wire within its plane.
Definition: geo_types.h:563
geo::WireID const & WireID() const
Initial tdc tick for hit.
Definition: Hit.h:280
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
std::string Process() const
Definition: MCParticle.h:216
std::string fClusterModuleLabel
int TrackId() const
Definition: MCParticle.h:211
std::vector< float > fPionKERange
TProfile * fNuEP2_KE_kaon
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:101
TH1F * fNuVtx_dy
TH1F * fNuKE_elec
int InteractionType() const
Definition: MCNeutrino.h:150
TString part[npart]
Definition: Style.C:32
TProfile * fNuEP2_KE_elec
TH1F * fNuVtx_dz
if(nlines<=0)
TH1F * fNuEP2_muon
TH1F * fNuE_kaon
void push_back(Ptr< U > const &p)
Definition: PtrVector.h:435
TH1F * fNuP_muon
short fTrackWeightOption
const art::Ptr< simb::MCTruth > & TrackIdToMCTruth_P(int id) const
TProfile * fNuEP2_KE_pion
Geometry information for a single wire plane.The plane is represented in the geometry by a solid whic...
Definition: PlaneGeo.h:78
TH1F * fNuEP2_kaon
iterator begin()
Definition: ParticleList.h:305
TH1F * fNuP_elec
std::string fPFParticleModuleLabel
TH1F * fNHitInCluster
std::vector< std::vector< art::Ptr< recob::Hit > > > TrackIdsToHits_Ps(detinfo::DetectorClocksData const &clockData, std::vector< int > const &tkIds, std::vector< art::Ptr< recob::Hit >> const &hitsIn) const
TH1F * fNuKE_muon
The data type to uniquely identify a TPC.
Definition: geo_types.h:381
size_type size() const
Definition: PtrVector.h:302
TH1F * fNuP_prot
const sim::ParticleList & ParticleList() const
TH1F * fNuVtx_dx
TH1F * fNuE_prot
TProfile * fNuEP2_KE_prot
double Vx(const int i=0) const
Definition: MCParticle.h:222
float PeakTime() const
Time of the signal peak, in tick units.
Definition: Hit.h:220
TH1F * fNuE_muon
TH1F * fNClusters
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
TProfile * fNuEP2_KE_muon
TH1F * fNuE_pion
TH1F * fNuE_elec
TH1F * fNuEP2_elec
TH1F * fNuKE_pion
double Vz(const int i=0) const
Definition: MCParticle.h:224
TH1F * fNuP_pion
EventNumber_t event() const
Definition: EventID.h:116
std::vector< float > fMuonKERange
unsigned int Nplanes(TPCID const &tpcid=tpc_zero) const
Returns the total number of planes in the specified TPC.
Definition: GeometryCore.h:977
TH1F * fNuKE_kaon
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:306
second_as<> second
Type of time stored in seconds, in double precision.
Definition: spacetime.h:82
Event generator information.
Definition: MCNeutrino.h:18
Definition: fwd.h:26
EventID id() const
Definition: Event.cc:23
double Vy(const int i=0) const
Definition: MCParticle.h:223
std::vector< float > fKaonKERange
decltype(auto) constexpr empty(T &&obj)
ADL-aware version of std::empty.
Definition: StdUtils.h:109
Cosmic rays.
Definition: MCTruth.h:24
TH1F * fNuEP2_pion
Beam neutrinos.
Definition: MCTruth.h:23
vertex reconstruction
void pfpf::PFPAna::beginJob ( )
overrideprivatevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 126 of file PFPAna_module.cc.

References fCRE, fCREP2, fCRP, fNClusters, fNHitInCluster, fNuE_elec, fNuE_kaon, fNuE_muon, fNuE_pion, fNuE_prot, fNuEP2_elec, fNuEP2_kaon, fNuEP2_KE_elec, fNuEP2_KE_kaon, fNuEP2_KE_muon, fNuEP2_KE_pion, fNuEP2_KE_prot, fNuEP2_muon, fNuEP2_pion, fNuEP2_prot, fNuKE_elec, fNuKE_kaon, fNuKE_muon, fNuKE_pion, fNuKE_prot, fNuP_elec, fNuP_kaon, fNuP_muon, fNuP_pion, fNuP_prot, fNuVtx_dx, fNuVtx_dy, fNuVtx_dz, and fSkipCosmics.

127  {
129 
130  fNClusters = tfs->make<TH1F>("fNoClustersInEvent", "Number of Clusters", 40, 0, 400);
131  fNHitInCluster = tfs->make<TH1F>("fNHitInCluster", "NHitInCluster", 100, 0, 100);
132 
133  if (!fSkipCosmics) {
134  // Cosmic ray histos
135  fCREP2 = tfs->make<TH1F>("CREP2", "CREP2", 50, 0, 1);
136  fCRE = tfs->make<TH1F>("CRE", "CR Efficiency", 50, 0, 1);
137  fCRP = tfs->make<TH1F>("CRP", "CR Purity", 50, 0, 1);
138  }
139  // Neutrino Int histos
140  fNuKE_elec = tfs->make<TH1F>("NuKE_elec", "NuKE electron", 100, 0, 4000);
141  fNuKE_muon = tfs->make<TH1F>("NuKE_muon", "NuKE muon", 100, 0, 4000);
142  fNuKE_pion = tfs->make<TH1F>("NuKE_pion", "NuKE pion", 100, 0, 4000);
143  fNuKE_kaon = tfs->make<TH1F>("NuKE_kaon", "NuKE kaon", 100, 0, 4000);
144  fNuKE_prot = tfs->make<TH1F>("NuKE_prot", "NuKE proton", 100, 0, 4000);
145 
146  fNuEP2_elec = tfs->make<TH1F>("NuEP2_elec", "NuEP2 electron", 50, 0, 1);
147  fNuEP2_muon = tfs->make<TH1F>("NuEP2_muon", "NuEP2 muon", 50, 0, 1);
148  fNuEP2_pion = tfs->make<TH1F>("NuEP2_pion", "NuEP2 pion", 50, 0, 1);
149  fNuEP2_kaon = tfs->make<TH1F>("NuEP2_kaon", "NuEP2 kaon", 50, 0, 1);
150  fNuEP2_prot = tfs->make<TH1F>("NuEP2_prot", "NuEP2 proton", 50, 0, 1);
151 
152  fNuE_elec = tfs->make<TH1F>("NuE_elec", "Nu Efficiency electron", 50, 0, 1);
153  fNuE_muon = tfs->make<TH1F>("NuE_muon", "Nu Efficiency muon", 50, 0, 1);
154  fNuE_pion = tfs->make<TH1F>("NuE_pion", "Nu Efficiency pion", 50, 0, 1);
155  fNuE_kaon = tfs->make<TH1F>("NuE_kaon", "Nu Efficiency kaon", 50, 0, 1);
156  fNuE_prot = tfs->make<TH1F>("NuE_prot", "Nu Efficiency proton", 50, 0, 1);
157 
158  fNuP_elec = tfs->make<TH1F>("NuP_elec", "Nu Purity electron", 50, 0, 1);
159  fNuP_muon = tfs->make<TH1F>("NuP_muon", "Nu Purity muon", 50, 0, 1);
160  fNuP_pion = tfs->make<TH1F>("NuP_pion", "Nu Purity pion", 50, 0, 1);
161  fNuP_kaon = tfs->make<TH1F>("NuP_kaon", "Nu Purity kaon", 50, 0, 1);
162  fNuP_prot = tfs->make<TH1F>("NuP_prot", "Nu Purity proton", 50, 0, 1);
163 
164  // True - Reco vertex difference
165  fNuVtx_dx = tfs->make<TH1F>("Vtx dx", "Vtx dx", 80, -10, 10);
166  fNuVtx_dy = tfs->make<TH1F>("Vtx dy", "Vtx dy", 80, -10, 10);
167  fNuVtx_dz = tfs->make<TH1F>("Vtx dz", "Vtx dz", 80, -10, 10);
168 
169  fNuEP2_KE_elec = tfs->make<TProfile>("NuEP2_KE_elec", "NuEP2 electron vs KE", 20, 0, 2000);
170  fNuEP2_KE_muon = tfs->make<TProfile>("NuEP2_KE_muon", "NuEP2 muon vs KE", 20, 0, 2000);
171  fNuEP2_KE_pion = tfs->make<TProfile>("NuEP2_KE_pion", "NuEP2 pion vs KE", 20, 0, 2000);
172  fNuEP2_KE_kaon = tfs->make<TProfile>("NuEP2_KE_kaon", "NuEP2 kaon vs KE", 20, 0, 2000);
173  fNuEP2_KE_prot = tfs->make<TProfile>("NuEP2_KE_prot", "NuEP2 proton vs KE", 20, 0, 2000);
174  }
TH1F * fNuEP2_prot
TH1F * fNuP_kaon
TH1F * fNuKE_prot
TProfile * fNuEP2_KE_kaon
TH1F * fNuVtx_dy
TH1F * fNuKE_elec
TProfile * fNuEP2_KE_elec
TH1F * fNuVtx_dz
TH1F * fNuEP2_muon
TH1F * fNuE_kaon
TH1F * fNuP_muon
TProfile * fNuEP2_KE_pion
TH1F * fNuEP2_kaon
TH1F * fNuP_elec
TH1F * fNHitInCluster
TH1F * fNuKE_muon
TH1F * fNuP_prot
TH1F * fNuVtx_dx
TH1F * fNuE_prot
TProfile * fNuEP2_KE_prot
TH1F * fNuE_muon
TH1F * fNClusters
TProfile * fNuEP2_KE_muon
TH1F * fNuE_pion
TH1F * fNuE_elec
TH1F * fNuEP2_elec
TH1F * fNuKE_pion
TH1F * fNuP_pion
TH1F * fNuKE_kaon
TH1F * fNuEP2_pion
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

std::string pfpf::PFPAna::fClusterModuleLabel
private

Definition at line 90 of file PFPAna_module.cc.

Referenced by analyze().

TH1F* pfpf::PFPAna::fCRE
private

Definition at line 55 of file PFPAna_module.cc.

Referenced by analyze(), and beginJob().

TH1F* pfpf::PFPAna::fCREP2
private

Definition at line 54 of file PFPAna_module.cc.

Referenced by analyze(), and beginJob().

TH1F* pfpf::PFPAna::fCRP
private

Definition at line 56 of file PFPAna_module.cc.

Referenced by analyze(), and beginJob().

std::vector<float> pfpf::PFPAna::fElecKERange
private

Definition at line 94 of file PFPAna_module.cc.

Referenced by analyze().

std::string pfpf::PFPAna::fHitsModuleLabel
private

Definition at line 89 of file PFPAna_module.cc.

Referenced by analyze().

std::vector<float> pfpf::PFPAna::fKaonKERange
private

Definition at line 97 of file PFPAna_module.cc.

Referenced by analyze().

bool pfpf::PFPAna::fMergeDaughters
private

Definition at line 100 of file PFPAna_module.cc.

Referenced by analyze().

std::vector<float> pfpf::PFPAna::fMuonKERange
private

Definition at line 95 of file PFPAna_module.cc.

Referenced by analyze().

TH1F* pfpf::PFPAna::fNClusters
private

Definition at line 51 of file PFPAna_module.cc.

Referenced by analyze(), and beginJob().

TH1F* pfpf::PFPAna::fNHitInCluster
private

Definition at line 52 of file PFPAna_module.cc.

Referenced by analyze(), and beginJob().

TH1F* pfpf::PFPAna::fNuE_elec
private

Definition at line 68 of file PFPAna_module.cc.

Referenced by analyze(), and beginJob().

TH1F* pfpf::PFPAna::fNuE_kaon
private

Definition at line 71 of file PFPAna_module.cc.

Referenced by analyze(), and beginJob().

TH1F* pfpf::PFPAna::fNuE_muon
private

Definition at line 69 of file PFPAna_module.cc.

Referenced by analyze(), and beginJob().

TH1F* pfpf::PFPAna::fNuE_pion
private

Definition at line 70 of file PFPAna_module.cc.

Referenced by analyze(), and beginJob().

TH1F* pfpf::PFPAna::fNuE_prot
private

Definition at line 72 of file PFPAna_module.cc.

Referenced by analyze(), and beginJob().

TH1F* pfpf::PFPAna::fNuEP2_elec
private

Definition at line 63 of file PFPAna_module.cc.

Referenced by analyze(), and beginJob().

TH1F* pfpf::PFPAna::fNuEP2_kaon
private

Definition at line 66 of file PFPAna_module.cc.

Referenced by analyze(), and beginJob().

TProfile* pfpf::PFPAna::fNuEP2_KE_elec
private

Definition at line 83 of file PFPAna_module.cc.

Referenced by analyze(), and beginJob().

TProfile* pfpf::PFPAna::fNuEP2_KE_kaon
private

Definition at line 86 of file PFPAna_module.cc.

Referenced by analyze(), and beginJob().

TProfile* pfpf::PFPAna::fNuEP2_KE_muon
private

Definition at line 84 of file PFPAna_module.cc.

Referenced by analyze(), and beginJob().

TProfile* pfpf::PFPAna::fNuEP2_KE_pion
private

Definition at line 85 of file PFPAna_module.cc.

Referenced by analyze(), and beginJob().

TProfile* pfpf::PFPAna::fNuEP2_KE_prot
private

Definition at line 87 of file PFPAna_module.cc.

Referenced by analyze(), and beginJob().

TH1F* pfpf::PFPAna::fNuEP2_muon
private

Definition at line 64 of file PFPAna_module.cc.

Referenced by analyze(), and beginJob().

TH1F* pfpf::PFPAna::fNuEP2_pion
private

Definition at line 65 of file PFPAna_module.cc.

Referenced by analyze(), and beginJob().

TH1F* pfpf::PFPAna::fNuEP2_prot
private

Definition at line 67 of file PFPAna_module.cc.

Referenced by analyze(), and beginJob().

TH1F* pfpf::PFPAna::fNuKE_elec
private

Definition at line 58 of file PFPAna_module.cc.

Referenced by analyze(), and beginJob().

TH1F* pfpf::PFPAna::fNuKE_kaon
private

Definition at line 61 of file PFPAna_module.cc.

Referenced by analyze(), and beginJob().

TH1F* pfpf::PFPAna::fNuKE_muon
private

Definition at line 59 of file PFPAna_module.cc.

Referenced by analyze(), and beginJob().

TH1F* pfpf::PFPAna::fNuKE_pion
private

Definition at line 60 of file PFPAna_module.cc.

Referenced by analyze(), and beginJob().

TH1F* pfpf::PFPAna::fNuKE_prot
private

Definition at line 62 of file PFPAna_module.cc.

Referenced by analyze(), and beginJob().

TH1F* pfpf::PFPAna::fNuP_elec
private

Definition at line 73 of file PFPAna_module.cc.

Referenced by analyze(), and beginJob().

TH1F* pfpf::PFPAna::fNuP_kaon
private

Definition at line 76 of file PFPAna_module.cc.

Referenced by analyze(), and beginJob().

TH1F* pfpf::PFPAna::fNuP_muon
private

Definition at line 74 of file PFPAna_module.cc.

Referenced by analyze(), and beginJob().

TH1F* pfpf::PFPAna::fNuP_pion
private

Definition at line 75 of file PFPAna_module.cc.

Referenced by analyze(), and beginJob().

TH1F* pfpf::PFPAna::fNuP_prot
private

Definition at line 77 of file PFPAna_module.cc.

Referenced by analyze(), and beginJob().

TH1F* pfpf::PFPAna::fNuVtx_dx
private

Definition at line 79 of file PFPAna_module.cc.

Referenced by analyze(), and beginJob().

TH1F* pfpf::PFPAna::fNuVtx_dy
private

Definition at line 80 of file PFPAna_module.cc.

Referenced by analyze(), and beginJob().

TH1F* pfpf::PFPAna::fNuVtx_dz
private

Definition at line 81 of file PFPAna_module.cc.

Referenced by analyze(), and beginJob().

std::string pfpf::PFPAna::fPFParticleModuleLabel
private

Definition at line 92 of file PFPAna_module.cc.

Referenced by analyze().

std::vector<float> pfpf::PFPAna::fPionKERange
private

Definition at line 96 of file PFPAna_module.cc.

Referenced by analyze().

short pfpf::PFPAna::fPrintLevel
private

Definition at line 102 of file PFPAna_module.cc.

Referenced by analyze().

std::vector<float> pfpf::PFPAna::fProtKERange
private

Definition at line 98 of file PFPAna_module.cc.

Referenced by analyze().

bool pfpf::PFPAna::fSkipCosmics
private

Definition at line 101 of file PFPAna_module.cc.

Referenced by analyze(), and beginJob().

std::string pfpf::PFPAna::fTrackModuleLabel
private

Definition at line 91 of file PFPAna_module.cc.

short pfpf::PFPAna::fTrackWeightOption
private

Definition at line 99 of file PFPAna_module.cc.

Referenced by analyze().

std::string pfpf::PFPAna::fVertexModuleLabel
private

Definition at line 93 of file PFPAna_module.cc.

Referenced by analyze().


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