Index: trunk/source/processes/electromagnetic/standard/History
===================================================================
--- trunk/source/processes/electromagnetic/standard/History	(revision 1337)
+++ trunk/source/processes/electromagnetic/standard/History	(revision 1340)
@@ -1,3 +1,3 @@
-$Id: History,v 1.504 2010/06/04 09:25:12 vnivanch Exp $
+$Id: History,v 1.514 2010/11/04 17:31:43 vnivanch Exp $
 -------------------------------------------------------------------
 
@@ -17,4 +17,43 @@
      * Reverse chronological order (last date on top), please *
      ----------------------------------------------------------
+
+04 November 2010: V.Ivant (emstand-V09-03-25)
+- Fixed warnings of the Coverity tool (pedantic initialisation);
+
+26 October 2010: V.Ivant (emstand-V09-03-24)
+- Fixed problem reported by the Coverity tool (mainly pedantic 
+  initialisation);
+- G4BetheHeitlerModel, G4PairProductionRelModel - removed unused 
+  internal table of cross section
+- G4WaterStopping - fixed bug in index of data for Fe ion
+
+14 October 2010: V.Ivant (emstand-V09-03-23)
+- G4ModifiedTsai - added (moved from lowenergy)
+- G4PairProductionRelModel, G4eBremsstrahlungRelModel - return back 
+     the version of 9.4beta (disable tag 21); use general interface
+     to sample polar angular distribution (G4ModifiedTsai - default)
+
+28 September 2010: V.Ivant (emstand-V09-03-22)
+- G4ionIonisation, G4alphaIonisation - removed obsolete nuclear stopping 
+      flag and Get/Set methods (nuclear stopping is simulated by the
+      dedicated G4NuclearStopping process)
+
+12 September 2010: V.Ivant (emstand-V09-03-21)
+- G4BetheBlochModel - fixed shell corrections
+- G4PairProductionRelModel, G4eBremsstrahlungRelModel - fixed 
+     SetCurrentElement method, fix is important for unit tests
+
+12 August 2010: V.Ivant (emstand-V09-03-20)
+- G4UniversalFluctuation - L.Urban revision of width correction 
+  providing better results for thin targets and a good tail  
+
+14 June 2010:  V.Ivant (emstand-V09-03-19)
+- G4UniversalFluctuation93 new class keeping version of the release 9.3
+  for the G4UniversalFluctuation
+- G4UniversalFluctuation - improved comments
+
+11 June 2010:  V.Ivant (emstand-V09-03-18)
+- G4UniversalFluctuation - L.Urban fixed anomaly at the tail of 
+                           distribution for thin targets
 
 4 June 2010:  V.Ivant (emstand-V09-03-17)
Index: trunk/source/processes/electromagnetic/standard/include/G4BetheHeitlerModel.hh
===================================================================
--- trunk/source/processes/electromagnetic/standard/include/G4BetheHeitlerModel.hh	(revision 1337)
+++ trunk/source/processes/electromagnetic/standard/include/G4BetheHeitlerModel.hh	(revision 1340)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4BetheHeitlerModel.hh,v 1.6 2007/05/22 17:34:36 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-04-beta-01 $
+// $Id: G4BetheHeitlerModel.hh,v 1.9 2010/10/26 10:35:22 vnivanch Exp $
+// GEANT4 tag $Name: emstand-V09-03-24 $
 //
 // -------------------------------------------------------------------
@@ -63,5 +63,5 @@
 
   G4BetheHeitlerModel(const G4ParticleDefinition* p = 0, 
-		      const G4String& nam = "Bethe-Heitler");
+		      const G4String& nam = "BetheHeitler");
  
   virtual ~G4BetheHeitlerModel();
@@ -97,12 +97,4 @@
   G4ParticleDefinition*     thePositron;
   G4ParticleChangeForGamma* fParticleChange;
-  G4PhysicsTable*           theCrossSectionTable; 
-
-  G4double                  lowGammaEnergy;
-  G4double                  highGammaEnergy;
-
-  G4int                     nbins;
-  size_t                    indexZ[120];
-  
 };
 
Index: trunk/source/processes/electromagnetic/standard/include/G4CoulombScattering.hh
===================================================================
--- trunk/source/processes/electromagnetic/standard/include/G4CoulombScattering.hh	(revision 1337)
+++ trunk/source/processes/electromagnetic/standard/include/G4CoulombScattering.hh	(revision 1340)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4CoulombScattering.hh,v 1.14 2010/02/17 18:59:22 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-04-beta-01 $
+// $Id: G4CoulombScattering.hh,v 1.15 2010/10/25 19:13:23 vnivanch Exp $
+// GEANT4 tag $Name: emstand-V09-03-24 $
 //
 // -------------------------------------------------------------------
@@ -93,5 +93,4 @@
   G4double thEnergyElec;
   G4bool isInitialised;
-  G4bool buildElmTableFlag;
   const G4ParticleDefinition* aParticle;
 
Index: trunk/source/processes/electromagnetic/standard/include/G4PAIySection.hh
===================================================================
--- trunk/source/processes/electromagnetic/standard/include/G4PAIySection.hh	(revision 1337)
+++ trunk/source/processes/electromagnetic/standard/include/G4PAIySection.hh	(revision 1340)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4PAIySection.hh,v 1.1 2007/10/01 17:45:14 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-04-beta-01 $
+// $Id: G4PAIySection.hh,v 1.2 2010/11/04 17:30:31 vnivanch Exp $
+// GEANT4 tag $Name: emstand-V09-03-25 $
 //
 // 
@@ -110,25 +110,25 @@
   // Inline access functions
 
-  G4int GetNumberOfGammas() const { return fNumberOfGammas ; }
-	  
-  G4int GetSplineSize() const { return fSplineNumber ; }
-	  
-  G4int GetIntervalNumber() const { return fIntervalNumber ; }
-
-  G4double GetEnergyInterval(G4int i){ return fEnergyInterval[i] ; } 
-
-  G4double GetDifPAIySection(G4int i){ return fDifPAIySection[i] ; } 
-  G4double GetPAIdNdxCrenkov(G4int i){ return fdNdxCerenkov[i] ; } 
-  G4double GetPAIdNdxPlasmon(G4int i){ return fdNdxPlasmon[i] ; } 
-	  
-  G4double GetMeanEnergyLoss() const {return fIntegralPAIySection[0] ; }
-  G4double GetMeanCerenkovLoss() const {return fIntegralCerenkov[0] ; }
-  G4double GetMeanPlasmonLoss() const {return fIntegralPlasmon[0] ; }
-
-  G4double GetNormalizationCof() const { return fNormalizationCof ; }
+  inline G4int GetNumberOfGammas() const { return fNumberOfGammas ; }
+	  
+  inline G4int GetSplineSize() const { return fSplineNumber ; }
+	  
+  inline G4int GetIntervalNumber() const { return fIntervalNumber ; }
+
+  inline G4double GetEnergyInterval(G4int i){ return fEnergyInterval[i] ; } 
+
+  inline G4double GetDifPAIySection(G4int i){ return fDifPAIySection[i] ; } 
+  inline G4double GetPAIdNdxCrenkov(G4int i){ return fdNdxCerenkov[i] ; } 
+  inline G4double GetPAIdNdxPlasmon(G4int i){ return fdNdxPlasmon[i] ; } 
+	  
+  inline G4double GetMeanEnergyLoss() const {return fIntegralPAIySection[0] ; }
+  inline G4double GetMeanCerenkovLoss() const {return fIntegralCerenkov[0] ; }
+  inline G4double GetMeanPlasmonLoss() const {return fIntegralPlasmon[0] ; }
+
+  inline G4double GetNormalizationCof() const { return fNormalizationCof ; }
           
   inline G4double GetPAItable(G4int i,G4int j) const ;
 
-  inline G4double    GetLorentzFactor(G4int i) const ;
+  inline G4double GetLorentzFactor(G4int i) const ;
 	  	  
   inline G4double GetSplineEnergy(G4int i) const ;
@@ -185,5 +185,5 @@
   G4double   fPAItable[500][112] ;         // Output array
 
-} ;    
+};
 
 ////////////////  Inline methods //////////////////////////////////
Index: trunk/source/processes/electromagnetic/standard/include/G4PairProductionRelModel.hh
===================================================================
--- trunk/source/processes/electromagnetic/standard/include/G4PairProductionRelModel.hh	(revision 1337)
+++ trunk/source/processes/electromagnetic/standard/include/G4PairProductionRelModel.hh	(revision 1340)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4PairProductionRelModel.hh,v 1.3 2009/06/04 13:45:53 gunter Exp $
-// GEANT4 tag $Name: geant4-09-04-beta-01 $
+// $Id: G4PairProductionRelModel.hh,v 1.9 2010/10/26 10:35:22 vnivanch Exp $
+// GEANT4 tag $Name: emstand-V09-03-24 $
 //
 // -------------------------------------------------------------------
@@ -64,5 +64,5 @@
 
   G4PairProductionRelModel(const G4ParticleDefinition* p = 0, 
-		      const G4String& nam = "Bethe-Heitler");
+			   const G4String& nam = "BetheHeitlerLPM");
  
   virtual ~G4PairProductionRelModel();
@@ -88,5 +88,5 @@
 
   // * fast inline functions *
-  inline void SetCurrentElement(const G4double);
+  inline void SetCurrentElement(G4double /*Z*/);
 
   // set / get methods
@@ -110,7 +110,4 @@
   G4double ScreenFunction2(G4double ScreenVariable);
 
-
-
-
   G4double ComputeXSectionPerAtom(G4double totalEnergy, G4double Z);
 
@@ -128,11 +125,4 @@
   G4ParticleDefinition*     thePositron;
   G4ParticleChangeForGamma* fParticleChange;
-  G4PhysicsTable*           theCrossSectionTable; 
-
-  G4double                  lowGammaEnergy;
-  G4double                  highGammaEnergy;
-
-  G4int                     nbins;
-  size_t                    indexZ[120];
 
   G4double fLPMconstant;
@@ -196,5 +186,5 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 
-inline void G4PairProductionRelModel::SetCurrentElement(const G4double Z)
+inline void G4PairProductionRelModel::SetCurrentElement(G4double Z)
 {
   if(Z != currentZ) {
@@ -214,8 +204,8 @@
       Finel = facFinel - 2.*lnZ/3. ;
     }
-
     fCoulomb=GetCurrentElement()->GetfCoulomb();
   }
 }
+
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
Index: trunk/source/processes/electromagnetic/standard/include/G4UniversalFluctuation.hh
===================================================================
--- trunk/source/processes/electromagnetic/standard/include/G4UniversalFluctuation.hh	(revision 1337)
+++ trunk/source/processes/electromagnetic/standard/include/G4UniversalFluctuation.hh	(revision 1340)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4UniversalFluctuation.hh,v 1.10 2009/03/19 14:15:17 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-04-beta-01 $
+// $Id: G4UniversalFluctuation.hh,v 1.12 2010/08/08 08:19:59 urban Exp $
+// GEANT4 tag $Name: emstand-V09-03-24 $
 //
 // -------------------------------------------------------------------
@@ -34,5 +34,5 @@
 // File name:     G4UniversalFluctuation
 //
-// Author:        Vladimir Ivanchenko
+// Author:        V.Ivanchenko make a class with the Laszlo Urban model
 //
 // Creation date: 03.01.2002
@@ -110,4 +110,5 @@
   G4double ipotLogFluct;
   G4double e0;
+  G4double esmall;
 
   G4double e1,e2;
@@ -116,6 +117,7 @@
   G4double theBohrBeta2;
   G4double minLoss;
-  G4double nmaxCont1;
-  G4double nmaxCont2;
+  G4double nmaxCont;
+  G4double rate,fw;
+
 
 };
Index: trunk/source/processes/electromagnetic/standard/include/G4alphaIonisation.hh
===================================================================
--- trunk/source/processes/electromagnetic/standard/include/G4alphaIonisation.hh	(revision 1337)
+++ trunk/source/processes/electromagnetic/standard/include/G4alphaIonisation.hh	(revision 1340)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4alphaIonisation.hh,v 1.1 2009/11/10 11:50:30 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-04-beta-01 $
+// $Id: G4alphaIonisation.hh,v 1.3 2010/10/26 10:06:12 vnivanch Exp $
+// GEANT4 tag $Name: emstand-V09-03-24 $
 //
 // -------------------------------------------------------------------
@@ -71,6 +71,4 @@
   virtual void PrintInfo();
 
-  void ActivateNuclearStopping(G4bool);
-
 protected:
 
@@ -82,6 +80,4 @@
 
   inline G4double BetheBlochEnergyThreshold();
-
-  inline G4bool NuclearStoppingFlag();
 
 private:
@@ -98,15 +94,7 @@
 
   G4bool     isInitialised;
-  G4bool     nuclearStopping;
 };
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline void G4alphaIonisation::ActivateNuclearStopping(G4bool val)
-{
-  nuclearStopping = val;
-}
-
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
@@ -118,10 +106,3 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
-inline G4bool G4alphaIonisation::NuclearStoppingFlag()
-{
-  return nuclearStopping;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
 #endif
Index: trunk/source/processes/electromagnetic/standard/include/G4eBremsstrahlungRelModel.hh
===================================================================
--- trunk/source/processes/electromagnetic/standard/include/G4eBremsstrahlungRelModel.hh	(revision 1337)
+++ trunk/source/processes/electromagnetic/standard/include/G4eBremsstrahlungRelModel.hh	(revision 1340)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4eBremsstrahlungRelModel.hh,v 1.11 2009/02/20 12:06:37 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-04-beta-01 $
+// $Id: G4eBremsstrahlungRelModel.hh,v 1.14 2010/10/26 10:35:22 vnivanch Exp $
+// GEANT4 tag $Name: emstand-V09-03-24 $
 //
 // -------------------------------------------------------------------
@@ -65,5 +65,5 @@
 
   G4eBremsstrahlungRelModel(const G4ParticleDefinition* p = 0, 
-			    const G4String& nam = "eBremRel");
+			    const G4String& nam = "eBremLPM");
 
   virtual ~G4eBremsstrahlungRelModel();
@@ -159,6 +159,6 @@
 
 private:
+
   // consts
-  G4double highKinEnergy;
   G4double lowKinEnergy;
   G4double fMigdalConstant;
@@ -195,6 +195,6 @@
     }
 
-    fCoulomb=GetCurrentElement()->GetfCoulomb();
-    fMax   =  Fel-fCoulomb + Finel/currentZ  +  (1.+1./currentZ)/12.;
+    fCoulomb = GetCurrentElement()->GetfCoulomb();
+    fMax = Fel-fCoulomb + Finel/currentZ  +  (1.+1./currentZ)/12.;
   }
 }
Index: trunk/source/processes/electromagnetic/standard/include/G4eMultipleScattering.hh
===================================================================
--- trunk/source/processes/electromagnetic/standard/include/G4eMultipleScattering.hh	(revision 1337)
+++ trunk/source/processes/electromagnetic/standard/include/G4eMultipleScattering.hh	(revision 1340)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4eMultipleScattering.hh,v 1.3 2009/11/01 13:04:12 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-04-beta-01 $
+// $Id: G4eMultipleScattering.hh,v 1.4 2010/10/26 10:39:02 vnivanch Exp $
+// GEANT4 tag $Name: emstand-V09-03-24 $
 //
 // -----------------------------------------------------------------------------
@@ -64,5 +64,5 @@
 public:    // with description
 
-  G4eMultipleScattering(const G4String& processName="msc");
+  G4eMultipleScattering(const G4String& processName = "msc");
 
   virtual ~G4eMultipleScattering();
@@ -75,11 +75,11 @@
 
   // geom. step length distribution should be sampled or not
-  void Setsamplez(G4bool value) { samplez = value;};
+  //void Setsamplez(G4bool value) { samplez = value;};
 
   // to reduce the energy/step dependence
-  void Setdtrl(G4double value) { dtrl = value;};
+  //void Setdtrl(G4double value) { dtrl = value;};
 
   // 'soften' step limitation above lambdalimit
-  void SetLambdalimit(G4double value) { lambdalimit = value;};
+  //void SetLambdalimit(G4double value) { lambdalimit = value;};
 
 protected:
@@ -90,8 +90,8 @@
 private:        // data members
 
-  G4double lambdalimit;
-  G4double dtrl;
+  //  G4double lambdalimit;
+  //G4double dtrl;
 
-  G4bool   samplez;
+  //G4bool   samplez;
   G4bool   isInitialized;
 
Index: trunk/source/processes/electromagnetic/standard/include/G4ionIonisation.hh
===================================================================
--- trunk/source/processes/electromagnetic/standard/include/G4ionIonisation.hh	(revision 1337)
+++ trunk/source/processes/electromagnetic/standard/include/G4ionIonisation.hh	(revision 1340)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4ionIonisation.hh,v 1.57 2009/02/20 12:06:37 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-04-beta-01 $
+// $Id: G4ionIonisation.hh,v 1.58 2010/09/28 15:50:00 vnivanch Exp $
+// GEANT4 tag $Name: emstand-V09-03-24 $
 //
 // -------------------------------------------------------------------
@@ -95,6 +95,4 @@
   void ActivateStoppingData(G4bool);
 
-  void ActivateNuclearStopping(G4bool);
-
 protected:
 
@@ -106,6 +104,4 @@
 
   inline G4double BetheBlochEnergyThreshold();
-
-  inline G4bool NuclearStoppingFlag();
 
 private:
@@ -123,5 +119,4 @@
   G4bool     isInitialised;
   G4bool     stopDataActive;
-  G4bool     nuclearStopping;
 };
 
