Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-16 08:29:00

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 EventAction.hh
0027 /// \brief Definition of the B5::EventAction class
0028 
0029 #ifndef B5EventAction_h
0030 #define B5EventAction_h 1
0031 
0032 #include "G4UserEventAction.hh"
0033 
0034 #include "Constants.hh"
0035 
0036 #include "globals.hh"
0037 
0038 #include <array>
0039 #include <vector>
0040 
0041 class G4Event;
0042 
0043 // named constants
0044 const G4int kEm = 0;
0045 const G4int kHad = 1;
0046 const G4int kH1 = 0;
0047 const G4int kH2 = 1;
0048 const G4int kDim = 2;
0049 
0050 namespace B5
0051 {
0052 
0053 /// Event action
0054 
0055 class EventAction : public G4UserEventAction
0056 {
0057   public:
0058     EventAction();
0059     ~EventAction() override = default;
0060 
0061     void BeginOfEventAction(const G4Event*) override;
0062     void EndOfEventAction(const G4Event*) override;
0063 
0064     std::vector<G4double>& GetEmCalEdep() { return fCalEdep[kEm]; }
0065     std::vector<G4double>& GetHadCalEdep() { return fCalEdep[kHad]; }
0066 
0067   private:
0068     // hit collections Ids
0069     std::array<G4int, kDim> fHodHCID = {-1, -1};
0070     std::array<G4int, kDim> fDriftHCID = {-1, -1};
0071     std::array<G4int, kDim> fCalHCID = {-1, -1};
0072     // histograms Ids
0073     std::array<std::array<G4int, kDim>, kDim> fDriftHistoID{{{{-1, -1}}, {{-1, -1}}}};
0074     // std::array<T, N> is an aggregate that contains a C array.
0075     // To initialize it, we need outer braces for the class itself
0076     // and inner braces for the C array
0077     // energy deposit in calorimeters cells
0078     std::array<std::vector<G4double>, kDim> fCalEdep{
0079       {std::vector<G4double>(kNofEmCells, 0.), std::vector<G4double>(kNofHadCells, 0.)}};
0080 };
0081 
0082 }  // namespace B5
0083 
0084 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0085 
0086 #endif