Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-09 08:28:51

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 target sphere.
0047     // The aim is then to try to correlate some changes in these (more primitive)
0048     // quantities with the observed changes in the (more indirect and complex)
0049     // particle fluences.
0050   public:
0051     TrackingAction();
0052     ~TrackingAction() override = default;
0053     void PreUserTrackingAction(const G4Track*) override;
0054     void PostUserTrackingAction(const G4Track*) override;
0055 
0056     void Initialize();
0057     // This method is called by RunAction::BeginOfRunAction for the
0058     // initialization of the tracking-action at the beginning of each Run.
0059 
0060     void SetRunPointer(Run* inputValue = nullptr) { fRunPtr = inputValue; }
0061     // This method is called by RunAction::BeginOfRunAction for providing to the
0062     // tracking-action the pointer to the run object at the beginning of each Run.
0063     // This pointer is then used to pass the information collected by the tracking-action
0064     // to the run object.
0065 
0066     static const G4int fkNumberScoringVolumes = 1;  // only the target sphere
0067     static const G4int fkNumberKinematicRegions = 3;  // all, below 20 MeV, above 20 MeV
0068     static const G4int fkNumberParticleTypes = 11;  // all, e, gamma, mu, nu, pi, n, p, ions,
0069                                                     // other-mesons, other-baryons
0070     static const G4int fkNumberCombinations =
0071       fkNumberScoringVolumes * fkNumberKinematicRegions * fkNumberParticleTypes;
0072     static const std::array<G4String, fkNumberScoringVolumes> fkArrayScoringVolumeNames;
0073     static const std::array<G4String, fkNumberKinematicRegions> fkArrayKinematicRegionNames;
0074     static const std::array<G4String, fkNumberParticleTypes> fkArrayParticleTypeNames;
0075     static G4int GetIndex(const G4int iScoringVolume, const G4int iKinematicRegion,
0076                           const G4int iParticleType);
0077 
0078   private:
0079     Run* fRunPtr;  // Pointer to the Run object
0080 
0081     std::array<G4long, fkNumberCombinations> fArrayMultiplicities;
0082     std::array<G4double, fkNumberCombinations> fArraySumKineticEnergies;
0083     // Keep record of the number of particles and their kinetic energy at production,
0084     // according to the particle type and their kinetic energy range (below/above 20 MeV).
0085 };
0086 
0087 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0088 
0089 #endif