Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-17 07:52:13

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 // gpaterno, October 2025
0027 //
0028 /// \file EventAction.hh
0029 /// \brief Definition of the EventAction class
0030 //
0031 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0032 
0033 #ifndef EventAction_h
0034 #define EventAction_h 1
0035 
0036 #include "G4UserEventAction.hh"
0037 
0038 #include "globals.hh"
0039 #include <iostream>
0040 #include <fstream>
0041 #include <map>
0042 
0043 #include "Run.hh"
0044 #include "G4RunManager.hh"
0045 
0046 class RunAction;
0047 
0048 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0049 
0050 /// Event action class. Used to score the energy deposited per event in some 
0051 /// important volumes (radiator, converter and spheres of a granluar traget).
0052 
0053 class EventAction : public G4UserEventAction
0054 {
0055 public:
0056     EventAction();
0057     ~EventAction() override = default;
0058 
0059     void BeginOfEventAction(const G4Event* event) override;
0060     void EndOfEventAction(const G4Event* event) override;
0061 
0062     //custom methods 
0063     inline void SetVerbose(G4int val) {fVerboseLevel = val;}
0064     inline G4int GetVerbose() const {return fVerboseLevel;}
0065     
0066     G4int GetEventID() const {
0067         return G4RunManager::GetRunManager()->GetCurrentEvent()->GetEventID();
0068     }
0069     
0070     void AddEdepRad(G4double val) {fEdepRad += val;}
0071     void AddEdepConv(G4double val) {fEdepConv += val;}
0072     
0073     void AddEdepInSpheres(G4int, G4double);
0074 
0075 private:
0076     G4int fSensitiveDetector_ID = -1;
0077     G4int fVerboseLevel = 0;
0078     
0079     G4double fEdepRad = 0.;
0080     G4double fEdepConv = 0.;
0081     
0082     G4int fNSpheres = 0.;
0083     std::map<G4int,G4double> fEdepSpheres;
0084 };
0085 
0086 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0087 
0088 #endif
0089