00001
00002
00003
00004
00005
00006
00007
00008 #include "BDSGlobalConstants.hh"
00009
00010 #include "BDSLaserCompton.hh"
00011 #include "G4ios.hh"
00012 #include "G4UnitsTable.hh"
00013
00014 #if G4VERSION > 8
00015 BDSLaserCompton::BDSLaserCompton(const G4String& processName)
00016 : G4VDiscreteProcess(processName),isInitialised(false)
00017 #else
00018 BDSLaserCompton::BDSLaserCompton(const G4String& processName)
00019 : G4VeEnergyLoss(processName)
00020 #endif
00021 {
00022 itsLaserWavelength=BDSGlobals->GetLaserwireWavelength();
00023 itsLaserDirection=BDSGlobals->GetLaserwireDir();
00024
00025
00026
00027
00028
00029
00030
00031
00032 itsComptonEngine=new BDSComptonEngine();
00033 }
00034
00035
00036 BDSLaserCompton::~BDSLaserCompton(){}
00037
00038
00039 G4VParticleChange* BDSLaserCompton::PostStepDoIt(const G4Track& trackData,
00040 const G4Step& stepData)
00041 {
00042
00043
00044 aParticleChange.Initialize(trackData);
00045
00046
00047 if(!FireLaserCompton){
00048 #if G4VERSION > 8
00049 return G4VDiscreteProcess::PostStepDoIt(trackData,stepData);
00050 #else
00051 return G4VContinuousDiscreteProcess::PostStepDoIt(trackData,stepData);
00052 #endif
00053 }
00054 G4Material* aMaterial=trackData.GetMaterial() ;
00055
00056 if(aMaterial==theMaterials->GetMaterial("LaserVac"))
00057 {
00058 G4LogicalVolume* lVolume = (trackData.GetVolume())->GetLogicalVolume();
00059
00060
00061
00062 itsLaserWavelength=BDSGlobals->GetLaserwireWavelength(lVolume->GetName());
00063 itsLaserDirection=BDSGlobals->GetLaserwireDir(lVolume->GetName());
00064
00065
00066 if(itsLaserWavelength<=0.)
00067 {G4Exception("BDSLaserCompton::PostStepDoIt - Invalid Wavelength");}
00068 itsLaserEnergy=twopi*hbarc/itsLaserWavelength;
00069
00070 G4LorentzVector Laser4mom(itsLaserEnergy*itsLaserDirection.unit(),itsLaserEnergy);
00071
00072 const G4DynamicParticle* aDynamicParticle=trackData.GetDynamicParticle();
00073
00074 itsComptonEngine->
00075 SetIncomingElectron4Vec(aDynamicParticle->Get4Momentum());
00076 itsComptonEngine->SetIncomingPhoton4Vec(Laser4mom);
00077
00078 itsComptonEngine->PerformCompton();
00079
00080 if(BDSGlobals->GetLaserwireTrackPhotons())
00081 {
00082
00083
00084 G4LorentzVector ScatGam=itsComptonEngine->GetScatteredGamma();
00085
00086 G4DynamicParticle* aGamma=
00087 new G4DynamicParticle (G4Gamma::Gamma(),
00088 ScatGam.vect().unit(),
00089 ScatGam.e());
00090
00091 aParticleChange.SetNumberOfSecondaries(1);
00092 aParticleChange.AddSecondary(aGamma);
00093 if(!BDSGlobals->GetLaserwireTrackElectrons())
00094 {
00095 #if G4VERSION > 6
00096 aParticleChange.ProposeEnergy( 0. );
00097 aParticleChange.ProposeLocalEnergyDeposit (0.);
00098 aParticleChange.ProposeTrackStatus(fStopAndKill);
00099 #else
00100 aParticleChange.SetEnergyChange( 0. );
00101 aParticleChange.SetLocalEnergyDeposit (0.);
00102 aParticleChange.SetStatusChange(fStopAndKill);
00103 #endif
00104 }
00105 }
00106 else
00107 {
00108 #if G4VERSION > 6
00109 aParticleChange.SetNumberOfSecondaries(0);
00110 aParticleChange.ProposeLocalEnergyDeposit (0.);
00111 #else
00112 aParticleChange.SetNumberOfSecondaries(0);
00113 aParticleChange.SetLocalEnergyDeposit (0.);
00114 #endif
00115
00116 }
00117
00118
00119
00120
00121
00122 G4double NewKinEnergy=
00123 itsComptonEngine->GetScatteredElectron().e()-electron_mass_c2;
00124
00125
00126
00127 G4LorentzVector ScatEl=itsComptonEngine->GetScatteredElectron();
00128
00129
00130 if (NewKinEnergy > 0.)
00131 {
00132 #if G4VERSION > 6
00133 aParticleChange.ProposeMomentumDirection(ScatEl.vect().unit());
00134 aParticleChange.ProposeEnergy(NewKinEnergy);
00135 aParticleChange.ProposeLocalEnergyDeposit (0.);
00136 #else
00137 aParticleChange.SetMomentumChange(ScatEl.vect().unit());
00138 aParticleChange.SetEnergyChange(NewKinEnergy);
00139 aParticleChange.SetLocalEnergyDeposit (0.);
00140 #endif
00141 }
00142 else
00143 {
00144
00145 #if G4VERSION > 6
00146 aParticleChange.ProposeEnergy( 0. );
00147 aParticleChange.ProposeLocalEnergyDeposit (0.);
00148 G4double charge= aDynamicParticle->GetCharge();
00149 if (charge<0.) aParticleChange.ProposeTrackStatus(fStopAndKill);
00150 else aParticleChange.ProposeTrackStatus(fStopButAlive);
00151 #else
00152 aParticleChange.SetEnergyChange( 0. );
00153 aParticleChange.SetLocalEnergyDeposit (0.);
00154 G4double charge= aDynamicParticle->GetCharge();
00155 if (charge<0.) aParticleChange.SetStatusChange(fStopAndKill);
00156 else aParticleChange.SetStatusChange(fStopButAlive);
00157 #endif
00158
00159 }
00160
00161 }
00162
00163
00164
00165 #if G4VERSION > 8
00166 return G4VDiscreteProcess::PostStepDoIt(trackData,stepData);
00167 #else
00168 return G4VContinuousDiscreteProcess::PostStepDoIt(trackData,stepData);
00169 #endif
00170 }
00171
00172 #if G4VERSION > 8
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219 #endif