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
00029
00030
00031
00032
00033
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 #ifndef G4AdjointCSManager_h
00051 #define G4AdjointCSManager_h 1
00052
00053 #include"globals.hh"
00054 #include<vector>
00055 #include"G4AdjointCSMatrix.hh"
00056
00057
00058 class G4VEmAdjointModel;
00059 class G4MaterialCutsCouple;
00060 class G4Material;
00061 class G4ParticleDefinition;
00062 class G4Element;
00063 class G4VEmProcess;
00064 class G4VEnergyLossProcess;
00065 class G4PhysicsTable;
00066
00068
00069 class G4AdjointCSManager
00070 {
00071
00072 public:
00073 ~G4AdjointCSManager();
00074 static G4AdjointCSManager* GetAdjointCSManager();
00075
00076 public:
00077 G4int GetNbProcesses();
00078
00079
00080
00081 size_t RegisterEmAdjointModel(G4VEmAdjointModel*);
00082
00083 void RegisterEmProcess(G4VEmProcess* aProcess, G4ParticleDefinition* aPartDef);
00084
00085 void RegisterEnergyLossProcess(G4VEnergyLossProcess* aProcess, G4ParticleDefinition* aPartDef);
00086
00087 void RegisterAdjointParticle(G4ParticleDefinition* aPartDef);
00088
00089
00090
00091
00092 void BuildCrossSectionMatrices();
00093 void BuildTotalSigmaTables();
00094
00095
00096
00097
00098 G4double GetTotalAdjointCS(G4ParticleDefinition* aPartDef, G4double Ekin,
00099 const G4MaterialCutsCouple* aCouple);
00100 G4double GetTotalForwardCS(G4ParticleDefinition* aPartDef, G4double Ekin,
00101 const G4MaterialCutsCouple* aCouple);
00102
00103 G4double GetAdjointSigma(G4double Ekin_nuc, size_t index_model,G4bool is_scat_proj_to_proj,
00104 const G4MaterialCutsCouple* aCouple);
00105
00106 void GetEminForTotalCS(G4ParticleDefinition* aPartDef,
00107 const G4MaterialCutsCouple* aCouple, G4double& emin_adj, G4double& emin_fwd);
00108 void GetMaxFwdTotalCS(G4ParticleDefinition* aPartDef,
00109 const G4MaterialCutsCouple* aCouple, G4double& e_sigma_max, G4double& sigma_max);
00110 void GetMaxAdjTotalCS(G4ParticleDefinition* aPartDef,
00111 const G4MaterialCutsCouple* aCouple, G4double& e_sigma_max, G4double& sigma_max);
00112
00113
00114
00115
00116
00117 G4double GetCrossSectionCorrection(G4ParticleDefinition* aPartDef,G4double PreStepEkin,const G4MaterialCutsCouple* aCouple, G4bool& fwd_is_used, G4double& fwd_TotCS);
00118
00119
00120
00121
00122 inline void SetFwdCrossSectionMode(G4bool aBool){forward_CS_mode=aBool;}
00123
00124
00125
00126
00127
00128 G4double GetContinuousWeightCorrection(G4ParticleDefinition* aPartDef, G4double PreStepEkin,G4double AfterStepEkin,
00129 const G4MaterialCutsCouple* aCouple, G4double step_length);
00130 G4double GetPostStepWeightCorrection();
00131
00132
00133
00134
00135
00136
00137
00138 G4double ComputeAdjointCS(G4Material* aMaterial,
00139 G4VEmAdjointModel* aModel,
00140 G4double PrimEnergy,
00141 G4double Tcut,
00142 G4bool IsScatProjToProjCase,
00143 std::vector<G4double>&
00144 AdjointCS_for_each_element);
00145
00146
00147
00148 G4Element* SampleElementFromCSMatrices(G4Material* aMaterial,
00149 G4VEmAdjointModel* aModel,
00150 G4double PrimEnergy,
00151 G4double Tcut,
00152 G4bool IsScatProjToProjCase);
00153
00154
00155
00156
00157 G4double ComputeTotalAdjointCS(const G4MaterialCutsCouple* aMatCutCouple,G4ParticleDefinition* aPart,G4double PrimEnergy);
00158
00159
00160
00161
00162 G4ParticleDefinition* GetAdjointParticleEquivalent(G4ParticleDefinition* theFwdPartDef);
00163 G4ParticleDefinition* GetForwardParticleEquivalent(G4ParticleDefinition* theAdjPartDef);
00164
00165
00166 inline void SetTmin(G4double aVal){Tmin=aVal;}
00167 inline void SetTmax(G4double aVal){Tmax=aVal;}
00168 inline void SetNbins(G4int aInt){nbins=aInt;}
00169 inline void SetIon(G4ParticleDefinition* adjIon,
00170 G4ParticleDefinition* fwdIon) {theAdjIon=adjIon; theFwdIon =fwdIon;}
00171
00172
00173 private:
00174 static G4AdjointCSManager* theInstance;
00175 std::vector< std::vector<G4AdjointCSMatrix*> > theAdjointCSMatricesForScatProjToProj;
00176 std::vector< std::vector<G4AdjointCSMatrix*> > theAdjointCSMatricesForProdToProj;
00177 std::vector< G4VEmAdjointModel*> listOfAdjointEMModel;
00178
00179 std::vector<G4AdjointCSMatrix*>
00180 BuildCrossSectionsMatricesForAGivenModelAndElement(G4VEmAdjointModel* aModel,
00181 G4int Z,
00182 G4int A,
00183 G4int nbin_pro_decade);
00184
00185 std::vector<G4AdjointCSMatrix*>
00186 BuildCrossSectionsMatricesForAGivenModelAndMaterial(G4VEmAdjointModel* aModel,
00187 G4Material* aMaterial,
00188 G4int nbin_pro_decade);
00189
00190
00191 G4Material* lastMaterial;
00192 G4double lastPrimaryEnergy;
00193 G4double lastTcut;
00194 std::vector< size_t> listOfIndexOfAdjointEMModelInAction;
00195 std::vector< G4bool> listOfIsScatProjToProjCase;
00196 std::vector< std::vector<G4double> > lastAdjointCSVsModelsAndElements;
00197 G4bool CrossSectionMatrixesAreBuilt;
00198 size_t currentParticleIndex;
00199 G4ParticleDefinition* currentParticleDef;
00200
00201
00202
00203 std::vector<G4PhysicsTable*> theTotalForwardSigmaTableVector;
00204 std::vector<G4PhysicsTable*> theTotalAdjointSigmaTableVector;
00205 std::vector< std::vector<G4double> > EminForFwdSigmaTables;
00206 std::vector< std::vector<G4double> > EminForAdjSigmaTables;
00207 std::vector< std::vector<G4double> > EkinofFwdSigmaMax;
00208 std::vector< std::vector<G4double> > EkinofAdjSigmaMax;
00209 G4bool TotalSigmaTableAreBuilt;
00210
00211
00212 std::vector<G4PhysicsTable*> listSigmaTableForAdjointModelScatProjToProj;
00213 std::vector<G4PhysicsTable*> listSigmaTableForAdjointModelProdToProj;
00214
00215
00216
00217
00218
00219
00220 std::vector< std::vector<G4VEmProcess*>* > listOfForwardEmProcess;
00221 std::vector< std::vector<G4VEnergyLossProcess*>* > listOfForwardEnergyLossProcess;
00222
00223
00224
00225 std::vector< G4ParticleDefinition*> theListOfAdjointParticlesInAction;
00226
00227
00228 G4double Tmin,Tmax;
00229 G4int nbins;
00230
00231
00232
00233
00234 G4MaterialCutsCouple* currentCouple;
00235 G4Material* currentMaterial;
00236 size_t currentMatIndex;
00237
00238 G4int verbose;
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248 G4bool forward_CS_is_used;
00249 G4bool forward_CS_mode;
00250
00251
00252
00253
00254 G4double PreadjCS,PostadjCS;
00255 G4double PrefwdCS,PostfwdCS;
00256 G4double LastEkinForCS;
00257 G4double LastCSCorrectionFactor;
00258 G4ParticleDefinition* lastPartDefForCS;
00259
00260
00261
00262 G4ParticleDefinition* theAdjIon;
00263 G4ParticleDefinition* theFwdIon;
00264 G4double massRatio;
00265
00266
00267
00268
00269 private:
00270 G4AdjointCSManager();
00271 void DefineCurrentMaterial(const G4MaterialCutsCouple* couple);
00272 void DefineCurrentParticle(const G4ParticleDefinition* aPartDef);
00273 G4double ComputeAdjointCS(G4double aPrimEnergy, G4AdjointCSMatrix* anAdjointCSMatrix, G4double Tcut);
00274 size_t eindex;
00275
00276 };
00277 #endif