@@ -136,11 +131,4 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
-inline void G4ionIonisation::ActivateNuclearStopping(G4bool val)
-{
-  nuclearStopping = val;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
 inline G4double G4ionIonisation::BetheBlochEnergyThreshold()
 {
@@ -150,10 +138,3 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
-inline G4bool G4ionIonisation::NuclearStoppingFlag()
-{
-  return nuclearStopping;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
 #endif
Index: trunk/source/processes/electromagnetic/standard/src/G4BetheBlochModel.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4BetheBlochModel.cc	(revision 1337)
+++ trunk/source/processes/electromagnetic/standard/src/G4BetheBlochModel.cc	(revision 1340)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4BetheBlochModel.cc,v 1.37 2010/05/27 10:25:59 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-04-beta-01 $
+// $Id: G4BetheBlochModel.cc,v 1.40 2010/11/04 17:30:31 vnivanch Exp $
+// GEANT4 tag $Name: emstand-V09-03-25 $
 //
 // -------------------------------------------------------------------
@@ -82,9 +82,11 @@
 {
   fParticleChange = 0;
+  theElectron = G4Electron::Electron();
   if(p) {
     SetGenericIon(p);
     SetParticle(p);
-  }
-  theElectron = G4Electron::Electron();
+  } else {
+    SetParticle(theElectron);
+  }
   corr = G4LossTableManager::Instance()->EmCorrections();  
   nist = G4NistManager::Instance();
@@ -117,5 +119,4 @@
   //	 << G4endl;
 
-  corrFactor = chargeSquare;
   // always false before the run
   SetDeexcitationFlag(false);
@@ -157,4 +158,5 @@
   G4double q = particle->GetPDGCharge()/eplus;
   chargeSquare = q*q;
+  corrFactor = chargeSquare;
   ratio = electron_mass_c2/mass;
   G4double magmom = 
@@ -275,10 +277,8 @@
 
   // shell correction
-  dedx -= 2.0*corr->ShellCorrection(p,material,kineticEnergy);
+  //dedx -= 2.0*corr->ShellCorrection(p,material,kineticEnergy);
+  dedx -= corr->ShellCorrection(p,material,kineticEnergy);
 
   // now compute the total ionization loss
-
-  if (dedx < 0.0) dedx = 0.0 ;
-
   dedx *= twopi_mc2_rcl2*chargeSquare*eDensity/beta2;
 
@@ -289,4 +289,6 @@
     dedx += corr->HighOrderCorrections(p,material,kineticEnergy,cutEnergy);
   }
+
+  if (dedx < 0.0) { dedx = 0.0; }
   return dedx;
 }
Index: trunk/source/processes/electromagnetic/standard/src/G4BetheHeitlerModel.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4BetheHeitlerModel.cc	(revision 1337)
+++ trunk/source/processes/electromagnetic/standard/src/G4BetheHeitlerModel.cc	(revision 1340)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4BetheHeitlerModel.cc,v 1.13 2009/04/09 18:41:18 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-04-beta-01 $
+// $Id: G4BetheHeitlerModel.cc,v 1.15 2010/10/25 19:02:32 vnivanch Exp $
+// GEANT4 tag $Name: emstand-V09-03-24 $
 //
 // -------------------------------------------------------------------
@@ -43,6 +43,7 @@
 // 16-11-05 replace shootBit() by G4UniformRand()  mma
 // 04-12-05 SetProposedKineticEnergy(0.) for the killed photon (mma)
-// 20-02-20 SelectRandomElement is called for any initial gamma energy 
+// 20-02-07 SelectRandomElement is called for any initial gamma energy 
 //          in order to have selected element for polarized model (VI)
+// 25-10-10 Removed unused table, added element selector (VI) 
 //
 // Class Description:
@@ -58,8 +59,5 @@
 #include "G4Gamma.hh"
 #include "Randomize.hh"
-#include "G4DataVector.hh"
-#include "G4PhysicsLogVector.hh"
 #include "G4ParticleChangeForGamma.hh"
-#include "G4LossTableManager.hh"
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -69,7 +67,5 @@
 G4BetheHeitlerModel::G4BetheHeitlerModel(const G4ParticleDefinition*,
 					 const G4String& nam)
-  : G4VEmModel(nam),
-    theCrossSectionTable(0),
-    nbins(10)
+  : G4VEmModel(nam)
 {
   fParticleChange = 0;
@@ -82,57 +78,21 @@
 
 G4BetheHeitlerModel::~G4BetheHeitlerModel()
-{
-  if(theCrossSectionTable) {
-    theCrossSectionTable->clearAndDestroy();
-    delete theCrossSectionTable;
-  }
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-void G4BetheHeitlerModel::Initialise(const G4ParticleDefinition*,
-				     const G4DataVector&)
-{
-  if(!fParticleChange) fParticleChange = GetParticleChangeForGamma();
-
-  if(theCrossSectionTable) {
-    theCrossSectionTable->clearAndDestroy();
-    delete theCrossSectionTable;
-  }
-
-  const G4ElementTable* theElementTable = G4Element::GetElementTable();
-  size_t nvect = G4Element::GetNumberOfElements();
-  theCrossSectionTable = new G4PhysicsTable(nvect);
-  G4PhysicsLogVector* ptrVector;
-  G4double emin = LowEnergyLimit();
-  G4double emax = HighEnergyLimit();
-  G4int n = nbins*G4int(log10(emax/emin));
-  G4bool spline = G4LossTableManager::Instance()->SplineFlag(); 
-  G4double e, value;
-
-  for(size_t j=0; j<nvect ; j++) { 
-
-    ptrVector  = new G4PhysicsLogVector(emin, emax, n);
-    ptrVector->SetSpline(spline);
-    G4double Z = (*theElementTable)[j]->GetZ();
-    G4int   iz = G4int(Z);
-    indexZ[iz] = j;
- 
-    for(G4int i=0; i<nbins; i++) {
-      e = ptrVector->GetLowEdgeEnergy( i ) ;
-      value = ComputeCrossSectionPerAtom(theGamma, e, Z);  
-      ptrVector->PutValue( i, value );
-    }
-
-    theCrossSectionTable->insert(ptrVector);
-  }
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-G4double G4BetheHeitlerModel::ComputeCrossSectionPerAtom(
-                                                   const G4ParticleDefinition*,
-                                              G4double GammaEnergy, G4double Z,
-					      G4double, G4double, G4double)
+{}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+void G4BetheHeitlerModel::Initialise(const G4ParticleDefinition* p,
+				     const G4DataVector& cuts)
+{
+  if(!fParticleChange) { fParticleChange = GetParticleChangeForGamma(); }
+  InitialiseElementSelectors(p, cuts);
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+G4double 
+G4BetheHeitlerModel::ComputeCrossSectionPerAtom(const G4ParticleDefinition*,
+						G4double GammaEnergy, G4double Z,
+						G4double, G4double, G4double)
 // Calculates the microscopic cross section in GEANT4 internal units.
 // A parametrized formula from L. Urban is used to estimate
@@ -144,6 +104,5 @@
   static const G4double GammaEnergyLimit = 1.5*MeV;
   G4double CrossSection = 0.0 ;
-  if ( Z < 1. ) return CrossSection;
-  if ( GammaEnergy <= 2.0*electron_mass_c2 ) return CrossSection;
+  if ( Z < 0.9 || GammaEnergy <= 2.0*electron_mass_c2 ) { return CrossSection; }
 
   static const G4double
@@ -160,5 +119,5 @@
 
   G4double GammaEnergySave = GammaEnergy;
-  if (GammaEnergy < GammaEnergyLimit) GammaEnergy = GammaEnergyLimit ;
+  if (GammaEnergy < GammaEnergyLimit) { GammaEnergy = GammaEnergyLimit; }
 
   G4double X=log(GammaEnergy/electron_mass_c2), X2=X*X, X3=X2*X, X4=X3*X, X5=X4*X;
@@ -177,5 +136,5 @@
   }
 
-  if (CrossSection < 0.) CrossSection = 0.;
+  if (CrossSection < 0.) { CrossSection = 0.; }
   return CrossSection;
 }
@@ -208,5 +167,5 @@
   G4double epsil ;
   G4double epsil0 = electron_mass_c2/GammaEnergy ;
-  if(epsil0 > 1.0) return;
+  if(epsil0 > 1.0) { return; }
 
   // do it fast if GammaEnergy < 2. MeV
@@ -225,5 +184,5 @@
     // Extract Coulomb factor for this Element
     G4double FZ = 8.*(anElement->GetIonisation()->GetlogZ3());
-    if (GammaEnergy > 50.*MeV) FZ += 8.*(anElement->GetfCoulomb());
+    if (GammaEnergy > 50.*MeV) { FZ += 8.*(anElement->GetfCoulomb()); }
 
     // limits of the screening variable
@@ -334,4 +293,2 @@
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
-
-
Index: trunk/source/processes/electromagnetic/standard/src/G4BohrFluctuations.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4BohrFluctuations.cc	(revision 1337)
+++ trunk/source/processes/electromagnetic/standard/src/G4BohrFluctuations.cc	(revision 1340)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4BohrFluctuations.cc,v 1.8 2009/09/29 11:33:22 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-04-beta-01 $
+// $Id: G4BohrFluctuations.cc,v 1.9 2010/10/25 18:23:36 vnivanch Exp $
+// GEANT4 tag $Name: emstand-V09-03-24 $
 //
 // -------------------------------------------------------------------
@@ -67,5 +67,10 @@
   xmin(0.2),
   minLoss(0.001*eV)
-{}
+{
+  particleMass   = proton_mass_c2;
+  chargeSquare   = 1.0;
+  kineticEnergy  = 0.0;
+  beta2          = 0.0;
+}
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -92,5 +97,5 @@
                                                       G4double& meanLoss)
 {
-  if(meanLoss <= minLoss) return meanLoss;
+  if(meanLoss <= minLoss) { return meanLoss; }
   G4double siga = Dispersion(material,dp,tmax,length);
   G4double loss = meanLoss;
@@ -142,5 +147,5 @@
 					G4double& length)
 {
-  if(!particle) InitialiseMe(dp->GetDefinition());
+  if(!particle) { InitialiseMe(dp->GetDefinition()); }
 
   G4double electronDensity = material->GetElectronDensity();
Index: trunk/source/processes/electromagnetic/standard/src/G4BraggIonModel.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4BraggIonModel.cc	(revision 1337)
+++ trunk/source/processes/electromagnetic/standard/src/G4BraggIonModel.cc	(revision 1340)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4BraggIonModel.cc,v 1.27 2009/11/22 18:00:23 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-04-beta-01 $
+// $Id: G4BraggIonModel.cc,v 1.30 2010/11/04 17:30:31 vnivanch Exp $
+// GEANT4 tag $Name: emstand-V09-03-25 $
 //
 // -------------------------------------------------------------------
@@ -81,5 +81,4 @@
     isInitialised(false)
 {
-  if(p) SetParticle(p);
   SetHighEnergyLimit(2.0*MeV);
 
@@ -90,4 +89,7 @@
   theZieglerFactor = eV*cm2*1.0e-15;
   theElectron      = G4Electron::Electron();
+  corrFactor       = 1.0;
+  if(p) { SetParticle(p); }
+  else  { SetParticle(theElectron); }
 }
 
@@ -110,5 +112,5 @@
                                  const G4DataVector&)
 {
-  if(p != particle) SetParticle(p);
+  if(p != particle) { SetParticle(p); }
 
   corrFactor = chargeSquare;
@@ -122,5 +124,5 @@
     G4String pname = particle->GetParticleName();
     if(particle->GetParticleType() == "nucleus" &&
-       pname != "deuteron" && pname != "triton") isIon = true;
+       pname != "deuteron" && pname != "triton") { isIon = true; }
 
     corr = G4LossTableManager::Instance()->EmCorrections();
Index: trunk/source/processes/electromagnetic/standard/src/G4BraggModel.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4BraggModel.cc	(revision 1337)
+++ trunk/source/processes/electromagnetic/standard/src/G4BraggModel.cc	(revision 1340)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4BraggModel.cc,v 1.26 2010/06/04 09:08:43 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-04-beta-01 $
+// $Id: G4BraggModel.cc,v 1.28 2010/11/04 17:30:31 vnivanch Exp $
+// GEANT4 tag $Name: emstand-V09-03-25 $
 //
 // -------------------------------------------------------------------
@@ -84,5 +84,4 @@
     isInitialised(false)
 {
-  if(p) SetParticle(p);
   SetHighEnergyLimit(2.0*MeV);
 
@@ -90,6 +89,9 @@
   theZieglerFactor = eV*cm2*1.0e-15;
   theElectron = G4Electron::Electron();
+  expStopPower125 = 0.0;
 
   corr = G4LossTableManager::Instance()->EmCorrections();
+  if(p) { SetParticle(p); }
+  else  { SetParticle(theElectron); }
 }
 
Index: trunk/source/processes/electromagnetic/standard/src/G4IonFluctuations.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4IonFluctuations.cc	(revision 1337)
+++ trunk/source/processes/electromagnetic/standard/src/G4IonFluctuations.cc	(revision 1340)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4IonFluctuations.cc,v 1.26 2009/03/31 13:24:40 toshito Exp $
-// GEANT4 tag $Name: geant4-09-04-beta-01 $
+// $Id: G4IonFluctuations.cc,v 1.27 2010/10/25 19:13:23 vnivanch Exp $
+// GEANT4 tag $Name: emstand-V09-03-24 $
 //
 // -------------------------------------------------------------------
@@ -80,5 +80,8 @@
     xmin(0.2),
     minLoss(0.001*eV)
-{}
+{
+  kineticEnergy = 0.0;
+  beta2 = 0.0;
+}
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Index: trunk/source/processes/electromagnetic/standard/src/G4PAIModel.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4PAIModel.cc	(revision 1337)
+++ trunk/source/processes/electromagnetic/standard/src/G4PAIModel.cc	(revision 1340)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4PAIModel.cc,v 1.52 2010/06/03 07:28:39 grichine Exp $
-// GEANT4 tag $Name: geant4-09-04-beta-01 $
+// $Id: G4PAIModel.cc,v 1.54 2010/11/04 17:30:32 vnivanch Exp $
+// GEANT4 tag $Name: emstand-V09-03-25 $
 //
 // -------------------------------------------------------------------
@@ -81,7 +81,5 @@
   fBg2lim(0.0169),
   fTaulim(8.4146e-3)
-{
-  if(p) SetParticle(p);
-  
+{  
   fElectron = G4Electron::Electron();
   fPositron = G4Positron::Positron();
@@ -93,4 +91,11 @@
   fLambdaVector      = 0;
   fdNdxCutVector     = 0;
+  fParticleEnergyVector = 0;
+  fSandiaIntervalNumber = 0;
+  fMatIndex = 0;
+  fDeltaCutInKinEnergy = 0.0;
+
+  if(p) { SetParticle(p); }
+  else  { SetParticle(fElectron); }
 
   isInitialised      = false;
@@ -132,5 +137,5 @@
 void G4PAIModel::SetParticle(const G4ParticleDefinition* p)
 {
-  if(fParticle == p) return;
+  if(fParticle == p) { return; }
   fParticle = p;
   fMass = fParticle->GetPDGMass();
@@ -141,4 +146,6 @@
   fRatio = electron_mass_c2/fMass;
   fQc = fMass/fRatio;
+  fLowestKineticEnergy  = fMass*(fLowestGamma  - 1.0);
+  fHighestKineticEnergy = fMass*(fHighestGamma - 1.0);
 }
 
@@ -148,11 +155,9 @@
 			    const G4DataVector&)
 {
-  G4cout<<"G4PAIModel::Initialise for "<<p->GetParticleName()<<G4endl;
-  if(isInitialised) return;
+  //G4cout<<"G4PAIModel::Initialise for "<<p->GetParticleName()<<G4endl;
+  if(isInitialised) { return; }
   isInitialised = true;
 
   SetParticle(p);
-  fLowestKineticEnergy  = fMass*(fLowestGamma  - 1.0);
-  fHighestKineticEnergy = fMass*(fHighestGamma - 1.0);
 
   fParticleEnergyVector = new G4PhysicsLogVector(fLowestKineticEnergy,
@@ -213,10 +218,11 @@
 void G4PAIModel::ComputeSandiaPhotoAbsCof()
 { 
-  G4int i, j, numberOfElements ;
-  static const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
+  G4int i, j;
+  const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
 
   G4SandiaTable thisMaterialSandiaTable(fMatIndex) ;
-  numberOfElements = (*theMaterialTable)[fMatIndex]->
-                                              GetNumberOfElements();
+  G4int numberOfElements = 
+    (*theMaterialTable)[fMatIndex]->GetNumberOfElements();
+
   G4int* thisMaterialZ = new G4int[numberOfElements] ;
 
@@ -236,18 +242,20 @@
   fSandiaPhotoAbsCof = new G4double*[fSandiaIntervalNumber] ;
 
-  for(i=0;i<fSandiaIntervalNumber;i++)  fSandiaPhotoAbsCof[i] = new G4double[5] ;
+  for(i=0; i<fSandiaIntervalNumber; i++)  
+  {
+    fSandiaPhotoAbsCof[i] = new G4double[5];
+  }
    
   for( i = 0 ; i < fSandiaIntervalNumber ; i++ )
   {
-    fSandiaPhotoAbsCof[i][0] = thisMaterialSandiaTable.GetPhotoAbsorpCof(i+1,0) ; 
+    fSandiaPhotoAbsCof[i][0] = thisMaterialSandiaTable.GetPhotoAbsorpCof(i+1,0); 
 
     for( j = 1; j < 5 ; j++ )
     {
-      fSandiaPhotoAbsCof[i][j] = thisMaterialSandiaTable.
-	                              GetPhotoAbsorpCof(i+1,j)*
+      fSandiaPhotoAbsCof[i][j] = thisMaterialSandiaTable.GetPhotoAbsorpCof(i+1,j)*
                  (*theMaterialTable)[fMatIndex]->GetDensity() ;
     }
   }
-  // delete[] thisMaterialZ ;
+  delete[] thisMaterialZ;
 }
 
@@ -307,5 +315,5 @@
     ionloss = fPAIySection.GetMeanEnergyLoss() ;   //  total <dE/dx>
 
-    if ( ionloss < DBL_MIN)  ionloss = DBL_MIN;
+    if ( ionloss < DBL_MIN) { ionloss = 0.0; }
     fdEdxVector->PutValue(i,ionloss) ;
 
Index: trunk/source/processes/electromagnetic/standard/src/G4PAIPhotonModel.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4PAIPhotonModel.cc	(revision 1337)
+++ trunk/source/processes/electromagnetic/standard/src/G4PAIPhotonModel.cc	(revision 1340)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4PAIPhotonModel.cc,v 1.24 2010/06/03 07:28:39 grichine Exp $
-// GEANT4 tag $Name: geant4-09-04-beta-01 $
+// $Id: G4PAIPhotonModel.cc,v 1.25 2010/10/26 09:16:50 vnivanch Exp $
+// GEANT4 tag $Name: emstand-V09-03-24 $
 //
 // -------------------------------------------------------------------
@@ -83,6 +83,4 @@
   fTaulim(8.4146e-3)
 {
-  if(p) SetParticle(p);
-
   fVerbose  = 0;
   fElectron = G4Electron::Electron();
@@ -90,6 +88,6 @@
 
   fProtonEnergyVector = new G4PhysicsLogVector(fLowestKineticEnergy,
-							   fHighestKineticEnergy,
-							   fTotBin);
+					       fHighestKineticEnergy,
+					       fTotBin);
   fPAItransferTable     = 0;
   fPAIphotonTable       = 0;
@@ -104,4 +102,10 @@
   fdNdxCutPhotonVector  = 0;
   fdNdxCutPlasmonVector = 0;
+
+  fSandiaIntervalNumber = 0;
+  fMatIndex = 0;
+
+  if(p) { SetParticle(p); }
+  else  { SetParticle(fElectron); }
 
   isInitialised      = false;
@@ -161,6 +165,6 @@
                                    const G4DataVector&)
 {
-  G4cout<<"G4PAIPhotonModel::Initialise for "<<p->GetParticleName()<<G4endl;
-  if(isInitialised) return;
+  //  G4cout<<"G4PAIPhotonModel::Initialise for "<<p->GetParticleName()<<G4endl;
+  if(isInitialised) { return; }
   isInitialised = true;
 
@@ -229,5 +233,5 @@
 {
   G4int i, j, numberOfElements ;
-  static const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
+  const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
 
   G4SandiaTable thisMaterialSandiaTable(fMatIndex) ;
@@ -264,5 +268,5 @@
     }
   }
-  // delete[] thisMaterialZ ;
+  delete[] thisMaterialZ ;
 }
 
Index: trunk/source/processes/electromagnetic/standard/src/G4PAIySection.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4PAIySection.cc	(revision 1337)
+++ trunk/source/processes/electromagnetic/standard/src/G4PAIySection.cc	(revision 1340)
@@ -24,7 +24,6 @@
 // ********************************************************************
 //
-//
-// $Id: G4PAIySection.cc,v 1.4 2009/07/26 15:51:01 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-04-beta-01 $
+// $Id: G4PAIySection.cc,v 1.6 2010/11/04 17:30:32 vnivanch Exp $
+// GEANT4 tag $Name: emstand-V09-03-25 $
 //
 // 
@@ -70,5 +69,9 @@
 
 G4PAIySection::G4PAIySection()
-{}
+{
+  fSandia = 0;
+  fDensity = fElectronDensity = fNormalizationCof = 0.0;
+  fIntervalNumber = fSplineNumber = 0;
+}
 
 ////////////////////////////////////////////////////////////////////////////
Index: trunk/source/processes/electromagnetic/standard/src/G4PairProductionRelModel.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4PairProductionRelModel.cc	(revision 1337)
+++ trunk/source/processes/electromagnetic/standard/src/G4PairProductionRelModel.cc	(revision 1340)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4PairProductionRelModel.cc,v 1.3 2009/05/15 17:12:33 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-04-beta-01 $
+// $Id: G4PairProductionRelModel.cc,v 1.4 2010/10/26 09:06:04 vnivanch Exp $
+// GEANT4 tag $Name: emstand-V09-03-24 $
 //
 // -------------------------------------------------------------------
@@ -85,6 +85,4 @@
 					 const G4String& nam)
   : G4VEmModel(nam),
-    theCrossSectionTable(0),
-    nbins(10),
     fLPMconstant(fine_structure_const*electron_mass_c2*electron_mass_c2/(4.*pi*hbarc)*0.5),
     fLPMflag(true),
@@ -99,4 +97,6 @@
   nist = G4NistManager::Instance();  
 
+  currentZ = z13 = z23 = lnZ = Fel = Finel = fCoulomb = phiLPM = gLPM = xiLPM = 0;
+
 }
 
@@ -104,64 +104,14 @@
 
 G4PairProductionRelModel::~G4PairProductionRelModel()
-{
-  if(theCrossSectionTable) {
-    theCrossSectionTable->clearAndDestroy();
-    delete theCrossSectionTable;
-  }
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-void G4PairProductionRelModel::Initialise(const G4ParticleDefinition*,
-					  const G4DataVector&)
-{
-  fParticleChange = GetParticleChangeForGamma();
-
-  if(theCrossSectionTable) {
-    theCrossSectionTable->clearAndDestroy();
-    delete theCrossSectionTable;
-  }
-
-  const G4ElementTable* theElementTable = G4Element::GetElementTable();
-  size_t nvect = G4Element::GetNumberOfElements();
-  theCrossSectionTable = new G4PhysicsTable(nvect);
-  G4PhysicsLogVector* ptrVector;
-  G4double emin = LowEnergyLimit();
-  G4double emax = HighEnergyLimit();
-  G4int n = nbins*G4int(log10(emax/emin));
-  G4bool spline = G4LossTableManager::Instance()->SplineFlag(); 
-  G4double e, value;
-
-  for(size_t j=0; j<nvect ; j++) { 
-
-    ptrVector  = new G4PhysicsLogVector(emin, emax, n);
-    ptrVector->SetSpline(spline);
-    G4double Z = (*theElementTable)[j]->GetZ();
-    G4VEmModel::SetCurrentElement((*theElementTable)[j]);
-    G4int   iz = G4int(Z);
-    indexZ[iz] = j;
- 
-    for(G4int i=0; i<nbins; i++) {
-      e = ptrVector->GetLowEdgeEnergy( i ) ;
-      value = ComputeCrossSectionPerAtom(theGamma, e, Z);  
-      ptrVector->PutValue( i, value );
-    }
-
-    theCrossSectionTable->insert(ptrVector);
-  }
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-/*
-G4double G4PairProductionRelModel::ComputeRelXSectionPerAtom(G4double k, G4double Z)
-{
-
-  G4double cross = 0.0;
-  
-
-
-
-}
-*/
+{}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+void G4PairProductionRelModel::Initialise(const G4ParticleDefinition* p,
+					  const G4DataVector& cuts)
+{
+  if(!fParticleChange) { fParticleChange = GetParticleChangeForGamma(); }
+  InitialiseElementSelectors(p, cuts);
+}
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -340,5 +290,5 @@
   //  static const G4double gammaEnergyLimit = 1.5*MeV;
   G4double crossSection = 0.0 ;
-  if ( Z < 1. ) return crossSection;
+  if ( Z < 0.9 ) return crossSection;
   if ( gammaEnergy <= 2.0*electron_mass_c2 ) return crossSection;
 
Index: trunk/source/processes/electromagnetic/standard/src/G4UniversalFluctuation.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4UniversalFluctuation.cc	(revision 1337)
+++ trunk/source/processes/electromagnetic/standard/src/G4UniversalFluctuation.cc	(revision 1340)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4UniversalFluctuation.cc,v 1.22 2009/03/20 18:11:23 urban Exp $
-// GEANT4 tag $Name: geant4-09-04-beta-01 $
+// $Id: G4UniversalFluctuation.cc,v 1.28 2010/10/26 10:06:12 vnivanch Exp $
+// GEANT4 tag $Name: emstand-V09-03-24 $
 //
 // -------------------------------------------------------------------
@@ -34,5 +34,5 @@
 // File name:     G4UniversalFluctuation
 //
-// Author:        Vladimir Ivanchenko 
+// Author:        Laszlo Urban
 // 
 // Creation date: 03.01.2002
@@ -57,6 +57,9 @@
 // 03-04-07 correction to get better width of eloss distr.(L.Urban)
 // 13-07-07 add protection for very small step or low-density material (VI)
-// 19-03-09 new width correction (does not depend on previous steps) (L.Urban)         
+// 19-03-09 new width correction (does not depend on previous steps) (L.Urban)
 // 20-03-09 modification in the width correction (L.Urban)
+// 14-06-10 fixed tail distribution - do not use uniform function (L.Urban)
+// 08-08-10 width correction algorithm has bee modified -->
+//          better results for thin targets (L.Urban)
 //
 
@@ -82,8 +85,13 @@
   theBohrBeta2(50.0*keV/proton_mass_c2),
   minLoss(10.*eV),
-  nmaxCont1(4.),
-  nmaxCont2(16.)
+  nmaxCont(16.),
+  rate(0.55),
+  fw(4.)
 {
   lastMaterial = 0;
+
+  particleMass = chargeSquare = ipotFluct = electronDensity = f1Fluct = f2Fluct 
+    = e1Fluct = e2Fluct = e1LogFluct = e2LogFluct = ipotLogFluct = e0 = esmall 
+    = e1 = e2 = 0;
 }
 
@@ -118,8 +126,7 @@
   // shortcut for very very small loss (out of validity of the model)
   //
-  if (meanLoss < minLoss)
-    return meanLoss;
-
-  if(!particle) InitialiseMe(dp->GetDefinition());
+  if (meanLoss < minLoss) { return meanLoss; }
+
+  if(!particle) { InitialiseMe(dp->GetDefinition()); }
 
   G4double tau   = dp->GetKineticEnergy()/particleMass;
@@ -174,16 +181,7 @@
     ipotLogFluct = material->GetIonisation()->GetLogMeanExcEnergy();
     e0 = material->GetIonisation()->GetEnergy0fluct();
+    esmall = 0.5*sqrt(e0*ipotFluct);  
     lastMaterial = material;
-  
-    // modification of some model parameters
-    // (this part should go to materials later)
-    G4double p = 1.40;
-    f2Fluct *= p;
-    f1Fluct = 1.-f2Fluct;
-    G4double q = 1.00;
-    e2Fluct *= q;
-    e2LogFluct = log(e2Fluct);
-    e1LogFluct = (ipotLogFluct-f2Fluct*e2LogFluct)/f1Fluct;
-    e1Fluct = exp(e1LogFluct);
+   
   }
 
@@ -193,29 +191,41 @@
   G4double a1 = 0. , a2 = 0., a3 = 0. ;
 
-  // cut and material dependent rate 
-  G4double rate = 1.0;
   if(tmax > ipotFluct) {
     G4double w2 = log(2.*electron_mass_c2*beta2*gam2)-beta2;
 
-    if(w2 > ipotLogFluct && w2 > e2LogFluct) {
-
-      rate = 0.03+0.23*log(log(tmax/ipotFluct));
+    if(w2 > ipotLogFluct && w2 > e2LogFluct && tmax> ipotFluct)  {
       G4double C = meanLoss*(1.-rate)/(w2-ipotLogFluct);
       a1 = C*f1Fluct*(w2-e1LogFluct)/e1Fluct;
       a2 = C*f2Fluct*(w2-e2LogFluct)/e2Fluct;
-      // correction in order to get better FWHM values
-      // ( scale parameters a1 and e1)
-      G4double width = 1.;
-      if(meanLoss > 10.*e1Fluct)
+         
+
+  if(a1 < nmaxCont) 
+  { 
+    //small energy loss
+    G4double sa1 = sqrt(a1);
+    if(G4UniformRand() < exp(-sa1))
       {
-        width = 3.1623/sqrt(meanLoss/e1Fluct);
-        if(width < a2/a1)
-        width = a2/a1;
+       e1 = esmall;
+       a1 = meanLoss*(1.-rate)/e1;
+       a2 = 0.;
+       e2 = e2Fluct;
       } 
-      a1 *= width;
-      e1 = e1Fluct/width;
+      else
+      {
+       a1 = sa1 ;    
+       e1 = sa1*e1Fluct;
+       e2 = e2Fluct;
+      }
+    }
+    else
+    {
+      //not small energy loss
+      //correction to get better fwhm value
+      a1 /= fw;
+      e1 = fw*e1Fluct;
       e2 = e2Fluct;
     }
-  }
+  }   
+ }
 
   G4double w1 = tmax/e0;
@@ -223,5 +233,5 @@
     a3 = rate*meanLoss*(tmax-e0)/(e0*tmax*log(w1));
 
-  //'nearly' Gaussian fluctuation if a1>nmaxCont2&&a2>nmaxCont2&&a3>nmaxCont2  
+  //'nearly' Gaussian fluctuation if a1>nmaxCont&&a2>nmaxCont&&a3>nmaxCont  
   G4double emean = 0.;
   G4double sig2e = 0., sige = 0.;
@@ -229,5 +239,5 @@
  
   // excitation of type 1
-  if(a1 > nmaxCont2)
+  if(a1 > nmaxCont)
   {
     emean += a1*e1;
@@ -243,5 +253,5 @@
 
   // excitation of type 2
-  if(a2 > nmaxCont2)
+  if(a2 > nmaxCont)
   {
     emean += a2*e2;
@@ -262,7 +272,7 @@
     p3 = a3;
     G4double alfa = 1.;
-    if(a3 > nmaxCont2)
+    if(a3 > nmaxCont)
     {
-       alfa            = w1*(nmaxCont2+a3)/(w1*nmaxCont2+a3);
+       alfa            = w1*(nmaxCont+a3)/(w1*nmaxCont+a3);
        G4double alfa1  = alfa*log(alfa)/(alfa-1.);
        G4double namean = a3*w1*(alfa-1.)/((w1-1.)*alfa);
Index: trunk/source/processes/electromagnetic/standard/src/G4UrbanMscModel90.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4UrbanMscModel90.cc	(revision 1337)
+++ trunk/source/processes/electromagnetic/standard/src/G4UrbanMscModel90.cc	(revision 1340)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4UrbanMscModel90.cc,v 1.13 2009/04/10 18:10:58 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-04-beta-01 $
+// $Id: G4UrbanMscModel90.cc,v 1.14 2010/10/26 10:06:12 vnivanch Exp $
+// GEANT4 tag $Name: emstand-V09-03-24 $
 //
 // -------------------------------------------------------------------
@@ -93,4 +93,13 @@
   inside        = false;  
   insideskin    = false;
+
+  skindepth = skin*stepmin;
+
+  mass = proton_mass_c2;
+  charge = 1.0;
+  currentKinEnergy = currentRange = currentRadLength = masslimite = masslimitmu 
+    = lambda0 = lambdaeff = tPathLength = zPathLength = par1 = par2 = par3 = 0;
+
+  currentMaterialIndex = 0;
 }
 
@@ -105,5 +114,5 @@
 				   const G4DataVector&)
 {
-  skindepth     = skin*stepmin;
+  skindepth = skin*stepmin;
   if(isInitialized) return;
 
Index: trunk/source/processes/electromagnetic/standard/src/G4UrbanMscModel92.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4UrbanMscModel92.cc	(revision 1337)
+++ trunk/source/processes/electromagnetic/standard/src/G4UrbanMscModel92.cc	(revision 1340)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4UrbanMscModel92.cc,v 1.1 2009/11/01 13:05:01 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-04-beta-01 $
+// $Id: G4UrbanMscModel92.cc,v 1.2 2010/10/26 10:06:12 vnivanch Exp $
+// GEANT4 tag $Name: emstand-V09-03-24 $
 //
 // -------------------------------------------------------------------
@@ -166,4 +166,12 @@
   insideskin    = false;
 
+  skindepth = skin*stepmin;
+
+  mass = proton_mass_c2;
+  charge = ChargeSquare = 1.0;
+  currentKinEnergy = currentRadLength = lambda0 = lambdaeff = tPathLength 
+    = zPathLength = par1 = par2 = par3 = 0;
+
+  currentMaterialIndex = 0;
 }
 
Index: trunk/source/processes/electromagnetic/standard/src/G4UrbanMscModel93.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4UrbanMscModel93.cc	(revision 1337)
+++ trunk/source/processes/electromagnetic/standard/src/G4UrbanMscModel93.cc	(revision 1340)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4UrbanMscModel93.cc,v 1.5 2010/06/25 09:41:44 gunter Exp $
-// GEANT4 tag $Name: geant4-09-04-beta-01 $
+// $Id: G4UrbanMscModel93.cc,v 1.7 2010/11/04 17:30:32 vnivanch Exp $
+// GEANT4 tag $Name: emstand-V09-03-25 $
 //
 // -------------------------------------------------------------------
@@ -166,4 +166,12 @@
   insideskin    = false;
 
+  skindepth = skin*stepmin;
+
+  mass = proton_mass_c2;
+  charge = ChargeSquare = 1.0;
+  currentKinEnergy = currentRadLength = lambda0 = lambdaeff = tPathLength 
+    = zPathLength = par1 = par2 = par3 = 0;
+
+  currentMaterialIndex = -1;
 }
 
@@ -179,5 +187,6 @@
 {
   skindepth = skin*stepmin;
-  if(isInitialized) return;
+
+  if(isInitialized) { return; }
   // set values of some data members
   SetParticle(p);
@@ -460,14 +469,14 @@
 
   // stop here if small range particle
-  if(inside) return tPathLength;            
+  if(inside) { return tPathLength; }            
   
-  if(tPathLength > currentRange) tPathLength = currentRange;
+  if(tPathLength > currentRange) { tPathLength = currentRange; }
 
   presafety = sp->GetSafety();
 
- // G4cout << "G4Urban2::StepLimit tPathLength= " 
- // 	 <<tPathLength<<" safety= " << presafety
- //        << " range= " <<currentRange<< " lambda= "<<lambda0
- // 	 << " Alg: " << steppingAlgorithm <<G4endl;
+  // G4cout << "G4Urban2::StepLimit tPathLength= " 
+  // 	 <<tPathLength<<" safety= " << presafety
+  //        << " range= " <<currentRange<< " lambda= "<<lambda0
+  // 	 << " Alg: " << steppingAlgorithm <<G4endl;
 
   // far from geometry boundary
Index: trunk/source/processes/electromagnetic/standard/src/G4WaterStopping.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4WaterStopping.cc	(revision 1337)
+++ trunk/source/processes/electromagnetic/standard/src/G4WaterStopping.cc	(revision 1340)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4WaterStopping.cc,v 1.21 2010/04/26 17:44:34 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-04-beta-01 $
+// $Id: G4WaterStopping.cc,v 1.22 2010/10/26 10:06:12 vnivanch Exp $
+// GEANT4 tag $Name: emstand-V09-03-24 $
 
 //---------------------------------------------------------------------------
@@ -68,6 +68,9 @@
 {
   G4double res = 0.0;
-  if((iz > 26) || (iz < 3) || (iz > 18 && iz < 26)) { return res; } 
   G4int idx = iz - 3;
+
+  if(iz == 26) { idx = 16; }
+  else if (iz < 3 || iz > 18) { return res; }
+
   G4double scaledEnergy = energy/A[idx];
   if(scaledEnergy < emin) {
Index: trunk/source/processes/electromagnetic/standard/src/G4WentzelOKandVIxSection.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4WentzelOKandVIxSection.cc	(revision 1337)
+++ trunk/source/processes/electromagnetic/standard/src/G4WentzelOKandVIxSection.cc	(revision 1340)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4WentzelOKandVIxSection.cc,v 1.10 2010/06/01 13:34:21 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-04-beta-01 $
+// $Id: G4WentzelOKandVIxSection.cc,v 1.12 2010/11/04 17:30:32 vnivanch Exp $
+// GEANT4 tag $Name: emstand-V09-03-25 $
 //
 // -------------------------------------------------------------------
@@ -93,4 +93,10 @@
     } 
   }
+  currentMaterial = 0;
+  elecXSRatio = factB = formfactA = screenZ = 0.0;
+  cosTetMaxElec = cosTetMaxNuc = invbeta2 = kinFactor = 1.0;
+
+  Initialise(theElectron, 1.0);
+  SetTargetMass(proton_mass_c2);
 }
 
Index: trunk/source/processes/electromagnetic/standard/src/G4WentzelVIModel.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4WentzelVIModel.cc	(revision 1337)
+++ trunk/source/processes/electromagnetic/standard/src/G4WentzelVIModel.cc	(revision 1340)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4WentzelVIModel.cc,v 1.60 2010/06/01 11:13:31 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-04-beta-01 $
+// $Id: G4WentzelVIModel.cc,v 1.61 2010/10/26 10:06:12 vnivanch Exp $
+// GEANT4 tag $Name: emstand-V09-03-24 $
 //
 // -------------------------------------------------------------------
@@ -89,4 +89,8 @@
   fG4pow = G4Pow::GetInstance();
   wokvi = new G4WentzelOKandVIxSection();
+
+  preKinEnergy = tPathLength = zPathLength = lambdaeff = currentRange = xtsec = 0;
+  currentMaterialIndex = 0;
+  cosThetaMax = cosTetMaxNuc = 1.0;
 }
 
Index: trunk/source/processes/electromagnetic/standard/src/G4alphaIonisation.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4alphaIonisation.cc	(revision 1337)
+++ trunk/source/processes/electromagnetic/standard/src/G4alphaIonisation.cc	(revision 1340)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4alphaIonisation.cc,v 1.1 2009/11/10 11:50:30 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-04-beta-01 $
+// $Id: G4alphaIonisation.cc,v 1.3 2010/10/26 10:06:12 vnivanch Exp $
+// GEANT4 tag $Name: emstand-V09-03-24 $
 //
 // -------------------------------------------------------------------
@@ -64,6 +64,5 @@
   : G4VEnergyLossProcess(name),
     theParticle(0),
-    isInitialised(false),
-    nuclearStopping(true)
+    isInitialised(false)
 {
   //  SetLinearLossLimit(0.15);
@@ -74,4 +73,5 @@
   mass = 0.0;
   ratio = 0.0;
+  eth = 8*MeV;
 }
 
@@ -85,5 +85,6 @@
 G4bool G4alphaIonisation::IsApplicable(const G4ParticleDefinition& p)
 {
-  return (p.GetPDGCharge() == 2*eplus);
+  return (!p.IsShortLived() &&
+	  std::fabs(p.GetPDGCharge() - 2*CLHEP::eplus) < 0.01);
 }
 
@@ -122,5 +123,5 @@
     SetSecondaryParticle(G4Electron::Electron());
 
-    if (!EmModel(1)) SetEmModel(new G4BraggIonModel(), 1);
+    if (!EmModel(1)) { SetEmModel(new G4BraggIonModel(), 1); }
     EmModel(1)->SetLowEnergyLimit(MinKinEnergy());
 
@@ -129,8 +130,8 @@
     EmModel(1)->SetHighEnergyLimit(eth);
 
-    if (!FluctModel()) SetFluctModel(new G4UniversalFluctuation());
+    if (!FluctModel()) { SetFluctModel(new G4UniversalFluctuation()); }
     AddEmModel(1, EmModel(1), new G4IonFluctuations());
 
-    if (!EmModel(2)) SetEmModel(new G4BetheBlochModel(),2);  
+    if (!EmModel(2)) { SetEmModel(new G4BetheBlochModel(),2); }  
     EmModel(2)->SetLowEnergyLimit(eth);
     EmModel(2)->SetHighEnergyLimit(MaxKinEnergy());
@@ -139,7 +140,4 @@
     isInitialised = true;
   }
