LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
PFParticle.cxx
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 
10 
11 #include <utility>
12 #include <iomanip>
13 
14 namespace recob{
15 
17  fPdgCode(0), fSelf(0), fParent(PFParticle::kPFParticlePrimary)
18  {}
19 
20  PFParticle::PFParticle(int pdgCode, size_t self, size_t parent, const std::vector<size_t>& daughters) :
21  fPdgCode(pdgCode),
22  fSelf(self),
23  fParent(parent),
24  fDaughters(daughters)
25  {}
26 
27  PFParticle::PFParticle(int pdgCode, size_t self, size_t parent, std::vector<size_t>&& daughters) :
28  fPdgCode(pdgCode),
29  fSelf(self),
30  fParent(parent),
31  fDaughters(std::move(daughters))
32  {}
33 
34  //----------------------------------------------------------------------
35  // ostream operator.
36  //
37  std::ostream& operator<< (std::ostream& o, const PFParticle& c)
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  }
46 
47  //----------------------------------------------------------------------
48  // less than operator - basically sort in order of index into main collection
49  bool operator< (const PFParticle& a, const PFParticle& b)
50  {
51  return a.Self() < b.Self();
52  }
53 
54 
55 }// namespace
56 
constexpr auto const & right(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:112
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
STL namespace.
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 fPdgCode
A preliminary estimate of the PFParticle type using the PDG code.
Definition: PFParticle.h:52
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
Hierarchical representation of particle flow.
Definition: PFParticle.h:44
friend bool operator<(const PFParticle &a, const PFParticle &b)
Definition: PFParticle.cxx:49
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