source: trunk/examples/extended/field/field02/src/F02EventAction.cc@ 1353

Last change on this file since 1353 was 1337, checked in by garnier, 15 years ago

tag geant4.9.4 beta 1 + modifs locales

File size: 4.2 KB
Line 
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//
26//
27// $Id: F02EventAction.cc,v 1.7 2010/06/06 04:55:59 perl Exp $
28// GEANT4 tag $Name: geant4-09-04-beta-01 $
29//
30//
31
32//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
33//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
34
35#include "F02EventAction.hh"
36
37#include "F02RunAction.hh"
38
39#include "F02CalorHit.hh"
40#include "F02EventActionMessenger.hh"
41
42#include "G4Event.hh"
43#include "G4EventManager.hh"
44#include "G4HCofThisEvent.hh"
45#include "G4VHitsCollection.hh"
46#include "G4SDManager.hh"
47#include "G4ios.hh"
48#include "G4UnitsTable.hh"
49#include "Randomize.hh"
50
51//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
52
53F02EventAction::F02EventAction(F02RunAction* F02RA)
54 : calorimeterCollID(-1), eventMessenger(0),
55 runaction(F02RA), verboselevel(0),
56 drawFlag("all"), printModulo(10000)
57{
58 eventMessenger = new F02EventActionMessenger(this);
59}
60
61//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
62
63F02EventAction::~F02EventAction()
64{
65 delete eventMessenger;
66}
67
68//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
69
70void F02EventAction::BeginOfEventAction(const G4Event* evt)
71{
72 G4int evtNb = evt->GetEventID();
73 if (evtNb%printModulo == 0)
74 G4cout << "\n---> Begin of Event: " << evtNb << G4endl;
75
76 if(verboselevel>1)
77 G4cout << "<<< Event " << evtNb << " started." << G4endl;
78
79 if (calorimeterCollID==-1)
80 {
81 G4SDManager * SDman = G4SDManager::GetSDMpointer();
82 calorimeterCollID = SDman->GetCollectionID("CalCollection");
83 }
84}
85
86//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
87
88void F02EventAction::EndOfEventAction(const G4Event* evt)
89{
90 if(verboselevel>0)
91 G4cout << "<<< Event " << evt->GetEventID() << " ended." << G4endl;
92
93 // save rndm status
94 if (runaction->GetRndmFreq() == 2)
95 {
96 CLHEP::HepRandom::saveEngineStatus("endOfEvent.rndm");
97 G4int evtNb = evt->GetEventID();
98 if (evtNb%printModulo == 0)
99 {
100 G4cout << "\n---> End of Event: " << evtNb << G4endl;
101 CLHEP::HepRandom::showEngineStatus();
102 }
103 }
104}
105
106//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
107
108G4int F02EventAction::GetEventno()
109{
110 G4int evno = fpEventManager->GetConstCurrentEvent()->GetEventID() ;
111 return evno ;
112}
113
114//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
115
116void F02EventAction::setEventVerbose(G4int level)
117{
118 verboselevel = level ;
119}
120
121//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Note: See TracBrowser for help on using the repository browser.