-  // reinitialisation of corrections for the new run
-  EmModel(1)->ActivateNuclearStopping(nuclearStopping);
-  EmModel(2)->ActivateNuclearStopping(nuclearStopping);
 }
 
@@ -147,12 +145,5 @@
 
 void G4alphaIonisation::PrintInfo()
-{
-  if (G4Alpha::Alpha() == theParticle) {
-    if(EmModel(1) && EmModel(2)) {
-      G4cout << "      NuclearStopping= " << nuclearStopping
-	     << G4endl;
-    }
-  }
-}
+{}
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Index: trunk/source/processes/electromagnetic/standard/src/G4eBremsstrahlungModel.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4eBremsstrahlungModel.cc	(revision 1337)
+++ trunk/source/processes/electromagnetic/standard/src/G4eBremsstrahlungModel.cc	(revision 1340)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4eBremsstrahlungModel.cc,v 1.46 2010/04/28 18:39:40 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-04-beta-01 $
+// $Id: G4eBremsstrahlungModel.cc,v 1.48 2010/10/26 10:35:22 vnivanch Exp $
+// GEANT4 tag $Name: emstand-V09-03-24 $
 //
 // -------------------------------------------------------------------
@@ -55,4 +55,5 @@
 // 15-02-07  correct LPMconstant by a factor 2, thanks to G. Depaola (mma)
 // 09-09-08  MigdalConstant increased in (2pi)^2 times (A.Schaelicke) 
