00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071 #ifndef G4EmModelManager_h
00072 #define G4EmModelManager_h 1
00073
00074
00075
00076 #include "globals.hh"
00077 #include "G4DataVector.hh"
00078 #include "G4EmTableType.hh"
00079 #include "G4EmProcessSubType.hh"
00080 #include "G4Region.hh"
00081
00082 class G4RegionModels
00083 {
00084
00085 friend class G4EmModelManager;
00086
00087 public:
00088
00089 private:
00090
00091 G4RegionModels(G4int nMod, std::vector<G4int>& indx,
00092 G4DataVector& lowE, const G4Region* reg);
00093
00094 ~G4RegionModels();
00095
00096 inline G4int SelectIndex(G4double e) const {
00097 G4int idx = 0;
00098 if (nModelsForRegion>1) {
00099 idx = nModelsForRegion;
00100 do {--idx;} while (idx > 0 && e <= lowKineticEnergy[idx]);
00101 }
00102 return theListOfModelIndexes[idx];
00103 };
00104
00105 inline G4int ModelIndex(G4int n) const {
00106 return theListOfModelIndexes[n];
00107 };
00108
00109 inline G4int NumberOfModels() const {
00110 return nModelsForRegion;
00111 };
00112
00113 inline G4double LowEdgeEnergy(G4int n) const {
00114 return lowKineticEnergy[n];
00115 };
00116
00117 inline const G4Region* Region() const {
00118 return theRegion;
00119 };
00120
00121 G4RegionModels(G4RegionModels &);
00122 G4RegionModels & operator=(const G4RegionModels &right);
00123
00124 const G4Region* theRegion;
00125 G4int nModelsForRegion;
00126 G4int* theListOfModelIndexes;
00127 G4double* lowKineticEnergy;
00128
00129 };
00130
00131 #include "G4VEmModel.hh"
00132 #include "G4VEmFluctuationModel.hh"
00133 #include "G4DynamicParticle.hh"
00134
00135 class G4Region;
00136 class G4ParticleDefinition;
00137 class G4PhysicsVector;
00138 class G4MaterialCutsCouple;
00139
00140
00141
00142 class G4EmModelManager
00143 {
00144 public:
00145
00146 G4EmModelManager();
00147
00148 ~G4EmModelManager();
00149
00150 void Clear();
00151
00152 const G4DataVector* Initialise(const G4ParticleDefinition*,
00153 const G4ParticleDefinition*,
00154 G4double,
00155 G4int);
00156
00157 void FillDEDXVector(G4PhysicsVector*, const G4MaterialCutsCouple*,
00158 G4EmTableType t = fRestricted);
00159
00160 void FillLambdaVector(G4PhysicsVector*, const G4MaterialCutsCouple*,
00161 G4bool startFromNull = true, G4EmTableType t = fRestricted);
00162
00163 G4VEmModel* GetModel(G4int, G4bool ver = false);
00164
00165 void AddEmModel(G4int, G4VEmModel*, G4VEmFluctuationModel*, const G4Region*);
00166
00167 void UpdateEmModel(const G4String&, G4double, G4double);
00168
00169 void DumpModelList(G4int verb);
00170
00171 inline G4VEmModel* SelectModel(G4double& energy, size_t& index);
00172
00173 inline const G4DataVector* Cuts() const;
00174
00175 inline const G4DataVector* SubCutoff() const;
00176
00177 inline void SetFluoFlag(G4bool val);
00178
00179 inline G4int NumberOfModels() const;
00180
00181 private:
00182
00183 inline G4double ComputeDEDX(G4VEmModel* model,
00184 const G4MaterialCutsCouple*,
00185 G4double kinEnergy,
00186 G4double cutEnergy,
00187 G4double minEnergy);
00188
00189
00190
00191 G4EmModelManager(G4EmModelManager &);
00192 G4EmModelManager & operator=(const G4EmModelManager &right);
00193
00194
00195
00196 private:
00197
00198 const G4DataVector* theCuts;
00199 G4DataVector* theSubCuts;
00200
00201 std::vector<G4VEmModel*> models;
00202 std::vector<G4VEmFluctuationModel*> flucModels;
00203 std::vector<const G4Region*> regions;
00204 std::vector<G4int> orderOfModels;
00205 std::vector<G4int> isUsed;
00206
00207 G4int nEmModels;
00208 G4int nRegions;
00209
00210 std::vector<G4int> idxOfRegionModels;
00211 std::vector<G4RegionModels*> setOfRegionModels;
00212
00213 G4double maxSubCutInRange;
00214
00215 const G4ParticleDefinition* particle;
00216
00217 G4int verboseLevel;
00218 G4bool severalModels;
00219 G4bool fluoFlag;
00220
00221
00222 G4RegionModels* currRegionModel;
00223 G4VEmModel* currModel;
00224 };
00225
00226
00227
00228
00229 inline G4VEmModel* G4EmModelManager::SelectModel(G4double& kinEnergy,
00230 size_t& index)
00231 {
00232 if(severalModels) {
00233 if(nRegions > 1) {
00234 currRegionModel = setOfRegionModels[idxOfRegionModels[index]];
00235 }
00236 currModel = models[currRegionModel->SelectIndex(kinEnergy)];
00237 }
00238 return currModel;
00239 }
00240
00241
00242
00243 inline const G4DataVector* G4EmModelManager::Cuts() const
00244 {
00245 return theCuts;
00246 }
00247
00248
00249
00250 inline const G4DataVector* G4EmModelManager::SubCutoff() const
00251 {
00252 return theSubCuts;
00253 }
00254
00255
00256
00257 inline void G4EmModelManager::SetFluoFlag(G4bool val)
00258 {
00259 fluoFlag = val;
00260 }
00261
00262
00263
00264 inline G4int G4EmModelManager::NumberOfModels() const
00265 {
00266 return nEmModels;
00267 }
00268
00269
00270
00271 inline G4double
00272 G4EmModelManager::ComputeDEDX(G4VEmModel* model,
00273 const G4MaterialCutsCouple* couple,
00274 G4double e,
00275 G4double cut,
00276 G4double emin)
00277 {
00278 G4double dedx = 0.0;
00279 if(model && cut > emin) {
00280 dedx = model->ComputeDEDX(couple,particle,e,cut);
00281 if(emin > 0.0) {dedx -= model->ComputeDEDX(couple,particle,e,emin);}
00282 }
00283 return dedx;
00284 }
00285
00286
00287
00288 #endif
00289