LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
recob::PFParticle Class Reference

Hierarchical representation of particle flow. More...

#include "PFParticle.h"

Public Member Functions

 PFParticle ()
 Default constructor necessary for gccxml - not really for public use. More...
 
 PFParticle (int pdgCode, size_t self, size_t parent, const std::vector< size_t > &daughters)
 Primary constructor. More...
 
 PFParticle (int pdgCode, size_t self, size_t parent, std::vector< size_t > &&daughters)
 
 ~PFParticle ()=default
 Destructor definition. More...
 
 PFParticle (const PFParticle &other)=default
 Copy constructor (using defaults) More...
 
 PFParticle (PFParticle &&other)=default
 
PFParticleoperator= (const PFParticle &other)=default
 Copy assignment operator (using defaults) More...
 
PFParticleoperator= (PFParticle &&other)=default
 
Accessors
int PdgCode () const
 Return the type of particle as a PDG ID. More...
 
bool IsPrimary () const
 Returns whether the particle is the root of the flow. More...
 
int NumDaughters () const
 Returns the number of daughter particles flowing from this one. More...
 
size_t Self () const
 Returns the index of this particle. More...
 
size_t Parent () const
 
size_t Daughter (size_t idx) const
 Returns the ID of the specified daughter. More...
 
const std::vector< size_t > & Daughters () const
 Returns the collection of daughter particles. More...
 

Static Public Attributes

static constexpr size_t kPFParticlePrimary = std::numeric_limits<size_t>::max()
 Define index to signify primary particle. More...
 

Private Attributes

int fPdgCode
 A preliminary estimate of the PFParticle type using the PDG code. More...
 
size_t fSelf
 Self reference. More...
 
size_t fParent
 Index into PFParticle collection for parent. More...
 
std::vector< size_t > fDaughters
 Vector of indices into PFParticle Collection for daughters. More...
 

Friends

std::ostream & operator<< (std::ostream &o, const PFParticle &c)
 
bool operator< (const PFParticle &a, const PFParticle &b)
 

Detailed Description

Hierarchical representation of particle flow.

The "Particle Flow" Particle is an object connecting to others of the same type to define a hierarchy of a single parent generating multiple daughter particles.

This structure was originally proposed to accommodate the information produced by Pandora. The PFParticle is a small entity that is expected to be associated with recob::Track, recob::Cluster, recob::Hit, recob::Vertex and also recob::Seed to describe all the reconstructed quantities related to it.

The parentage relationships are expressed by indices in the collection all the particles belong to. This requires additional care when creating that collection, since each relation is defined in the particles with indices pointing to a collection that does not yet exist when the particle is created. The relation is expressed as one parent and many daughters. For "primary" particles, which have no parent, the special parent value recob::PFParticle::kPFParticlePrimary must be used.

Note that the parentage relation can not be expressed as simple art associations, which can't express relations between two objects of the same type.

Definition at line 44 of file PFParticle.h.

Constructor & Destructor Documentation

recob::PFParticle::PFParticle ( )

Default constructor necessary for gccxml - not really for public use.

Definition at line 17 of file PFParticle.cxx.

static constexpr size_t kPFParticlePrimary
Define index to signify primary particle.
Definition: PFParticle.h:57
int fPdgCode
A preliminary estimate of the PFParticle type using the PDG code.
Definition: PFParticle.h:50
size_t fSelf
Self reference.
Definition: PFParticle.h:51
size_t fParent
Index into PFParticle collection for parent.
Definition: PFParticle.h:52
recob::PFParticle::PFParticle ( int  pdgCode,
size_t  self,
size_t  parent,
const std::vector< size_t > &  daughters 
)

Primary constructor.

Definition at line 19 of file PFParticle.cxx.

23  : fPdgCode(pdgCode), fSelf(self), fParent(parent), fDaughters(daughters)
24  {}
std::vector< size_t > fDaughters
Vector of indices into PFParticle Collection for daughters.
Definition: PFParticle.h:53
int fPdgCode
A preliminary estimate of the PFParticle type using the PDG code.
Definition: PFParticle.h:50
size_t fSelf
Self reference.
Definition: PFParticle.h:51
size_t fParent
Index into PFParticle collection for parent.
Definition: PFParticle.h:52
recob::PFParticle::PFParticle ( int  pdgCode,
size_t  self,
size_t  parent,
std::vector< size_t > &&  daughters 
)

Definition at line 26 of file PFParticle.cxx.

27  : fPdgCode(pdgCode), fSelf(self), fParent(parent), fDaughters(std::move(daughters))
28  {}
std::vector< size_t > fDaughters
Vector of indices into PFParticle Collection for daughters.
Definition: PFParticle.h:53
int fPdgCode
A preliminary estimate of the PFParticle type using the PDG code.
Definition: PFParticle.h:50
size_t fSelf
Self reference.
Definition: PFParticle.h:51
size_t fParent
Index into PFParticle collection for parent.
Definition: PFParticle.h:52
recob::PFParticle::~PFParticle ( )
default

Destructor definition.

recob::PFParticle::PFParticle ( const PFParticle other)
default

Copy constructor (using defaults)

recob::PFParticle::PFParticle ( PFParticle &&  other)
default

Member Function Documentation

size_t recob::PFParticle::Daughter ( size_t  idx) const
inline

Returns the ID of the specified daughter.

