![]() |
|
|||
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 SteppingAction.hh 0027 /// \brief Definition of the SteppingAction class 0028 // 0029 // 0030 0031 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0032 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0033 0034 #ifndef SteppingAction_H 0035 #define SteppingAction_H 1 0036 0037 #include "G4ThreeVector.hh" 0038 #include "G4UserSteppingAction.hh" 0039 #include "globals.hh" 0040 0041 #include <array> 0042 0043 class Run; 0044 0045 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0046 0047 class SteppingAction : public G4UserSteppingAction 0048 { 0049 public: 0050 SteppingAction(); 0051 ~SteppingAction() override = default; 0052 0053 void UserSteppingAction(const G4Step*) override; 0054 // This is the main method where the step lengths of particles inside 0055 // the scoring volumes are collected, and then the corresponding fluences 0056 // are filled up in the Run object where they are stored (and then 0057 // printed out at the end of the Run). 0058 // (For simplicity and brevity, we avoid histograms and compute instead 0059 // some statistics ourself, which will be print-out at the end of the run.) 0060 0061 void Initialize(); 0062 // This method is called by RunAction::BeginOfRunAction for the 0063 // initialization of the stepping-action at the beginning of each Run. 0064 // This is necessary because different runs can have different primary particle 0065 // types, kinetic energies, and detector configurations. 0066 0067 void SetRunPointer(Run* inputValue = nullptr) { fRunPtr = inputValue; } 0068 // This method is called by RunAction::BeginOfRunAction for providing to the 0069 // stepping-action the pointer to the run object at the beginning of each Run. 0070 // This pointer is then used to pass the information collected by the stepping-action 0071 // to the run object. 0072 0073 G4double GetCubicVolumeScoringUpDown() const { return fCubicVolumeScoringUpDown; } 0074 G4double GetCubicVolumeScoringSide() const { return fCubicVolumeScoringSide; } 0075 // The cubic-volumes of the scoring volumes are needed to get the fluence from 0076 // the sum of step lengths in those scoring volumes. 0077 // Notice that two of the three scoring volumes - upstream and downstream - 0078 // have the same cubic-volume, that we call "fCubicVolumeScoringUpDown". 0079 0080 static const G4int fkNumberScoringVolumes = 3; // downstream, side, upstream 0081 static const G4int fkNumberKinematicRegions = 3; // all, below 20 MeV, above 20 MeV 0082 static const G4int fkNumberParticleTypes = 11; // all, e, gamma, mu, nu, pi, n, p, ions, 0083 // other-mesons, other-baryons 0084 static const G4int fkNumberCombinations = 0085 fkNumberScoringVolumes * fkNumberKinematicRegions * fkNumberParticleTypes; 0086 static const std::array<G4String, fkNumberScoringVolumes> fkArrayScoringVolumeNames; 0087 static const std::array<G4String, fkNumberKinematicRegions> fkArrayKinematicRegionNames; 0088 static const std::array<G4String, fkNumberParticleTypes> fkArrayParticleTypeNames; 0089 static G4int GetIndex(const G4int iScoringVolume, const G4int iKinematicRegion, 0090 const G4int iParticleType); 0091 0092 private: 0093 Run* fRunPtr; // Pointer to the Run object 0094 G4int fPrimaryParticleId; 0095 G4double fPrimaryParticleEnergy; 0096 G4ThreeVector fPrimaryParticleDirection; 0097 G4String fTargetMaterialName; 0098 G4bool fIsFirstStepOfTheEvent; 0099 G4bool fIsFirstStepInTarget; 0100 G4bool fIsFirstStepInScoringUpDown; 0101 G4bool fIsFirstStepInScoringSide; 0102 G4double fCubicVolumeScoringUpDown; 0103 G4double fCubicVolumeScoringSide; 0104 0105 std::array<G4double, fkNumberCombinations> fArraySumStepLengths; 0106 // Array to collect the sum of step lengths in the scoring volumes for the whole run, 0107 // according to the various cases (kinematical region and particle type). 0108 // Note that the fluence in a scoring volume is defined as sum of step lengths 0109 // in that scoring volume divided by the cubic-volume of that scoring volume. 0110 }; 0111 0112 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0113 0114 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |