Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Protected Attributes
G4VMultipleScattering Class Referenceabstract

#include <G4VMultipleScattering.hh>

Inheritance diagram for G4VMultipleScattering:
G4VContinuousDiscreteProcess G4VProcess G4AdjointhMultipleScattering G4eMultipleScattering G4hMultipleScattering G4MuMultipleScattering

Public Member Functions

 G4VMultipleScattering (const G4String &name="msc", G4ProcessType type=fElectromagnetic)
 
virtual ~G4VMultipleScattering ()
 
virtual G4bool IsApplicable (const G4ParticleDefinition &p)=0
 
virtual void PrintInfo ()=0
 
void PreparePhysicsTable (const G4ParticleDefinition &)
 
void BuildPhysicsTable (const G4ParticleDefinition &)
 
void PrintInfoDefinition ()
 
G4bool StorePhysicsTable (const G4ParticleDefinition *, const G4String &directory, G4bool ascii=false)
 
G4bool RetrievePhysicsTable (const G4ParticleDefinition *, const G4String &directory, G4bool ascii)
 
void StartTracking (G4Track *)
 
G4double AlongStepGetPhysicalInteractionLength (const G4Track &, G4double previousStepSize, G4double currentMinimalStep, G4double &currentSafety, G4GPILSelection *selection)
 
G4double PostStepGetPhysicalInteractionLength (const G4Track &, G4double previousStepSize, G4ForceCondition *condition)
 
G4VParticleChangeAlongStepDoIt (const G4Track &, const G4Step &)
 
G4VParticleChangePostStepDoIt (const G4Track &, const G4Step &)
 
G4double ContinuousStepLimit (const G4Track &track, G4double previousStepSize, G4double currentMinimalStep, G4double &currentSafety)
 
G4VEmModelSelectModel (G4double kinEnergy, size_t idx)
 
void AddEmModel (G4int order, G4VEmModel *, const G4Region *region=0)
 
void SetEmModel (G4VMscModel *, G4int index=1)
 
G4VMscModelEmModel (G4int index=1) const
 
G4VEmModelGetModelByIndex (G4int idx=0, G4bool ver=false) const
 
void SetIonisation (G4VEnergyLossProcess *)
 
G4bool LateralDisplasmentFlag () const
 
void SetLateralDisplasmentFlag (G4bool val)
 
G4double Skin () const
 
void SetSkin (G4double val)
 
G4double RangeFactor () const
 
void SetRangeFactor (G4double val)
 
G4double GeomFactor () const
 
void SetGeomFactor (G4double val)
 
G4double PolarAngleLimit () const
 
void SetPolarAngleLimit (G4double val)
 
G4MscStepLimitType StepLimitType () const
 
void SetStepLimitType (G4MscStepLimitType val)
 
G4double LowestKinEnergy () const
 
void SetLowestKinEnergy (G4double val)
 
const G4ParticleDefinitionFirstParticle () const
 
- Public Member Functions inherited from G4VContinuousDiscreteProcess
 G4VContinuousDiscreteProcess (const G4String &, G4ProcessType aType=fNotDefined)
 
 G4VContinuousDiscreteProcess (G4VContinuousDiscreteProcess &)
 
virtual ~G4VContinuousDiscreteProcess ()
 
virtual G4double AtRestGetPhysicalInteractionLength (const G4Track &, G4ForceCondition *)
 
virtual G4VParticleChangeAtRestDoIt (const G4Track &, const G4Step &)
 
- Public Member Functions inherited from G4VProcess
 G4VProcess (const G4String &aName="NoName", G4ProcessType aType=fNotDefined)
 
 G4VProcess (const G4VProcess &right)
 
virtual ~G4VProcess ()
 
G4int operator== (const G4VProcess &right) const
 
G4int operator!= (const G4VProcess &right) const
 
G4double GetCurrentInteractionLength () const
 
void SetPILfactor (G4double value)
 
G4double GetPILfactor () const
 
G4double AlongStepGPIL (const G4Track &track, G4double previousStepSize, G4double currentMinimumStep, G4double &proposedSafety, G4GPILSelection *selection)
 
G4double AtRestGPIL (const G4Track &track, G4ForceCondition *condition)
 
G4double PostStepGPIL (const G4Track &track, G4double previousStepSize, G4ForceCondition *condition)
 
const G4StringGetPhysicsTableFileName (const G4ParticleDefinition *, const G4String &directory, const G4String &tableName, G4bool ascii=false)
 
const G4StringGetProcessName () const
 
G4ProcessType GetProcessType () const
 
void SetProcessType (G4ProcessType)
 
G4int GetProcessSubType () const
 
void SetProcessSubType (G4int)
 
virtual void EndTracking ()
 
virtual void SetProcessManager (const G4ProcessManager *)
 
virtual const G4ProcessManagerGetProcessManager ()
 
virtual void ResetNumberOfInteractionLengthLeft ()
 
G4double GetNumberOfInteractionLengthLeft () const
 
G4double GetTotalNumberOfInteractionLengthTraversed () const
 
G4bool isAtRestDoItIsEnabled () const
 
G4bool isAlongStepDoItIsEnabled () const
 
G4bool isPostStepDoItIsEnabled () const
 
virtual void DumpInfo () const
 
void SetVerboseLevel (G4int value)
 
G4int GetVerboseLevel () const
 
virtual void SetMasterProcess (G4VProcess *masterP)
 
const G4VProcessGetMasterProcess () const
 
virtual void BuildWorkerPhysicsTable (const G4ParticleDefinition &part)
 
virtual void PrepareWorkerPhysicsTable (const G4ParticleDefinition &)
 

Protected Member Functions

virtual void InitialiseProcess (const G4ParticleDefinition *)=0
 
G4double GetMeanFreePath (const G4Track &track, G4double, G4ForceCondition *condition)
 
G4double GetContinuousStepLimit (const G4Track &track, G4double previousStepSize, G4double currentMinimalStep, G4double &currentSafety)
 
