Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:20:57

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/TestEm2/include/Run.hh
0027 /// \brief Definition of the Run class
0028 //
0029 //
0030 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0031 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0032 
0033 #ifndef Run_h
0034 #define Run_h 1
0035 
0036 #include "DetectorConstruction.hh"
0037 
0038 #include "G4AnalysisManager.hh"
0039 #include "G4Run.hh"
0040 
0041 #include <vector>
0042 typedef std::vector<G4double> MyVector;
0043 
0044 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0045 
0046 class DetectorConstruction;
0047 class PrimaryGeneratorAction;
0048 
0049 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0050 
0051 class Run : public G4Run
0052 {
0053   public:
0054     Run(DetectorConstruction*, PrimaryGeneratorAction*);
0055     ~Run() override = default;
0056 
0057     void Merge(const G4Run*) override;
0058 
0059     void InitializePerEvent();
0060     void FillPerEvent();
0061 
0062     inline void FillPerTrack(G4double, G4double);
0063     inline void FillPerStep(G4double, G4int, G4int);
0064 
0065     inline void AddStep(G4double q);
0066 
0067     void EndOfRun(G4double edep, G4double rms, G4double& limit);
0068 
0069     inline void SetVerbose(G4int val) { fVerbose = val; };
0070 
0071   private:
0072     void Reset();
0073 
0074     DetectorConstruction* fDet = nullptr;
0075     PrimaryGeneratorAction* fKin = nullptr;
0076 
0077     G4int f_nLbin = kMaxBin;
0078     MyVector f_dEdL;
0079     MyVector fSumELongit;
0080     MyVector fSumE2Longit;
0081     MyVector fSumELongitCumul;
0082     MyVector fSumE2LongitCumul;
0083 
0084     G4int f_nRbin = kMaxBin;
0085     MyVector f_dEdR;
0086     MyVector fSumERadial;
0087     MyVector fSumE2Radial;
0088     MyVector fSumERadialCumul;
0089     MyVector fSumE2RadialCumul;
0090 
0091     G4double fChargTrLength = 0.;
0092     G4double fSumChargTrLength = 0.;
0093     G4double fSum2ChargTrLength = 0.;
0094 
0095     G4double fNeutrTrLength = 0.;
0096     G4double fSumNeutrTrLength = 0.;
0097     G4double fSum2NeutrTrLength = 0.;
0098 
0099     G4double fChargedStep = 0.;
0100     G4double fNeutralStep = 0.;
0101 
0102     G4int fVerbose = 0;
0103 };
0104 
0105 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0106 
0107 inline void Run::FillPerTrack(G4double charge, G4double trkLength)
0108 {
0109   if (charge != 0.)
0110     fChargTrLength += trkLength;
0111   else
0112     fNeutrTrLength += trkLength;
0113 }
0114 
0115 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0116 
0117 inline void Run::FillPerStep(G4double dEstep, G4int Lbin, G4int Rbin)
0118 {
0119   f_dEdL[Lbin] += dEstep;
0120   f_dEdR[Rbin] += dEstep;
0121 }
0122 
0123 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0124 
0125 inline void Run::AddStep(G4double q)
0126 {
0127   if (q == 0.0) {
0128     fNeutralStep += 1.0;
0129   }
0130   else {
0131     fChargedStep += 1.0;
0132   }
0133 }
0134 
0135 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0136 
0137 #endif