/** * @file SolidEventAction.hh * @author: (modified by) Ibrahin Pinera * @date 2016 SoLid - University of Antwerp */ #ifndef SolidEventAction_h #define SolidEventAction_h 1 #include "G4UserEventAction.hh" #include "G4THitsMap.hh" #include "SolidPVTHit.hh" #include "G4ThreeVector.hh" #include "G4ios.hh" #include "globals.hh" #include #include class SolidRunAction; class SolidPrimaryGeneratorAction; class SolidEventMessenger; class G4Event; struct RunTally { int Evt; int Generated; int LiCapture; int PVTCapture; int CapCube; int NCubes; G4ThreeVector CapPos; G4ThreeVector ThermPos; G4ThreeVector InitPos; G4ThreeVector InitVec; float CapDist; float ThermDist; float CapEne; float EneCube[1000000]; float IncidentE; float Deposit; int Generated1; int Generated2; int BulkAbs; int Detected; int WLS; // int LiCapture; inline int operator ==(const RunTally& right) const {return (this==&right);} }; //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... class SolidEventAction : public G4UserEventAction { public: SolidEventAction(SolidRunAction *ra, SolidPrimaryGeneratorAction *pga); virtual ~SolidEventAction(); virtual void BeginOfEventAction(const G4Event*); virtual void EndOfEventAction(const G4Event*); // void CountCaptures(); void AddGenerated(G4int numgenerated){Statistics.Generated += numgenerated;} void AddGenerated1(G4int numgenerated){Statistics.Generated1 += numgenerated;} void AddGenerated2(G4int numgenerated){Statistics.Generated2 += numgenerated;} void AddLiCaptured(G4int numLicaptured){Statistics.LiCapture += numLicaptured;} void AddPVTCaptured(G4int numPVTcaptured){Statistics.PVTCapture += numPVTcaptured;} void AddEdep(G4double edep){Statistics.Deposit += edep;} void CountDetected(RunTally); void CountWLS(){Statistics.WLS++;} void CountBulkAbs(){Statistics.BulkAbs++;} void SetThermalPos(G4ThreeVector thermpos){Statistics.ThermPos = thermpos;} void SetCapturePos(G4ThreeVector cappos){Statistics.CapPos = cappos;} void SetInitialPos(G4ThreeVector inipos){Statistics.InitPos = inipos;} void SetInitialVec(G4ThreeVector inivec){Statistics.InitVec = inivec;} void SetCaptureEne(G4double capene){Statistics.CapEne = capene;} void SetCaptureCube(G4int cube){Statistics.CapCube = cube;} void SetNCubes(G4int ncubes){Statistics.NCubes = ncubes;} void SetEneCube(G4double energy, G4int cube){Statistics.EneCube[cube] += energy;} //Keeps track of the incident energy of the primary particle void SetIncidentE(G4double ince){Statistics.IncidentE = ince;} // void AddEnergy(G4double energy){Statistics.IncidentE += energy;} G4bool IsEdep0Set; // flag to know wether edep0 was already set G4ThreeVector edep0_pos; // position of energy deposit of primary particle inline void SetVerbose (const G4bool val) {fVerbose = val;} private: G4int event_id; G4int pvtCollID; G4int liCollID; SolidRunAction *run_action; SolidPrimaryGeneratorAction* genAction; // particle generator // G4double primEnergy; std::vector SDNames; G4String hitsFilename; G4String edepFilename; G4int S_hits; SolidEventMessenger* fgeEvMess; RunTally Statistics; G4bool fVerbose; private: // methods G4THitsMap* GetHitsCollection(G4int hcID, const G4Event* event) const; G4double GetSum(G4THitsMap* hitsMap) const; void PrintEventStatistics(G4double absoEdep, G4double absoTrackLength, G4double gapEdep, G4double gapTrackLength) const; // void WriteHit( G4int cubeId, G4String layer, G4int pdg, G4double energy, G4double track, G4double time); void WriteHit( G4int cubeId, G4String layer, G4int pdg, G4double energy, G4double track, G4double time, G4int pID, G4int mID); }; #endif