Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-01 07:50:52

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