EventAction Class Reference

#include <EventAction.hh>

Inheritance diagram for EventAction:

Inheritance graph
[legend]
Collaboration diagram for EventAction:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 EventAction (RunAction *)
 ~EventAction ()
void BeginOfEventAction (const G4Event *)
void EndOfEventAction (const G4Event *)
void AddEdep (G4double edep)

Private Attributes

RunActionm_runAction
G4double m_edepPerEvent
G4int m_printModulo


Detailed Description

Definition at line 16 of file EventAction.hh.


Constructor & Destructor Documentation

EventAction::EventAction ( RunAction run  ) 

Definition at line 20 of file EventAction.cc.

00021 :m_runAction(run), m_printModulo(5000)
00022 {}

EventAction::~EventAction (  ) 

Definition at line 26 of file EventAction.cc.

00027 {}


Member Function Documentation

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;};


Member Data Documentation

Definition at line 26 of file EventAction.hh.

Referenced by EndOfEventAction().

G4double EventAction::m_edepPerEvent [private]

Definition at line 30 of file EventAction.hh.

Referenced by BeginOfEventAction(), and EndOfEventAction().

G4int EventAction::m_printModulo [private]

Definition at line 31 of file EventAction.hh.

Referenced by BeginOfEventAction().


The documentation for this class was generated from the following files:

Generated on Fri Nov 21 10:21:11 2008 for jour4b3 by  doxygen 1.5.7.1