Parameters
idxindex of the daughter to be queried (0 to NumDaughters()-1)
Returns
the ID of the specified daughter
Exceptions
std::out_of_rangeif the requested daughter does not exist

The returned value describes the ID of the idx-th daughter of this PFParticle. Note that this is not the same as the index of that PFParticle in the data product or PFParticle collection.

This function checks the validity of the index (idx). For unchecked access, use Daughters()[idx] instead.

Definition at line 107 of file PFParticle.h.

References Daughters().

107 { return Daughters().at(idx); }
const std::vector< size_t > & Daughters() const
Returns the collection of daughter particles.
Definition: PFParticle.h:110
const std::vector<size_t>& recob::PFParticle::Daughters ( ) const
inline
int recob::PFParticle::NumDaughters ( ) const
inline

Returns the number of daughter particles flowing from this one.

Definition at line 85 of file PFParticle.h.

Referenced by lar_pandora::PFParticleAnalysis::analyze(), evd::RecoBaseDrawer::DrawPFParticle3D(), evd::RecoBaseDrawer::DrawPFParticleOrtho(), trkf::Geometric3DVertexFitter::fitPFP(), recob::operator<<(), lar_pandora::LArPandoraEventDump::PrintParticle(), and trkf::VertexFitter::produce().

85 { return fDaughters.size(); }
std::vector< size_t > fDaughters
Vector of indices into PFParticle Collection for daughters.
Definition: PFParticle.h:53
PFParticle& recob::PFParticle::operator= ( const PFParticle other)
default

Copy assignment operator (using defaults)

PFParticle& recob::PFParticle::operator= ( PFParticle &&  other)
default
size_t recob::PFParticle::Self ( ) const
inline

Returns the index of this particle.

Definition at line 88 of file PFParticle.h.

References fSelf.

Referenced by lar_pandora::PFParticleAnalysis::analyze(), lar_pandora::LArPandoraHelper::BuildPFParticleHitMaps(), lar_pandora::LArPandoraEventDump::BuildPFParticleMap(), lar_pandora::LArPandoraHelper::BuildPFParticleMap(), shower::LArPandoraShowerCheatingAlg::CheatDebugEVD(), CRHitRemoval::collectPFParticleHits(), shower::LArPandoraShowerAlg::DebugEVD(), evd::RecoBaseDrawer::DrawPFParticle3D(), evd::RecoBaseDrawer::DrawPFParticleOrtho(), lar_pandora::PFParticleHitDumper::FillAssociated2DHits(), lar_pandora::PFParticleHitDumper::FillReco2D(), lar_pandora::PFParticleHitDumper::FillReco3D(), lar_pandora::PFParticleHitDumper::FillRecoTracks(), lar_pandora::PFParticleCosmicAna::FillRecoTree(), lar_pandora::LArPandoraHelper::GetFinalStatePFParticle(), lar_pandora::LArPandoraHelper::GetGeneration(), lar_pandora::PFParticleValidation::GetMCPrimaryMatchingMap(), lar_pandora::LArPandoraHelper::GetParentPFParticle(), lar_pandora::ConsolidatedPFParticleAnalysisTemplate::GetPFParticleIdMap(), recob::operator<(), lar_pandora::ConsolidatedPFParticleAnalysisTemplate::PrintOutScores(), lar_pandora::LArPandoraEventDump::PrintParticle(), trkf::VertexFitter::produce(), trkf::PMAlgTrajFitter::produce(), CRHitRemovalByPCA::removeTaggedHits(), and lar_pandora::LArPandoraHelper::SelectFinalStatePFParticles().

88 { return fSelf; }
size_t fSelf
Self reference.
Definition: PFParticle.h:51

Friends And Related Function Documentation

bool operator< ( const PFParticle a,
const PFParticle b 
)
friend

Definition at line 45 of file PFParticle.cxx.

Referenced by Daughters().

46  {
47  return a.Self() < b.Self();
48  }
std::ostream& operator<< ( std::ostream &  o,
const PFParticle c 
)
friend

Definition at line 33 of file PFParticle.cxx.

Referenced by Daughters().

34  {
35  o << std::setiosflags(std::ios::fixed) << std::setprecision(2);
36  o << "PFParticle hypothesis PDG Code " << std::setw(8) << std::right << c.PdgCode()
37  << ", is primary = " << c.IsPrimary() << ", # Daughters " << std::setw(5) << std::right
38  << c.NumDaughters() << std::endl;
39 
40  return o;
41  }
constexpr auto const & right(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:102

Member Data Documentation

std::vector<size_t> recob::PFParticle::fDaughters
private

Vector of indices into PFParticle Collection for daughters.

Definition at line 53 of file PFParticle.h.

Referenced by Daughters().

size_t recob::PFParticle::fParent
private

Index into PFParticle collection for parent.

Definition at line 52 of file PFParticle.h.

Referenced by Parent().

int recob::PFParticle::fPdgCode
private

A preliminary estimate of the PFParticle type using the PDG code.

Definition at line 50 of file PFParticle.h.

Referenced by PdgCode().

size_t recob::PFParticle::fSelf
private

Self reference.

Definition at line 51 of file PFParticle.h.

Referenced by Self().

constexpr size_t recob::PFParticle::kPFParticlePrimary = std::numeric_limits<size_t>::max()
static

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