PFParticle.cxx
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////
2 //
3 // \brief Definition of PFParticle object for LArSoft
4 //
5 // \author usher@slac.stanford.edu
6 //
7 ////////////////////////////////////////////////////////////////////////////
8 
10 
11 #include <utility>
12 #include <iomanip>
13 #include <ostream>
14 
15 namespace recob{
16 
18  fPdgCode(0), fSelf(0), fParent(PFParticle::kPFParticlePrimary)
19  {}
20 
21  PFParticle::PFParticle(int pdgCode, size_t self, size_t parent, const std::vector<size_t>& daughters) :
22  fPdgCode(pdgCode),
23  fSelf(self),
24  fParent(parent),
25  fDaughters(daughters)
26  {}
27 
28  PFParticle::PFParticle(int pdgCode, size_t self, size_t parent, std::vector<size_t>&& daughters) :
29  fPdgCode(pdgCode),
30  fSelf(self),
31  fParent(parent),
32  fDaughters(std::move(daughters))
33  {}
34 
35  //----------------------------------------------------------------------
36  // ostream operator.
37  //
38  std::ostream& operator<< (std::ostream& o, const PFParticle& c)
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  }
47 
48  //----------------------------------------------------------------------
49  // less than operator - basically sort in order of index into main collection
50  bool operator< (const PFParticle& a, const PFParticle& b)
51  {
52  return a.Self() < b.Self();
53  }
54 
55 
56 }// namespace
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
Q_EXPORT QTSManip setprecision(int p)
Definition: qtextstream.h:343
int fPdgCode
A preliminary estimate of the PFParticle type using the PDG code.
Definition: PFParticle.h:52
const double a
def move(depos, offset)
Definition: depos.py:107
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:38
Q_EXPORT QTSManip setw(int w)
Definition: qtextstream.h:331
Hierarchical representation of particle flow.
Definition: PFParticle.h:44
friend bool operator<(const PFParticle &a, const PFParticle &b)
Definition: PFParticle.cxx:50
static bool * b
Definition: config.cpp:1043
size_t fSelf
Self reference.
Definition: PFParticle.h:53
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:54
def parent(G, child, parent_type)
Definition: graph.py:67
QTextStream & endl(QTextStream &s)