LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
lar_pandora::ConsolidatedPFParticleAnalysisTemplate Class Reference

ConsolidatedPFParticleAnalysisTemplate class. More...

Inheritance diagram for lar_pandora::ConsolidatedPFParticleAnalysisTemplate:
art::EDAnalyzer art::detail::Analyzer art::detail::LegacyModule art::Observer art::ModuleBase

Public Types

typedef art::Handle< std::vector< recob::PFParticle > > PFParticleHandle
 
typedef std::map< size_t, art::Ptr< recob::PFParticle > > PFParticleIdMap
 
typedef std::vector< art::Ptr< recob::PFParticle > > PFParticleVector
 
typedef std::vector< art::Ptr< recob::Track > > TrackVector
 
typedef std::vector< art::Ptr< recob::Shower > > ShowerVector
 
using ModuleType = EDAnalyzer
 

Public Member Functions

 ConsolidatedPFParticleAnalysisTemplate (fhicl::ParameterSet const &pset)
 Constructor. More...
 
void reconfigure (fhicl::ParameterSet const &pset)
 Configure memeber variables using FHiCL parameters. More...
 
void analyze (const art::Event &evt)
 Analyze an event! More...
 
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 GetPFParticleIdMap (const PFParticleHandle &pfParticleHandle, PFParticleIdMap &pfParticleMap)
 Produce a mapping from PFParticle ID to the art ptr to the PFParticle itself for fast navigation. More...
 
void PrintOutScores (const art::Event &evt, const PFParticleHandle &pfParticleHandle) const
 Print out scores in PFParticleMetadata. More...
 
void GetFinalStatePFParticleVectors (const PFParticleIdMap &pfParticleMap, PFParticleVector &crParticles, PFParticleVector &nuParticles)
 Produce a mapping from PFParticle ID to the art ptr to the PFParticle itself for fast navigation. More...
 
void CollectTracksAndShowers (const PFParticleVector &particles, const PFParticleHandle &pfParticleHandle, const art::Event &evt, TrackVector &tracks, ShowerVector &showers)
 Collect associated tracks and showers to particles in an input particle vector. More...
 

Private Attributes

std::string m_pandoraLabel
 The label for the pandora producer. More...
 
std::string m_trackLabel
 The label for the track producer from PFParticles. More...
 
std::string m_showerLabel
 The label for the shower producer from PFParticles. More...
 
bool m_printOutScores
 Option to investigate the associations to scores for PFParticles. More...
 

Detailed Description

Member Typedef Documentation

Definition at line 22 of file EDAnalyzer.h.

Constructor & Destructor Documentation

lar_pandora::ConsolidatedPFParticleAnalysisTemplate::ConsolidatedPFParticleAnalysisTemplate ( fhicl::ParameterSet const &  pset)

Constructor.

Parameters
psetthe set of input fhicl parameters

Definition at line 126 of file ConsolidatedPFParticleAnalysisTemplate_module.cc.

References reconfigure().

128  : art::EDAnalyzer(pset)
129  {
130  this->reconfigure(pset);
131  }
void reconfigure(fhicl::ParameterSet const &pset)
Configure memeber variables using FHiCL parameters.

Member Function Documentation

void lar_pandora::ConsolidatedPFParticleAnalysisTemplate::analyze ( const art::Event evt)

Analyze an event!

Parameters
evtthe art event to analyze

Investigate scores associated as larpandoraobject::metadata for the PFParticles

Definition at line 145 of file ConsolidatedPFParticleAnalysisTemplate_module.cc.

References CollectTracksAndShowers(), art::ProductRetriever::getByLabel(), GetFinalStatePFParticleVectors(), GetPFParticleIdMap(), art::Handle< T >::isValid(), m_pandoraLabel, m_printOutScores, and PrintOutScores().

