Back to home page

EIC code displayed by LXR

 
 

    


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

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 //
0027 /// \file B4/B4b/include/RunData.hh
0028 /// \brief Definition of the B4b::RunData class
0029 
0030 #ifndef B4bRunData_h
0031 #define B4bRunData_h 1
0032 
0033 #include "G4Run.hh"
0034 #include "globals.hh"
0035 
0036 #include <array>
0037 
0038 namespace B4b
0039 {
0040 
0041 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0042 
0043 const G4int kAbs = 0;
0044 const G4int kGap = 1;
0045 const G4int kDim = 2;
0046 
0047 ///  Run data class
0048 ///
0049 /// It defines data members to hold the energy deposit and track lengths
0050 /// of charged particles in Absober and Gap layers.
0051 ///
0052 /// In order to reduce the number of data members a 2-dimensions array
0053 /// is introduced for each quantity:
0054 /// - fEdep[], fTrackLength[].
0055 ///
0056 /// The data are collected step by step in SteppingAction, and
0057 /// the accumulated values are filled in histograms and a Ntuple
0058 /// event by event in EventAction.
0059 
0060 class RunData : public G4Run
0061 {
0062   public:
0063     RunData() = default;
0064     ~RunData() override = default;
0065 
0066     void Add(G4int id, G4double de, G4double dl);
0067     void FillPerEvent();
0068 
0069     void Reset();
0070 
0071     // Get methods
0072     G4String GetVolumeName(G4int id) const;
0073     G4double GetEdep(G4int id) const;
0074     G4double GetTrackLength(G4int id) const;
0075 
0076   private:
0077     std::array<G4String, kDim> fVolumeNames = {"Absorber", "Gap"};
0078     std::array<G4double, kDim> fEdep = {0., 0.};
0079     std::array<G4double, kDim> fTrackLength = {0., 0.};
0080 };
0081 
0082 // inline functions
0083 
0084 inline void RunData::Add(G4int id, G4double de, G4double dl)
0085 {
0086   fEdep[id] += de;
0087   fTrackLength[id] += dl;
0088 }
0089 
0090 inline G4String RunData::GetVolumeName(G4int id) const
0091 {
0092   return fVolumeNames[id];
0093 }
0094 
0095 inline G4double RunData::GetEdep(G4int id) const
0096 {
0097   return fEdep[id];
0098 }
0099 
0100 inline G4double RunData::GetTrackLength(G4int id) const
0101 {
0102   return fTrackLength[id];
0103 }
0104 
0105 }  // namespace B4b
0106 
0107 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0108 
0109 #endif