Index: trunk/source/processes/electromagnetic/utils/History
===================================================================
--- trunk/source/processes/electromagnetic/utils/History	(revision 968)
+++ trunk/source/processes/electromagnetic/utils/History	(revision 991)
@@ -1,3 +1,3 @@
-$Id: History,v 1.372 2009/02/26 11:33:33 vnivanch Exp $
+$Id: History,v 1.364 2008/11/20 20:32:40 vnivanch Exp $
 -------------------------------------------------------------------
 
@@ -17,30 +17,4 @@
      * Reverse chronological order (last date on top), please *
      ----------------------------------------------------------
-
-26 February 09: V.Ivant (emutils-V09-02-03)
-G4EmConfigurator - fixed for the case if only fluctuation model is set
-                   and main model is default
-
-22 February 09: V.Ivant (emutils-V09-02-02)
-- G4VEmModel - make methods to access geometry protected, added new
-               method SetSampleZ, added geommax private member
-- G4EmCalculator - added possibility to be used by DNA processes:
-                   take into account special DNA particles 
-
-18 February 09: V.Ivant (emutils-V09-02-01)
-G4VEmModel, G4VEmFluctuationModel, G4VEnegryLossProcess, G4VEmProcess, 
-G4VMultipleScattering - move all virtual methods to source, update comments
-G4VEmModel - added flagDeexcitation and Get/Set methods
-G4VEnegryLossProcess, G4VEmProcess - added calls to deexcitation PostStep
-G4EmProcessOptions - added ActivateDeexcitation method
-G4EnergyLossMessenger - added /process/em/deexcitation UI command 
-G4LossTableBuilder - added protection in BuildRangeTable against zero dedx 
-
-27 January 09: V.Ivant (emutils-V09-02-00)
-G4VEmModel - added method SampleDeexcitationAlongStep
-G4VEnegryLossProcess - added deexcitation AlongStep per region
-G4VMscModel - added methdos: InitialiseSafetyHelper, ComputeSafety,
-              ComputeGeomLimit, ComputeDisplacement
-G4VEmProcess - added possibility to set more than 1 model
 
 20 November 08: V.Ivant (emutils-V09-01-37)
Index: trunk/source/processes/electromagnetic/utils/include/G4EmProcessOptions.hh
===================================================================
--- trunk/source/processes/electromagnetic/utils/include/G4EmProcessOptions.hh	(revision 968)
+++ trunk/source/processes/electromagnetic/utils/include/G4EmProcessOptions.hh	(revision 991)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4EmProcessOptions.hh,v 1.15 2009/02/18 14:40:10 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02-ref-02 $
+// $Id: G4EmProcessOptions.hh,v 1.14 2008/04/17 10:33:26 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02 $
 //
 //
@@ -107,6 +107,5 @@
   void SetLinearLossLimit(G4double val);
 
-  void ActivateDeexcitation(const G4String& proc, G4bool val, 
-			    const G4String& reg = "");
+  void ActivateDeexcitation(G4bool val, const G4Region* r = 0);
 
   void SetMscStepLimitation(G4MscStepLimitType val);
Index: trunk/source/processes/electromagnetic/utils/include/G4EnergyLossMessenger.hh
===================================================================
--- trunk/source/processes/electromagnetic/utils/include/G4EnergyLossMessenger.hh	(revision 968)
+++ trunk/source/processes/electromagnetic/utils/include/G4EnergyLossMessenger.hh	(revision 991)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4EnergyLossMessenger.hh,v 1.23 2009/02/18 14:40:10 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02-ref-02 $
+// $Id: G4EnergyLossMessenger.hh,v 1.22 2008/10/20 13:27:45 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02 $
 //
 // -------------------------------------------------------------------
@@ -107,5 +107,4 @@
   G4UIcmdWithADouble*        MinSubSecCmd;
   G4UIcommand*               StepFuncCmd;
-  G4UIcommand*               deexCmd;
   G4UIcmdWithAString*        mscCmd;
   G4UIcmdWithADoubleAndUnit* MinEnCmd;
Index: trunk/source/processes/electromagnetic/utils/include/G4VEmFluctuationModel.hh
===================================================================
--- trunk/source/processes/electromagnetic/utils/include/G4VEmFluctuationModel.hh	(revision 968)
+++ trunk/source/processes/electromagnetic/utils/include/G4VEmFluctuationModel.hh	(revision 991)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4VEmFluctuationModel.hh,v 1.12 2009/02/19 11:25:50 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02-ref-02 $
+// $Id: G4VEmFluctuationModel.hh,v 1.11 2008/09/12 14:47:38 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02 $
 //
 // -------------------------------------------------------------------
@@ -101,5 +101,5 @@
   //------------------------------------------------------------------------
 
-  inline G4String GetName() const;
+  G4String GetName() const;
 
 private:
@@ -115,4 +115,12 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
+inline void G4VEmFluctuationModel::InitialiseMe(const G4ParticleDefinition*)
+{}
+
+inline 
+void G4VEmFluctuationModel::SetParticleAndCharge(const G4ParticleDefinition*, 
+						 G4double)
+{}
+
 inline G4String G4VEmFluctuationModel::GetName() const 
 {
Index: trunk/source/processes/electromagnetic/utils/include/G4VEmModel.hh
===================================================================
--- trunk/source/processes/electromagnetic/utils/include/G4VEmModel.hh	(revision 968)
+++ trunk/source/processes/electromagnetic/utils/include/G4VEmModel.hh	(revision 991)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4VEmModel.hh,v 1.66 2009/02/19 09:57:36 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02-ref-02 $
+// $Id: G4VEmModel.hh,v 1.59 2008/11/13 19:29:41 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02 $
 //
 // -------------------------------------------------------------------
@@ -65,5 +65,4 @@
 // 12-09-08 Added methods GetParticleCharge, GetChargeSquareRatio, 
 //          CorrectionsAlongStep, ActivateNuclearStopping (VI)
-// 16-02-09 Move implementations of virtual methods to source (VI)
 //
 // Class Description:
@@ -121,4 +120,10 @@
   //------------------------------------------------------------------------
 
+  // dEdx per unit length
+  virtual G4double ComputeDEDX(const G4MaterialCutsCouple*,
+			       const G4ParticleDefinition*,
+			       G4double kineticEnergy,
+			       G4double cutEnergy = DBL_MAX);
+
   // main method to compute dEdx
   virtual G4double ComputeDEDXPerVolume(const G4Material*,
@@ -126,4 +131,11 @@
 					G4double kineticEnergy,
 					G4double cutEnergy = DBL_MAX);
+
+  // cross section per volume
+  virtual G4double CrossSection(const G4MaterialCutsCouple*,
+				const G4ParticleDefinition*,
+				G4double kineticEnergy,
+				G4double cutEnergy = 0.0,
+				G4double maxEnergy = DBL_MAX);
 
   // main method to compute cross section per Volume
@@ -163,9 +175,4 @@
 				    G4double length);
 
-  // sample PIXE deexcitation
-  virtual void SampleDeexcitationAlongStep(const G4Material*,
-					   const G4Track&,
-                                           G4double& eloss);
-
 protected:
 
@@ -205,23 +212,10 @@
 				  const G4DataVector&);
 
-  // dEdx per unit length
-  inline G4double ComputeDEDX(const G4MaterialCutsCouple*,
-			      const G4ParticleDefinition*,
-			      G4double kineticEnergy,
-			      G4double cutEnergy = DBL_MAX);
-
-  // cross section per volume
-  inline G4double CrossSection(const G4MaterialCutsCouple*,
-				const G4ParticleDefinition*,
-				G4double kineticEnergy,
-				G4double cutEnergy = 0.0,
-				G4double maxEnergy = DBL_MAX);
-
   // compute mean free path via cross section per volume
-  inline G4double ComputeMeanFreePath(const G4ParticleDefinition*,
-				      G4double kineticEnergy,
-				      const G4Material*,    
-				      G4double cutEnergy = 0.0,
-				      G4double maxEnergy = DBL_MAX);
+  G4double ComputeMeanFreePath(const G4ParticleDefinition*,
+			       G4double kineticEnergy,
+			       const G4Material*,    
+			       G4double cutEnergy = 0.0,
+			       G4double maxEnergy = DBL_MAX);
 
   // generic cross section per element
@@ -239,5 +233,6 @@
 					   G4double maxEnergy = DBL_MAX);
 