146  {
147  // Collect the PFParticles from the event
148  PFParticleHandle pfParticleHandle;
149  evt.getByLabel(m_pandoraLabel, pfParticleHandle);
150 
151  if (!pfParticleHandle.isValid()) {
152  mf::LogDebug("ConsolidatedPFParticleAnalysisTemplate")
153  << " Failed to find the PFParticles." << std::endl;
154  return;
155  }
156 
157  // Produce a map of the PFParticle IDs for fast navigation through the hierarchy
158  PFParticleIdMap pfParticleMap;
159  this->GetPFParticleIdMap(pfParticleHandle, pfParticleMap);
160 
162  if (m_printOutScores) this->PrintOutScores(evt, pfParticleHandle);
163 
164  // Produce two PFParticle vectors containing final-state particles:
165  // 1. Particles identified as cosmic-rays - recontructed under cosmic-hypothesis
166  // 2. Daughters of the neutrino PFParticle - reconstructed under the neutrino hypothesis
167  std::vector<art::Ptr<recob::PFParticle>> crParticles;
168  std::vector<art::Ptr<recob::PFParticle>> nuParticles;
169  this->GetFinalStatePFParticleVectors(pfParticleMap, crParticles, nuParticles);
170 
171  // Use as required!
172  // -----------------------------
173  // What follows is an example showing how one might access the reconstructed neutrino final-state tracks and showers
174 
175  // These are the vectors to hold the tracks and showers for the final-states of the reconstructed neutrino
176  std::vector<art::Ptr<recob::Track>> tracks;
177  std::vector<art::Ptr<recob::Shower>> showers;
178  this->CollectTracksAndShowers(nuParticles, pfParticleHandle, evt, tracks, showers);
179 
180  // Print a summary of the consolidated event
181  std::cout << "Consolidated event summary:" << std::endl;
182  std::cout << " - Number of primary cosmic-ray PFParticles : " << crParticles.size()
183  << std::endl;
184  std::cout << " - Number of neutrino final-state PFParticles : " << nuParticles.size()
185  << std::endl;
186  std::cout << " ... of which are track-like : " << tracks.size() << std::endl;
187  std::cout << " ... of which are showers-like : " << showers.size() << std::endl;
188  }
void CollectTracksAndShowers(const PFParticleVector &particles, const PFParticleHandle &pfParticleHandle, const art::Event &evt, TrackVector &tracks, ShowerVector &showers)
Collect associated tracks and showers to particles in an input particle vector.
bool m_printOutScores
Option to investigate the associations to scores for PFParticles.
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
void PrintOutScores(const art::Event &evt, const PFParticleHandle &pfParticleHandle) const
Print out scores in PFParticleMetadata.
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
void GetFinalStatePFParticleVectors(const PFParticleIdMap &pfParticleMap, PFParticleVector &crParticles, PFParticleVector &nuParticles)
Produce a mapping from PFParticle ID to the art ptr to the PFParticle itself for fast navigation...
void GetPFParticleIdMap(const PFParticleHandle &pfParticleHandle, PFParticleIdMap &pfParticleMap)
Produce a mapping from PFParticle ID to the art ptr to the PFParticle itself for fast navigation...
void lar_pandora::ConsolidatedPFParticleAnalysisTemplate::CollectTracksAndShowers ( const PFParticleVector particles,
const PFParticleHandle pfParticleHandle,
const art::Event evt,
TrackVector tracks,
ShowerVector showers 
)
private

Collect associated tracks and showers to particles in an input particle vector.

Parameters
particlesa vector holding PFParticles from which to find the associated tracks and showers
pfParticleHandlethe handle for the PFParticle collection
evtthe art event to analyze
tracksa vector to hold the associated tracks
showersa vector to hold the associated showers

Definition at line 282 of file ConsolidatedPFParticleAnalysisTemplate_module.cc.

References m_showerLabel, and m_trackLabel.

Referenced by analyze().

