LArSoft  v09_90_00
Liquid Argon Software toolkit - https://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 <iosfwd>
13 #include <limits>
14 #include <vector>
15 
16 namespace recob {
17 
44  class PFParticle {
45 
46  public:
47  PFParticle();
48 
49  private:
50  int fPdgCode;
51  size_t fSelf;
52  size_t fParent;
53  std::vector<size_t> fDaughters;
54 
55  public:
57  static constexpr size_t kPFParticlePrimary = std::numeric_limits<size_t>::max();
58 
60  PFParticle(int pdgCode, size_t self, size_t parent, const std::vector<size_t>& daughters);
61 
62  PFParticle(int pdgCode, size_t self, size_t parent, std::vector<size_t>&& daughters);
63 
65  ~PFParticle() = default;
66 
68  PFParticle(const PFParticle& other) = default;
69  PFParticle(PFParticle&& other) = default;
70 
72  PFParticle& operator=(const PFParticle& other) = default;
73  PFParticle& operator=(PFParticle&& other) = default;
74 
77 
79  int PdgCode() const { return fPdgCode; }
80 
82  bool IsPrimary() const { return fParent == PFParticle::kPFParticlePrimary; }
83 
85  int NumDaughters() const { return fDaughters.size(); }
86 
88  size_t Self() const { return fSelf; }
89 
92  size_t Parent() const { return fParent; }
93 
107  size_t Daughter(size_t idx) const { return Daughters().at(idx); }
108 
110  const std::vector<size_t>& Daughters() const { return fDaughters; }
111 
113 
114  friend std::ostream& operator<<(std::ostream& o, const PFParticle& c);
115  friend bool operator<(const PFParticle& a, const PFParticle& b);
116 
117  }; // class PFParticle
118 } // namespace recob
119 
120 #endif //Recob_PFParticle_H
const std::vector< size_t > & Daughters() const
Returns the collection of daughter particles.
Definition: PFParticle.h:110
int NumDaughters() const
Returns the number of daughter particles flowing from this one.
Definition: PFParticle.h:85
Reconstruction base classes.
size_t Self() const
Returns the index of this particle.
Definition: PFParticle.h:88
static constexpr size_t kPFParticlePrimary
Define index to signify primary particle.
Definition: PFParticle.h:57
std::vector< size_t > fDaughters
Vector of indices into PFParticle Collection for daughters.
Definition: PFParticle.h:53
int PdgCode() const
Return the type of particle as a PDG ID.
Definition: PFParticle.h:79
int fPdgCode
A preliminary estimate of the PFParticle type using the PDG code.
Definition: PFParticle.h:50
size_t Parent() const
Definition: PFParticle.h:92
bool IsPrimary() const
Returns whether the particle is the root of the flow.
Definition: PFParticle.h:82
friend std::ostream & operator<<(std::ostream &o, const PFParticle &c)
Definition: PFParticle.cxx:33
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:45
~PFParticle()=default
Destructor definition.
size_t fSelf
Self reference.
Definition: PFParticle.h:51
PFParticle()
Default constructor necessary for gccxml - not really for public use.
Definition: PFParticle.cxx:17
size_t fParent
Index into PFParticle collection for parent.
Definition: PFParticle.h:52
size_t Daughter(size_t idx) const
Returns the ID of the specified daughter.
Definition: PFParticle.h:107