-  // to select atom cross section per volume is recomputed for each element 
+  // this method can be used only in the case if generic method to compute
+  // cross section per volume is used and not overwritten in derived class 
   inline const G4Element* SelectRandomAtom(const G4Material*,
 					   const G4ParticleDefinition*,
@@ -265,6 +260,4 @@
   inline G4bool LPMFlag() const;
 
-  inline G4bool DeexcitationFlag() const;
-
   inline void SetHighEnergyLimit(G4double);
 
@@ -277,6 +270,4 @@
   inline void SetLPMFlag(G4bool val);
 
-  inline void SetDeexcitationFlag(G4bool val);
-
   inline void ActivateNuclearStopping(G4bool);
 
@@ -287,13 +278,9 @@
   inline void SetParticleChange(G4VParticleChange*, G4VEmFluctuationModel*);
 
-  inline void SetCurrentCouple(const G4MaterialCutsCouple*);
-
 protected:
 
-  inline const G4MaterialCutsCouple* CurrentCouple() const;
+  inline const G4Element* GetCurrentElement() const;
 
   inline void SetCurrentElement(const G4Element*);
-
-  inline const G4Element* GetCurrentElement() const;
 
 private:
@@ -328,9 +315,6 @@
 private:
 
-  const G4MaterialCutsCouple* currentCouple;
-  const G4Element*            currentElement;
-
+  const G4Element* currentElement;
   G4int                  nsec;
-  G4bool                 flagDeexcitation;
   std::vector<G4double>  xsec;
 
@@ -340,37 +324,77 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 
-inline G4double G4VEmModel::ComputeDEDX(const G4MaterialCutsCouple* c,
-                                        const G4ParticleDefinition* p,
-					G4double kinEnergy,
-					G4double cutEnergy)
-{
-  currentCouple = c;
-  return ComputeDEDXPerVolume(c->GetMaterial(),p,kinEnergy,cutEnergy);
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
-
-inline G4double G4VEmModel::CrossSection(const G4MaterialCutsCouple* c,
-                                         const G4ParticleDefinition* p,
-					 G4double kinEnergy,
-					 G4double cutEnergy,
-					 G4double maxEnergy)
-{
-  currentCouple = c;
-  return CrossSectionPerVolume(c->GetMaterial(),p,kinEnergy,cutEnergy,maxEnergy);
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
-
-inline G4double G4VEmModel::ComputeMeanFreePath(const G4ParticleDefinition* p,
-						G4double ekin,
-						const G4Material* material,     
-						G4double emin,
-						G4double emax)
-{
-  G4double mfp = DBL_MAX;
-  G4double cross = CrossSectionPerVolume(material,p,ekin,emin,emax);
-  if (cross > DBL_MIN) mfp = 1./cross;
-  return mfp;
+inline G4double G4VEmModel::HighEnergyLimit() const
+{
+  return highLimit;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+inline G4double G4VEmModel::LowEnergyLimit() const
+{
+  return lowLimit;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+inline G4double G4VEmModel::PolarAngleLimit() const
+{
+  return polarAngleLimit;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+inline G4double G4VEmModel::SecondaryThreshold() const
+{
+  return secondaryThreshold;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4bool G4VEmModel::LPMFlag() const 
+{
+  return theLPMflag;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+inline void G4VEmModel::SetHighEnergyLimit(G4double val)
+{
+  highLimit = val;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+inline void G4VEmModel::SetLowEnergyLimit(G4double val)
+{
+  lowLimit = val;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+inline void G4VEmModel::SetPolarAngleLimit(G4double val)
+{
+  polarAngleLimit = val;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+inline void G4VEmModel::SetSecondaryThreshold(G4double val) 
+{
+  secondaryThreshold = val;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline void G4VEmModel::SetLPMFlag(G4bool val) 
+{
+  theLPMflag = val;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline void G4VEmModel::ActivateNuclearStopping(G4bool val)
+{
+  nuclearStopping = val;
 }
 
@@ -391,4 +415,94 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 
+inline void G4VEmModel::SetParticleChange(G4VParticleChange* p,  
+                                          G4VEmFluctuationModel* f = 0)
+{
+  if(p && pParticleChange != p) pParticleChange = p;
+  fluc = f;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+
+inline G4VEmFluctuationModel* G4VEmModel::GetModelOfFluctuations()
+{
+  return fluc;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+inline G4double G4VEmModel::MinEnergyCut(const G4ParticleDefinition*,
+                                         const G4MaterialCutsCouple*)
+{
+  return 0.0;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+inline G4double G4VEmModel::GetChargeSquareRatio(const G4ParticleDefinition* p,
+						 const G4Material*, G4double)
+{
+  G4double q = p->GetPDGCharge()/CLHEP::eplus;
+  return q*q;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+inline G4double G4VEmModel::GetParticleCharge(const G4ParticleDefinition* p,
+					      const G4Material*, G4double)
+{
+  return p->GetPDGCharge();
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+inline void G4VEmModel::CorrectionsAlongStep(const G4MaterialCutsCouple*,
+					     const G4DynamicParticle*,
+					     G4double&,G4double&,G4double)
+{}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+inline G4double G4VEmModel::ComputeDEDXPerVolume(const G4Material*,
+						 const G4ParticleDefinition*,
+						 G4double,G4double)
+{
+  return 0.0;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+inline G4double G4VEmModel::ComputeDEDX(const G4MaterialCutsCouple* c,
+                                        const G4ParticleDefinition* p,
+					G4double kinEnergy,
+					G4double cutEnergy)
+{
+  return ComputeDEDXPerVolume(c->GetMaterial(),p,kinEnergy,cutEnergy);
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+inline G4double G4VEmModel::CrossSection(const G4MaterialCutsCouple* c,
+                                         const G4ParticleDefinition* p,
+					 G4double kinEnergy,
+					 G4double cutEnergy,
+					 G4double maxEnergy)
+{
+  return CrossSectionPerVolume(c->GetMaterial(),p,
+			       kinEnergy,cutEnergy,maxEnergy);
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+inline G4double G4VEmModel::ComputeCrossSectionPerAtom(
+                                         const G4ParticleDefinition*,
+					 G4double, G4double, G4double,
+					 G4double, G4double)
+{
+  return 0.0;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
 inline 
 const G4Element* G4VEmModel::SelectRandomAtom(const G4MaterialCutsCouple* couple,
@@ -398,5 +512,4 @@
 					      G4double maxEnergy)
 {
-  currentCouple = couple;
   if(nSelectors > 0) {
     currentElement = 
@@ -458,98 +571,14 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 
-inline G4VEmFluctuationModel* G4VEmModel::GetModelOfFluctuations()
-{
-  return fluc;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
-
-inline G4double G4VEmModel::HighEnergyLimit() const
-{
-  return highLimit;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
-
-inline G4double G4VEmModel::LowEnergyLimit() const
-{
-  return lowLimit;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
-
-inline G4double G4VEmModel::PolarAngleLimit() const
-{
-  return polarAngleLimit;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
-
-inline G4double G4VEmModel::SecondaryThreshold() const
-{
-  return secondaryThreshold;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4bool G4VEmModel::LPMFlag() const 
-{
-  return theLPMflag;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4bool G4VEmModel::DeexcitationFlag() const 
-{
-  return flagDeexcitation;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
-
-inline void G4VEmModel::SetHighEnergyLimit(G4double val)
-{
-  highLimit = val;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
-
-inline void G4VEmModel::SetLowEnergyLimit(G4double val)
-{
-  lowLimit = val;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
-
-inline void G4VEmModel::SetPolarAngleLimit(G4double val)
-{
-  polarAngleLimit = val;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
-
-inline void G4VEmModel::SetSecondaryThreshold(G4double val) 
-{
-  secondaryThreshold = val;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline void G4VEmModel::SetLPMFlag(G4bool val) 
-{
-  theLPMflag = val;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline void G4VEmModel::SetDeexcitationFlag(G4bool val) 
-{
-  flagDeexcitation = val;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline void G4VEmModel::ActivateNuclearStopping(G4bool val)
-{
-  nuclearStopping = val;
+inline const G4Element* G4VEmModel::GetCurrentElement() const
+{
+  return currentElement;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+inline void G4VEmModel::SetCurrentElement(const G4Element* elm)
+{
+  currentElement = elm;
 }
 
@@ -565,4 +594,12 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 
+inline G4double G4VEmModel::MaxSecondaryEnergy(const G4ParticleDefinition*,
+					       G4double kineticEnergy)
+{
+  return kineticEnergy;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
 inline const G4String& G4VEmModel::GetName() const 
 {
@@ -571,39 +608,44 @@
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
-
-inline void G4VEmModel::SetParticleChange(G4VParticleChange* p,  
-                                          G4VEmFluctuationModel* f = 0)
-{
-  if(p && pParticleChange != p) pParticleChange = p;
-  fluc = f;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
-
-inline void G4VEmModel::SetCurrentCouple(const G4MaterialCutsCouple* p)
-{
-  currentCouple = p;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
-
-inline const G4MaterialCutsCouple* G4VEmModel::CurrentCouple() const
-{
-  return currentCouple;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
-
-inline void G4VEmModel::SetCurrentElement(const G4Element* elm)
-{
-  currentElement = elm;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
-
-inline const G4Element* G4VEmModel::GetCurrentElement() const
-{
-  return currentElement;
-}
+// Methods for msc simulation
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+inline void G4VEmModel::SampleScattering(const G4DynamicParticle*, G4double)
+{}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+inline G4double G4VEmModel::ComputeTruePathLengthLimit(
+                                const G4Track&, 
+				G4PhysicsTable*, 
+				G4double)
+{
+  return DBL_MAX;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+inline G4double G4VEmModel::ComputeGeomPathLength(G4double truePathLength)
+{
+  return truePathLength;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+inline G4double G4VEmModel::ComputeTrueStepLength(G4double geomPathLength)
+{
+  return geomPathLength;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+inline void G4VEmModel::DefineForRegion(const G4Region*) 
+{}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+inline void G4VEmModel::SetupForMaterial(const G4ParticleDefinition*,
+					 const G4Material*, G4double)
+{}
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Index: trunk/source/processes/electromagnetic/utils/include/G4VEmProcess.hh
===================================================================
--- trunk/source/processes/electromagnetic/utils/include/G4VEmProcess.hh	(revision 968)
+++ trunk/source/processes/electromagnetic/utils/include/G4VEmProcess.hh	(revision 991)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4VEmProcess.hh,v 1.50 2009/02/19 09:57:36 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02-ref-02 $
+// $Id: G4VEmProcess.hh,v 1.47 2008/07/31 13:01:26 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02 $
 //
 // -------------------------------------------------------------------
@@ -108,8 +108,19 @@
 
   //------------------------------------------------------------------------
-  // Implementation of virtual methods common to all Discrete processes 
+  // Methods with standard implementation; may be overwritten if needed 
+  //------------------------------------------------------------------------
+
+  inline G4double RecalculateLambda(G4double kinEnergy,
+				    const G4MaterialCutsCouple* couple);
+
+  //------------------------------------------------------------------------
+  // Generic methods common to all Discrete processes 
   //------------------------------------------------------------------------
 
 public:
+
+  void PrintInfoDefinition();
+
+  G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&);
 
   // Initialise for build of tables
@@ -118,16 +129,4 @@
   // Build physics table during initialisation
   void BuildPhysicsTable(const G4ParticleDefinition&);
-
-  void PrintInfoDefinition();
-
-  // implementation of virtual method, specific for G4VEmProcess
-  G4double PostStepGetPhysicalInteractionLength(
-                             const G4Track& track,
-                             G4double   previousStepSize,
-                             G4ForceCondition* condition
-                            );
-
-  // implementation of virtual method, specific for G4VEmProcess
-  G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&);
 
   // Store PhysicsTable in a file.
@@ -146,7 +145,4 @@
 			      G4bool ascii);
 
-  // deexcitation activated per G4Region
-  void ActivateDeexcitation(G4bool, const G4Region* r = 0);
-
   //------------------------------------------------------------------------
   // Specific methods for Discrete EM post step simulation 
@@ -156,4 +152,11 @@
   G4double CrossSectionPerVolume(G4double kineticEnergy,
 				 const G4MaterialCutsCouple* couple);
+
+  // implementation of virtual method
+  virtual G4double PostStepGetPhysicalInteractionLength(
+                             const G4Track& track,
+                             G4double   previousStepSize,
+                             G4ForceCondition* condition
+                            );
 
   // It returns the cross section of the process per atom
@@ -164,4 +167,7 @@
   inline G4double MeanFreePath(const G4Track& track);
 
+  inline G4VEmModel* SelectModelForMaterial(G4double kinEnergy, 
+					    size_t& idxRegion) const;
+
   // It returns cross section per volume
   inline G4double GetLambda(G4double& kinEnergy, 
@@ -197,25 +203,15 @@
 
   //------------------------------------------------------------------------
-  // Specific methods to set, access, modify models and basic parameters
-  //------------------------------------------------------------------------
-
-protected:
-  // Select model in run time
-  inline void SelectModel(G4double& kinEnergy);
-
-public:
-  // Select model by energy and region index
-  inline G4VEmModel* SelectModelForMaterial(G4double kinEnergy, 
-					    size_t& idxRegion) const;
+  // Specific methods to set, access, modify models
+  //------------------------------------------------------------------------
+
+  // Add EM model coupled for the region
+  inline void AddEmModel(G4int, G4VEmModel*, const G4Region* region = 0);
    
-  // Add model for region, smaller value of order defines which
-  // model will be selected for a given energy interval  
-  inline void AddEmModel(G4int, G4VEmModel*, const G4Region* region = 0);
-
   // Assign a model to a process
-  inline void SetModel(G4VEmModel*, G4int index = 1);
+  inline void SetModel(G4VEmModel*);
   
   // return the assigned model
-  inline G4VEmModel* Model(G4int index = 1);
+  inline G4VEmModel* Model();
     
   // Define new energy range for the model identified by the name
@@ -225,4 +221,10 @@
   inline G4VEmModel* GetModelByIndex(G4int idx = 0, G4bool ver = false);
 
+  //------------------------------------------------------------------------
+  // Get/set parameters used for simulation of energy loss
+  //------------------------------------------------------------------------
+
+  inline void ActivateDeexcitation(G4bool, const G4Region* r = 0);
+
   inline void SetLambdaFactor(G4double val);
 
@@ -231,8 +233,4 @@
 
   inline void SetApplyCuts(G4bool val);
-
-  //------------------------------------------------------------------------
-  // Other generic methods
-  //------------------------------------------------------------------------
   
 protected:
@@ -244,7 +242,4 @@
   G4PhysicsVector* LambdaPhysicsVector(const G4MaterialCutsCouple*);
 
-  inline G4double RecalculateLambda(G4double kinEnergy,
-				    const G4MaterialCutsCouple* couple);
-
   inline G4ParticleChangeForGamma* GetParticleChange();
 
@@ -253,4 +248,6 @@
   inline void SetSecondaryParticle(const G4ParticleDefinition* p);
 
+  inline G4VEmModel* SelectModel(G4double& kinEnergy);
+
   inline size_t CurrentMaterialCutsCoupleIndex() const;
 
@@ -283,5 +280,6 @@
   inline G4double ComputeCurrentLambda(G4double kinEnergy);
 
-  // copy constructor and hide assignment operator
+  // hide  assignment operator
+
   G4VEmProcess(G4VEmProcess &);
   G4VEmProcess & operator=(const G4VEmProcess &right);
@@ -299,6 +297,4 @@
   // ======== Parameters of the class fixed at initialisation =======
 
-  std::vector<G4VEmModel*>     emModels;
-
   // tables and vectors
   G4PhysicsTable*              theLambdaTable;
@@ -321,9 +317,8 @@
   G4bool                       applyCuts;
   G4bool                       startFromNull;
-  G4bool                       useDeexcitation;
-
-  G4int                        nDERegions;
-  std::vector<const G4Region*> deRegions;
-  G4bool*                      idxDERegions;
+
+  G4int                        nRegions;
+  std::vector<G4Region*>       regions;
+  std::vector<G4bool>          flagsDeexcitation;
 
   // ======== Cashed values - may be state dependent ================
@@ -337,5 +332,5 @@
   std::vector<G4DynamicParticle*> secParticles;
 
-  G4VEmModel*                  currentModel;  
+  G4VEmModel*                  selectedModel;  
 
   const G4ParticleDefinition*  particle;
@@ -353,280 +348,4 @@
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4double G4VEmProcess::ComputeCrossSectionPerAtom(
-		 G4double kineticEnergy, G4double Z, G4double A, G4double cut)
-{
-  SelectModel(kineticEnergy);
-  G4double x = 0.0;
-  if(currentModel) {
-   x = currentModel->ComputeCrossSectionPerAtom(particle,kineticEnergy,
-						 Z,A,cut);
-  }
-  return x;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4double G4VEmProcess::MeanFreePath(const G4Track& track)
-{
-  DefineMaterial(track.GetMaterialCutsCouple());
-  preStepLambda = GetCurrentLambda(track.GetKineticEnergy());
-  G4double x = DBL_MAX;
-  if(DBL_MIN < preStepLambda) x = 1.0/preStepLambda;
-  return x;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4double G4VEmProcess::GetLambda(G4double& kineticEnergy,
-					const G4MaterialCutsCouple* couple)
-{
-  DefineMaterial(couple);
-  return GetCurrentLambda(kineticEnergy);
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline void G4VEmProcess::SetLambdaBinning(G4int nbins)
-{
-  nLambdaBins = nbins;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4int G4VEmProcess::LambdaBinning() const
-{
-  return nLambdaBins;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline void G4VEmProcess::SetMinKinEnergy(G4double e)
-{
-  minKinEnergy = e;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4double G4VEmProcess::MinKinEnergy() const
-{
-  return minKinEnergy;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline void G4VEmProcess::SetMaxKinEnergy(G4double e)
-{
-  maxKinEnergy = e;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4double G4VEmProcess::MaxKinEnergy() const
-{
-  return maxKinEnergy;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline void G4VEmProcess::SetPolarAngleLimit(G4double val)
-{
-  if(val < 0.0)     polarAngleLimit = 0.0;
-  else if(val > pi) polarAngleLimit = pi;
-  else              polarAngleLimit = val;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4double G4VEmProcess::PolarAngleLimit() const
-{
-  return polarAngleLimit;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline const G4PhysicsTable* G4VEmProcess::LambdaTable() const
-{
-  return theLambdaTable;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline const G4ParticleDefinition* G4VEmProcess::Particle() const
-{
-  return particle;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline const G4ParticleDefinition* G4VEmProcess::SecondaryParticle() const
-{
-  return secondaryParticle;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline void G4VEmProcess::SelectModel(G4double& kinEnergy)
-{
-  currentModel = modelManager->SelectModel(kinEnergy, currentMaterialIndex);
-  currentModel->SetCurrentCouple(currentCouple);
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4VEmModel* G4VEmProcess::SelectModelForMaterial(
-                                   G4double kinEnergy, size_t& idxRegion) const
-{
-  return modelManager->SelectModel(kinEnergy, idxRegion);
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline void G4VEmProcess::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 void G4VEmProcess::SetModel(G4VEmModel* p, G4int index)
-{
-  G4int n = emModels.size();
-  if(index >= n) for(G4int i=n; i<index+1; i++) {emModels.push_back(0);}
-  emModels[index] = p;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4VEmModel* G4VEmProcess::Model(G4int index)
-{
-  G4VEmModel* p = 0;
-  if(index >= 0 && index <  G4int(emModels.size())) p = emModels[index];
-  return p;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline void G4VEmProcess::UpdateEmModel(const G4String& nam, 
-					G4double emin, G4double emax)
-{
-  modelManager->UpdateEmModel(nam, emin, emax);
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4VEmModel* G4VEmProcess::GetModelByIndex(G4int idx, G4bool ver)
-{
-  return modelManager->GetModel(idx, ver);
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline void G4VEmProcess::SetLambdaFactor(G4double val)
-{
-  if(val > 0.0 && val <= 1.0) lambdaFactor = val;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline void G4VEmProcess::SetIntegral(G4bool val)
-{
-  if(particle && particle != theGamma) integral = val;
-  if(integral) buildLambdaTable = true;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4bool G4VEmProcess::IsIntegral() const
-{
-  return integral;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline void G4VEmProcess::SetApplyCuts(G4bool val)
-{
-  applyCuts = val;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4double G4VEmProcess::RecalculateLambda(G4double e, 
-						const G4MaterialCutsCouple* couple)
-{
-  DefineMaterial(couple);
-  return ComputeCurrentLambda(e);
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4ParticleChangeForGamma* G4VEmProcess::GetParticleChange()
-{
-  return &fParticleChange;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline void G4VEmProcess::SetParticle(const G4ParticleDefinition* p)
-{
-  particle = p;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline void G4VEmProcess::SetSecondaryParticle(const G4ParticleDefinition* p)
-{
-  secondaryParticle = p;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline size_t G4VEmProcess::CurrentMaterialCutsCoupleIndex() const 
-{
-  return currentMaterialIndex;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4double G4VEmProcess::GetGammaEnergyCut()
-{
-  return (*theCutsGamma)[currentMaterialIndex];
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4double G4VEmProcess::GetElectronEnergyCut()
-{
-  return (*theCutsElectron)[currentMaterialIndex];
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline void G4VEmProcess::SetBuildTableFlag(G4bool val)
-{
-  buildLambdaTable = val;
-  if(!val) integral = false;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline void G4VEmProcess::SetStartFromNullFlag(G4bool val)
-{
-  startFromNull = val;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline void G4VEmProcess::InitialiseStep(const G4Track& track)
-{
-  preStepKinEnergy = track.GetKineticEnergy();
-  DefineMaterial(track.GetMaterialCutsCouple());
-  if (theNumberOfInteractionLengthLeft < 0.0) mfpKinEnergy = DBL_MAX;
-}
-
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
@@ -639,4 +358,61 @@
     mfpKinEnergy = DBL_MAX;
   }
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline void G4VEmProcess::InitialiseStep(const G4Track& track)
+{
+  preStepKinEnergy = track.GetKineticEnergy();
+  DefineMaterial(track.GetMaterialCutsCouple());
+  if (theNumberOfInteractionLengthLeft < 0.0) mfpKinEnergy = DBL_MAX;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4double G4VEmProcess::GetLambda(G4double& kineticEnergy,
+					const G4MaterialCutsCouple* couple)
+{
+  DefineMaterial(couple);
+  return GetCurrentLambda(kineticEnergy);
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4double G4VEmProcess::GetCurrentLambda(G4double e)
+{
+  G4double x = 0.0;
+  if(theLambdaTable) x = GetLambdaFromTable(e);
+  else               x = ComputeCurrentLambda(e);
+  return x;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4double G4VEmProcess::RecalculateLambda(G4double e, 
+						const G4MaterialCutsCouple* couple)
+{
+  DefineMaterial(couple);
+  return ComputeCurrentLambda(e);
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4double G4VEmProcess::ComputeCurrentLambda(G4double e)
+{
+  G4VEmModel* currentModel = SelectModel(e);
+  G4double x = 0.0;
+  if(currentModel) 
+    x = currentModel->CrossSectionPerVolume(currentMaterial,particle,
+					    e,(*theCuts)[currentMaterialIndex]);
+  return x;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4double G4VEmProcess::GetLambdaFromTable(G4double e)
+{
+  G4bool b;
+  return (((*theLambdaTable)[currentMaterialIndex])->GetValue(e, b));
 }
 
@@ -666,17 +442,10 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
-inline G4double G4VEmProcess::GetLambdaFromTable(G4double e)
-{
-  G4bool b;
-  return (((*theLambdaTable)[currentMaterialIndex])->GetValue(e, b));
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4double G4VEmProcess::GetCurrentLambda(G4double e)
-{
-  G4double x = 0.0;
-  if(theLambdaTable) x = GetLambdaFromTable(e);
-  else               x = ComputeCurrentLambda(e);
+inline G4double G4VEmProcess::MeanFreePath(const G4Track& track)
+{
+  DefineMaterial(track.GetMaterialCutsCouple());
+  preStepLambda = GetCurrentLambda(track.GetKineticEnergy());
+  G4double x = DBL_MAX;
+  if(DBL_MIN < preStepLambda) x = 1.0/preStepLambda;
   return x;
 }
@@ -684,13 +453,233 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
-inline G4double G4VEmProcess::ComputeCurrentLambda(G4double e)
-{
-  SelectModel(e);
-  G4double x = 0.0;
-  if(currentModel) {
-    x = currentModel->CrossSectionPerVolume(currentMaterial,particle,
-					    e,(*theCuts)[currentMaterialIndex]);
-  }
-  return x;
+inline G4VEmModel* G4VEmProcess::SelectModel(G4double& kinEnergy)
+{
+  return modelManager->SelectModel(kinEnergy, currentMaterialIndex);
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4VEmModel* G4VEmProcess::SelectModelForMaterial(
+                                   G4double kinEnergy, size_t& idxRegion) const
+{
+  return modelManager->SelectModel(kinEnergy, idxRegion);
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline const G4ParticleDefinition* G4VEmProcess::Particle() const
+{
+  return particle;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline const G4ParticleDefinition* G4VEmProcess::SecondaryParticle() const
+{
+  return secondaryParticle;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4double G4VEmProcess::GetGammaEnergyCut()
+{
+  return (*theCutsGamma)[currentMaterialIndex];
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4double G4VEmProcess::GetElectronEnergyCut()
+{
+  return (*theCutsElectron)[currentMaterialIndex];
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline void G4VEmProcess::SetLambdaFactor(G4double val)
+{
+  if(val > 0.0 && val <= 1.0) lambdaFactor = val;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4VEmModel* G4VEmProcess::GetModelByIndex(G4int idx, G4bool ver)
+{
+  return modelManager->GetModel(idx, ver);
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4ParticleChangeForGamma* G4VEmProcess::GetParticleChange()
+{
+  return &fParticleChange;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline void G4VEmProcess::SetParticle(const G4ParticleDefinition* p)
+{
+  particle = p;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline void G4VEmProcess::SetSecondaryParticle(const G4ParticleDefinition* p)
+{
+  secondaryParticle = p;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline void G4VEmProcess::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 void G4VEmProcess::SetModel(G4VEmModel* model)
+{
+  selectedModel = model;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4VEmModel* G4VEmProcess::Model()
+{
+  return selectedModel;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline void G4VEmProcess::UpdateEmModel(const G4String& nam, 
+					G4double emin, G4double emax)
+{
+  modelManager->UpdateEmModel(nam, emin, emax);
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4double G4VEmProcess::ComputeCrossSectionPerAtom(
+		 G4double kineticEnergy, G4double Z, G4double A, G4double cut)
+{
+  G4VEmModel* model = SelectModel(kineticEnergy);
+  return model->ComputeCrossSectionPerAtom(particle,kineticEnergy,Z,A,cut);
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline void G4VEmProcess::SetLambdaBinning(G4int nbins)
+{
+  nLambdaBins = nbins;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4int G4VEmProcess::LambdaBinning() const
+{
+  return nLambdaBins;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline void G4VEmProcess::SetMinKinEnergy(G4double e)
+{
+  minKinEnergy = e;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4double G4VEmProcess::MinKinEnergy() const
+{
+  return minKinEnergy;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline void G4VEmProcess::SetMaxKinEnergy(G4double e)
+{
+  maxKinEnergy = e;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4double G4VEmProcess::MaxKinEnergy() const
+{
+  return maxKinEnergy;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline void G4VEmProcess::SetPolarAngleLimit(G4double val)
+{
+  if(val < 0.0)     polarAngleLimit = 0.0;
+  else if(val > pi) polarAngleLimit = pi;
+  else              polarAngleLimit = val;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4double G4VEmProcess::PolarAngleLimit() const
+{
+  return polarAngleLimit;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline void G4VEmProcess::ActivateDeexcitation(G4bool, const G4Region*)
+{}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline const G4PhysicsTable* G4VEmProcess::LambdaTable() const
+{
+  return theLambdaTable;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline void G4VEmProcess::SetIntegral(G4bool val)
+{
+  if(particle && particle != theGamma) integral = val;
+  if(integral) buildLambdaTable = true;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4bool G4VEmProcess::IsIntegral() const
+{
+  return integral;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline void G4VEmProcess::SetBuildTableFlag(G4bool val)
+{
+  buildLambdaTable = val;
+  if(!val) integral = false;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline void G4VEmProcess::SetStartFromNullFlag(G4bool val)
+{
+  startFromNull = val;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline void G4VEmProcess::SetApplyCuts(G4bool val)
+{
+  applyCuts = val;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline size_t G4VEmProcess::CurrentMaterialCutsCoupleIndex() const 
+{
+  return currentMaterialIndex;
 }
 
Index: trunk/source/processes/electromagnetic/utils/include/G4VEnergyLossProcess.hh
===================================================================
--- trunk/source/processes/electromagnetic/utils/include/G4VEnergyLossProcess.hh	(revision 968)
+++ trunk/source/processes/electromagnetic/utils/include/G4VEnergyLossProcess.hh	(revision 991)
@@ -24,5 +24,5 @@
 // ********************************************************************
 //
-// $Id: G4VEnergyLossProcess.hh,v 1.86 2009/02/19 09:57:36 vnivanch Exp $
+// $Id: G4VEnergyLossProcess.hh,v 1.83 2008/09/12 16:19:01 vnivanch Exp $
 // GEANT4 tag $Name:
 //
@@ -126,13 +126,8 @@
   virtual ~G4VEnergyLossProcess();
 
-private:
-  // clean vectors and arrays
-  void Clean();
-
   //------------------------------------------------------------------------
   // Virtual methods to be implemented in concrete processes
   //------------------------------------------------------------------------
 
-public:
   virtual G4bool IsApplicable(const G4ParticleDefinition& p) = 0;
   
@@ -148,36 +143,22 @@
   //------------------------------------------------------------------------
 
+protected:
+
   virtual G4double MinPrimaryEnergy(const G4ParticleDefinition*,
 				    const G4Material*, G4double cut);
 
   //------------------------------------------------------------------------
-  // Virtual methods implementation common to all EM ContinuousDiscrete 
-  // processes. Further inheritance is not assumed 
+  // Virtual methods common to all EM ContinuousDiscrete processes
+  // Further inheritance is not assumed 
   //------------------------------------------------------------------------
 
 public:
 
-  // prepare all tables
+  void PrintInfoDefinition();
+
   void PreparePhysicsTable(const G4ParticleDefinition&);
 
-  // build all tables
   void BuildPhysicsTable(const G4ParticleDefinition&);
 
-  // build a table
-  G4PhysicsTable* BuildDEDXTable(G4EmTableType tType = fRestricted);
-
-  // build a table
-  G4PhysicsTable* BuildLambdaTable(G4EmTableType tType = fRestricted);
-
-  // summary printout after initialisation
-  void PrintInfoDefinition();
-
-  // Add subcutoff option for the region
-  void ActivateSubCutoff(G4bool val, const G4Region* region = 0);
-
-  // Activate deexcitation code for region
-  void ActivateDeexcitation(G4bool, const G4Region* region = 0);
-
-  // Step limit from AlongStep 
   G4double AlongStepGetPhysicalInteractionLength(const G4Track&,
 						 G4double  previousStepSize,
@@ -186,79 +167,33 @@
 						 G4GPILSelection* selection);
 
-  // Step limit from cross section
   G4double PostStepGetPhysicalInteractionLength(const G4Track& track,
 						G4double   previousStepSize,
 						G4ForceCondition* condition);
 
-  // AlongStep computations
   G4VParticleChange* AlongStepDoIt(const G4Track&, const G4Step&);
 
-  // Sampling of secondaries in vicinity of geometrical boundary
-  void SampleSubCutSecondaries(std::vector<G4Track*>&, const G4Step&, 
-                               G4VEmModel* model, G4int matIdx,
-			       G4double& extraEdep); 
-
-  // PostStep sampling of secondaries
   G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&);
 
-  // Store all PhysicsTable in files.
-  // Return false in case of any fatal failure at I/O  
+  // Store PhysicsTable in a file.
+  // Return false in case of failure at I/O
   G4bool StorePhysicsTable(const G4ParticleDefinition*,
                            const G4String& directory,
 			   G4bool ascii = false);
 
-  // Retrieve all Physics from a files.
-  // Return true if all the Physics Table are built.
-  // Return false if any fatal failure. 
+  // Retrieve Physics from a file.
+  // (return true if the Physics Table can be build by using file)
+  // (return false if the process has no functionality or in case of failure)
+  // File name should is constructed as processName+particleName and the
+  // should be placed under the directory specifed by the argument.
   G4bool RetrievePhysicsTable(const G4ParticleDefinition*,
                               const G4String& directory,
 			      G4bool ascii);
 
-private:
-  // store a table
-  G4bool StoreTable(const G4ParticleDefinition* p, 
-		    G4PhysicsTable*, G4bool ascii,
-		    const G4String& directory, 
-		    const G4String& tname);
-
-  // retrieve a table
-  G4bool RetrieveTable(const G4ParticleDefinition* p, 
-		       G4PhysicsTable*, G4bool ascii,
-		       const G4String& directory, 
-		       const G4String& tname, 
-		       G4bool mandatory);
-
-  //------------------------------------------------------------------------
-  // Public interface to cross section, mfp and sampling of fluctuations
-  // These methods are not used in run time
-  //------------------------------------------------------------------------
-
-public:
-  // access to dispersion of restricted energy loss
-  G4double GetDEDXDispersion(const G4MaterialCutsCouple *couple,
-			     const G4DynamicParticle* dp,
-			     G4double length);
-
-  // Access to cross section table
-  G4double CrossSectionPerVolume(G4double kineticEnergy,
-				 const G4MaterialCutsCouple* couple);
-
-  // access to cross section
-  G4double MeanFreePath(const G4Track& track);
-
-  // access to step limit
-  G4double ContinuousStepLimit(const G4Track& track,
-			       G4double previousStepSize,
-			       G4double currentMinimumStep,
-			       G4double& currentSafety);
-
 protected:
 
-  // implementation of the pure virtual method
   G4double GetMeanFreePath(const G4Track& track,
 			   G4double previousStepSize,
 			   G4ForceCondition* condition);
 
-  // implementation of the pure virtual method
   G4double GetContinuousStepLimit(const G4Track& track,
 				  G4double previousStepSize,
@@ -267,107 +202,32 @@
 
   //------------------------------------------------------------------------
-  // Run time method which may be also used by derived processes
-  //------------------------------------------------------------------------
-
-  // creeation of an empty vector for cross section
-  G4PhysicsVector* LambdaPhysicsVector(const G4MaterialCutsCouple*, 
-				       G4double cut);
-
-  inline G4ParticleChangeForLoss* GetParticleChange();
-
-  inline size_t CurrentMaterialCutsCoupleIndex() const;
-
-  inline G4double GetCurrentRange() const;
-
-  //------------------------------------------------------------------------
-  // Specific methods to set, access, modify models
-  //------------------------------------------------------------------------
-
-  // Select model in run time
-  inline void SelectModel(G4double kinEnergy);
+  // Specific methods for along/post step EM processes 
+  //------------------------------------------------------------------------
 
 public:
-  // Select model by energy and region index
-  inline G4VEmModel* SelectModelForMaterial(G4double kinEnergy, 
-					    size_t& idx) const;
-
-  // Add EM model coupled with fluctuation model for region, smaller value 
-  // of order defines which pair of models will be selected for a given 
-  // energy interval  
-  inline void AddEmModel(G4int, G4VEmModel*, 
-			 G4VEmFluctuationModel* fluc = 0,
-			 const G4Region* region = 0);
-
-  // Define new energy range for the model identified by the name
-  inline void UpdateEmModel(const G4String&, G4double, G4double);
-
-  // Assign a model to a process
-  inline void SetEmModel(G4VEmModel*, G4int index=1);
-  
-  // return the assigned model
-  inline G4VEmModel* EmModel(G4int index=1);
-  
-  // Access to models
-  inline G4VEmModel* GetModelByIndex(G4int idx = 0, G4bool ver = false);
-
-  inline G4int NumberOfModels();
-
-  // Assign a fluctuation model to a process
-  inline void SetFluctModel(G4VEmFluctuationModel*);
-  
-  // return the assigned fluctuation model
-  inline G4VEmFluctuationModel* FluctModel();
-    
-  //------------------------------------------------------------------------
-  // Define and access particle type 
-  //------------------------------------------------------------------------
-
-protected:
-  inline void SetParticle(const G4ParticleDefinition* p);
-  inline void SetSecondaryParticle(const G4ParticleDefinition* p);
-
-public:
-  inline void SetBaseParticle(const G4ParticleDefinition* p);
-  inline const G4ParticleDefinition* Particle() const;
-  inline const G4ParticleDefinition* BaseParticle() const;
-  inline const G4ParticleDefinition* SecondaryParticle() const;
-
-  //------------------------------------------------------------------------
-  // Get/set parameters to configure the process at initialisation time
-  //------------------------------------------------------------------------
-
-  // Add subcutoff process (bremsstrahlung) to sample secondary 
-  // particle production in vicinity of the geometry boundary
+
   void AddCollaborativeProcess(G4VEnergyLossProcess*);
 
-  inline void SetLossFluctuations(G4bool val);
-  inline void SetRandomStep(G4bool val);
-
-  inline void SetIntegral(G4bool val);
-  inline G4bool IsIntegral() const;
-
-  // Set/Get flag "isIonisation"
-  inline void SetIonisation(G4bool val);
-  inline G4bool IsIonisationProcess() const;
-
-  // Redefine parameteters for stepping control
-  //
-  inline void SetLinearLossLimit(G4double val);
-  inline void SetMinSubRange(G4double val);
-  inline void SetLambdaFactor(G4double val);
-  inline void SetStepFunction(G4double v1, G4double v2);
-
-  inline G4int NumberOfSubCutoffRegions() const;
-  inline G4int NumberOfDERegions() const;
-
-  //------------------------------------------------------------------------
-  // Specific methods to path Physics Tables to the process
-  //------------------------------------------------------------------------
+  void SampleSubCutSecondaries(std::vector<G4Track*>&, const G4Step&, 
+                               G4VEmModel* model, G4int matIdx,
+			       G4double& extraEdep); 
+
+  G4double GetDEDXDispersion(const G4MaterialCutsCouple *couple,
+			     const G4DynamicParticle* dp,
+			     G4double length);
+
+  //------------------------------------------------------------------------
+  // Specific methods to build and access Physics Tables
+  //------------------------------------------------------------------------
+
+  G4PhysicsTable* BuildDEDXTable(G4EmTableType tType = fRestricted);
+
+  G4PhysicsTable* BuildLambdaTable(G4EmTableType tType = fRestricted);
 
   void SetDEDXTable(G4PhysicsTable* p, G4EmTableType tType);
   void SetCSDARangeTable(G4PhysicsTable* pRange);
   void SetRangeTableForLoss(G4PhysicsTable* p);
+  void SetInverseRangeTable(G4PhysicsTable* p);
   void SetSecondaryRangeTable(G4PhysicsTable* p);
-  void SetInverseRangeTable(G4PhysicsTable* p);
 
   void SetLambdaTable(G4PhysicsTable* p);
@@ -391,16 +251,4 @@
   // Max kinetic energy for tables
   inline void SetMaxKinEnergyForCSDARange(G4double e);
-
-  // Return values for given G4MaterialCutsCouple
-  inline G4double GetDEDX(G4double& kineticEnergy, const G4MaterialCutsCouple*);
-  inline G4double GetDEDXForSubsec(G4double& kineticEnergy, 
-				   const G4MaterialCutsCouple*);
-  inline G4double GetRange(G4double& kineticEnergy, const G4MaterialCutsCouple*);
-  inline G4double GetCSDARange(G4double& kineticEnergy, const G4MaterialCutsCouple*);
-  inline G4double GetRangeForLoss(G4double& kineticEnergy, const G4MaterialCutsCouple*);
-  inline G4double GetKineticEnergy(G4double& range, const G4MaterialCutsCouple*);
-  inline G4double GetLambda(G4double& kineticEnergy, const G4MaterialCutsCouple*);
-
-  inline G4bool TablesAreBuilt() const;
 
   // Access to specific tables
@@ -416,4 +264,97 @@
   inline G4PhysicsTable* SubLambdaTable();
 
+  // Return values for given G4MaterialCutsCouple
+  inline G4double GetDEDX(G4double& kineticEnergy, const G4MaterialCutsCouple*);
+  inline G4double GetDEDXForSubsec(G4double& kineticEnergy, 
+				   const G4MaterialCutsCouple*);
+  inline G4double GetRange(G4double& kineticEnergy, const G4MaterialCutsCouple*);
+  inline G4double GetCSDARange(G4double& kineticEnergy, const G4MaterialCutsCouple*);
+  inline G4double GetRangeForLoss(G4double& kineticEnergy, const G4MaterialCutsCouple*);
+  inline G4double GetKineticEnergy(G4double& range, const G4MaterialCutsCouple*);
+  inline G4double GetLambda(G4double& kineticEnergy, const G4MaterialCutsCouple*);
+
+  inline G4bool TablesAreBuilt() const;
+
+  //------------------------------------------------------------------------
+  // Define and access particle type 
+  //------------------------------------------------------------------------
+
+  inline void SetBaseParticle(const G4ParticleDefinition* p);
+  inline const G4ParticleDefinition* Particle() const;
+  inline const G4ParticleDefinition* BaseParticle() const;
+  inline const G4ParticleDefinition* SecondaryParticle() const;
+
+  //------------------------------------------------------------------------
+  // Specific methods to set, access, modify models
+  //------------------------------------------------------------------------
+
+  // Add EM model coupled with fluctuation model for the region
+  inline void AddEmModel(G4int, G4VEmModel*, 
+			 G4VEmFluctuationModel* fluc = 0,
+			 const G4Region* region = 0);
+
+  // Assign a model to a process
+  inline void SetEmModel(G4VEmModel*, G4int index=1);
+  
+  // return the assigned model
+  inline G4VEmModel* EmModel(G4int index=1);
+  
+  // Assign a fluctuation model to a process
+  inline void SetFluctModel(G4VEmFluctuationModel*);
+  
+  // return the assigned fluctuation model
+  inline G4VEmFluctuationModel* FluctModel();
+    
+  // Define new energy range for the model identified by the name
+  inline void UpdateEmModel(const G4String&, G4double, G4double);
+
+  // Access to models
+  inline G4VEmModel* GetModelByIndex(G4int idx = 0, G4bool ver = false);
+
+  inline G4int NumberOfModels();
+
+  //------------------------------------------------------------------------
+  // Get/set parameters used for simulation of energy loss
+  //------------------------------------------------------------------------
+
+  inline void SetLossFluctuations(G4bool val);
+  inline void SetRandomStep(G4bool val);
+  inline void SetIntegral(G4bool val);
+  inline G4bool IsIntegral() const;
+
+  // Set/Get flag "isIonisation"
+  inline void SetIonisation(G4bool val);
+  inline G4bool IsIonisationProcess() const;
+
+  // Redefine parameteters for stepping control
+  //
+  inline void SetLinearLossLimit(G4double val);
+  inline void SetMinSubRange(G4double val);
+  inline void SetStepFunction(G4double v1, G4double v2);
+  inline void SetLambdaFactor(G4double val);
+
+
+  // Add subcutoff option for the region
+  void ActivateSubCutoff(G4bool val, const G4Region* region = 0);
+
+  inline G4int NumberOfSubCutoffRegions() const;
+
+  // Activate deexcitation code
+  virtual void ActivateDeexcitation(G4bool, const G4Region* region = 0);
+
+  //------------------------------------------------------------------------
+  // Public interface to helper functions 
+  //------------------------------------------------------------------------
+
+  inline 
+  G4VEmModel* SelectModelForMaterial(G4double kinEnergy, size_t& idx) const;
+
+  inline G4double MeanFreePath(const G4Track& track);
+
+  inline G4double ContinuousStepLimit(const G4Track& track,
+				      G4double previousStepSize,
+				      G4double currentMinimumStep,
+				      G4double& currentSafety);
+
   //------------------------------------------------------------------------
   // Run time method for simulation of ionisation
@@ -426,13 +367,49 @@
   inline void SetDynamicMassCharge(G4double massratio, G4double charge2ratio);
 
+  // Access to cross section table
+  G4double CrossSectionPerVolume(G4double kineticEnergy,
+				 const G4MaterialCutsCouple* couple);
+
+protected:
+
+  G4PhysicsVector* LambdaPhysicsVector(const G4MaterialCutsCouple*, 
+				       G4double cut);
+
+  inline G4ParticleChangeForLoss* GetParticleChange();
+
+  inline void SetParticle(const G4ParticleDefinition* p);
+
+  inline void SetSecondaryParticle(const G4ParticleDefinition* p);
+
+  inline void SelectModel(G4double kinEnergy);
+
+  inline size_t CurrentMaterialCutsCoupleIndex() const;
+
+  inline G4double GetCurrentRange() const;
+
 private:
+
+  //------------------------------------------------------------------------
+  // Management of tables
+  //------------------------------------------------------------------------
+
+  void Clear();
+
+  G4bool StoreTable(const G4ParticleDefinition* p, 
+		    G4PhysicsTable*, G4bool ascii,
+		    const G4String& directory, 
+		    const G4String& tname);
+
+  G4bool RetrieveTable(const G4ParticleDefinition* p, 
+		       G4PhysicsTable*, G4bool ascii,
+		       const G4String& directory, 
+		       const G4String& tname, 
+		       G4bool mandatory);
 
   // define material and indexes
   inline void DefineMaterial(const G4MaterialCutsCouple* couple);
 
-  //------------------------------------------------------------------------
-  // Compute values using scaling relation, mass and charge of based particle
-  //------------------------------------------------------------------------
-
+  // Returnd values for scaled energy using mass of the base particle
+  //
   inline G4double GetDEDXForScaledEnergy(G4double scaledKinEnergy);
   inline G4double GetSubDEDXForScaledEnergy(G4double scaledKinEnergy);
@@ -441,9 +418,10 @@
   inline G4double GetScaledRangeForScaledEnergy(G4double scaledKinEnergy);
   inline G4double GetLimitScaledRangeForScaledEnergy(G4double scaledKinEnergy);
+  inline G4double GetLambdaForScaledEnergy(G4double scaledKinEnergy);
   inline G4double ScaledKinEnergyForLoss(G4double range);
-  inline G4double GetLambdaForScaledEnergy(G4double scaledKinEnergy);
   inline void ComputeLambdaForScaledEnergy(G4double scaledKinEnergy);
 
   // hide  assignment operator
+
   G4VEnergyLossProcess(G4VEnergyLossProcess &);
   G4VEnergyLossProcess & operator=(const G4VEnergyLossProcess &right);
@@ -466,9 +444,6 @@
   G4VEmFluctuationModel*                fluctModel;
   std::vector<const G4Region*>          scoffRegions;
-  std::vector<const G4Region*>          deRegions;
   G4int                                 nSCoffRegions;
-  G4int                                 nDERegions;
-  G4bool*                               idxSCoffRegions;
-  G4bool*                               idxDERegions;
+  G4int*                                idxSCoffRegions;
 
   std::vector<G4VEnergyLossProcess*>    scProcesses;
@@ -518,5 +493,4 @@
   G4bool   isIonisation;
   G4bool   useSubCutoff;
-  G4bool   useDeexcitation;
 
 protected:
@@ -557,292 +531,13 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
-inline G4ParticleChangeForLoss* G4VEnergyLossProcess::GetParticleChange()
-{
-  return &fParticleChange;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline size_t G4VEnergyLossProcess::CurrentMaterialCutsCoupleIndex() const 
-{
-  return currentMaterialIndex;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-  
-inline G4double G4VEnergyLossProcess::GetCurrentRange() const
-{
-  return fRange;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline void G4VEnergyLossProcess::SelectModel(G4double kinEnergy)
-{
-  currentModel = modelManager->SelectModel(kinEnergy, currentMaterialIndex);
-  currentModel->SetCurrentCouple(currentCouple);
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4VEmModel* G4VEnergyLossProcess::SelectModelForMaterial(
-                   G4double kinEnergy, size_t& idx) const
-{
-  return modelManager->SelectModel(kinEnergy, idx);
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline
-void G4VEnergyLossProcess::AddEmModel(G4int order, G4VEmModel* p, 
-				      G4VEmFluctuationModel* fluc,
-				      const G4Region* region)
-{
-  modelManager->AddEmModel(order, p, fluc, region);
-  if(p) p->SetParticleChange(pParticleChange, fluc);
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline void G4VEnergyLossProcess::UpdateEmModel(const G4String& nam, 
-						G4double emin, G4double emax)
-{
-  modelManager->UpdateEmModel(nam, emin, emax);
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline void G4VEnergyLossProcess::SetEmModel(G4VEmModel* p, G4int index)
-{
-  G4int n = emModels.size();
-  if(index >= n) for(G4int i=n; i<index+1; i++) {emModels.push_back(0);}
-  emModels[index] = p;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4VEmModel* G4VEnergyLossProcess::EmModel(G4int index)
-{
-  G4VEmModel* p = 0;
-  if(index >= 0 && index <  G4int(emModels.size())) p = emModels[index];
-  return p;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline 
-G4VEmModel* G4VEnergyLossProcess::GetModelByIndex(G4int idx, G4bool ver)
-{
-  return modelManager->GetModel(idx, ver);
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4int G4VEnergyLossProcess::NumberOfModels()
-{
-  return modelManager->NumberOfModels();
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline void G4VEnergyLossProcess::SetFluctModel(G4VEmFluctuationModel* p)
-{
-  fluctModel = p;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4VEmFluctuationModel* G4VEnergyLossProcess::FluctModel()
-{
-  return fluctModel;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline void G4VEnergyLossProcess::SetParticle(const G4ParticleDefinition* p)
-{
-  particle = p;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline void G4VEnergyLossProcess::SetSecondaryParticle(const G4ParticleDefinition* p)
-{
-  secondaryParticle = p;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline void G4VEnergyLossProcess::SetBaseParticle(const G4ParticleDefinition* p)
-{
-  baseParticle = p;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline const G4ParticleDefinition* G4VEnergyLossProcess::Particle() const
-{
-  return particle;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline const G4ParticleDefinition* G4VEnergyLossProcess::BaseParticle() const
-{
-  return baseParticle;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline const G4ParticleDefinition* G4VEnergyLossProcess::SecondaryParticle() const
-{
-  return secondaryParticle;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline void G4VEnergyLossProcess::SetLossFluctuations(G4bool val)
-{
-  lossFluctuationFlag = val;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline void G4VEnergyLossProcess::SetRandomStep(G4bool val)
-{
-  rndmStepFlag = val;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline void G4VEnergyLossProcess::SetIntegral(G4bool val)
-{
-  integral = val;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-  
-inline G4bool G4VEnergyLossProcess::IsIntegral() const 
-{
-  return integral;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline void G4VEnergyLossProcess::SetIonisation(G4bool val)
-{
-  isIonisation = val;
-  if(val) aGPILSelection = CandidateForSelection;
-  else    aGPILSelection = NotCandidateForSelection;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4bool G4VEnergyLossProcess::IsIonisationProcess() const
-{
-  return isIonisation;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline void G4VEnergyLossProcess::SetLinearLossLimit(G4double val)
-{
-  linLossLimit = val;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline void G4VEnergyLossProcess::SetMinSubRange(G4double val)
-{
-  minSubRange = val;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline void G4VEnergyLossProcess::SetLambdaFactor(G4double val)
-{
-  if(val > 0.0 && val <= 1.0) lambdaFactor = val;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-void G4VEnergyLossProcess::SetStepFunction(G4double v1, G4double v2)
-{
-  dRoverRange = v1;
-  finalRange = v2;
-  if (dRoverRange > 0.999) dRoverRange = 1.0;
-  currentCouple = 0;
-  mfpKinEnergy  = DBL_MAX;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4int G4VEnergyLossProcess::NumberOfSubCutoffRegions() const
-{
-  return nSCoffRegions;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4int G4VEnergyLossProcess::NumberOfDERegions() const
-{
-  return nDERegions;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline void G4VEnergyLossProcess::SetDEDXBinning(G4int nbins)
-{
-  nBins = nbins;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline void G4VEnergyLossProcess::SetLambdaBinning(G4int nbins)
-{
-  nBins = nbins;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline void G4VEnergyLossProcess::SetDEDXBinningForCSDARange(G4int nbins)
-{
-  nBinsCSDA = nbins;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline void G4VEnergyLossProcess::SetMinKinEnergy(G4double e)
-{
-  minKinEnergy = e;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4double G4VEnergyLossProcess::MinKinEnergy() const
-{
-  return minKinEnergy;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline void G4VEnergyLossProcess::SetMaxKinEnergy(G4double e)
-{
-  maxKinEnergy = e;
-  if(e < maxKinEnergyCSDA) maxKinEnergyCSDA = e;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4double G4VEnergyLossProcess::MaxKinEnergy() const
-{
-  return maxKinEnergy;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline void G4VEnergyLossProcess::SetMaxKinEnergyForCSDARange(G4double e)
-{
-  maxKinEnergyCSDA = e;
+inline void G4VEnergyLossProcess::DefineMaterial(
+            const G4MaterialCutsCouple* couple)
+{
+  if(couple != currentCouple) {
+    currentCouple   = couple;
+    currentMaterial = couple->GetMaterial();
+    currentMaterialIndex = couple->GetIndex();
+    mfpKinEnergy = DBL_MAX;
+  }
 }
 
@@ -863,4 +558,55 @@
   DefineMaterial(couple);
   return GetSubDEDXForScaledEnergy(kineticEnergy*massRatio);
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4double G4VEnergyLossProcess::GetDEDXForScaledEnergy(G4double e)
+{
+  G4bool b;
+  G4double x = 
+    ((*theDEDXTable)[currentMaterialIndex]->GetValue(e, b))*chargeSqRatio;
+  if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);
+  return x;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4double G4VEnergyLossProcess::GetSubDEDXForScaledEnergy(G4double e)
+{
+  G4bool b;
+  G4double x = 
+    ((*theDEDXSubTable)[currentMaterialIndex]->GetValue(e, b))*chargeSqRatio;
+  if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);
+  return x;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4double G4VEnergyLossProcess::GetIonisationForScaledEnergy(G4double e)
+{
+  G4bool b;
+  G4double x = 0.0;
+  //  if(theIonisationTable) {
+  x = ((*theIonisationTable)[currentMaterialIndex]->GetValue(e, b))
+    *chargeSqRatio;
+  if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);
+  //}
+  return x;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline 
+G4double G4VEnergyLossProcess::GetSubIonisationForScaledEnergy(G4double e)
+{
+  G4bool b;
+  G4double x = 0.0;
+  //if(theIonisationSubTable) {
+  x = ((*theIonisationSubTable)[currentMaterialIndex]->GetValue(e, b))
+    *chargeSqRatio;
+  if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);
+  //}
+  return x;
 }
 
@@ -897,219 +643,4 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
-inline G4double G4VEnergyLossProcess::GetRangeForLoss(
-                G4double& kineticEnergy,
-		const G4MaterialCutsCouple* couple)
-{
-  DefineMaterial(couple);
-  G4double x = DBL_MAX;
-  if(theRangeTableForLoss) 
-    x = GetScaledRangeForScaledEnergy(kineticEnergy*massRatio)*reduceFactor;
-  //  G4cout << "Range from " << GetProcessName() 
-  //         << "  e= " << kineticEnergy << " r= " << x << G4endl;
-  return x;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4double G4VEnergyLossProcess::GetKineticEnergy(
-                G4double& range,
-		const G4MaterialCutsCouple* couple)
-{
-  DefineMaterial(couple);
-  G4double r = range/reduceFactor;
-  G4double e = ScaledKinEnergyForLoss(r)/massRatio;
-  return e;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4double G4VEnergyLossProcess::GetLambda(G4double& kineticEnergy,
-					  const G4MaterialCutsCouple* couple)
-{
-  DefineMaterial(couple);
-  G4double x = 0.0;
-  if(theLambdaTable) x = GetLambdaForScaledEnergy(kineticEnergy*massRatio);
-  return x;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4bool G4VEnergyLossProcess::TablesAreBuilt() const
-{
-  return  tablesAreBuilt;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4PhysicsTable* G4VEnergyLossProcess::DEDXTable() const
-{
-  return theDEDXTable;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4PhysicsTable* G4VEnergyLossProcess::DEDXTableForSubsec() const
-{
-  return theDEDXSubTable;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4PhysicsTable* G4VEnergyLossProcess::DEDXunRestrictedTable() const
-{
-  return theDEDXunRestrictedTable;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4PhysicsTable* G4VEnergyLossProcess::IonisationTable() const
-{
-  G4PhysicsTable* t = theDEDXTable;
-  if(theIonisationTable) t = theIonisationTable; 
-  return t;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4PhysicsTable* G4VEnergyLossProcess::IonisationTableForSubsec() const
-{
-  G4PhysicsTable* t = theDEDXSubTable;
-  if(theIonisationSubTable) t = theIonisationSubTable; 
-  return t;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4PhysicsTable* G4VEnergyLossProcess::CSDARangeTable() const
-{
-  return theCSDARangeTable;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4PhysicsTable* G4VEnergyLossProcess::RangeTableForLoss() const
-{
-  return theRangeTableForLoss;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4PhysicsTable* G4VEnergyLossProcess::InverseRangeTable() const
-{
-  return theInverseRangeTable;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4PhysicsTable* G4VEnergyLossProcess::LambdaTable()
-{
-  return theLambdaTable;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4PhysicsTable* G4VEnergyLossProcess::SubLambdaTable()
-{
-  return theSubLambdaTable;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4double G4VEnergyLossProcess::SampleRange()
-{
-  G4double e = amu_c2*preStepKinEnergy/particle->GetPDGMass();
-  G4bool b;
-  G4double s = fRange*std::pow(10.,vstrag->GetValue(e,b));
-  G4double x = fRange + G4RandGauss::shoot(0.0,s);
-  if(x > 0.0) fRange = x;
-  return fRange;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline void G4VEnergyLossProcess::SetDynamicMassCharge(G4double massratio,
-                                                       G4double charge2ratio)
-{
-  massRatio     = massratio;
-  chargeSqRatio = charge2ratio;
-  reduceFactor  = 1.0/(chargeSqRatio*massRatio);
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline void G4VEnergyLossProcess::DefineMaterial(
-            const G4MaterialCutsCouple* couple)
-{
-  if(couple != currentCouple) {
-    currentCouple   = couple;
-    currentMaterial = couple->GetMaterial();
-    currentMaterialIndex = couple->GetIndex();
-    mfpKinEnergy = DBL_MAX;
-  }
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4double G4VEnergyLossProcess::GetDEDXForScaledEnergy(G4double e)
-{
-  G4bool b;
-  G4double x = 
-    ((*theDEDXTable)[currentMaterialIndex]->GetValue(e, b))*chargeSqRatio;
-  if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);
-  return x;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4double G4VEnergyLossProcess::GetSubDEDXForScaledEnergy(G4double e)
-{
-  G4bool b;
-  G4double x = 
-    ((*theDEDXSubTable)[currentMaterialIndex]->GetValue(e, b))*chargeSqRatio;
-  if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);
-  return x;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4double G4VEnergyLossProcess::GetIonisationForScaledEnergy(G4double e)
-{
-  G4bool b;
-  G4double x = 0.0;
-  //  if(theIonisationTable) {
-  x = ((*theIonisationTable)[currentMaterialIndex]->GetValue(e, b))
-    *chargeSqRatio;
-  if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);
-  //}
-  return x;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline 
-G4double G4VEnergyLossProcess::GetSubIonisationForScaledEnergy(G4double e)
-{
-  G4bool b;
-  G4double x = 0.0;
-  //if(theIonisationSubTable) {
-  x = ((*theIonisationSubTable)[currentMaterialIndex]->GetValue(e, b))
-    *chargeSqRatio;
-  if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);
-  //}
-  return x;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4double G4VEnergyLossProcess::GetScaledRangeForScaledEnergy(G4double e)
-{
-  G4bool b;
-  G4double x = ((*theRangeTableForLoss)[currentMaterialIndex])->GetValue(e, b);
-  if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);
-  return x;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
 inline G4double G4VEnergyLossProcess::GetLimitScaledRangeForScaledEnergy(
 		G4double e)
@@ -1126,4 +657,41 @@
   }
   return x;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4double G4VEnergyLossProcess::GetRangeForLoss(
+                G4double& kineticEnergy,
+		const G4MaterialCutsCouple* couple)
+{
+  DefineMaterial(couple);
+  G4double x = DBL_MAX;
+  if(theRangeTableForLoss) 
+    x = GetScaledRangeForScaledEnergy(kineticEnergy*massRatio)*reduceFactor;
+  //  G4cout << "Range from " << GetProcessName() 
+  //         << "  e= " << kineticEnergy << " r= " << x << G4endl;
+  return x;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4double G4VEnergyLossProcess::GetScaledRangeForScaledEnergy(G4double e)
+{
+  G4bool b;
+  G4double x = ((*theRangeTableForLoss)[currentMaterialIndex])->GetValue(e, b);
+  if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);
+  return x;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4double G4VEnergyLossProcess::GetKineticEnergy(
+                G4double& range,
+		const G4MaterialCutsCouple* couple)
+{
+  DefineMaterial(couple);
+  G4double r = range/reduceFactor;
+  G4double e = ScaledKinEnergyForLoss(r)/massRatio;
+  return e;
 }
 
@@ -1143,4 +711,15 @@
   }
   return e;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4double G4VEnergyLossProcess::GetLambda(G4double& kineticEnergy,
+					  const G4MaterialCutsCouple* couple)
+{
+  DefineMaterial(couple);
+  G4double x = 0.0;
+  if(theLambdaTable) x = GetLambdaForScaledEnergy(kineticEnergy*massRatio);
+  return x;
 }
 
@@ -1179,3 +758,418 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
+inline G4double G4VEnergyLossProcess::ContinuousStepLimit(
+         const G4Track& track, G4double x, G4double y, G4double& z)
+{
+  G4GPILSelection sel;
+  return AlongStepGetPhysicalInteractionLength(track, x, y, z, &sel);
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4double G4VEnergyLossProcess::SampleRange()
+{
+  G4double e = amu_c2*preStepKinEnergy/particle->GetPDGMass();
+  G4bool b;
+  G4double s = fRange*std::pow(10.,vstrag->GetValue(e,b));
+  G4double x = fRange + G4RandGauss::shoot(0.0,s);
+  if(x > 0.0) fRange = x;
+  return fRange;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4double G4VEnergyLossProcess::MeanFreePath(const G4Track& track)
+{
+  DefineMaterial(track.GetMaterialCutsCouple());
+  preStepLambda = GetLambdaForScaledEnergy(track.GetKineticEnergy()*massRatio);
+  G4double x = DBL_MAX;
+  if(DBL_MIN < preStepLambda) x = 1.0/preStepLambda;
+  return x;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4double G4VEnergyLossProcess::MinPrimaryEnergy(
+                const G4ParticleDefinition*, const G4Material*, G4double cut)
+{
+  return cut;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline void G4VEnergyLossProcess::SelectModel(G4double kinEnergy)
+{
+  currentModel = modelManager->SelectModel(kinEnergy, currentMaterialIndex);
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4VEmModel* G4VEnergyLossProcess::SelectModelForMaterial(
+                   G4double kinEnergy, size_t& idx) const
+{
+  return modelManager->SelectModel(kinEnergy, idx);
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4ParticleChangeForLoss* G4VEnergyLossProcess::GetParticleChange()
+{
+  return &fParticleChange;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline const G4ParticleDefinition* G4VEnergyLossProcess::Particle() const
+{
+  return particle;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline const G4ParticleDefinition* G4VEnergyLossProcess::BaseParticle() const
+{
+  return baseParticle;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline const G4ParticleDefinition* G4VEnergyLossProcess::SecondaryParticle() const
+{
+  return secondaryParticle;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4PhysicsTable* G4VEnergyLossProcess::DEDXTable() const
+{
+  return theDEDXTable;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4PhysicsTable* G4VEnergyLossProcess::DEDXTableForSubsec() const
+{
+  return theDEDXSubTable;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4PhysicsTable* G4VEnergyLossProcess::DEDXunRestrictedTable() const
+{
+  return theDEDXunRestrictedTable;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4PhysicsTable* G4VEnergyLossProcess::IonisationTable() const
+{
+  G4PhysicsTable* t = theDEDXTable;
+  if(theIonisationTable) t = theIonisationTable; 
+  return t;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4PhysicsTable* G4VEnergyLossProcess::IonisationTableForSubsec() const
+{
+  G4PhysicsTable* t = theDEDXSubTable;
+  if(theIonisationSubTable) t = theIonisationSubTable; 
+  return t;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4PhysicsTable* G4VEnergyLossProcess::CSDARangeTable() const
+{
+  return theCSDARangeTable;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4PhysicsTable* G4VEnergyLossProcess::RangeTableForLoss() const
+{
+  return theRangeTableForLoss;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4PhysicsTable* G4VEnergyLossProcess::InverseRangeTable() const
+{
+  return theInverseRangeTable;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4PhysicsTable* G4VEnergyLossProcess::LambdaTable()
+{
+  return theLambdaTable;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4PhysicsTable* G4VEnergyLossProcess::SubLambdaTable()
+{
+  return theSubLambdaTable;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+  
+inline G4bool G4VEnergyLossProcess::IsIntegral() const 
+{
+  return integral;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline size_t G4VEnergyLossProcess::CurrentMaterialCutsCoupleIndex() const 
+{
+  return currentMaterialIndex;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline void G4VEnergyLossProcess::SetDynamicMassCharge(G4double massratio,
+                                                       G4double charge2ratio)
+{
+  massRatio     = massratio;
+  chargeSqRatio = charge2ratio;
+  reduceFactor  = 1.0/(chargeSqRatio*massRatio);
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+  
+inline G4double G4VEnergyLossProcess::GetCurrentRange() const
+{
+  return fRange;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline
+void G4VEnergyLossProcess::AddEmModel(G4int order, G4VEmModel* p, 
+				      G4VEmFluctuationModel* fluc,
+				      const G4Region* region)
+{
+  modelManager->AddEmModel(order, p, fluc, region);
+  if(p) p->SetParticleChange(pParticleChange, fluc);
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline 
+G4VEmModel* G4VEnergyLossProcess::GetModelByIndex(G4int idx, G4bool ver)
+{
+  return modelManager->GetModel(idx, ver);
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4int G4VEnergyLossProcess::NumberOfModels()
+{
+  return modelManager->NumberOfModels();
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline void G4VEnergyLossProcess::SetEmModel(G4VEmModel* p, G4int index)
+{
+  G4int n = emModels.size();
+  if(index >= n) for(G4int i=n; i<index+1; i++) {emModels.push_back(0);}
+  emModels[index] = p;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4VEmModel* G4VEnergyLossProcess::EmModel(G4int index)
+{
+  G4VEmModel* p = 0;
+  if(index >= 0 && index <  G4int(emModels.size())) p = emModels[index];
+  return p;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline void G4VEnergyLossProcess::SetFluctModel(G4VEmFluctuationModel* p)
+{
+  fluctModel = p;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4VEmFluctuationModel* G4VEnergyLossProcess::FluctModel()
+{
+  return fluctModel;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline void G4VEnergyLossProcess::UpdateEmModel(const G4String& nam, 
+						G4double emin, G4double emax)
+{
+  modelManager->UpdateEmModel(nam, emin, emax);
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline void G4VEnergyLossProcess::SetIntegral(G4bool val)
+{
+  integral = val;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline void G4VEnergyLossProcess::SetParticle(const G4ParticleDefinition* p)
+{
+  particle = p;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline void G4VEnergyLossProcess::SetBaseParticle(const G4ParticleDefinition* p)
+{
+  baseParticle = p;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline void G4VEnergyLossProcess::SetSecondaryParticle(const G4ParticleDefinition* p)
+{
+  secondaryParticle = p;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline void G4VEnergyLossProcess::SetLinearLossLimit(G4double val)
+{
+  linLossLimit = val;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline void G4VEnergyLossProcess::SetLossFluctuations(G4bool val)
+{
+  lossFluctuationFlag = val;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline void G4VEnergyLossProcess::SetRandomStep(G4bool val)
+{
+  rndmStepFlag = val;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline void G4VEnergyLossProcess::SetMinSubRange(G4double val)
+{
+  minSubRange = val;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4bool G4VEnergyLossProcess::TablesAreBuilt() const
+{
+  return  tablesAreBuilt;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4int G4VEnergyLossProcess::NumberOfSubCutoffRegions() const
+{
+  return nSCoffRegions;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline void G4VEnergyLossProcess::SetDEDXBinning(G4int nbins)
+{
+  nBins = nbins;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline void G4VEnergyLossProcess::SetLambdaBinning(G4int nbins)
+{
+  nBins = nbins;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline void G4VEnergyLossProcess::SetDEDXBinningForCSDARange(G4int nbins)
+{
+  nBinsCSDA = nbins;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4double G4VEnergyLossProcess::MinKinEnergy() const
+{
+  return minKinEnergy;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline void G4VEnergyLossProcess::SetMinKinEnergy(G4double e)
+{
+  minKinEnergy = e;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline void G4VEnergyLossProcess::SetMaxKinEnergy(G4double e)
+{
+  maxKinEnergy = e;
+  if(e < maxKinEnergyCSDA) maxKinEnergyCSDA = e;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline void G4VEnergyLossProcess::SetMaxKinEnergyForCSDARange(G4double e)
+{
+  maxKinEnergyCSDA = e;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4double G4VEnergyLossProcess::MaxKinEnergy() const
+{
+  return maxKinEnergy;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline void G4VEnergyLossProcess::SetLambdaFactor(G4double val)
+{
+  if(val > 0.0 && val <= 1.0) lambdaFactor = val;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline void G4VEnergyLossProcess::SetIonisation(G4bool val)
+{
+  isIonisation = val;
+  if(val) aGPILSelection = CandidateForSelection;
+  else    aGPILSelection = NotCandidateForSelection;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4bool G4VEnergyLossProcess::IsIonisationProcess() const
+{
+  return isIonisation;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+void G4VEnergyLossProcess::SetStepFunction(G4double v1, G4double v2)
+{
+  dRoverRange = v1;
+  finalRange = v2;
+  if (dRoverRange > 0.999) dRoverRange = 1.0;
+  currentCouple = 0;
+  mfpKinEnergy  = DBL_MAX;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
 #endif
Index: trunk/source/processes/electromagnetic/utils/include/G4VMscModel.hh
===================================================================
--- trunk/source/processes/electromagnetic/utils/include/G4VMscModel.hh	(revision 968)
+++ trunk/source/processes/electromagnetic/utils/include/G4VMscModel.hh	(revision 991)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4VMscModel.hh,v 1.8 2009/02/24 09:56:03 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02-ref-02 $
+// $Id: G4VMscModel.hh,v 1.4 2008/03/10 10:39:28 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02 $
 //
 // -------------------------------------------------------------------
@@ -54,9 +54,4 @@
 #include "G4MscStepLimitType.hh"
 #include "globals.hh"
-#include "G4ThreeVector.hh"
-#include "G4Track.hh"
-#include "G4SafetyHelper.hh"
-
-class G4ParticleChangeForMSC;
 
 class G4VMscModel : public G4VEmModel
@@ -69,15 +64,4 @@
   virtual ~G4VMscModel();
 
-  // empty 
-  virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
-				 const G4MaterialCutsCouple*,
-				 const G4DynamicParticle*,
-				 G4double tmin,
-				 G4double tmax);
-
-  //================================================================
-  //  Set parameters of multiple scattering models
-  //================================================================
- 
   inline void SetStepLimitType(G4MscStepLimitType);
 
@@ -90,24 +74,4 @@
   inline void SetSkin(G4double);
 
-  inline void SetSampleZ(G4bool);
-
-protected:
-
-  // initialisation of interface with geometry
-  void InitialiseSafetyHelper();
-
-  // shift point of the track PostStep 
-  void ComputeDisplacement(G4ParticleChangeForMSC*,  
-			   const G4ThreeVector& displDir,
-                           G4double displacement,
-			   G4double postsafety);
-
-  // compute safety
-  inline G4double ComputeSafety(const G4ThreeVector& position, G4double limit);
-
-  // compute linear distance to a geometry boundary
-  inline G4double ComputeGeomLimit(const G4Track& position, G4double& presafety, 
-				   G4double limit);
-
 private:
 
@@ -115,6 +79,4 @@
   G4VMscModel & operator=(const  G4VMscModel &right);
   G4VMscModel(const  G4VMscModel&);
-
-  G4SafetyHelper* safetyHelper;
 
 protected:
@@ -126,5 +88,4 @@
   G4double dtrl;
   G4double lambdalimit;
-  G4double geommax;
 
   G4MscStepLimitType steppingAlgorithm;
@@ -173,35 +134,4 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 
-inline void G4VMscModel::SetSampleZ(G4bool val)
-{
-  samplez = val;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
-
-inline G4double G4VMscModel::ComputeSafety(const G4ThreeVector& position, 
-					   G4double)
-{
-  return safetyHelper->ComputeSafety(position);
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
-
-inline G4double G4VMscModel::ComputeGeomLimit(const G4Track& track, 
-					      G4double& presafety, 
-					      G4double limit)
-{
-  G4double res = geommax;
-  if(track.GetVolume() != safetyHelper->GetWorldVolume()) {
-    res = safetyHelper->CheckNextStep(
-          track.GetStep()->GetPreStepPoint()->GetPosition(),
-	  track.GetMomentumDirection(),
-	  limit, presafety);
-  }
-  return res;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
-
 #endif
 
Index: trunk/source/processes/electromagnetic/utils/include/G4VMultipleScattering.hh
===================================================================
--- trunk/source/processes/electromagnetic/utils/include/G4VMultipleScattering.hh	(revision 968)
+++ trunk/source/processes/electromagnetic/utils/include/G4VMultipleScattering.hh	(revision 991)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4VMultipleScattering.hh,v 1.55 2009/02/18 12:19:33 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02-ref-02 $
+// $Id: G4VMultipleScattering.hh,v 1.54 2008/07/31 13:01:26 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02 $
 //
 // -------------------------------------------------------------------
@@ -145,8 +145,12 @@
 			      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.
-  G4double AlongStepGetPhysicalInteractionLength(
+  virtual G4double AlongStepGetPhysicalInteractionLength(
                                             const G4Track&,
 					    G4double  previousStepSize,
@@ -188,6 +192,10 @@
   inline G4PhysicsTable* LambdaTable() const;
 
-  // access particle type 
+  //------------------------------------------------------------------------
+  // Define and access particle type 
+  //------------------------------------------------------------------------
+
   inline const G4ParticleDefinition* Particle() const;
+  inline void SetParticle(const G4ParticleDefinition*);
 
   //------------------------------------------------------------------------
@@ -195,45 +203,27 @@
   //------------------------------------------------------------------------
 
-protected:
-  // Select model in run time
-  inline G4VEmModel* SelectModel(G4double kinEnergy);
-
-public:
-  // Select model in run time
+  inline void AddEmModel(G4int, G4VEmModel*, const G4Region* region = 0);
+
   inline G4VEmModel* SelectModelForMaterial(G4double kinEnergy, 
 					    size_t& idxRegion) const;
 
-  // 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
+  // Access to models
   inline G4VEmModel* GetModelByIndex(G4int idx = 0, G4bool ver = false);
 
   //------------------------------------------------------------------------
-  // Get/Set parameters for simulation of multiple scattering
-  //------------------------------------------------------------------------
-
-  inline G4bool LateralDisplasmentFlag() const;
+  // Set parameters for simulation of multiple scattering
+  //------------------------------------------------------------------------
+
   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:
@@ -243,4 +233,8 @@
 			   G4double,
 			   G4ForceCondition* condition);
+
+  //------------------------------------------------------------------------
+  // Run time methods
+  //------------------------------------------------------------------------
 
   // This method is not used for tracking, it returns step limit
@@ -259,15 +253,34 @@
 					    G4double& currentSafety);
 
+  inline G4VEmModel* SelectModel(G4double kinEnergy);
+  // Select concrete model
+
+  inline const G4MaterialCutsCouple* CurrentMaterialCutsCouple() const; 
+
   // define current material
   inline void DefineMaterial(const G4MaterialCutsCouple* couple);
 
-  inline const G4MaterialCutsCouple* CurrentMaterialCutsCouple() const; 
+  //------------------------------------------------------------------------
+  // Access parameters of multiple scattering
+  //------------------------------------------------------------------------
 
   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);
@@ -317,214 +330,11 @@
 //....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 
-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);
+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;
 }
 
@@ -554,17 +364,209 @@
 //....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::DefineMaterial(const G4MaterialCutsCouple* couple)
-{
-  if(couple != currentCouple) {
-    currentCouple   = couple;
-    currentMaterialIndex = couple->GetIndex();
+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);
   }
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline const G4MaterialCutsCouple* 
-G4VMultipleScattering::CurrentMaterialCutsCouple() const
+  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
 {
   return currentCouple;
@@ -573,7 +575,18 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
-inline G4ParticleChangeForMSC* G4VMultipleScattering::GetParticleChange()
-{
-  return &fParticleChange;
+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);
 }
 
Index: trunk/source/processes/electromagnetic/utils/src/G4EmCalculator.cc
===================================================================
--- trunk/source/processes/electromagnetic/utils/src/G4EmCalculator.cc	(revision 968)
+++ trunk/source/processes/electromagnetic/utils/src/G4EmCalculator.cc	(revision 991)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4EmCalculator.cc,v 1.46 2009/02/24 09:56:03 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02-ref-02 $
+// $Id: G4EmCalculator.cc,v 1.44 2008/08/03 18:47:15 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02 $
 //
 // -------------------------------------------------------------------
@@ -755,11 +755,6 @@
     if(currentProcess) currentProcessName = currentProcess->GetProcessName();
 
-    if(p->GetParticleType() == "nucleus" 
-       && currentParticleName != "deuteron"  
-       && currentParticleName != "triton"
-       && currentParticleName != "alpha+"
-       && currentParticleName != "helium"
-       && currentParticleName != "hydrogen"
-      ) {
+    if(p->GetParticleType() == "nucleus" &&
+       currentParticleName  != "deuteron" && currentParticleName != "triton") {
       baseParticle = theGenericIon;
       massRatio = baseParticle->GetPDGMass()/p->GetPDGMass();
Index: trunk/source/processes/electromagnetic/utils/src/G4EmConfigurator.cc
===================================================================
--- trunk/source/processes/electromagnetic/utils/src/G4EmConfigurator.cc	(revision 968)
+++ trunk/source/processes/electromagnetic/utils/src/G4EmConfigurator.cc	(revision 991)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4EmConfigurator.cc,v 1.4 2009/02/26 11:33:33 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02-ref-02 $
+// $Id: G4EmConfigurator.cc,v 1.3 2008/11/21 12:30:29 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02 $
 //
 // -------------------------------------------------------------------
@@ -117,7 +117,5 @@
   G4String fname = "";
   if(fm) fname = fm->GetName();
-  G4String mname = "";
-  if(mod) mname = mod->GetName();
-  AddModelForRegion(particleName, processName, mname, regionName,
+  AddModelForRegion(particleName, processName, mod->GetName(), regionName,
 		    emin, emax, fname);
 }
@@ -205,9 +203,5 @@
 
 	for(G4int i=0; i<nm; i++) {
-          G4String mname = "";
-          if(modelList[i]) mname = modelList[i]->GetName();
-          G4String fname = "";
-          if(flucModelList[i]) fname = flucModelList[i]->GetName();
-	  if(modelName == mname && flucModelName == fname &&
+	  if(modelName == modelList[i]->GetName() &&
              (particleList[i] == "" || particleList[i] == particleName) ) {
 	    mod  = modelList[i];
@@ -220,20 +214,11 @@
 
 	if(!mod) {
-
-	  // set fluctuation model for ionisation processes
-          if(fluc && ptype == eloss) {
-	    G4VEnergyLossProcess* p = reinterpret_cast<G4VEnergyLossProcess*>(proc);
-	    p->SetFluctModel(fluc);
-	 
-	  } else {
-	    G4cout << "### G4EmConfigurator WARNING: fails to find a model <"
-		   << modelName << "> for process <" 
-		   << processName << "> and " << particleName 
-		   << G4endl;
-	    if(flucModelName != "") {
-	      G4cout << "                            fluctuation model <" 
-		     << flucModelName << G4endl;
-	    }
-	  }
+	  G4cout << "### G4EmConfigurator WARNING: fails to find a model <"
+		 << modelName << "> for process <" 
+		 << processName << "> and " << particleName 
+		 << G4endl;
+	  if(flucModelName != "")  
+	    G4cout << "                            fluctuation model <" 
+		   << flucModelName << G4endl;
 	} else {
 
Index: trunk/source/processes/electromagnetic/utils/src/G4EmProcessOptions.cc
===================================================================
--- trunk/source/processes/electromagnetic/utils/src/G4EmProcessOptions.cc	(revision 968)
+++ trunk/source/processes/electromagnetic/utils/src/G4EmProcessOptions.cc	(revision 991)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4EmProcessOptions.cc,v 1.26 2009/02/18 14:43:27 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02-ref-02 $
+// $Id: G4EmProcessOptions.cc,v 1.24 2008/04/17 10:33:27 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02 $
 //
 // -------------------------------------------------------------------
@@ -59,5 +59,4 @@
 #include "G4VMultipleScattering.hh"
 #include "G4Region.hh"
-#include "G4RegionStore.hh"
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -393,38 +392,19 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
-void G4EmProcessOptions::ActivateDeexcitation(const G4String& pname, 
-					      G4bool val, 
-					      const G4String& reg)
-{
-  G4RegionStore* regionStore = G4RegionStore::GetInstance();
-  const G4Region* r = 0;
-  if(reg == "" || reg == "World") {
-    r = regionStore->GetRegion("DefaultRegionForTheWorld", false);
-  } else {
-    r = regionStore->GetRegion(reg, false);
-  }
-  if(!r) {
-    G4cout << "G4EmProcessOptions::ActivateDeexcitation ERROR: G4Region <"
-	   << reg << "> not found, the command ignored" << G4endl;
-    return;
-  }
-
-  const std::vector<G4VEnergyLossProcess*>& v =
-        theManager->GetEnergyLossProcessVector();
-  std::vector<G4VEnergyLossProcess*>::const_iterator itr;
-  for(itr = v.begin(); itr != v.end(); itr++) {
-    G4VEnergyLossProcess* p = *itr;
-    if(p) {
-      if(pname == p->GetProcessName()) p->ActivateDeexcitation(val,r);
-    }
-  }
-  const std::vector<G4VEmProcess*>& w =
-        theManager->GetEmProcessVector();
-  std::vector<G4VEmProcess*>::const_iterator itp;
-  for(itp = w.begin(); itp != w.end(); itp++) {
-    G4VEmProcess* q = *itp;
-    if(q) {
-      if(pname == q->GetProcessName()) q->ActivateDeexcitation(val,r);
-    }
+void G4EmProcessOptions::ActivateDeexcitation(G4bool val, const G4Region* r)
+{
+  const std::vector<G4VEnergyLossProcess*>& v =
+        theManager->GetEnergyLossProcessVector();
+  std::vector<G4VEnergyLossProcess*>::const_iterator itr;
+  for(itr = v.begin(); itr != v.end(); itr++) {
+    G4VEnergyLossProcess* p = *itr;
+    if(p) p->ActivateDeexcitation(val,r);
+  }
+  const std::vector<G4VEmProcess*>& w =
+        theManager->GetEmProcessVector();
+  std::vector<G4VEmProcess*>::const_iterator itp;
+  for(itp = w.begin(); itp != w.end(); itp++) {
+    G4VEmProcess* q = *itp;
+    if(q) q->ActivateDeexcitation(val,r);
   }
 }
Index: trunk/source/processes/electromagnetic/utils/src/G4EnergyLossMessenger.cc
===================================================================
--- trunk/source/processes/electromagnetic/utils/src/G4EnergyLossMessenger.cc	(revision 968)
+++ trunk/source/processes/electromagnetic/utils/src/G4EnergyLossMessenger.cc	(revision 991)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4EnergyLossMessenger.cc,v 1.37 2009/02/18 14:43:27 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02-ref-02 $
+// $Id: G4EnergyLossMessenger.cc,v 1.35 2008/10/20 13:27:45 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02 $
 //
 // -------------------------------------------------------------------
@@ -178,19 +178,4 @@
   aplCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
 
-  deexCmd = new G4UIcommand("/process/em/deexcitation",this);
-  deexCmd->SetGuidance("Set deexcitation flag per process and G4Region.");
-  deexCmd->SetGuidance("  procName  : process name");
-  deexCmd->SetGuidance("  flag      : flag");
-  deexCmd->SetGuidance("  regName   : G4Region name");
-
-  G4UIparameter* pName = new G4UIparameter("pName",'s',false);
-  deexCmd->SetParameter(pName);
-
-  G4UIparameter* flag = new G4UIparameter("flag",'s',false);
-  deexCmd->SetParameter(flag);
-
-  G4UIparameter* regName = new G4UIparameter("regName",'s',false);
-  deexCmd->SetParameter(regName);
-
   dedxCmd = new G4UIcmdWithAnInteger("/process/eLoss/binsDEDX",this);
   dedxCmd->SetGuidance("Set number of bins for DEDX tables");
@@ -274,5 +259,4 @@
   delete MinSubSecCmd;
   delete StepFuncCmd;
-  delete deexCmd;
   delete eLossDirectory;
   delete mscDirectory;
@@ -336,13 +320,4 @@
   }
 
-  if (command == deexCmd) {
-    G4String s1 (""), s2(""), s3("");
-    G4bool b = false;
-    std::istringstream is(newValue);
-    is >> s1 >> s2 >> s3;
-    if(s2 == "true") b = true;
-    opt->ActivateDeexcitation(s1,b,s3);
-  }
-
   if (command == mscCmd) {
     if(newValue == "Minimal") 
Index: trunk/source/processes/electromagnetic/utils/src/G4LossTableBuilder.cc
===================================================================
--- trunk/source/processes/electromagnetic/utils/src/G4LossTableBuilder.cc	(revision 968)
+++ trunk/source/processes/electromagnetic/utils/src/G4LossTableBuilder.cc	(revision 991)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4LossTableBuilder.cc,v 1.28 2009/02/18 16:24:47 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02-ref-02 $
+// $Id: G4LossTableBuilder.cc,v 1.27 2008/07/22 15:55:15 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02 $
 //
 // -------------------------------------------------------------------
@@ -132,9 +132,7 @@
       G4double dedx1  = pv->GetValue(elow, b);
 
-      //G4cout << "nbins= " << nbins << " dedx1= " << dedx1 << G4endl;
-
       // protection for specific cases dedx=0
       if(dedx1 == 0.0) {
-        for (size_t k=1; k<nbins-1; k++) {
+        for (size_t k=1; k<nbins; k++) {
           bin0++;
           elow  = pv->GetLowEdgeEnergy(k);
@@ -145,14 +143,6 @@
       }
 
-      //G4cout << "nbins= " << nbins << " elow= " << elow << " ehigh= " << ehigh << G4endl;
       // initialisation of a new vector
       G4PhysicsLogVector* v = new G4PhysicsLogVector(elow, ehigh, nbins);
-      // dedx is exect zero
-      if(nbins <= 2) {
-	v->PutValue(0,1000.);
-	v->PutValue(1,2000.);
-	G4PhysicsTableHelper::SetPhysicsVector(rangeTable, i, v);
-	return;
-      }
       v->SetSpline(splineFlag);
 
Index: trunk/source/processes/electromagnetic/utils/src/G4VEmFluctuationModel.cc
===================================================================
--- trunk/source/processes/electromagnetic/utils/src/G4VEmFluctuationModel.cc	(revision 968)
+++ trunk/source/processes/electromagnetic/utils/src/G4VEmFluctuationModel.cc	(revision 991)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4VEmFluctuationModel.cc,v 1.4 2009/02/19 11:25:50 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02-ref-02 $
+// $Id: G4VEmFluctuationModel.cc,v 1.3 2008/07/15 16:56:39 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02 $
 //
 // -------------------------------------------------------------------
@@ -65,10 +65,3 @@
 }
 
-void G4VEmFluctuationModel::InitialiseMe(const G4ParticleDefinition*)
-{}
 
-void G4VEmFluctuationModel::SetParticleAndCharge(const G4ParticleDefinition*, 
-						 G4double)
-{}
-
-
Index: trunk/source/processes/electromagnetic/utils/src/G4VEmModel.cc
===================================================================
--- trunk/source/processes/electromagnetic/utils/src/G4VEmModel.cc	(revision 968)
+++ trunk/source/processes/electromagnetic/utils/src/G4VEmModel.cc	(revision 991)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4VEmModel.cc,v 1.25 2009/02/19 09:57:36 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02-ref-02 $
+// $Id: G4VEmModel.cc,v 1.20 2008/11/13 23:13:18 schaelic Exp $
+// GEANT4 tag $Name: geant4-09-02 $
 //
 // -------------------------------------------------------------------
@@ -41,5 +41,4 @@
 // 25.10.2005 Set default highLimit=100.TeV (V.Ivanchenko)
 // 06.02.2006 add method ComputeMeanFreePath() (mma)
-// 16.02.2009 Move implementations of virtual methods to source (VI)
 //
 //
@@ -61,7 +60,5 @@
   fluc(0), name(nam), lowLimit(0.1*keV), highLimit(100.0*TeV), 
   polarAngleLimit(0.0),secondaryThreshold(DBL_MAX),theLPMflag(false),
-  pParticleChange(0),nuclearStopping(false),
-  currentCouple(0),currentElement(0),
-  nsec(5),flagDeexcitation(false) 
+  pParticleChange(0),nuclearStopping(false),nsec(5) 
 {
   xsec.resize(nsec);
@@ -85,10 +82,46 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 
+G4double G4VEmModel::CrossSectionPerVolume(const G4Material* material,
+					   const G4ParticleDefinition* p,
+					   G4double ekin,
+					   G4double emin,
+					   G4double emax)
+{
+  SetupForMaterial(p, material, ekin);
+  G4double cross = 0.0;
+  const G4ElementVector* theElementVector = material->GetElementVector();
+  const G4double* theAtomNumDensityVector = material->GetVecNbOfAtomsPerVolume();
+  G4int nelm = material->GetNumberOfElements(); 
+  if(nelm > nsec) {
+    xsec.resize(nelm);
+    nsec = nelm;
+  }
+  for (G4int i=0; i<nelm; i++) {
+    cross += theAtomNumDensityVector[i]*
+      ComputeCrossSectionPerAtom(p,(*theElementVector)[i],ekin,emin,emax);
+    xsec[i] = cross;
+  }
+  return cross;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+G4double G4VEmModel::ComputeMeanFreePath(const G4ParticleDefinition* p,
+					 G4double ekin,
+					 const G4Material* material,     
+					 G4double emin,
+					 G4double emax)
+{
+  G4double mfp = DBL_MAX;
+  G4double cross = CrossSectionPerVolume(material,p,ekin,emin,emax);
+  if (cross > DBL_MIN) mfp = 1./cross;
+  return mfp;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
 void G4VEmModel::InitialiseElementSelectors(const G4ParticleDefinition* p, 
 					    const G4DataVector& cuts)
 {
-  // initialise before run
-  flagDeexcitation = false;
-
   G4int nbins = G4int(std::log10(highLimit/lowLimit) + 0.5);
   if(nbins < 3) nbins = 3;
@@ -129,130 +162,3 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 
-G4double G4VEmModel::ComputeDEDXPerVolume(const G4Material*,
-					  const G4ParticleDefinition*,
-					  G4double,G4double)
-{
-  return 0.0;
-}
 
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
-
-G4double G4VEmModel::CrossSectionPerVolume(const G4Material* material,
-					   const G4ParticleDefinition* p,
-					   G4double ekin,
-					   G4double emin,
-					   G4double emax)
-{
-  SetupForMaterial(p, material, ekin);
-  G4double cross = 0.0;
-  const G4ElementVector* theElementVector = material->GetElementVector();
-  const G4double* theAtomNumDensityVector = material->GetVecNbOfAtomsPerVolume();
-  G4int nelm = material->GetNumberOfElements(); 
-  if(nelm > nsec) {
-    xsec.resize(nelm);
-    nsec = nelm;
-  }
-  for (G4int i=0; i<nelm; i++) {
-    cross += theAtomNumDensityVector[i]*
-      ComputeCrossSectionPerAtom(p,(*theElementVector)[i],ekin,emin,emax);
-    xsec[i] = cross;
-  }
-  return cross;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
-
-G4double G4VEmModel::ComputeCrossSectionPerAtom(const G4ParticleDefinition*,
-						G4double, G4double, G4double,
-						G4double, G4double)
-{
-  return 0.0;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
-
-G4double G4VEmModel::MinEnergyCut(const G4ParticleDefinition*,
-				  const G4MaterialCutsCouple*)
-{
-  return 0.0;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
-
-G4double G4VEmModel::GetChargeSquareRatio(const G4ParticleDefinition* p,
-					  const G4Material*, G4double)
-{
-  G4double q = p->GetPDGCharge()/CLHEP::eplus;
-  return q*q;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
-
-G4double G4VEmModel::GetParticleCharge(const G4ParticleDefinition* p,
-				       const G4Material*, G4double)
-{
-  return p->GetPDGCharge();
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
-
-void G4VEmModel::CorrectionsAlongStep(const G4MaterialCutsCouple*,
-				      const G4DynamicParticle*,
-				      G4double&,G4double&,G4double)
-{}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
-
-void G4VEmModel::SampleDeexcitationAlongStep(const G4Material*,
-					     const G4Track&,
-					     G4double& )
-{}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
-
-G4double G4VEmModel::MaxSecondaryEnergy(const G4ParticleDefinition*,
-					G4double kineticEnergy)
-{
-  return kineticEnergy;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
-
-void G4VEmModel::SampleScattering(const G4DynamicParticle*, G4double)
-{}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
-
-G4double G4VEmModel::ComputeTruePathLengthLimit(const G4Track&, 
-						G4PhysicsTable*, 
-						G4double)
-{
-  return DBL_MAX;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
-
-G4double G4VEmModel::ComputeGeomPathLength(G4double truePathLength)
-{
-  return truePathLength;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
-
-G4double G4VEmModel::ComputeTrueStepLength(G4double geomPathLength)
-{
-  return geomPathLength;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
-
-void G4VEmModel::DefineForRegion(const G4Region*) 
-{}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
-
-void G4VEmModel::SetupForMaterial(const G4ParticleDefinition*,
-				  const G4Material*, G4double)
-{}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Index: trunk/source/processes/electromagnetic/utils/src/G4VEmProcess.cc
===================================================================
--- trunk/source/processes/electromagnetic/utils/src/G4VEmProcess.cc	(revision 968)
+++ trunk/source/processes/electromagnetic/utils/src/G4VEmProcess.cc	(revision 991)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4VEmProcess.cc,v 1.62 2009/02/19 09:57:36 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02-ref-02 $
+// $Id: G4VEmProcess.cc,v 1.60 2008/10/17 14:46:16 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02 $
 //
 // -------------------------------------------------------------------
@@ -91,8 +91,6 @@
   applyCuts(false),
   startFromNull(true),
-  useDeexcitation(false),
-  nDERegions(0),
-  idxDERegions(0),
-  currentModel(0),
+  nRegions(0),
+  selectedModel(0),
   particle(0),
   currentCouple(0)
@@ -137,21 +135,4 @@
   delete modelManager;
   (G4LossTableManager::Instance())->DeRegister(this);
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-void G4VEmProcess::Clear()
-{
-  delete [] theEnergyOfCrossSectionMax;
-  delete [] theCrossSectionMax;
-  delete [] idxDERegions;
-  theEnergyOfCrossSectionMax = 0;
-  theCrossSectionMax = 0;
-  idxDERegions = 0;
-  currentCouple = 0;
-  preStepLambda = 0.0;
-  mfpKinEnergy  = DBL_MAX;
-  deRegions.clear();
-  nDERegions = 0;
 }
 
@@ -181,34 +162,17 @@
       theLambdaTable = G4PhysicsTableHelper::PreparePhysicsTable(theLambdaTable);
   }
-  // Sub Cutoff and Deexcitation
-  if (nDERegions>0) {
-
-    const G4ProductionCutsTable* theCoupleTable=
-          G4ProductionCutsTable::GetProductionCutsTable();
-    size_t numOfCouples = theCoupleTable->GetTableSize();
-
-    idxDERegions = new G4bool[numOfCouples];
-
-    for (size_t j=0; j<numOfCouples; j++) {
-
-      const G4MaterialCutsCouple* couple =
-        theCoupleTable->GetMaterialCutsCouple(j);
-      const G4ProductionCuts* pcuts = couple->GetProductionCuts();
-      G4bool reg = false;
-      for(G4int i=0; i<nDERegions; i++) {
-	if(deRegions[i]) {
-	  if(pcuts == deRegions[i]->GetProductionCuts()) reg = true;
-	}
-      }
-      idxDERegions[j] = reg;
-    }
-  }
-  if (1 < verboseLevel && nDERegions>0) {
-    G4cout << " Deexcitation is activated for regions: " << G4endl;
-    for (G4int i=0; i<nDERegions; i++) {
-      const G4Region* r = deRegions[i];
-      G4cout << "           " << r->GetName() << G4endl;
-    }
-  }
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+void G4VEmProcess::Clear()
+{
+  if(theEnergyOfCrossSectionMax) delete [] theEnergyOfCrossSectionMax;
+  if(theCrossSectionMax) delete [] theCrossSectionMax;
+  theEnergyOfCrossSectionMax = 0;
+  theCrossSectionMax = 0;
+  currentCouple = 0;
+  preStepLambda = 0.0;
+  mfpKinEnergy  = DBL_MAX;
 }
 
@@ -273,33 +237,4 @@
       G4cout << *theLambdaTable << G4endl;
     }
-  }
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-void G4VEmProcess::PrintInfoDefinition()
-{
-  if(verboseLevel > 0) {
-    G4cout << G4endl << GetProcessName() << ":   for  "
-           << particle->GetParticleName();
-    if(integral) G4cout << ", integral: 1 ";
-    if(applyCuts) G4cout << ", applyCuts: 1 ";
-    G4cout << "    SubType= " << GetProcessSubType() << G4endl;
-    if(buildLambdaTable) {
-      G4cout << "      Lambda tables from "
-	     << G4BestUnit(minKinEnergy,"Energy") 
-	     << " to "
-	     << G4BestUnit(maxKinEnergy,"Energy")
-	     << " in " << nLambdaBins << " bins, spline: " 
-	     << (G4LossTableManager::Instance())->SplineFlag()
-	     << G4endl;
-    }
-    PrintInfo();
-    modelManager->DumpModelList(verboseLevel);
-  }
-
-  if(verboseLevel > 2 && buildLambdaTable) {
-    G4cout << "      LambdaTable address= " << theLambdaTable << G4endl;
-    if(theLambdaTable) G4cout << (*theLambdaTable) << G4endl;
   }
 }
@@ -369,4 +304,14 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
+G4double G4VEmProcess::GetMeanFreePath(const G4Track& track,
+				       G4double,
+				       G4ForceCondition* condition)
+{
+  *condition = NotForced;
+  return G4VEmProcess::MeanFreePath(track);
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
 G4VParticleChange* G4VEmProcess::PostStepDoIt(const G4Track& track,
                                               const G4Step&)
@@ -397,8 +342,6 @@
   }
 
-  SelectModel(finalT);
-  if(useDeexcitation) {
-    currentModel->SetDeexcitationFlag(idxDERegions[currentMaterialIndex]);
-  }
+  G4VEmModel* currentModel = SelectModel(finalT);
+
   /*  
   if(0 < verboseLevel) {
@@ -461,4 +404,54 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
+void G4VEmProcess::PrintInfoDefinition()
+{
+  if(verboseLevel > 0) {
+    G4cout << G4endl << GetProcessName() << ":   for  "
+           << particle->GetParticleName();
+    if(integral) G4cout << ", integral: 1 ";
+    if(applyCuts) G4cout << ", applyCuts: 1 ";
+    G4cout << "    SubType= " << GetProcessSubType() << G4endl;
+    if(buildLambdaTable) {
+      G4cout << "      Lambda tables from "
+	     << G4BestUnit(minKinEnergy,"Energy") 
+	     << " to "
+	     << G4BestUnit(maxKinEnergy,"Energy")
+	     << " in " << nLambdaBins << " bins, spline: " 
+	     << (G4LossTableManager::Instance())->SplineFlag()
+	     << G4endl;
+    }
+    PrintInfo();
+    modelManager->DumpModelList(verboseLevel);
+  }
+
+  if(verboseLevel > 2 && buildLambdaTable) {
+    G4cout << "      LambdaTable address= " << theLambdaTable << G4endl;
+    if(theLambdaTable) G4cout << (*theLambdaTable) << G4endl;
+  }
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+G4double G4VEmProcess::CrossSectionPerVolume(G4double kineticEnergy,
+					     const G4MaterialCutsCouple* couple)
+{
+  // Cross section per atom is calculated
+  DefineMaterial(couple);
+  G4double cross = 0.0;
+  G4bool b;
+  if(theLambdaTable) {
+    cross = (((*theLambdaTable)[currentMaterialIndex])->
+                           GetValue(kineticEnergy, b));
+  } else {
+    G4VEmModel* model = SelectModel(kineticEnergy);
+    cross = 
+      model->CrossSectionPerVolume(currentMaterial,particle,kineticEnergy);
+  }
+
+  return cross;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
 G4bool G4VEmProcess::StorePhysicsTable(const G4ParticleDefinition* part,
 			 	       const G4String& directory,
@@ -528,63 +521,4 @@
 
   return yes;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-void G4VEmProcess::ActivateDeexcitation(G4bool val, const G4Region* r)
-{
-  G4RegionStore* regionStore = G4RegionStore::GetInstance();
-  const G4Region* reg = r;
-  if (!reg) {reg = regionStore->GetRegion("DefaultRegionForTheWorld", false);}
-
-  // the region is in the list
-  if (nDERegions) {
-    for (G4int i=0; i<nDERegions; i++) {
-      if (reg == deRegions[i]) {
-	if(!val) deRegions[i] = 0;
-        return;
-      }
-    }
-  }
-
-  // new region 
-  if(val) {
-    useDeexcitation = true;
-    deRegions.push_back(reg);
-    nDERegions++;
-  } else {
-    useDeexcitation = false;
-  }
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-G4double G4VEmProcess::CrossSectionPerVolume(G4double kineticEnergy,
-					     const G4MaterialCutsCouple* couple)
-{
-  // Cross section per atom is calculated
-  DefineMaterial(couple);
-  G4double cross = 0.0;
-  G4bool b;
-  if(theLambdaTable) {
-    cross = (((*theLambdaTable)[currentMaterialIndex])->
-                           GetValue(kineticEnergy, b));
-  } else {
-    SelectModel(kineticEnergy);
-    cross = currentModel->CrossSectionPerVolume(currentMaterial,
-						particle,kineticEnergy);
-  }
-
-  return cross;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-G4double G4VEmProcess::GetMeanFreePath(const G4Track& track,
-				       G4double,
-				       G4ForceCondition* condition)
-{
-  *condition = NotForced;
-  return G4VEmProcess::MeanFreePath(track);
 }
 
Index: trunk/source/processes/electromagnetic/utils/src/G4VEnergyLossProcess.cc
===================================================================
--- trunk/source/processes/electromagnetic/utils/src/G4VEnergyLossProcess.cc	(revision 968)
+++ trunk/source/processes/electromagnetic/utils/src/G4VEnergyLossProcess.cc	(revision 991)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4VEnergyLossProcess.cc,v 1.146 2009/02/19 11:25:50 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02-ref-02 $
+// $Id: G4VEnergyLossProcess.cc,v 1.143 2008/10/17 14:46:16 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02 $
 //
 // -------------------------------------------------------------------
@@ -150,7 +150,5 @@
   secondaryParticle(0),
   nSCoffRegions(0),
-  nDERegions(0),
   idxSCoffRegions(0),
-  idxDERegions(0),
   nProcesses(0),
   theDEDXTable(0),
@@ -178,5 +176,4 @@
   isIonisation(true),
   useSubCutoff(false),
-  useDeexcitation(false),
   particle(0),
   currentCouple(0),
@@ -240,5 +237,5 @@
 	   << G4endl;
   delete vstrag;
-  Clean();
+  Clear();
 
   if ( !baseParticle ) {
@@ -294,5 +291,5 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
-void G4VEnergyLossProcess::Clean()
+void G4VEnergyLossProcess::Clear()
 {
   if(1 < verboseLevel) { 
@@ -305,5 +302,4 @@
   delete [] theCrossSectionMax;
   delete [] idxSCoffRegions;
-  delete [] idxDERegions;
 
   theDEDXAtMaxEnergy = 0;
@@ -316,13 +312,4 @@
   scProcesses.clear();
   nProcesses = 0;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-G4double G4VEnergyLossProcess::MinPrimaryEnergy(const G4ParticleDefinition*, 
-						const G4Material*, 
-						G4double cut)
-{
-  return cut;
 }
 
@@ -377,5 +364,5 @@
   }
 
-  Clean();
+  Clear();
 
   // Base particle and set of models can be defined here
@@ -420,6 +407,6 @@
 				     minSubRange, verboseLevel);
 
-  // Sub Cutoff and Deexcitation
-  if (nSCoffRegions>0 || nDERegions>0) {
+  // Sub Cutoff Regime
+  if (nSCoffRegions>0) {
     theSubCuts = modelManager->SubCutoff();
 
@@ -427,7 +414,5 @@
           G4ProductionCutsTable::GetProductionCutsTable();
     size_t numOfCouples = theCoupleTable->GetTableSize();
-
-    if(nSCoffRegions>0) idxSCoffRegions = new G4bool[numOfCouples];
-    if(nDERegions>0) idxDERegions = new G4bool[numOfCouples];
+    idxSCoffRegions = new G4int[numOfCouples];
   
     for (size_t j=0; j<numOfCouples; j++) {
@@ -436,19 +421,9 @@
 	theCoupleTable->GetMaterialCutsCouple(j);
       const G4ProductionCuts* pcuts = couple->GetProductionCuts();
-      
-      if(nSCoffRegions>0) {
-	G4bool reg = false;
-	for(G4int i=0; i<nSCoffRegions; i++) {
-	  if( pcuts == scoffRegions[i]->GetProductionCuts()) reg = true;
-	}
-	idxSCoffRegions[j] = reg;
-      }
-      if(nDERegions>0) {
-	G4bool reg = false;
-	for(G4int i=0; i<nDERegions; i++) {
-	  if( pcuts == deRegions[i]->GetProductionCuts()) reg = true;
-	}
-	idxDERegions[j] = reg;
-      }
+      G4int reg = 0;
+      for(G4int i=0; i<nSCoffRegions; i++) {
+        if( pcuts == scoffRegions[i]->GetProductionCuts()) reg = 1;
+      }
+      idxSCoffRegions[j] = reg;
     }
   }
@@ -470,11 +445,4 @@
       }
     }
-    if (nDERegions) {
-      G4cout << " Deexcitation is ON for regions: " << G4endl;
-      for (G4int i=0; i<nDERegions; i++) {
-        const G4Region* r = deRegions[i];
-	G4cout << "           " << r->GetName() << G4endl;
-      }
-    }
   }
 }
@@ -511,4 +479,24 @@
     if(isIonisation) G4cout << "  isIonisation  flag = 1";
     G4cout << G4endl;
+  }
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+void G4VEnergyLossProcess::ActivateSubCutoff(G4bool val, const G4Region* r)
+{
+  G4RegionStore* regionStore = G4RegionStore::GetInstance();
+  if(val) {
+    useSubCutoff = true;
+    if (!r) {r = regionStore->GetRegion("DefaultRegionForTheWorld", false);}
+    if (nSCoffRegions) {
+      for (G4int i=0; i<nSCoffRegions; i++) {
+	if (r == scoffRegions[i]) return;
+      }
+    }
+    scoffRegions.push_back(r);
+    nSCoffRegions++;
+  } else {
+    useSubCutoff = false;
   }
 }
@@ -652,131 +640,9 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
-void G4VEnergyLossProcess::PrintInfoDefinition()
-{
-  if(0 < verboseLevel) {
-    G4cout << G4endl << GetProcessName() << ":   for  "
-           << particle->GetParticleName()
-	   << "    SubType= " << GetProcessSubType() 
-           << G4endl
-           << "      dE/dx and range tables from "
- 	   << G4BestUnit(minKinEnergy,"Energy")
-           << " to " << G4BestUnit(maxKinEnergy,"Energy")
-           << " in " << nBins << " bins" << G4endl
-           << "      Lambda tables from threshold to "
-           << G4BestUnit(maxKinEnergy,"Energy")
-           << " in " << nBins << " bins, spline: " 
-	   << (G4LossTableManager::Instance())->SplineFlag()
-           << G4endl;
-    if(theRangeTableForLoss && isIonisation) {
-      G4cout << "      finalRange(mm)= " << finalRange/mm
-             << ", dRoverRange= " << dRoverRange
-             << ", integral: " << integral
-             << ", fluct: " << lossFluctuationFlag
-	     << ", linLossLimit= " << linLossLimit
-             << G4endl;
-    }
-    PrintInfo();
-    modelManager->DumpModelList(verboseLevel);
-    if(theCSDARangeTable && isIonisation) {
-      G4cout << "      CSDA range table up"
-             << " to " << G4BestUnit(maxKinEnergyCSDA,"Energy")
-             << " in " << nBinsCSDA << " bins" << G4endl;
-    }
-    if(nSCoffRegions>0 && isIonisation) {
-      G4cout << "      Subcutoff sampling in " << nSCoffRegions 
-	     << " regions" << G4endl;
-    }
-    if(2 < verboseLevel) {
-      G4cout << "      DEDXTable address= " << theDEDXTable << G4endl;
-      if(theDEDXTable && isIonisation) G4cout << (*theDEDXTable) << G4endl;
-      G4cout << "non restricted DEDXTable address= " 
-	     << theDEDXunRestrictedTable << G4endl;
-      if(theDEDXunRestrictedTable && isIonisation) {
-           G4cout << (*theDEDXunRestrictedTable) << G4endl;
-      }
-      if(theDEDXSubTable && isIonisation) {
-	G4cout << (*theDEDXSubTable) << G4endl;
-      }
-      G4cout << "      CSDARangeTable address= " << theCSDARangeTable 
-	     << G4endl;
-      if(theCSDARangeTable && isIonisation) {
-	G4cout << (*theCSDARangeTable) << G4endl;
-      }
-      G4cout << "      RangeTableForLoss address= " << theRangeTableForLoss 
-	     << G4endl;
-      if(theRangeTableForLoss && isIonisation) {
-             G4cout << (*theRangeTableForLoss) << G4endl;
-      }
-      G4cout << "      InverseRangeTable address= " << theInverseRangeTable 
-	     << G4endl;
-      if(theInverseRangeTable && isIonisation) {
-             G4cout << (*theInverseRangeTable) << G4endl;
-      }
-      G4cout << "      LambdaTable address= " << theLambdaTable << G4endl;
-      if(theLambdaTable && isIonisation) {
-	G4cout << (*theLambdaTable) << G4endl;
-      }
-      G4cout << "      SubLambdaTable address= " << theSubLambdaTable << G4endl;
-      if(theSubLambdaTable && isIonisation) {
-	G4cout << (*theSubLambdaTable) << G4endl;
-      }
-    }
-  }
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-void G4VEnergyLossProcess::ActivateSubCutoff(G4bool val, const G4Region* r)
-{
-  G4RegionStore* regionStore = G4RegionStore::GetInstance();
-  const G4Region* reg = r;
-  if (!reg) {reg = regionStore->GetRegion("DefaultRegionForTheWorld", false);}
-
-  // the region is in the list
-  if (nSCoffRegions) {
-    for (G4int i=0; i<nSCoffRegions; i++) {
-      if (reg == scoffRegions[i]) {
-	if(!val) deRegions[i] = 0;
-        return;
-      }
-    }
-  }
-
-  // new region 
-  if(val) {
-    useSubCutoff = true;
-    scoffRegions.push_back(reg);
-    nSCoffRegions++;
-  } else {
-    useSubCutoff = false;
-  }
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-void G4VEnergyLossProcess::ActivateDeexcitation(G4bool val, const G4Region* r)
-{
-  G4RegionStore* regionStore = G4RegionStore::GetInstance();
-  const G4Region* reg = r;
-  if (!reg) {reg = regionStore->GetRegion("DefaultRegionForTheWorld", false);}
-
-  // the region is in the list
-  if (nDERegions) {
-    for (G4int i=0; i<nDERegions; i++) {
-      if (reg == deRegions[i]) {
-	if(!val) deRegions[i] = 0;
-        return;
-      }
-    }
-  }
-
-  // new region 
-  if(val) {
-    useDeexcitation = true;
-    deRegions.push_back(reg);
-    nDERegions++;
-  } else {
-    useDeexcitation = false;
-  }
+G4double G4VEnergyLossProcess::GetContinuousStepLimit(
+		const G4Track&,
+                G4double, G4double, G4double&)
+{
+  return DBL_MAX;
 }
 
@@ -808,4 +674,16 @@
   //  <<" stepLimit= "<<x<<G4endl;
   return x;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+G4double G4VEnergyLossProcess::GetMeanFreePath(
+                             const G4Track& track,
+                             G4double,
+                             G4ForceCondition* condition)
+
+{
+  *condition = NotForced;
+  return MeanFreePath(track);
 }
 
@@ -928,12 +806,8 @@
   if (length >= fRange) {
     eloss = preStepKinEnergy;
-    if (useDeexcitation) {
-      if(idxDERegions[currentMaterialIndex]) {
-	currentModel->SampleDeexcitationAlongStep(currentMaterial, track, eloss);
-	if(eloss < 0.0) eloss = 0.0;
-      }
-    }
+    currentModel->CorrectionsAlongStep(currentCouple, dynParticle, 
+				       eloss, esecdep, length);
     fParticleChange.SetProposedKineticEnergy(0.0);
-    fParticleChange.ProposeLocalEnergyDeposit(eloss);
+    fParticleChange.ProposeLocalEnergyDeposit(preStepKinEnergy);
     return &fParticleChange;
   }
@@ -1060,7 +934,6 @@
       G4double tmax = 
 	std::min(currentModel->MaxSecondaryKinEnergy(dynParticle),cut);
-      G4double emean = eloss;
       eloss = fluc->SampleFluctuations(currentMaterial,dynParticle,
-				       tmax,length,emean);
+				       tmax,length,eloss);
       /*                            
       if(-1 < verboseLevel) 
@@ -1077,12 +950,4 @@
   eloss += esecdep;
   if(eloss < 0.0) eloss = 0.0;
-
-  // deexcitation
-  else if (useDeexcitation) {
-    if(idxDERegions[currentMaterialIndex]) {
-      currentModel->SampleDeexcitationAlongStep(currentMaterial, track, eloss);
-      if(eloss < 0.0) eloss = 0.0;
-    }
-  }
 
   // Energy balanse
@@ -1241,8 +1106,4 @@
 
   SelectModel(postStepScaledEnergy);
-  if(useDeexcitation) {
-    currentModel->SetDeexcitationFlag(idxDERegions[currentMaterialIndex]);
-  }
-
   const G4DynamicParticle* dynParticle = track.GetDynamicParticle();
   G4double tcut = (*theCuts)[currentMaterialIndex];
@@ -1279,294 +1140,73 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
-G4bool G4VEnergyLossProcess::StorePhysicsTable(
-       const G4ParticleDefinition* part, const G4String& directory, 
-       G4bool ascii)
-{
-  G4bool res = true;
-  if ( baseParticle || part != particle ) return res;
-
-  if(!StoreTable(part,theDEDXTable,ascii,directory,"DEDX")) 
-    {res = false;}
-
-  if(!StoreTable(part,theDEDXunRestrictedTable,ascii,directory,"DEDXnr")) 
-    {res = false;}
-
-  if(!StoreTable(part,theDEDXSubTable,ascii,directory,"SubDEDX")) 
-    {res = false;}
-
-  if(!StoreTable(part,theIonisationTable,ascii,directory,"Ionisation")) 
-    {res = false;}
-
-  if(!StoreTable(part,theIonisationSubTable,ascii,directory,"SubIonisation")) 
-    {res = false;}
-
-  if(isIonisation &&
-     !StoreTable(part,theCSDARangeTable,ascii,directory,"CSDARange")) 
-    {res = false;}
-
-  if(isIonisation &&
-     !StoreTable(part,theRangeTableForLoss,ascii,directory,"Range")) 
-    {res = false;}
-  
-  if(isIonisation &&
-     !StoreTable(part,theInverseRangeTable,ascii,directory,"InverseRange")) 
-    {res = false;}
-  
-  if(!StoreTable(part,theLambdaTable,ascii,directory,"Lambda")) 
-    {res = false;}
-
-  if(!StoreTable(part,theSubLambdaTable,ascii,directory,"SubLambda")) 
-    {res = false;}
-
-  if ( res ) {
-    if(0 < verboseLevel) {
-      G4cout << "Physics tables are stored for " << particle->GetParticleName()
-             << " and process " << GetProcessName()
-	     << " in the directory <" << directory
-	     << "> " << G4endl;
-    }
-  } else {
-    G4cout << "Fail to store Physics Tables for " 
-	   << particle->GetParticleName()
-           << " and process " << GetProcessName()
-	   << " in the directory <" << directory
-	   << "> " << G4endl;
-  }
-  return res;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
-
-G4bool G4VEnergyLossProcess::RetrievePhysicsTable(
-       const G4ParticleDefinition* part, const G4String& directory,
-       G4bool ascii)
-{
-  G4bool res = true;
-  const G4String particleName = part->GetParticleName();
-
-  if(1 < verboseLevel) {
-    G4cout << "G4VEnergyLossProcess::RetrievePhysicsTable() for "
-           << particleName << " and process " << GetProcessName()
-           << "; tables_are_built= " << tablesAreBuilt
+void G4VEnergyLossProcess::PrintInfoDefinition()
+{
+  if(0 < verboseLevel) {
+    G4cout << G4endl << GetProcessName() << ":   for  "
+           << particle->GetParticleName()
+	   << "    SubType= " << GetProcessSubType() 
+           << G4endl
+           << "      dE/dx and range tables from "
+ 	   << G4BestUnit(minKinEnergy,"Energy")
+           << " to " << G4BestUnit(maxKinEnergy,"Energy")
+           << " in " << nBins << " bins" << G4endl
+           << "      Lambda tables from threshold to "
+           << G4BestUnit(maxKinEnergy,"Energy")
+           << " in " << nBins << " bins, spline: " 
+	   << (G4LossTableManager::Instance())->SplineFlag()
            << G4endl;
-  }
-  if(particle == part) {
-
-    //    G4bool yes = true;
-    if ( !baseParticle ) {
-
-      G4bool fpi = true;
-      if(!RetrieveTable(part,theDEDXTable,ascii,directory,"DEDX",fpi)) 
-	{fpi = false;}
-
-      if(!RetrieveTable(part,theIonisationTable,ascii,directory,"Ionisation",false)) 
-	{fpi = false;}
-
-      if(!RetrieveTable(part,theRangeTableForLoss,ascii,directory,"Range",fpi)) 
-        {res = false;}
-
-      if(!RetrieveTable(part,theDEDXunRestrictedTable,ascii,directory,"DEDXnr",false)) 
-	{res = false;}
-
-      if(!RetrieveTable(part,theCSDARangeTable,ascii,directory,"CSDARange",false)) 
-	{res = false;}
-
-      if(!RetrieveTable(part,theInverseRangeTable,ascii,directory,"InverseRange",fpi)) 
-        {res = false;}
-
-      if(!RetrieveTable(part,theLambdaTable,ascii,directory,"Lambda",true)) 
-        {res = false;}
-
-      G4bool yes = false;
-      if(nSCoffRegions > 0) {yes = true;}
-
-      if(!RetrieveTable(part,theDEDXSubTable,ascii,directory,"SubDEDX",yes)) 
-        {res = false;}
-
-      if(!RetrieveTable(part,theSubLambdaTable,ascii,directory,"SubLambda",yes)) 
-        {res = false;}
-
-      if(!fpi) yes = false;
-      if(!RetrieveTable(part,theIonisationSubTable,ascii,directory,"SubIonisation",yes)) 
-        {res = false;}
-    }
-  }
-
-  return res;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
-
-G4bool G4VEnergyLossProcess::StoreTable(const G4ParticleDefinition* part, 
-					G4PhysicsTable* aTable, G4bool ascii,
-					const G4String& directory,
-					const G4String& tname)
-{
-  G4bool res = true;
-  if ( aTable ) {
-    const G4String name = GetPhysicsTableFileName(part,directory,tname,ascii);
-    if( !aTable->StorePhysicsTable(name,ascii)) res = false;
-  }
-  return res;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
-
-G4bool G4VEnergyLossProcess::RetrieveTable(const G4ParticleDefinition* part, 
-					   G4PhysicsTable* aTable, G4bool ascii,
-					   const G4String& directory,
-					   const G4String& tname,
-					   G4bool mandatory)
-{
-  G4bool res = true;
-  G4String filename = GetPhysicsTableFileName(part,directory,tname,ascii);
-  G4bool yes = aTable->ExistPhysicsTable(filename);
-  if(yes) {
-    yes = G4PhysicsTableHelper::RetrievePhysicsTable(aTable,filename,ascii);
-    if((G4LossTableManager::Instance())->SplineFlag()) {
-      size_t n = aTable->length();
-      for(size_t i=0; i<n; i++) {(*aTable)[i]->SetSpline(true);}
-    }
-  }
-  if(yes) {
-    if (0 < verboseLevel) {
-      G4cout << tname << " table for " << part->GetParticleName() 
-	     << " is Retrieved from <" << filename << ">"
+    if(theRangeTableForLoss && isIonisation) {
+      G4cout << "      finalRange(mm)= " << finalRange/mm
+             << ", dRoverRange= " << dRoverRange
+             << ", integral: " << integral
+             << ", fluct: " << lossFluctuationFlag
+	     << ", linLossLimit= " << linLossLimit
+             << G4endl;
+    }
+    PrintInfo();
+    modelManager->DumpModelList(verboseLevel);
+    if(theCSDARangeTable && isIonisation) {
+      G4cout << "      CSDA range table up"
+             << " to " << G4BestUnit(maxKinEnergyCSDA,"Energy")
+             << " in " << nBinsCSDA << " bins" << G4endl;
+    }
+    if(nSCoffRegions>0 && isIonisation) {
+      G4cout << "      Subcutoff sampling in " << nSCoffRegions 
+	     << " regions" << G4endl;
+    }
+    if(2 < verboseLevel) {
+      G4cout << "      DEDXTable address= " << theDEDXTable << G4endl;
+      if(theDEDXTable && isIonisation) G4cout << (*theDEDXTable) << G4endl;
+      G4cout << "non restricted DEDXTable address= " 
+	     << theDEDXunRestrictedTable << G4endl;
+      if(theDEDXunRestrictedTable && isIonisation) {
+           G4cout << (*theDEDXunRestrictedTable) << G4endl;
+      }
+      if(theDEDXSubTable && isIonisation) {
+	G4cout << (*theDEDXSubTable) << G4endl;
+      }
+      G4cout << "      CSDARangeTable address= " << theCSDARangeTable 
 	     << G4endl;
-    }
-  } else {
-    if(mandatory) res = false;
-    if(mandatory || 1 < verboseLevel) {
-      G4cout << tname << " table for " << part->GetParticleName() 
-	     << " from file <"
-	     << filename << "> is not Retrieved"
+      if(theCSDARangeTable && isIonisation) {
+	G4cout << (*theCSDARangeTable) << G4endl;
+      }
+      G4cout << "      RangeTableForLoss address= " << theRangeTableForLoss 
 	     << G4endl;
-    }
-  }
-  return res;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-G4double G4VEnergyLossProcess::GetDEDXDispersion(
-                                  const G4MaterialCutsCouple *couple,
-                                  const G4DynamicParticle* dp,
-                                        G4double length)
-{
-  DefineMaterial(couple);
-  G4double ekin = dp->GetKineticEnergy();
-  SelectModel(ekin*massRatio);
-  G4double tmax = currentModel->MaxSecondaryKinEnergy(dp);
-  tmax = std::min(tmax,(*theCuts)[currentMaterialIndex]);
-  G4double d = 0.0;
-  G4VEmFluctuationModel* fm = currentModel->GetModelOfFluctuations();
-  if(fm) d = fm->Dispersion(currentMaterial,dp,tmax,length);
-  return d;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-G4double G4VEnergyLossProcess::CrossSectionPerVolume(
-	 G4double kineticEnergy, const G4MaterialCutsCouple* couple)
-{
-  // Cross section per volume is calculated
-  DefineMaterial(couple);
-  G4double cross = 0.0;
-  G4bool b;
-  if(theLambdaTable) {
-    cross = 
-      ((*theLambdaTable)[currentMaterialIndex])->GetValue(kineticEnergy, b);
-  } else {
-    SelectModel(kineticEnergy);
-    cross = 
-      currentModel->CrossSectionPerVolume(currentMaterial,
-					  particle, kineticEnergy,
-					  (*theCuts)[currentMaterialIndex]);
-  }
-
-  return cross;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-G4double G4VEnergyLossProcess::MeanFreePath(const G4Track& track)
-{
-  DefineMaterial(track.GetMaterialCutsCouple());
-  preStepLambda = GetLambdaForScaledEnergy(track.GetKineticEnergy()*massRatio);
-  G4double x = DBL_MAX;
-  if(DBL_MIN < preStepLambda) x = 1.0/preStepLambda;
-  return x;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-G4double G4VEnergyLossProcess::ContinuousStepLimit(const G4Track& track, 
-						   G4double x, G4double y, 
-						   G4double& z)
-{
-  G4GPILSelection sel;
-  return AlongStepGetPhysicalInteractionLength(track, x, y, z, &sel);
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-G4double G4VEnergyLossProcess::GetMeanFreePath(
-                             const G4Track& track,
-                             G4double,
-                             G4ForceCondition* condition)
-
-{
-  *condition = NotForced;
-  return MeanFreePath(track);
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-G4double G4VEnergyLossProcess::GetContinuousStepLimit(
-		const G4Track&,
-                G4double, G4double, G4double&)
-{
-  return DBL_MAX;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-G4PhysicsVector* G4VEnergyLossProcess::LambdaPhysicsVector(
-                 const G4MaterialCutsCouple* couple, G4double cut)
-{
-  //  G4double cut  = (*theCuts)[couple->GetIndex()];
-  //  G4int nbins = nLambdaBins;
-  G4double tmin = 
-    std::max(MinPrimaryEnergy(particle, couple->GetMaterial(), cut),
-	     minKinEnergy);
-  if(tmin >= maxKinEnergy) tmin = 0.5*maxKinEnergy;
-  G4PhysicsVector* v = new G4PhysicsLogVector(tmin, maxKinEnergy, nBins);
-  v->SetSpline((G4LossTableManager::Instance())->SplineFlag());
-
-  return v;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-  
-void G4VEnergyLossProcess::AddCollaborativeProcess(
-            G4VEnergyLossProcess* p)
-{
-  G4bool add = true;
-  if(p->GetProcessName() != "eBrem") add = false;
-  if(add && nProcesses > 0) {
-    for(G4int i=0; i<nProcesses; i++) {
-      if(p == scProcesses[i]) {
-        add = false;
-        break;
-      }
-    }
-  }
-  if(add) {
-    scProcesses.push_back(p);
-    nProcesses++;
-    if (1 < verboseLevel) { 
-      G4cout << "### The process " << p->GetProcessName() 
-	     << " is added to the list of collaborative processes of "
-	     << GetProcessName() << G4endl; 
+      if(theRangeTableForLoss && isIonisation) {
+             G4cout << (*theRangeTableForLoss) << G4endl;
+      }
+      G4cout << "      InverseRangeTable address= " << theInverseRangeTable 
+	     << G4endl;
+      if(theInverseRangeTable && isIonisation) {
+             G4cout << (*theInverseRangeTable) << G4endl;
+      }
+      G4cout << "      LambdaTable address= " << theLambdaTable << G4endl;
+      if(theLambdaTable && isIonisation) {
+	G4cout << (*theLambdaTable) << G4endl;
+      }
+      G4cout << "      SubLambdaTable address= " << theSubLambdaTable << G4endl;
+      if(theSubLambdaTable && isIonisation) {
+	G4cout << (*theSubLambdaTable) << G4endl;
+      }
     }
   }
@@ -1737,2 +1377,261 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
+G4PhysicsVector* G4VEnergyLossProcess::LambdaPhysicsVector(
+                 const G4MaterialCutsCouple* couple, G4double cut)
+{
+  //  G4double cut  = (*theCuts)[couple->GetIndex()];
+  //  G4int nbins = nLambdaBins;
+  G4double tmin = 
+    std::max(MinPrimaryEnergy(particle, couple->GetMaterial(), cut),
+	     minKinEnergy);
+  if(tmin >= maxKinEnergy) tmin = 0.5*maxKinEnergy;
+  G4PhysicsVector* v = new G4PhysicsLogVector(tmin, maxKinEnergy, nBins);
+  v->SetSpline((G4LossTableManager::Instance())->SplineFlag());
+
+  return v;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+G4double G4VEnergyLossProcess::CrossSectionPerVolume(
+	 G4double kineticEnergy, const G4MaterialCutsCouple* couple)
+{
+  // Cross section per volume is calculated
+  DefineMaterial(couple);
+  G4double cross = 0.0;
+  G4bool b;
+  if(theLambdaTable) {
+    cross = 
+      ((*theLambdaTable)[currentMaterialIndex])->GetValue(kineticEnergy, b);
+  } else {
+    SelectModel(kineticEnergy);
+    cross = 
+      currentModel->CrossSectionPerVolume(currentMaterial,
+					  particle, kineticEnergy,
+					  (*theCuts)[currentMaterialIndex]);
+  }
+
+  return cross;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+G4bool G4VEnergyLossProcess::StorePhysicsTable(
+       const G4ParticleDefinition* part, const G4String& directory, 
+       G4bool ascii)
+{
+  G4bool res = true;
+  if ( baseParticle || part != particle ) return res;
+
+  if(!StoreTable(part,theDEDXTable,ascii,directory,"DEDX")) 
+    {res = false;}
+
+  if(!StoreTable(part,theDEDXunRestrictedTable,ascii,directory,"DEDXnr")) 
+    {res = false;}
+
+  if(!StoreTable(part,theDEDXSubTable,ascii,directory,"SubDEDX")) 
+    {res = false;}
+
+  if(!StoreTable(part,theIonisationTable,ascii,directory,"Ionisation")) 
+    {res = false;}
+
+  if(!StoreTable(part,theIonisationSubTable,ascii,directory,"SubIonisation")) 
+    {res = false;}
+
+  if(isIonisation &&
+     !StoreTable(part,theCSDARangeTable,ascii,directory,"CSDARange")) 
+    {res = false;}
+
+  if(isIonisation &&
+     !StoreTable(part,theRangeTableForLoss,ascii,directory,"Range")) 
+    {res = false;}
+  
+  if(isIonisation &&
+     !StoreTable(part,theInverseRangeTable,ascii,directory,"InverseRange")) 
+    {res = false;}
+  
+  if(!StoreTable(part,theLambdaTable,ascii,directory,"Lambda")) 
+    {res = false;}
+
+  if(!StoreTable(part,theSubLambdaTable,ascii,directory,"SubLambda")) 
+    {res = false;}
+
+  if ( res ) {
+    if(0 < verboseLevel) {
+      G4cout << "Physics tables are stored for " << particle->GetParticleName()
+             << " and process " << GetProcessName()
+	     << " in the directory <" << directory
+	     << "> " << G4endl;
+    }
+  } else {
+    G4cout << "Fail to store Physics Tables for " 
+	   << particle->GetParticleName()
+           << " and process " << GetProcessName()
+	   << " in the directory <" << directory
+	   << "> " << G4endl;
+  }
+  return res;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
+
+G4bool G4VEnergyLossProcess::StoreTable(const G4ParticleDefinition* part, 
+					G4PhysicsTable* aTable, G4bool ascii,
+					const G4String& directory,
+					const G4String& tname)
+{
+  G4bool res = true;
+  if ( aTable ) {
+    const G4String name = GetPhysicsTableFileName(part,directory,tname,ascii);
+    if( !aTable->StorePhysicsTable(name,ascii)) res = false;
+  }
+  return res;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
+
+G4bool G4VEnergyLossProcess::RetrievePhysicsTable(
+       const G4ParticleDefinition* part, const G4String& directory,
+       G4bool ascii)
+{
+  G4bool res = true;
+  const G4String particleName = part->GetParticleName();
+
+  if(1 < verboseLevel) {
+    G4cout << "G4VEnergyLossProcess::RetrievePhysicsTable() for "
+           << particleName << " and process " << GetProcessName()
+           << "; tables_are_built= " << tablesAreBuilt
+           << G4endl;
+  }
+  if(particle == part) {
+
+    //    G4bool yes = true;
+    if ( !baseParticle ) {
+
+      G4bool fpi = true;
+      if(!RetrieveTable(part,theDEDXTable,ascii,directory,"DEDX",fpi)) 
+	{fpi = false;}
+
+      if(!RetrieveTable(part,theIonisationTable,ascii,directory,"Ionisation",false)) 
+	{fpi = false;}
+
+      if(!RetrieveTable(part,theRangeTableForLoss,ascii,directory,"Range",fpi)) 
+        {res = false;}
+
+      if(!RetrieveTable(part,theDEDXunRestrictedTable,ascii,directory,"DEDXnr",false)) 
+	{res = false;}
+
+      if(!RetrieveTable(part,theCSDARangeTable,ascii,directory,"CSDARange",false)) 
+	{res = false;}
+
+      if(!RetrieveTable(part,theInverseRangeTable,ascii,directory,"InverseRange",fpi)) 
+        {res = false;}
+
+      if(!RetrieveTable(part,theLambdaTable,ascii,directory,"Lambda",true)) 
+        {res = false;}
+
+      G4bool yes = false;
+      if(nSCoffRegions > 0) {yes = true;}
+
+      if(!RetrieveTable(part,theDEDXSubTable,ascii,directory,"SubDEDX",yes)) 
+        {res = false;}
+
+      if(!RetrieveTable(part,theSubLambdaTable,ascii,directory,"SubLambda",yes)) 
+        {res = false;}
+
+      if(!fpi) yes = false;
+      if(!RetrieveTable(part,theIonisationSubTable,ascii,directory,"SubIonisation",yes)) 
+        {res = false;}
+    }
+  }
+
+  return res;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
+
+G4bool G4VEnergyLossProcess::RetrieveTable(const G4ParticleDefinition* part, 
+					   G4PhysicsTable* aTable, G4bool ascii,
+					   const G4String& directory,
+					   const G4String& tname,
+					   G4bool mandatory)
+{
+  G4bool res = true;
+  G4String filename = GetPhysicsTableFileName(part,directory,tname,ascii);
+  G4bool yes = aTable->ExistPhysicsTable(filename);
+  if(yes) {
+    yes = G4PhysicsTableHelper::RetrievePhysicsTable(aTable,filename,ascii);
+    if((G4LossTableManager::Instance())->SplineFlag()) {
+      size_t n = aTable->length();
+      for(size_t i=0; i<n; i++) {(*aTable)[i]->SetSpline(true);}
+    }
+  }
+  if(yes) {
+    if (0 < verboseLevel) {
+      G4cout << tname << " table for " << part->GetParticleName() 
+	     << " is Retrieved from <" << filename << ">"
+	     << G4endl;
+    }
+  } else {
+    if(mandatory) res = false;
+    if(mandatory || 1 < verboseLevel) {
+      G4cout << tname << " table for " << part->GetParticleName() 
+	     << " from file <"
+	     << filename << "> is not Retrieved"
+	     << G4endl;
+    }
+  }
+  return res;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+  
+void G4VEnergyLossProcess::AddCollaborativeProcess(
+            G4VEnergyLossProcess* p)
+{
+  G4bool add = true;
+  if(p->GetProcessName() != "eBrem") add = false;
+  if(add && nProcesses > 0) {
+    for(G4int i=0; i<nProcesses; i++) {
+      if(p == scProcesses[i]) {
+        add = false;
+        break;
+      }
+    }
+  }
+  if(add) {
+    scProcesses.push_back(p);
+    nProcesses++;
+    if (1 < verboseLevel) { 
+      G4cout << "### The process " << p->GetProcessName() 
+	     << " is added to the list of collaborative processes of "
+	     << GetProcessName() << G4endl; 
+    }
+  }
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+G4double G4VEnergyLossProcess::GetDEDXDispersion(
+                                  const G4MaterialCutsCouple *couple,
+                                  const G4DynamicParticle* dp,
+                                        G4double length)
+{
+  DefineMaterial(couple);
+  G4double ekin = dp->GetKineticEnergy();
+  SelectModel(ekin*massRatio);
+  G4double tmax = currentModel->MaxSecondaryKinEnergy(dp);
+  tmax = std::min(tmax,(*theCuts)[currentMaterialIndex]);
+  G4double d = 0.0;
+  G4VEmFluctuationModel* fm = currentModel->GetModelOfFluctuations();
+  if(fm) d = fm->Dispersion(currentMaterial,dp,tmax,length);
+  return d;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+void G4VEnergyLossProcess::ActivateDeexcitation(G4bool, const G4Region*)
+{}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
Index: trunk/source/processes/electromagnetic/utils/src/G4VMscModel.cc
===================================================================
--- trunk/source/processes/electromagnetic/utils/src/G4VMscModel.cc	(revision 968)
+++ trunk/source/processes/electromagnetic/utils/src/G4VMscModel.cc	(revision 991)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4VMscModel.cc,v 1.10 2009/02/24 09:56:03 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02-ref-02 $
+// $Id: G4VMscModel.cc,v 1.4 2008/03/10 18:39:45 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02 $
 //
 // -------------------------------------------------------------------
@@ -49,6 +49,4 @@
 
 #include "G4VMscModel.hh"
-#include "G4ParticleChangeForMSC.hh"
-#include "G4TransportationManager.hh"
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -57,5 +55,4 @@
 G4VMscModel::G4VMscModel(const G4String& nam):
   G4VEmModel(nam), 
-  safetyHelper(0),
   facrange(0.02),
   facgeom(2.5),
@@ -64,5 +61,4 @@
   dtrl(0.05),
   lambdalimit(mm),
-  geommax(1.e50*mm),
   steppingAlgorithm(fUseSafety),
   samplez(false),
@@ -76,61 +72,2 @@
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
-
-void G4VMscModel::InitialiseSafetyHelper()
-{
-  if(!safetyHelper) {
-    safetyHelper = G4TransportationManager::GetTransportationManager()
-      ->GetSafetyHelper();
-    safetyHelper->InitialiseHelper();
-  }
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
-
-void G4VMscModel::ComputeDisplacement(G4ParticleChangeForMSC* fParticleChange,  
-				      const G4ThreeVector& dir,
-				      G4double displacement,
-				      G4double postsafety)
-{
-  const G4ThreeVector* pos = fParticleChange->GetProposedPosition();
-  G4double r = displacement;
-  if(r >  postsafety) {
-    G4double newsafety = safetyHelper->ComputeSafety(*pos);
-    if(r > newsafety) r = newsafety;
-  }
-  if(r > 0.) {
-
-    // compute new endpoint of the Step
-    G4ThreeVector newPosition = *pos + r*dir;
-
-    // definitely not on boundary
-    if(displacement == r) {
-      safetyHelper->ReLocateWithinVolume(newPosition);
-
-    } else {
-      // check safety after displacement
-      G4double postsafety = safetyHelper->ComputeSafety(newPosition);
-
-      // displacement to boundary
-      if(postsafety <= 0.0) {
-	safetyHelper->Locate(newPosition, 
-			     *fParticleChange->GetProposedMomentumDirection());
-
-	// not on the boundary
-      } else {
-	safetyHelper->ReLocateWithinVolume(newPosition);
-      }
-    }
-    fParticleChange->ProposePosition(newPosition);
-  }
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
-
-void G4VMscModel::SampleSecondaries(std::vector<G4DynamicParticle*>*,
-				    const G4MaterialCutsCouple*,
-				    const G4DynamicParticle*,
-				    G4double, G4double)
-{}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
