Public Member Functions | Static Public Attributes | Private Attributes | Friends | List of all members
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.

17  :
19  {}
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 21 of file PFParticle.cxx.

21  :
22  fPdgCode(pdgCode),
23  fSelf(self),
24  fParent(parent),
25  fDaughters(daughters)
26  {}
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
def parent(G, child, parent_type)
Definition: graph.py:67
recob::PFParticle::PFParticle ( int  pdgCode,
size_t  self,
size_t  parent,
std::vector< size_t > &&  daughters 
)

Definition at line 28 of file PFParticle.cxx.

28  :
29  fPdgCode(pdgCode),
30  fSelf(self),
31  fParent(parent),
32  fDaughters(std::move(daughters))
33  {}
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
def move(depos, offset)
Definition: depos.py:107
size_t fSelf
Self reference.
Definition: PFParticle.h:53
size_t fParent
Index into PFParticle collection for parent.
Definition: PFParticle.h:54
def parent(G, child, parent_type)
Definition: graph.py:67
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 111 of file PFParticle.h.

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

Returns the collection of daughter particles.

Definition at line 114 of file PFParticle.h.

114 {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 whether the particle is the root of the flow.

Definition at line 86 of file PFParticle.h.

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 number of daughter particles flowing from this one.

Definition at line 89 of file PFParticle.h.

89 {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 index of the parent particle (PFParticle::kPFParticlePrimary if primary).

Definition at line 96 of file PFParticle.h.

96 {return fParent;}
size_t fParent
Index into PFParticle collection for parent.
Definition: PFParticle.h:54
int recob::PFParticle::PdgCode ( void  ) const
inline

Return the type of particle as a PDG ID.

Definition at line 83 of file PFParticle.h.

83 {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 index of this particle.

Definition at line 92 of file PFParticle.h.

92 {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 50 of file PFParticle.cxx.

51  {
52  return a.Self() < b.Self();
53  }
const double a
static bool * b
Definition: config.cpp:1043
std::ostream& operator<< ( std::ostream &  o,
const PFParticle c 
)
friend

Definition at line 38 of file PFParticle.cxx.

39  {
40  o << std::setiosflags(std::ios::fixed) << std::setprecision(2);
41  o << "PFParticle hypothesis PDG Code " << std::setw(8) << std::right << c.PdgCode()
42  << ", is primary = " << c.IsPrimary()
43  << ", # Daughters " << std::setw(5) << std::right << c.NumDaughters() << std::endl;
44 
45  return o;
46  }
Q_EXPORT QTSManip setprecision(int p)
Definition: qtextstream.h:343
Q_EXPORT QTSManip setw(int w)
Definition: qtextstream.h:331
QTextStream & endl(QTextStream &s)

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.

size_t recob::PFParticle::fParent
private

Index into PFParticle collection for parent.

Definition at line 54 of file PFParticle.h.

int recob::PFParticle::fPdgCode
private

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

Definition at line 52 of file PFParticle.h.

size_t recob::PFParticle::fSelf
private

Self reference.

Definition at line 53 of file PFParticle.h.

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

Define index to signify primary particle.

Definition at line 61 of file PFParticle.h.


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