NAIA  1.0.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
MCTruth.h
Go to the documentation of this file.
1 
8 #ifndef NAIA_MCTRUTH_H
9 #define NAIA_MCTRUTH_H
10 
11 // gbatch headers
12 #ifdef ENABLE_PRODUCTION_CODE
13 #include "root.h"
14 #endif
15 
17 #include "Containers/Utils.h"
18 
19 #include "TVector3.h"
20 
21 #include <array>
22 #include <map>
23 #include <vector>
24 
25 namespace NAIA {
26 
31 struct MCParticle {
32  int PDGCode = 0;
33  int Z = 0;
34  int A = 0;
35  // clang-format off
36  std::vector<TVector3> Momentum;
37  std::vector<TVector3> Position;
38  // clang-format on
39  int partID = -1;
40  int parentID = -1;
41  int Proc1 = -1;
42  int Proc2 = -1;
43 
49  double GetGenMomentum() const {
50  if (!Momentum.empty()) {
52  } else {
53  throw std::runtime_error("No generation momentum available");
54  }
55  }
56 
57  TVector3 GetGenPosition() const {
58  if (!Position.empty()) {
60  } else {
61  throw std::runtime_error("No generation position available");
62  }
63  }
64 };
65 
73 class MCTruthBaseData : public TObject {
74 public:
75 #ifdef ENABLE_PRODUCTION_CODE
76  bool Fill(AMSEventR *evPtr);
77 #endif
78 
83  void Clear();
84 
89  void Dump() const;
90 
92 
93 private:
94  ClassDef(MCTruthBaseData, 2)
95 };
96 
105 class MCTruthPlusData : public TObject {
106 public:
110  struct TrMCHit {
111  unsigned int pID = 0;
112  std::array<float, 3> Coo;
113  std::array<float, 3> Mom;
114  };
115 
116 #ifdef ENABLE_PRODUCTION_CODE
117  bool Fill(AMSEventR *evPtr);
118  bool FillTrMCHit(TrTrackR *pTrTrack);
119 #endif
120 
125  void Clear();
126 
131  void Dump() const;
132 
133  // clang-format off
134  std::vector<MCParticle> Secondaries;
136  // clang-format on
137 
138 private:
139  ClassDef(MCTruthPlusData, 1)
140 };
141 
150 class MCTruthBase : public OnDemandContainer<MCTruthBase>, public MCTruthBaseData {
151 public:
152  static const std::string BranchName;
153 
155 };
156 
165 class MCTruthPlus : public OnDemandContainer<MCTruthPlus>, public MCTruthPlusData {
166 public:
167  static const std::string BranchName;
168 
170 };
171 
172 } // namespace NAIA
173 #endif
int Z
particle charge
Definition: MCTruth.h:33
std::vector< TVector3 > Position
particle position at different z-heights. See MCTruth::MCHeights for a description of the possible he...
Definition: MCTruth.h:37
std::vector< TVector3 > Momentum
particle momentum at different z-heights. See MCTruth::MCHeights for a description of the possible he...
Definition: MCTruth.h:36
OnDemandContainer container class description.
int Proc2
secondary creation subprocess (G4VProcess::ProcessSubType)
Definition: MCTruth.h:42
Accessor class for MCTruthPlus info.
Definition: MCTruth.h:165
Container class for base MCTruth info.
Definition: MCTruth.h:73
void Dump() const
Dump on screen container content.
Definition: MCTruth.cpp:12
int A
particle mass number
Definition: MCTruth.h:34
static const std::string BranchName
Definition: MCTruth.h:167
std::map< unsigned int, T > LayerVariable
Definition: Utils.h:54
Mixin class to add &quot;read-on-demand&quot; behavior to an existing container class.
void Clear()
Clear container content.
Definition: MCTruth.cpp:38
std::array< float, 3 > Coo
hit position
Definition: MCTruth.h:112
TVector3 GetGenPosition() const
Definition: MCTruth.h:57
Simple struct for MC tracker hits.
Definition: MCTruth.h:110
MCParticle Primary
primary particle
Definition: MCTruth.h:91
int Proc1
secondary creation process (G4VProcess::ProcessType)
Definition: MCTruth.h:41
double GetGenMomentum() const
Get the particle generation momentum.
Definition: MCTruth.h:49
int partID
Particle track ID according to Geant4.
Definition: MCTruth.h:39
Accessor class for MCTruthBase info.
Definition: MCTruth.h:150
void Clear()
Clear container content.
Definition: MCTruth.cpp:10
void Dump() const
Dump on screen container content.
Definition: MCTruth.cpp:24
int parentID
Parent particle track ID according to Geant4.
Definition: MCTruth.h:40
std::vector< MCParticle > Secondaries
list of particles created by interaction of the primary particle
Definition: MCTruth.h:134
Simple struct to describe a MC particle.
Definition: MCTruth.h:31
std::array< float, 3 > Mom
hit momentum
Definition: MCTruth.h:113
LayerVariable< TrMCHit > TrackMCHits
A collection of the closest MCHit to the TrTrack cluster on each layer.
Definition: MCTruth.h:135
static const std::string BranchName
Definition: MCTruth.h:152
int PDGCode
particle PDG code
Definition: MCTruth.h:32
unsigned int pID
particle PID
Definition: MCTruth.h:111
Container class for additional MCTruth info.
Definition: MCTruth.h:105