Back to home page

EIC code displayed by LXR

 
 

    


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

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