+// 13-10-10  Add angular distributon interface (VI)
 //
 // Class Description:
@@ -75,4 +76,5 @@
 #include "G4DataVector.hh"
 #include "G4ParticleChangeForLoss.hh"
+#include "G4ModifiedTsai.hh"
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -90,7 +92,10 @@
     isInitialised(false)
 {
-  if(p) SetParticle(p);
+  if(p) { SetParticle(p); }
   theGamma = G4Gamma::Gamma();
   minThreshold = 0.1*keV;
+  SetAngularDistribution(new G4ModifiedTsai());
+  highKinEnergy = HighEnergyLimit();
+  lowKinEnergy  = LowEnergyLimit();
 }
 
@@ -129,5 +134,5 @@
                                         const G4DataVector& cuts)
 {
-  if(p) SetParticle(p);
+  if(p) { SetParticle(p); }
   highKinEnergy = HighEnergyLimit();
   lowKinEnergy  = LowEnergyLimit();
@@ -172,6 +177,6 @@
                                                    G4double cutEnergy)
 {
-  if(!particle) SetParticle(p);
-  if(kineticEnergy < lowKinEnergy) return 0.0;
+  if(!particle) { SetParticle(p); }
+  if(kineticEnergy < lowKinEnergy) { return 0.0; }
 
   const G4double thigh = 100.*GeV;
@@ -272,5 +277,5 @@
     dedx += loss;
   }
