source: trunk/geant4/N03/src/ExN03EventAction.cc @ 609

Last change on this file since 609 was 609, checked in by garnier, 17 years ago

r659@mac-90108: laurentgarnier | 2007-11-16 12:02:01 +0100
mise a jour de Geant4 au head ET qq mise a jour pour Qt de mon cote

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