Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:21:03

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 /// \file electromagnetic/TestEm7/include/RunAction.hh
0027 /// \brief Definition of the RunAction class
0028 //
0029 //
0030 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0031 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0032 
0033 #ifndef RunAction_h
0034 #define RunAction_h 1
0035 
0036 #include "G4AnalysisManager.hh"
0037 #include "G4UserRunAction.hh"
0038 #include "globals.hh"
0039 
0040 class DetectorConstruction;
0041 class PhysicsList;
0042 class PrimaryGeneratorAction;
0043 
0044 class G4Run;
0045 
0046 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0047 
0048 class RunAction : public G4UserRunAction
0049 {
0050   public:
0051     RunAction(DetectorConstruction*, PhysicsList*, PrimaryGeneratorAction*);
0052     virtual ~RunAction();
0053 
0054     virtual void BeginOfRunAction(const G4Run*);
0055     virtual void EndOfRunAction(const G4Run*);
0056 
0057     inline void FillTallyEdep(G4int n, G4double e);
0058     inline void FillEdep(G4double de, G4double eni);
0059     inline void AddProjRange(G4double x);
0060     inline void AddPrimaryStep();
0061 
0062   private:
0063     void BookHisto();
0064 
0065     G4AnalysisManager* fAnalysisManager;
0066     DetectorConstruction* fDetector;
0067     PhysicsList* fPhysics;
0068     PrimaryGeneratorAction* fKinematic;
0069     G4double* fTallyEdep;
0070     G4double fProjRange, fProjRange2;
0071     G4double fEdeptot, fEniel;
0072     G4int fNbPrimarySteps;
0073     G4int fRange;
0074 };
0075 
0076 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0077 
0078 inline void RunAction::FillTallyEdep(G4int n, G4double e)
0079 {
0080   fTallyEdep[n] += e;
0081 }
0082 
0083 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0084 
0085 inline void RunAction::FillEdep(G4double de, G4double eni)
0086 {
0087   fEdeptot += de;
0088   fEniel += eni;
0089 }
0090 
0091 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0092 
0093 inline void RunAction::AddProjRange(G4double x)
0094 {
0095   fProjRange += x;
0096   fProjRange2 += x * x;
0097   ++fRange;
0098 }
0099 
0100 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0101 
0102 inline void RunAction::AddPrimaryStep()
0103 {
0104   ++fNbPrimarySteps;
0105 }
0106 
0107 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0108 
0109 #endif