- Protected Member Functions inherited from G4VContinuousDiscreteProcess
void SetGPILSelection (G4GPILSelection selection)
 
G4GPILSelection GetGPILSelection () const
 
- Protected Member Functions inherited from G4VProcess
void SubtractNumberOfInteractionLengthLeft (G4double previousStepSize)
 
void ClearNumberOfInteractionLengthLeft ()
 

Protected Attributes

G4GPILSelection valueGPILSelectionMSC
 
G4ParticleChangeForMSC fParticleChange
 
- Protected Attributes inherited from G4VProcess
const G4ProcessManageraProcessManager
 
G4VParticleChangepParticleChange
 
G4ParticleChange aParticleChange
 
G4double theNumberOfInteractionLengthLeft
 
G4double currentInteractionLength
 
G4double theInitialNumberOfInteractionLength
 
G4String theProcessName
 
G4String thePhysicsTableFileName
 
G4ProcessType theProcessType
 
G4int theProcessSubType
 
G4double thePILfactor
 
G4bool enableAtRestDoIt
 
G4bool enableAlongStepDoIt
 
G4bool enablePostStepDoIt
 
G4int verboseLevel
 

Additional Inherited Members

- Static Public Member Functions inherited from G4VProcess
static const G4StringGetProcessTypeName (G4ProcessType)
 

Detailed Description

Definition at line 91 of file G4VMultipleScattering.hh.

Constructor & Destructor Documentation

G4VMultipleScattering::G4VMultipleScattering ( const G4String name = "msc",
G4ProcessType  type = fElectromagnetic 
)

Definition at line 90 of file G4VMultipleScattering.cc.

References python.hepunit::eV, fMultipleScattering, fParticleChange, G4GenericIon::GenericIon(), G4LossTableManager::Instance(), G4VProcess::pParticleChange, G4LossTableManager::Register(), G4VProcess::SetProcessSubType(), and G4VProcess::SetVerboseLevel().

91  :
93  numberOfModels(0),
94  firstParticle(0),
95  currParticle(0),
96  stepLimit(fUseSafety),
97  skin(1.0),
98  facrange(0.04),
99  facgeom(2.5),
100  latDisplasment(true),
101  isIon(false)
102 {
103  SetVerboseLevel(1);
105  if("ionmsc" == name) { firstParticle = G4GenericIon::GenericIon(); }
106 
107  geomMin = 0.01*CLHEP::nm;
108  lowestKinEnergy = 10*eV;
109 
110  // default limit on polar angle
111  polarAngleLimit = 0.0;
112 
113  physStepLimit = gPathLength = tPathLength = 0.0;
114  fIonisation = 0;
115 
117  safetyHelper = 0;
118  fPositionChanged = false;
119  isActive = false;
120 
121  modelManager = new G4EmModelManager();
122  emManager = G4LossTableManager::Instance();
123  emManager->Register(this);
124 
125  warn = 0;
126 }
static G4LossTableManager * Instance()
G4ParticleChangeForMSC fParticleChange
void SetProcessSubType(G4int)
Definition: G4VProcess.hh:432
void Register(G4VEnergyLossProcess *p)
static G4GenericIon * GenericIon()
Definition: G4GenericIon.cc:93
G4VParticleChange * pParticleChange
Definition: G4VProcess.hh:283
void SetVerboseLevel(G4int value)
Definition: G4VProcess.hh:437
G4VMultipleScattering::~G4VMultipleScattering ( )
virtual

Definition at line 130 of file G4VMultipleScattering.cc.

References G4LossTableManager::DeRegister().

131 {
132  /*
133  if(1 < verboseLevel) {
134  G4cout << "G4VMultipleScattering destruct " << GetProcessName()
135  << G4endl;
136  }
137  */
138  delete modelManager;
139  emManager->DeRegister(this);
140 }
void DeRegister(G4VEnergyLossProcess *p)

Member Function Documentation

void G4VMultipleScattering::AddEmModel ( G4int  order,
G4VEmModel p,
const G4Region region = 0 
)

Definition at line 144 of file G4VMultipleScattering.cc.

References G4EmModelManager::AddEmModel(), fm, G4VProcess::pParticleChange, and G4VEmModel::SetParticleChange().

Referenced by G4EmLivermorePolarizedPhysics::ConstructProcess(), G4EmLowEPPhysics::ConstructProcess(), G4EmLivermorePhysics::ConstructProcess(), G4EmPenelopePhysics::ConstructProcess(), PhysListEmStandardGS::ConstructProcess(), PhysListEmStandardWVI::ConstructProcess(), PhysListEmStandard_WVI::ConstructProcess(), PhysListEmStandard_GS::ConstructProcess(), G4EmStandardPhysics_option3::ConstructProcess(), G4EmStandardPhysics::ConstructProcess(), G4EmStandardPhysics_option4::ConstructProcess(), G4EmStandardPhysics_option1::ConstructProcess(), G4EmStandardPhysics_option2::ConstructProcess(), G4MuMultipleScattering::InitialiseProcess(), G4eMultipleScattering::InitialiseProcess(), G4hMultipleScattering::InitialiseProcess(), G4AdjointhMultipleScattering::InitialiseProcess(), and G4EmConfigurator::PrepareModels().

146 {
148  modelManager->AddEmModel(order, p, fm, region);
149  if(p) { p->SetParticleChange(pParticleChange); }
150 }
void AddEmModel(G4int, G4VEmModel *, G4VEmFluctuationModel *, const G4Region *)
void SetParticleChange(G4VParticleChange *, G4VEmFluctuationModel *f=0)
Definition: G4VEmModel.cc:387
#define fm
G4VParticleChange * pParticleChange
Definition: G4VProcess.hh:283
G4VParticleChange * G4VMultipleScattering::AlongStepDoIt ( const G4Track track,
const G4Step step 
)
virtual

Reimplemented from G4VContinuousDiscreteProcess.

