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

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

update

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.8 2007/11/21 17:41:19 maire Exp $
27// GEANT4 tag $Name: $
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 public:
55 RunAction(DetectorConstruction*, PrimaryGeneratorAction*, HistoManager*);
56 ~RunAction();
57
58 public:
59 void BeginOfRunAction(const G4Run*);
60 void EndOfRunAction(const G4Run*);
61
62 void AddEnergy (G4double edep)
63 {EnergyDeposit += edep; EnergyDeposit2 += edep*edep;};
64
65 void AddTrakLenCharg (G4double length)
66 {TrakLenCharged += length; TrakLenCharged2 += length*length;};
67
68 void AddTrakLenNeutr (G4double length)
69 {TrakLenNeutral += length; TrakLenNeutral2 += length*length;};
70
71 void AddMscProjTheta (G4double theta)
72 {if (std::abs(theta) <= MscThetaCentral) { MscEntryCentral++;
73 MscProjecTheta += theta; MscProjecTheta2 += theta*theta;}
74 };
75
76 void CountStepsCharg (G4int nSteps)
77 {nbStepsCharged += nSteps; nbStepsCharged2 += nSteps*nSteps;};
78
79 void CountStepsNeutr (G4int nSteps)
80 {nbStepsNeutral += nSteps; nbStepsNeutral2 += nSteps*nSteps;};
81
82 void CountParticles (G4ParticleDefinition* part)
83 { if (part == G4Gamma::Gamma()) nbGamma++ ;
84 else if (part == G4Electron::Electron()) nbElect++ ;
85 else if (part == G4Positron::Positron()) nbPosit++ ; };
86
87 void CountTransmit (G4int flag)
88 { if (flag == 1) Transmit[0]++;
89 else if (flag == 2) {Transmit[0]++; Transmit[1]++; }};
90
91 void CountReflect (G4int flag)
92 { if (flag == 1) Reflect[0]++;
93 else if (flag == 2) {Reflect[0]++; Reflect[1]++; }};
94
95 G4double ComputeMscHighland();
96
97 void AddEnergyLeak (G4double eleak, G4int index)
98 { EnergyLeak[index] += eleak; EnergyLeak2[index] += eleak*eleak;};
99
100 private:
101 G4double EnergyDeposit, EnergyDeposit2;
102 G4double TrakLenCharged, TrakLenCharged2;
103 G4double TrakLenNeutral, TrakLenNeutral2;
104 G4double nbStepsCharged, nbStepsCharged2;
105 G4double nbStepsNeutral, nbStepsNeutral2;
106 G4double MscProjecTheta, MscProjecTheta2;
107 G4double MscThetaCentral;
108
109 G4int nbGamma, nbElect, nbPosit;
110 G4int Transmit[2], Reflect[2];
111 G4int MscEntryCentral;
112
113 G4double EnergyLeak[2], EnergyLeak2[2];
114
115 DetectorConstruction* detector;
116 PrimaryGeneratorAction* primary;
117 HistoManager* histoManager;
118};
119
120//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
121
122#endif
123
Note: See TracBrowser for help on using the repository browser.