Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-04-10 08:06:17

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 TrackingAction.hh
0027 /// \brief Definition of the TrackingAction class
0028 //
0029 //
0030 
0031 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0032 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0033 
0034 #ifndef TrackingAction_h
0035 #define TrackingAction_h 1
0036 
0037 #include "G4UserTrackingAction.hh"
0038 #include "globals.hh"
0039 
0040 #include <array>
0041 
0042 class Run;
0043 
0044 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0045 
0046 class TrackingAction : public G4UserTrackingAction
0047 {
0048     // We are using this class to monitor the average multiplicity, the average
0049     // kinetic energy, and the average total energy flow (i.e. sum of the
0050     // kinetic energies) of different particle types as they are produced
0051     // inside the inner sphere (tracker), the middle spherical shell (EM calo),
0052     // and the outmost spherical shell (HAD calo).
0053     // The aim is then to try to correlate some changes in these (more primitive)
0054     // quantities with the observed changes in the (more indirect and complex)
0055     // particle fluences.
0056   public:
0057     TrackingAction();
0058     ~TrackingAction() override = default;
0059     void PreUserTrackingAction(const G4Track*) override;
0060     void PostUserTrackingAction(const G4Track*) override;
0061 
0062     void Initialize();
0063     // This method is called by RunAction::BeginOfRunAction for the
0064     // initialization of the tracking-action at the beginning of each Run.
0065 
0066     void SetRunPointer(Run* inputValue = nullptr) { fRunPtr = inputValue; }
0067     // This method is called by RunAction::BeginOfRunAction for providing to the
0068     // tracking-action the pointer to the run object at the beginning of each Run.
0069     // This pointer is then used to pass the information collected by the tracking-action
0070     // to the run object.
0071 
0072     static const G4int fkNumberScoringVolumes = 3;  // tracker, emCalo, hadCalo
0073     static const G4int fkNumberKinematicRegions = 3;  // all, below 20 MeV, above 20 MeV
0074     static const G4int fkNumberParticleTypes = 11;  // all, e, gamma, mu, nu, pi, n, p, ions,
0075                                                     // other-mesons, other-baryons
0076     static const G4int fkNumberCombinations =
0077       fkNumberScoringVolumes * fkNumberKinematicRegions * fkNumberParticleTypes;
0078     static const std::array<G4String, fkNumberScoringVolumes> fkArrayScoringVolumeNames;
0079     static const std::array<G4String, fkNumberKinematicRegions> fkArrayKinematicRegionNames;
0080     static const std::array<G4String, fkNumberParticleTypes> fkArrayParticleTypeNames;
0081     static G4int GetIndex(const G4int iScoringVolume, const G4int iKinematicRegion,
0082                           const G4int iParticleType);
0083 
0084   private:
0085     Run* fRunPtr;  // Pointer to the Run object
0086 
0087     std::array<G4long, fkNumberCombinations> fArrayMultiplicities;
0088     std::array<G4double, fkNumberCombinations> fArraySumKineticEnergies;
0089     // Keep record of the number of particles and their kinetic energy at production,
0090     // according to the particle type and their kinetic energy range (below/above 20 MeV).
0091 };
0092 
0093 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0094 
0095 #endif