Definition at line 457 of file G4VMultipleScattering.cc.

References G4SafetyHelper::ComputeSafety(), G4VMscModel::ComputeTrueStepLength(), fParticleChange, G4Track::GetKineticEnergy(), G4Track::GetMaterialCutsCouple(), G4StepPoint::GetMomentumDirection(), G4StepPoint::GetPosition(), G4Step::GetPostStepPoint(), G4Step::GetPreStepPoint(), G4VMscModel::GetRange(), G4StepPoint::GetSafety(), G4Step::GetStepLength(), CLHEP::Hep3Vector::mag2(), G4ParticleChangeForMSC::ProposeMomentumDirection(), G4ParticleChangeForMSC::ProposePosition(), G4VParticleChange::ProposeTrueStepLength(), and G4VMscModel::SampleScattering().

458 {
461  fNewPosition = step.GetPostStepPoint()->GetPosition();
462  fParticleChange.ProposePosition(fNewPosition);
463  fPositionChanged = false;
464 
465  G4double geomLength = step.GetStepLength();
466 
467  // very small step - no msc
468  if(!isActive) {
469  tPathLength = geomLength;
470 
471  // sample msc
472  } else {
473  G4double range =
474  currentModel->GetRange(currParticle,track.GetKineticEnergy(),
475  track.GetMaterialCutsCouple());
476 
477  tPathLength = currentModel->ComputeTrueStepLength(geomLength);
478 
479  // protection against wrong t->g->t conversion
480  /*
481  if(currParticle->GetPDGMass() > GeV)
482  G4cout << "G4VMsc::AlongStepDoIt: GeomLength= "
483  << geomLength
484  << " tPathLength= " << tPathLength
485  << " physStepLimit= " << physStepLimit
486  << " dr= " << range - trueLength
487  << " ekin= " << track.GetKineticEnergy() << G4endl;
488  */
489  if (tPathLength > physStepLimit) {
490  tPathLength = physStepLimit;
491  }
492 
493  // do not sample scattering at the last or at a small step
494  if(tPathLength + geomMin < range && tPathLength > geomMin) {
495 
496  G4double preSafety = step.GetPreStepPoint()->GetSafety();
497  G4double maxDisp = (tPathLength + geomLength)*0.5;
498  G4double postSafety= preSafety - maxDisp;
499  G4bool safetyRecomputed = false;
500  if(postSafety < maxDisp) {
501  safetyRecomputed = true;
502  postSafety = safetyHelper->ComputeSafety(fNewPosition,maxDisp);
503  }
504  G4ThreeVector displacement = currentModel->SampleScattering(
505  step.GetPostStepPoint()->GetMomentumDirection(), postSafety);
506 
507  G4double r2 = displacement.mag2();
508 
509  //G4cout << "R= " << sqrt(r2) << " postSafety= " << postSafety
510  // << G4endl;
511 
512  // make correction for displacement
513  if(r2 > 0.0) {
514 
515  fPositionChanged = true;
516  G4double fac = 1.0;
517 
518  // displaced point is definitely within the volume
519  if(r2 > postSafety*postSafety) {
520  G4double dispR = std::sqrt(r2);
521  if(!safetyRecomputed) {
522  postSafety = safetyHelper->ComputeSafety(fNewPosition, dispR);
523  }
524 
525  if(dispR > postSafety) {
526  fac = 0.99*postSafety/dispR;
527  }
528  }
529  // compute new endpoint of the Step
530  fNewPosition += fac*displacement;
531  //safetyHelper->ReLocateWithinVolume(fNewPosition);
532  }
533  }
534  }
536  //fParticleChange.ProposePosition(fNewPosition);
537  return &fParticleChange;
538 }
G4double GetStepLength() const
const G4MaterialCutsCouple * GetMaterialCutsCouple() const
G4StepPoint * GetPreStepPoint() const
G4ParticleChangeForMSC fParticleChange
virtual G4double ComputeTrueStepLength(G4double geomPathLength)
Definition: G4VMscModel.cc:159
const G4ThreeVector & GetMomentumDirection() const
G4double GetKineticEnergy() const
const G4ThreeVector & GetPosition() const
G4double GetRange(const G4ParticleDefinition *part, G4double kineticEnergy, const G4MaterialCutsCouple *couple)
Definition: G4VMscModel.hh:288
bool G4bool
Definition: G4Types.hh:79
void ProposeTrueStepLength(G4double truePathLength)
G4double ComputeSafety(const G4ThreeVector &pGlobalPoint, G4double maxRadius=DBL_MAX)
void ProposeMomentumDirection(const G4ThreeVector &Pfinal)
void ProposePosition(const G4ThreeVector &finalPosition)
G4StepPoint * GetPostStepPoint() const
double mag2() const
G4double GetSafety() const
double G4double
Definition: G4Types.hh:76
virtual G4ThreeVector & SampleScattering(const G4ThreeVector &, G4double safety)
Definition: G4VMscModel.cc:138
G4double G4VMultipleScattering::AlongStepGetPhysicalInteractionLength ( const G4Track track,
G4double  previousStepSize,
G4double  currentMinimalStep,
G4double currentSafety,
G4GPILSelection selection 
)
virtual

Reimplemented from G4VContinuousDiscreteProcess.

Definition at line 391 of file G4VMultipleScattering.cc.

References CandidateForSelection, G4VMscModel::ComputeTruePathLengthLimit(), G4MaterialCutsCouple::GetIndex(), G4Track::GetKineticEnergy(), G4Track::GetMaterialCutsCouple(), G4Track::GetParticleDefinition(), G4ParticleDefinition::GetPDGMass(), G4VEmModel::IsActive(), NotCandidateForSelection, python.hepunit::proton_mass_c2, and SelectModel().

Referenced by GetContinuousStepLimit().

