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

PFParticleValidation class. More...

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

Classes

class  MatchingDetails
 MatchingDetails class. More...
 
class  SimpleMatchedPfo
 SimpleMatchedPfo class. More...
 
class  SimpleMCPrimary
 SimpleMCPrimary class. More...
 

Public Types

using ModuleType = EDAnalyzer
 

Public Member Functions

 PFParticleValidation (fhicl::ParameterSet const &pset)
 Constructor. More...
 
virtual ~PFParticleValidation ()
 Destructor. More...
 
void beginJob ()
 
void endJob ()
 
void analyze (const art::Event &evt)
 
void reconfigure (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 Types

typedef std::vector< SimpleMCPrimarySimpleMCPrimaryList
 
typedef std::vector< SimpleMatchedPfoSimpleMatchedPfoList
 
typedef std::map< int, MatchingDetailsMatchingDetailsMap
 
typedef std::map< SimpleMCPrimary, SimpleMatchedPfoListMCPrimaryMatchingMap
 
typedef std::map< art::Ptr< recob::PFParticle >, HitVectorPFParticleToMatchedHits
 
typedef std::map< art::Ptr< simb::MCParticle >, PFParticleToMatchedHitsMCParticleMatchingMap
 
typedef std::set< int > IntSet
 

Private Member Functions

void GetMCParticleMatchingMap (const PFParticlesToHits &recoParticlesToHits, const MCParticlesToHits &trueParticlesToHits, const HitsToMCParticles &hitsToTrueParticles, MCParticleMatchingMap &mcParticleMatchingMap) const
 Performing matching between true and reconstructed particles. More...
 
void GetSimpleMCPrimaryList (const art::Event &evt, const MCParticlesToHits &mcParticlesToHits, const HitsToMCParticles &hitsToMCParticles, const MCParticleMatchingMap &mcParticleMatchingMap, SimpleMCPrimaryList &simpleMCPrimaryList) const
 Extract details of each mc primary (ordered by number of true hits) More...
 
void GetMCPrimaryMatchingMap (const SimpleMCPrimaryList &simpleMCPrimaryList, const MCParticleMatchingMap &mcParticleMatchingMap, const PFParticlesToHits &pfParticlesToHits, MCPrimaryMatchingMap &mcPrimaryMatchingMap) const
 Obtain a sorted list of matched pfos for each mc primary. More...
 
bool IsNeutrinoInduced (const art::Ptr< simb::MCParticle > pMCParticle, const MCParticlesToMCTruth &artMCParticlesToMCTruth) const
 Whether a mc particle is neutrino induced. More...
 
void GetMCTruth (const art::Event &evt, MCTruthVector &mcTruthVector) const
 Obtain a vector of mc truth. More...
 
void GetRecoNeutrinos (const art::Event &evt, PFParticleVector &recoNeutrinoVector) const
 Obtain a vector of reco neutrinos. More...
 
void PrintAllOutput (const MCTruthVector &mcTruthVector, const PFParticleVector &recoNeutrinoVector, const MCPrimaryMatchingMap &mcPrimaryMatchingMap) const
 Print all the raw matching output to screen. More...
 
void PerformMatching (const MCPrimaryMatchingMap &mcPrimaryMatchingMap, MatchingDetailsMap &matchingDetailsMap) const
 Apply a well-defined matching procedure to the comprehensive matches in the provided mc primary matching map. More...
 
bool GetStrongestPfoMatch (const MCPrimaryMatchingMap &mcPrimaryMatchingMap, IntSet &usedMCIds, IntSet &usedPfoIds, MatchingDetailsMap &matchingDetailsMap) const
 Get the strongest pfo match (most matched hits) between an available mc primary and an available pfo. More...
 
void GetRemainingPfoMatches (const MCPrimaryMatchingMap &mcPrimaryMatchingMap, const IntSet &usedPfoIds, MatchingDetailsMap &matchingDetailsMap) const
 Get the best matches for any pfos left-over after the strong matching procedure. More...
 
void PrintMatchingOutput (const MCPrimaryMatchingMap &mcPrimaryMatchingMap, const MatchingDetailsMap &matchingDetailsMap) const
 Print the results of the matching procedure. More...
 
bool IsGoodMCPrimary (const SimpleMCPrimary &simpleMCPrimary) const
 Whether a provided mc primary passes selection, based on number of "good" hits. More...
 
bool HasMatch (const SimpleMCPrimary &simpleMCPrimary, const SimpleMatchedPfoList &simpleMatchedPfoList, const MatchingDetailsMap &matchingDetailsMap) const
 Whether a provided mc primary has a match, of any quality (use simple matched pfo list and information in matching details map) More...
 
bool IsGoodMatch (const SimpleMCPrimary &simpleMCPrimary, const SimpleMatchedPfo &simpleMatchedPfo) const
 Whether a provided mc primary and pfo are deemed to be a good match. More...
 
unsigned int CountHitsByType (const geo::View_t view, const HitVector &hitVector) const
 Count the number of hits, in a provided vector, of a specified view. More...
 

Static Private Member Functions

static bool SortSimpleMCPrimaries (const SimpleMCPrimary &lhs, const SimpleMCPrimary &rhs)
 Sort simple mc primaries by number of mc hits. More...
 
static bool SortSimpleMatchedPfos (const SimpleMatchedPfo &lhs, const SimpleMatchedPfo &rhs)
 Sort simple matched pfos by number of matched hits. More...
 

Private Attributes

std::string m_hitfinderLabel
 The name/label of the hit producer module. More...
 
std::string m_particleLabel
 The name/label of the particle producer module. More...
 
std::string m_geantModuleLabel
 The name/label of the geant module. More...
 
std::string m_backtrackerLabel
 The name/label of the back-tracker module. More...
 
bool m_printAllToScreen
 Whether to print all/raw matching details to screen. More...
 
bool m_printMatchingToScreen
 Whether to print matching output to screen. More...
 
bool m_neutrinoInducedOnly
 Whether to consider only mc particles that were neutrino induced. More...
 
int m_matchingMinPrimaryHits
 The minimum number of good mc primary hits used in matching scheme. More...
 
int m_matchingMinHitsForGoodView
 The minimum number of good mc primary hits in given view to declare view to be good. More...
 
int m_matchingMinPrimaryGoodViews
 The minimum number of good views for a mc primary. More...
 
bool m_useSmallPrimaries
 Whether to consider matches to mc primaries with fewer than m_matchingMinPrimaryHits. More...
 
int m_matchingMinSharedHits
 The minimum number of shared hits used in matching scheme. More...
 
float m_matchingMinCompleteness
 The minimum particle completeness to declare a match. More...
 
float m_matchingMinPurity
 The minimum particle purity to declare a match. More...
 

Detailed Description

PFParticleValidation class.

Definition at line 23 of file PFParticleValidation_module.cc.

Member Typedef Documentation

typedef std::set<int> lar_pandora::PFParticleValidation::IntSet
private

Definition at line 211 of file PFParticleValidation_module.cc.

Definition at line 22 of file EDAnalyzer.h.

Constructor & Destructor Documentation

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

Constructor.

Parameters
pset

Definition at line 354 of file PFParticleValidation_module.cc.

References reconfigure().

355  : art::EDAnalyzer(pset)
356  {
357  this->reconfigure(pset);
358  }
void reconfigure(fhicl::ParameterSet const &pset)
lar_pandora::PFParticleValidation::~PFParticleValidation ( )
virtual

Destructor.

Definition at line 362 of file PFParticleValidation_module.cc.

362 {}

Member Function Documentation

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

Definition at line 394 of file PFParticleValidation_module.cc.

References lar_pandora::LArPandoraHelper::BuildMCParticleHitMaps(), lar_pandora::LArPandoraHelper::BuildPFParticleHitMaps(), lar_pandora::LArPandoraHelper::CollectHits(), GetMCParticleMatchingMap(), GetMCPrimaryMatchingMap(), GetMCTruth(), GetRecoNeutrinos(), GetSimpleMCPrimaryList(), lar_pandora::LArPandoraHelper::kAddDaughters, m_backtrackerLabel, m_geantModuleLabel, m_hitfinderLabel, m_particleLabel, m_printAllToScreen, m_printMatchingToScreen, PerformMatching(), PrintAllOutput(), and PrintMatchingOutput().

395  {
396  HitVector hitVector;
398 
399  PFParticlesToHits pfParticlesToHits;
400  HitsToPFParticles hitsToPfParticles;
402  evt, m_particleLabel, pfParticlesToHits, hitsToPfParticles, LArPandoraHelper::kAddDaughters);
403 
404  MCParticlesToHits mcParticlesToHits;
405  HitsToMCParticles hitsToMCParticles;
406 
409  hitVector,
410  mcParticlesToHits,
411  hitsToMCParticles,
413 
414  if (hitsToMCParticles.empty()) {
415  if (m_backtrackerLabel.empty())
416  throw cet::exception("LArPandora") << " PFParticleValidation::analyze - no sim channels "
417  "found, backtracker module must be set in FHiCL "
418  << std::endl;
419 
424  mcParticlesToHits,
425  hitsToMCParticles,
427  }
428 
429  MCParticleMatchingMap mcParticleMatchingMap;
431  pfParticlesToHits, mcParticlesToHits, hitsToMCParticles, mcParticleMatchingMap);
432 
433  SimpleMCPrimaryList simpleMCPrimaryList;
435  evt, mcParticlesToHits, hitsToMCParticles, mcParticleMatchingMap, simpleMCPrimaryList);
436 
437  MCPrimaryMatchingMap mcPrimaryMatchingMap;
439  simpleMCPrimaryList, mcParticleMatchingMap, pfParticlesToHits, mcPrimaryMatchingMap);
440 
441  MCTruthVector mcTruthVector;
442  this->GetMCTruth(evt, mcTruthVector);
443 
444  PFParticleVector recoNeutrinoVector;
445  this->GetRecoNeutrinos(evt, recoNeutrinoVector);
446 
447  if (m_printAllToScreen)
448  this->PrintAllOutput(mcTruthVector, recoNeutrinoVector, mcPrimaryMatchingMap);
449 
451  MatchingDetailsMap matchingDetailsMap;
452  this->PerformMatching(mcPrimaryMatchingMap, matchingDetailsMap);
453  this->PrintMatchingOutput(mcPrimaryMatchingMap, matchingDetailsMap);
454  }
455  }
static void BuildPFParticleHitMaps(const PFParticleVector &particleVector, const PFParticlesToSpacePoints &particlesToSpacePoints, const SpacePointsToHits &spacePointsToHits, PFParticlesToHits &particlesToHits, HitsToPFParticles &hitsToParticles, const DaughterMode daughterMode=kUseDaughters)
Build mapping between PFParticles and Hits using PFParticle/SpacePoint/Hit maps.
std::vector< art::Ptr< simb::MCTruth > > MCTruthVector
void GetMCParticleMatchingMap(const PFParticlesToHits &recoParticlesToHits, const MCParticlesToHits &trueParticlesToHits, const HitsToMCParticles &hitsToTrueParticles, MCParticleMatchingMap &mcParticleMatchingMap) const
Performing matching between true and reconstructed particles.
std::map< art::Ptr< recob::Hit >, art::Ptr< simb::MCParticle > > HitsToMCParticles
void PrintMatchingOutput(const MCPrimaryMatchingMap &mcPrimaryMatchingMap, const MatchingDetailsMap &matchingDetailsMap) const
Print the results of the matching procedure.
void PerformMatching(const MCPrimaryMatchingMap &mcPrimaryMatchingMap, MatchingDetailsMap &matchingDetailsMap) const
Apply a well-defined matching procedure to the comprehensive matches in the provided mc primary match...
std::map< SimpleMCPrimary, SimpleMatchedPfoList > MCPrimaryMatchingMap
void GetRecoNeutrinos(const art::Event &evt, PFParticleVector &recoNeutrinoVector) const
Obtain a vector of reco neutrinos.
void GetSimpleMCPrimaryList(const art::Event &evt, const MCParticlesToHits &mcParticlesToHits, const HitsToMCParticles &hitsToMCParticles, const MCParticleMatchingMap &mcParticleMatchingMap, SimpleMCPrimaryList &simpleMCPrimaryList) const
Extract details of each mc primary (ordered by number of true hits)
std::map< int, MatchingDetails > MatchingDetailsMap
void PrintAllOutput(const MCTruthVector &mcTruthVector, const PFParticleVector &recoNeutrinoVector, const MCPrimaryMatchingMap &mcPrimaryMatchingMap) const
Print all the raw matching output to screen.
std::string m_particleLabel
The name/label of the particle producer module.
std::vector< SimpleMCPrimary > SimpleMCPrimaryList
bool m_printMatchingToScreen
Whether to print matching output to screen.
void GetMCTruth(const art::Event &evt, MCTruthVector &mcTruthVector) const
Obtain a vector of mc truth.
std::map< art::Ptr< simb::MCParticle >, HitVector > MCParticlesToHits
bool m_printAllToScreen
Whether to print all/raw matching details to screen.
std::vector< art::Ptr< recob::PFParticle > > PFParticleVector
std::string m_backtrackerLabel
The name/label of the back-tracker module.
std::map< art::Ptr< recob::PFParticle >, HitVector > PFParticlesToHits
static void CollectHits(const art::Event &evt, const std::string &label, HitVector &hitVector)
Collect the reconstructed Hits from the ART event record.
std::vector< art::Ptr< recob::Hit > > HitVector
std::map< art::Ptr< recob::Hit >, art::Ptr< recob::PFParticle > > HitsToPFParticles
void GetMCPrimaryMatchingMap(const SimpleMCPrimaryList &simpleMCPrimaryList, const MCParticleMatchingMap &mcParticleMatchingMap, const PFParticlesToHits &pfParticlesToHits, MCPrimaryMatchingMap &mcPrimaryMatchingMap) const
Obtain a sorted list of matched pfos for each mc primary.
std::string m_geantModuleLabel
The name/label of the geant module.
static void BuildMCParticleHitMaps(const art::Event &evt, const HitVector &hitVector, const SimChannelVector &simChannelVector, HitsToTrackIDEs &hitsToTrackIDEs)
Collect the links from reconstructed hits to their true energy deposits.
std::map< art::Ptr< simb::MCParticle >, PFParticleToMatchedHits > MCParticleMatchingMap
std::string m_hitfinderLabel
The name/label of the hit producer module.
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
void lar_pandora::PFParticleValidation::beginJob ( )
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 386 of file PFParticleValidation_module.cc.

