| 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 2006/06/29 16:49:59 gunter 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 "G4ParticleDefinition.hh"
|
|---|
| 38 | #include "G4ThreeVector.hh"
|
|---|
| 39 | #include "globals.hh"
|
|---|
| 40 |
|
|---|
| 41 | #include <vector>
|
|---|
| 42 |
|
|---|
| 43 | typedef std::vector<G4double> MyVector;
|
|---|
| 44 |
|
|---|
| 45 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
|---|
| 46 |
|
|---|
| 47 | class DetectorConstruction;
|
|---|
| 48 | class PrimaryGeneratorAction;
|
|---|
| 49 | class RunActionMessenger;
|
|---|
| 50 |
|
|---|
| 51 | class G4Run;
|
|---|
| 52 |
|
|---|
| 53 | namespace AIDA {
|
|---|
| 54 | class IAnalysisFactory;
|
|---|
| 55 | class ITree;
|
|---|
| 56 | class IHistogram1D;
|
|---|
| 57 | }
|
|---|
| 58 |
|
|---|
| 59 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
|---|
| 60 |
|
|---|
| 61 | class RunAction : public G4UserRunAction
|
|---|
| 62 | {
|
|---|
| 63 | public:
|
|---|
| 64 |
|
|---|
| 65 | RunAction(DetectorConstruction*, PrimaryGeneratorAction*);
|
|---|
| 66 | ~RunAction();
|
|---|
| 67 |
|
|---|
| 68 | void BeginOfRunAction(const G4Run*);
|
|---|
| 69 | void EndOfRunAction(const G4Run*);
|
|---|
| 70 |
|
|---|
| 71 | inline void initializePerEvent();
|
|---|
| 72 | void fillPerEvent();
|
|---|
| 73 | inline void fillPerTrack(G4double,G4double);
|
|---|
| 74 | inline void fillPerStep (G4double,G4int,G4int);
|
|---|
| 75 |
|
|---|
| 76 | void SetVerbose(G4int val) {verbose = val;};
|
|---|
| 77 |
|
|---|
| 78 | // Acceptance parameters
|
|---|
| 79 | void SetEdepAndRMS(G4ThreeVector);
|
|---|
| 80 |
|
|---|
| 81 | G4double GetAverageEdep() const {return edeptrue;};
|
|---|
| 82 | G4double GetRMSEdep() const {return rmstrue;};
|
|---|
| 83 | G4double GetLimitEdep() const {return limittrue;};
|
|---|
| 84 |
|
|---|
| 85 | // Histogram name and type
|
|---|
| 86 | void SetHistoName(G4String& val) {histoName[0] = val;};
|
|---|
| 87 | void SetHistoType(G4String& val) {histoType = val;};
|
|---|
| 88 |
|
|---|
| 89 | const G4String& GetHistoName() const {return histoName[1];};
|
|---|
| 90 | const G4String& GetHistoType() const {return histoType;};
|
|---|
| 91 |
|
|---|
| 92 | private:
|
|---|
| 93 |
|
|---|
| 94 | void bookHisto();
|
|---|
| 95 | void cleanHisto();
|
|---|
| 96 |
|
|---|
| 97 | private:
|
|---|
| 98 |
|
|---|
| 99 | DetectorConstruction* Det;
|
|---|
| 100 | PrimaryGeneratorAction* Kin;
|
|---|
| 101 | RunActionMessenger* runMessenger;
|
|---|
| 102 |
|
|---|
| 103 | G4int nLbin;
|
|---|
| 104 | MyVector dEdL;
|
|---|
| 105 | MyVector sumELongit;
|
|---|
| 106 | MyVector sumE2Longit;
|
|---|
| 107 | MyVector sumELongitCumul;
|
|---|
| 108 | MyVector sumE2LongitCumul;
|
|---|
| 109 |
|
|---|
| 110 | G4int nRbin;
|
|---|
| 111 | MyVector dEdR;
|
|---|
| 112 | MyVector sumERadial;
|
|---|
| 113 | MyVector sumE2Radial;
|
|---|
| 114 | MyVector sumERadialCumul;
|
|---|
| 115 | MyVector sumE2RadialCumul;
|
|---|
| 116 |
|
|---|
| 117 | G4double ChargTrLength;
|
|---|
| 118 | G4double sumChargTrLength;
|
|---|
| 119 | G4double sum2ChargTrLength;
|
|---|
| 120 |
|
|---|
| 121 | G4double NeutrTrLength;
|
|---|
| 122 | G4double sumNeutrTrLength;
|
|---|
| 123 | G4double sum2NeutrTrLength;
|
|---|
| 124 |
|
|---|
| 125 | G4double edeptrue;
|
|---|
| 126 | G4double rmstrue;
|
|---|
| 127 | G4double limittrue;
|
|---|
| 128 |
|
|---|
| 129 | G4int verbose;
|
|---|
| 130 |
|
|---|
| 131 | G4String histoName[2];
|
|---|
| 132 | G4String histoType;
|
|---|
| 133 |
|
|---|
| 134 | AIDA::IAnalysisFactory* af;
|
|---|
| 135 | AIDA::ITree* tree;
|
|---|
| 136 | AIDA::IHistogram1D* histo[9];
|
|---|
| 137 | };
|
|---|
| 138 |
|
|---|
| 139 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
|---|
| 140 |
|
|---|
| 141 | inline
|
|---|
| 142 | void RunAction::initializePerEvent()
|
|---|
| 143 | {
|
|---|
| 144 | //initialize arrays of energy deposit per bin
|
|---|
| 145 | for (G4int i=0; i<nLbin; i++)
|
|---|
| 146 | { dEdL[i] = 0.; }
|
|---|
| 147 |
|
|---|
| 148 | for (G4int j=0; j<nRbin; j++)
|
|---|
| 149 | { dEdR[j] = 0.; }
|
|---|
| 150 |
|
|---|
| 151 | //initialize tracklength
|
|---|
| 152 | ChargTrLength = NeutrTrLength = 0.;
|
|---|
| 153 | }
|
|---|
| 154 |
|
|---|
| 155 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
|---|
| 156 |
|
|---|
| 157 | inline
|
|---|
| 158 | void RunAction::fillPerTrack(G4double charge, G4double trkLength)
|
|---|
| 159 | {
|
|---|
| 160 | if (charge != 0.) ChargTrLength += trkLength;
|
|---|
| 161 | else NeutrTrLength += trkLength;
|
|---|
| 162 | }
|
|---|
| 163 |
|
|---|
| 164 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
|---|
| 165 |
|
|---|
| 166 | inline
|
|---|
| 167 | void RunAction::fillPerStep(G4double dEstep, G4int Lbin, G4int Rbin)
|
|---|
| 168 | {
|
|---|
| 169 | dEdL[Lbin] += dEstep; dEdR[Rbin] += dEstep;
|
|---|
| 170 | }
|
|---|
| 171 |
|
|---|
| 172 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
|---|
| 173 |
|
|---|
| 174 | #endif
|
|---|
| 175 |
|
|---|