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 #include "G4AdjointAlongStepWeightCorrection.hh"
00029 #include "G4Step.hh"
00030 #include "G4ParticleDefinition.hh"
00031 #include "G4VParticleChange.hh"
00032 #include "G4AdjointCSManager.hh"
00033
00035
00036
00037 G4AdjointAlongStepWeightCorrection::G4AdjointAlongStepWeightCorrection(const G4String& name,
00038 G4ProcessType type): G4VContinuousProcess(name, type)
00039 {fParticleChange = new G4ParticleChange();
00040 currentMaterialIndex=0;
00041 preStepKinEnergy=1.;
00042 currentCouple=0;
00043 }
00044
00046
00047
00048 G4AdjointAlongStepWeightCorrection::~G4AdjointAlongStepWeightCorrection()
00049 {delete fParticleChange;
00050 }
00052
00053 void G4AdjointAlongStepWeightCorrection::PreparePhysicsTable(
00054 const G4ParticleDefinition& )
00055 {
00056 ;
00057 }
00059
00060
00061 void G4AdjointAlongStepWeightCorrection::BuildPhysicsTable(const G4ParticleDefinition& )
00062 {;
00063 }
00065
00066 G4VParticleChange* G4AdjointAlongStepWeightCorrection::AlongStepDoIt(const G4Track& track,
00067 const G4Step& step)
00068 {
00069
00070 fParticleChange->Initialize(track);
00071
00072
00073
00074 G4double length = step.GetStepLength();
00075
00076
00077 G4double Tkin = step.GetPostStepPoint()->GetKineticEnergy();
00078 G4ParticleDefinition* thePartDef= const_cast<G4ParticleDefinition*> (track.GetDynamicParticle()->GetDefinition());
00079 G4double weight_correction=G4AdjointCSManager::GetAdjointCSManager()->GetContinuousWeightCorrection(thePartDef,
00080 preStepKinEnergy,Tkin, currentCouple,length);
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092 G4double new_weight=weight_correction*step.GetPostStepPoint()->GetWeight();
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104 if (new_weight==0 || (new_weight<=0 && new_weight>0)){
00105
00106 new_weight=1.e-300;
00107 }
00108
00109
00110 fParticleChange->SetParentWeightByProcess(false);
00111 fParticleChange->SetSecondaryWeightByProcess(false);
00112 fParticleChange->ProposeParentWeight(new_weight);
00113
00114
00115 return fParticleChange;
00116
00117 }
00119
00120 G4double G4AdjointAlongStepWeightCorrection::GetContinuousStepLimit(const G4Track& track,
00121 G4double , G4double , G4double& )
00122 {
00123 G4double x = DBL_MAX;
00124 DefineMaterial(track.GetMaterialCutsCouple());
00125 preStepKinEnergy = track.GetKineticEnergy();
00126 return x;
00127 }