386 {}
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 &)
unsigned int lar_pandora::PFParticleValidation::CountHitsByType ( const geo::View_t  view,
const HitVector hitVector 
) const
private

Count the number of hits, in a provided vector, of a specified view.

Parameters
viewthe view
hitVectorthe hit vector
Returns
the number of hits of the specified view

Definition at line 923 of file PFParticleValidation_module.cc.

Referenced by GetMCPrimaryMatchingMap(), and GetSimpleMCPrimaryList().

925  {
926  unsigned int nHitsOfSpecifiedType(0);
927 
928  for (const art::Ptr<recob::Hit> pHit : hitVector) {
929  if (view == pHit->View()) ++nHitsOfSpecifiedType;
930  }
931 
932  return nHitsOfSpecifiedType;
933  }
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")
void lar_pandora::PFParticleValidation::endJob ( )
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 390 of file PFParticleValidation_module.cc.

390 {}
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::PFParticleValidation::GetMCParticleMatchingMap ( const PFParticlesToHits recoParticlesToHits,
const MCParticlesToHits trueParticlesToHits,
const HitsToMCParticles hitsToTrueParticles,
MCParticleMatchingMap mcParticleMatchingMap 
) const
private

Performing matching between true and reconstructed particles.

Parameters
recoParticlesToHitsthe mapping from reconstructed particles to hits
trueParticlesToHitsthe mapping from true particles to hits
hitsToTrueParticlesthe mapping from hits to true particles
mcParticleMatchingMapthe output matches between all reconstructed and true particles

Definition at line 459 of file PFParticleValidation_module.cc.

Referenced by analyze().

464  {
465  // Create a placeholder entry for all mc particles with >0 hits
466  for (const MCParticlesToHits::value_type& mcParticleToHitsEntry : mcParticlesToHits) {
467  if (!mcParticleToHitsEntry.second.empty())
468  (void)mcParticleMatchingMap.insert(MCParticleMatchingMap::value_type(
469  mcParticleToHitsEntry.first, PFParticleToMatchedHits()));
470  }
471 
472  // Store true to reco matching details
473  for (const PFParticlesToHits::value_type& recoParticleToHits : pfParticlesToHits) {
474  const art::Ptr<recob::PFParticle> pRecoParticle(recoParticleToHits.first);
475  const HitVector& hitVector(recoParticleToHits.second);
476 
477  for (const art::Ptr<recob::Hit> pHit : hitVector) {
478  HitsToMCParticles::const_iterator mcParticleIter = hitsToMCParticles.find(pHit);
479 
480  if (hitsToMCParticles.end() == mcParticleIter) continue;
481 
482  const art::Ptr<simb::MCParticle> pTrueParticle = mcParticleIter->second;
483  mcParticleMatchingMap[pTrueParticle][pRecoParticle].push_back(pHit);
484  }
485  }
486  }
std::map< art::Ptr< recob::PFParticle >, HitVector > PFParticleToMatchedHits
intermediate_table::const_iterator const_iterator
std::vector< art::Ptr< recob::Hit > > HitVector
void lar_pandora::PFParticleValidation::GetMCPrimaryMatchingMap ( const SimpleMCPrimaryList simpleMCPrimaryList,
const MCParticleMatchingMap mcParticleMatchingMap,
const PFParticlesToHits pfParticlesToHits,
MCPrimaryMatchingMap mcPrimaryMatchingMap 
) const
private

