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 // - inelastic nuclear interactions of generic-ions (i.e. projectile ions >> 54 // heavier than deuterium, triton, He3 and alpha) 53 // 55 // 54 // This class does NOT use the Geant4 run-mana 56 // This class does NOT use the Geant4 run-manager, and therefore should 55 // be usable in a multi-threaded application, 57 // be usable in a multi-threaded application, with one instance of this 56 // class in each thread. 58 // class in each thread. 57 // << 59 // 58 // This class has been inspired by test30 (who 60 // This class has been inspired by test30 (whose author is Vladimir 59 // Ivanchenko), with various simplifications a 61 // Ivanchenko), with various simplifications and restricted to hadronic 60 // inelastic interactions. 62 // inelastic interactions. 61 //-------------------------------------------- 63 //------------------------------------------------------------------------ 62 64 63 //....oooOO0OOooo........oooOO0OOooo........oo 65 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 64 //....oooOO0OOooo........oooOO0OOooo........oo 66 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 65 67 66 #ifndef HadronicGenerator_h 68 #ifndef HadronicGenerator_h 67 #define HadronicGenerator_h 1 69 #define HadronicGenerator_h 1 68 70 69 #include "G4HadronicProcess.hh" << 70 #include "G4ThreeVector.hh" << 71 #include "G4ios.hh" << 72 #include "globals.hh" << 73 << 74 #include <iomanip> 71 #include <iomanip> >> 72 #include "globals.hh" >> 73 #include "G4ios.hh" >> 74 #include "G4ThreeVector.hh" 75 #include <map> 75 #include <map> 76 76 77 class G4ParticleDefinition; 77 class G4ParticleDefinition; 78 class G4VParticleChange; 78 class G4VParticleChange; 79 class G4ParticleTable; 79 class G4ParticleTable; 80 class G4Material; 80 class G4Material; 81 class G4HadronicInteraction; << 81 class G4HadronicProcess; 82 82 83 //....oooOO0OOooo........oooOO0OOooo........oo 83 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 84 84 85 class HadronicGenerator << 85 class HadronicGenerator { 86 { << 86 // This class provides the functionality of a "hadronic generator" 87 // This class provides the functionality o << 87 // for Geant4 final-state inelastic hadronic collisions. 88 // for Geant4 final-state inelastic hadron << 88 // Only a few of the available Geant4 final-state hadronic inelastic 89 // Only a few of the available Geant4 fina << 89 // "physics cases" are currently available in this class - but it can 90 // "physics cases" are currently available << 90 // be extended to other cases if needed. 91 // be extended to other cases if needed. << 91 // It is important to notice that this class does NOT use the Geant4 92 // It is important to notice that this cla << 92 // run-manager, so it should work fine in a multi-threaded environment, 93 // run-manager, so it should work fine in << 93 // with a separate instance of this class in each thread. 94 // with a separate instance of this class << 95 public: 94 public: 96 explicit HadronicGenerator(const G4String << 95 >> 96 explicit HadronicGenerator( const G4String physicsCase = "FTFP_BERT_ATL" ); 97 // Currently supported final-state hadroni 97 // Currently supported final-state hadronic inelastic "physics cases": 98 // - Hadronic models : BERT, BIC, 98 // - Hadronic models : BERT, BIC, IonBIC, INCL, FTFP, QGSP 99 // - "Physics-list proxies" : FTFP_BERT_A 99 // - "Physics-list proxies" : FTFP_BERT_ATL (default), FTFP_BERT, 100 // QGSP_BERT, 100 // QGSP_BERT, QGSP_BIC, FTFP_INCLXX 101 // (i.e. they are not real, complete ph 101 // (i.e. they are not real, complete physics lists - for instance 102 // they do not have: transportation, e 102 // they do not have: transportation, electromagnetic physics, 103 // hadron elastic scattering, neutron 103 // hadron elastic scattering, neutron fission and capture, etc. - 104 // however, they cover all hadron type 104 // however, they cover all hadron types and all energies by 105 // combining different hadronic models 105 // combining different hadronic models, i.e. there are transitions 106 // between two hadronic models in well 106 // between two hadronic models in well-defined energy intervals, 107 // e.g. "FTFP_BERT" has the transition 107 // e.g. "FTFP_BERT" has the transition between BERT and FTFP 108 // hadronic models; moreover, the tran 108 // hadronic models; moreover, the transition intervals used in 109 // our "physics cases"might not be the 109 // our "physics cases"might not be the same as in the corresponding 110 // physics lists). 110 // physics lists). 111 111 112 ~HadronicGenerator(); 112 ~HadronicGenerator(); 113 113 114 inline G4bool IsPhysicsCaseSupported() con << 114 G4bool IsPhysicsCaseSupported(); 115 // Returns "true" if the physicsCase is su << 115 // Returns "true" if the physicsCase is supported; "false" otherwise. 116 << 116 117 G4bool IsApplicable(const G4String& namePr << 117 G4bool IsApplicable( const G4String &nameProjectile, const G4double projectileEnergy ); 118 G4bool IsApplicable(G4ParticleDefinition* << 118 G4bool IsApplicable( G4ParticleDefinition* projectileDefinition, 119 const G4double project << 119 const G4double projectileEnergy ); 120 // Returns "true" if the specified project 120 // Returns "true" if the specified projectile (either by name or particle definition) 121 // of given energy is applicable, "false" 121 // of given energy is applicable, "false" otherwise. 122 122 123 G4VParticleChange* GenerateInteraction(con << 123 G4VParticleChange* GenerateInteraction( const G4String &nameProjectile, 124 con << 124 const G4double projectileEnergy, 125 con << 125 const G4ThreeVector &projectileDirection , 126 G4M << 126 G4Material* targetMaterial ); 127 G4VParticleChange* GenerateInteraction(G4P << 127 G4VParticleChange* GenerateInteraction( G4ParticleDefinition* projectileDefinition, 128 con << 128 const G4double projectileEnergy, 129 con << 129 const G4ThreeVector &projectileDirection , 130 G4M << 130 G4Material* targetMaterial ); 131 // This is the main method provided by the 131 // This is the main method provided by the class: 132 // in input it receives the projectile (ei 132 // in input it receives the projectile (either by name or particle definition), 133 // its energy, its direction and the targe 133 // its energy, its direction and the target material, and it returns one sampled 134 // final-state of the inelastic hadron-nuc 134 // final-state of the inelastic hadron-nuclear collision as modelled by the 135 // final-state hadronic inelastic "physics 135 // final-state hadronic inelastic "physics case" specified in the constructor. 136 // If the required hadronic collision is n 136 // If the required hadronic collision is not possible, then the method returns 137 // immediately an empty "G4VParticleChange 137 // immediately an empty "G4VParticleChange", i.e. without secondaries produced. 138 << 138 139 inline G4HadronicProcess* GetHadronicProce << 140 inline G4HadronicInteraction* GetHadronicI << 141 // Returns the hadronic process and the ha << 142 // that handled the last call of "Generate << 143 << 144 G4double GetImpactParameter() const; << 145 G4int GetNumberOfTargetSpectatorNucleons() << 146 G4int GetNumberOfProjectileSpectatorNucleo << 147 G4int GetNumberOfNNcollisions() const; << 148 // In the case of hadronic interactions ha << 149 // respectively, the impact parameter, the << 150 // spectator nucleons, and the number of n << 151 // else, returns a negative value (-999). << 152 << 153 private: 139 private: >> 140 154 G4String fPhysicsCase; 141 G4String fPhysicsCase; 155 G4bool fPhysicsCaseIsSupported; 142 G4bool fPhysicsCaseIsSupported; 156 G4HadronicProcess* fLastHadronicProcess; << 157 G4ParticleTable* fPartTable; 143 G4ParticleTable* fPartTable; 158 std::map<G4ParticleDefinition*, G4Hadronic << 144 std::map< G4ParticleDefinition*, G4HadronicProcess* > fProcessMap; 159 }; 145 }; 160 146 161 inline G4bool HadronicGenerator::IsPhysicsCase << 162 { << 163 return fPhysicsCaseIsSupported; << 164 } << 165 147 166 inline G4HadronicProcess* HadronicGenerator::G << 148 inline G4bool HadronicGenerator::IsPhysicsCaseSupported() { 167 { << 149 return fPhysicsCaseIsSupported; 168 return fLastHadronicProcess; << 169 } << 170 << 171 inline G4HadronicInteraction* HadronicGenerato << 172 { << 173 return fLastHadronicProcess == nullptr ? nul << 174 } 150 } 175 151 176 //....oooOO0OOooo........oooOO0OOooo........oo 152 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 177 153 178 #endif 154 #endif 179 155