Index: trunk/source/processes/electromagnetic/utils/include/G4VMultipleScattering.hh
===================================================================
--- trunk/source/processes/electromagnetic/utils/include/G4VMultipleScattering.hh	(revision 991)
+++ trunk/source/processes/electromagnetic/utils/include/G4VMultipleScattering.hh	(revision 1005)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4VMultipleScattering.hh,v 1.54 2008/07/31 13:01:26 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4VMultipleScattering.hh,v 1.55 2009/02/18 12:19:33 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // -------------------------------------------------------------------
@@ -145,12 +145,8 @@
 			      G4bool ascii);
 
-  //------------------------------------------------------------------------
-  // Specific methods for msc processes
-  //------------------------------------------------------------------------
-
   // The function overloads the corresponding function of the base
   // class.It limits the step near to boundaries only
   // and invokes the method GetMscContinuousStepLimit at every step.
-  virtual G4double AlongStepGetPhysicalInteractionLength(
+  G4double AlongStepGetPhysicalInteractionLength(
                                             const G4Track&,
 					    G4double  previousStepSize,
@@ -192,10 +188,6 @@
   inline G4PhysicsTable* LambdaTable() const;
 
-  //------------------------------------------------------------------------
-  // Define and access particle type 
-  //------------------------------------------------------------------------
-
+  // access particle type 
   inline const G4ParticleDefinition* Particle() const;
-  inline void SetParticle(const G4ParticleDefinition*);
 
   //------------------------------------------------------------------------
@@ -203,27 +195,45 @@
   //------------------------------------------------------------------------
 
-  inline void AddEmModel(G4int, G4VEmModel*, const G4Region* region = 0);
-
+protected:
+  // Select model in run time
+  inline G4VEmModel* SelectModel(G4double kinEnergy);
+
+public:
+  // Select model in run time
   inline G4VEmModel* SelectModelForMaterial(G4double kinEnergy, 
 					    size_t& idxRegion) const;
 
-  // Access to models
+  // Add model for region, smaller value of order defines which
+  // model will be selected for a given energy interval  
+  inline void AddEmModel(G4int order, G4VEmModel*, const G4Region* region = 0);
+
+  // Access to models by index
   inline G4VEmModel* GetModelByIndex(G4int idx = 0, G4bool ver = false);
 
   //------------------------------------------------------------------------
-  // Set parameters for simulation of multiple scattering
-  //------------------------------------------------------------------------
-
+  // Get/Set parameters for simulation of multiple scattering
+  //------------------------------------------------------------------------
+
+  inline G4bool LateralDisplasmentFlag() const;
   inline void SetLateralDisplasmentFlag(G4bool val);
 
+  inline G4double Skin() const;
   inline void SetSkin(G4double val);
 
+  inline G4double RangeFactor() const;
   inline void SetRangeFactor(G4double val);
 
+  inline G4double GeomFactor() const;
   inline void SetGeomFactor(G4double val);
 
+  inline G4double PolarAngleLimit() const;
   inline void SetPolarAngleLimit(G4double val);
 
+  inline G4MscStepLimitType StepLimitType() const;
   inline void SetStepLimitType(G4MscStepLimitType val);
+
+  //------------------------------------------------------------------------
+  // Run time methods
+  //------------------------------------------------------------------------
 
 protected:
@@ -233,8 +243,4 @@
 			   G4double,
 			   G4ForceCondition* condition);
-
-  //------------------------------------------------------------------------
-  // Run time methods
-  //------------------------------------------------------------------------
 
   // This method is not used for tracking, it returns step limit
@@ -253,34 +259,15 @@
 					    G4double& currentSafety);
 
-  inline G4VEmModel* SelectModel(G4double kinEnergy);
-  // Select concrete model
-
-  inline const G4MaterialCutsCouple* CurrentMaterialCutsCouple() const; 
-
   // define current material
   inline void DefineMaterial(const G4MaterialCutsCouple* couple);
 
-  //------------------------------------------------------------------------
-  // Access parameters of multiple scattering
-  //------------------------------------------------------------------------
+  inline const G4MaterialCutsCouple* CurrentMaterialCutsCouple() const; 
 
   inline G4ParticleChangeForMSC* GetParticleChange();
 
-  inline G4double Skin() const;
-
-  inline G4double RangeFactor() const;
-
-  inline G4double GeomFactor() const;
-
-  inline G4double PolarAngleLimit() const;
-
-  inline G4MscStepLimitType StepLimitType() const;
-
-  inline G4bool LateralDisplasmentFlag() const;
 
 private:
 
   // hide  assignment operator
-
   G4VMultipleScattering(G4VMultipleScattering &);
   G4VMultipleScattering & operator=(const G4VMultipleScattering &right);