Obtain a sorted list of matched pfos for each mc primary.

Parameters
simpleMCPrimaryListthe simple mc primary list
mcToFullPfoMatchingMapthe mc to full pfo matching map
pfoToHitListMapthe pfo to hit list map
mcPrimaryMatchingMapto receive the populated mc primary matching map

Definition at line 557 of file PFParticleValidation_module.cc.

References CountHitsByType(), art::Ptr< T >::get(), lar_pandora::LArPandoraHelper::IsNeutrino(), geo::kU, geo::kV, geo::kW, lar_pandora::PFParticleValidation::SimpleMatchedPfo::m_id, lar_pandora::PFParticleValidation::SimpleMatchedPfo::m_nMatchedHitsTotal, lar_pandora::PFParticleValidation::SimpleMatchedPfo::m_nMatchedHitsU, lar_pandora::PFParticleValidation::SimpleMatchedPfo::m_nMatchedHitsV, lar_pandora::PFParticleValidation::SimpleMatchedPfo::m_nMatchedHitsW, lar_pandora::PFParticleValidation::SimpleMatchedPfo::m_nPfoHitsTotal, lar_pandora::PFParticleValidation::SimpleMatchedPfo::m_nPfoHitsU, lar_pandora::PFParticleValidation::SimpleMatchedPfo::m_nPfoHitsV, lar_pandora::PFParticleValidation::SimpleMatchedPfo::m_nPfoHitsW, lar_pandora::PFParticleValidation::SimpleMatchedPfo::m_pAddress, lar_pandora::PFParticleValidation::SimpleMatchedPfo::m_parentId, lar_pandora::PFParticleValidation::SimpleMatchedPfo::m_pdgCode, recob::PFParticle::Parent(), recob::PFParticle::PdgCode(), recob::PFParticle::Self(), and SortSimpleMatchedPfos().

Referenced by analyze().

562  {
563  for (const SimpleMCPrimary& simpleMCPrimary : simpleMCPrimaryList) {
564  SimpleMatchedPfoList simpleMatchedPfoList;
565  MCParticleMatchingMap::const_iterator matchedPfoIter = mcParticleMatchingMap.end();
566 
567  // ATTN Nasty workaround I
568  for (MCParticleMatchingMap::const_iterator iter = mcParticleMatchingMap.begin(),
569  iterEnd = mcParticleMatchingMap.end();
570  iter != iterEnd;
571  ++iter) {
572  if (simpleMCPrimary.m_pAddress == iter->first.get()) {
573  matchedPfoIter = iter;
574  break;
575  };
576  }
577 
578  if (mcParticleMatchingMap.end() != matchedPfoIter) {
579  for (const PFParticleToMatchedHits::value_type& contribution : matchedPfoIter->second) {
580  const art::Ptr<recob::PFParticle> pMatchedPfo(contribution.first);
581  const HitVector& matchedHitVector(contribution.second);
582 
583  SimpleMatchedPfo simpleMatchedPfo;
584  simpleMatchedPfo.m_pAddress = pMatchedPfo.get();
585  simpleMatchedPfo.m_id = pMatchedPfo->Self();
586 
587  // ATTN Assume pfos have either zero or one parents. Ignore parent neutrino.
588  PFParticlesToHits::const_iterator parentPfoIter = pfParticlesToHits.end();
589 
590  // ATTN Nasty workaround II, bad place for another loop.
591  for (PFParticlesToHits::const_iterator iter = pfParticlesToHits.begin(),
592  iterEnd = pfParticlesToHits.end();
593  iter != iterEnd;
594  ++iter) {
595  if (pMatchedPfo->Parent() == iter->first->Self()) {
596  parentPfoIter = iter;
597  break;
598  };
599  }
600 
601  if ((pfParticlesToHits.end() != parentPfoIter) &&
602  !LArPandoraHelper::IsNeutrino(parentPfoIter->first))
603  simpleMatchedPfo.m_parentId = parentPfoIter->first->Self();
604 
605  simpleMatchedPfo.m_pdgCode = pMatchedPfo->PdgCode();
606  simpleMatchedPfo.m_nMatchedHitsTotal = matchedHitVector.size();
607  simpleMatchedPfo.m_nMatchedHitsU = this->CountHitsByType(geo::kU, matchedHitVector);
608  simpleMatchedPfo.m_nMatchedHitsV = this->CountHitsByType(geo::kV, matchedHitVector);
609  simpleMatchedPfo.m_nMatchedHitsW = this->CountHitsByType(geo::kW, matchedHitVector);
610 
611  PFParticlesToHits::const_iterator pfoHitsIter = pfParticlesToHits.find(pMatchedPfo);
612 
613  if (pfParticlesToHits.end() == pfoHitsIter)
614  throw cet::exception("LArPandora")
615  << " PFParticleValidation::analyze --- Presence of PFParticle in map mandatory.";
616 
617  const HitVector& pfoHitVector(pfoHitsIter->second);
618 
619  simpleMatchedPfo.m_nPfoHitsTotal = pfoHitVector.size();
620  simpleMatchedPfo.m_nPfoHitsU = this->CountHitsByType(geo::kU, pfoHitVector);
621  simpleMatchedPfo.m_nPfoHitsV = this->CountHitsByType(geo::kV, pfoHitVector);
622  simpleMatchedPfo.m_nPfoHitsW = this->CountHitsByType(geo::kW, pfoHitVector);
623 
624  simpleMatchedPfoList.push_back(simpleMatchedPfo);
625  }
626  }
627 
628  // Store the ordered vectors of matched pfo details
629  std::sort(simpleMatchedPfoList.begin(),
630  simpleMatchedPfoList.end(),
632 
633  if (!mcPrimaryMatchingMap
634  .insert(MCPrimaryMatchingMap::value_type(simpleMCPrimary, simpleMatchedPfoList))
635  .second)
636  throw cet::exception("LArPandora")
637  << " PFParticleValidation::analyze --- Double-counting MC primaries.";
638  }
639  }
static bool IsNeutrino(const art::Ptr< recob::PFParticle > particle)
Determine whether a particle has been reconstructed as a neutrino.
Planes which measure V.
Definition: geo_types.h:136
intermediate_table::const_iterator const_iterator
Planes which measure U.
Definition: geo_types.h:135
std::vector< SimpleMatchedPfo > SimpleMatchedPfoList
static bool SortSimpleMatchedPfos(const SimpleMatchedPfo &lhs, const SimpleMatchedPfo &rhs)
Sort simple matched pfos by number of matched hits.
std::vector< art::Ptr< recob::Hit > > HitVector
Planes which measure W (third view for Bo, MicroBooNE, etc).
Definition: geo_types.h:137
unsigned int CountHitsByType(const geo::View_t view, const HitVector &hitVector) const
Count the number of hits, in a provided vector, of a specified view.
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
void lar_pandora::PFParticleValidation::GetMCTruth ( const art::Event evt,
MCTruthVector mcTruthVector 
) const
private

Obtain a vector of mc truth.

Parameters
evtthe event
mcNeutrinoVectorto receive the populated vector of mc truth

Definition at line 643 of file PFParticleValidation_module.cc.

References lar_pandora::LArPandoraHelper::CollectMCParticles(), m_geantModuleLabel, and simb::MCTruth::NeutrinoSet().

Referenced by analyze().

644  {
645  MCTruthToMCParticles artMCTruthToMCParticles;
646  MCParticlesToMCTruth artMCParticlesToMCTruth;
648  evt, m_geantModuleLabel, artMCTruthToMCParticles, artMCParticlesToMCTruth);
649 
650  for (const auto& mapEntry : artMCTruthToMCParticles) {
651  const art::Ptr<simb::MCTruth> truth = mapEntry.first;
652 
653  if (!truth->NeutrinoSet()) continue;
654 
655  if (mcTruthVector.end() == std::find(mcTruthVector.begin(), mcTruthVector.end(), truth))
656  mcTruthVector.push_back(truth);
657  }
658  }
std::map< art::Ptr< simb::MCParticle >, art::Ptr< simb::MCTruth > > MCParticlesToMCTruth
std::map< art::Ptr< simb::MCTruth >, MCParticleVector > MCTruthToMCParticles
bool NeutrinoSet() const
Definition: MCTruth.h:78
std::string m_geantModuleLabel
The name/label of the geant module.
static void CollectMCParticles(const art::Event &evt, const std::string &label, MCParticleVector &particleVector)
Collect a vector of MCParticle objects from the ART event record.
void lar_pandora::PFParticleValidation::GetRecoNeutrinos ( const art::Event evt,
PFParticleVector recoNeutrinoVector 
) const
private

