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 "G4ParticleDefinition.hh"
40 #include "G4ThreeVector.hh"
41 #include "globals.hh"
42 
43 #include "g4root.hh"
46 
47 #include <vector>
48 typedef std::vector<G4double> MyVector;
49 
50 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
51 
54 class RunActionMessenger;
55 
56 class G4Run;
57 
58 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
59 
60 class RunAction : public G4UserRunAction
61 {
62  public:
63 
65  ~RunAction();
66 
67  virtual void BeginOfRunAction(const G4Run*);
68  virtual void EndOfRunAction(const G4Run*);
69 
70  void InitializePerEvent();
71  void FillPerEvent();
72  inline void FillPerTrack(G4double,G4double);
73  inline void FillPerStep (G4double,G4int,G4int);
74  inline void AddStep (G4double q);
75 
76  void SetVerbose(G4int val) {fVerbose = val;};
77 
78  // Acceptance parameters
80 
81  G4double GetAverageEdep() const {return fEdeptrue;};
82  G4double GetRMSEdep() const {return fRmstrue;};
83  G4double GetLimitEdep() const {return fLimittrue;};
84 
85  // Histogram name and type
86  void SetHistoName(G4String& val) {fHistoName[0] = val;};
87 
88  const G4String& GetHistoName() const {return fHistoName[1];};
89 
90  private:
91 
92  void BookHisto();
93  void CleanHisto();
94 
95  private:
96 
99  RunActionMessenger* fRunMessenger;
100 
101  G4int f_nLbin;
102  MyVector f_dEdL;
103  MyVector fSumELongit;
104  MyVector fSumE2Longit;
105  MyVector fSumELongitCumul;
106  MyVector fSumE2LongitCumul;
107 
108  G4int f_nRbin;
109  MyVector f_dEdR;
110  MyVector fSumERadial;
111  MyVector fSumE2Radial;
112  MyVector fSumERadialCumul;
113  MyVector fSumE2RadialCumul;
114 
115  G4double fChargTrLength;
116  G4double fSumChargTrLength;
117  G4double fSum2ChargTrLength;
118 
119  G4double fNeutrTrLength;
120  G4double fSumNeutrTrLength;
121  G4double fSum2NeutrTrLength;
122 
123  G4double fEdeptrue;
124  G4double fRmstrue;
125  G4double fLimittrue;
126 
127  G4double fChargedStep;
128  G4double fNeutralStep;
129 
130  G4int fVerbose;
131 
132  G4String fHistoName[2];
133 };
134 
135 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
136 
137 inline
139 {
140  if (charge != 0.) fChargTrLength += trkLength;
141  else fNeutrTrLength += trkLength;
142 }
143 
144 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
145 
146 inline
147 void RunAction::FillPerStep(G4double dEstep, G4int Lbin, G4int Rbin)
148 {
149  f_dEdL[Lbin] += dEstep; f_dEdR[Rbin] += dEstep;
150 }
151 
153 {
154  if (q == 0.0) { fNeutralStep += 1.0; }
155  else { fChargedStep += 1.0; }
156 }
157 
158 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
159 
160 #endif
161