/scratch0/jsnuveri/BDSIM/BDSIMgit/bdsim/src/BDSContinuousSR.cc

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

Generated on 28 Jun 2015 for BDSIM by  doxygen 1.4.7