Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RunAction.hh
Go to the documentation of this file.
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 //
28 //
29 // $Id$
30 //
31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33 
34 #ifndef RunAction_h
35 #define RunAction_h 1
36 
37 #include "G4UserRunAction.hh"
38 
39 #include "G4Gamma.hh"
40 #include "G4Electron.hh"
41 #include "G4Positron.hh"
42 
43 #include "globals.hh"
44 
45 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
46 
47 class G4Run;
50 class HistoManager;
51 
52 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
53 
54 class RunAction : public G4UserRunAction
55 {
56 
57 public:
58 
60  ~RunAction();
61 
62  virtual void BeginOfRunAction(const G4Run*);
63  virtual void EndOfRunAction(const G4Run*);
64 
66  {fEnergyDeposit += edep; fEnergyDeposit2 += edep*edep;};
67 
68  void AddTrakLenCharg (G4double length)
69  {fTrakLenCharged += length; fTrakLenCharged2 += length*length;};
70 
71  void AddTrakLenNeutr (G4double length)
72  {fTrakLenNeutral += length; fTrakLenNeutral2 += length*length;};
73 
75  {if (std::abs(theta) <= fMscThetaCentral) { fMscEntryCentral++;
76  fMscProjecTheta += theta; fMscProjecTheta2 += theta*theta;}
77  };
78 
79  void CountStepsCharg (G4int nSteps)
80  {fNbStepsCharged += nSteps; fNbStepsCharged2 += nSteps*nSteps;};
81 
82  void CountStepsNeutr (G4int nSteps)
83  {fNbStepsNeutral += nSteps; fNbStepsNeutral2 += nSteps*nSteps;};
84 
86  { if (part == G4Gamma::Gamma()) fNbGamma++ ;
87  else if (part == G4Electron::Electron()) fNbElect++ ;
88  else if (part == G4Positron::Positron()) fNbPosit++ ; };
89 
90  void CountTransmit (G4int flag)
91  { if (flag == 1) fTransmit[0]++;
92  else if (flag == 2) {fTransmit[0]++; fTransmit[1]++; }};
93 
94  void CountReflect (G4int flag)
95  { if (flag == 1) fReflect[0]++;
96  else if (flag == 2) {fReflect[0]++; fReflect[1]++; }};
97 
99 
101  { fEnergyLeak[index] += eleak; fEnergyLeak2[index] += eleak*eleak;};
102 
103  private:
104  G4double fEnergyDeposit, fEnergyDeposit2;
105  G4double fTrakLenCharged, fTrakLenCharged2;
106  G4double fTrakLenNeutral, fTrakLenNeutral2;
107  G4double fNbStepsCharged, fNbStepsCharged2;
108  G4double fNbStepsNeutral, fNbStepsNeutral2;
109  G4double fMscProjecTheta, fMscProjecTheta2;
110  G4double fMscThetaCentral;
111 
112  G4int fNbGamma, fNbElect, fNbPosit;
113  G4int fTransmit[2], fReflect[2];
114  G4int fMscEntryCentral;
115 
116  G4double fEnergyLeak[2], fEnergyLeak2[2];
117 
118  DetectorConstruction* fDetector;
119  PrimaryGeneratorAction* fPrimary;
120  HistoManager* fHistoManager;
121 };
122 
123 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
124 
125 #endif
126