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