EDepSimRooTrackerKinematicsGenerator.hh
Go to the documentation of this file.
1 #ifndef EDepSim_RooTrackerKinematicsGenerator_hh
2 #define EDepSim_RooTrackerKinematicsGenerator_hh
3 ////////////////////////////////////////////////////////////
4 //
5 
6 #include <vector>
7 
9 
10 class TFile;
11 class TTree;
12 class TBits;
13 class TObjString;
14 class G4Event;
15 
16 /// This is an interface to read rooTracker formatted kinematic info.
17 namespace EDepSim {class RooTrackerKinematicsGenerator;}
19 public:
20  /// Construct a new generator. The name is the name of the generator
21  /// (e.g. NEUT, GENIE, &c). The fileName is the name of the root file
22  /// containing the tree of kinematic information. The treeName is the
23  /// path of the rooTracker tree in the input file. The order is a string
24  /// specifying the order that events in the input files should be used.
25  /// The current legal values are "consecutive", "stride", or
26  /// "random". The firstEvent is the first event to use in the file.
27  ///
28  /// While NEUT and GENIE produce files with single interactions in each
29  /// event, the individual events can be built into spill using another
30  /// program (a so called overlay program). The divisions between the
31  /// spills can be specified by adding in a fake event that has a single
32  /// particle with a HepStatus value of -1. The fake event will be
33  /// dropped from generation, so it should not contain a real particle.
34  RooTrackerKinematicsGenerator(const G4String& name,
35  const G4String& fileName,
36  const G4String& treeName,
37  const G4String& order,
38  int firstEvent);
40 
41  /// Add a primary vertex to the event.
43  G4Event* evt, const G4LorentzVector& position);
44 
45  /// Get the name of the open kinematics file.
46  virtual G4String GetInputName();
47 
48 private:
49  /// The static part of the file name field.
51 
52  /// The RooTracker file to read.
53  TFile* fInput;
54 
55  /// The event tree that contains the output events.
56  TTree *fTree;
57 
58  /// The next entry to read from the file. The entry to be used is
59  /// fEntryVector[fNextEntry].
60  unsigned int fNextEntry;
61 
62  /// A pre-filled vector of entry numbers to be used from input tree. This
63  /// is used to allow the order of the input interactions to be randomized.
64  /// Beam flux simulators typically over-sample pion decays in the beam
65  /// pipe so that they can generate larger samples. This has the
66  /// unfortunate effect that consecutive neutrino interactions will have
67  /// correlated energies.
68  std::vector<int> fEntryVector;
69 
70  //////////////////////////////////////////////////////////////
71  // Declare the information to get from the ntuple. This does not get all
72  // of the information, only the stuff that is actually used.
73  //////////////////////////////////////////////////////////////
74 
75  /// The generator-specific event flags.
76  TBits* fEvtFlags;
77 
78  /// The generator-specific string with the 'event code'
79  TObjString* fEvtCode;
80 
81  /// The sequence number of the event (the event number).
82  int fEvtNum;
83 
84  /// The cross section for the event (1E-38 cm2)
85  double fEvtXSec;
86 
87  /// The differential cross section for the event kinematics
88  /// (1E-38 cm2/{K^n})
89  double fEvtDXSec;
90 
91  /// The weight for the event
92  double fEvtWght;
93 
94  /// The probability for the event (given the cross section, path lengths,
95  /// etc.).
96  double fEvtProb;
97 
98  /// The event vertex position in detector coord syst (in meters and
99  /// seconds).
100  double fEvtVtx[4];
101 
102  /// The number of particles in the particle arrays to track
103  int fStdHepN;
104 
105  /// The maximum number of particles that can be in the particle arrays.
106  static const int kNPmax = 4000;
107 
108  /// The PDG codes for the particles to track. This may include generator
109  /// specific codes for pseudo particles.
110  int fStdHepPdg[kNPmax]; //[fStdHepN]
111 
112  /// The a generator specific status for each particle. Particles with a
113  /// status equal to 1 will be tracked.
114  ///
115  /// The HEPEVT status values are as follows:
116  /// - 0 : null entry.
117  /// - 1 : an existing entry, which has not decayed or fragmented. This is
118  /// the main class of entries, which represents the `final state' given
119  /// by the generator.
120  /// - 2 : an entry which has decayed or fragmented and is therefore not
121  /// appearing in the final state, but is retained for event history
122  /// information.
123  /// - 3 : a documentation line, defined separately from the event
124  /// history. This could include the two incoming reacting particles,
125  /// etc.
126  /// - 4 to 10 :
127  /// undefined, but reserved for future standards.
128  /// - 11 to 200 : at the disposal of each model builder for constructs
129  /// specific to his program, but equivalent to a null line in the
130  /// context of any other program.
131  /// - 201 and above : at the disposal of users, in particular for event
132  /// tracking in the detector.
133  ///
134  /// The GENIE generator approximately follows the HEPEVT status codes.
135  /// As of July 2008, the status values found the GENIE source code are:
136  /// - -1 -- Undefined particle
137  /// - 0 -- An initial state particle.
138  /// - 1 -- A stable final state particle to be tracked.
139  /// - 2 -- An intermediate particle that should not be tracked.
140  /// - 3 -- A particle which decayed and should not be tracked. If
141  /// this particle produced daughters to be tracked, they will
142  /// have a state of 1.
143  int fStdHepStatus[kNPmax]; //[fStdHepN]
144 
145  /// The position (x, y, z, t) (fm, second) of the particle in the nuclear
146  /// frame
147  double fStdHepX4[kNPmax][4]; //[fStdHepN]
148 
149  /// The 4-momentum (px, py, pz, E) of the particle in the LAB frame (GeV)
150  double fStdHepP4[kNPmax][4]; //[fStdHepN]
151 
152  /// The particle polarization vector.
153  double fStdHepPolz [kNPmax][3]; //[fStdHepN]
154 
155  /// The index of the first daughter of the particle in the arrays.
156  int fStdHepFd[kNPmax]; //[fStdHepN]
157 
158  /// The index last daughter of the particle in the arrays.
159  int fStdHepLd[kNPmax]; //[fStdHepN]
160 
161  /// The index of the first mother of the particle in there arrays.
162  int fStdHepFm[kNPmax]; //[fStdHepN]
163 
164  /// The index of the last mother of the particle in the arrays.
165  int fStdHepLm[kNPmax]; //[fStdHepN]
166 
167  //////////////////////////////
168  /// The following variables are copied more or less directly from the
169  /// input flux generator.
170  //////////////////////////////
171 
172  /// The PDG code of the particle which created the parent neutrino.
174 
175  /// The interaction mode at the vertex which created the parent neutrino.
176  /// This is normally the decay mode of the parent particle.
178 
179  /// The 4 momentum of the particle at the vertex which created the parent
180  /// neutrino. This is normally the momentum of the parent particle at the
181  /// decay point.
182  double fNuParentDecP4[4];
183 
184  /// The position of the vertex at which the neutrino was created. This is
185  /// passed directly from the beam (or other flux) generator, and is in the
186  /// native units of the original generator.
187  double fNuParentDecX4[4];
188 
189  /// The momentum of the parent particle at it's production point. This is
190  /// in the native energy units of the flux generator.
191  double fNuParentProP4[4];
192 
193  /// The position of the parent particle at it's production point. This
194  /// uses the target as the origin and is in the native units of the flux
195  /// generator.
196  double fNuParentProX4[4];
197 
198  /// The vertex ID of the parent particle vertex.
200 };
201 #endif
static QCString name
Definition: declinfo.cpp:673
double fStdHepP4[kNPmax][4]
The 4-momentum (px, py, pz, E) of the particle in the LAB frame (GeV)
int fNuParentPdg
The PDG code of the particle which created the parent neutrino.
int fStdHepN
The number of particles in the particle arrays to track.
std::string string
Definition: nybbler.cc:12
std::string fFilename
The static part of the file name field.
TObjString * fEvtCode
The generator-specific string with the &#39;event code&#39;.
int fNuParentProNVtx
The vertex ID of the parent particle vertex.
int fStdHepLd[kNPmax]
The index last daughter of the particle in the arrays.
GeneratorStatus
A status value that can be returned by GeneratePrimaryVertex.
TBits * fEvtFlags
The generator-specific event flags.
int fStdHepFd[kNPmax]
The index of the first daughter of the particle in the arrays.
fileName
Definition: dumpTree.py:9
double fEvtXSec
The cross section for the event (1E-38 cm2)
double fStdHepPolz[kNPmax][3]
The particle polarization vector.
Construct a module from components.
Definition: TG4HitSegment.h:10
int fEvtNum
The sequence number of the event (the event number).
TTree * fTree
The event tree that contains the output events.
static const int kNPmax
The maximum number of particles that can be in the particle arrays.
RooTrackerKinematicsGenerator(const G4String &name, const G4String &fileName, const G4String &treeName, const G4String &order, int firstEvent)
int fStdHepFm[kNPmax]
The index of the first mother of the particle in there arrays.
TCEvent evt
Definition: DataStructs.cxx:7
virtual G4String GetInputName()
Get the name of the open kinematics file.
int fStdHepLm[kNPmax]
The index of the last mother of the particle in the arrays.
virtual GeneratorStatus GeneratePrimaryVertex(G4Event *evt, const G4LorentzVector &position)
Add a primary vertex to the event.