397 {
398  // get Step limit proposed by the process
399  *selection = NotCandidateForSelection;
400  physStepLimit = gPathLength = tPathLength = currentMinimalStep;
401 
402  G4double ekin = track.GetKineticEnergy();
403  /*
404  G4cout << "MSC::AlongStepGPIL: Ekin= " << ekin
405  << " " << currParticle->GetParticleName()
406  << " currMod " << currentModel
407  << G4endl;
408  */
409  // isIon flag is used only to select a model
410  if(isIon) {
411  ekin *= proton_mass_c2/track.GetParticleDefinition()->GetPDGMass();
412  }
413 
414  // select new model
415  if(1 < numberOfModels) {
416  currentModel = static_cast<G4VMscModel*>(
417  SelectModel(ekin,track.GetMaterialCutsCouple()->GetIndex()));
418  }
419  // step limit
420  if(currentModel->IsActive(ekin) && gPathLength >= geomMin
421  && ekin >= lowestKinEnergy) {
422  isActive = true;
423  tPathLength =
424  currentModel->ComputeTruePathLengthLimit(track, gPathLength);
425  if (tPathLength < physStepLimit) {
426  *selection = CandidateForSelection;
427  }
428  } else { isActive = false; }
429 
430 
431  //if(currParticle->GetPDGMass() > GeV)
432  /*
433  G4cout << "MSC::AlongStepGPIL: Ekin= " << ekin
434  << " " << currParticle->GetParticleName()
435  << " gPathLength= " << gPathLength
436  << " tPathLength= " << tPathLength
437  << " currentMinimalStep= " << currentMinimalStep
438  << " isActive " << isActive << G4endl;
439  */
440  return gPathLength;
441 }
G4VEmModel * SelectModel(G4double kinEnergy, size_t idx)
const G4MaterialCutsCouple * GetMaterialCutsCouple() const
G4double GetKineticEnergy() const
virtual G4double ComputeTruePathLengthLimit(const G4Track &track, G4double &stepLimit)
Definition: G4VMscModel.cc:145
const G4ParticleDefinition * GetParticleDefinition() const
float proton_mass_c2
Definition: hepunit.py:275
G4bool IsActive(G4double kinEnergy)
Definition: G4VEmModel.hh:711
G4double GetPDGMass() const
double G4double
Definition: G4Types.hh:76
void G4VMultipleScattering::BuildPhysicsTable ( const G4ParticleDefinition part)
virtual

Reimplemented from G4VProcess.

Definition at line 268 of file G4VMultipleScattering.cc.

References G4LossTableManager::BuildPhysicsTable(), G4EmModelManager::DumpModelList(), G4cout, G4endl, G4VEmModel::GetCrossSectionTable(), G4VProcess::GetMasterProcess(), GetModelByIndex(), G4ParticleDefinition::GetParticleName(), G4VProcess::GetProcessName(), G4VProcess::GetProcessSubType(), G4LossTableManager::Instance(), G4LossTableManager::IsMaster(), G4EmModelManager::NumberOfModels(), PrintInfo(), G4VEmModel::SetCrossSectionTable(), and G4VProcess::verboseLevel.

269 {
270  G4String num = part.GetParticleName();
271  if(1 < verboseLevel) {
272  G4cout << "### G4VMultipleScattering::BuildPhysicsTable() for "
273  << GetProcessName()
274  << " and particle " << num
275  << " IsMaster= " << G4LossTableManager::Instance()->IsMaster()
276  << G4endl;
277  }
278  G4bool master = true;
279  const G4VMultipleScattering* masterProcess =
280  static_cast<const G4VMultipleScattering*>(GetMasterProcess());
281  if(masterProcess != this) { master = false; }
282 
283  if(firstParticle == &part) {
284  /*
285  G4cout << "### G4VMultipleScattering::BuildPhysicsTable() for "
286  << GetProcessName()
287  << " and particle " << num
288  << " IsMaster= " << G4LossTableManager::Instance()->IsMaster()
289  << " " << this
290  << G4endl;
291  */
292  emManager->BuildPhysicsTable(firstParticle);
293 
294  if(!master) {
295  // initialisation of models
296  G4bool printing = true;
297  numberOfModels = modelManager->NumberOfModels();
298  /*
299  G4cout << "### G4VMultipleScattering::SlaveBuildPhysicsTable() for "
300  << GetProcessName()
301  << " and particle " << num
302  << " Nmod= " << numberOfModels << " " << this
303  << G4endl;
304  */
305  for(G4int i=0; i<numberOfModels; ++i) {
306  G4VMscModel* msc =
307  static_cast<G4VMscModel*>(GetModelByIndex(i, printing));
308  G4VMscModel* msc0=
309  static_cast<G4VMscModel*>(masterProcess->GetModelByIndex(i,printing));
310  msc->SetCrossSectionTable(msc0->GetCrossSectionTable(), false);
311  }
312  }
313 
314  }
315 
316  // explicitly defined printout by particle name
317  if(1 < verboseLevel ||
318  (0 < verboseLevel && (num == "e-" ||
319  num == "e+" || num == "mu+" ||
320  num == "mu-" || num == "proton"||
321  num == "pi+" || num == "pi-" ||
322  num == "kaon+" || num == "kaon-" ||
323  num == "alpha" || num == "anti_proton" ||
324  num == "GenericIon")))
325  {
326  G4cout << G4endl << GetProcessName()
327  << ": for " << num
328  << " SubType= " << GetProcessSubType()
329  << G4endl;
330  PrintInfo();
331  modelManager->DumpModelList(verboseLevel);
332  }
333 
334  if(1 < verboseLevel) {
335  G4cout << "### G4VMultipleScattering::BuildPhysicsTable() done for "
336  << GetProcessName()
337  << " and particle " << num
338  << G4endl;
339  }
340 }
const G4VProcess * GetMasterProcess() const
Definition: G4VProcess.hh:538
static G4LossTableManager * Instance()
G4int verboseLevel
Definition: G4VProcess.hh:368
G4PhysicsTable * GetCrossSectionTable()
Definition: G4VEmModel.hh:784
int G4int
Definition: G4Types.hh:78
const G4String & GetParticleName() const
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
G4bool IsMaster() const
void SetCrossSectionTable(G4PhysicsTable *, G4bool isLocal)
Definition: G4VEmModel.cc:395
const G4String & GetProcessName() const
Definition: G4VProcess.hh:408
void DumpModelList(G4int verb)
G4int NumberOfModels() const
void BuildPhysicsTable(const G4ParticleDefinition *aParticle)
#define G4endl
Definition: G4ios.hh:61
virtual void PrintInfo()=0
G4int GetProcessSubType() const
Definition: G4VProcess.hh:426
G4VEmModel * GetModelByIndex(G4int idx=0, G4bool ver=false) const
G4double G4VMultipleScattering::ContinuousStepLimit ( const G4Track track,
G4double  previousStepSize,
G4double  currentMinimalStep,
G4double currentSafety 
)

