LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
GenParticle.hh
Go to the documentation of this file.
1 #ifndef artg4tk_DataProducts_EventGenerators_GenParticle_hh
2 #define artg4tk_DataProducts_EventGenerators_GenParticle_hh
3 
4 //
5 // A minimal class to hold information about generated particles.
6 //
7 
9 
12 
13 #include "CLHEP/Vector/LorentzVector.h"
14 #include "CLHEP/Vector/ThreeVector.h"
15 
16 #include <iosfwd>
17 
18 namespace artg4tk {
19 
20  class GenParticle {
21 
22  public:
23  enum status_type { undefined = -1, alive = 0, decayed = 1 };
24 
26 
27  GenParticle();
30  CLHEP::Hep3Vector const& position,
31  CLHEP::HepLorentzVector const& momentum,
33 
35  pdgId() const
36  {
37  return _pdgId;
38  }
40  parent() const
41  {
42  return _parent;
43  }
44  children_type const&
45  children() const
46  {
47  return _children;
48  }
50  child(size_t i) const
51  {
52  return _children.at(i);
53  }
54  CLHEP::Hep3Vector const&
55  position() const
56  {
57  return _position;
58  }
59  CLHEP::HepLorentzVector const&
60  momentum() const
61  {
62  return _momentum;
63  }
65  status() const
66  {
67  return _status;
68  }
69 
71 
72  // There is source in art::PtrVector that should be protected and gccxml trying to instantiate
73  // it. Until that is fixed, we need to provide a an operator< so or else the dictionary
74  // generation fails ... So we provide a bogus version here. This is never actually used but,if
75  // gccxml cannot find the method, it quits.
76  bool
77  operator<(GenParticle const&) const
78  {
79  return true;
80  }
81 
82  private:
83  // PDG particle ID code.
85 
86  // Ancestry navigation.
88  children_type _children;
89 
90  // Position, momentum at creation.
91  CLHEP::Hep3Vector _position;
92  CLHEP::HepLorentzVector _momentum;
93 
95  };
96 
97  std::ostream& operator<<(std::ostream& ost, const GenParticle& genp);
98 
99 }
100 
101 #endif /* artg4tk_DataProducts_EventGenerators_GenParticle_hh */
bool operator<(GenParticle const &) const
Definition: GenParticle.hh:77
CLHEP::Hep3Vector const & position() const
Definition: GenParticle.hh:55
std::ostream & operator<<(std::ostream &ost, const GenParticle &genp)
Definition: GenParticle.cc:32
art::Ptr< GenParticle > const & parent() const
Definition: GenParticle.hh:40
art::Ptr< GenParticle > const & child(size_t i) const
Definition: GenParticle.hh:50
PDGCode::type _pdgId
Definition: GenParticle.hh:84
art::PtrVector< GenParticle > children_type
Definition: GenParticle.hh:25
status_type _status
Definition: GenParticle.hh:94
PDGCode::type pdgId() const
Definition: GenParticle.hh:35
reference at(size_type n)
Definition: PtrVector.h:359
CLHEP::HepLorentzVector const & momentum() const
Definition: GenParticle.hh:60
children_type const & children() const
Definition: GenParticle.hh:45
CLHEP::HepLorentzVector _momentum
Definition: GenParticle.hh:92
art::Ptr< GenParticle > _parent
Definition: GenParticle.hh:87
status_type status() const
Definition: GenParticle.hh:65
Definition: fwd.h:26
children_type _children
Definition: GenParticle.hh:88
CLHEP::Hep3Vector _position
Definition: GenParticle.hh:91
void addChild(art::Ptr< GenParticle > const &child)
Definition: GenParticle.cc:26