Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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$
31 //
32 //
33 
34 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
35 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
36 
37 #include "F01EventAction.hh"
38 
39 #include "F01RunAction.hh"
40 
41 #include "F01CalorHit.hh"
43 
44 #include "G4Event.hh"
45 #include "G4EventManager.hh"
46 #include "G4HCofThisEvent.hh"
47 #include "G4VHitsCollection.hh"
48 #include "G4SDManager.hh"
49 #include "G4ios.hh"
50 #include "G4UnitsTable.hh"
51 #include "Randomize.hh"
52 
53 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
54 
57  fCalorimeterCollID(-1),
58  fEventMessenger(0),
59  fRunAction(F01RA),
60  fVerboseLevel(0),
61  fPrintModulo(10000)
62 {
63  fEventMessenger = new F01EventActionMessenger(this);
64 }
65 
66 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
67 
69 {
70  delete fEventMessenger;
71 }
72 
73 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
74 
76 {
77  G4int evtNb = evt->GetEventID();
78  if (evtNb%fPrintModulo == 0)
79  G4cout << "\n---> Begin of Event: " << evtNb << G4endl;
80 
81  if (fVerboseLevel>1)
82  G4cout << "<<< Event " << evtNb << " started." << G4endl;
83 
84  if (fCalorimeterCollID==-1)
85  {
87  fCalorimeterCollID = SDman->GetCollectionID("CalCollection");
88  }
89 }
90 
91 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
92 
94 {
95  if (fVerboseLevel>0)
96  G4cout << "<<< Event " << evt->GetEventID() << " ended." << G4endl;
97 
98 
99  //save rndm status
100  if (fRunAction->GetRndmFreq() == 2)
101  {
102  CLHEP::HepRandom::saveEngineStatus("endOfEvent.rndm");
103  G4int evtNb = evt->GetEventID();
104  if (evtNb%fPrintModulo == 0)
105  {
106  G4cout << "\n---> End of Event: " << evtNb << G4endl;
108  }
109  }
110 }
111 
112 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
113 
115 {
116  fVerboseLevel = level ;
117 }
118 
119 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....