Definition at line 573 of file G4VMultipleScattering.cc.

References GetContinuousStepLimit().

578 {
579  return GetContinuousStepLimit(track,previousStepSize,currentMinimalStep,
580  currentSafety);
581 }
G4double GetContinuousStepLimit(const G4Track &track, G4double previousStepSize, G4double currentMinimalStep, G4double &currentSafety)
G4VMscModel * G4VMultipleScattering::EmModel ( G4int  index = 1) const

Definition at line 163 of file G4VMultipleScattering.cc.

Referenced by G4eMultipleScattering::InitialiseProcess(), G4MuMultipleScattering::InitialiseProcess(), and G4hMultipleScattering::InitialiseProcess().

164 {
165  G4VMscModel* p = 0;
166  if(index >= 0 && index < G4int(mscModels.size())) { p = mscModels[index]; }
167  return p;
168 }
const char * p
Definition: xmltok.h:285
int G4int
Definition: G4Types.hh:78
const G4ParticleDefinition * G4VMultipleScattering::FirstParticle ( ) const
inline

Definition at line 413 of file G4VMultipleScattering.hh.

414 {
415  return firstParticle;
416 }
G4double G4VMultipleScattering::GeomFactor ( ) const
inline
G4double G4VMultipleScattering::GetContinuousStepLimit ( const G4Track track,
G4double  previousStepSize,
G4double  currentMinimalStep,
G4double currentSafety 
)
protectedvirtual

Implements G4VContinuousDiscreteProcess.

Definition at line 557 of file G4VMultipleScattering.cc.

References AlongStepGetPhysicalInteractionLength(), NotCandidateForSelection, and test::x.

Referenced by ContinuousStepLimit().

562 {
564  G4double x = AlongStepGetPhysicalInteractionLength(track,previousStepSize,
565  currentMinimalStep,
566  currentSafety,
567  &selection);
568  return x;
569 }
double G4double
Definition: G4Types.hh:76
G4double AlongStepGetPhysicalInteractionLength(const G4Track &, G4double previousStepSize, G4double currentMinimalStep, G4double &currentSafety, G4GPILSelection *selection)
G4GPILSelection
G4double G4VMultipleScattering::GetMeanFreePath ( const G4Track track,
G4double  ,
G4ForceCondition condition 
)
protectedvirtual

Implements G4VContinuousDiscreteProcess.

Definition at line 585 of file G4VMultipleScattering.cc.

References DBL_MAX, and Forced.

587 {
588  *condition = Forced;
589  return DBL_MAX;
590 }
G4double condition(const G4ErrorSymMatrix &m)
#define DBL_MAX
Definition: templates.hh:83
G4VEmModel * G4VMultipleScattering::GetModelByIndex ( G4int  idx = 0,
G4bool  ver = false 
) const

Definition at line 173 of file G4VMultipleScattering.cc.

References G4EmModelManager::GetModel().

Referenced by BuildPhysicsTable(), SetIonisation(), and StartTracking().

174 {
175  return modelManager->GetModel(idx, ver);
176 }
G4VEmModel * GetModel(G4int, G4bool ver=false)
virtual void G4VMultipleScattering::InitialiseProcess ( const G4ParticleDefinition )
protectedpure virtual
virtual G4bool G4VMultipleScattering::IsApplicable ( const G4ParticleDefinition p)
pure virtual
G4bool G4VMultipleScattering::LateralDisplasmentFlag ( ) const
inline
G4double G4VMultipleScattering::LowestKinEnergy ( ) const
inline

Definition at line 399 of file G4VMultipleScattering.hh.

400 {
401  return lowestKinEnergy;
402 }
G4double G4VMultipleScattering::PolarAngleLimit ( ) const
inline

Definition at line 368 of file G4VMultipleScattering.hh.

Referenced by G4MuMultipleScattering::PrintInfo().

369 {
370  return polarAngleLimit;
371 }
G4VParticleChange * G4VMultipleScattering::PostStepDoIt ( const G4Track track,
const G4Step  
)
virtual

Reimplemented from G4VContinuousDiscreteProcess.

Definition at line 543 of file G4VMultipleScattering.cc.

References fParticleChange, G4ParticleChangeForMSC::Initialize(), G4ParticleChangeForMSC::ProposePosition(), and G4SafetyHelper::ReLocateWithinVolume().

544 {
545  fParticleChange.Initialize(track);
546 
547  if(fPositionChanged) {
548  safetyHelper->ReLocateWithinVolume(fNewPosition);
549  fParticleChange.ProposePosition(fNewPosition);
550  }
551 
552  return &fParticleChange;
553 }
virtual void Initialize(const G4Track &)
void ReLocateWithinVolume(const G4ThreeVector &pGlobalPoint)
G4ParticleChangeForMSC fParticleChange
void ProposePosition(const G4ThreeVector &finalPosition)
G4double G4VMultipleScattering::PostStepGetPhysicalInteractionLength ( const G4Track ,
G4double  previousStepSize,
G4ForceCondition condition 
)
virtual