@@ -330,11 +317,214 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
+inline G4double G4VMultipleScattering::ContinuousStepLimit(
+                                       const G4Track& track,
+                                       G4double previousStepSize,
+                                       G4double currentMinimalStep,
+                                       G4double& currentSafety)
+{
+  return GetMscContinuousStepLimit(track,previousStepSize,currentMinimalStep,
+				   currentSafety);
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline void G4VMultipleScattering::SetBinning(G4int nbins)
+{
+  nBins = nbins;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4int G4VMultipleScattering::Binning() const
+{
+  return nBins;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline void G4VMultipleScattering::SetMinKinEnergy(G4double e)
+{
+  minKinEnergy = e;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4double G4VMultipleScattering::MinKinEnergy() const
+{
+  return minKinEnergy;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline void G4VMultipleScattering::SetMaxKinEnergy(G4double e)
+{
+  maxKinEnergy = e;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4double G4VMultipleScattering::MaxKinEnergy() const
+{
+  return maxKinEnergy;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline  void G4VMultipleScattering::SetBuildLambdaTable(G4bool val)
+{
+  buildLambdaTable = val;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4PhysicsTable* G4VMultipleScattering::LambdaTable() const
+{
+  return theLambdaTable;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline  const G4ParticleDefinition* G4VMultipleScattering::Particle() const
+{
+  return currentParticle;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline void G4VMultipleScattering::AddEmModel(G4int order, G4VEmModel* p,
+					      const G4Region* region)
+{
+  G4VEmFluctuationModel* fm = 0;
+  modelManager->AddEmModel(order, p, fm, region);
+  if(p) p->SetParticleChange(pParticleChange);
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4VEmModel* G4VMultipleScattering::SelectModel(G4double kinEnergy)
+{
+  return modelManager->SelectModel(kinEnergy, currentMaterialIndex);
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4VEmModel* G4VMultipleScattering::SelectModelForMaterial(
+		   G4double kinEnergy, size_t& idxRegion) const
+{
+  return modelManager->SelectModel(kinEnergy, idxRegion);
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
 inline 
-void G4VMultipleScattering::DefineMaterial(const G4MaterialCutsCouple* couple)
-{
-  if(couple != currentCouple) {
-    currentCouple   = couple;
-    currentMaterialIndex = couple->GetIndex();
+G4VEmModel* G4VMultipleScattering::GetModelByIndex(G4int idx, G4bool ver)
+{
+  return modelManager->GetModel(idx, ver);
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline  G4bool G4VMultipleScattering::LateralDisplasmentFlag() const
+{
+  return latDisplasment;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline  void G4VMultipleScattering::SetLateralDisplasmentFlag(G4bool val)
+{
+  latDisplasment = val;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline  G4double G4VMultipleScattering::Skin() const
+{
+  return skin;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline  void G4VMultipleScattering::SetSkin(G4double val)
+{
+  if(val < 1.0) skin = 0.0;
+  else          skin = val;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline  G4double G4VMultipleScattering::RangeFactor() const
+{
+  return facrange;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline  void G4VMultipleScattering::SetRangeFactor(G4double val)
+{
+  if(val > 0.0) facrange = val;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline  G4double G4VMultipleScattering::GeomFactor() const
+{
+  return facgeom;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline  void G4VMultipleScattering::SetGeomFactor(G4double val)
+{
+  if(val > 0.0) facgeom = val;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline  G4double G4VMultipleScattering::PolarAngleLimit() const
+{
+  return polarAngleLimit;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline  void G4VMultipleScattering::SetPolarAngleLimit(G4double val)
+{
+  if(val < 0.0)     polarAngleLimit = 0.0;
+  else if(val > pi) polarAngleLimit = pi;
+  else              polarAngleLimit = val;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4MscStepLimitType G4VMultipleScattering::StepLimitType() const
+{
+  return stepLimit;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline void G4VMultipleScattering::SetStepLimitType(G4MscStepLimitType val) 
+{
+  stepLimit = val;
+  if(val == fMinimal) facrange = 0.2;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline 
+G4double G4VMultipleScattering::GetLambda(const G4ParticleDefinition* p, 
+					  G4double& e)
+{
+  G4double x;
+  if(theLambdaTable) {
+    G4bool b;
+    x = ((*theLambdaTable)[currentMaterialIndex])->GetValue(e, b);
+  } else {
+    x = currentModel->CrossSection(currentCouple,p,e);
   }
+  if(x > DBL_MIN) x = 1./x;
+  else            x = DBL_MAX; 
+  return x;
 }
 
@@ -364,209 +554,17 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
-inline G4double G4VMultipleScattering::ContinuousStepLimit(
-                                       const G4Track& track,
-                                       G4double previousStepSize,
-                                       G4double currentMinimalStep,
-                                       G4double& currentSafety)
-{
-  return GetMscContinuousStepLimit(track,previousStepSize,currentMinimalStep,
-				   currentSafety);
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
 inline 
-G4double G4VMultipleScattering::GetLambda(const G4ParticleDefinition* p, 
-					  G4double& e)
-{
-  G4double x;
-  if(theLambdaTable) {
-    G4bool b;
-    x = ((*theLambdaTable)[currentMaterialIndex])->GetValue(e, b);
-  } else {
-    x = currentModel->CrossSection(currentCouple,p,e);
+void G4VMultipleScattering::DefineMaterial(const G4MaterialCutsCouple* couple)
+{
+  if(couple != currentCouple) {
+    currentCouple   = couple;
+    currentMaterialIndex = couple->GetIndex();
   }
-  if(x > DBL_MIN) x = 1./x;
-  else            x = DBL_MAX; 
-  return x;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4VEmModel* G4VMultipleScattering::SelectModel(G4double kinEnergy)
-{
-  return modelManager->SelectModel(kinEnergy, currentMaterialIndex);
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4VEmModel* G4VMultipleScattering::SelectModelForMaterial(
-		   G4double kinEnergy, size_t& idxRegion) const
-{
-  return modelManager->SelectModel(kinEnergy, idxRegion);
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline void G4VMultipleScattering::SetBinning(G4int nbins)
-{
-  nBins = nbins;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4int G4VMultipleScattering::Binning() const
-{
-  return nBins;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline void G4VMultipleScattering::SetMinKinEnergy(G4double e)
-{
-  minKinEnergy = e;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4double G4VMultipleScattering::MinKinEnergy() const
-{
-  return minKinEnergy;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline void G4VMultipleScattering::SetMaxKinEnergy(G4double e)
-{
-  maxKinEnergy = e;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4double G4VMultipleScattering::MaxKinEnergy() const
-{
-  return maxKinEnergy;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline  G4bool G4VMultipleScattering::LateralDisplasmentFlag() const
-{
-  return latDisplasment;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline  void G4VMultipleScattering::SetLateralDisplasmentFlag(G4bool val)
-{
-  latDisplasment = val;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4ParticleChangeForMSC* G4VMultipleScattering::GetParticleChange()
-{
-  return &fParticleChange;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline  G4double G4VMultipleScattering::Skin() const
-{
-  return skin;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline  void G4VMultipleScattering::SetSkin(G4double val)
-{
-  if(val < 1.0) skin = 0.0;
-  else          skin = val;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline  G4double G4VMultipleScattering::RangeFactor() const
-{
-  return facrange;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline  void G4VMultipleScattering::SetRangeFactor(G4double val)
-{
-  if(val > 0.0) facrange = val;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline  G4double G4VMultipleScattering::GeomFactor() const
-{
-  return facgeom;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline  void G4VMultipleScattering::SetGeomFactor(G4double val)
-{
-  if(val > 0.0) facgeom = val;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline  G4double G4VMultipleScattering::PolarAngleLimit() const
-{
-  return polarAngleLimit;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline  void G4VMultipleScattering::SetPolarAngleLimit(G4double val)
-{
-  if(val < 0.0)     polarAngleLimit = 0.0;
-  else if(val > pi) polarAngleLimit = pi;
-  else              polarAngleLimit = val;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4MscStepLimitType G4VMultipleScattering::StepLimitType() const
-{
-  return stepLimit;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline void G4VMultipleScattering::SetStepLimitType(G4MscStepLimitType val) 
-{
-  stepLimit = val;
-  if(val == fMinimal) facrange = 0.2;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline  void G4VMultipleScattering::SetBuildLambdaTable(G4bool val)
-{
-  buildLambdaTable = val;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline  const G4ParticleDefinition* G4VMultipleScattering::Particle() const
-{
-  return currentParticle;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4PhysicsTable* G4VMultipleScattering::LambdaTable() const
-{
-  return theLambdaTable;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline 
-const G4MaterialCutsCouple* G4VMultipleScattering::CurrentMaterialCutsCouple() const
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline const G4MaterialCutsCouple* 
+G4VMultipleScattering::CurrentMaterialCutsCouple() const
 {
   return currentCouple;
@@ -575,18 +573,7 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
-inline void G4VMultipleScattering::AddEmModel(G4int order, G4VEmModel* p,
-					      const G4Region* region)
-{
-  G4VEmFluctuationModel* fm = 0;
-  modelManager->AddEmModel(order, p, fm, region);
-  if(p) p->SetParticleChange(pParticleChange);
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline 
-G4VEmModel* G4VMultipleScattering::GetModelByIndex(G4int idx, G4bool ver)
-{
-  return modelManager->GetModel(idx, ver);
+inline G4ParticleChangeForMSC* G4VMultipleScattering::GetParticleChange()
+{
+  return &fParticleChange;
 }
 
