#include <EventAction.hh>
Public Member Functions | |
EventAction (RunAction *) | |
~EventAction () | |
void | BeginOfEventAction (const G4Event *) |
void | EndOfEventAction (const G4Event *) |
void | AddEdep (G4double edep) |
Private Attributes | |
RunAction * | m_runAction |
G4double | m_edepPerEvent |
G4int | m_printModulo |
Definition at line 16 of file EventAction.hh.
EventAction::EventAction | ( | RunAction * | run | ) |
EventAction::~EventAction | ( | ) |
void EventAction::BeginOfEventAction | ( | const G4Event * | evt | ) |
Definition at line 31 of file EventAction.cc.
00032 { 00033 G4int evtNb = evt->GetEventID(); 00034 00035 //printing survey 00036 if (evtNb%m_printModulo == 0) 00037 G4cout << "\n---> Begin of Event: " << evtNb << G4endl; 00038 00039 //energy deposited per event 00040 m_edepPerEvent = 0.; 00041 }
void EventAction::EndOfEventAction | ( | const G4Event * | event | ) |
Definition at line 45 of file EventAction.cc.
00046 { 00047 //energy deposited per event 00048 // 00049 if (m_edepPerEvent > 0.) { 00050 m_runAction->SumEvents(m_edepPerEvent); 00051 } 00052 00053 // -- jour4b2: 00054 // ------------------------------- 00055 // -- Get back collection pointer: 00056 // ------------------------------- 00057 // -- find back collection, this is made by getting the collection ID: 00058 G4SDManager* SDmanager = G4SDManager::GetSDMpointer(); 00059 G4int astronautCollectionID = SDmanager->GetCollectionID("AstronautCollection"); 00060 AstroHitCollection* astroCollection(0); 00061 // -- Collection ID is correct, we get the pointer of the collection: 00062 if (astronautCollectionID>=0) astroCollection = (AstroHitCollection*)(event->GetHCofThisEvent()->GetHC(astronautCollectionID)); 00063 else G4cout << "Collection `AstronautCollection' not found !!!!" << G4endl; 00064 00065 // -- Question : why do we need to cast (AstroHitCollection*) two lines above ? 00066 00067 // -------------------------------------------- 00068 // -- print hits found for the 5 first events: 00069 // -------------------------------------------- 00070 if (event->GetEventID() < 5) 00071 { 00072 G4cout << "Event::EndOfEventAction(...) for event # " << event->GetEventID() << " : " << G4endl; 00073 // -- get back detector pointer to get astronaut mass: 00074 DetectorConstruction* detector = (DetectorConstruction*)(G4RunManager::GetRunManager()->GetUserDetectorConstruction()); 00075 G4double mass = detector->GetAstronaut()->GetLogicalVolume()->GetMass(); 00076 if (astroCollection) 00077 { 00078 // -- Now print: 00079 G4cout << " - number of hits : " << astroCollection->entries() << G4endl; 00080 if (astroCollection->entries()) G4cout << " - hit list : " << G4endl; 00081 else G4cout << " - hit list : (empty)" << G4endl; 00082 for (G4int i=0; i<astroCollection->entries(); i++) 00083 { 00084 AstroHit* hit = (*astroCollection)[i]; 00085 G4cout << " k = " << hit->GetSlice() 00086 << " , dose (gray) = " << hit->GetEnergy()/mass/gray 00087 << " , nb protons : " << hit->GetNbProton() 00088 << " , <eKin>(MeV) = " << hit->GetProtonMeanEkin()/MeV << G4endl; 00089 } 00090 } 00091 } 00092 00093 // ------------------------------------------ 00094 // -- fill the RunAction table for SD vector: 00095 // ------------------------------------------ 00096 if (astroCollection) 00097 { 00098 for (G4int i=0; i<astroCollection->entries(); i++) 00099 { 00100 AstroHit* hit = (*astroCollection)[i]; 00101 m_runAction->SumDepthDoseSD(hit->GetSlice(), 00102 hit->GetEnergy(), 00103 hit->GetNbProton(), 00104 hit->GetProtonTotalEkin()); 00105 } 00106 } 00107 }
void EventAction::AddEdep | ( | G4double | edep | ) | [inline] |
Definition at line 26 of file EventAction.hh.
Referenced by SteppingAction::UserSteppingAction().
00026 {m_edepPerEvent += edep;};
RunAction* EventAction::m_runAction [private] |
G4double EventAction::m_edepPerEvent [private] |
Definition at line 30 of file EventAction.hh.
Referenced by BeginOfEventAction(), and EndOfEventAction().
G4int EventAction::m_printModulo [private] |