Reimplemented from G4VContinuousDiscreteProcess.

Definition at line 446 of file G4VMultipleScattering.cc.

References DBL_MAX, and Forced.

448 {
449  *condition = Forced;
450  //*condition = NotForced;
451  return DBL_MAX;
452 }
G4double condition(const G4ErrorSymMatrix &m)
#define DBL_MAX
Definition: templates.hh:83
void G4VMultipleScattering::PreparePhysicsTable ( const G4ParticleDefinition part)
virtual

Reimplemented from G4VProcess.

Definition at line 181 of file G4VMultipleScattering.cc.

References G4Electron::Electron(), G4ParticleTable::FindParticle(), fMinimal, G4cout, G4endl, GeomFactor(), G4ProcessManager::GetAlongStepProcessVector(), G4VProcess::GetMasterProcess(), G4EmModelManager::GetModel(), G4ParticleDefinition::GetParticleName(), G4ParticleTable::GetParticleTable(), G4ParticleDefinition::GetParticleType(), G4ParticleDefinition::GetProcessManager(), G4VProcess::GetProcessName(), G4TransportationManager::GetSafetyHelper(), G4TransportationManager::GetTransportationManager(), G4VEmModel::HighEnergyLimit(), G4EmModelManager::Initialise(), G4SafetyHelper::InitialiseHelper(), InitialiseProcess(), LateralDisplasmentFlag(), G4LossTableManager::MaxKinEnergy(), G4INCL::Math::min(), n, G4EmModelManager::NumberOfModels(), eplot::pname, G4LossTableManager::PreparePhysicsTable(), RangeFactor(), G4VMscModel::SetGeomFactor(), G4VEmModel::SetHighEnergyLimit(), G4VMscModel::SetIonisation(), G4VMscModel::SetLateralDisplasmentFlag(), SetLateralDisplasmentFlag(), G4VEmModel::SetMasterThread(), G4VEmModel::SetPolarAngleLimit(), G4VMscModel::SetRangeFactor(), SetRangeFactor(), G4VMscModel::SetSkin(), G4VMscModel::SetStepLimitType(), SetStepLimitType(), G4ProcessVector::size(), Skin(), StepLimitType(), test::v, and G4VProcess::verboseLevel.

182 {
183  G4bool master = true;
184  if(GetMasterProcess() != this) { master = false; }
185 
186  if(!firstParticle) { firstParticle = &part; }
187  if(part.GetParticleType() == "nucleus") {
190  SetRangeFactor(0.2);
191  G4String pname = part.GetParticleName();
192  if(pname != "deuteron" && pname != "triton" &&
193  pname != "alpha+" && pname != "helium" &&
194  pname != "alpha" && pname != "He3" &&
195  pname != "hydrogen") {
196 
197  const G4ParticleDefinition* theGenericIon =
199 
200  if(theGenericIon && firstParticle != theGenericIon) {
201  G4ProcessManager* pm = theGenericIon->GetProcessManager();
203  size_t n = v->size();
204  for(size_t j=0; j<n; ++j) {
205  if((*v)[j] == this) {
206  firstParticle = theGenericIon;
207  isIon = true;
208  break;
209  }
210  }
211  }
212  }
213  }
214 
215  emManager->PreparePhysicsTable(&part, this, master);
216  currParticle = 0;
217 
218  if(1 < verboseLevel) {
219  G4cout << "### G4VMultipleScattering::PrepearPhysicsTable() for "
220  << GetProcessName()
221  << " and particle " << part.GetParticleName()
222  << " local particle " << firstParticle->GetParticleName()
223  << " isIon= " << isIon
224  << G4endl;
225  }
226 
227  if(firstParticle == &part) {
228 
229  InitialiseProcess(firstParticle);
230 
231  // initialisation of models
232  numberOfModels = modelManager->NumberOfModels();
233  for(G4int i=0; i<numberOfModels; ++i) {
234  G4VMscModel* msc = static_cast<G4VMscModel*>(modelManager->GetModel(i));
235  msc->SetIonisation(0, firstParticle);
236  msc->SetMasterThread(master);
237  if(0 == i) { currentModel = msc; }
238  if(isIon) {
240  msc->SetLateralDisplasmentFlag(false);
241  msc->SetRangeFactor(0.2);
242  } else {
245  msc->SetSkin(Skin());
246  msc->SetRangeFactor(RangeFactor());
247  msc->SetGeomFactor(GeomFactor());
248  }
249  msc->SetPolarAngleLimit(polarAngleLimit);
250  G4double emax =
251  std::min(msc->HighEnergyLimit(),emManager->MaxKinEnergy());
252  msc->SetHighEnergyLimit(emax);
253  }
254 
255  modelManager->Initialise(firstParticle, G4Electron::Electron(),
256  10.0, verboseLevel);
257 
258  if(!safetyHelper) {
260  ->GetSafetyHelper();
261  safetyHelper->InitialiseHelper();
262  }
263  }
264 }
const G4VProcess * GetMasterProcess() const
Definition: G4VProcess.hh:538
G4SafetyHelper * GetSafetyHelper() const
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
void InitialiseHelper()
G4int verboseLevel
Definition: G4VProcess.hh:368
G4double HighEnergyLimit() const
Definition: G4VEmModel.hh:592
void SetLateralDisplasmentFlag(G4bool val)
G4VEmModel * GetModel(G4int, G4bool ver=false)
void SetLateralDisplasmentFlag(G4bool val)
Definition: G4VMscModel.hh:196
void SetStepLimitType(G4MscStepLimitType)
Definition: G4VMscModel.hh:224
G4ProcessManager * GetProcessManager() const
int G4int
Definition: G4Types.hh:78
const G4String & GetParticleName() const
void SetHighEnergyLimit(G4double)
Definition: G4VEmModel.hh:683
G4MscStepLimitType StepLimitType() const
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
void SetRangeFactor(G4double)
Definition: G4VMscModel.hh:210
const G4String & GetParticleType() const
const G4int n
const G4String & GetProcessName() const
Definition: G4VProcess.hh:408
string pname
Definition: eplot.py:33
G4bool LateralDisplasmentFlag() const
const G4DataVector * Initialise(const G4ParticleDefinition *part, const G4ParticleDefinition *secPart, G4double minSubRange, G4int verb)
static G4TransportationManager * GetTransportationManager()
void SetMasterThread(G4bool val)
Definition: G4VEmModel.hh:669
G4int size() const
void SetIonisation(G4VEnergyLossProcess *, const G4ParticleDefinition *part)
Definition: G4VMscModel.hh:335
G4int NumberOfModels() const
static G4ParticleTable * GetParticleTable()
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
void PreparePhysicsTable(const G4ParticleDefinition *aParticle, G4VEnergyLossProcess *p, G4bool theMaster)
virtual void InitialiseProcess(const G4ParticleDefinition *)=0
void SetGeomFactor(G4double)
Definition: G4VMscModel.hh:217
static G4Electron * Electron()
Definition: G4Electron.cc:94
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
void SetSkin(G4double)
Definition: G4VMscModel.hh:203
G4ProcessVector * GetAlongStepProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const
void SetRangeFactor(G4double val)
G4double MaxKinEnergy() const
void SetPolarAngleLimit(G4double)
Definition: G4VEmModel.hh:718
void SetStepLimitType(G4MscStepLimitType val)
virtual void G4VMultipleScattering::PrintInfo ( )
pure virtual
void G4VMultipleScattering::PrintInfoDefinition ( )

