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 #ifndef G4VEmAdjointModel_h
00049 #define G4VEmAdjointModel_h 1
00050
00051 #include "globals.hh"
00052 #include "G4DynamicParticle.hh"
00053 #include "G4ParticleDefinition.hh"
00054 #include "G4MaterialCutsCouple.hh"
00055 #include "G4Material.hh"
00056 #include "G4Element.hh"
00057 #include "G4ElementVector.hh"
00058 #include "Randomize.hh"
00059 #include "G4ParticleDefinition.hh"
00060 #include "G4VEmModel.hh"
00061 #include "G4Electron.hh"
00062 #include "G4Gamma.hh"
00063 #include "G4ProductionCutsTable.hh"
00064
00065 class G4PhysicsTable;
00066 class G4Region;
00067 class G4VParticleChange;
00068 class G4ParticleChange;
00069 class G4Track;
00070 class G4AdjointCSMatrix;
00071
00072 class G4VEmAdjointModel
00073 {
00074
00075 public:
00076
00077 G4VEmAdjointModel(const G4String& nam);
00078
00079 virtual ~G4VEmAdjointModel();
00080
00081
00082
00083
00084
00085
00086
00087 virtual void SampleSecondaries(const G4Track& aTrack,
00088 G4bool IsScatProjToProjCase,
00089 G4ParticleChange* fParticleChange)=0;
00090
00091
00092
00093
00094
00095
00096
00097 virtual G4double AdjointCrossSection(const G4MaterialCutsCouple* aCouple,
00098 G4double primEnergy,
00099 G4bool IsScatProjToProjCase);
00100
00101 virtual G4double GetAdjointCrossSection(const G4MaterialCutsCouple* aCouple,
00102 G4double primEnergy,
00103 G4bool IsScatProjToProjCase);
00104
00105 virtual G4double DiffCrossSectionPerAtomPrimToSecond(
00106 G4double kinEnergyProj,
00107 G4double kinEnergyProd,
00108 G4double Z,
00109 G4double A = 0.);
00110
00111 virtual G4double DiffCrossSectionPerAtomPrimToScatPrim(
00112 G4double kinEnergyProj,
00113 G4double kinEnergyScatProj,
00114 G4double Z,
00115 G4double A = 0.);
00116
00117
00118
00119 virtual G4double DiffCrossSectionPerVolumePrimToSecond(
00120 const G4Material* aMaterial,
00121 G4double kinEnergyProj,
00122 G4double kinEnergyProd
00123 );
00124
00125 virtual G4double DiffCrossSectionPerVolumePrimToScatPrim(
00126 const G4Material* aMaterial,
00127 G4double kinEnergyProj,
00128 G4double kinEnergyScatProj
00129 );
00130
00131
00132
00133
00134
00135 virtual G4double GetSecondAdjEnergyMaxForScatProjToProjCase(G4double PrimAdjEnergy);
00136 virtual G4double GetSecondAdjEnergyMinForScatProjToProjCase(G4double PrimAdjEnergy,G4double Tcut=0);
00137 virtual G4double GetSecondAdjEnergyMaxForProdToProjCase(G4double PrimAdjEnergy);
00138 virtual G4double GetSecondAdjEnergyMinForProdToProjCase(G4double PrimAdjEnergy);
00139
00140
00141
00142
00143
00144
00145 void DefineCurrentMaterial(const G4MaterialCutsCouple* couple);
00146
00147
00148 std::vector< std::vector< double>* > ComputeAdjointCrossSectionVectorPerAtomForSecond(
00149 G4double kinEnergyProd,
00150 G4double Z,
00151 G4double A = 0.,
00152 G4int nbin_pro_decade=10
00153 );
00154 std::vector< std::vector< double>* > ComputeAdjointCrossSectionVectorPerAtomForScatProj(
00155 G4double kinEnergyProd,
00156 G4double Z,
00157 G4double A = 0.,
00158 G4int nbin_pro_decade=10
00159 );
00160
00161 std::vector< std::vector< double>* > ComputeAdjointCrossSectionVectorPerVolumeForSecond(
00162 G4Material* aMaterial,
00163 G4double kinEnergyProd,
00164 G4int nbin_pro_decade=10
00165 );
00166 std::vector< std::vector< double>* > ComputeAdjointCrossSectionVectorPerVolumeForScatProj(
00167 G4Material* aMaterial,
00168 G4double kinEnergyProd,
00169 G4int nbin_pro_decade=10
00170 );
00171
00172
00173
00174 inline void SetCSMatrices(std::vector< G4AdjointCSMatrix* >* Vec1CSMatrix, std::vector< G4AdjointCSMatrix* >* Vec2CSMatrix){
00175 pOnCSMatrixForProdToProjBackwardScattering = Vec1CSMatrix;
00176 pOnCSMatrixForScatProjToProjBackwardScattering = Vec2CSMatrix;
00177
00178
00179 };
00180
00181 inline G4ParticleDefinition* GetAdjointEquivalentOfDirectPrimaryParticleDefinition(){return theAdjEquivOfDirectPrimPartDef;}
00182
00183 inline G4ParticleDefinition* GetAdjointEquivalentOfDirectSecondaryParticleDefinition(){return theAdjEquivOfDirectSecondPartDef;}
00184
00185 inline G4double GetHighEnergyLimit(){return HighEnergyLimit;}
00186
00187 inline G4double GetLowEnergyLimit(){return LowEnergyLimit;}
00188
00189 void SetHighEnergyLimit(G4double aVal);
00190
00191 void SetLowEnergyLimit(G4double aVal);
00192
00193 inline void DefineDirectEMModel(G4VEmModel* aModel){theDirectEMModel = aModel;}
00194
00195 void SetAdjointEquivalentOfDirectPrimaryParticleDefinition(G4ParticleDefinition* aPart);
00196
00197 inline void SetAdjointEquivalentOfDirectSecondaryParticleDefinition(G4ParticleDefinition* aPart){
00198 theAdjEquivOfDirectSecondPartDef =aPart;
00199 }
00200
00201 inline void SetSecondPartOfSameType(G4bool aBool){second_part_of_same_type =aBool;}
00202
00203 inline G4bool GetSecondPartOfSameType(){return second_part_of_same_type;}
00204
00205 inline void SetUseMatrix(G4bool aBool) { UseMatrix = aBool;}
00206
00207 inline void SetUseMatrixPerElement(G4bool aBool){ UseMatrixPerElement = aBool;}
00208 inline void SetUseOnlyOneMatrixForAllElements(G4bool aBool){ UseOnlyOneMatrixForAllElements = aBool;}
00209
00210 inline void SetApplyCutInRange(G4bool aBool){ ApplyCutInRange = aBool;}
00211 inline G4bool GetUseMatrix() {return UseMatrix;}
00212 inline G4bool GetUseMatrixPerElement(){ return UseMatrixPerElement;}
00213 inline G4bool GetUseOnlyOneMatrixForAllElements(){ return UseOnlyOneMatrixForAllElements;}
00214 inline G4bool GetApplyCutInRange(){ return ApplyCutInRange;}
00215
00216 inline G4String GetName(){ return name;}
00217 inline virtual void SetCSBiasingFactor(G4double aVal) {CS_biasing_factor = aVal;}
00218
00219 protected:
00220
00221
00222
00223
00224 G4double DiffCrossSectionFunction1(G4double kinEnergyProj);
00225 G4double DiffCrossSectionFunction2(G4double kinEnergyProj);
00226 G4double DiffCrossSectionPerVolumeFunctionForIntegrationOverEkinProj(G4double EkinProd);
00227
00228
00229
00230
00231
00232 G4double SampleAdjSecEnergyFromCSMatrix(size_t MatrixIndex,G4double prim_energy,G4bool IsScatProjToProjCase);
00233 G4double SampleAdjSecEnergyFromCSMatrix(G4double prim_energy,G4bool IsScatProjToProjCase);
00234 void SelectCSMatrix(G4bool IsScatProjToProjCase);
00235
00236 virtual G4double SampleAdjSecEnergyFromDiffCrossSectionPerAtom(G4double prim_energy,G4bool IsScatProjToProjCase);
00237
00238
00239
00240
00241
00242 virtual void CorrectPostStepWeight(G4ParticleChange* fParticleChange,
00243 G4double old_weight,
00244 G4double adjointPrimKinEnergy,
00245 G4double projectileKinEnergy,
00246 G4bool IsScatProjToProjCase);
00247
00248
00249
00250
00251
00252
00253 protected:
00254
00255 G4VEmModel* theDirectEMModel;
00256 G4VParticleChange* pParticleChange;
00257
00258
00259
00260
00261
00262
00263
00264 const G4String name;
00265
00266
00267
00268
00269 G4int ASelectedNucleus;
00270 G4int ZSelectedNucleus;
00271 G4Material* SelectedMaterial;
00272 G4double kinEnergyProdForIntegration;
00273 G4double kinEnergyScatProjForIntegration;
00274 G4double kinEnergyProjForIntegration;
00275
00276
00277
00278
00279
00280
00281 std::vector< G4AdjointCSMatrix* >* pOnCSMatrixForProdToProjBackwardScattering;
00282 std::vector< G4AdjointCSMatrix* >* pOnCSMatrixForScatProjToProjBackwardScattering;
00283 std::vector<G4double> CS_Vs_ElementForScatProjToProjCase;
00284 std::vector<G4double> CS_Vs_ElementForProdToProjCase;
00285
00286 G4double lastCS;
00287 G4double lastAdjointCSForScatProjToProjCase;
00288 G4double lastAdjointCSForProdToProjCase;
00289
00290
00291
00292
00293
00294
00295
00296 G4ParticleDefinition* theAdjEquivOfDirectPrimPartDef;
00297 G4ParticleDefinition* theAdjEquivOfDirectSecondPartDef;
00298 G4ParticleDefinition* theDirectPrimaryPartDef;
00299 G4bool second_part_of_same_type;
00300
00301
00302
00303
00304 G4double preStepEnergy;
00305
00306
00307
00308 G4Material* currentMaterial;
00309 G4MaterialCutsCouple* currentCouple;
00310 size_t currentMaterialIndex;
00311 size_t currentCoupleIndex;
00312 G4double currentTcutForDirectPrim;
00313 G4double currentTcutForDirectSecond;
00314 G4bool ApplyCutInRange;
00315
00316
00317
00318
00319
00320
00321 G4double mass_ratio_product;
00322 G4double mass_ratio_projectile;
00323
00324
00325
00326
00327
00328 G4double HighEnergyLimit;
00329 G4double LowEnergyLimit;
00330
00331
00332
00333
00334
00335 G4double CS_biasing_factor;
00336
00337
00338
00339
00340 G4bool UseMatrix;
00341 G4bool UseMatrixPerElement;
00342 G4bool UseOnlyOneMatrixForAllElements;
00343
00344
00345
00346
00347 size_t indexOfUsedCrossSectionMatrix;
00348
00349 size_t model_index;
00350
00351
00352
00353
00354
00355
00356
00357
00358 };
00359
00360
00361 #endif
00362