source: trunk/examples/extended/electromagnetic/TestEm5/include/RunAction.hh@ 1303

Last change on this file since 1303 was 1230, checked in by garnier, 16 years ago

update to geant4.9.3

File size: 4.7 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// $Id: RunAction.hh,v 1.9 2009/01/22 17:41:43 vnivanch Exp $
27// GEANT4 tag $Name: geant4-09-03-cand-01 $
28//
29//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
30//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
31
32#ifndef RunAction_h
33#define RunAction_h 1
34
35#include "G4UserRunAction.hh"
36
37#include "G4Gamma.hh"
38#include "G4Electron.hh"
39#include "G4Positron.hh"
40
41#include "globals.hh"
42
43//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
44
45class G4Run;
46class DetectorConstruction;
47class PrimaryGeneratorAction;
48class HistoManager;
49
50//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
51
52class RunAction : public G4UserRunAction
53{
54
55public:
56
57 RunAction(DetectorConstruction*, PrimaryGeneratorAction*, HistoManager*);
58 virtual ~RunAction();
59
60 void BeginOfRunAction(const G4Run*);
61 void EndOfRunAction(const G4Run*);
62
63 void AddEnergy (G4double edep)
64 {EnergyDeposit += edep; EnergyDeposit2 += edep*edep;};
65
66 void AddTrakLenCharg (G4double length)
67 {TrakLenCharged += length; TrakLenCharged2 += length*length;};
68
69 void AddTrakLenNeutr (G4double length)
70 {TrakLenNeutral += length; TrakLenNeutral2 += length*length;};
71
72 void AddMscProjTheta (G4double theta)
73 {if (std::abs(theta) <= MscThetaCentral) { MscEntryCentral++;
74 MscProjecTheta += theta; MscProjecTheta2 += theta*theta;}
75 };
76
77 void CountStepsCharg (G4int nSteps)
78 {nbStepsCharged += nSteps; nbStepsCharged2 += nSteps*nSteps;};
79
80 void CountStepsNeutr (G4int nSteps)
81 {nbStepsNeutral += nSteps; nbStepsNeutral2 += nSteps*nSteps;};
82
83 void CountParticles (G4ParticleDefinition* part)
84 { if (part == G4Gamma::Gamma()) nbGamma++ ;
85 else if (part == G4Electron::Electron()) nbElect++ ;
86 else if (part == G4Positron::Positron()) nbPosit++ ; };
87
88 void CountTransmit (G4int flag)
89 { if (flag == 1) Transmit[0]++;
90 else if (flag == 2) {Transmit[0]++; Transmit[1]++; }};
91
92 void CountReflect (G4int flag)
93 { if (flag == 1) Reflect[0]++;
94 else if (flag == 2) {Reflect[0]++; Reflect[1]++; }};
95
96 G4double ComputeMscHighland();
97
98 void AddEnergyLeak (G4double eleak, G4int index)
99 { EnergyLeak[index] += eleak; EnergyLeak2[index] += eleak*eleak;};
100
101 private:
102 G4double EnergyDeposit, EnergyDeposit2;
103 G4double TrakLenCharged, TrakLenCharged2;
104 G4double TrakLenNeutral, TrakLenNeutral2;
105 G4double nbStepsCharged, nbStepsCharged2;
106 G4double nbStepsNeutral, nbStepsNeutral2;
107 G4double MscProjecTheta, MscProjecTheta2;
108 G4double MscThetaCentral;
109
110 G4int nbGamma, nbElect, nbPosit;
111 G4int Transmit[2], Reflect[2];
112 G4int MscEntryCentral;
113
114 G4double EnergyLeak[2], EnergyLeak2[2];
115
116 DetectorConstruction* detector;
117 PrimaryGeneratorAction* primary;
118 HistoManager* histoManager;
119};
120
121//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
122
123#endif
124
Note: See TracBrowser for help on using the repository browser.