Obtain a vector of reco neutrinos.

Parameters
evtthe event
recoNeutrinoVectorto receive the populated vector of reco neutrinos

Definition at line 662 of file PFParticleValidation_module.cc.

References lar_pandora::LArPandoraHelper::CollectPFParticles(), m_particleLabel, and lar_pandora::LArPandoraHelper::SelectNeutrinoPFParticles().

Referenced by analyze().

664  {
665  PFParticleVector allPFParticles;
667  LArPandoraHelper::SelectNeutrinoPFParticles(allPFParticles, recoNeutrinoVector);
668  }
std::string m_particleLabel
The name/label of the particle producer module.
std::vector< art::Ptr< recob::PFParticle > > PFParticleVector
static void CollectPFParticles(const art::Event &evt, const std::string &label, PFParticleVector &particleVector)
Collect the reconstructed PFParticles from the ART event record.
static void SelectNeutrinoPFParticles(const PFParticleVector &inputParticles, PFParticleVector &outputParticles)
Select reconstructed neutrino particles from a list of all reconstructed particles.
void lar_pandora::PFParticleValidation::GetRemainingPfoMatches ( const MCPrimaryMatchingMap mcPrimaryMatchingMap,
const IntSet usedPfoIds,
MatchingDetailsMap matchingDetailsMap 
) const
private

Get the best matches for any pfos left-over after the strong matching procedure.

Parameters
mcPrimaryMatchingMapthe input/raw mc primary matching map
usedPfoIdsthe list of pfo ids with an existing match
matchingDetailsMapthe matching details map, to be populated

Definition at line 778 of file PFParticleValidation_module.cc.

References IsGoodMCPrimary(), lar_pandora::PFParticleValidation::MatchingDetails::m_completeness, lar_pandora::PFParticleValidation::SimpleMCPrimary::m_id, lar_pandora::PFParticleValidation::SimpleMatchedPfo::m_id, lar_pandora::PFParticleValidation::MatchingDetails::m_matchedPrimaryId, lar_pandora::PFParticleValidation::MatchingDetails::m_nMatchedHits, lar_pandora::PFParticleValidation::SimpleMatchedPfo::m_nMatchedHitsTotal, lar_pandora::PFParticleValidation::SimpleMCPrimary::m_nMCHitsTotal, and m_useSmallPrimaries.

Referenced by PerformMatching().

782  {
783  for (const MCPrimaryMatchingMap::value_type& mapValue : mcPrimaryMatchingMap) {
784  const SimpleMCPrimary& simpleMCPrimary(mapValue.first);
785 
786  if (!m_useSmallPrimaries && !this->IsGoodMCPrimary(simpleMCPrimary)) continue;
787 
788  for (const SimpleMatchedPfo& simpleMatchedPfo : mapValue.second) {
789  if (usedPfoIds.count(simpleMatchedPfo.m_id)) continue;
790 
791  MatchingDetails& matchingDetails(matchingDetailsMap[simpleMatchedPfo.m_id]);
792 
793  if (simpleMatchedPfo.m_nMatchedHitsTotal > matchingDetails.m_nMatchedHits) {
794  matchingDetails.m_matchedPrimaryId = simpleMCPrimary.m_id;
795  matchingDetails.m_nMatchedHits = simpleMatchedPfo.m_nMatchedHitsTotal;
796  matchingDetails.m_completeness =
797  static_cast<float>(simpleMatchedPfo.m_nMatchedHitsTotal) /
798  static_cast<float>(simpleMCPrimary.m_nMCHitsTotal);
799  }
800  }
801  }
802  }
bool m_useSmallPrimaries
Whether to consider matches to mc primaries with fewer than m_matchingMinPrimaryHits.
bool IsGoodMCPrimary(const SimpleMCPrimary &simpleMCPrimary) const
Whether a provided mc primary passes selection, based on number of "good" hits.
void lar_pandora::PFParticleValidation::GetSimpleMCPrimaryList ( const art::Event evt,
const MCParticlesToHits mcParticlesToHits,
const HitsToMCParticles hitsToMCParticles,
const MCParticleMatchingMap mcParticleMatchingMap,
SimpleMCPrimaryList simpleMCPrimaryList 
) const
private

Extract details of each mc primary (ordered by number of true hits)

Parameters
evtthe event
mcParticlesToHitsthe mc primary to hits map
hitsToMCParticlesthe hits to mc particles map
mcParticleMatchingMapthe mc to particle to pf particle matching map (to record number of matched pf particles)
simpleMCPrimaryListto receive the populated simple mc primary list

Definition at line 490 of file PFParticleValidation_module.cc.

References lar_pandora::LArPandoraHelper::CollectMCParticles(), CountHitsByType(), simb::MCParticle::E(), art::Ptr< T >::get(), IsNeutrinoInduced(), geo::kU, geo::kV, geo::kW, lar_pandora::PFParticleValidation::SimpleMCPrimary::m_energy, m_geantModuleLabel, m_neutrinoInducedOnly, lar_pandora::PFParticleValidation::SimpleMCPrimary::m_nMatchedPfos, lar_pandora::PFParticleValidation::SimpleMCPrimary::m_nMCHitsTotal, lar_pandora::PFParticleValidation::SimpleMCPrimary::m_nMCHitsU, lar_pandora::PFParticleValidation::SimpleMCPrimary::m_nMCHitsV, lar_pandora::PFParticleValidation::SimpleMCPrimary::m_nMCHitsW, lar_pandora::PFParticleValidation::SimpleMCPrimary::m_pAddress, lar_pandora::PFParticleValidation::SimpleMCPrimary::m_pdgCode, simb::MCParticle::PdgCode(), and SortSimpleMCPrimaries().

Referenced by analyze().

496  {
497  MCTruthToMCParticles artMCTruthToMCParticles;
498  MCParticlesToMCTruth artMCParticlesToMCTruth;
500  evt, m_geantModuleLabel, artMCTruthToMCParticles, artMCParticlesToMCTruth);
501 
502  for (const MCParticlesToHits::value_type& mapEntry : mcParticlesToHits) {
503  const art::Ptr<simb::MCParticle> pMCPrimary(mapEntry.first);
504 
505  if (m_neutrinoInducedOnly && !this->IsNeutrinoInduced(pMCPrimary, artMCParticlesToMCTruth))
506  continue;
507 
508  SimpleMCPrimary simpleMCPrimary;
509  // ATTN simpleMCPrimary.m_id assigned later, after sorting
510  simpleMCPrimary.m_pAddress = pMCPrimary.get();
511  simpleMCPrimary.m_pdgCode = pMCPrimary->PdgCode();
512  simpleMCPrimary.m_energy = pMCPrimary->E();
513 
514  MCParticlesToHits::const_iterator trueHitsIter = mcParticlesToHits.find(pMCPrimary);
515 
516  if (mcParticlesToHits.end() != trueHitsIter) {
517  const HitVector& hitVector(trueHitsIter->second);
518  simpleMCPrimary.m_nMCHitsTotal = hitVector.size();
519  simpleMCPrimary.m_nMCHitsU = this->CountHitsByType(geo::kU, hitVector);
520  simpleMCPrimary.m_nMCHitsV = this->CountHitsByType(geo::kV, hitVector);
521  simpleMCPrimary.m_nMCHitsW = this->CountHitsByType(geo::kW, hitVector);
522  }
523 
524  MCParticleMatchingMap::const_iterator matchedPfoIter = mcParticleMatchingMap.find(pMCPrimary);
525 
526  if (mcParticleMatchingMap.end() != matchedPfoIter)
527  simpleMCPrimary.m_nMatchedPfos = matchedPfoIter->second.size();
528 
529  simpleMCPrimaryList.push_back(simpleMCPrimary);
530  }
531 
532  std::sort(simpleMCPrimaryList.begin(),
533  simpleMCPrimaryList.end(),
535 
536  int mcPrimaryId(0);
537  for (SimpleMCPrimary& simpleMCPrimary : simpleMCPrimaryList)
538  simpleMCPrimary.m_id = mcPrimaryId++;
539  }
bool IsNeutrinoInduced(const art::Ptr< simb::MCParticle > pMCParticle, const MCParticlesToMCTruth &artMCParticlesToMCTruth) const
Whether a mc particle is neutrino induced.
Planes which measure V.
Definition: geo_types.h:136
bool m_neutrinoInducedOnly
Whether to consider only mc particles that were neutrino induced.
std::map< art::Ptr< simb::MCParticle >, art::Ptr< simb::MCTruth > > MCParticlesToMCTruth
intermediate_table::const_iterator const_iterator
Planes which measure U.
Definition: geo_types.h:135
std::map< art::Ptr< simb::MCTruth >, MCParticleVector > MCTruthToMCParticles
std::vector< art::Ptr< recob::Hit > > HitVector
static bool SortSimpleMCPrimaries(const SimpleMCPrimary &lhs, const SimpleMCPrimary &rhs)
Sort simple mc primaries by number of mc hits.
Planes which measure W (third view for Bo, MicroBooNE, etc).
Definition: geo_types.h:137
std::string m_geantModuleLabel
The name/label of the geant module.
static void CollectMCParticles(const art::Event &evt, const std::string &label, MCParticleVector &particleVector)
Collect a vector of MCParticle objects from the ART event record.
unsigned int CountHitsByType(const geo::View_t view, const HitVector &hitVector) const
Count the number of hits, in a provided vector, of a specified view.
Definition: fwd.h:26
bool lar_pandora::PFParticleValidation::GetStrongestPfoMatch ( const MCPrimaryMatchingMap mcPrimaryMatchingMap,
IntSet usedMCIds,
IntSet usedPfoIds,
MatchingDetailsMap matchingDetailsMap 
) const
private