-  if(dedx < 0.) dedx = 0.;
+  if(dedx < 0.) { dedx = 0.; }
   return dedx;
 }
@@ -413,9 +418,9 @@
                                                     G4double maxEnergy)
 {
-  if(!particle) SetParticle(p);
+  if(!particle) { SetParticle(p); }
   G4double cross = 0.0;
   G4double tmax = min(maxEnergy, kineticEnergy);
   G4double cut  = max(cutEnergy, minThreshold);
-  if(cut >= tmax) return cross;
+  if(cut >= tmax) { return cross; }
 
   const G4ElementVector* theElementVector = material->GetElementVector();
@@ -495,5 +500,5 @@
 {
   G4double cross = 0.0 ;
-  if ( kineticEnergy < 1*keV || kineticEnergy < cut) return cross;
+  if ( kineticEnergy < 1*keV || kineticEnergy < cut) { return cross; }
 
   static const G4double ksi=2.0, alfa=1.00;
@@ -664,5 +669,5 @@
   G4double kineticEnergy = dp->GetKineticEnergy();
   G4double tmax = min(maxEnergy, kineticEnergy);
-  if(tmin >= tmax) return;
+  if(tmin >= tmax) { return; }
 
 //
@@ -709,6 +714,6 @@
   G4double xmax     = tmax/kineticEnergy;
   G4double kappa    = 0.0;
-  if(xmax >= 1.) xmax = 1.;
-  else     kappa    = log(xmax)/log(xmin);
+  if(xmax >= 1.) { xmax = 1.; }
+  else   { kappa    = log(xmax)/log(xmin); }
   G4double epsilmin = tmin/totalEnergy;
   G4double epsilmax = tmax/totalEnergy;
@@ -812,16 +817,4 @@
       } while( greject < G4UniformRand()*grejmax );
     }
