Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
G4GoudsmitSaundersonMscModel Class Reference

#include <G4GoudsmitSaundersonMscModel.hh>

Inheritance diagram for G4GoudsmitSaundersonMscModel:
G4VMscModel G4VEmModel

Public Member Functions

 G4GoudsmitSaundersonMscModel (const G4String &nam="GoudsmitSaunderson")
 
virtual ~G4GoudsmitSaundersonMscModel ()
 
virtual void Initialise (const G4ParticleDefinition *, const G4DataVector &)
 
void StartTracking (G4Track *)
 
virtual G4double ComputeCrossSectionPerAtom (const G4ParticleDefinition *particle, G4double KineticEnergy, G4double AtomicNumber, G4double, G4double, G4double)
 
virtual G4ThreeVectorSampleScattering (const G4ThreeVector &, G4double safety)
 
virtual G4double ComputeTruePathLengthLimit (const G4Track &track, G4double &currentMinimalStep)
 
virtual G4double ComputeGeomPathLength (G4double truePathLength)
 
virtual G4double ComputeTrueStepLength (G4double geomStepLength)
 
- Public Member Functions inherited from G4VMscModel
 G4VMscModel (const G4String &nam)
 
virtual ~G4VMscModel ()
 
virtual void SampleSecondaries (std::vector< G4DynamicParticle * > *, const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmin, G4double tmax)
 
void SetStepLimitType (G4MscStepLimitType)
 
void SetLateralDisplasmentFlag (G4bool val)
 
void SetRangeFactor (G4double)
 
void SetGeomFactor (G4double)
 
void SetSkin (G4double)
 
void SetSampleZ (G4bool)
 
G4VEnergyLossProcessGetIonisation () const
 
void SetIonisation (G4VEnergyLossProcess *, const G4ParticleDefinition *part)
 
G4double ComputeSafety (const G4ThreeVector &position, G4double limit)
 
G4double ComputeGeomLimit (const G4Track &, G4double &presafety, G4double limit)
 
G4double GetDEDX (const G4ParticleDefinition *part, G4double kineticEnergy, const G4MaterialCutsCouple *couple)
 
G4double GetRange (const G4ParticleDefinition *part, G4double kineticEnergy, const G4MaterialCutsCouple *couple)
 
G4double GetEnergy (const G4ParticleDefinition *part, G4double range, const G4MaterialCutsCouple *couple)
 
G4double GetTransportMeanFreePath (const G4ParticleDefinition *part, G4double kinEnergy)
 
- Public Member Functions inherited from G4VEmModel
 G4VEmModel (const G4String &nam)
 
virtual ~G4VEmModel ()
 
virtual void InitialiseLocal (const G4ParticleDefinition *, G4VEmModel *masterModel)
 
virtual void InitialiseForMaterial (const G4ParticleDefinition *, const G4Material *)
 
virtual void InitialiseForElement (const G4ParticleDefinition *, G4int Z)
 
virtual G4double ComputeDEDXPerVolume (const G4Material *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=DBL_MAX)
 
