/home/cern/BDSIM_new/src/BDSContinuousSR.cc

00001 
00008 //
00009 //  Synchrotron radiation energy loss process
00010 //
00011 
00012 
00013 
00014 
00015 #include "BDSGlobalConstants.hh" // must be first in include list
00016 #include "BDSContinuousSR.hh"
00017 #include "G4ios.hh"
00018 #include "G4UnitsTable.hh"
00019 
00020 #include "BDSAcceleratorComponent.hh"
00021 
00022 
00023 extern G4int event_number;
00024 
00025 typedef list<BDSAcceleratorComponent*>  BDSBeamline;
00026 extern BDSBeamline theBeamline;
00027 
00028 
00029 BDSContinuousSR::BDSContinuousSR(const G4String& processName)
00030   : G4VDiscreteProcess(processName)
00031      // initialization
00032 {
00033 
00034   G4cout<<"initializing contSR"<<G4endl;
00035 
00036   nExpConst=5*fine_structure_const/(2*sqrt(3.0))/electron_mass_c2;
00037   CritEngFac=3./2.*hbarc/pow(electron_mass_c2,3);
00038 
00039 } 
00040  
00041 
00042 G4VParticleChange* 
00043 BDSContinuousSR::PostStepDoIt(const G4Track& trackData,
00044                                      const G4Step& stepData)
00045 {
00046   aParticleChange.Initialize(trackData);
00047 
00048   G4double eEnergy=trackData.GetTotalEnergy();
00049 
00050   G4double R=BDSLocalRadiusOfCurvature;
00051 
00052   G4double NewKinEnergy = trackData.GetKineticEnergy();
00053  
00054   G4double GamEnergy=0;
00055 
00056   aParticleChange.SetNumberOfSecondaries(0);
00057 
00058   if(fabs(R)>0) {
00059     G4double l = trackData.GetStep()->GetStepLength();
00060     const G4DynamicParticle* aParticle = trackData.GetDynamicParticle();
00061     G4double mass = aParticle->GetMass();
00062     G4double gamma = 1.e-3 * eEnergy / mass; // in 1.e3 units
00063     
00064     G4double r0 = 2.817940325e-3*m; // classical electron radius in 1..e-12 units
00065 
00066     // G4cout<<"mass="<<mass<<G4endl;
00067 //     G4cout<<"energy="<<eEnergy<<G4endl;
00068 //     G4cout<<"gamma="<<gamma<<G4endl;
00069 //     G4cout<<"R="<<R<<G4endl;  
00070    
00071     // energy loss (in MeV)
00072     GamEnergy = l * (gamma * gamma * gamma * gamma ) * 2. * r0 * mass / ( 3. * R * R) ;
00073     
00074     //G4cout<<"constSr : poststepdoit, l= "<<l<<" energy loss =" << GamEnergy  <<" MeV"<<G4endl;
00075   }
00076 
00077   NewKinEnergy -= GamEnergy;
00078 
00079   if(GamEnergy>0)
00080     {
00081       
00082       if (NewKinEnergy > 0.)
00083         {
00084           //
00085           // Update the incident particle 
00086           aParticleChange.ProposeEnergy(NewKinEnergy);
00087         } 
00088       else
00089         { 
00090           aParticleChange.ProposeEnergy( 0. );
00091           aParticleChange.ProposeLocalEnergyDeposit (0.);
00092           G4double charge= trackData.GetDynamicParticle()->GetCharge();
00093           if (charge<0.) aParticleChange.ProposeTrackStatus(fStopAndKill);
00094           else       aParticleChange.ProposeTrackStatus(fStopButAlive);
00095         }
00096       
00097     }
00098   
00099   return G4VDiscreteProcess::PostStepDoIt(trackData,stepData);
00100 }
00101 
00102 
00103 BDSContinuousSR::~BDSContinuousSR(){
00104 }
00105 

Generated on Wed Mar 5 17:25:22 2008 for BDSIM by  doxygen 1.5.3