Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 /// \file HadronicGenerator.hh 26 /// \file HadronicGenerator.hh 27 /// \brief Definition of the HadronicGenerator 27 /// \brief Definition of the HadronicGenerator class 28 // << 28 // 29 //-------------------------------------------- 29 //------------------------------------------------------------------------ 30 // Class: HadronicGenerator 30 // Class: HadronicGenerator 31 // Author: Alberto Ribon (CERN EP/SFT) 31 // Author: Alberto Ribon (CERN EP/SFT) 32 // Date: May 2020 32 // Date: May 2020 33 // 33 // 34 // This class shows how to use Geant4 as a gen 34 // This class shows how to use Geant4 as a generator for simulating 35 // inelastic hadron-nuclear interactions. 35 // inelastic hadron-nuclear interactions. 36 // Some of the most used hadronic models are c 36 // Some of the most used hadronic models are currently supported in 37 // this class: 37 // this class: 38 // - the hadronic string models Fritiof (FTF) 38 // - the hadronic string models Fritiof (FTF) and Quark-Gluon-String (QGS) 39 // coupled with Precompound/de-excitation 39 // coupled with Precompound/de-excitation 40 // - the intranuclear cascade models: Bertini 40 // - the intranuclear cascade models: Bertini (BERT), Binary Cascade (BIC), 41 // and Lieg 41 // and Liege (INCL) 42 // Combinations of two models - in a transitio 42 // Combinations of two models - in a transition energy interval, with a 43 // linear probability as a function of the ene 43 // linear probability as a function of the energy - are also available to 44 // "mimic" the transition between hadronic mod 44 // "mimic" the transition between hadronic models as in the most common 45 // Geant4 reference physics lists. 45 // Geant4 reference physics lists. 46 // 46 // 47 // The current version of this class does NOT 47 // The current version of this class does NOT support: 48 // - hadron elastic interactions 48 // - hadron elastic interactions 49 // - neutron capture and fission 49 // - neutron capture and fission 50 // - precise low-energy inelastic interaction 50 // - precise low-energy inelastic interactions of neutrons and 51 // charged particles (i.e. ParticleHP) 51 // charged particles (i.e. ParticleHP) 52 // - gamma/lepton-nuclear inelastic interacti 52 // - gamma/lepton-nuclear inelastic interactions 53 // 53 // 54 // This class does NOT use the Geant4 run-mana 54 // This class does NOT use the Geant4 run-manager, and therefore should 55 // be usable in a multi-threaded application, 55 // be usable in a multi-threaded application, with one instance of this 56 // class in each thread. 56 // class in each thread. 57 // << 57 // 58 // This class has been inspired by test30 (who 58 // This class has been inspired by test30 (whose author is Vladimir 59 // Ivanchenko), with various simplifications a 59 // Ivanchenko), with various simplifications and restricted to hadronic 60 // inelastic interactions. 60 // inelastic interactions. 61 //-------------------------------------------- 61 //------------------------------------------------------------------------ 62 62 63 //....oooOO0OOooo........oooOO0OOooo........oo 63 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 64 //....oooOO0OOooo........oooOO0OOooo........oo 64 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 65 65 66 #ifndef HadronicGenerator_h 66 #ifndef HadronicGenerator_h 67 #define HadronicGenerator_h 1 67 #define HadronicGenerator_h 1 68 68 69 #include "G4HadronicProcess.hh" << 70 #include "G4ThreeVector.hh" << 71 #include "G4ios.hh" << 72 #include "globals.hh" << 73 << 74 #include <iomanip> 69 #include <iomanip> >> 70 #include "globals.hh" >> 71 #include "G4ios.hh" >> 72 #include "G4ThreeVector.hh" 75 #include <map> 73 #include <map> >> 74 #include "G4HadronicProcess.hh" 76 75 77 class G4ParticleDefinition; 76 class G4ParticleDefinition; 78 class G4VParticleChange; 77 class G4VParticleChange; 79 class G4ParticleTable; 78 class G4ParticleTable; 80 class G4Material; 79 class G4Material; 81 class G4HadronicInteraction; 80 class G4HadronicInteraction; 82 81 83 //....oooOO0OOooo........oooOO0OOooo........oo 82 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 84 83 85 class HadronicGenerator << 84 class HadronicGenerator { 86 { << 85 // This class provides the functionality of a "hadronic generator" 87 // This class provides the functionality o << 86 // for Geant4 final-state inelastic hadronic collisions. 88 // for Geant4 final-state inelastic hadron << 87 // Only a few of the available Geant4 final-state hadronic inelastic 89 // Only a few of the available Geant4 fina << 88 // "physics cases" are currently available in this class - but it can 90 // "physics cases" are currently available << 89 // be extended to other cases if needed. 91 // be extended to other cases if needed. << 90 // It is important to notice that this class does NOT use the Geant4 92 // It is important to notice that this cla << 91 // run-manager, so it should work fine in a multi-threaded environment, 93 // run-manager, so it should work fine in << 92 // with a separate instance of this class in each thread. 94 // with a separate instance of this class << 95 public: 93 public: 96 explicit HadronicGenerator(const G4String << 94 >> 95 explicit HadronicGenerator( const G4String physicsCase = "FTFP_BERT_ATL" ); 97 // Currently supported final-state hadroni 96 // Currently supported final-state hadronic inelastic "physics cases": 98 // - Hadronic models : BERT, BIC, 97 // - Hadronic models : BERT, BIC, IonBIC, INCL, FTFP, QGSP 99 // - "Physics-list proxies" : FTFP_BERT_A 98 // - "Physics-list proxies" : FTFP_BERT_ATL (default), FTFP_BERT, 100 // QGSP_BERT, 99 // QGSP_BERT, QGSP_BIC, FTFP_INCLXX 101 // (i.e. they are not real, complete ph 100 // (i.e. they are not real, complete physics lists - for instance 102 // they do not have: transportation, e 101 // they do not have: transportation, electromagnetic physics, 103 // hadron elastic scattering, neutron 102 // hadron elastic scattering, neutron fission and capture, etc. - 104 // however, they cover all hadron type 103 // however, they cover all hadron types and all energies by 105 // combining different hadronic models 104 // combining different hadronic models, i.e. there are transitions 106 // between two hadronic models in well 105 // between two hadronic models in well-defined energy intervals, 107 // e.g. "FTFP_BERT" has the transition 106 // e.g. "FTFP_BERT" has the transition between BERT and FTFP 108 // hadronic models; moreover, the tran 107 // hadronic models; moreover, the transition intervals used in 109 // our "physics cases"might not be the 108 // our "physics cases"might not be the same as in the corresponding 110 // physics lists). 109 // physics lists). 111 110 112 ~HadronicGenerator(); 111 ~HadronicGenerator(); 113 112 114 inline G4bool IsPhysicsCaseSupported() con 113 inline G4bool IsPhysicsCaseSupported() const; 115 // Returns "true" if the physicsCase is su << 114 // Returns "true" if the physicsCase is supported; "false" otherwise. 116 << 115 117 G4bool IsApplicable(const G4String& namePr << 116 G4bool IsApplicable( const G4String &nameProjectile, const G4double projectileEnergy ) const; 118 G4bool IsApplicable(G4ParticleDefinition* << 117 G4bool IsApplicable( G4ParticleDefinition* projectileDefinition, 119 const G4double project << 118 const G4double projectileEnergy ) const; 120 // Returns "true" if the specified project 119 // Returns "true" if the specified projectile (either by name or particle definition) 121 // of given energy is applicable, "false" 120 // of given energy is applicable, "false" otherwise. 122 121 123 G4VParticleChange* GenerateInteraction(con << 122 G4VParticleChange* GenerateInteraction( const G4String &nameProjectile, 124 con << 123 const G4double projectileEnergy, 125 con << 124 const G4ThreeVector &projectileDirection , 126 G4M << 125 G4Material* targetMaterial ); 127 G4VParticleChange* GenerateInteraction(G4P << 126 G4VParticleChange* GenerateInteraction( G4ParticleDefinition* projectileDefinition, 128 con << 127 const G4double projectileEnergy, 129 con << 128 const G4ThreeVector &projectileDirection , 130 G4M << 129 G4Material* targetMaterial ); 131 // This is the main method provided by the 130 // This is the main method provided by the class: 132 // in input it receives the projectile (ei 131 // in input it receives the projectile (either by name or particle definition), 133 // its energy, its direction and the targe 132 // its energy, its direction and the target material, and it returns one sampled 134 // final-state of the inelastic hadron-nuc 133 // final-state of the inelastic hadron-nuclear collision as modelled by the 135 // final-state hadronic inelastic "physics 134 // final-state hadronic inelastic "physics case" specified in the constructor. 136 // If the required hadronic collision is n 135 // If the required hadronic collision is not possible, then the method returns 137 // immediately an empty "G4VParticleChange 136 // immediately an empty "G4VParticleChange", i.e. without secondaries produced. 138 137 139 inline G4HadronicProcess* GetHadronicProce 138 inline G4HadronicProcess* GetHadronicProcess() const; 140 inline G4HadronicInteraction* GetHadronicI 139 inline G4HadronicInteraction* GetHadronicInteraction() const; 141 // Returns the hadronic process and the ha 140 // Returns the hadronic process and the hadronic interaction, respectively, 142 // that handled the last call of "Generate 141 // that handled the last call of "GenerateInteraction". 143 142 144 G4double GetImpactParameter() const; 143 G4double GetImpactParameter() const; 145 G4int GetNumberOfTargetSpectatorNucleons() 144 G4int GetNumberOfTargetSpectatorNucleons() const; 146 G4int GetNumberOfProjectileSpectatorNucleo 145 G4int GetNumberOfProjectileSpectatorNucleons() const; 147 G4int GetNumberOfNNcollisions() const; 146 G4int GetNumberOfNNcollisions() const; 148 // In the case of hadronic interactions ha 147 // In the case of hadronic interactions handled by the FTF model, returns, 149 // respectively, the impact parameter, the 148 // respectively, the impact parameter, the number of target/projectile 150 // spectator nucleons, and the number of n 149 // spectator nucleons, and the number of nucleon-nucleon collisions, 151 // else, returns a negative value (-999). 150 // else, returns a negative value (-999). 152 151 153 private: 152 private: >> 153 154 G4String fPhysicsCase; 154 G4String fPhysicsCase; 155 G4bool fPhysicsCaseIsSupported; 155 G4bool fPhysicsCaseIsSupported; 156 G4HadronicProcess* fLastHadronicProcess; 156 G4HadronicProcess* fLastHadronicProcess; 157 G4ParticleTable* fPartTable; 157 G4ParticleTable* fPartTable; 158 std::map<G4ParticleDefinition*, G4Hadronic << 158 std::map< G4ParticleDefinition*, G4HadronicProcess* > fProcessMap; 159 }; 159 }; 160 160 161 inline G4bool HadronicGenerator::IsPhysicsCase << 161 162 { << 162 inline G4bool HadronicGenerator::IsPhysicsCaseSupported() const { 163 return fPhysicsCaseIsSupported; 163 return fPhysicsCaseIsSupported; 164 } 164 } 165 165 166 inline G4HadronicProcess* HadronicGenerator::G << 166 167 { << 167 inline G4HadronicProcess* HadronicGenerator::GetHadronicProcess() const { 168 return fLastHadronicProcess; 168 return fLastHadronicProcess; 169 } 169 } 170 170 171 inline G4HadronicInteraction* HadronicGenerato << 171 172 { << 172 inline G4HadronicInteraction* HadronicGenerator::GetHadronicInteraction() const { 173 return fLastHadronicProcess == nullptr ? nul << 173 return fLastHadronicProcess == nullptr ? nullptr >> 174 : fLastHadronicProcess->GetHadronicInteraction(); 174 } 175 } 175 176 176 //....oooOO0OOooo........oooOO0OOooo........oo 177 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 177 178 178 #endif 179 #endif 179 180