Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
Em10EventAction Class Reference

#include <Em10EventAction.hh>

Inheritance diagram for Em10EventAction:
G4UserEventAction

Public Member Functions

 Em10EventAction (Em10RunAction *Em10RA)
 
 ~Em10EventAction ()
 
void BeginOfEventAction (const G4Event *)
 
void EndOfEventAction (const G4Event *)
 
G4int GetEventno ()
 
void setEventVerbose (G4int level)
 
void CountStepsCharged ()
 
void CountStepsNeutral ()
 
void AddCharged ()
 
void AddNeutral ()
 
void AddE ()
 
void AddP ()
 
void SetTr ()
 
void SetRef ()
 
void SetDrawFlag (G4String val)
 
void SetPrintModulo (G4int val)
 
- Public Member Functions inherited from G4UserEventAction
 G4UserEventAction ()
 
virtual ~G4UserEventAction ()
 
void SetEventManager (G4EventManager *value)
 

Additional Inherited Members

- Protected Attributes inherited from G4UserEventAction
G4EventManagerfpEventManager
 

Detailed Description

Definition at line 48 of file Em10EventAction.hh.

Constructor & Destructor Documentation

Em10EventAction::Em10EventAction ( Em10RunAction Em10RA)

Definition at line 56 of file Em10EventAction.cc.

57 :G4UserEventAction(),calorimeterCollID(-1),eventMessenger(0),
58  runaction(Em10RA),verboselevel(0),drawFlag("all"),printModulo(10000)
59 {
60  eventMessenger = new Em10EventActionMessenger(this);
61 }
Em10EventAction::~Em10EventAction ( )

Definition at line 65 of file Em10EventAction.cc.

66 {
67  delete eventMessenger;
68 }

Member Function Documentation

void Em10EventAction::AddCharged ( )

Definition at line 192 of file Em10EventAction.cc.

Referenced by Em10SteppingAction::UserSteppingAction().

193 {
194  Nch += 1.;
195 }
void Em10EventAction::AddE ( )

Definition at line 206 of file Em10EventAction.cc.

Referenced by Em10SteppingAction::UserSteppingAction().

207 {
208  NE += 1.;
209 }
Definition: Evaluator.cc:66
void Em10EventAction::AddNeutral ( )

Definition at line 199 of file Em10EventAction.cc.

Referenced by Em10SteppingAction::UserSteppingAction().

200 {
201  Nne += 1.;
202 }
void Em10EventAction::AddP ( )

Definition at line 213 of file Em10EventAction.cc.

Referenced by Em10SteppingAction::UserSteppingAction().

214 {
215  NP += 1.;
216 }
void Em10EventAction::BeginOfEventAction ( const G4Event evt)
virtual

Reimplemented from G4UserEventAction.

Definition at line 72 of file Em10EventAction.cc.

References G4cout, G4endl, G4SDManager::GetCollectionID(), G4Event::GetEventID(), and G4SDManager::GetSDMpointer().

73 {
74  G4int evtNb = evt->GetEventID();
75  if (evtNb%printModulo == 0)
76  G4cout << "\n---> Begin of Event: " << evtNb << G4endl;
77 
78  if(verboselevel>1)
79  G4cout << "<<< Event " << evtNb << " started." << G4endl;
80 
81  if (calorimeterCollID==-1)
82  {
84  calorimeterCollID = SDman->GetCollectionID("CalCollection");
85  }
86 
87  nstep = 0. ;
88  nstepCharged = 0. ;
89  nstepNeutral = 0. ;
90  Nch = 0. ;
91  Nne = 0. ;
92  NE=0.;
93  NP=0.;
94  Transmitted=0.;
95  Reflected =0.;
96 }
Definition: Evaluator.cc:66
G4int GetCollectionID(G4String colName)
Definition: G4SDManager.cc:131
int G4int
Definition: G4Types.hh:78
G4int GetEventID() const
Definition: G4Event.hh:140
G4GLOB_DLL std::ostream G4cout
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:40
#define G4endl
Definition: G4ios.hh:61
void Em10EventAction::CountStepsCharged ( )

Definition at line 178 of file Em10EventAction.cc.

Referenced by Em10SteppingAction::UserSteppingAction().

179 {
180  nstepCharged += 1. ;
181 }
void Em10EventAction::CountStepsNeutral ( )

Definition at line 185 of file Em10EventAction.cc.

Referenced by Em10SteppingAction::UserSteppingAction().

186 {
187  nstepNeutral += 1. ;
188 }
void Em10EventAction::EndOfEventAction ( const G4Event evt)
virtual

Reimplemented from G4UserEventAction.

Definition at line 100 of file Em10EventAction.cc.

References Em10RunAction::AddEdeps(), Em10RunAction::AddEP(), Em10RunAction::AddnStepsCharged(), Em10RunAction::AddnStepsNeutral(), Em10RunAction::AddTrackLength(), Em10RunAction::AddTrRef(), Em10RunAction::CountEvent(), Em10RunAction::CountParticles(), G4THitsCollection< T >::entries(), Em10RunAction::FillEn(), Em10RunAction::FillNbOfSteps(), G4BestUnit, G4cout, G4endl, G4Event::GetEventID(), G4HCofThisEvent::GetHC(), G4Event::GetHCofThisEvent(), Em10RunAction::GetRndmFreq(), CLHEP::HepRandom::saveEngineStatus(), and CLHEP::HepRandom::showEngineStatus().