Get the strongest pfo match (most matched hits) between an available mc primary and an available pfo.

Parameters
mcPrimaryMatchingMapthe input/raw mc primary matching map
usedMCIdsthe list of mc primary ids with an existing match
usedPfoIdsthe list of pfo ids with an existing match
matchingDetailsMapthe matching details map, to be populated

Definition at line 735 of file PFParticleValidation_module.cc.

References IsGoodMatch(), IsGoodMCPrimary(), lar_pandora::PFParticleValidation::MatchingDetails::m_completeness, lar_pandora::PFParticleValidation::SimpleMCPrimary::m_id, lar_pandora::PFParticleValidation::SimpleMatchedPfo::m_id, lar_pandora::PFParticleValidation::MatchingDetails::m_matchedPrimaryId, lar_pandora::PFParticleValidation::MatchingDetails::m_nMatchedHits, lar_pandora::PFParticleValidation::SimpleMatchedPfo::m_nMatchedHitsTotal, lar_pandora::PFParticleValidation::SimpleMCPrimary::m_nMCHitsTotal, and m_useSmallPrimaries.

Referenced by PerformMatching().

739  {
740  int bestPfoMatchId(-1);
741  MatchingDetails bestMatchingDetails;
742 
743  for (const MCPrimaryMatchingMap::value_type& mapValue : mcPrimaryMatchingMap) {
744  const SimpleMCPrimary& simpleMCPrimary(mapValue.first);
745 
746  if (!m_useSmallPrimaries && !this->IsGoodMCPrimary(simpleMCPrimary)) continue;
747 
748  if (usedMCIds.count(simpleMCPrimary.m_id)) continue;
749 
750  for (const SimpleMatchedPfo& simpleMatchedPfo : mapValue.second) {
751  if (usedPfoIds.count(simpleMatchedPfo.m_id)) continue;
752 
753  if (!this->IsGoodMatch(simpleMCPrimary, simpleMatchedPfo)) continue;
754 
755  if (simpleMatchedPfo.m_nMatchedHitsTotal > bestMatchingDetails.m_nMatchedHits) {
756  bestPfoMatchId = simpleMatchedPfo.m_id;
757  bestMatchingDetails.m_matchedPrimaryId = simpleMCPrimary.m_id;
758  bestMatchingDetails.m_nMatchedHits = simpleMatchedPfo.m_nMatchedHitsTotal;
759  bestMatchingDetails.m_completeness =
760  static_cast<float>(simpleMatchedPfo.m_nMatchedHitsTotal) /
761  static_cast<float>(simpleMCPrimary.m_nMCHitsTotal);
762  }
763  }
764  }
765 
766  if (bestPfoMatchId > -1) {
767  matchingDetailsMap[bestPfoMatchId] = bestMatchingDetails;
768  usedMCIds.insert(bestMatchingDetails.m_matchedPrimaryId);
769  usedPfoIds.insert(bestPfoMatchId);
770  return true;
771  }
772 
773  return false;
774  }
bool m_useSmallPrimaries
Whether to consider matches to mc primaries with fewer than m_matchingMinPrimaryHits.
bool IsGoodMatch(const SimpleMCPrimary &simpleMCPrimary, const SimpleMatchedPfo &simpleMatchedPfo) const
Whether a provided mc primary and pfo are deemed to be a good match.
bool IsGoodMCPrimary(const SimpleMCPrimary &simpleMCPrimary) const
Whether a provided mc primary passes selection, based on number of "good" hits.
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
bool lar_pandora::PFParticleValidation::HasMatch ( const SimpleMCPrimary simpleMCPrimary,
const SimpleMatchedPfoList simpleMatchedPfoList,
const MatchingDetailsMap matchingDetailsMap 
) const
private

Whether a provided mc primary has a match, of any quality (use simple matched pfo list and information in matching details map)

Parameters
simpleMCPrimarythe simple mc primary
simpleMatchedPfoListthe list of simple matched pfos
matchingDetailsMapthe matching details map
Returns
boolean

Definition at line 890 of file PFParticleValidation_module.cc.

References lar_pandora::PFParticleValidation::SimpleMCPrimary::m_id.

Referenced by PrintMatchingOutput().

893  {
894  for (const SimpleMatchedPfo& simpleMatchedPfo : simpleMatchedPfoList) {
895  if (matchingDetailsMap.count(simpleMatchedPfo.m_id) &&
896  (simpleMCPrimary.m_id == matchingDetailsMap.at(simpleMatchedPfo.m_id).m_matchedPrimaryId))
897  return true;
898  }
899 
900  return false;
901  }
bool lar_pandora::PFParticleValidation::IsGoodMatch ( const SimpleMCPrimary simpleMCPrimary,
const SimpleMatchedPfo simpleMatchedPfo 
) const
private

Whether a provided mc primary and pfo are deemed to be a good match.

Parameters
simpleMCPrimarythe simple mc primary
simpleMatchedPfothe simple matched pfo
Returns
boolean

Definition at line 905 of file PFParticleValidation_module.cc.

References m_matchingMinCompleteness, m_matchingMinPurity, m_matchingMinSharedHits, lar_pandora::PFParticleValidation::SimpleMatchedPfo::m_nMatchedHitsTotal, lar_pandora::PFParticleValidation::SimpleMCPrimary::m_nMCHitsTotal, and lar_pandora::PFParticleValidation::SimpleMatchedPfo::m_nPfoHitsTotal.

Referenced by GetStrongestPfoMatch(), and PrintMatchingOutput().

907  {
908  const float purity((simpleMatchedPfo.m_nPfoHitsTotal > 0) ?
909  static_cast<float>(simpleMatchedPfo.m_nMatchedHitsTotal) /
910  static_cast<float>(simpleMatchedPfo.m_nPfoHitsTotal) :
911  0.f);
912  const float completeness((simpleMCPrimary.m_nMCHitsTotal > 0) ?
913  static_cast<float>(simpleMatchedPfo.m_nMatchedHitsTotal) /
914  static_cast<float>(simpleMCPrimary.m_nMCHitsTotal) :
915  0.f);
916 
917  return ((simpleMatchedPfo.m_nMatchedHitsTotal >= m_matchingMinSharedHits) &&
918  (purity >= m_matchingMinPurity) && (completeness >= m_matchingMinCompleteness));
919  }
float m_matchingMinCompleteness
The minimum particle completeness to declare a match.
float m_matchingMinPurity
The minimum particle purity to declare a match.
int m_matchingMinSharedHits
The minimum number of shared hits used in matching scheme.
bool lar_pandora::PFParticleValidation::IsGoodMCPrimary ( const SimpleMCPrimary simpleMCPrimary) const
private