288  {
289  // Get the associations between PFParticles and tracks/showers from the event
290  art::FindManyP<recob::Track> pfPartToTrackAssoc(pfParticleHandle, evt, m_trackLabel);
291  art::FindManyP<recob::Shower> pfPartToShowerAssoc(pfParticleHandle, evt, m_showerLabel);
292 
293  for (const art::Ptr<recob::PFParticle>& pParticle : particles) {
294  const std::vector<art::Ptr<recob::Track>> associatedTracks(
295  pfPartToTrackAssoc.at(pParticle.key()));
296  const std::vector<art::Ptr<recob::Shower>> associatedShowers(
297  pfPartToShowerAssoc.at(pParticle.key()));
298  const unsigned int nTracks(associatedTracks.size());
299  const unsigned int nShowers(associatedShowers.size());
300 
301  // Check if the PFParticle has no associated tracks or showers
302  if (nTracks == 0 && nShowers == 0) {
303  mf::LogDebug("ConsolidatedPFParticleAnalysisTemplate")
304  << " No tracks or showers were associated to PFParticle " << pParticle->Self()
305  << std::endl;
306  continue;
307  }
308 
309  // Check if there is an associated track
310  if (nTracks == 1 && nShowers == 0) {
311  tracks.push_back(associatedTracks.front());
312  continue;
313  }
314 
315  // Check if there is an associated shower
316  if (nTracks == 0 && nShowers == 1) {
317  showers.push_back(associatedShowers.front());
318  continue;
319  }
320 
321  throw cet::exception("ConsolidatedPFParticleAnalysisTemplate")
322  << " There were " << nTracks << " tracks and " << nShowers
323  << " showers associated with PFParticle " << pParticle->Self();
324  }
325  }
std::string m_showerLabel
The label for the shower producer from PFParticles.
std::string m_trackLabel
The label for the track producer from PFParticles.
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
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
void lar_pandora::ConsolidatedPFParticleAnalysisTemplate::GetFinalStatePFParticleVectors ( const PFParticleIdMap pfParticleMap,
PFParticleVector crParticles,
PFParticleVector nuParticles 
)
private

Produce a mapping from PFParticle ID to the art ptr to the PFParticle itself for fast navigation.

Parameters
pfParticleMapthe mapping from ID to PFParticle
crParticlesa vector to hold the top-level PFParticles reconstructed under the cosmic hypothesis
nuParticlesa vector to hold the final-states of the reconstruced neutrino

Definition at line 239 of file ConsolidatedPFParticleAnalysisTemplate_module.cc.

References util::abs(), recob::PFParticle::Daughters(), recob::PFParticle::IsPrimary(), and recob::PFParticle::PdgCode().

Referenced by analyze().

243  {
244  for (PFParticleIdMap::const_iterator it = pfParticleMap.begin(); it != pfParticleMap.end();
245  ++it) {
246  const art::Ptr<recob::PFParticle> pParticle(it->second);
247 
248  // Only look for primary particles
249  if (!pParticle->IsPrimary()) continue;
250 
251  // Check if this particle is identified as the neutrino
252  const int pdg(pParticle->PdgCode());
253  const bool isNeutrino(std::abs(pdg) == pandora::NU_E || std::abs(pdg) == pandora::NU_MU ||
254  std::abs(pdg) == pandora::NU_TAU);
255 
256  // All non-neutrino primary particles are reconstructed under the cosmic hypothesis
257  if (!isNeutrino) {
258  crParticles.push_back(pParticle);
259  continue;
260  }
261 
262  // ATTN. We are filling nuParticles under the assumption that there is only one reconstructed neutrino identified per event.
263  // If this is not the case please handle accordingly
264  if (!nuParticles.empty()) {
265  throw cet::exception("ConsolidatedPFParticleAnalysisTemplate")
266  << " This event contains multiple reconstructed neutrinos!";
267  }
268 
269  // Add the daughters of the neutrino PFParticle to the nuPFParticles vector
270  for (const size_t daughterId : pParticle->Daughters()) {
271  if (pfParticleMap.find(daughterId) == pfParticleMap.end())
272  throw cet::exception("ConsolidatedPFParticleAnalysisTemplate")
273  << " Invalid PFParticle collection!";
274 
275  nuParticles.push_back(pfParticleMap.at(daughterId));
276  }
277  }
278  }
constexpr auto abs(T v)
Returns the absolute value of the argument.
intermediate_table::const_iterator const_iterator
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
void lar_pandora::ConsolidatedPFParticleAnalysisTemplate::GetPFParticleIdMap ( const PFParticleHandle pfParticleHandle,
PFParticleIdMap pfParticleMap 
)
private

Produce a mapping from PFParticle ID to the art ptr to the PFParticle itself for fast navigation.

Parameters
pfParticleHandlethe handle for the PFParticle collection
pfParticleMapthe mapping from ID to PFParticle

Definition at line 192 of file ConsolidatedPFParticleAnalysisTemplate_module.cc.

References recob::PFParticle::Self().

Referenced by analyze().

