File indexing completed on 2025-01-18 09:58:04
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044 #ifndef G4CrossSectionDataStore_h
0045 #define G4CrossSectionDataStore_h 1
0046
0047 #include "globals.hh"
0048 #include "G4VCrossSectionDataSet.hh"
0049 #include "G4DynamicParticle.hh"
0050 #include "G4PhysicsVector.hh"
0051 #include <vector>
0052 #include <iostream>
0053
0054 class G4Nucleus;
0055 class G4ParticleDefinition;
0056 class G4Isotope;
0057 class G4Element;
0058 class G4Material;
0059 class G4NistManager;
0060
0061 class G4CrossSectionDataStore
0062 {
0063 public:
0064
0065 G4CrossSectionDataStore();
0066
0067 ~G4CrossSectionDataStore() = default;
0068
0069
0070 inline G4double GetCrossSection(const G4DynamicParticle*, const G4Material*);
0071 G4double ComputeCrossSection(const G4DynamicParticle*, const G4Material*);
0072
0073
0074 G4double GetCrossSection(const G4DynamicParticle*,
0075 const G4Element*, const G4Material*);
0076
0077
0078 G4double GetCrossSection(const G4DynamicParticle*, G4int Z, G4int A,
0079 const G4Isotope*,
0080 const G4Element*, const G4Material*);
0081
0082
0083 const G4Element* SampleZandA(const G4DynamicParticle*, const G4Material*,
0084 G4Nucleus& target);
0085
0086
0087 void BuildPhysicsTable(const G4ParticleDefinition&);
0088
0089
0090 void DumpPhysicsTable(const G4ParticleDefinition&);
0091
0092
0093 void DumpHtml(const G4ParticleDefinition&, std::ofstream&) const;
0094 void PrintCrossSectionHtml(const G4VCrossSectionDataSet *cs,
0095 const G4String&, const G4String&) const;
0096
0097 void AddDataSet(G4VCrossSectionDataSet*);
0098 void AddDataSet(G4VCrossSectionDataSet*, std::size_t);
0099 inline const std::vector<G4VCrossSectionDataSet*>& GetDataSetList() const;
0100
0101 inline void SetVerboseLevel(G4int value);
0102
0103
0104 inline void SetForcedElement(const G4Element*);
0105
0106 G4CrossSectionDataStore & operator=
0107 (const G4CrossSectionDataStore &right) = delete;
0108 G4CrossSectionDataStore(const G4CrossSectionDataStore&) = delete;
0109
0110 private:
0111
0112 G4double GetIsoCrossSection(const G4DynamicParticle*, G4int Z, G4int A,
0113 const G4Isotope*, const G4Element*,
0114 const G4Material*, const G4int index);
0115
0116 G4String HtmlFileName(const G4String & in) const;
0117
0118 G4NistManager* nist;
0119 const G4Material* currentMaterial = nullptr;
0120 const G4ParticleDefinition* matParticle = nullptr;
0121 const G4Element* forcedElement = nullptr;
0122 G4double matKinEnergy = 0.0;
0123 G4double matCrossSection = 0.0;
0124
0125 G4int nDataSetList = 0;
0126 G4int verboseLevel = 1;
0127
0128 std::vector<G4VCrossSectionDataSet*> dataSetList;
0129 std::vector<G4double> xsecelm;
0130 std::vector<G4double> xseciso;
0131 };
0132
0133 inline void G4CrossSectionDataStore::SetVerboseLevel(G4int value)
0134 {
0135 verboseLevel = value;
0136 }
0137
0138 inline void G4CrossSectionDataStore::SetForcedElement(const G4Element* ptr)
0139 {
0140 forcedElement = ptr;
0141 }
0142
0143 inline const std::vector<G4VCrossSectionDataSet*>&
0144 G4CrossSectionDataStore::GetDataSetList() const
0145 {
0146 return dataSetList;
0147 }
0148
0149 inline G4double
0150 G4CrossSectionDataStore::GetCrossSection(const G4DynamicParticle* dp,
0151 const G4Material* mat)
0152 {
0153 if(dp->GetKineticEnergy() != matKinEnergy || mat != currentMaterial ||
0154 dp->GetDefinition() != matParticle) {
0155 ComputeCrossSection(dp, mat);
0156 }
0157 return matCrossSection;
0158 }
0159
0160 #endif