NAIA
 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  TVector3 Coo;
36  // clang-format off
37  std::vector<TVector3> Momentum;
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.size() > 0) {
51  return Momentum[0].Mag();
52  } else {
53  throw std::runtime_error("No generation momentum available");
54  }
55  }
56 };
57 
65 class MCTruthBaseData : public TObject {
66 public:
67 #ifdef ENABLE_PRODUCTION_CODE
68  void Fill(AMSEventR *evPtr);
69 #endif
70 
75  void Clear();
76 
81  void Dump() const;
82 
84 
85 private:
86  ClassDef(MCTruthBaseData, 1)
87 };
88 
97 class MCTruthPlusData : public TObject {
98 public:
102  struct TrMCHit {
103  unsigned int pID = 0;
104  std::array<float, 3> Coo;
105  std::array<float, 3> Mom;
106  };
107 
108 #ifdef ENABLE_PRODUCTION_CODE
109  void Fill(AMSEventR *evPtr);
110  void FillTrMCHit(TrTrackR *pTrTrack);
111 #endif
112 
117  void Clear();
118 
123  void Dump() const;
124 
125  std::vector<MCParticle> Secondaries;
127 
128 private:
129  ClassDef(MCTruthPlusData, 1)
130 };
131 
140 class MCTruthBase : public OnDemandContainer<MCTruthBase>, public MCTruthBaseData {
141 public:
142  static const std::string BranchName;
143 
145 };
146 
155 class MCTruthPlus : public OnDemandContainer<MCTruthPlus>, public MCTruthPlusData {
156 public:
157  static const std::string BranchName;
158 
160 };
161 
162 } // namespace NAIA
163 #endif
int Z
particle charge
Definition: MCTruth.h:33
std::vector< TVector3 > Momentum
particle momentum at different z-heights. See MCTruth::MCHeights for a description of the possible he...
Definition: MCTruth.h:37
OnDemandContainer container class description.
int Proc2
secondary creation subprocess (G4VProcess::ProcessSubType)
Definition: MCTruth.h:42
Accessor class for MCTruthPlus info.
Definition: MCTruth.h:155
Container class for base MCTruth info.
Definition: MCTruth.h:65
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:157
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:36
std::array< float, 3 > Coo
hit position
Definition: MCTruth.h:104
Simple struct for MC tracker hits.
Definition: MCTruth.h:102
MCParticle Primary
primary particle
Definition: MCTruth.h:83
TVector3 Coo
generation position
Definition: MCTruth.h:35
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:140
void Clear()
Clear container content.
Definition: MCTruth.cpp:10
void Dump() const
Dump on screen container content.
Definition: MCTruth.cpp:23
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:125
Simple struct to describe a MC particle.
Definition: MCTruth.h:31
std::array< float, 3 > Mom
hit momentum
Definition: MCTruth.h:105
LayerVariable< TrMCHit > TrackMCHits
MC hits of the primary particle on tracker layers.
Definition: MCTruth.h:126
static const std::string BranchName
Definition: MCTruth.h:142
int PDGCode
particle PDG code
Definition: MCTruth.h:32
unsigned int pID
particle PID
Definition: MCTruth.h:103
Container class for additional MCTruth info.
Definition: MCTruth.h:97