virtual G4double CrossSectionPerVolume (const G4Material *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
 
virtual G4double ChargeSquareRatio (const G4Track &)
 
virtual G4double GetChargeSquareRatio (const G4ParticleDefinition *, const G4Material *, G4double kineticEnergy)
 
virtual G4double GetParticleCharge (const G4ParticleDefinition *, const G4Material *, G4double kineticEnergy)
 
virtual void CorrectionsAlongStep (const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double &eloss, G4double &niel, G4double length)
 
virtual G4double Value (const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy)
 
virtual G4double MinPrimaryEnergy (const G4Material *, const G4ParticleDefinition *, G4double cut=0.0)
 
virtual G4double MinEnergyCut (const G4ParticleDefinition *, const G4MaterialCutsCouple *)
 
virtual void SetupForMaterial (const G4ParticleDefinition *, const G4Material *, G4double kineticEnergy)
 
virtual void DefineForRegion (const G4Region *)
 
void InitialiseElementSelectors (const G4ParticleDefinition *, const G4DataVector &)
 
std::vector
< G4EmElementSelector * > * 
GetElementSelectors ()
 
void SetElementSelectors (std::vector< G4EmElementSelector * > *)
 
G4double ComputeDEDX (const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=DBL_MAX)
 
G4double CrossSection (const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
 
G4double ComputeMeanFreePath (const G4ParticleDefinition *, G4double kineticEnergy, const G4Material *, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
 
G4double ComputeCrossSectionPerAtom (const G4ParticleDefinition *, const G4Element *, G4double kinEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
 
G4int SelectIsotopeNumber (const G4Element *)
 
const G4ElementSelectRandomAtom (const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
 
const G4ElementSelectRandomAtom (const G4Material *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
 
G4int SelectRandomAtomNumber (const G4Material *)
 
void SetParticleChange (G4VParticleChange *, G4VEmFluctuationModel *f=0)
 
void SetCrossSectionTable (G4PhysicsTable *, G4bool isLocal)
 
G4ElementDataGetElementData ()
 
G4PhysicsTableGetCrossSectionTable ()
 
G4VEmFluctuationModelGetModelOfFluctuations ()
 
G4VEmAngularDistributionGetAngularDistribution ()
 
void SetAngularDistribution (G4VEmAngularDistribution *)
 
G4double HighEnergyLimit () const
 
G4double LowEnergyLimit () const
 
G4double HighEnergyActivationLimit () const
 
G4double LowEnergyActivationLimit () const
 
G4double PolarAngleLimit () const
 
G4double SecondaryThreshold () const
 
G4bool LPMFlag () const
 
G4bool DeexcitationFlag () const
 
G4bool ForceBuildTableFlag () const
 
G4bool UseAngularGeneratorFlag () const
 
void SetAngularGeneratorFlag (G4bool)
 
void SetHighEnergyLimit (G4double)
 
void SetLowEnergyLimit (G4double)
 
void SetActivationHighEnergyLimit (G4double)
 
void SetActivationLowEnergyLimit (G4double)
 
G4bool IsActive (G4double kinEnergy)
 
void SetPolarAngleLimit (G4double)
 
void SetSecondaryThreshold (G4double)
 
void SetLPMFlag (G4bool val)
 
void SetDeexcitationFlag (G4bool val)
 
void SetForceBuildTable (G4bool val)
 
void SetMasterThread (G4bool val)
 
G4bool IsMaster () const
 
G4double MaxSecondaryKinEnergy (const G4DynamicParticle *dynParticle)
 
const G4StringGetName () const
 
void SetCurrentCouple (const G4MaterialCutsCouple *)
 
const G4ElementGetCurrentElement () const
 

Additional Inherited Members

- Protected Member Functions inherited from G4VMscModel
G4ParticleChangeForMSCGetParticleChangeForMSC (const G4ParticleDefinition *p=0)
 
G4double ConvertTrueToGeom (G4double &tLength, G4double &gLength)
 
- Protected Member Functions inherited from G4VEmModel
G4ParticleChangeForLossGetParticleChangeForLoss ()
 
G4ParticleChangeForGammaGetParticleChangeForGamma ()
 
virtual G4double MaxSecondaryEnergy (const G4ParticleDefinition *, G4double kineticEnergy)
 
const G4MaterialCutsCoupleCurrentCouple () const
 
void SetCurrentElement (const G4Element *)
 
- Protected Attributes inherited from G4VMscModel
G4double facrange
 
G4double facgeom
 
G4double facsafety
 
G4double skin
 
G4double dtrl
 
G4double lambdalimit
 
G4double geomMin
 
G4double geomMax
 
G4ThreeVector fDisplacement
 
G4MscStepLimitType steppingAlgorithm
 
G4bool samplez
 
G4bool latDisplasment
 
- Protected Attributes inherited from G4VEmModel
G4ElementDatafElementData
 
G4VParticleChangepParticleChange
 
G4PhysicsTablexSectionTable
 
const std::vector< G4double > * theDensityFactor
 
const std::vector< G4int > * theDensityIdx
 
size_t idxTable
 

Detailed Description

Definition at line 73 of file G4GoudsmitSaundersonMscModel.hh.

Constructor & Destructor Documentation

G4GoudsmitSaundersonMscModel::G4GoudsmitSaundersonMscModel ( const G4String nam = "GoudsmitSaunderson")

Definition at line 100 of file G4GoudsmitSaundersonMscModel.cc.

References G4cout, G4endl, G4LossTableManager::Instance(), python.hepunit::MeV, python.hepunit::mm, and G4VMscModel::samplez.

101  : G4VMscModel(nam),lowKEnergy(0.1*keV),highKEnergy(100.*TeV)
102 {
103  currentKinEnergy=currentRange=skindepth=par1=par2=par3
104  =zPathLength=truePathLength
105  =tausmall=taulim=tlimit=charge=lambdalimit=tPathLength=lambda0=lambda1
106  =lambda11=mass=0.0;
107  currentMaterialIndex = -1;
108 
109  fr=0.02,rangeinit=0.,masslimite=0.6*MeV,
110  particle=0;tausmall=1.e-16;taulim=1.e-6;tlimit=1.e10*mm;
111  tlimitmin=10.e-6*mm;geombig=1.e50*mm;geommin=1.e-3*mm,tgeom=geombig;
112  tlimitminfix=1.e-6*mm;stepmin=tlimitminfix;lambdalimit=1.*mm;smallstep=1.e10;
113  theManager=G4LossTableManager::Instance();
114  inside=false;insideskin=false;
115  samplez=false;
116  firstStep = true;
117 
118  GSTable = new G4GoudsmitSaundersonTable();
119 
120  if(ener[0] < 0.0){
121  G4cout << "### G4GoudsmitSaundersonMscModel loading ELSEPA data" << G4endl;
122  LoadELSEPAXSections();
123  }
124 }
static G4LossTableManager * Instance()
G4bool samplez
Definition: G4VMscModel.hh:188
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
G4VMscModel(const G4String &nam)
Definition: G4VMscModel.cc:58
G4GoudsmitSaundersonMscModel::~G4GoudsmitSaundersonMscModel ( )
virtual

Definition at line 126 of file G4GoudsmitSaundersonMscModel.cc.

127 {
128  delete GSTable;
129 }

Member Function Documentation

G4double G4GoudsmitSaundersonMscModel::ComputeCrossSectionPerAtom ( const G4ParticleDefinition particle,
G4double  KineticEnergy,
G4double  AtomicNumber,
G4double  ,
G4double  ,
G4double   
)
virtual

Reimplemented from G4VEmModel.

Definition at line 142 of file G4GoudsmitSaundersonMscModel.cc.

144 {
145  G4double kinEnergy = kineticEnergy;
146  if(kinEnergy<lowKEnergy) kinEnergy=lowKEnergy;
147  if(kinEnergy>highKEnergy)kinEnergy=highKEnergy;
148 
149  G4double cs(0.0), cs0(0.0);
150  CalculateIntegrals(p,Z,kinEnergy,cs0,cs);
151 
152  return cs;
153 }
const char * p
Definition: xmltok.h:285
double G4double
Definition: G4Types.hh:76
G4double G4GoudsmitSaundersonMscModel::ComputeGeomPathLength ( G4double  truePathLength)
virtual

Reimplemented from G4VMscModel.

Definition at line 650 of file G4GoudsmitSaundersonMscModel.cc.

References G4VMscModel::dtrl, G4Exp(), G4Log(), G4UniformRand, G4VMscModel::GetEnergy(), G4VMscModel::GetTransportMeanFreePath(), and G4VMscModel::samplez.

651 {
652  firstStep = false;
653  par1 = -1. ;
654  par2 = par3 = 0. ;
655 
656  // do the true -> geom transformation
657  zPathLength = tPathLength;
658 
659  // z = t for very small tPathLength
660  if(tPathLength < tlimitminfix) { return zPathLength; }
661 
662  // this correction needed to run MSC with eIoni and eBrem inactivated
663  // and makes no harm for a normal run
664  if(tPathLength > currentRange)
665  { tPathLength = currentRange; }
666 
667  G4double tau = tPathLength/lambda1 ;
668 
669  if ((tau <= tausmall) || insideskin) {
670  zPathLength = tPathLength;
671  if(zPathLength > lambda1) { zPathLength = lambda1; }
672  return zPathLength;
673  }
674 
675  G4double zmean = tPathLength;
676  if (tPathLength < currentRange*dtrl) {
677  if(tau < taulim) zmean = tPathLength*(1.-0.5*tau) ;
678  else zmean = lambda1*(1.-G4Exp(-tau));
679  } else if(currentKinEnergy < mass || tPathLength == currentRange) {
680  par1 = 1./currentRange ;
681  par2 = 1./(par1*lambda1) ;
682  par3 = 1.+par2 ;
683  if(tPathLength < currentRange)
684  zmean = (1.-G4Exp(par3*G4Log(1.-tPathLength/currentRange)))/(par1*par3) ;
685  else
686  zmean = 1./(par1*par3) ;
687  } else {
688  G4double T1 = GetEnergy(particle,currentRange-tPathLength,currentCouple);
689 
690  lambda11 = GetTransportMeanFreePath(particle,T1);
691 
692  par1 = (lambda1-lambda11)/(lambda1*tPathLength) ;
693  par2 = 1./(par1*lambda1) ;
694  par3 = 1.+par2 ;
695  zmean = (1.-G4Exp(par3*G4Log(lambda11/lambda1)))/(par1*par3) ;
696  }
697 
698  zPathLength = zmean ;
699  // sample z
700  if(samplez) {
701 
702  const G4double ztmax = 0.99;
703  G4double zt = zmean/tPathLength ;
704 
705  if (tPathLength > stepmin && zt < ztmax) {
706 
707  G4double u,cz1;
708  if(zt >= 0.333333333) {
709 
710  G4double cz = 0.5*(3.*zt-1.)/(1.-zt) ;
711  cz1 = 1.+cz ;
712  G4double u0 = cz/cz1 ;
713  G4double grej ;
714  do {
715  u = G4Exp(G4Log(G4UniformRand())/cz1) ;
716  grej = exp(cz*G4Log(u/u0))*(1.-u)/(1.-u0) ;
717  } while (grej < G4UniformRand()) ;
718 
719  } else {
720  cz1 = 1./zt-1.;
721  u = 1.-G4Exp(G4Log(G4UniformRand())/cz1) ;
722  }
723  zPathLength = tPathLength*u ;
724  }
725  }
726  if(zPathLength > lambda1) zPathLength = lambda1;
727  //G4cout << "zPathLength= " << zPathLength << " lambda1= " << lambda1 << G4endl;
728 
729  return zPathLength;
730 }
G4double dtrl
Definition: G4VMscModel.hh:180
G4bool samplez
Definition: G4VMscModel.hh:188
G4double GetEnergy(const G4ParticleDefinition *part, G4double range, const G4MaterialCutsCouple *couple)
Definition: G4VMscModel.hh:308
#define G4UniformRand()
Definition: Randomize.hh:87
G4double GetTransportMeanFreePath(const G4ParticleDefinition *part, G4double kinEnergy)
Definition: G4VMscModel.hh:345
G4double G4Log(G4double x)
Definition: G4Log.hh:227
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
Definition: G4Exp.hh:180
double G4double
Definition: G4Types.hh:76
G4double G4GoudsmitSaundersonMscModel::ComputeTruePathLengthLimit ( const G4Track track,
G4double currentMinimalStep 
)
virtual

Reimplemented from G4VMscModel.

Definition at line 457 of file G4GoudsmitSaundersonMscModel.cc.

References G4VMscModel::ComputeGeomLimit(), G4VMscModel::ComputeSafety(), G4VMscModel::ConvertTrueToGeom(), G4VMscModel::facgeom, G4VMscModel::facrange, G4VMscModel::facsafety, fGeomBoundary, fUseDistanceToBoundary, fUseSafety, G4Track::GetDynamicParticle(), G4MaterialCutsCouple::GetIndex(), G4DynamicParticle::GetKineticEnergy(), G4Track::GetMaterialCutsCouple(), G4StepPoint::GetPosition(), G4Step::GetPreStepPoint(), G4VMscModel::GetRange(), G4StepPoint::GetSafety(), G4Track::GetStep(), G4StepPoint::GetStepStatus(), G4VMscModel::GetTransportMeanFreePath(), python.hepunit::MeV, G4VEmModel::SetCurrentCouple(), G4VMscModel::skin, G4InuclParticleNames::sp, and G4VMscModel::steppingAlgorithm.

459 {
460  tPathLength = currentMinimalStep;
461  const G4DynamicParticle* dp = track.GetDynamicParticle();
462  G4StepPoint* sp = track.GetStep()->GetPreStepPoint();
463  G4StepStatus stepStatus = sp->GetStepStatus();
464  currentCouple = track.GetMaterialCutsCouple();
465  SetCurrentCouple(currentCouple);
466  currentMaterialIndex = currentCouple->GetIndex();
467  currentKinEnergy = dp->GetKineticEnergy();
468  currentRange = GetRange(particle,currentKinEnergy,currentCouple);
469 
470  lambda1 = GetTransportMeanFreePath(particle,currentKinEnergy);
471 
472  // stop here if small range particle
473  if(inside || tPathLength < tlimitminfix) {
474  return ConvertTrueToGeom(tPathLength, currentMinimalStep);
475  }
476  if(tPathLength > currentRange) tPathLength = currentRange;
477 
478  G4double presafety = sp->GetSafety();
479 
480  //G4cout << "G4GS::StepLimit tPathLength= "
481  // <<tPathLength<<" safety= " << presafety
482  // << " range= " <<currentRange<< " lambda= "<<lambda1
483  // << " Alg: " << steppingAlgorithm <<G4endl;
484 
485  // far from geometry boundary
486  if(currentRange < presafety)
487  {
488  inside = true;
489  return ConvertTrueToGeom(tPathLength, currentMinimalStep);
490  }
491 
492  // standard version
493  //
495  {
496  //compute geomlimit and presafety
497  G4double geomlimit = ComputeGeomLimit(track, presafety, tPathLength);
498 
499  // is far from boundary
500  if(currentRange <= presafety)
501  {
502  inside = true;
503  return ConvertTrueToGeom(tPathLength, currentMinimalStep);
504  }
505 
506  smallstep += 1.;
507  insideskin = false;
508 
509  if(firstStep || stepStatus == fGeomBoundary)
510  {
511  rangeinit = currentRange;
512  if(firstStep) smallstep = 1.e10;
513  else smallstep = 1.;
514 
515  //define stepmin here (it depends on lambda!)
516  //rough estimation of lambda_elastic/lambda_transport
517  G4double rat = currentKinEnergy/MeV ;
518  rat = 1.e-3/(rat*(10.+rat)) ;
519  //stepmin ~ lambda_elastic
520  stepmin = rat*lambda1;
521  skindepth = skin*stepmin;
522  //define tlimitmin
523  tlimitmin = 10.*stepmin;
524  if(tlimitmin < tlimitminfix) tlimitmin = tlimitminfix;
525 
526  //G4cout << "rangeinit= " << rangeinit << " stepmin= " << stepmin
527  // << " tlimitmin= " << tlimitmin << " geomlimit= " << geomlimit <<G4endl;
528  // constraint from the geometry
529  if((geomlimit < geombig) && (geomlimit > geommin))
530  {
531  if(stepStatus == fGeomBoundary)
532  tgeom = geomlimit/facgeom;
533  else
534  tgeom = 2.*geomlimit/facgeom;
535  }
536  else
537  tgeom = geombig;
538 
539  }
540 
541  //step limit
542  tlimit = facrange*rangeinit;
543  if(tlimit < facsafety*presafety)
544  tlimit = facsafety*presafety;
545 
546  //lower limit for tlimit
547  if(tlimit < tlimitmin) tlimit = tlimitmin;
548 
549  if(tlimit > tgeom) tlimit = tgeom;
550 
551  //G4cout << "tgeom= " << tgeom << " geomlimit= " << geomlimit
552  // << " tlimit= " << tlimit << " presafety= " << presafety << G4endl;
553 
554  // shortcut
555  if((tPathLength < tlimit) && (tPathLength < presafety) &&
556  (smallstep >= skin) && (tPathLength < geomlimit-0.999*skindepth))
557  return ConvertTrueToGeom(tPathLength, currentMinimalStep);
558 
559  // step reduction near to boundary
560  if(smallstep < skin)
561  {
562  tlimit = stepmin;
563  insideskin = true;
564  }
565  else if(geomlimit < geombig)
566  {
567  if(geomlimit > skindepth)
568  {
569  if(tlimit > geomlimit-0.999*skindepth)
570  tlimit = geomlimit-0.999*skindepth;
571  }
572  else
573  {
574  insideskin = true;
575  if(tlimit > stepmin) tlimit = stepmin;
576  }
577  }
578 
579  if(tlimit < stepmin) tlimit = stepmin;
580 
581  if(tPathLength > tlimit) tPathLength = tlimit;
582 
583  }
584  // for 'normal' simulation with or without magnetic field
585  // there no small step/single scattering at boundaries
586  else if(steppingAlgorithm == fUseSafety)
587  {
588  // compute presafety again if presafety <= 0 and no boundary
589  // i.e. when it is needed for optimization purposes
590  if((stepStatus != fGeomBoundary) && (presafety < tlimitminfix))
591  presafety = ComputeSafety(sp->GetPosition(),tPathLength);
592 
593  // is far from boundary
594  if(currentRange < presafety)
595  {
596  inside = true;
597  return ConvertTrueToGeom(tPathLength, currentMinimalStep);
598  }
599 
600  if(firstStep || stepStatus == fGeomBoundary)
601  {
602  rangeinit = currentRange;
603  fr = facrange;
604  // 9.1 like stepping for e+/e- only (not for muons,hadrons)
605  if(mass < masslimite)
606  {
607  if(lambda1 > currentRange)
608  rangeinit = lambda1;
609  if(lambda1 > lambdalimit)
610  fr *= 0.75+0.25*lambda1/lambdalimit;
611  }
612 
613  //lower limit for tlimit
614  G4double rat = currentKinEnergy/MeV ;
615  rat = 1.e-3/(rat*(10.+rat)) ;
616  tlimitmin = 10.*lambda1*rat;
617  if(tlimitmin < tlimitminfix) tlimitmin = tlimitminfix;
618  }
619  //step limit
620  tlimit = fr*rangeinit;
621 
622  if(tlimit < facsafety*presafety)
623  tlimit = facsafety*presafety;
624 
625  //lower limit for tlimit
626  if(tlimit < tlimitmin) tlimit = tlimitmin;
627 
628  if(tPathLength > tlimit) tPathLength = tlimit;
629  }
630 
631  // version similar to 7.1 (needed for some experiments)
632  else
633  {
634  if (stepStatus == fGeomBoundary)
635  {
636  if (currentRange > lambda1) tlimit = facrange*currentRange;
637  else tlimit = facrange*lambda1;
638 
639  if(tlimit < tlimitmin) tlimit = tlimitmin;
640  if(tPathLength > tlimit) tPathLength = tlimit;
641  }
642  }
643  //G4cout << "tPathLength= " << tPathLength
644  // << " currentMinimalStep= " << currentMinimalStep << G4endl;
645  return ConvertTrueToGeom(tPathLength, currentMinimalStep);
646 }
G4double facgeom
Definition: G4VMscModel.hh:177
G4double GetKineticEnergy() const
const G4DynamicParticle * GetDynamicParticle() const
G4double facrange
Definition: G4VMscModel.hh:176
G4StepStatus GetStepStatus() const
G4double ConvertTrueToGeom(G4double &tLength, G4double &gLength)
Definition: G4VMscModel.hh:246
G4double skin
Definition: G4VMscModel.hh:179
const G4MaterialCutsCouple * GetMaterialCutsCouple() const
const G4Step * GetStep() const
G4StepStatus
Definition: G4StepStatus.hh:49
G4StepPoint * GetPreStepPoint() const
const G4ThreeVector & GetPosition() const
G4double GetRange(const G4ParticleDefinition *part, G4double kineticEnergy, const G4MaterialCutsCouple *couple)
Definition: G4VMscModel.hh:288
G4double ComputeGeomLimit(const G4Track &, G4double &presafety, G4double limit)
Definition: G4VMscModel.hh:256
G4double GetTransportMeanFreePath(const G4ParticleDefinition *part, G4double kinEnergy)
Definition: G4VMscModel.hh:345
G4double ComputeSafety(const G4ThreeVector &position, G4double limit)
Definition: G4VMscModel.hh:238
G4double facsafety
Definition: G4VMscModel.hh:178
void SetCurrentCouple(const G4MaterialCutsCouple *)
Definition: G4VEmModel.hh:419
G4double GetSafety() const
G4MscStepLimitType steppingAlgorithm
Definition: G4VMscModel.hh:186
double G4double
Definition: G4Types.hh:76
G4double G4GoudsmitSaundersonMscModel::ComputeTrueStepLength ( G4double  geomStepLength)
virtual

Reimplemented from G4VMscModel.

Definition at line 735 of file G4GoudsmitSaundersonMscModel.cc.

References G4Exp(), and G4Log().

736 {
737  // step defined other than transportation
738  if(geomStepLength == zPathLength && tPathLength <= currentRange)
739  return tPathLength;
740 
741  // t = z for very small step
742  zPathLength = geomStepLength;
743  tPathLength = geomStepLength;
744  if(geomStepLength < tlimitminfix) return tPathLength;
745 
746  // recalculation
747  if((geomStepLength > lambda1*tausmall) && !insideskin)
748  {
749  if(par1 < 0.)
750  tPathLength = -lambda1*G4Log(1.-geomStepLength/lambda1) ;
751  else
752  {
753  if(par1*par3*geomStepLength < 1.)
754  tPathLength = (1.-G4Exp(G4Log(1.-par1*par3*geomStepLength)/par3))/par1 ;
755  else
756  tPathLength = currentRange;
757  }
758  }
759  if(tPathLength < geomStepLength) tPathLength = geomStepLength;
760  //G4cout << "tPathLength= " << tPathLength << " step= " << geomStepLength << G4endl;
761 
762  return tPathLength;
763 }
G4double G4Log(G4double x)
Definition: G4Log.hh:227
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
Definition: G4Exp.hh:180
void G4GoudsmitSaundersonMscModel::Initialise ( const G4ParticleDefinition p,
const G4DataVector  
)
virtual

Implements G4VEmModel.

Definition at line 131 of file G4GoudsmitSaundersonMscModel.cc.

References G4VMscModel::GetParticleChangeForMSC(), and G4VMscModel::skin.

133 {
134  skindepth=skin*stepmin;
135  SetParticle(p);
136  fParticleChange = GetParticleChangeForMSC(p);
137 }
G4double skin
Definition: G4VMscModel.hh:179
G4ParticleChangeForMSC * GetParticleChangeForMSC(const G4ParticleDefinition *p=0)
Definition: G4VMscModel.cc:89
G4ThreeVector & G4GoudsmitSaundersonMscModel::SampleScattering ( const G4ThreeVector oldDirection,
G4double  safety 
)
virtual

Reimplemented from G4VMscModel.

Definition at line 157 of file G4GoudsmitSaundersonMscModel.cc.

References G4VMscModel::dtrl, G4VMscModel::fDisplacement, G4Exp(), G4Log(), G4UniformRand, G4VMscModel::GetDEDX(), G4Material::GetElementVector(), G4VMscModel::GetEnergy(), G4MaterialCutsCouple::GetMaterial(), G4Material::GetNumberOfElements(), G4Material::GetVecNbOfAtomsPerVolume(), G4ParticleChangeForMSC::ProposeMomentumDirection(), CLHEP::Hep3Vector::rotateUz(), G4InuclParticleNames::s0, and CLHEP::Hep3Vector::set().

158 {
159  fDisplacement.set(0.0,0.0,0.0);
160  G4double kineticEnergy = currentKinEnergy;
161  //dynParticle->GetKineticEnergy();
162  if((kineticEnergy <= 0.0) || (tPathLength <= tlimitminfix)||
163  (tPathLength/tausmall < lambda1)) { return fDisplacement; }
164 
165  ///////////////////////////////////////////
166  // Effective energy
167  G4double eloss = 0.0;
168  if (tPathLength > currentRange*dtrl) {
169  eloss = kineticEnergy -
170  GetEnergy(particle,currentRange-tPathLength,currentCouple);
171  } else {
172  eloss = tPathLength*GetDEDX(particle,kineticEnergy,currentCouple);
173  }
174  /*
175  G4double ttau = kineticEnergy/electron_mass_c2;
176  G4double ttau2 = ttau*ttau;
177  G4double epsilonpp = eloss/kineticEnergy;
178  G4double cst1 = epsilonpp*epsilonpp*(6+10*ttau+5*ttau2)/(24*ttau2+48*ttau+72);
179  kineticEnergy *= (1 - cst1);
180  */
181  kineticEnergy -= 0.5*eloss;
182 
183  ///////////////////////////////////////////
184  // additivity rule for mixture and compound xsection's
185  const G4Material* mat = currentCouple->GetMaterial();
186  const G4ElementVector* theElementVector = mat->GetElementVector();
187  const G4double* theAtomNumDensityVector = mat->GetVecNbOfAtomsPerVolume();
188  G4int nelm = mat->GetNumberOfElements();
189  G4double s0(0.0), s1(0.0);
190  lambda0 = 0.0;
191  for(G4int i=0;i<nelm;i++)
192  {
193  CalculateIntegrals(particle,(*theElementVector)[i]->GetZ(),kineticEnergy,s0,s1);
194  lambda0 += (theAtomNumDensityVector[i]*s0);
195  }
196  if(lambda0>0.0) { lambda0 =1./lambda0; }
197 
198  // Newton-Raphson root's finding method of scrA from:
199  // Sig1(PWA)/Sig0(PWA)=g1=2*scrA*((1+scrA)*log(1+1/scrA)-1)
200  G4double g1=0.0;
201  if(lambda1>0.0) { g1 = lambda0/lambda1; }
202 
203  G4double logx0,x1,delta;
204  G4double x0=g1*0.5;
205  // V.Ivanchenko added limit of the loop
206  for(G4int i=0;i<1000;++i)
207  {
208  logx0 = G4Log(1.+1./x0);
209  x1 = x0-(x0*((1.+x0)*logx0-1.0)-g1*0.5)/( (1.+2.*x0)*logx0-2.0);
210 
211  // V.Ivanchenko cut step size of iterative procedure
212  if(x1 < 0.0) { x1 = 0.5*x0; }
213  else if(x1 > 2*x0) { x1 = 2*x0; }
214  else if(x1 < 0.5*x0) { x1 = 0.5*x0; }
215  delta = std::fabs( x1 - x0 );
216  x0 = x1;
217  if(delta < 1.0e-3*x1) { break;}
218  }
219  G4double scrA = x1;
220 
221  G4double lambdan=0.;
222 
223  if(lambda0>0.0) { lambdan=tPathLength/lambda0; }
224  if(lambdan<=1.0e-12) { return fDisplacement; }
225 
226  //G4cout << "E(eV)= " << kineticEnergy/eV << " L0= " << lambda0
227  // << " L1= " << lambda1 << G4endl;
228 
229  G4double Qn1 = lambdan *g1;//2.* lambdan *scrA*((1.+scrA)*log(1.+1./scrA)-1.);
230  G4double Qn12 = 0.5*Qn1;
231 
232  G4double cosTheta1,sinTheta1,cosTheta2,sinTheta2;
233  G4double cosPhi1=1.0,sinPhi1=0.0,cosPhi2=1.0,sinPhi2=0.0;
234  G4double us=0.0,vs=0.0,ws=1.0,wss=0.,x_coord=0.0,y_coord=0.0,z_coord=1.0;
235 
236  G4double epsilon1=G4UniformRand();
237  G4double expn = G4Exp(-lambdan);
238 
239  if(epsilon1<expn)// no scattering
240  { return fDisplacement; }
241  else if((epsilon1<((1.+lambdan)*expn))||(lambdan<1.))//single or plural scattering (Rutherford DCS's)
242  {
243  G4double xi=G4UniformRand();
244  xi= 2.*scrA*xi/(1.-xi + scrA);
245  if(xi<0.)xi=0.;
246  else if(xi>2.)xi=2.;
247  ws=(1. - xi);
248  wss=std::sqrt(xi*(2.-xi));
249  G4double phi0=CLHEP::twopi*G4UniformRand();
250  us=wss*cos(phi0);
251  vs=wss*sin(phi0);
252  }
253  else // multiple scattering
254  {
255  // Ref.2 subsection 4.4 "The best solution found"
256  // Sample first substep scattering angle
257  SampleCosineTheta(0.5*lambdan,scrA,cosTheta1,sinTheta1);
258  G4double phi1 = CLHEP::twopi*G4UniformRand();
259  cosPhi1 = cos(phi1);
260  sinPhi1 = sin(phi1);
261 
262  // Sample second substep scattering angle
263  SampleCosineTheta(0.5*lambdan,scrA,cosTheta2,sinTheta2);
264  G4double phi2 = CLHEP::twopi*G4UniformRand();
265  cosPhi2 = cos(phi2);
266  sinPhi2 = sin(phi2);
267 
268  // Overall scattering direction
269  us = sinTheta2*(cosTheta1*cosPhi1*cosPhi2 - sinPhi1*sinPhi2) + cosTheta2*sinTheta1*cosPhi1;
270  vs = sinTheta2*(cosTheta1*sinPhi1*cosPhi2 + cosPhi1*sinPhi2) + cosTheta2*sinTheta1*sinPhi1;
271  ws = cosTheta1*cosTheta2 - sinTheta1*sinTheta2*cosPhi2;
272  G4double sqrtA=sqrt(scrA);
273  if(acos(ws)<sqrtA)//small angle approximation for theta less than screening angle
274  {
275  G4int i=0;
276  do{i++;
277  ws=1.+Qn12*G4Log(G4UniformRand());
278  }while((fabs(ws)>1.)&&(i<20));//i<20 to avoid time consuming during the run
279  if(i>=19)ws=cos(sqrtA);
280  wss=std::sqrt((1.-ws*ws));
281  us=wss*std::cos(phi1);
282  vs=wss*std::sin(phi1);
283  }
284  }
285 
286  //G4ThreeVector oldDirection = dynParticle->GetMomentumDirection();
287  G4ThreeVector newDirection(us,vs,ws);
288  newDirection.rotateUz(oldDirection);
289  fParticleChange->ProposeMomentumDirection(newDirection);
290 
291  // corresponding to error less than 1% in the exact formula of <z>
292  if(Qn1<0.02) { z_coord = 1.0 - Qn1*(0.5 - Qn1/6.); }
293  else { z_coord = (1.-G4Exp(-Qn1))/Qn1; }
294  G4double rr = zPathLength*std::sqrt((1.- z_coord*z_coord)/(1.-ws*ws));
295  x_coord = rr*us;
296  y_coord = rr*vs;
297 
298  // displacement is computed relatively to the end point
299  z_coord -= 1.0;
300  z_coord *= zPathLength;
301  /*
302  G4cout << "G4GS::SampleSecondaries: e(MeV)= " << kineticEnergy
303  << " sinTheta= " << sqrt(1.0 - ws*ws)
304  << " trueStep(mm)= " << tPathLength
305  << " geomStep(mm)= " << zPathLength
306  << G4endl;
307  */
308 
309  fDisplacement.set(x_coord,y_coord,z_coord);
310  fDisplacement.rotateUz(oldDirection);
311 
312  return fDisplacement;
313 }
void set(double x, double y, double z)
std::vector< G4Element * > G4ElementVector
G4double dtrl
Definition: G4VMscModel.hh:180
const G4ElementVector * GetElementVector() const
Definition: G4Material.hh:188
int G4int
Definition: G4Types.hh:78
G4double GetEnergy(const G4ParticleDefinition *part, G4double range, const G4MaterialCutsCouple *couple)
Definition: G4VMscModel.hh:308
const G4double * GetVecNbOfAtomsPerVolume() const
Definition: G4Material.hh:204
#define G4UniformRand()
Definition: Randomize.hh:87
Hep3Vector & rotateUz(const Hep3Vector &)
Definition: ThreeVector.cc:72
G4ThreeVector fDisplacement
Definition: G4VMscModel.hh:185
G4double G4Log(G4double x)
Definition: G4Log.hh:227
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
Definition: G4Exp.hh:180
void ProposeMomentumDirection(const G4ThreeVector &Pfinal)
G4double GetDEDX(const G4ParticleDefinition *part, G4double kineticEnergy, const G4MaterialCutsCouple *couple)
Definition: G4VMscModel.hh:273
size_t GetNumberOfElements() const
Definition: G4Material.hh:184
double G4double
Definition: G4Types.hh:76
const G4Material * GetMaterial() const
void G4GoudsmitSaundersonMscModel::StartTracking ( G4Track track)
virtual

Reimplemented from G4VEmModel.

Definition at line 444 of file G4GoudsmitSaundersonMscModel.cc.

References G4DynamicParticle::GetDefinition(), and G4Track::GetDynamicParticle().

445 {
446  SetParticle(track->GetDynamicParticle()->GetDefinition());
447  firstStep = true;
448  inside = false;
449  insideskin = false;
450  tlimit = geombig;
451 }
const G4DynamicParticle * GetDynamicParticle() const
G4ParticleDefinition * GetDefinition() const

The documentation for this class was generated from the following files: