LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
PFParticle.h
Go to the documentation of this file.
1 //
3 // \brief Definition of PFParticle object for LArSoft
4 //
5 // \author usher@slac.stanford.edu
6 //
8 
9 #ifndef Recob_PFParticle_H
10 #define Recob_PFParticle_H
11 
12 #include <vector>
13 #include <ostream>
14 #include <limits>
15 
16 namespace recob {
17 
44  class PFParticle {
45 
46  public:
47 
48  PFParticle();
49 
50  private:
51 
52  int fPdgCode;
53  size_t fSelf;
54  size_t fParent;
55  std::vector<size_t> fDaughters;
56 
57 
58  public:
59 
62 
64  PFParticle(int pdgCode, size_t self, size_t parent, const std::vector<size_t>& daughters);
65 
66  PFParticle(int pdgCode, size_t self, size_t parent, std::vector<size_t>&& daughters);
67 
69  ~PFParticle() = default;
70 
72  PFParticle(const PFParticle& other) = default;
73  PFParticle(PFParticle&& other) = default;
74 
76  PFParticle& operator= (const PFParticle& other) = default;
77  PFParticle& operator= (PFParticle&& other) = default;
78 
81 
83  int PdgCode() const {return fPdgCode;}
84 
86  bool IsPrimary() const {return fParent == PFParticle::kPFParticlePrimary;}
87 
89  int NumDaughters() const {return fDaughters.size();}
90 
92  size_t Self() const {return fSelf;}
93 
96  size_t Parent() const {return fParent;}
97 
111  size_t Daughter(size_t idx) const {return Daughters().at(idx);}
112 
114  const std::vector<size_t>& Daughters() const {return fDaughters;}
115 
117 
118  friend std::ostream& operator << (std::ostream& o, const PFParticle& c);
119  friend bool operator < (const PFParticle& a, const PFParticle& b);
120 
121  }; // class PFParticle
122 } // namespace recob
123 
124 #endif //Recob_PFParticle_H
const std::vector< size_t > & Daughters() const
Returns the collection of daughter particles.
Definition: PFParticle.h:114
int NumDaughters() const
Returns the number of daughter particles flowing from this one.
Definition: PFParticle.h:89
Reconstruction base classes.
size_t Self() const
Returns the index of this particle.
Definition: PFParticle.h:92
static constexpr size_t kPFParticlePrimary
Define index to signify primary particle.
Definition: PFParticle.h:61
std::vector< size_t > fDaughters
Vector of indices into PFParticle Collection for daughters.
Definition: PFParticle.h:55
int PdgCode() const
Return the type of particle as a PDG ID.
Definition: PFParticle.h:83
Int_t max
Definition: plot.C:27
int fPdgCode
A preliminary estimate of the PFParticle type using the PDG code.
Definition: PFParticle.h:52
size_t Parent() const
Definition: PFParticle.h:96
bool IsPrimary() const
Returns whether the particle is the root of the flow.
Definition: PFParticle.h:86
friend std::ostream & operator<<(std::ostream &o, const PFParticle &c)
Definition: PFParticle.cxx:37
PFParticle & operator=(const PFParticle &other)=default
Copy assignment operator (using defaults)
Hierarchical representation of particle flow.
Definition: PFParticle.h:44
friend bool operator<(const PFParticle &a, const PFParticle &b)
Definition: PFParticle.cxx:49
~PFParticle()=default
Destructor definition.
size_t fSelf
Self reference.
Definition: PFParticle.h:53
PFParticle()
Default constructor necessary for gccxml - not really for public use.
Definition: PFParticle.cxx:16
size_t fParent
Index into PFParticle collection for parent.
Definition: PFParticle.h:54
size_t Daughter(size_t idx) const
Returns the ID of the specified daughter.
Definition: PFParticle.h:111