195  {
196  for (unsigned int i = 0; i < pfParticleHandle->size(); ++i) {
197  const art::Ptr<recob::PFParticle> pParticle(pfParticleHandle, i);
198  if (!pfParticleMap.insert(PFParticleIdMap::value_type(pParticle->Self(), pParticle)).second) {
199  throw cet::exception("ConsolidatedPFParticleAnalysisTemplate")
200  << " Unable to get PFParticle ID map, the input PFParticle collection has repeat IDs!";
201  }
202  }
203  }
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
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
void lar_pandora::ConsolidatedPFParticleAnalysisTemplate::PrintOutScores ( const art::Event evt,
const PFParticleHandle pfParticleHandle 
) const
private

Print out scores in PFParticleMetadata.

Parameters
evtthe art event to analyze
pfParticleHandlethe handle for the PFParticle collection

Definition at line 207 of file ConsolidatedPFParticleAnalysisTemplate_module.cc.

References m_pandoraLabel, and recob::PFParticle::Self().

Referenced by analyze().

210  {
211  // Get the associations between PFParticles and larpandoraobj::PFParticleMetadata
213  pfParticleHandle, evt, m_pandoraLabel);
214 
215  for (unsigned int i = 0; i < pfParticleHandle->size(); ++i) {
216  const std::vector<art::Ptr<larpandoraobj::PFParticleMetadata>>& pfParticleMetadataList(
217  pfPartToMetadataAssoc.at(i));
218  if (!pfParticleMetadataList.empty()) {
219  const art::Ptr<recob::PFParticle> pParticle(pfParticleHandle, i);
220  for (unsigned int j = 0; j < pfParticleMetadataList.size(); ++j) {
221  const art::Ptr<larpandoraobj::PFParticleMetadata>& pfParticleMetadata(
222  pfParticleMetadataList.at(j));
223  const larpandoraobj::PFParticleMetadata::PropertiesMap& pfParticlePropertiesMap(
224  pfParticleMetadata->GetPropertiesMap());
225  if (!pfParticlePropertiesMap.empty())
226  std::cout << " Found PFParticle " << pParticle->Self() << " with: " << std::endl;
228  pfParticlePropertiesMap.begin();
229  it != pfParticlePropertiesMap.end();
230  ++it)
231  std::cout << " - " << it->first << " = " << it->second << std::endl;
232  }
233  }
234  }
235  }
std::map< std::string, float > PropertiesMap
intermediate_table::const_iterator const_iterator
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 lar_pandora::ConsolidatedPFParticleAnalysisTemplate::reconfigure ( fhicl::ParameterSet const &  pset)

Configure memeber variables using FHiCL parameters.

Parameters
psetthe set of input fhicl parameters

Definition at line 135 of file ConsolidatedPFParticleAnalysisTemplate_module.cc.

References fhicl::ParameterSet::get(), m_pandoraLabel, m_printOutScores, m_showerLabel, and m_trackLabel.

Referenced by ConsolidatedPFParticleAnalysisTemplate().

136  {
137  m_pandoraLabel = pset.get<std::string>("PandoraLabel");
138  m_trackLabel = pset.get<std::string>("TrackLabel");
139  m_showerLabel = pset.get<std::string>("ShowerLabel");
140  m_printOutScores = pset.get<bool>("PrintOutScores", true);
141  }
std::string m_showerLabel
The label for the shower producer from PFParticles.
std::string m_trackLabel
The label for the track producer from PFParticles.
bool m_printOutScores
Option to investigate the associations to scores for PFParticles.
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 lar_pandora::ConsolidatedPFParticleAnalysisTemplate::m_pandoraLabel
private

The label for the pandora producer.

Definition at line 96 of file ConsolidatedPFParticleAnalysisTemplate_module.cc.

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

bool lar_pandora::ConsolidatedPFParticleAnalysisTemplate::m_printOutScores
private

Option to investigate the associations to scores for PFParticles.

Definition at line 99 of file ConsolidatedPFParticleAnalysisTemplate_module.cc.

Referenced by analyze(), and reconfigure().

std::string lar_pandora::ConsolidatedPFParticleAnalysisTemplate::m_showerLabel
private

The label for the shower producer from PFParticles.

Definition at line 98 of file ConsolidatedPFParticleAnalysisTemplate_module.cc.

Referenced by CollectTracksAndShowers(), and reconfigure().

std::string lar_pandora::ConsolidatedPFParticleAnalysisTemplate::m_trackLabel
private

The label for the track producer from PFParticles.

Definition at line 97 of file ConsolidatedPFParticleAnalysisTemplate_module.cc.

Referenced by CollectTracksAndShowers(), and reconfigure().


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