Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-04 07:53:27

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 RunAction.hh
0027 /// \brief Definition of the RunAction class
0028 
0029 #ifndef RunAction_h
0030 #define RunAction_h 1
0031 
0032 #include "G4AnalysisManager.hh"
0033 #include "G4UserRunAction.hh"
0034 #include "G4VAccumulable.hh"
0035 #include "globals.hh"
0036 
0037 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0038 
0039 class DetectorConstruction;
0040 class PrimaryGeneratorAction;
0041 class G4Run;
0042 class G4ParticleDefinition;
0043 
0044 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0045 
0046 class RunAction : public G4UserRunAction
0047 {
0048     class ParticleStatistics : public G4VAccumulable
0049     {
0050       public:
0051         ParticleStatistics(const G4String& name);
0052         ~ParticleStatistics();
0053         void EventFinished();
0054         void FillData(G4double kinEnergy, G4double costheta, G4double longitudinalPolarization);
0055         void PrintResults(G4int totalNumberOfEvents);
0056 
0057         void Reset() override;
0058         void Merge(const G4VAccumulable& other) override;
0059 
0060       private:
0061         G4int fCurrentNumber;
0062         G4int fTotalNumber, fTotalNumber2;
0063         G4double fSumEnergy, fSumEnergy2;
0064         G4double fSumPolarization, fSumPolarization2;
0065         G4double fSumCosTheta, fSumCosTheta2;
0066     };
0067 
0068   public:
0069     RunAction(DetectorConstruction*, PrimaryGeneratorAction* = nullptr);
0070     virtual ~RunAction();
0071 
0072     virtual void BeginOfRunAction(const G4Run*);
0073     virtual void EndOfRunAction(const G4Run*);
0074 
0075     void CountProcesses(G4String&);
0076 
0077     void FillData(const G4ParticleDefinition* particle, G4double kinEnergy, G4double costheta,
0078                   G4double phi, G4double longitudinalPolarization);
0079 
0080     void EventFinished();
0081 
0082   private:
0083     void BookHisto();
0084     void SaveHisto(G4int nevents);
0085 
0086     const G4ParticleDefinition* fGamma;
0087     const G4ParticleDefinition* fElectron;
0088     const G4ParticleDefinition* fPositron;
0089 
0090     DetectorConstruction* fDetector;
0091     PrimaryGeneratorAction* fPrimary;
0092 
0093     G4AnalysisManager* fAnalysisManager;
0094 
0095     G4int fTotalEventCount;
0096 };
0097 
0098 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0099 
0100 #endif