Whether a provided mc primary passes selection, based on number of "good" hits.

Parameters
simpleMCPrimarythe simple mc primary
Returns
boolean

Definition at line 874 of file PFParticleValidation_module.cc.

References m_matchingMinHitsForGoodView, m_matchingMinPrimaryGoodViews, m_matchingMinPrimaryHits, lar_pandora::PFParticleValidation::SimpleMCPrimary::m_nMCHitsTotal, lar_pandora::PFParticleValidation::SimpleMCPrimary::m_nMCHitsU, lar_pandora::PFParticleValidation::SimpleMCPrimary::m_nMCHitsV, and lar_pandora::PFParticleValidation::SimpleMCPrimary::m_nMCHitsW.

Referenced by GetRemainingPfoMatches(), GetStrongestPfoMatch(), and PrintMatchingOutput().

875  {
876  if (simpleMCPrimary.m_nMCHitsTotal < m_matchingMinPrimaryHits) return false;
877 
878  int nGoodViews(0);
879  if (simpleMCPrimary.m_nMCHitsU >= m_matchingMinHitsForGoodView) ++nGoodViews;
880  if (simpleMCPrimary.m_nMCHitsV >= m_matchingMinHitsForGoodView) ++nGoodViews;
881  if (simpleMCPrimary.m_nMCHitsW >= m_matchingMinHitsForGoodView) ++nGoodViews;
882 
883  if (nGoodViews < m_matchingMinPrimaryGoodViews) return false;
884 
885  return true;
886  }
int m_matchingMinPrimaryHits
The minimum number of good mc primary hits used in matching scheme.
int m_matchingMinPrimaryGoodViews
The minimum number of good views for a mc primary.
int m_matchingMinHitsForGoodView
The minimum number of good mc primary hits in given view to declare view to be good.
bool lar_pandora::PFParticleValidation::IsNeutrinoInduced ( const art::Ptr< simb::MCParticle pMCParticle,
const MCParticlesToMCTruth artMCParticlesToMCTruth 
) const
private

Whether a mc particle is neutrino induced.

Parameters
pMCParticleaddress of the mc particle
artMCParticlesToMCTruththe mapping from mc particles to mc truth
Returns
boolean

Definition at line 543 of file PFParticleValidation_module.cc.

References simb::kBeamNeutrino, and simb::MCTruth::Origin().

Referenced by GetSimpleMCPrimaryList().

546  {
547  MCParticlesToMCTruth::const_iterator iter = artMCParticlesToMCTruth.find(pMCParticle);
548 
549  if (artMCParticlesToMCTruth.end() == iter) return false;
550 
551  const art::Ptr<simb::MCTruth> pMCTruth = iter->second;
552  return (simb::kBeamNeutrino == pMCTruth->Origin());
553  }
simb::Origin_t Origin() const
Definition: MCTruth.h:74
intermediate_table::const_iterator const_iterator
Beam neutrinos.
Definition: MCTruth.h:23
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::PFParticleValidation::PerformMatching ( const MCPrimaryMatchingMap mcPrimaryMatchingMap,
MatchingDetailsMap matchingDetailsMap 
) const
private

Apply a well-defined matching procedure to the comprehensive matches in the provided mc primary matching map.

Parameters
mcPrimaryMatchingMapthe input/raw mc primary matching map
matchingDetailsMapthe matching details map, to be populated

Definition at line 722 of file PFParticleValidation_module.cc.

References GetRemainingPfoMatches(), and GetStrongestPfoMatch().

Referenced by analyze().

724  {
725  // Get best matches, one-by-one, until no more strong matches possible
726  IntSet usedMCIds, usedPfoIds;
727  while (GetStrongestPfoMatch(mcPrimaryMatchingMap, usedMCIds, usedPfoIds, matchingDetailsMap)) {}
728 
729  // Assign any remaining pfos to primaries, based on number of matched hits
730  GetRemainingPfoMatches(mcPrimaryMatchingMap, usedPfoIds, matchingDetailsMap);
731  }
bool GetStrongestPfoMatch(const MCPrimaryMatchingMap &mcPrimaryMatchingMap, IntSet &usedMCIds, IntSet &usedPfoIds, MatchingDetailsMap &matchingDetailsMap) const
Get the strongest pfo match (most matched hits) between an available mc primary and an available pfo...
void GetRemainingPfoMatches(const MCPrimaryMatchingMap &mcPrimaryMatchingMap, const IntSet &usedPfoIds, MatchingDetailsMap &matchingDetailsMap) const
Get the best matches for any pfos left-over after the strong matching procedure.
void lar_pandora::PFParticleValidation::PrintAllOutput ( const MCTruthVector mcTruthVector,
const PFParticleVector recoNeutrinoVector,
const MCPrimaryMatchingMap mcPrimaryMatchingMap 
) const
private

Print all the raw matching output to screen.

Parameters
mcTruthVectorthe mc truth vector
recoNeutrinoVectorthe reco neutrino vector
mcPrimaryMatchingMapthe input/raw mc primary matching map

Definition at line 672 of file PFParticleValidation_module.cc.

References lar_pandora::PFParticleValidation::SimpleMCPrimary::m_id, lar_pandora::PFParticleValidation::SimpleMatchedPfo::m_id, lar_pandora::PFParticleValidation::SimpleMatchedPfo::m_nMatchedHitsTotal, lar_pandora::PFParticleValidation::SimpleMatchedPfo::m_nMatchedHitsU, lar_pandora::PFParticleValidation::SimpleMatchedPfo::m_nMatchedHitsV, lar_pandora::PFParticleValidation::SimpleMatchedPfo::m_nMatchedHitsW, lar_pandora::PFParticleValidation::SimpleMCPrimary::m_nMCHitsTotal, lar_pandora::PFParticleValidation::SimpleMCPrimary::m_nMCHitsU, lar_pandora::PFParticleValidation::SimpleMCPrimary::m_nMCHitsV, lar_pandora::PFParticleValidation::SimpleMCPrimary::m_nMCHitsW, lar_pandora::PFParticleValidation::SimpleMatchedPfo::m_nPfoHitsTotal, lar_pandora::PFParticleValidation::SimpleMatchedPfo::m_nPfoHitsU, lar_pandora::PFParticleValidation::SimpleMatchedPfo::m_nPfoHitsV, lar_pandora::PFParticleValidation::SimpleMatchedPfo::m_nPfoHitsW, lar_pandora::PFParticleValidation::SimpleMatchedPfo::m_parentId, lar_pandora::PFParticleValidation::SimpleMCPrimary::m_pdgCode, and lar_pandora::PFParticleValidation::SimpleMatchedPfo::m_pdgCode.

Referenced by analyze().

675  {
676  std::cout << "---RAW-MATCHING-OUTPUT-----------------------------------------------------------"
677  "---------------"
678  << std::endl;
679 
680  for (const art::Ptr<simb::MCTruth> pMCTruth : mcTruthVector) {
681  std::cout << "MCNeutrino, PDG " << pMCTruth->GetNeutrino().Nu().PdgCode()
682  << ", InteractionType " << pMCTruth->GetNeutrino().InteractionType() << std::endl;
683  }
684 
685  for (const art::Ptr<recob::PFParticle> pPfo : recoNeutrinoVector) {
686  std::cout << "RecoNeutrino, PDG " << pPfo->PdgCode() << ", nDaughters "
687  << pPfo->NumDaughters() << std::endl;
688  }
689 
690  for (const MCPrimaryMatchingMap::value_type& mapValue : mcPrimaryMatchingMap) {
691  const SimpleMCPrimary& simpleMCPrimary(mapValue.first);
692 
693  std::cout << std::endl
694  << "Primary " << simpleMCPrimary.m_id << ", PDG " << simpleMCPrimary.m_pdgCode
695  << ", nMCHits " << simpleMCPrimary.m_nMCHitsTotal << " ("
696  << simpleMCPrimary.m_nMCHitsU << ", " << simpleMCPrimary.m_nMCHitsV << ", "
697  << simpleMCPrimary.m_nMCHitsW << ")" << std::endl;
698 
699  for (const SimpleMatchedPfo& simpleMatchedPfo : mapValue.second) {
700  std::cout << "-MatchedPfo " << simpleMatchedPfo.m_id;
701 
702  if (simpleMatchedPfo.m_parentId >= 0)
703  std::cout << ", ParentPfo " << simpleMatchedPfo.m_parentId;
704 
705  std::cout << ", PDG " << simpleMatchedPfo.m_pdgCode << ", nMatchedHits "
706  << simpleMatchedPfo.m_nMatchedHitsTotal << " ("
707  << simpleMatchedPfo.m_nMatchedHitsU << ", " << simpleMatchedPfo.m_nMatchedHitsV
708  << ", " << simpleMatchedPfo.m_nMatchedHitsW << ")"
709  << ", nPfoHits " << simpleMatchedPfo.m_nPfoHitsTotal << " ("
710  << simpleMatchedPfo.m_nPfoHitsU << ", " << simpleMatchedPfo.m_nPfoHitsV << ", "
711  << simpleMatchedPfo.m_nPfoHitsW << ")" << std::endl;
712  }
713  }
714 
715  std::cout << "---------------------------------------------------------------------------------"
716  "---------------"
717  << std::endl;
718  }
void lar_pandora::PFParticleValidation::PrintMatchingOutput ( const MCPrimaryMatchingMap mcPrimaryMatchingMap,
const MatchingDetailsMap matchingDetailsMap 
) const
private