101 {
102  G4HCofThisEvent* HCE = evt->GetHCofThisEvent();
103  Em10CalorHitsCollection* CHC = 0;
104  if (HCE)
105  CHC = (Em10CalorHitsCollection*)(HCE->GetHC(calorimeterCollID));
106 
107  if (CHC)
108  {
109  int n_hit = CHC->entries();
110  // if(verboselevel==2)
111  // G4cout << " " << n_hit
112  // << " hits are stored in Em10CalorHitsCollection." << G4endl;
113 
114  G4double totEAbs=0, totLAbs=0;
115  for (int i=0;i<n_hit;i++)
116  { totEAbs += (*CHC)[i]->GetEdepAbs();
117  totLAbs += (*CHC)[i]->GetTrakAbs();
118  }
119  if(verboselevel==2)
120  G4cout
121  << " Absorber: total energy: " << std::setw(7) <<
122  G4BestUnit(totEAbs,"Energy")
123  << " total track length: " << std::setw(7) <<
124  G4BestUnit(totLAbs,"Length")
125  << G4endl;
126 
127  // count event, add deposits to the sum ...
128  runaction->CountEvent() ;
129  runaction->AddTrackLength(totLAbs) ;
130  runaction->AddnStepsCharged(nstepCharged) ;
131  runaction->AddnStepsNeutral(nstepNeutral) ;
132  if(verboselevel==2)
133  G4cout << " Ncharged=" << Nch << " , Nneutral=" << Nne << G4endl;
134  runaction->CountParticles(Nch,Nne);
135  runaction->AddEP(NE,NP);
136  runaction->AddTrRef(Transmitted,Reflected) ;
137  runaction->AddEdeps(totEAbs) ;
138  runaction->FillEn(totEAbs) ;
139 
140  nstep=nstepCharged+nstepNeutral ;
141  runaction->FillNbOfSteps(nstep);
142  }
143 
144  if(verboselevel>0)
145  G4cout << "<<< Event " << evt->GetEventID() << " ended." << G4endl;
146 
147 
148  //save rndm status
149  if (runaction->GetRndmFreq() == 2)
150  {
151  CLHEP::HepRandom::saveEngineStatus("endOfEvent.rndm");
152  G4int evtNb = evt->GetEventID();
153  if (evtNb%printModulo == 0)
154  {
155  G4cout << "\n---> End of Event: " << evtNb << G4endl;
157  }
158  }
159 }
Definition: Evaluator.cc:66
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
void FillNbOfSteps(G4double nstep)
G4int GetRndmFreq()
int G4int
Definition: G4Types.hh:78
void CountParticles(G4double, G4double)
G4int GetEventID() const
Definition: G4Event.hh:140
void FillEn(G4double En)
G4GLOB_DLL std::ostream G4cout
void AddEdeps(G4double Eabs)
static void showEngineStatus()
Definition: Random.cc:203
static void saveEngineStatus(const char filename[]="Config.conf")
Definition: Random.cc:175
void AddTrRef(G4double tr, G4double ref)
#define G4endl
Definition: G4ios.hh:61
void AddnStepsNeutral(G4double ns)
G4HCofThisEvent * GetHCofThisEvent() const
Definition: G4Event.hh:174
double G4double
Definition: G4Types.hh:76
void AddnStepsCharged(G4double ns)
void AddTrackLength(G4double tlabs)
void AddEP(G4double, G4double)
G4int Em10EventAction::GetEventno ( )

Definition at line 163 of file Em10EventAction.cc.

References G4UserEventAction::fpEventManager, G4EventManager::GetConstCurrentEvent(), and G4Event::GetEventID().

Referenced by Em10SteppingAction::UserSteppingAction().

164 {
166  return evno ;
167 }
G4EventManager * fpEventManager
int G4int
Definition: G4Types.hh:78
G4int GetEventID() const
Definition: G4Event.hh:140
const G4Event * GetConstCurrentEvent()
void Em10EventAction::SetDrawFlag ( G4String  val)
inline

Definition at line 69 of file Em10EventAction.hh.

Referenced by Em10EventActionMessenger::SetNewValue().

69 {drawFlag = val;};
void Em10EventAction::setEventVerbose ( G4int  level)

Definition at line 171 of file Em10EventAction.cc.

Referenced by Em10EventActionMessenger::SetNewValue().

172 {
173  verboselevel = level ;
174 }
void Em10EventAction::SetPrintModulo ( G4int  val)
inline

Definition at line 70 of file Em10EventAction.hh.

Referenced by Em10EventActionMessenger::SetNewValue().

70 {printModulo = val;};
void Em10EventAction::SetRef ( )

Definition at line 227 of file Em10EventAction.cc.

Referenced by Em10SteppingAction::UserSteppingAction().

228 {
229  Reflected = 1.;
230 }
void Em10EventAction::SetTr ( )

Definition at line 220 of file Em10EventAction.cc.

Referenced by Em10SteppingAction::UserSteppingAction().

221 {
222  Transmitted = 1.;
223 }

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