Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RE01EventAction Class Reference

#include <RE01EventAction.hh>

Inheritance diagram for RE01EventAction:
Collaboration diagram for RE01EventAction:

Public Member Functions

 RE01EventAction ()
 
virtual ~RE01EventAction ()
 
virtual void BeginOfEventAction (const G4Event *)
 
virtual void EndOfEventAction (const G4Event *)
 
- Public Member Functions inherited from G4UserEventAction
 G4UserEventAction ()
 
virtual ~G4UserEventAction ()
 
virtual void SetEventManager (G4EventManager *value)
 

Additional Inherited Members

- Protected Attributes inherited from G4UserEventAction
G4EventManagerfpEventManager
 

Detailed Description

Definition at line 40 of file RE01EventAction.hh.

Constructor & Destructor Documentation

RE01EventAction::RE01EventAction ( )

Definition at line 51 of file RE01EventAction.cc.

53  fTrackerCollID(-1),fCalorimeterCollID(-1)
54 {;}
RE01EventAction::~RE01EventAction ( )
virtual

Definition at line 57 of file RE01EventAction.cc.

58 {;}

Member Function Documentation

void RE01EventAction::BeginOfEventAction ( const G4Event )
virtual

Reimplemented from G4UserEventAction.

Definition at line 61 of file RE01EventAction.cc.

62 {
64  if(fTrackerCollID<0||fCalorimeterCollID<0)
65  {
66  G4String colNam;
67  fTrackerCollID = SDman->GetCollectionID(colNam="trackerCollection");
68  fCalorimeterCollID = SDman->GetCollectionID(colNam="calCollection");
69  }
70 }
G4int GetCollectionID(G4String colName)
Definition: G4SDManager.cc:135
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:40

Here is the call graph for this function:

void RE01EventAction::EndOfEventAction ( const G4Event evt)
virtual

Reimplemented from G4UserEventAction.

Definition at line 73 of file RE01EventAction.cc.

74 {
75  G4cout << ">>> Summary of Event " << evt->GetEventID() << G4endl;
76  if(evt->GetNumberOfPrimaryVertex()==0)
77  {
78  G4cout << "Event is empty." << G4endl;
79  return;
80  }
81 
82  if(fTrackerCollID<0||fCalorimeterCollID<0) return;
83 
84  G4HCofThisEvent * HCE = evt->GetHCofThisEvent();
87  if(HCE)
88  {
89  THC = (RE01TrackerHitsCollection*)(HCE->GetHC(fTrackerCollID));
90  CHC = (RE01CalorimeterHitsCollection*)(HCE->GetHC(fCalorimeterCollID));
91  }
92 
93  if(THC)
94  {
95  int n_hit = THC->entries();
96  G4cout << G4endl;
97  G4cout << "Tracker hits " <<
98  "--------------------------------------------------------------"
99  << G4endl;
100  G4cout << n_hit << " hits are stored in RE01TrackerHitsCollection."
101  << G4endl;
103  {
104  G4cout << "List of hits in tracker" << G4endl;
105  for(int i=0;i<n_hit;i++)
106  { (*THC)[i]->Print(); }
107  }
108  }
109  if(CHC)
110  {
111  int n_hit = CHC->entries();
112  G4cout << G4endl;
113  G4cout << "Calorimeter hits "<<
114  "--------------------------------------------------------------"
115  << G4endl;
116  G4cout << n_hit << " hits are stored in RE01CalorimeterHitsCollection."
117  << G4endl;
118  G4double totE = 0;
119  for(int i=0;i<n_hit;i++)
120  { totE += (*CHC)[i]->GetEdep(); }
121  G4cout << " Total energy deposition in calorimeter : "
122  << totE / GeV << " (GeV)" << G4endl;
123  }
124 
125  // get number of stored trajectories
126  G4TrajectoryContainer* trajectoryContainer = evt->GetTrajectoryContainer();
127  G4int n_trajectories = 0;
128  if (trajectoryContainer) n_trajectories = trajectoryContainer->entries();
129  // extract the trajectories and print them out
130  G4cout << G4endl;
131  G4cout << "Trajectories in tracker "<<
132  "--------------------------------------------------------------"
133  << G4endl;
135  {
136  for(G4int i=0; i<n_trajectories; i++)
137  {
138  RE01Trajectory* trj =
139  (RE01Trajectory*)((*(evt->GetTrajectoryContainer()))[i]);
140  trj->ShowTrajectory();
141  }
142  }
143 
144  G4cout << G4endl;
145  G4cout << "Primary particles "<<
146  "--------------------------------------------------------------"
147  << G4endl;
148  G4int n_vertex = evt->GetNumberOfPrimaryVertex();
149  for(G4int iv=0;iv<n_vertex;iv++)
150  {
151  G4PrimaryVertex* pv = evt->GetPrimaryVertex(iv);
152  G4cout << G4endl;
153  G4cout << "Primary vertex "
154  << G4ThreeVector(pv->GetX0(),pv->GetY0(),pv->GetZ0())
155  << " at t = " << (pv->GetT0())/ns << " [ns]" << G4endl;
157  {
159  while(pp)
160  {
161  PrintPrimary(pp,0);
162  pp = pp->GetNext();
163  }
164  }
165  }
166 }
G4double GetX0() const
G4VHitsCollection * GetHC(G4int i)
CLHEP::Hep3Vector G4ThreeVector
G4int GetNumberOfPrimaryVertex() const
Definition: G4Event.hh:164
virtual void ShowTrajectory(std::ostream &os=G4cout) const
G4int entries() const
G4double GetT0() const
G4EventManager * fpEventManager
int G4int
Definition: G4Types.hh:78
G4TrajectoryContainer * GetTrajectoryContainer() const
Definition: G4Event.hh:189
G4int GetEventID() const
Definition: G4Event.hh:151
G4PrimaryParticle * GetPrimary(G4int i=0) const
G4GLOB_DLL std::ostream G4cout
G4double GetZ0() const
G4PrimaryVertex * GetPrimaryVertex(G4int i=0) const
Definition: G4Event.hh:167
G4PrimaryParticle * GetNext() const
G4int GetVerboseLevel()
static constexpr double GeV
Definition: G4SIunits.hh:217
G4double GetY0() const
#define G4endl
Definition: G4ios.hh:61
G4HCofThisEvent * GetHCofThisEvent() const
Definition: G4Event.hh:185
double G4double
Definition: G4Types.hh:76
#define ns
Definition: xmlparse.cc:614

Here is the call graph for this function:


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