Geant4  10.00.p02
F01EventAction.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
28 //
29 //
30 // $Id: F01EventAction.cc 76248 2013-11-08 11:19:52Z gcosmo $
31 //
32 //
33 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
34 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
35 
36 #include "F01EventAction.hh"
37 
38 #include "F01RunAction.hh"
39 
40 #include "F01CalorHit.hh"
42 
43 #include "G4Event.hh"
44 #include "G4EventManager.hh"
45 #include "G4HCofThisEvent.hh"
46 #include "G4VHitsCollection.hh"
47 #include "G4SDManager.hh"
48 #include "Randomize.hh"
49 
50 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
51 
54  fCalorimeterCollID(-1),
55  fEventMessenger(0),
56  fRunAction(action),
57  fVerboseLevel(0),
58  fPrintModulo(10000)
59 {
61 }
62 
63 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
64 
66 {
67  delete fEventMessenger;
68 }
69 
70 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
71 
73 {
74  G4int evtNb = evt->GetEventID();
75  if (evtNb%fPrintModulo == 0)
76  G4cout << "\n---> Begin of Event: " << evtNb << G4endl;
77 
78  if (fVerboseLevel>1)
79  G4cout << "<<< Event " << evtNb << " started." << G4endl;
80 
81  if (fCalorimeterCollID==-1)
82  {
84  fCalorimeterCollID = sdManager->GetCollectionID("CalCollection");
85  }
86 }
87 
88 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
89 
91 {
92  if (fVerboseLevel>0)
93  G4cout << "<<< Event " << evt->GetEventID() << " ended." << G4endl;
94 
95  // save rndm status
96  if (fRunAction->GetRndmFreq() == 2)
97  {
98  G4Random::saveEngineStatus("endOfEvent.rndm");
99  G4int evtNb = evt->GetEventID();
100  if (evtNb%fPrintModulo == 0)
101  {
102  G4cout << "\n---> End of Event: " << evtNb << G4endl;
103  G4Random::showEngineStatus();
104  }
105  }
106 }
107 
108 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01EventAction(F01RunAction *F01RA)
G4int GetCollectionID(G4String colName)
Definition: G4SDManager.cc:131
virtual void BeginOfEventAction(const G4Event *)
Definition of the F01EventActionMessenger class.
int G4int
Definition: G4Types.hh:78
G4int GetEventID() const
Definition: G4Event.hh:140
G4GLOB_DLL std::ostream G4cout
virtual void EndOfEventAction(const G4Event *)
F01EventActionMessenger * fEventMessenger
Definition of the F01EventAction class.
virtual ~F01EventAction()
G4int fCalorimeterCollID
Definition of the F01CalorHit class.
G4int GetRndmFreq() const
Definition: F01RunAction.hh:57
Definition of the F01RunAction class.
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:40
#define G4endl
Definition: G4ios.hh:61
F01RunAction * fRunAction