Print the results of the matching procedure.

Parameters
mcPrimaryMatchingMapthe input/raw mc primary matching map
matchingDetailsMapthe matching details map

Definition at line 806 of file PFParticleValidation_module.cc.

References HasMatch(), if(), IsGoodMatch(), IsGoodMCPrimary(), lar_pandora::PFParticleValidation::SimpleMCPrimary::m_id, lar_pandora::PFParticleValidation::SimpleMatchedPfo::m_id, m_matchingMinCompleteness, m_matchingMinHitsForGoodView, m_matchingMinPrimaryGoodViews, m_matchingMinPrimaryHits, m_matchingMinPurity, m_matchingMinSharedHits, lar_pandora::PFParticleValidation::SimpleMatchedPfo::m_nMatchedHitsTotal, lar_pandora::PFParticleValidation::SimpleMatchedPfo::m_nMatchedHitsU, lar_pandora::PFParticleValidation::SimpleMatchedPfo::m_nMatchedHitsV, lar_pandora::PFParticleValidation::SimpleMatchedPfo::m_nMatchedHitsW, lar_pandora::PFParticleValidation::SimpleMCPrimary::m_nMCHitsTotal, lar_pandora::PFParticleValidation::SimpleMCPrimary::m_nMCHitsU, lar_pandora::PFParticleValidation::SimpleMCPrimary::m_nMCHitsV, lar_pandora::PFParticleValidation::SimpleMCPrimary::m_nMCHitsW, lar_pandora::PFParticleValidation::SimpleMatchedPfo::m_nPfoHitsTotal, lar_pandora::PFParticleValidation::SimpleMatchedPfo::m_nPfoHitsU, lar_pandora::PFParticleValidation::SimpleMatchedPfo::m_nPfoHitsV, lar_pandora::PFParticleValidation::SimpleMatchedPfo::m_nPfoHitsW, lar_pandora::PFParticleValidation::SimpleMatchedPfo::m_parentId, lar_pandora::PFParticleValidation::SimpleMCPrimary::m_pdgCode, lar_pandora::PFParticleValidation::SimpleMatchedPfo::m_pdgCode, and m_useSmallPrimaries.

Referenced by analyze().

