/** * @file SolidRunAction.hh * @author: (modified by) Ibrahin Pinera * @date 2016 SoLid - University of Antwerp */ #ifndef SolidRunAction_h #define SolidRunAction_h 1 #include "G4UserRunAction.hh" #include "SolidEventAction.hh" #include "globals.hh" #include class TTree; class TFile; class TBranch; class SolidRunMessenger; //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... class G4Run; /** @class SolidRunAction * Run Action class * @author Sakari Ihantola * @author Ibrahin Pinera (modified) */ /// Run action class SolidRunAction : public G4UserRunAction { public: /** Standard constructor * @param outp_ root output file */ SolidRunAction(TFile*); ///< Standard constructor /* Default destructor */ virtual ~SolidRunAction(); ///< Default destructor public: void BeginOfRunAction(const G4Run*); ///< "Begin of run" action void EndOfRunAction(const G4Run*); ///< "End of run" action void UpdateTracking(void); ///< Fill tracking tree void UpdateStatistics(RunTally); ///< Fill trees void SaveFile(G4int); ///< Write treees into the output root file void SetSeed(G4long seed) { fSeed = seed; } ///< Set randon number seed G4long GetSeed() { return fSeed; } ///< Get random number seed inline void SetStoreT2 (const G4bool val) {m_storeT2 = val;} inline void SetStoreT6 (const G4bool val) {m_storeT6 = val;} inline void SetStoreT7 (const G4bool val) {m_storeT7 = val;} inline void SetStoreT8 (const G4bool val) {m_storeT8 = val;} inline void SetStoreT9 (const G4bool val) {m_storeT9 = val;} inline void SetStoreT9cut (const G4int val) {m_storeT9cut = val;} inline void SetStoreNevt (const G4int val) {m_storeNevt = val;} G4bool IsT2Stored() { return m_storeT2; } G4bool IsT6Stored() { return m_storeT6; } G4bool IsT7Stored() { return m_storeT7; } G4bool IsT8Stored() { return m_storeT8; } G4bool IsT9Stored() { return m_storeT9; } G4int GetT9cut() { return m_storeT9cut; } G4int GetNevt() { return m_storeNevt; } G4double DepositedSoFar; G4int NeutronStepCount, PositronStepCount, nGeneratedTrackID, istherm, checkTrackID, particleStepCount; G4int CubeNumber; G4double thePreEne; G4bool NeutronEnteringCube; G4bool checkEnteredDetector; G4double triggerTime; int InitVol; int InitCube; G4int pvtCollID; // T1 tree variables std::vector primary_pdgid; std::vector primary_energy; std::vector primary_posx; std::vector primary_posy; std::vector primary_posz; std::vector primary_momx; std::vector primary_momy; std::vector primary_momz; std::vector primary_vol; std::vector primary_cube; std::vector primary_cubex; std::vector primary_cubey; std::vector primary_cubez; // T2 tree variables double CapEneLi; ///< Lithium capture energy double CapEnePVT; ///< PVT capture energy double ModTime; ///< Moderation time double ThermalTime; ///< Thermal time double CaptureTime; ///< Capture time double ThermalRadius; ///< Thermal radius double ModDistance; ///< Module distance double CaptureDistance; ///< Capture distance int NScatter; ///< Number of scatterings int CaptureVol; ///< Neutron cap volume int CaptureCube; ///< Neutron cap volume double NeutronDeltaR; ///< deltaR (ibd -> capture) double InitPosX; ///< x coordinate of ibd vertex double InitPosY; ///< y coordinate of ibd vertex double InitPosZ; ///< z coordinate of ibd vertex double PositronEndX; ///< x coordinate of positron track end double PositronEndY; ///< y coordinate of positron track end double PositronEndZ; ///< z coordinate of positron track end double PositronDistance; ///< Distance of positron track double AnnihilationTime; ///< Annihilation time int AnnihilationCube; ///< Annihilation cube int AnnihilationVol; ///< Annihilation volume double PositronDeltaR; ///< deltaR (ibd -> annih) double ibdDeltaT; ///< deltaT (e+ annih -> n cap) double ibdDeltaR; ///< deltaR (e+ annih -> n cap) // T5 tree variables std::vector cubenumber; ///< Cube ID number std::vector cubeXPosition; ///< Cube x position std::vector cubeYPosition; ///< Cube y position std::vector cubeZPosition; ///< Cube z position std::vector pdg; ///< PDG code of hit std::vector partID; ///< trackID code of hit std::vector mothID; ///< parent trackID code of hit std::vector edepTot; ///< Total energy deposit std::vector edepPvt; ///< Energy deposit in PVT std::vector edepLi; ///< Energy deposit in Li6 std::vector timeOfDemise; ///< Time std::vector distanceTravelled; ///< Distance // T6 tree variables std::vector partPDG; ///< particle ID std::vector partTrackID; ///< Track ID std::vector partParentID; ///< Parent Track ID std::vector partEnergy; ///< Energy std::vector partDeposited; ///< Energy depositions std::vector partX; ///< posX std::vector partY; ///< posY std::vector partZ; ///< posZ std::vector partTime; ///< elapsed time std::vector partCubeID; ///< Cubes ID std::vector partCubeX; ///< Cubes X std::vector partCubeY; ///< Cubes Y std::vector partCubeZ; ///< Cubes Z std::vector partVolID; ///< volume ID // T7 tree variables std::vector enteringPartID; ///< particle ID std::vector enteringTrackID; ///< Track ID std::vector enteringParentID; ///< Parent Track ID std::vector enteringEnergy; ///< Energy std::vector enteringX; ///< posX std::vector enteringY; ///< posY std::vector enteringZ; ///< posZ std::vector enteringXmom; ///< momX std::vector enteringYmom; ///< momY std::vector enteringZmom; ///< momZ std::vector enteringTime; ///< elapsed time std::vector enteringPreVolID; ///< volume ID from where is coming std::vector enteringPostVolID; ///< volume ID where it enters // T8 tree variables std::vector nGenerationTrackID; ///< track id for generated neutron std::vector nGenerationParentID; ///< parent id for generated neutron std::vector nGenerationEnergy; ///< energy of generated neutrons std::vector nGenerationPosX; ///< position x for generated neutron std::vector nGenerationPosY; ///< position y for generated neutron std::vector nGenerationPosZ; ///< position z for generated neutron std::vector nGenerationTime; ///< elapsed time for generated neutron std::vector nGenerationCube; ///< cube id for generated neutron std::vector nGenerationVol; ///< volume id for generated neutron std::vector nGenerationProcess; ///< creator process name for generated neutron // T9 tree variable std::vector summaryPartPDG; ///< partPDG std::vector summaryAllPDG; ///< (temp vector of partID for finding parentPDG) std::vector summaryAllPartID; ///< partID (temp vector for finding parentPDG) std::vector summaryPartID; ///< part track ID std::vector summaryParentID; ///< mother trackID std::vector summaryParentPDG; ///< mother PDG std::vector summaryNsteps; ///< Number of total steps std::vector summaryNcubes; ///< Number of hit cubes std::vector summaryNCompton; ///< number of compton std::vector summaryNBrem; ///< number of Bremsthralung std::vector summaryNIonisation; ///< number of Ionisation processes // std::vector summaryCreatorProcess; ///< creator process // std::vector summaryLastProcess; ///< last process std::vector summaryCreatorProcessID; ///< creator process std::vector summaryLastProcessID; ///< last process std::vector summaryInitialEkin; ///< initial kinetic energy of the particle std::vector summaryFirstVol; ///< ID of the first volume or cubeID std::vector summaryLastVol; ///< ID of the last volume or cube ID std::vector summaryGoodEntry; ///< true if the particle touched at least one of the VolID < 90 std::vector listCubes; ///< list of cubes tmp std::vector summaryPosX; /// position x of the particle LastStep std::vector summaryPosY; /// position y of the particle LastStep std::vector summaryPosZ; /// position z of the particle LastStep private: RunTally Stats; G4long fSeed; ///< Random number seed TFile *outp; ///< Output root file TTree *T0; ///< Tree for simulation setup information TTree *T1; ///< Tree for IBD conditions TTree *T2; ///< Tree for neutron information TTree *T5; ///< Tree for cube-level information from sensitive detectors TTree *T6; ///< Tree for particles tracking info TTree *T7; ///< Tree for particles entering the detector volume TTree *T8; ///< Tree for spallation neutrons generation by muons TTree *T9; ///< Tree with MC truth information G4bool m_storeT2; G4bool m_storeT6; G4bool m_storeT7; G4bool m_storeT8; G4bool m_storeT9; G4int m_storeT9cut; G4int m_storeNevt; SolidRunMessenger* m_raMess; TBranch *RunBranch; time_t start; ///< Start time of simulation. It will be used to calculate run time at the end of run. float conv_CapPos[3]; float conv_ThermPos[3]; float conv_InitPos[3]; float conv_InitVec[3]; }; #endif