LBNEAnalysis.hh
Go to the documentation of this file.
1 //
2 // LBNEAnalysis.hh
3 //
4 // Modified Jul 2005 by A. MArino to make data_t and hadmmtuple_t classes
5 
6 #ifndef LBNEANALYSIS_HH
7 #define LBNEANALYSIS_HH
8 #include <fstream>
9 #include "globals.hh"
10 #include "G4Trajectory.hh"
11 #include "G4TrajectoryPoint.hh"
12 #include "dk2nu/tree/dk2nu.h"
13 #include "dk2nu/tree/dkmeta.h"
14 //root
15 #include "TSystem.h"
16 
17 //G4
18 #include "G4ios.hh"
19 #include "G4TrajectoryContainer.hh"
20 
21 #include <map>
22 
23 class G4ParticleDefinition;
24 class G4Step;
25 class TFile;
26 class TTree;
27 class G4Track;
28 class LBNEDataNtp_t;
30 typedef std::vector<G4String>vstring_t; //A. Bashyal for ppfx...
31 
32 const int kMaxP = 10000;
33 const int HkMaxP = 100000000;
34 
36 {
37 public:
38 
39  LBNEAnalysis();
40  ~LBNEAnalysis();
41 
42  //void book();
43  //void finish();
44  G4bool CreateOutput();
45  G4bool CreateDk2NuOutput();
46  void CloseOutput();
47  void CloseDk2NuOutput();
48  void FillNeutrinoNtuple(const G4Track& track,const std::vector<G4VTrajectory*>& nuHistory);
49  void FillTrackingNtuple(const G4Track& track, LBNETrajectory* currTrajectory);
50  void TrackThroughGeometry(const LBNETrajectory* TrackTrajectory);
51  void fillDkMeta(); // From runAction, with input from PrimaryGenerator Action
52 
53 
54  void FillAlcoveTrackingPlaneData(const G4Step& aStep);
55 
56  void FillTrackingPlaneData(const G4Step& aStep); //---- for tracking planes
57  void FillTrackingPlaneH1Data(const G4Step& aStep);
58  void FillTrackingPlaneH2Data(const G4Step& aStep);
59  void FillTrackingPlaneDPData(const G4Step& aStep);
60  void FillTargetOutputData(const G4Step& aStep);
61 
62  LBNETrajectory* GetParentTrajectory(G4int parentID);
63  LBNETrajectory* GetTrajectory(G4int trackID);
64  static LBNEAnalysis* getInstance();
65 
66  void CalcLocationWeights(const bsim::DkMeta* dkmeta, bsim::Dk2Nu* dk2nu, bool useRealisticNearDetectorVolume);
67 
68  void ResetEvent(); //---needed for tracking planes
69  void FillEvent();
70  void SetCount(G4int count);
71  G4int GetCount();
72  void SetEntry(G4int entry);
73  G4int GetEntry();
74  G4double GetDistanceInVolume(LBNETrajectory* wanted_traj,G4String wanted_vol); //For ppfx ...A. Bashyal
75 
76 private:
77 
78 
79 private:
81 
83 
84  G4double x;
85  G4double y;
86  G4double z;
87  //----- variables to store the tracking plane info
88  // for each track it makes one entry per particle per tracking plane. There
89  // can also be multiple particles per event.
92  double fNImpWt[kMaxP];
93  double fParticleX[kMaxP];
94  double fParticleY[kMaxP];
95  double fParticleZ[kMaxP];
98  double fParticleDX[kMaxP];
99  double fParticleDY[kMaxP];
102 // Variables to store the Horn 1 tracking plane info. Amit Bashyal
105  double fH1NImpWt;
108  double fH1ParticleX;
109  double fH1ParticleY;
110  double fH1ParticleZ;
128  G4ThreeVector NuMomentum;
130 
131  //----- variables to store the tracking plane info in Horn2 Plane Amit Bashyal
132  // for each track it makes one entry per particle per tracking plane. There
133  // can also be multiple particles per event.
136  double fH2NImpWt;
137  double fH2ParticleX;
138  double fH2ParticleY;
139  double fH2ParticleZ;
156  G4String fH2CProcess;
159 
160 //Variables to be stored in the Decay Pipe Tracking Plane. All the Variables are
161 // not used as they are not useful for this study. Amit Bashyal
165  double fDPNImpWt;
166  double fDPParticleX;
167  double fDPParticleY;
168  double fDPParticleZ;
186  //Variables to Study the Particles coming out of Target Amit Bashyal
187 
190  double fTParticleX;
191  double fTParticleY;
192  double fTParticleZ;
195  double fTParticlePX;
196  double fTParticlePY;
197  double fTParticlePZ;
199 
200  G4double noProtons;
201 
202 
203  //Variables to study particles in the sculpted absorber tracking plane
204  int fMuRunNo;
205  int fMuEvtNo;
209  int fMuPDG[kMaxP];
210  double fMuNimpWt[kMaxP];
211  double fMuX[kMaxP];
212  double fMuY[kMaxP];
213  double fMuZ[kMaxP];
214  double fMuT[kMaxP];
215  double fMuStartX[kMaxP];
216  double fMuStartY[kMaxP];
217  double fMuStartZ[kMaxP];
218  double fMuStartE[kMaxP];
219  double fMuMass[kMaxP];
220  double fMuEnergy[kMaxP];
221  double fMuPX[kMaxP];
222  double fMuPY[kMaxP];
223  double fMuPZ[kMaxP];
224  double fMuTheta[kMaxP];
225  double fMudEdx[kMaxP];
227  double fMuDE[kMaxP];
228  double fMuDEion[kMaxP];
229 // double fMuDEnonion[kMaxP];
232  double fMuParX[kMaxP];
233  double fMuParY[kMaxP];
234  double fMuParZ[kMaxP];
235  double fMuParE[kMaxP];
236  double fMuParPX[kMaxP];
237  double fMuParPY[kMaxP];
238  double fMuParPZ[kMaxP];
239 
240 
241 
242  TTree* fHorn1TrackingTree; //Tree for Horn1 Tracking Plane Data
245  TTree* fTargetOutputTree; //Tree for Horn2 Tracking Plane Data
247 
248 // What it should be..
249  // std::string nuNtupleFileName;
250  char nuNtupleFileName[1024];
251  char nuNtupleFileNameDK2Nu[1024]; // New file to support standard complete
252  //
253  //need this or get a seg fault don't know why
254  //
255  std::map<int, int> code;
256  //
257 
258  TFile* fOutFile;
259  TTree* fOutTree;
260 
261  TFile* nuNtuple;
262 
263  TFile* fOutFileDk2Nu; // The new (dk2nu, r487) NTuple file
266 
267  TTree* fTrackingTree; // tree for tracking plane data
268 
269 
270  bsim::Dk2Nu* fDk2Nu;
271  bsim::DkMeta* fDkMeta;
272 
273  LBNEDataNtp_t *fLBNEOutNtpData; // Not used for Dk2Nu, we rely solely on G4Trajectory and G4TrajectoryPt
275 
276 
277 
278  G4int fcount;
279  G4int fentry;
280  G4int nGenAbs = 3;
281  G4int nVolAbs = 4;
282 
283  std::vector<G4double> fXdet_near;
284  std::vector<G4double> fYdet_near;
285  std::vector<G4double> fZdet_near;
286  std::vector<G4double> fXdet_far;
287  std::vector<G4double> fYdet_far;
288  std::vector<G4double> fZdet_far;
289  std::vector<G4String> fDetNameNear;
290  std::vector<G4String> fDetNameFar;
291 
292  std::vector<bsim::Traj>vec_traj; //A. Bashyal
293  int tar_trackID=-1;
295  int nVintTot;
296  int nVdblTot;
297  G4double dist_IC1[3];
298  G4double dist_IC2[3];
299  G4double dist_DPIP[3];
300  G4double dist_DVOL[3];
305  bool doPPFx;
306  std::ofstream fOutDBGDk2nu_; // Backdoor ASCII Ntuple to understand relative rates
307  // Missing pion in the Revisited NuMI Small Tgt.
311 
312 
313  void setDetectorPositions(); // Obsollete if read from Dk2Nu file, as per Robert (Robert, not Rob), Hatcher, Sept 2014.
314 
315 };
316 #endif
G4String fH2CProcess
void FillTrackingPlaneH1Data(const G4Step &aStep)
G4int GetCount()
int fParticlePDG[kMaxP]
Definition: LBNEAnalysis.hh:91
TTree * fHorn2TrackingTree
double fH2ParticleDZ
double fDPParticleDY
void fillDkMeta()
G4double dist_DPIP[3]
double fH2PProductionX
double fMudEdx[kMaxP]
double fDPPProductionX
LBNETrajectory * GetParentTrajectory(G4int parentID)
double fMuParE[kMaxP]
TFile * fOutFileDk2Nu
void FillNeutrinoNtuple(const G4Track &track, const std::vector< G4VTrajectory * > &nuHistory)
QList< Entry > entry
double fMuParX[kMaxP]
std::string fH1CProcess
double fH2ParticleX
double fParticleZ[kMaxP]
Definition: LBNEAnalysis.hh:95
double fDPParticleX
double fH2ParticlePX
bsim::DkMeta * fDkMeta
int fMuParPDG[kMaxP]
double fMuParPZ[kMaxP]
double fH1ParticleMass
std::string string
Definition: nybbler.cc:12
double fDPPProductionY
bsim::Dk2Nu * fDk2Nu
double fDPParticleDX
double fH1PProductionX
double fDPParticleEnergy
std::vector< G4double > fXdet_far
double fMudEdx_ion[kMaxP]
std::vector< G4String > fDetNameNear
void CloseDk2NuOutput()
G4ThreeVector NuMomentum
double fMuT[kMaxP]
double fParticleMass[kMaxP]
Definition: LBNEAnalysis.hh:97
void FillTrackingPlaneH2Data(const G4Step &aStep)
double fH1ParticlePX
LBNETrajectory * GetTrajectory(G4int trackID)
double fDPParticleMass
double fDPParticleDZ
double fDPParticleY
double fH2ParticleMass
double fMuPX[kMaxP]
G4double dist_DVOL[3]
double fH1ParticlePXPZ
double fH1ParticleZ
void SetEntry(G4int entry)
TTree * fOutTreeDk2NuMeta
G4double y
Definition: LBNEAnalysis.hh:85
double fMuStartZ[kMaxP]
void SetCount(G4int count)
double fParticleEnergy[kMaxP]
Definition: LBNEAnalysis.hh:96
std::vector< G4double > fYdet_far
double fH2PProductionDX
G4double x
Definition: LBNEAnalysis.hh:84
double fH1PProductionZ
int fMuPDG[kMaxP]
bool fDk2NuDetectorFileRead
Definition: LBNEAnalysis.hh:82
void FillTrackingNtuple(const G4Track &track, LBNETrajectory *currTrajectory)
double fMuX[kMaxP]
void TrackThroughGeometry(const LBNETrajectory *TrackTrajectory)
double fMuParPX[kMaxP]
void FillAlcoveTrackingPlaneData(const G4Step &aStep)
double fTParticlePY
vstring_t VolVintName
double fH1PProductionDX
LBNEDataNtp_t * fLBNEOutNtpData
double fDPParticlePYPZ
std::vector< G4double > fXdet_near
double fDPPProductionDX
double fDPPProductionZ
G4double noProtons
double fMuMass[kMaxP]
double fH2PProductionZ
static LBNEAnalysis * instance
Definition: LBNEAnalysis.hh:80
static LBNEAnalysis * getInstance()
double fH1PProductionDZ
void setDetectorPositions()
void CalcLocationWeights(const bsim::DkMeta *dkmeta, bsim::Dk2Nu *dk2nu, bool useRealisticNearDetectorVolume)
TTree * fDPTrackingTree
double fMuPY[kMaxP]
double fTParticleZ
double fMuEnergy[kMaxP]
double fMuPZ[kMaxP]
double fDPParticlePX
G4int GetEntry()
int fMuTrackID[kMaxP]
void FillTrackingPlaneData(const G4Step &aStep)
double fMuZ[kMaxP]
double fParticleY[kMaxP]
Definition: LBNEAnalysis.hh:94
double fH2PProductionDZ
double fH1ParticleDX
double fMuParY[kMaxP]
double fMuY[kMaxP]
TTree * fOutTreeDk2Nu
double fH1ParticlePY
std::vector< G4double > fZdet_far
char nuNtupleFileName[1024]
double fDPParticleZ
double fMuDE[kMaxP]
double fH1ParticlePZ
double fDPParticlePY
double fMuStartY[kMaxP]
double fH2PProductionDY
double fH1ParticleDZ
double fH1NImpWt
double fH2ParticlePXPZ
G4double z
Definition: LBNEAnalysis.hh:86
std::vector< G4String > vstring_t
Definition: LBNEAnalysis.hh:29
TTree * fAlcoveTrackingTree
double fDPPProductionDZ
double fParticleDZ[kMaxP]
double fTParticleEnergy
double fMuStartE[kMaxP]
double fH1PProductionDY
double fH2ParticleDY
double fH2NImpWt
double fH1ParticleY
int fTrackID[kMaxP]
Definition: LBNEAnalysis.hh:90
int numEntFillNTuDk2nuPzR_
double fH1ParticleX
double fTParticleY
double fH2ParticlePYPZ
double fH1ParticleDY
double fDPPProductionDY
double fH2ParticlePZ
double fTParticlePZ
vstring_t VolAbsName
double fParticleDY[kMaxP]
Definition: LBNEAnalysis.hh:99
double fMuParPY[kMaxP]
void FillTrackingPlaneDPData(const G4Step &aStep)
double fH1PProductionY
vstring_t GenAbsName
std::vector< G4double > fYdet_near
TTree * fTrackingTree
int fMuNSteps[kMaxP]
double fH2ParticlePY
double fH1ParticlePYPZ
double fDPParticlePZ
std::map< int, int > code
G4bool CreateDk2NuOutput()
TTree * fTargetOutputTree
const int HkMaxP
Definition: LBNEAnalysis.hh:33
double fH2ParticleZ
double fDPNImpWt
double fTParticlePX
vstring_t VolVdblName
G4double dist_IC2[3]
TTree * fOutTree
G4double dist_IC1[3]
TTree * fHorn1TrackingTree
G4bool CreateOutput()
double fMuStartX[kMaxP]
double fMuParZ[kMaxP]
G4double GetDistanceInVolume(LBNETrajectory *wanted_traj, G4String wanted_vol)
double fH1ParticleEnergy
void FillTargetOutputData(const G4Step &aStep)
double fDPParticlePXPZ
double fMuNimpWt[kMaxP]
double fH2PProductionY
std::ofstream fOutDBGDk2nu_
double fParticleX[kMaxP]
Definition: LBNEAnalysis.hh:93
double fH2ParticleY
double fMuDEion[kMaxP]
double fNImpWt[kMaxP]
Definition: LBNEAnalysis.hh:92
const int kMaxP
Definition: LBNEAnalysis.hh:32
double fH2ParticleDX
double fMuTheta[kMaxP]
LBNEDataNtp_t * fTrackingPlaneData
std::vector< G4String > fDetNameFar
double fTParticleX
double fParticleDX[kMaxP]
Definition: LBNEAnalysis.hh:98
void CloseOutput()
std::vector< G4double > fZdet_near
std::vector< bsim::Traj > vec_traj
TFile * fOutFile
int fMuParentID[kMaxP]
double fH2ParticleEnergy
char nuNtupleFileNameDK2Nu[1024]
TFile * nuNtuple