808  {
809  std::cout << "---PROCESSED-MATCHING-OUTPUT-----------------------------------------------------"
810  "---------------"
811  << std::endl;
812  std::cout << "MinPrimaryGoodHits " << m_matchingMinPrimaryHits << ", MinHitsForGoodView "
813  << m_matchingMinHitsForGoodView << ", MinPrimaryGoodViews "
814  << m_matchingMinPrimaryGoodViews << std::endl;
815  std::cout << "UseSmallPrimaries " << m_useSmallPrimaries << ", MinSharedHits "
816  << m_matchingMinSharedHits << ", MinCompleteness " << m_matchingMinCompleteness
817  << ", MinPurity " << m_matchingMinPurity << std::endl;
818 
819  bool isCorrect(true), isCalculable(false);
820 
821  for (const MCPrimaryMatchingMap::value_type& mapValue : mcPrimaryMatchingMap) {
822  const SimpleMCPrimary& simpleMCPrimary(mapValue.first);
823  const bool hasMatch(this->HasMatch(simpleMCPrimary, mapValue.second, matchingDetailsMap));
824  const bool isTargetPrimary(this->IsGoodMCPrimary(simpleMCPrimary) &&
825  (2112 != simpleMCPrimary.m_pdgCode));
826 
827  if (!hasMatch && !isTargetPrimary) continue;
828 
829  std::cout << std::endl
830  << (!isTargetPrimary ? "(Non target) " : "") << "Primary " << simpleMCPrimary.m_id
831  << ", PDG " << simpleMCPrimary.m_pdgCode << ", nMCHits "
832  << simpleMCPrimary.m_nMCHitsTotal << " (" << simpleMCPrimary.m_nMCHitsU << ", "
833  << simpleMCPrimary.m_nMCHitsV << ", " << simpleMCPrimary.m_nMCHitsW << ")"
834  << std::endl;
835 
836  if (2112 != simpleMCPrimary.m_pdgCode) isCalculable = true;
837 
838  unsigned int nMatches(0);
839 
840  for (const SimpleMatchedPfo& simpleMatchedPfo : mapValue.second) {
841  if (matchingDetailsMap.count(simpleMatchedPfo.m_id) &&
842  (simpleMCPrimary.m_id ==
843  matchingDetailsMap.at(simpleMatchedPfo.m_id).m_matchedPrimaryId)) {
844  const bool isGoodMatch(this->IsGoodMatch(simpleMCPrimary, simpleMatchedPfo));
845 
846  if (isGoodMatch) ++nMatches;
847  std::cout << "-" << (!isGoodMatch ? "(Below threshold) " : "") << "MatchedPfo "
848  << simpleMatchedPfo.m_id;
849 
850  if (simpleMatchedPfo.m_parentId >= 0)
851  std::cout << ", ParentPfo " << simpleMatchedPfo.m_parentId;
852 
853  std::cout << ", PDG " << simpleMatchedPfo.m_pdgCode << ", nMatchedHits "
854  << simpleMatchedPfo.m_nMatchedHitsTotal << " ("
855  << simpleMatchedPfo.m_nMatchedHitsU << ", " << simpleMatchedPfo.m_nMatchedHitsV
856  << ", " << simpleMatchedPfo.m_nMatchedHitsW << ")"
857  << ", nPfoHits " << simpleMatchedPfo.m_nPfoHitsTotal << " ("
858  << simpleMatchedPfo.m_nPfoHitsU << ", " << simpleMatchedPfo.m_nPfoHitsV << ", "
859  << simpleMatchedPfo.m_nPfoHitsW << ")" << std::endl;
860  }
861  }
862 
863  if (isTargetPrimary && (1 != nMatches)) isCorrect = false;
864  }
865 
866  std::cout << std::endl << "Is correct? " << (isCorrect && isCalculable) << std::endl;
867  std::cout << "---------------------------------------------------------------------------------"
868  "---------------"
869  << std::endl;
870  }
bool HasMatch(const SimpleMCPrimary &simpleMCPrimary, const SimpleMatchedPfoList &simpleMatchedPfoList, const MatchingDetailsMap &matchingDetailsMap) const
Whether a provided mc primary has a match, of any quality (use simple matched pfo list and informatio...
float m_matchingMinCompleteness
The minimum particle completeness to declare a match.
int m_matchingMinPrimaryHits
The minimum number of good mc primary hits used in matching scheme.
bool m_useSmallPrimaries
Whether to consider matches to mc primaries with fewer than m_matchingMinPrimaryHits.
if(nlines<=0)
bool IsGoodMatch(const SimpleMCPrimary &simpleMCPrimary, const SimpleMatchedPfo &simpleMatchedPfo) const
Whether a provided mc primary and pfo are deemed to be a good match.
float m_matchingMinPurity
The minimum particle purity to declare a match.
int m_matchingMinSharedHits
The minimum number of shared hits used in matching scheme.
int m_matchingMinPrimaryGoodViews
The minimum number of good views for a mc primary.
bool IsGoodMCPrimary(const SimpleMCPrimary &simpleMCPrimary) const
Whether a provided mc primary passes selection, based on number of "good" hits.
int m_matchingMinHitsForGoodView
The minimum number of good mc primary hits in given view to declare view to be good.
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::PFParticleValidation::reconfigure ( fhicl::ParameterSet const &  pset)

Definition at line 366 of file PFParticleValidation_module.cc.

References fhicl::ParameterSet::get(), m_backtrackerLabel, m_geantModuleLabel, m_hitfinderLabel, m_matchingMinCompleteness, m_matchingMinHitsForGoodView, m_matchingMinPrimaryGoodViews, m_matchingMinPrimaryHits, m_matchingMinPurity, m_matchingMinSharedHits, m_neutrinoInducedOnly, m_particleLabel, m_printAllToScreen, m_printMatchingToScreen, and m_useSmallPrimaries.

Referenced by PFParticleValidation().

367  {
368  m_particleLabel = pset.get<std::string>("PFParticleModule", "pandoraNu");
369  m_hitfinderLabel = pset.get<std::string>("HitFinderModule", "gaushit");
370  m_geantModuleLabel = pset.get<std::string>("GeantModule", "largeant");
371  m_backtrackerLabel = pset.get<std::string>("BackTrackerModule", "gaushitTruthMatch");
372  m_printAllToScreen = pset.get<bool>("PrintAllToScreen", true);
373  m_printMatchingToScreen = pset.get<bool>("PrintMatchingToScreen", true);
374  m_neutrinoInducedOnly = pset.get<bool>("NeutrinoInducedOnly", true);
375  m_matchingMinPrimaryHits = pset.get<int>("MatchingMinPrimaryHits", 15);
376  m_matchingMinHitsForGoodView = pset.get<int>("MatchingMinHitsForGoodView", 5);
377  m_matchingMinPrimaryGoodViews = pset.get<int>("MatchingMinPrimaryGoodViews", 2);
378  m_useSmallPrimaries = pset.get<bool>("UseSmallPrimaries", true);
379  m_matchingMinSharedHits = pset.get<int>("MatchingMinSharedHits", 5);
380  m_matchingMinCompleteness = pset.get<float>("MatchingMinCompleteness", 0.1f);
381  m_matchingMinPurity = pset.get<float>("MatchingMinPurity", 0.5f);
382  }
float m_matchingMinCompleteness
The minimum particle completeness to declare a match.
bool m_neutrinoInducedOnly
Whether to consider only mc particles that were neutrino induced.
int m_matchingMinPrimaryHits
The minimum number of good mc primary hits used in matching scheme.
std::string m_particleLabel
The name/label of the particle producer module.
bool m_useSmallPrimaries
Whether to consider matches to mc primaries with fewer than m_matchingMinPrimaryHits.
bool m_printMatchingToScreen
Whether to print matching output to screen.
bool m_printAllToScreen
Whether to print all/raw matching details to screen.
float m_matchingMinPurity
The minimum particle purity to declare a match.
std::string m_backtrackerLabel
The name/label of the back-tracker module.
int m_matchingMinSharedHits
The minimum number of shared hits used in matching scheme.
int m_matchingMinPrimaryGoodViews
The minimum number of good views for a mc primary.
int m_matchingMinHitsForGoodView
The minimum number of good mc primary hits in given view to declare view to be good.
std::string m_geantModuleLabel
The name/label of the geant module.
std::string m_hitfinderLabel
The name/label of the hit producer module.
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 lar_pandora::PFParticleValidation::SortSimpleMatchedPfos ( const SimpleMatchedPfo lhs,
const SimpleMatchedPfo rhs 
)
staticprivate

Sort simple matched pfos by number of matched hits.

Parameters
lhsthe left-hand side
rhsthe right-hand side
Returns
boolean

Definition at line 947 of file PFParticleValidation_module.cc.

References lar_pandora::PFParticleValidation::SimpleMatchedPfo::m_id, lar_pandora::PFParticleValidation::SimpleMatchedPfo::m_nMatchedHitsTotal, and lar_pandora::PFParticleValidation::SimpleMatchedPfo::m_nPfoHitsTotal.

Referenced by GetMCPrimaryMatchingMap().

949  {
950  if (lhs.m_nMatchedHitsTotal != rhs.m_nMatchedHitsTotal)
951  return (lhs.m_nMatchedHitsTotal > rhs.m_nMatchedHitsTotal);
952 
953  if (lhs.m_nPfoHitsTotal != rhs.m_nPfoHitsTotal)
954  return (lhs.m_nPfoHitsTotal > rhs.m_nPfoHitsTotal);
955 
956  return (lhs.m_id < rhs.m_id);
957  }
bool lar_pandora::PFParticleValidation::SortSimpleMCPrimaries ( const SimpleMCPrimary lhs,
const SimpleMCPrimary rhs 
)
staticprivate

Sort simple mc primaries by number of mc hits.

Parameters
lhsthe left-hand side
rhsthe right-hand side
Returns
boolean

Definition at line 937 of file PFParticleValidation_module.cc.

References lar_pandora::PFParticleValidation::SimpleMCPrimary::m_energy, and lar_pandora::PFParticleValidation::SimpleMCPrimary::m_nMCHitsTotal.

Referenced by GetSimpleMCPrimaryList().

939  {
940  if (lhs.m_nMCHitsTotal != rhs.m_nMCHitsTotal) return (lhs.m_nMCHitsTotal > rhs.m_nMCHitsTotal);
941 
942  return (lhs.m_energy > rhs.m_energy);
943  }
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::PFParticleValidation::m_backtrackerLabel
private

The name/label of the back-tracker module.

Definition at line 312 of file PFParticleValidation_module.cc.

Referenced by analyze(), and reconfigure().

std::string lar_pandora::PFParticleValidation::m_geantModuleLabel
private

The name/label of the geant module.

Definition at line 311 of file PFParticleValidation_module.cc.

Referenced by analyze(), GetMCTruth(), GetSimpleMCPrimaryList(), and reconfigure().

std::string lar_pandora::PFParticleValidation::m_hitfinderLabel
private

The name/label of the hit producer module.

Definition at line 309 of file PFParticleValidation_module.cc.

Referenced by analyze(), and reconfigure().

float lar_pandora::PFParticleValidation::m_matchingMinCompleteness
private

The minimum particle completeness to declare a match.

Definition at line 329 of file PFParticleValidation_module.cc.

Referenced by IsGoodMatch(), PrintMatchingOutput(), and reconfigure().

int lar_pandora::PFParticleValidation::m_matchingMinHitsForGoodView
private

The minimum number of good mc primary hits in given view to declare view to be good.

Definition at line 323 of file PFParticleValidation_module.cc.

Referenced by IsGoodMCPrimary(), PrintMatchingOutput(), and reconfigure().

int lar_pandora::PFParticleValidation::m_matchingMinPrimaryGoodViews
private

The minimum number of good views for a mc primary.

Definition at line 324 of file PFParticleValidation_module.cc.

Referenced by IsGoodMCPrimary(), PrintMatchingOutput(), and reconfigure().

int lar_pandora::PFParticleValidation::m_matchingMinPrimaryHits
private

The minimum number of good mc primary hits used in matching scheme.

Definition at line 321 of file PFParticleValidation_module.cc.

Referenced by IsGoodMCPrimary(), PrintMatchingOutput(), and reconfigure().

float lar_pandora::PFParticleValidation::m_matchingMinPurity
private

The minimum particle purity to declare a match.

Definition at line 330 of file PFParticleValidation_module.cc.

Referenced by IsGoodMatch(), PrintMatchingOutput(), and reconfigure().

int lar_pandora::PFParticleValidation::m_matchingMinSharedHits
private

The minimum number of shared hits used in matching scheme.

Definition at line 328 of file PFParticleValidation_module.cc.

Referenced by IsGoodMatch(), PrintMatchingOutput(), and reconfigure().

bool lar_pandora::PFParticleValidation::m_neutrinoInducedOnly
private

Whether to consider only mc particles that were neutrino induced.

Definition at line 318 of file PFParticleValidation_module.cc.

Referenced by GetSimpleMCPrimaryList(), and reconfigure().

std::string lar_pandora::PFParticleValidation::m_particleLabel
private

The name/label of the particle producer module.

Definition at line 310 of file PFParticleValidation_module.cc.

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

bool lar_pandora::PFParticleValidation::m_printAllToScreen
private

Whether to print all/raw matching details to screen.

Definition at line 314 of file PFParticleValidation_module.cc.

Referenced by analyze(), and reconfigure().

bool lar_pandora::PFParticleValidation::m_printMatchingToScreen
private

Whether to print matching output to screen.

Definition at line 315 of file PFParticleValidation_module.cc.

Referenced by analyze(), and reconfigure().

bool lar_pandora::PFParticleValidation::m_useSmallPrimaries
private

Whether to consider matches to mc primaries with fewer than m_matchingMinPrimaryHits.

Definition at line 327 of file PFParticleValidation_module.cc.

Referenced by GetRemainingPfoMatches(), GetStrongestPfoMatch(), PrintMatchingOutput(), and reconfigure().


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