Definition at line 344 of file G4VMultipleScattering.cc.

References G4EmModelManager::DumpModelList(), G4cout, G4endl, G4ParticleDefinition::GetParticleName(), G4VProcess::GetProcessName(), G4VProcess::GetProcessSubType(), PrintInfo(), and G4VProcess::verboseLevel.

345 {
346  if (0 < verboseLevel) {
347  G4cout << G4endl << GetProcessName()
348  << ": for " << firstParticle->GetParticleName()
349  << " SubType= " << GetProcessSubType()
350  << G4endl;
351  PrintInfo();
352  modelManager->DumpModelList(verboseLevel);
353  }
354 }
G4int verboseLevel
Definition: G4VProcess.hh:368
const G4String & GetParticleName() const
G4GLOB_DLL std::ostream G4cout
const G4String & GetProcessName() const
Definition: G4VProcess.hh:408
void DumpModelList(G4int verb)
#define G4endl
Definition: G4ios.hh:61
virtual void PrintInfo()=0
G4int GetProcessSubType() const
Definition: G4VProcess.hh:426
G4double G4VMultipleScattering::RangeFactor ( ) const
inline
G4bool G4VMultipleScattering::RetrievePhysicsTable ( const G4ParticleDefinition ,
const G4String directory,
G4bool  ascii 
)
virtual

Reimplemented from G4VProcess.

Definition at line 635 of file G4VMultipleScattering.cc.

638 {
639  return true;
640 }
G4VEmModel * G4VMultipleScattering::SelectModel ( G4double  kinEnergy,
size_t  idx 
)
inline

Definition at line 304 of file G4VMultipleScattering.hh.

References G4EmModelManager::SelectModel().

Referenced by AlongStepGetPhysicalInteractionLength().

305 {
306  return modelManager->SelectModel(kinEnergy, coupleIndex);
307 }
G4VEmModel * SelectModel(G4double &energy, size_t &index)
void G4VMultipleScattering::SetEmModel ( G4VMscModel p,
G4int  index = 1 
)

Definition at line 154 of file G4VMultipleScattering.cc.

References n.

Referenced by PhysListEmStandardNR::ConstructProcess(), G4eMultipleScattering::InitialiseProcess(), G4MuMultipleScattering::InitialiseProcess(), and G4hMultipleScattering::InitialiseProcess().

155 {
156  G4int n = mscModels.size();
157  if(index >= n) { for(G4int i=n; i<=index; ++i) { mscModels.push_back(0); } }
158  mscModels[index] = p;
159 }
const char * p
Definition: xmltok.h:285
int G4int
Definition: G4Types.hh:78
const G4int n
void G4VMultipleScattering::SetGeomFactor ( G4double  val)
inline

Definition at line 361 of file G4VMultipleScattering.hh.

362 {
363  if(val > 0.0) facgeom = val;
364 }
void G4VMultipleScattering::SetIonisation ( G4VEnergyLossProcess p)

Definition at line 644 of file G4VMultipleScattering.cc.

References GetModelByIndex(), and G4VMscModel::SetIonisation().

645 {
646  for(G4int i=0; i<numberOfModels; ++i) {
647  G4VMscModel* msc = static_cast<G4VMscModel*>(GetModelByIndex(i, true));
648  msc->SetIonisation(p, firstParticle);
649  }
650 }
int G4int
Definition: G4Types.hh:78
void SetIonisation(G4VEnergyLossProcess *, const G4ParticleDefinition *part)
Definition: G4VMscModel.hh:335
G4VEmModel * GetModelByIndex(G4int idx=0, G4bool ver=false) const
void G4VMultipleScattering::SetLateralDisplasmentFlag ( G4bool  val)
inline

Definition at line 318 of file G4VMultipleScattering.hh.

Referenced by RE06PhysicsList::ConstructEM(), G4AdjointhMultipleScattering::InitialiseProcess(), and PreparePhysicsTable().

319 {
320  latDisplasment = val;
321 }
void G4VMultipleScattering::SetLowestKinEnergy ( G4double  val)
inline

Definition at line 406 of file G4VMultipleScattering.hh.

407 {
408  lowestKinEnergy = val;
409 }
void G4VMultipleScattering::SetPolarAngleLimit ( G4double  val)
inline

Definition at line 375 of file G4VMultipleScattering.hh.

