ACTARSim
ACTAR TPC Simulation Reference Guide
ActarSimROOTAnalysis.hh
Go to the documentation of this file.
1 // - AUTHOR: Hector Alvarez-Pol 03/2005
2 /******************************************************************
3  * Copyright (C) 2005-2016, Hector Alvarez-Pol *
4  * All rights reserved. *
5  * *
6  * License according to GNU LESSER GPL (see lgpl-3.0.txt). *
7  * For the list of contributors see CREDITS. *
8  ******************************************************************/
9 
10 #ifndef ActarSimROOTAnalysis_h
11 #define ActarSimROOTAnalysis_h 1
12 
13 class G4VPhysicalVolume;
14 class G4Event;
15 class G4Run;
16 class G4Track;
17 class G4Step;
18 
19 #include "G4ClassificationOfNewTrack.hh"
20 #include "G4TrackStatus.hh"
21 #include "G4Types.hh"
22 #include "G4PrimaryParticle.hh"
23 
24 #include <time.h>
25 
26 #include "TClonesArray.h"
27 
28 class TH1D;
29 class TH2D;
30 class TH3D;
31 class TTree;
32 class TBranch;
33 class TFile;
34 class TClonesArray;
35 class TH2F;
36 
38 
45 
49 class ActarSimBeamInfo;
50 
51 class ActarSimData;
52 class ActarSimTrack;
54 
56 extern ActarSimROOTAnalysis *gActarSimROOTAnalysis; ///< Global pointer to this soliton
57 
59 private:
60  time_t LastDoItTime; ///< Used in OnceAWhileDoIt method for recursivity
61  TFile* simFile; ///< The ROOT file
62  char* newDirName; ///< Directory name within ROOT file
63 
64  TTree* eventTree; ///< Events tree
65  TTree* tracksTree; ///< Tracks tree
66 
67  ActarSimROOTAnalGas* gasAnal; ///< Pointer to detector specific (gas chamber) analysis class
68  ActarSimROOTAnalSil* silAnal; ///< Pointer to detector specific (silicon) analysis class
69  ActarSimROOTAnalSilRing* silRingAnal; ///< Pointer to detector specific (silicon ring) analysis class
70  ActarSimROOTAnalSci* sciAnal; ///< Pointer to detector specific (scintillator) analysis class
71  ActarSimROOTAnalSciRing* sciRingAnal; ///< Pointer to detector specific (scintillator ring) analysis class
72  ActarSimROOTAnalPla* plaAnal; ///< Pointer to detector specific (plastic) analysis class
73 
74  ActarSimBeamInfo* pBeamInfo; ///< Pointer to beam information object
75 
76  ActarSimAnalysisMessenger* analMessenger; ///< Pointer to the corresponding messenger
77 
78  ActarSimData* theData; ///< Pointer to data object
79 
80  TH1D *hPrimTheta; ///< Histogram of primary Theta angle
81  TH1D *hPrimPhi; ///< Histogram of primary Phi angle
82  TH1D *hPrimEnergy; ///< Histogram of primary energy
83  TH2D *hPrimEnergyVsTheta; ///< Histogram of primary Energy vs Theta angle
84 
85  TH2F *hScatteredIonKinematic; ///< Histogram with Cine Kinematic results for scattered ions
86  TH2F *hRecoilIonKinematic; ///< Histogram with Cine Kinematic results for recoil ions
87 
88  ActarSimPrimaryInfo** thePrimaryInfo; ///< Primary particles data
89  TClonesArray* primaryInfoCA; ///< ClonesArray of primaries info objects
90  TClonesArray* beamInfoCA; ///< ClonesArray of the beam info objects
91  TClonesArray* theDataCA; ///< ClonesArray of the data objects
92 
93  G4int theRunID; ///< Particle Run ID
94  G4int theEventID; ///< Particle Event ID
95 
96  G4String storeTracksFlag; ///< Flag to turn "on"/"off" the storage of complete tracks
97  G4String storeTrackHistosFlag; ///< Flag to turn "on"/"off" the storage of histograms related to the tracks
98  G4String storeEventsFlag; ///< Flag to turn "on"/"off" the storage fo events
99  G4String storeSimpleTracksFlag; ///< Flag to turn "on"/"off" the storage of simple tracks
100  G4String storeHistogramsFlag; ///< Flag to turn "on"/"off" the storage of general histograms
101  G4String beamInteractionFlag; ///< Flag to turn "on"/"off" the beam interaction analysis
102 
103  G4int gasAnalIncludedFlag; ///< Flag to turn on(1)/off(0) the gas chamber analysis
104  G4int silAnalIncludedFlag; ///< Flag to turn on(1)/off(0) the silicon analysis
105  G4int silRingAnalIncludedFlag; ///<Flag to turn on(1)/off(0) the silicon ring analysis
106  G4int sciAnalIncludedFlag; ///< Flag to turn on(1)/off(0) the scintillator analysis
107  G4int sciRingAnalIncludedFlag; ///< Flag to turn on(1)/off(0) the scintillator ring analysis
108  G4int plaAnalIncludedFlag; ///< Flag to turn on(1)/off(0) the plastic analysis
109 
110 public:
113 
114  TFile* GetSimFile(){return simFile;}
115  void SetSimFile(TFile* file) {simFile = file;}
116 
117  TTree* GetEventTree(){return eventTree;}
118  void SetEventTree(TTree* tree) {eventTree = tree;}
119  TTree* GetTracksTree(){return tracksTree;}
120  void SetTracksTree(TTree* tree) {tracksTree = tree;}
122  void SetTheData(ActarSimData* data){theData = data;}
123  //ActarSimTrack* GetTheTracks(){return theTracks;}
124  //void SetTheTracks(ActarSimTrack* tr){theTracks = tr;}
125 
127 
128  G4int GetTheEventID(){return theEventID;}
129  void SetTheEventID(G4int id){theEventID = id;}
130  G4int GetTheRunID(){return theRunID;}
131  void SetTheRunID(G4int id){theRunID = id;}
132 
133  void SetGasAnalOn(){gasAnalIncludedFlag=1;}
134  void SetSilAnalOn(){silAnalIncludedFlag=1;}
135  void SetSilRingAnalOn(){silRingAnalIncludedFlag=1;}
136  void SetSciAnalOn(){sciAnalIncludedFlag=1;}
137  void SetSciRingAnalOn(){sciRingAnalIncludedFlag=1;}
138  void SetPlaAnalOn(){plaAnalIncludedFlag=1;}
139  void SetGasAnalOff(){gasAnalIncludedFlag=0;}
140  void SetSilAnalOff(){silAnalIncludedFlag=0;}
141  void SetSciAnalOff(){sciAnalIncludedFlag=0;}
142  void SetSciRingAnalOff(){sciRingAnalIncludedFlag=0;}
143  void SetPlaAnalOff(){plaAnalIncludedFlag=0;}
144 
145  //Messenger actions
146  void SetStoreTracksFlag(G4String val) {storeTracksFlag = val;};
147  void SetStoreTrackHistosFlag(G4String val) {storeTrackHistosFlag = val;};
148  void SetStoreEventsFlag(G4String val) {storeEventsFlag = val;};
149  void SetStoreSimpleTracksFlag(G4String val) {storeSimpleTracksFlag=val;};
150  void SetStoreHistogramsFlag(G4String val) {storeHistogramsFlag=val;};
151  void SetBeamInteractionFlag(G4String val){beamInteractionFlag=val;}
152 
153  G4String GetStoreTracksFlag() {return storeTracksFlag;}
155  G4String GetStoreEventsFlag() {return storeEventsFlag;}
159 
166 
168  void SetMinStrideLength(Double_t value);
169 
170  void Construct(const G4VPhysicalVolume*);
171 
172  void ConstructParticle();
173  void ConstructProcess();
174  void SetCuts();
175 
176  //TODO->Solve this assymetry!
177  //void GeneratePrimaries(const G4Event*);
178  void GeneratePrimaries(const G4Event*,G4double,G4double,G4double,G4double);
179  void GeneratePrimaries(const G4Event *anEvent, ActarSimBeamInfo *beamInfo);
180  void GenerateBeam(const G4Event*);
181 
182  void BeginOfRunAction(const G4Run*);
183  void EndOfRunAction(const G4Run*);
184 
185  void BeginOfEventAction(const G4Event*);
186  void EndOfEventAction(const G4Event*);
187 
188  void ClassifyNewTrack(const G4Track*, G4ClassificationOfNewTrack*);
189 
190  void PreUserTrackingAction(const G4Track*);
191  void PostUserTrackingAction(const G4Track*, G4TrackStatus*);
192 
193  void UserSteppingAction(const G4Step*); // original
194 
195  void OnceAWhileDoIt(const G4bool DoItNow = false);
196 };
197 #endif
void EndOfRunAction(const G4Run *)
Actions to perform in the analysis at the end of the run.
TClonesArray * theDataCA
ClonesArray of the data objects.
void GeneratePrimaries(const G4Event *, G4double, G4double, G4double, G4double)
ActarSimROOTAnalysis()
Constructor.
ActarSimROOTAnalSciRing * sciRingAnal
Pointer to detector specific (scintillator ring) analysis class.
void SetTheData(ActarSimData *data)
void ConstructProcess()
Actions to perform in the analysis during the processes construction.
TH1D * hPrimEnergy
Histogram of primary energy.
G4int theEventID
Particle Event ID.
void SetStoreTracksFlag(G4String val)
ActarSimROOTAnalGas * gasAnal
Pointer to detector specific (gas chamber) analysis class.
void SetBeamInteractionFlag(G4String val)
void EndOfEventAction(const G4Event *)
Actions to perform in the analysis at the end of the event.
void PostUserTrackingAction(const G4Track *, G4TrackStatus *)
Actions to perform in the analysis after the user tracking.
G4int plaAnalIncludedFlag
Flag to turn on(1)/off(0) the plastic analysis.
void SetStoreHistogramsFlag(G4String val)
void ClassifyNewTrack(const G4Track *, G4ClassificationOfNewTrack *)
Actions to perform in the analysis when classifying new tracks.
TFile * simFile
The ROOT file.
void SetStoreEventsFlag(G4String val)
void SetMinStrideLength(Double_t value)
Setter of the minimum stride length in the gas.
G4int sciAnalIncludedFlag
Flag to turn on(1)/off(0) the scintillator analysis.
G4int sciRingAnalIncludedFlag
Flag to turn on(1)/off(0) the scintillator ring analysis.
void UserSteppingAction(const G4Step *)
Actions to perform in the analysis after each step.
ActarSimROOTAnalSilRing * silRingAnal
Pointer to detector specific (silicon ring) analysis class.
G4int silRingAnalIncludedFlag
Flag to turn on(1)/off(0) the silicon ring analysis.
G4int theRunID
Particle Run ID.
G4String storeTrackHistosFlag
Flag to turn "on"/"off" the storage of histograms related to the tracks.
G4String beamInteractionFlag
Flag to turn "on"/"off" the beam interaction analysis.
TClonesArray * primaryInfoCA
ClonesArray of primaries info objects.
G4String storeSimpleTracksFlag
Flag to turn "on"/"off" the storage of simple tracks.
TH2F * hRecoilIonKinematic
Histogram with Cine Kinematic results for recoil ions.
void SetStoreTrackHistosFlag(G4String val)
void BeginOfEventAction(const G4Event *)
Actions to perform in the analysis at the beginning of the event.
TTree * eventTree
Events tree.
G4String storeHistogramsFlag
Flag to turn "on"/"off" the storage of general histograms.
G4String storeEventsFlag
Flag to turn "on"/"off" the storage fo events.
TH2D * hPrimEnergyVsTheta
Histogram of primary Energy vs Theta angle.
ActarSimPrimaryInfo ** thePrimaryInfo
Primary particles data.
void Construct(const G4VPhysicalVolume *)
Things to do while contructing...
time_t LastDoItTime
Used in OnceAWhileDoIt method for recursivity.
ActarSimROOTAnalSci * sciAnal
Pointer to detector specific (scintillator) analysis class.
G4int gasAnalIncludedFlag
Flag to turn on(1)/off(0) the gas chamber analysis.
ActarSimROOTAnalysis * gActarSimROOTAnalysis
Global pointer to this soliton.
void SetCuts()
Actions to perform in the analysis during the cut setting.
void PreUserTrackingAction(const G4Track *)
Actions to perform in the analysis before the user tracking.
void GenerateBeam(const G4Event *)
Defining any beam related histogram or information in the output file.
void OnceAWhileDoIt(const G4bool DoItNow=false)
Recursive controller.
ActarSimData * theData
Pointer to data object.
TH1D * hPrimTheta
Histogram of primary Theta angle.
void BeginOfRunAction(const G4Run *)
Actions to perform in the analysis at the beginning of the run.
void SetEventTree(TTree *tree)
void SetStoreSimpleTracksFlag(G4String val)
ActarSimROOTAnalPla * plaAnal
Pointer to detector specific (plastic) analysis class.
TH2F * hScatteredIonKinematic
Histogram with Cine Kinematic results for scattered ions.
char * newDirName
Directory name within ROOT file.
G4int silAnalIncludedFlag
Flag to turn on(1)/off(0) the silicon analysis.
ActarSimBeamInfo * GetBeamInfo()
TClonesArray * beamInfoCA
ClonesArray of the beam info objects.
TH1D * hPrimPhi
Histogram of primary Phi angle.
void SetSimFile(TFile *file)
~ActarSimROOTAnalysis()
Constructor. Save and close Files.
G4String storeTracksFlag
Flag to turn "on"/"off" the storage of complete tracks.
void SetTracksTree(TTree *tree)
TTree * tracksTree
Tracks tree.
ActarSimBeamInfo * pBeamInfo
Pointer to beam information object.
ActarSimAnalysisMessenger * analMessenger
Pointer to the corresponding messenger.
ActarSimROOTAnalSil * silAnal
Pointer to detector specific (silicon) analysis class.
void ConstructParticle()
Actions to perform in the analysis during the particle construction.