TG4PrimaryVertex.h
Go to the documentation of this file.
1 #ifndef TG4PrimaryVertex_hxx_seen
2 #define TG4PrimaryVertex_hxx_seen
3 
4 #include <string>
5 #include <vector>
6 
7 #include <TLorentzVector.h>
8 #include <TObject.h>
9 
10 class TG4PrimaryVertex;
11 class TG4PrimaryParticle;
12 
13 namespace EDepSim {class PersistencyManager;}
14 typedef std::vector<TG4PrimaryVertex> TG4PrimaryVertexContainer;
15 
16 /// A class to save a G4 primary vertex into a root output file without linking
17 /// to geant.
18 class TG4PrimaryVertex : public TObject {
20 public:
21  typedef std::vector<TG4PrimaryParticle> PrimaryParticles;
22 
24  : Position(0,0,0,0), GeneratorName("none"),
25  InteractionNumber(0), CrossSection(0.0), DiffCrossSection(0.0),
26  Weight(0.0), Probability(0.0) {}
27  virtual ~TG4PrimaryVertex();
28 
29  /// The initial position of the particle.
30  const TLorentzVector& GetPosition() const {return Position ;}
31 
32  /// The name of the generator that created this vertex.
33  const char* GetGeneratorName() const {return GeneratorName.c_str();}
34 
35  /// The reaction that created this vertex.
36  const char* GetReaction() const {return Reaction.c_str();}
37 
38  /// The name of the input file.
39  const char* GetFilename() const {return Filename.c_str();}
40 
41  /// The index (or identifier) of the interaction in the kinematics file.
42  int GetInteractionNumber() const {return InteractionNumber;}
43 
44  /// The cross section for the reaction that created this vertex.
45  double GetCrossSection() const {return CrossSection;}
46 
47  /// The differential cross section for the kinematics of the reaction that
48  /// created this vertex.
49  double GetDiffCrossSection() const {return DiffCrossSection;}
50 
51  /// The weight of the interaction. This will be set to one if the
52  /// interaction is not reweighted. If the vertex is oversampled, this
53  /// will be less than one.
54  double GetWeight() const {return Weight;}
55 
56  /// The overall probability of the interaction that created this vertex.
57  /// This includes the effect of the cross section, path length through the
58  /// material, etc. This should be one if it is not filled.
59  double GetProbability() const {return Probability;}
60 
61  /// The PrimaryVertex points for this PrimaryVertex.
62  PrimaryParticles Particles;
63 
64  /// The informational vertices associated with this vertex.
66 
67 // The public fields are deprecated but still supported by default in the
68 // current version.
69 #define EDEPSIM_USE_PUBLIC_FIELDS
70 
71 #if defined(EDEPSIM_USE_PUBLIC_FIELDS)&&!defined(EDEPSIM_FORCE_PRIVATE_FIELDS)&&!defined(__CINT__)
72 public:
73 #ifdef EDEPSIM_WARN_PUBLIC_FIELDS
74 #warning Using deprecated public fields. Please consider using the accessor. For example, to access PrimaryId, use GetPrimaryId().
75 #endif
76 #else
77 private:
78 #endif
79 
80  /// The initial position of the particle.
81  TLorentzVector Position;
82 
83  /// The name of the generator that created this vertex.
85 
86  /// The reaction that created this vertex.
88 
89  /// The name of the input file.
91 
92  /// The index (or identifier) of the interaction in the kinematics file.
94 
95  /// The cross section for the reaction that created this vertex.
96  Float_t CrossSection;
97 
98  /// The differential cross section for the kinematics of the reaction that
99  /// created this vertex.
101 
102  /// The weight of the interaction. This will be set to one if the
103  /// interaction is not reweighted. If the vertex is oversampled, this
104  /// will be less than one.
105  Float_t Weight;
106 
107  /// The overall probability of the interaction that created this vertex.
108  /// This includes the effect of the cross section, path length through the
109  /// material, etc. This should be one if it is not filled.
110  Float_t Probability;
111 
113 };
114 
115 /// A class to save a G4 primary particle into a root output file without
116 /// linking to geant.
117 class TG4PrimaryParticle : public TObject {
119 public:
121  : TrackId(-1), PDGCode(0), Momentum(0,0,0,0) {}
122  virtual ~TG4PrimaryParticle();
123 
124  /// The Track Id of the matching trajectory. Particles that are not
125  /// tracked will have negative track id values.
126  int GetTrackId() const {return TrackId;}
127 
128  /// The name of the particle.
129  const char* GetName() const {return Name.c_str();}
130 
131  /// The PDG code of the particle.
132  int GetPDGCode() const {return PDGCode;}
133 
134  /// The initial momentum of the particle
135  const TLorentzVector& GetMomentum() const {return Momentum;}
136 
137 #if defined(EDEPSIM_USE_PUBLIC_FIELDS)&&!defined(EDEPSIM_FORCE_PRIVATE_FIELDS)&&!defined(__CINT__)
138 public:
139 #ifdef EDEPSIM_WARN_PUBLIC_FIELDS
140 #warning Using deprecated public fields. Please consider using the accessor. For example, to access PrimaryId, use GetPrimaryId().
141 #endif
142 #else
143 private:
144 #endif
145 
146  /// The Track Id of the matching trajectory. Particles that are not
147  /// tracked will have negative track id values.
148  Int_t TrackId;
149 
150  /// The name of the particle.
152 
153  /// The PDG code of the particle.
154  Int_t PDGCode;
155 
156  /// The initial momentum of the particle
157  TLorentzVector Momentum;
158 
160 };
161 #endif
int GetPDGCode() const
The PDG code of the particle.
std::string Filename
The name of the input file.
Float_t CrossSection
The cross section for the reaction that created this vertex.
PrimaryParticles Particles
The PrimaryVertex points for this PrimaryVertex.
std::string string
Definition: nybbler.cc:12
ChannelGroupService::Name Name
std::string Name
The name of the particle.
int GetInteractionNumber() const
The index (or identifier) of the interaction in the kinematics file.
TLorentzVector Momentum
The initial momentum of the particle.
const TLorentzVector & GetMomentum() const
The initial momentum of the particle.
const TLorentzVector & GetPosition() const
The initial position of the particle.
const char * GetReaction() const
The reaction that created this vertex.
std::string Reaction
The reaction that created this vertex.
Construct a module from components.
Definition: TG4HitSegment.h:10
double GetDiffCrossSection() const
double GetCrossSection() const
The cross section for the reaction that created this vertex.
double GetProbability() const
const char * GetGeneratorName() const
The name of the generator that created this vertex.
std::vector< TG4PrimaryVertex > TG4PrimaryVertexContainer
TG4PrimaryVertexContainer Informational
The informational vertices associated with this vertex.
std::string GeneratorName
The name of the generator that created this vertex.
Int_t PDGCode
The PDG code of the particle.
TLorentzVector Position
The initial position of the particle.
const char * GetFilename() const
The name of the input file.
std::vector< TG4PrimaryParticle > PrimaryParticles
int GetTrackId() const
Int_t InteractionNumber
The index (or identifier) of the interaction in the kinematics file.
const char * GetName() const
The name of the particle.
double GetWeight() const