LArSoft  v06_68_00
Liquid Argon Software toolkit - http://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
 Returns the ID of the specified daughter. More...
 
bool IsPrimary () const
 Returns the ID of the specified daughter. More...
 
int NumDaughters () const
 Returns the ID of the specified daughter. More...
 
size_t Self () const
 Returns the ID of the specified daughter. More...
 
size_t Parent () const
 Returns the ID of the specified daughter. More...
 
size_t Daughter (size_t idx) const
 Returns the ID of the specified daughter. More...
 
const std::vector< size_t > & Daughters () const
 Returns the ID of the specified daughter. 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 16 of file PFParticle.cxx.

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

Primary constructor.

Definition at line 20 of file PFParticle.cxx.

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

Definition at line 27 of file PFParticle.cxx.

27  :
28  fPdgCode(pdgCode),
29  fSelf(self),
30  fParent(parent),
31  fDaughters(std::move(daughters))
32  {}
std::vector< size_t > fDaughters
Vector of indices into PFParticle Collection for daughters.
Definition: PFParticle.h:55
int fPdgCode
A preliminary estimate of the PFParticle type using the PDG code.
Definition: PFParticle.h:52
size_t fSelf
Self reference.
Definition: PFParticle.h:53
size_t fParent
Index into PFParticle collection for parent.
Definition: PFParticle.h:54
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 99 of file PFParticle.h.

References Daughters().

99 {return Daughters().at(idx);}
const std::vector< size_t > & Daughters() const
Returns the ID of the specified daughter.
Definition: PFParticle.h:100
const std::vector<size_t>& recob::PFParticle::Daughters ( ) 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 100 of file PFParticle.h.

References fDaughters, operator<, and operator<<.

Referenced by lar_pandora::LArPandoraSlices::CollectDaughters(), CRHitRemoval::collectPFParticleHits(), Daughter(), evd::RecoBaseDrawer::DrawPFParticle3D(), evd::RecoBaseDrawer::DrawPFParticleOrtho(), trkf::Geometric3DVertexFitter::fitPFP(), lar_pandora::LArPandoraEventDump::PrintParticle(), trkf::VertexFitter::produce(), and CRHitRemovalByPCA::removeTaggedHits().

100 {return fDaughters;}
std::vector< size_t > fDaughters
Vector of indices into PFParticle Collection for daughters.
Definition: PFParticle.h:55
bool recob::PFParticle::IsPrimary ( ) 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 82 of file PFParticle.h.

References kPFParticlePrimary.

Referenced by lar_pandora::LArPandoraEventDump::analyze(), lar_pandora::PFParticleAnalysis::analyze(), lar_pandora::PFParticleHitDumper::FillReco3D(), lar_pandora::PFParticleCosmicAna::FillRecoTree(), trkf::Geometric3DVertexFitter::fitPFP(), lar_pandora::LArPandoraHelper::GetFinalStatePFParticle(), lar_pandora::LArPandoraHelper::GetGeneration(), lar_pandora::LArPandoraHelper::GetParentNeutrino(), lar_pandora::LArPandoraHelper::GetParentPFParticle(), lar_pandora::LArPandoraHelper::IsFinalState(), recob::operator<<(), lar_pandora::LArPandoraEventDump::PrintParticle(), CRHitRemoval::produce(), CRHitRemovalByPCA::produce(), and trkf::VertexFitter::produce().

static constexpr size_t kPFParticlePrimary
Define index to signify primary particle.
Definition: PFParticle.h:61
size_t fParent
Index into PFParticle collection for parent.
Definition: PFParticle.h:54
int recob::PFParticle::NumDaughters ( ) 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 83 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().

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

Copy assignment operator (using defaults)

PFParticle& recob::PFParticle::operator= ( PFParticle &&  other)
default
size_t recob::PFParticle::Parent ( ) 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 85 of file PFParticle.h.

References fParent.

Referenced by lar_pandora::PFParticleAnalysis::analyze(), lar_pandora::PFParticleHitDumper::FillReco3D(), lar_pandora::LArPandoraHelper::GetFinalStatePFParticle(), lar_pandora::LArPandoraHelper::GetGeneration(), lar_pandora::PFParticleValidation::GetMCPrimaryMatchingMap(), lar_pandora::LArPandoraHelper::GetParentNeutrino(), lar_pandora::LArPandoraHelper::GetParentPFParticle(), lar_pandora::LArPandoraHelper::IsFinalState(), lar_pandora::LArPandoraEventDump::PrintParticle(), and CRHitRemoval::produce().

85 {return fParent;}
size_t fParent
Index into PFParticle collection for parent.
Definition: PFParticle.h:54
int recob::PFParticle::PdgCode ( ) 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 81 of file PFParticle.h.

References fPdgCode.

Referenced by lar_pandora::PFParticleAnalysis::analyze(), lar_pandora::PFParticleMonitoring::analyze(), pfpf::PFPAna::analyze(), lar_pandora::PFParticleHitDumper::FillReco2D(), lar_pandora::PFParticleHitDumper::FillReco3D(), lar_pandora::PFParticleCosmicAna::FillRecoTree(), trkf::Geometric3DVertexFitter::fitPFP(), lar_pandora::PFParticleValidation::GetMCPrimaryMatchingMap(), lar_pandora::LArPandoraHelper::GetParentNeutrino(), lar_pandora::LArPandoraHelper::IsNeutrino(), lar_pandora::LArPandoraHelper::IsShower(), lar_pandora::LArPandoraHelper::IsTrack(), recob::operator<<(), lar_pandora::LArPandoraEventDump::PrintParticle(), ShowerReco3D::produce(), and shower::EMShower::produce().

81 {return fPdgCode;}
int fPdgCode
A preliminary estimate of the PFParticle type using the PDG code.
Definition: PFParticle.h:52
size_t recob::PFParticle::Self ( ) 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 84 of file PFParticle.h.

References fSelf.

Referenced by lar_pandora::LArPandoraEventDump::analyze(), lar_pandora::PFParticleAnalysis::analyze(), lar_pandora::PFParticleAnalysis::BuildParticleMap(), lar_pandora::LArPandoraHelper::BuildPFParticleHitMaps(), lar_pandora::PFParticleMonitoring::BuildRecoParticleMap(), CRHitRemoval::collectPFParticleHits(), evd::RecoBaseDrawer::DrawPFParticle3D(), evd::RecoBaseDrawer::DrawPFParticleOrtho(), 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(), recob::operator<(), lar_pandora::LArPandoraEventDump::PrintParticle(), trkf::PMAlgTrajFitter::produce(), CRHitRemovalByPCA::removeTaggedHits(), and lar_pandora::LArPandoraHelper::SelectFinalStatePFParticles().

84 {return fSelf;}
size_t fSelf
Self reference.
Definition: PFParticle.h:53

Friends And Related Function Documentation

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

Definition at line 49 of file PFParticle.cxx.

Referenced by Daughters().

50  {
51  return a.Self() < b.Self();
52  }
std::ostream& operator<< ( std::ostream &  o,
const PFParticle c 
)
friend

Definition at line 37 of file PFParticle.cxx.

Referenced by Daughters().

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

Member Data Documentation

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

Vector of indices into PFParticle Collection for daughters.

Definition at line 55 of file PFParticle.h.

Referenced by Daughters().

size_t recob::PFParticle::fParent
private

Index into PFParticle collection for parent.

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

Referenced by PdgCode().

size_t recob::PFParticle::fSelf
private

Self reference.

Definition at line 53 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: