LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
ArtG4tkVtx.hh
Go to the documentation of this file.
1 #ifndef artg4tk_DataProducts_G4DetectorHits_ArtG4tkVtx_hh
2 #define artg4tk_DataProducts_G4DetectorHits_ArtG4tkVtx_hh
3 
5 
6 #include <string>
7 #include <vector>
8 
9 namespace artg4tk {
10 
11  class ArtG4tkVtx {
12 
13  public:
14  // NOTE(JVY): it might also be useful to add status:
15  // none, decay, interaction (em, had, elastic, inelastic,...)
16 
18  ArtG4tkVtx(const CLHEP::HepLorentzVector& pos,
19  const std::string& pvname,
20  const std::string& mname)
21  : fPosition(pos), fPhysVolumeName(pvname), fMaterialName(mname), fIncoming(), fOutcoming()
22  {}
23  ArtG4tkVtx(const ArtG4tkVtx& rhs)
24  : fPosition(rhs.fPosition)
27  , fIncoming(rhs.fIncoming)
28  , fOutcoming(rhs.fOutcoming)
29  {}
31 
32  void
34  {
35  fPosition = CLHEP::HepLorentzVector(0., 0., 0., 0);
36  fPhysVolumeName = "";
37  fMaterialName = "";
39  fOutcoming.clear();
40  return;
41  }
42 
43  void
44  SetPosition(const CLHEP::HepLorentzVector& pos)
45  {
46  fPosition = pos;
47  return;
48  }
49  void
50  SetPhysVolumeName(const std::string& pvname)
51  {
52  fPhysVolumeName = pvname;
53  return;
54  }
55  void
56  SetMaterialName(const std::string& mname)
57  {
58  fMaterialName = mname;
59  return;
60  }
61 
62  void
64  {
65  fIncoming = pin;
66  return;
67  }
68  void
69  SetIncoming(const int pdg, const CLHEP::Hep3Vector& mom)
70  {
71  fIncoming.SetPDG(pdg);
73  return;
74  }
75  void
76  SetIncoming(const int pdg, const CLHEP::HepLorentzVector& mom)
77  {
78  fIncoming.SetPDG(pdg);
80  return;
81  }
82  void
84  {
85  fOutcoming.push_back(pout);
86  return;
87  }
88 
89  const CLHEP::HepLorentzVector&
90  GetPosition() const
91  {
92  return fPosition;
93  }
94  const std::string&
96  {
97  return fPhysVolumeName;
98  }
99  const std::string&
101  {
102  return fMaterialName;
103  }
104  const ArtG4tkParticle&
105  GetIncoming() const
106  {
107  return fIncoming;
108  }
109  int
111  {
112  return fOutcoming.size();
113  }
114  const std::vector<ArtG4tkParticle>&
116  {
117  return fOutcoming;
118  }
119  const ArtG4tkParticle&
120  GetOutcoming(int i) const
121  {
122  return fOutcoming[i];
123  }
124 
125  // Patch up dictionary generation.
126  // NOTE(from GenParticle, by HW):
127  // There is source in art::PtrVector that should be protected and gccxml trying to instantiate
128  // it. Until that is fixed, we need to provide a an operator< or else the dictionary generation
129  // fails. So we provide a bogus version here. This is never actually used but,if gccxml cannot
130  // find the method, it quits.
131  //
132  bool
133  operator<(const ArtG4tkVtx&) const
134  {
135  return true;
136  }
137 
138  private:
139  // data members
140  //
141  CLHEP::HepLorentzVector fPosition;
142  std::string fPhysVolumeName;
143  std::string fMaterialName;
145  std::vector<ArtG4tkParticle> fOutcoming;
146  };
147 
148 }
149 
150 #endif /* artg4tk_DataProducts_G4DetectorHits_ArtG4tkVtx_hh */
void SetIncoming(const ArtG4tkParticle &pin)
Definition: ArtG4tkVtx.hh:63
const ArtG4tkParticle & GetOutcoming(int i) const
Definition: ArtG4tkVtx.hh:120
void SetIncoming(const int pdg, const CLHEP::HepLorentzVector &mom)
Definition: ArtG4tkVtx.hh:76
void AddOutcoming(const ArtG4tkParticle &pout)
Definition: ArtG4tkVtx.hh:83
std::vector< ArtG4tkParticle > fOutcoming
Definition: ArtG4tkVtx.hh:145
const std::string & GetMaterialName() const
Definition: ArtG4tkVtx.hh:100
const std::vector< ArtG4tkParticle > & GetAllOutcoming() const
Definition: ArtG4tkVtx.hh:115
ArtG4tkParticle fIncoming
Definition: ArtG4tkVtx.hh:144
void SetIncoming(const int pdg, const CLHEP::Hep3Vector &mom)
Definition: ArtG4tkVtx.hh:69
int GetNumOutcoming() const
Definition: ArtG4tkVtx.hh:110
bool operator<(const ArtG4tkVtx &) const
Definition: ArtG4tkVtx.hh:133
void SetPhysVolumeName(const std::string &pvname)
Definition: ArtG4tkVtx.hh:50
void SetMaterialName(const std::string &mname)
Definition: ArtG4tkVtx.hh:56
ArtG4tkVtx(const CLHEP::HepLorentzVector &pos, const std::string &pvname, const std::string &mname)
Definition: ArtG4tkVtx.hh:18
const ArtG4tkParticle & GetIncoming() const
Definition: ArtG4tkVtx.hh:105
CLHEP::HepLorentzVector fPosition
Definition: ArtG4tkVtx.hh:141
std::string fMaterialName
Definition: ArtG4tkVtx.hh:143
void SetPosition(const CLHEP::HepLorentzVector &pos)
Definition: ArtG4tkVtx.hh:44
std::string fPhysVolumeName
Definition: ArtG4tkVtx.hh:142
const std::string & GetPhysVolumeName() const
Definition: ArtG4tkVtx.hh:95
void SetMomentum(const CLHEP::HepLorentzVector &)
const CLHEP::HepLorentzVector & GetPosition() const
Definition: ArtG4tkVtx.hh:90
ArtG4tkVtx(const ArtG4tkVtx &rhs)
Definition: ArtG4tkVtx.hh:23