source: trunk/examples/novice/N03/src/ExN03EventAction.cc@ 1341

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

tag geant4.9.4 beta 1 + modifs locales

File size: 3.9 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: ExN03EventAction.cc,v 1.30 2010/06/06 04:06:26 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 "ExN03EventAction.hh"
36
37#include "ExN03RunAction.hh"
38#include "ExN03EventActionMessenger.hh"
39
40#include "G4Event.hh"
41#include "G4UnitsTable.hh"
42
43#include "Randomize.hh"
44#include <iomanip>
45
46//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
47
48ExN03EventAction::ExN03EventAction(ExN03RunAction* run)
49:runAct(run),printModulo(1),eventMessenger(0)
50{
51 eventMessenger = new ExN03EventActionMessenger(this);
52}
53
54//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
55
56ExN03EventAction::~ExN03EventAction()
57{
58 delete eventMessenger;
59}
60
61//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
62
63void ExN03EventAction::BeginOfEventAction(const G4Event* evt)
64{
65 G4int evtNb = evt->GetEventID();
66 if (evtNb%printModulo == 0) {
67 G4cout << "\n---> Begin of event: " << evtNb << G4endl;
68 CLHEP::HepRandom::showEngineStatus();
69}
70
71 // initialisation per event
72 EnergyAbs = EnergyGap = 0.;
73 TrackLAbs = TrackLGap = 0.;
74}
75
76//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
77
78void ExN03EventAction::EndOfEventAction(const G4Event* evt)
79{
80 //accumulates statistic
81 //
82 runAct->fillPerEvent(EnergyAbs, EnergyGap, TrackLAbs, TrackLGap);
83
84 //print per event (modulo n)
85 //
86 G4int evtNb = evt->GetEventID();
87 if (evtNb%printModulo == 0) {
88 G4cout << "---> End of event: " << evtNb << G4endl;
89
90 G4cout
91 << " Absorber: total energy: " << std::setw(7)
92 << G4BestUnit(EnergyAbs,"Energy")
93 << " total track length: " << std::setw(7)
94 << G4BestUnit(TrackLAbs,"Length")
95 << G4endl
96 << " Gap: total energy: " << std::setw(7)
97 << G4BestUnit(EnergyGap,"Energy")
98 << " total track length: " << std::setw(7)
99 << G4BestUnit(TrackLGap,"Length")
100 << G4endl;
101
102 }
103}
104
105//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Note: See TracBrowser for help on using the repository browser.