376 {
377  if(val < 0.0) { polarAngleLimit = 0.0; }
378  else if(val > CLHEP::pi) { polarAngleLimit = CLHEP::pi; }
379  else { polarAngleLimit = val; }
380 }
void G4VMultipleScattering::SetRangeFactor ( G4double  val)
inline
void G4VMultipleScattering::SetSkin ( G4double  val)
inline

Definition at line 332 of file G4VMultipleScattering.hh.

333 {
334  if(val < 1.0) { skin = 0.0; }
335  else { skin = val; }
336 }
void G4VMultipleScattering::SetStepLimitType ( G4MscStepLimitType  val)
inline
G4double G4VMultipleScattering::Skin ( ) const
inline
void G4VMultipleScattering::StartTracking ( G4Track track)
virtual

Reimplemented from G4VProcess.

Definition at line 358 of file G4VMultipleScattering.cc.

References G4LossTableManager::GetEnergyLossProcess(), GetModelByIndex(), G4Track::GetParticleDefinition(), G4VMscModel::SetIonisation(), and G4VEmModel::StartTracking().

359 {
360  G4VEnergyLossProcess* eloss = 0;
361  if(track->GetParticleDefinition() != currParticle) {
362  currParticle = track->GetParticleDefinition();
363  fIonisation = emManager->GetEnergyLossProcess(currParticle);
364  eloss = fIonisation;
365  }
366  /*
367  G4cout << "G4VMultipleScattering::StartTracking Nmod= " << numberOfModels
368  << " " << currParticle->GetParticleName()
369  << " E(MeV)= " << track->GetKineticEnergy()
370  << " Ion= " << eloss << " " << fIonisation << " IsMaster= "
371  << G4LossTableManager::Instance()->IsMaster()
372  << G4endl;
373  */
374  // one model
375  if(1 == numberOfModels) {
376  currentModel->StartTracking(track);
377  if(eloss) { currentModel->SetIonisation(fIonisation, currParticle); }
378 
379  // many models
380  } else {
381  for(G4int i=0; i<numberOfModels; ++i) {
382  G4VMscModel* msc = static_cast<G4VMscModel*>(GetModelByIndex(i,true));
383  msc->StartTracking(track);
384  if(eloss) { msc->SetIonisation(fIonisation, currParticle); }
385  }
386  }
387 }
virtual void StartTracking(G4Track *)
Definition: G4VEmModel.cc:271
int G4int
Definition: G4Types.hh:78
const G4ParticleDefinition * GetParticleDefinition() const
G4VEnergyLossProcess * GetEnergyLossProcess(const G4ParticleDefinition *)
void SetIonisation(G4VEnergyLossProcess *, const G4ParticleDefinition *part)
Definition: G4VMscModel.hh:335
G4VEmModel * GetModelByIndex(G4int idx=0, G4bool ver=false) const
G4MscStepLimitType G4VMultipleScattering::StepLimitType ( ) const
inline
G4bool G4VMultipleScattering::StorePhysicsTable ( const G4ParticleDefinition part,
const G4String directory,
G4bool  ascii = false 
)
virtual

Reimplemented from G4VProcess.

Definition at line 595 of file G4VMultipleScattering.cc.

References G4cout, G4endl, G4VEmModel::GetCrossSectionTable(), G4EmModelManager::GetModel(), G4ParticleDefinition::GetParticleName(), G4VProcess::GetPhysicsTableFileName(), G4VProcess::GetProcessName(), G4INCL::Math::min(), G4EmModelManager::NumberOfModels(), G4PhysicsTable::StorePhysicsTable(), and G4VProcess::verboseLevel.

598 {
599  G4bool yes = true;
600  if(part != firstParticle) { return yes; }
601  G4int nmod = modelManager->NumberOfModels();
602  static const G4String ss[4] = {"1","2","3","4"};
603  for(G4int i=0; i<nmod; ++i) {
604  G4VEmModel* msc = modelManager->GetModel(i);
605  yes = true;
606  G4PhysicsTable* table = msc->GetCrossSectionTable();
607  if (table) {
608  G4int j = std::min(i,3);
609  G4String name =
610  GetPhysicsTableFileName(part,directory,"LambdaMod"+ss[j],ascii);
611  yes = table->StorePhysicsTable(name,ascii);
612 
613  if ( yes ) {
614  if ( verboseLevel>0 ) {
615  G4cout << "Physics table are stored for "
616  << part->GetParticleName()
617  << " and process " << GetProcessName()
618  << " with a name <" << name << "> " << G4endl;
619  }
620  } else {
621  G4cout << "Fail to store Physics Table for "
622  << part->GetParticleName()
623  << " and process " << GetProcessName()
624  << " in the directory <" << directory
625  << "> " << G4endl;
626  }
627  }
628  }
629  return yes;
630 }
G4int verboseLevel
Definition: G4VProcess.hh:368
G4VEmModel * GetModel(G4int, G4bool ver=false)
const XML_Char * name
G4PhysicsTable * GetCrossSectionTable()
Definition: G4VEmModel.hh:784
int G4int
Definition: G4Types.hh:78
const G4String & GetPhysicsTableFileName(const G4ParticleDefinition *, const G4String &directory, const G4String &tableName, G4bool ascii=false)
Definition: G4VProcess.cc:186
const G4String & GetParticleName() const
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
const G4String & GetProcessName() const
Definition: G4VProcess.hh:408
G4int NumberOfModels() const
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
#define G4endl
Definition: G4ios.hh:61
G4bool StorePhysicsTable(const G4String &filename, G4bool ascii=false)

Field Documentation

G4ParticleChangeForMSC G4VMultipleScattering::fParticleChange
protected

Definition at line 280 of file G4VMultipleScattering.hh.

Referenced by AlongStepDoIt(), G4VMultipleScattering(), and PostStepDoIt().

G4GPILSelection G4VMultipleScattering::valueGPILSelectionMSC
protected

Definition at line 279 of file G4VMultipleScattering.hh.


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