File indexing completed on 2025-01-18 09:58:13
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
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069 #ifndef G4EmModelManager_h
0070 #define G4EmModelManager_h 1
0071
0072
0073
0074 #include "globals.hh"
0075 #include "G4DataVector.hh"
0076 #include "G4EmTableType.hh"
0077 #include "G4EmProcessSubType.hh"
0078 #include "G4Region.hh"
0079
0080 #include "G4VEmModel.hh"
0081 #include "G4VEmFluctuationModel.hh"
0082 #include "G4DynamicParticle.hh"
0083 #include <iostream>
0084
0085 class G4RegionModels
0086 {
0087
0088 friend class G4EmModelManager;
0089
0090 private:
0091
0092 G4RegionModels(G4int nMod, std::vector<G4int>& indx,
0093 G4DataVector& lowE, const G4Region* reg);
0094
0095 ~G4RegionModels();
0096
0097 inline G4int SelectIndex(G4double e) const {
0098 G4int idx = 0;
0099 if (nModelsForRegion>1) {
0100 idx = nModelsForRegion;
0101
0102 do {--idx;} while (idx > 0 && e <= lowKineticEnergy[idx]);
0103 }
0104 return theListOfModelIndexes[idx];
0105 };
0106
0107 inline G4int ModelIndex(G4int n) const {
0108 return theListOfModelIndexes[n];
0109 };
0110
0111 inline G4int NumberOfModels() const {
0112 return nModelsForRegion;
0113 };
0114
0115 inline G4double LowEdgeEnergy(G4int n) const {
0116 return lowKineticEnergy[n];
0117 };
0118
0119 inline const G4Region* Region() const {
0120 return theRegion;
0121 };
0122
0123 G4RegionModels(G4RegionModels &) = delete;
0124 G4RegionModels & operator=(const G4RegionModels &right) = delete;
0125
0126 const G4Region* theRegion;
0127 G4int nModelsForRegion;
0128 G4int* theListOfModelIndexes;
0129 G4double* lowKineticEnergy;
0130
0131 };
0132
0133
0134
0135 class G4Region;
0136 class G4ParticleDefinition;
0137 class G4PhysicsVector;
0138 class G4MaterialCutsCouple;
0139
0140
0141
0142 class G4EmModelManager
0143 {
0144 public:
0145
0146 G4EmModelManager();
0147
0148 ~G4EmModelManager();
0149
0150 void Clear();
0151
0152 const G4DataVector* Initialise(const G4ParticleDefinition* part,
0153 const G4ParticleDefinition* secPart,
0154 G4int verb);
0155
0156 void FillDEDXVector(G4PhysicsVector*, const G4MaterialCutsCouple*,
0157 G4EmTableType t = fRestricted);
0158
0159 void FillLambdaVector(G4PhysicsVector*, const G4MaterialCutsCouple*,
0160 G4bool startFromNull = true,
0161 G4EmTableType t = fRestricted);
0162
0163 void AddEmModel(G4int, G4VEmModel*, G4VEmFluctuationModel* fm,
0164 const G4Region* r);
0165
0166
0167 G4VEmModel* GetModel(G4int idx, G4bool ver = false) const;
0168
0169
0170
0171 G4VEmModel* GetRegionModel(G4int idx, std::size_t index_couple);
0172
0173
0174
0175 G4int NumberOfRegionModels(std::size_t index_couple) const;
0176
0177
0178 void DumpModelList(std::ostream& out, G4int verb);
0179
0180
0181 inline G4VEmModel* SelectModel(G4double energy, std::size_t index);
0182
0183
0184 inline const G4DataVector* Cuts() const;
0185
0186
0187 inline void SetFluoFlag(G4bool val);
0188
0189
0190 inline G4int NumberOfModels() const;
0191
0192
0193 G4EmModelManager(G4EmModelManager &) = delete;
0194 G4EmModelManager & operator=(const G4EmModelManager &right) = delete;
0195
0196 private:
0197
0198 const G4ParticleDefinition* particle = nullptr;
0199 const G4DataVector* theCuts = nullptr;
0200 G4DataVector* theCutsNew = nullptr;
0201
0202
0203 G4RegionModels* currRegionModel = nullptr;
0204 G4VEmModel* currModel = nullptr;
0205
0206 G4int nEmModels = 0;
0207 G4int nRegions = 0;
0208
0209 G4int verboseLevel = 0;
0210 G4bool severalModels = true;
0211 G4bool fluoFlag = false;
0212
0213 std::vector<G4VEmModel*> models;
0214 std::vector<G4VEmFluctuationModel*> flucModels;
0215 std::vector<const G4Region*> regions;
0216 std::vector<G4int> orderOfModels;
0217 std::vector<G4int> isUsed;
0218
0219 std::vector<G4int> idxOfRegionModels;
0220 std::vector<G4RegionModels*> setOfRegionModels;
0221 };
0222
0223
0224
0225
0226 inline
0227 G4VEmModel* G4EmModelManager::SelectModel(G4double kinEnergy, std::size_t index)
0228 {
0229 if(severalModels) {
0230 if(nRegions > 1) {
0231 currRegionModel = setOfRegionModels[idxOfRegionModels[index]];
0232 }
0233 currModel = models[currRegionModel->SelectIndex(kinEnergy)];
0234 }
0235 return currModel;
0236 }
0237
0238
0239
0240 inline const G4DataVector* G4EmModelManager::Cuts() const
0241 {
0242 return theCuts;
0243 }
0244
0245
0246
0247 inline void G4EmModelManager::SetFluoFlag(G4bool val)
0248 {
0249 fluoFlag = val;
0250 }
0251
0252
0253
0254 inline G4int G4EmModelManager::NumberOfModels() const
0255 {
0256 return nEmModels;
0257 }
0258
0259
0260
0261 #endif
0262