-    /*
-    if(x > 0.999) {
-      G4cout << "### G4eBremsstrahlungModel Warning: e= " << kineticEnergy
-	     << " tlow= " << tlow
-	     << " x= " << x
-	     << " greject= " << greject 
-	     << " grejmax= " << grejmax
-	     << " migdal= " << migdal
-	     << G4endl; 
-      //      if(x >= 1.0) G4Exception("X=1");
-    }
-    */
     gammaEnergy = x*kineticEnergy; 
 
@@ -837,17 +830,10 @@
 
   //
-  //  angles of the emitted gamma. ( Z - axis along the parent particle)
+  // angles of the emitted gamma. ( Z - axis along the parent particle)
+  // use general interface
   //
-  //  universal distribution suggested by L. Urban 
-  // (Geant3 manual (1993) Phys211),
-  //  derived from Tsai distribution (Rev Mod Phys 49,421(1977))
-
-  G4double u;
-  const G4double a1 = 0.625 , a2 = 3.*a1 , d = 27. ;
-
-  if (9./(9.+d) > G4UniformRand()) u = - log(G4UniformRand()*G4UniformRand())/a1;
-     else                          u = - log(G4UniformRand()*G4UniformRand())/a2;
-
-  G4double theta = u*electron_mass_c2/totalEnergy;
+  G4double theta = GetAngularDistribution()->PolarAngle(totalEnergy,
+							totalEnergy-gammaEnergy,
+							(G4int)anElement->GetZ());
 
   G4double sint = sin(theta);
Index: trunk/source/processes/electromagnetic/standard/src/G4eBremsstrahlungRelModel.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4eBremsstrahlungRelModel.cc	(revision 1337)
+++ trunk/source/processes/electromagnetic/standard/src/G4eBremsstrahlungRelModel.cc	(revision 1340)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4eBremsstrahlungRelModel.cc,v 1.15 2010/04/06 17:02:23 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-04-beta-01 $
+// $Id: G4eBremsstrahlungRelModel.cc,v 1.18 2010/11/04 17:30:32 vnivanch Exp $
+// GEANT4 tag $Name: emstand-V09-03-25 $
 //
 // -------------------------------------------------------------------
@@ -42,4 +42,5 @@
 // 13.11.08    add SetLPMflag and SetLPMconstant methods
 // 13.11.08    change default LPMconstant value
+// 13.10.10    add angular distributon interface (VI)
 //
 // Main References:
@@ -65,5 +66,5 @@
 #include "G4ParticleChangeForLoss.hh"
 #include "G4LossTableManager.hh"
-
+#include "G4ModifiedTsai.hh"
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -90,14 +91,23 @@
     use_completescreening(true),isInitialised(false)
 {
-  if(p) SetParticle(p);
   theGamma = G4Gamma::Gamma();
 
   minThreshold = 0.1*keV;
-  SetLowEnergyLimit(GeV);  
+  lowKinEnergy = GeV;
+  SetLowEnergyLimit(lowKinEnergy);  
 
   nist = G4NistManager::Instance();  
+
+  SetLPMFlag(true);
+  SetAngularDistribution(new G4ModifiedTsai());
+
+  particleMass = kinEnergy = totalEnergy = currentZ = z13 = z23 = lnZ = Fel 
+    = Finel = fCoulomb = fMax = densityFactor = densityCorr = lpmEnergy 
+    = xiLPM = phiLPM = gLPM = klpm = kp = 0.0;
+
+  energyThresholdLPM = 1.e39;
+
   InitialiseConstants();
-
-  SetLPMFlag(true);
+  if(p) { SetParticle(p); }
 }
 
@@ -125,6 +135,6 @@
   particle = p;
   particleMass = p->GetPDGMass();
-  if(p == G4Electron::Electron()) isElectron = true;
-  else                            isElectron = false;
+  if(p == G4Electron::Electron()) { isElectron = true; }
+  else                            { isElectron = false;}
 }
 
