Geant4 Cross Reference |
1 // 2 // ******************************************************************** 3 // * License and Disclaimer * 4 // * * 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. * 10 // * * 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitation of liability. * 17 // * * 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************************************** 25 // 26 // 27 // ------------------------------------------------------------------- 28 // 29 // GEANT4 Class header file 30 // 31 // 32 // File name: G4HadronicProcessStore 33 // 34 // Author: Vladimir Ivanchenko 35 // 36 // Creation date: 09.05.2008 37 // 38 // Modifications: 39 // 40 // 41 // Class Description: 42 // 43 44 // ------------------------------------------------------------------- 45 // 46 47 #ifndef G4HadronicProcessStore_h 48 #define G4HadronicProcessStore_h 1 49 50 51 #include "globals.hh" 52 #include "G4DynamicParticle.hh" 53 #include "G4ThreeVector.hh" 54 #include "G4HadronicProcess.hh" 55 #include "G4HadronicInteraction.hh" 56 #include "G4ParticleDefinition.hh" 57 #include "G4HadronicProcessType.hh" 58 #include "G4ThreadLocalSingleton.hh" 59 #include <map> 60 #include <vector> 61 #include <iostream> 62 63 class G4Element; 64 class G4HadronicEPTestMessenger; 65 class G4HadronicParameters; 66 67 class G4HadronicProcessStore 68 { 69 70 friend class G4ThreadLocalSingleton<G4HadronicProcessStore>; 71 72 public: 73 74 static G4HadronicProcessStore* Instance(); 75 76 ~G4HadronicProcessStore(); 77 78 G4double GetCrossSectionPerAtom( 79 const G4ParticleDefinition* particle, 80 G4double kineticEnergy, 81 const G4VProcess* process, 82 const G4Element* element, 83 const G4Material* material=nullptr); 84 85 G4double GetCrossSectionPerVolume( 86 const G4ParticleDefinition* particle, 87 G4double kineticEnergy, 88 const G4VProcess* process, 89 const G4Material* material); 90 91 G4double GetInelasticCrossSectionPerVolume( 92 const G4ParticleDefinition *aParticle, 93 G4double kineticEnergy, 94 const G4Material *material); 95 96 G4double GetInelasticCrossSectionPerAtom( 97 const G4ParticleDefinition *aParticle, 98 G4double kineticEnergy, 99 const G4Element *anElement, 100 const G4Material* mat=nullptr); 101 102 G4double GetInelasticCrossSectionPerIsotope( 103 const G4ParticleDefinition *aParticle, 104 G4double kineticEnergy, 105 G4int Z, G4int A); 106 107 G4double GetElasticCrossSectionPerVolume( 108 const G4ParticleDefinition *aParticle, 109 G4double kineticEnergy, 110 const G4Material *material); 111 112 G4double GetElasticCrossSectionPerAtom( 113 const G4ParticleDefinition *aParticle, 114 G4double kineticEnergy, 115 const G4Element *anElement, const G4Material* mat=0); 116 117 G4double GetElasticCrossSectionPerIsotope( 118 const G4ParticleDefinition *aParticle, 119 G4double kineticEnergy, 120 G4int Z, G4int A); 121 122 G4double GetCaptureCrossSectionPerVolume( 123 const G4ParticleDefinition *aParticle, 124 G4double kineticEnergy, 125 const G4Material *material); 126 127 G4double GetCaptureCrossSectionPerAtom( 128 const G4ParticleDefinition *aParticle, 129 G4double kineticEnergy, 130 const G4Element *anElement, 131 const G4Material* mat=nullptr); 132 133 G4double GetCaptureCrossSectionPerIsotope( 134 const G4ParticleDefinition *aParticle, 135 G4double kineticEnergy, 136 G4int Z, G4int A); 137 138 G4double GetFissionCrossSectionPerVolume( 139 const G4ParticleDefinition *aParticle, 140 G4double kineticEnergy, 141 const G4Material *material); 142 143 G4double GetFissionCrossSectionPerAtom( 144 const G4ParticleDefinition *aParticle, 145 G4double kineticEnergy, 146 const G4Element *anElement, 147 const G4Material* mat=nullptr); 148 149 G4double GetFissionCrossSectionPerIsotope( 150 const G4ParticleDefinition *aParticle, 151 G4double kineticEnergy, 152 G4int Z, G4int A); 153 154 G4double GetChargeExchangeCrossSectionPerVolume( 155 const G4ParticleDefinition *aParticle, 156 G4double kineticEnergy, 157 const G4Material *material); 158 159 G4double GetChargeExchangeCrossSectionPerAtom( 160 const G4ParticleDefinition *aParticle, 161 G4double kineticEnergy, 162 const G4Element *anElement, 163 const G4Material* mat=nullptr); 164 165 G4double GetChargeExchangeCrossSectionPerIsotope( 166 const G4ParticleDefinition *aParticle, 167 G4double kineticEnergy, 168 G4int Z, G4int A); 169 170 // register/deregister processes following G4HadronicProcess interface 171 void Register(G4HadronicProcess*); 172 173 void RegisterParticle(G4HadronicProcess*, 174 const G4ParticleDefinition*); 175 176 void RegisterInteraction(G4HadronicProcess*, 177 G4HadronicInteraction*); 178 179 void DeRegister(G4HadronicProcess*); 180 181 // register/deregister processes following only G4VProcess interface 182 void RegisterExtraProcess(G4VProcess*); 183 184 void RegisterParticleForExtraProcess(G4VProcess*, 185 const G4ParticleDefinition*); 186 187 void DeRegisterExtraProcess(G4VProcess*); 188 189 void SetBuildXSTable(G4bool val); 190 191 G4bool GetBuildXSTable() const; 192 193 void PrintInfo(const G4ParticleDefinition*); 194 195 void Dump(G4int level); 196 void DumpHtml(); 197 void PrintHtml(const G4ParticleDefinition*, std::ofstream&); 198 void PrintModelHtml(const G4HadronicInteraction * model) const; 199 200 void SetVerbose(G4int val); 201 G4int GetVerbose(); 202 // these methods are obsolete and will be removed 203 204 G4HadronicProcess* FindProcess(const G4ParticleDefinition*, 205 G4HadronicProcessType subType); 206 207 // Energy-momentum non-conservation limits and reporting 208 void SetEpReportLevel(G4int level); 209 210 void SetProcessAbsLevel(G4double absoluteLevel); 211 212 void SetProcessRelLevel(G4double relativeLevel); 213 214 private: 215 216 // constructor 217 G4HadronicProcessStore(); 218 219 // print process info 220 void Print(G4int idxProcess, G4int idxParticle); 221 222 G4String HtmlFileName(const G4String &) const; 223 224 static G4ThreadLocal G4HadronicProcessStore* instance; 225 226 typedef const G4ParticleDefinition* PD; 227 typedef G4HadronicProcess* HP; 228 typedef G4HadronicInteraction* HI; 229 230 // hadronic processes following G4HadronicProcess interface 231 std::vector<G4HadronicProcess*> process; 232 std::vector<G4HadronicInteraction*> model; 233 std::vector<G4String> modelName; 234 std::vector<PD> particle; 235 std::vector<G4int> wasPrinted; 236 237 std::multimap<PD,HP> p_map; 238 std::multimap<HP,HI> m_map; 239 240 // hadronic processes following only G4VProcess interface 241 std::vector<G4VProcess*> extraProcess; 242 std::multimap<PD,G4VProcess*> ep_map; 243 244 G4HadronicParameters* param; 245 246 // counters and options 247 G4int n_proc = 0; 248 G4int n_model = 0; 249 G4int n_part = 0; 250 G4int n_extra = 0; 251 252 G4bool buildTableStart = true; 253 G4bool buildXSTable = false; 254 255 // cache 256 HP currentProcess = nullptr; 257 PD currentParticle = nullptr; 258 PD theGenericIon; 259 260 G4DynamicParticle localDP; 261 262 G4HadronicEPTestMessenger* theEPTestMessenger; 263 }; 264 265 #endif 266