@@ -140,5 +150,6 @@
 
 void G4eBremsstrahlungRelModel::SetupForMaterial(const G4ParticleDefinition*,
-						 const G4Material* mat, G4double kineticEnergy)
+						 const G4Material* mat, 
+						 G4double kineticEnergy)
 {
   densityFactor = mat->GetElectronDensity()*fMigdalConstant;
@@ -146,9 +157,9 @@
 
   // Threshold for LPM effect (i.e. below which LPM hidden by density effect) 
-  if (LPMFlag()) 
+  if (LPMFlag()) {
     energyThresholdLPM=sqrt(densityFactor)*lpmEnergy;
-  else
+  } else {
      energyThresholdLPM=1.e39;   // i.e. do not use LPM effect
-
+  }
   // calculate threshold for density effect
   kinEnergy   = kineticEnergy;
@@ -168,7 +179,6 @@
 					   const G4DataVector& cuts)
 {
-  if(p) SetParticle(p);
-
-  highKinEnergy = HighEnergyLimit();
+  if(p) { SetParticle(p); }
+
   lowKinEnergy  = LowEnergyLimit();
 
@@ -177,5 +187,5 @@
   InitialiseElementSelectors(p, cuts);
 
-  if(isInitialised) return;
+  if(isInitialised) { return; }
   fParticleChange = GetParticleChangeForLoss();
   isInitialised = true;
@@ -190,8 +200,8 @@
                                                    G4double cutEnergy)
 {
-  if(!particle) SetParticle(p);
-  if(kineticEnergy < lowKinEnergy) return 0.0;
+  if(!particle) { SetParticle(p); }
+  if(kineticEnergy < lowKinEnergy) { return 0.0; }
   G4double cut = std::min(cutEnergy, kineticEnergy);
-  if(cut == 0.0) return 0.0;
+  if(cut == 0.0) { return 0.0; }
 
   SetupForMaterial(particle, material,kineticEnergy);
@@ -261,10 +271,10 @@
 					      G4double maxEnergy)
 {
-  if(!particle) SetParticle(p);
-  if(kineticEnergy < lowKinEnergy) return 0.0;
+  if(!particle) { SetParticle(p); }
+  if(kineticEnergy < lowKinEnergy) { return 0.0; }
   G4double cut  = std::min(cutEnergy, kineticEnergy);
   G4double tmax = std::min(maxEnergy, kineticEnergy);
 
-  if(cut >= tmax) return 0.0;
+  if(cut >= tmax) { return 0.0; }
 
   SetCurrentElement(Z);
@@ -273,5 +283,5 @@
 
   // allow partial integration
-  if(tmax < kinEnergy) cross -= ComputeXSectionPerAtom(tmax);
+  if(tmax < kinEnergy) { cross -= ComputeXSectionPerAtom(tmax); }
   
   cross *= Z*Z*bremFactor;
@@ -390,5 +400,5 @@
   // *** make sure suppression is smaller than 1 ***
   // *** caused by Migdal approximation in xi    ***
-  if (xiLPM*phiLPM>1. || s>0.57)  xiLPM=1./phiLPM;
+  if (xiLPM*phiLPM>1. || s>0.57)  { xiLPM=1./phiLPM; }
 }
 
@@ -401,5 +411,5 @@
 //    * complete screening
 {
-  if(gammaEnergy < 0.0) return 0.0;
+  if(gammaEnergy < 0.0) { return 0.0; }
 
   G4double y = gammaEnergy/totalEnergy;
@@ -429,5 +439,5 @@
 {
 
-  if(gammaEnergy < 0.0) return 0.0;
+  if(gammaEnergy < 0.0) { return 0.0; }
 
   G4double y = gammaEnergy/totalEnergy;
@@ -465,8 +475,8 @@
 {
   G4double kineticEnergy = dp->GetKineticEnergy();
-  if(kineticEnergy < lowKinEnergy) return;
+  if(kineticEnergy < lowKinEnergy) { return; }
   G4double cut  = std::min(cutEnergy, kineticEnergy);
   G4double emax = std::min(maxEnergy, kineticEnergy);
-  if(cut >= emax) return;
+  if(cut >= emax) { return; }
 
   SetupForMaterial(particle, couple->GetMaterial(),kineticEnergy);
@@ -483,5 +493,5 @@
   //  G4double fmax= fMax;
   G4bool highe = true;
-  if(totalEnergy < energyThresholdLPM) highe = false;
+  if(totalEnergy < energyThresholdLPM) { highe = false; }
  
   G4double xmin = log(cut*cut + densityCorr);
@@ -507,17 +517,11 @@
 
   //
-  //  angles of the emitted gamma. ( Z - axis along the parent particle)
+  // angles of the emitted gamma. ( Z - axis along the parent particle)
+  // use general interface
   //
-  //  universal distribution suggested by L. Urban 
-  // (Geant3 manual (1993) Phys211),
-  //  derived from Tsai distribution (Rev Mod Phys 49,421(1977))
-
-  G4double u;
-  const G4double a1 = 0.625 , a2 = 3.*a1 , d = 27. ;
-
-  if (9./(9.+d) > G4UniformRand()) u = - log(G4UniformRand()*G4UniformRand())/a1;
-     else                          u = - log(G4UniformRand()*G4UniformRand())/a2;
-
-  G4double theta = u*particleMass/totalEnergy;
+  G4double theta = GetAngularDistribution()->PolarAngle(totalEnergy,
+							totalEnergy-gammaEnergy,
+							(G4int)currentZ);
+
   G4double sint = sin(theta);
   G4double phi = twopi * G4UniformRand();
Index: trunk/source/processes/electromagnetic/standard/src/G4eCoulombScatteringModel.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4eCoulombScatteringModel.cc	(revision 1337)
+++ trunk/source/processes/electromagnetic/standard/src/G4eCoulombScatteringModel.cc	(revision 1340)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4eCoulombScatteringModel.cc,v 1.89 2010/05/27 14:22:05 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-04-beta-01 $
+// $Id: G4eCoulombScatteringModel.cc,v 1.90 2010/10/26 10:35:22 vnivanch Exp $
+// GEANT4 tag $Name: emstand-V09-03-24 $
 //
 // -------------------------------------------------------------------
@@ -91,4 +91,11 @@
   currentCouple = 0;
   wokvi = new G4WentzelOKandVIxSection();
+
+  currentMaterialIndex = 0;
+
+  cosTetMinNuc = 1.0;
+  cosTetMaxNuc = -1.0;
+  elecRatio = 0.0;
+  mass = proton_mass_c2;
 }
 
Index: trunk/source/processes/electromagnetic/standard/src/G4hIonisation.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4hIonisation.cc	(revision 1337)
+++ trunk/source/processes/electromagnetic/standard/src/G4hIonisation.cc	(revision 1340)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4hIonisation.cc,v 1.85 2010/06/04 09:22:14 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-04-beta-01 $
+// $Id: G4hIonisation.cc,v 1.86 2010/10/26 10:42:04 vnivanch Exp $
+// GEANT4 tag $Name: emstand-V09-03-24 $
 //
 // -------------------------------------------------------------------
@@ -116,4 +116,5 @@
   mass = 0.0;
   ratio = 0.0;
+  eth = 2*MeV;
 }
 
Index: trunk/source/processes/electromagnetic/standard/src/G4ionIonisation.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4ionIonisation.cc	(revision 1337)
+++ trunk/source/processes/electromagnetic/standard/src/G4ionIonisation.cc	(revision 1340)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4ionIonisation.cc,v 1.70 2009/11/27 20:06:32 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-04-beta-01 $
+// $Id: G4ionIonisation.cc,v 1.72 2010/10/26 10:42:04 vnivanch Exp $
+// GEANT4 tag $Name: emstand-V09-03-24 $
 //
 // -------------------------------------------------------------------
@@ -66,5 +66,4 @@
 #include "G4Electron.hh"
 #include "G4Proton.hh"
-//#include "G4Alpha.hh"
 #include "G4GenericIon.hh"
 #include "G4BraggModel.hh"
@@ -83,9 +82,7 @@
 G4ionIonisation::G4ionIonisation(const G4String& name)
   : G4VEnergyLossProcess(name),
-    corr(0),
     theParticle(0),
     isInitialised(false),
-    stopDataActive(true),
-    nuclearStopping(true)
+    stopDataActive(true)
 {
   SetLinearLossLimit(0.02);
@@ -95,4 +92,5 @@
   //  SetVerboseLevel(1);
   corr = G4LossTableManager::Instance()->EmCorrections();
+  eth = 2*MeV;
 }
 
@@ -136,12 +134,12 @@
     const G4ParticleDefinition* theBaseParticle = 0;
 
-    if(part == ion)     theBaseParticle = 0;
-    else if(bpart == 0) theBaseParticle = ion;
-    else                theBaseParticle = bpart;
+    if(part == ion)     { theBaseParticle = 0; }
+    else if(bpart == 0) { theBaseParticle = ion; }
+    else                { theBaseParticle = bpart; }
 
     SetBaseParticle(theBaseParticle);
     SetSecondaryParticle(G4Electron::Electron());
 
-    if (!EmModel(1)) SetEmModel(new G4BraggIonModel(), 1);
+    if (!EmModel(1)) { SetEmModel(new G4BraggIonModel(), 1); }
     EmModel(1)->SetLowEnergyLimit(MinKinEnergy());
 
@@ -150,8 +148,8 @@
     EmModel(1)->SetHighEnergyLimit(eth);
 
-    if (!FluctModel()) SetFluctModel(new G4IonFluctuations());
+    if (!FluctModel()) { SetFluctModel(new G4IonFluctuations()); }
     AddEmModel(1, EmModel(1), FluctModel());
 
-    if (!EmModel(2)) SetEmModel(new G4BetheBlochModel(),2);  
+    if (!EmModel(2)) { SetEmModel(new G4BetheBlochModel(),2); }  
     EmModel(2)->SetLowEnergyLimit(eth);
     EmModel(2)->SetHighEnergyLimit(MaxKinEnergy());
@@ -166,7 +164,5 @@
   }
   // reinitialisation of corrections for the new run
-  EmModel(1)->ActivateNuclearStopping(nuclearStopping);
-  EmModel(2)->ActivateNuclearStopping(nuclearStopping);
-  if(part == ion) corr->InitialiseForNewRun();
+  if(part == ion) { corr->InitialiseForNewRun(); }
 }
 
@@ -178,5 +174,5 @@
     G4cout << "      Stopping Power data for " 
            << corr->GetNumberOfStoppingVectors()
-	   << " ion/material pairs, nuclearStopping: " << nuclearStopping
+	   << " ion/material pairs "
            << G4endl;
   }
