Index: trunk/source/processes/electromagnetic/standard/History
===================================================================
--- trunk/source/processes/electromagnetic/standard/History	(revision 991)
+++ trunk/source/processes/electromagnetic/standard/History	(revision 1005)
@@ -1,3 +1,3 @@
-$Id: History,v 1.430 2008/11/24 18:28:09 vnivanch Exp $
+$Id: History,v 1.432 2009/02/20 12:11:37 vnivanch Exp $
 -------------------------------------------------------------------
 
@@ -17,4 +17,13 @@
      * Reverse chronological order (last date on top), please *
      ----------------------------------------------------------
+
+20 February 09: V.Ivant (emstand-V09-02-00)
+- Move all virtual methods from inline to source
+G4PEEffectModel - substitute ComputeMeanFreePath by CrossSectionPerVolume 
+                  (minor CPU speadup for compound materials)
+G4PAIModel, G4PAIPhotonModel - remove usage of random numbers at 
+                   initialisation (potential non-reproducibility)
+G4WentzelVIModel - use generic methods of G4VMscModel to access safety
+                   and other geometry information 
 
 24 November 08: V.Ivant (emstand-V09-01-45)
Index: trunk/source/processes/electromagnetic/standard/include/G4BetheBlochModel.hh
===================================================================
--- trunk/source/processes/electromagnetic/standard/include/G4BetheBlochModel.hh	(revision 991)
+++ trunk/source/processes/electromagnetic/standard/include/G4BetheBlochModel.hh	(revision 1005)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4BetheBlochModel.hh,v 1.16 2008/10/22 16:00:57 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4BetheBlochModel.hh,v 1.17 2009/02/20 12:06:37 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // -------------------------------------------------------------------
@@ -82,6 +82,6 @@
   virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&);
 
-  G4double MinEnergyCut(const G4ParticleDefinition*,
-			const G4MaterialCutsCouple*);
+  virtual G4double MinEnergyCut(const G4ParticleDefinition*,
+				const G4MaterialCutsCouple*);
 			
   virtual G4double ComputeCrossSectionPerElectron(
@@ -131,6 +131,6 @@
 protected:
 
-  G4double MaxSecondaryEnergy(const G4ParticleDefinition*,
-			      G4double kinEnergy);
+  virtual G4double MaxSecondaryEnergy(const G4ParticleDefinition*,
+				      G4double kinEnergy);
 
 private:
@@ -166,16 +166,3 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
-inline G4double G4BetheBlochModel::MaxSecondaryEnergy(
-          const G4ParticleDefinition* pd,
-                G4double kinEnergy) 
-{
-  if(isIon) SetParticle(pd);
-  G4double tau  = kinEnergy/mass;
-  G4double tmax = 2.0*electron_mass_c2*tau*(tau + 2.) /
-                  (1. + 2.0*(tau + 1.)*ratio + ratio*ratio);
-  return std::min(tmax,tlimit);
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
 #endif
Index: trunk/source/processes/electromagnetic/standard/include/G4BohrFluctuations.hh
===================================================================
--- trunk/source/processes/electromagnetic/standard/include/G4BohrFluctuations.hh	(revision 991)
+++ trunk/source/processes/electromagnetic/standard/include/G4BohrFluctuations.hh	(revision 1005)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4BohrFluctuations.hh,v 1.3 2007/09/27 13:53:11 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4BohrFluctuations.hh,v 1.4 2009/02/19 19:17:50 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // -------------------------------------------------------------------
@@ -79,6 +79,4 @@
   void InitialiseMe(const G4ParticleDefinition*);
 
-protected:
-
 private:
 
@@ -103,25 +101,4 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
-
-inline G4double G4BohrFluctuations::Dispersion(
-                          const G4Material* material,
-                          const G4DynamicParticle* dp,
- 				G4double& tmax,
-			        G4double& length)
-{
-  if(!particle) InitialiseMe(dp->GetDefinition());
-
-  G4double electronDensity = material->GetElectronDensity();
-  kineticEnergy = dp->GetKineticEnergy();
-  G4double etot = kineticEnergy + particleMass;
-  beta2 = kineticEnergy*(kineticEnergy + 2.0*particleMass)/(etot*etot);
-  G4double siga  = (1.0/beta2 - 0.5) * twopi_mc2_rcl2 * tmax * length
-                 * electronDensity * chargeSquare;
-
-  return siga;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
 #endif
 
Index: trunk/source/processes/electromagnetic/standard/include/G4BraggIonModel.hh
===================================================================
--- trunk/source/processes/electromagnetic/standard/include/G4BraggIonModel.hh	(revision 991)
+++ trunk/source/processes/electromagnetic/standard/include/G4BraggIonModel.hh	(revision 1005)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4BraggIonModel.hh,v 1.11 2008/10/22 16:00:57 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4BraggIonModel.hh,v 1.12 2009/02/20 12:06:37 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // -------------------------------------------------------------------
@@ -77,6 +77,6 @@
   virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&);
 
-  G4double MinEnergyCut(const G4ParticleDefinition*,
-			const G4MaterialCutsCouple*);
+  virtual G4double MinEnergyCut(const G4ParticleDefinition*,
+				const G4MaterialCutsCouple*);
 			
   virtual G4double ComputeCrossSectionPerElectron(
@@ -128,6 +128,6 @@
 protected:
 
-  G4double MaxSecondaryEnergy(const G4ParticleDefinition*,
-			      G4double kinEnergy);
+  virtual G4double MaxSecondaryEnergy(const G4ParticleDefinition*,
+				      G4double kinEnergy);
 
 private:
@@ -180,17 +180,4 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 
-inline G4double G4BraggIonModel::MaxSecondaryEnergy(
-          const G4ParticleDefinition* pd,
-                G4double kinEnergy)
-{
-  if(pd != particle) SetParticle(pd);
-  G4double tau  = kinEnergy/mass;
-  G4double tmax = 2.0*electron_mass_c2*tau*(tau + 2.) /
-                  (1. + 2.0*(tau + 1.)*ratio + ratio*ratio);
-  return tmax;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
-
 inline void G4BraggIonModel::SetParticle(const G4ParticleDefinition* p)
 {
Index: trunk/source/processes/electromagnetic/standard/include/G4BraggModel.hh
===================================================================
--- trunk/source/processes/electromagnetic/standard/include/G4BraggModel.hh	(revision 991)
+++ trunk/source/processes/electromagnetic/standard/include/G4BraggModel.hh	(revision 1005)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4BraggModel.hh,v 1.12 2008/09/14 17:11:48 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4BraggModel.hh,v 1.13 2009/02/20 12:06:37 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // -------------------------------------------------------------------
@@ -80,6 +80,6 @@
   virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&);
 
-  G4double MinEnergyCut(const G4ParticleDefinition*,
-			const G4MaterialCutsCouple*);
+  virtual G4double MinEnergyCut(const G4ParticleDefinition*,
+				const G4MaterialCutsCouple*);
 			
   virtual G4double ComputeCrossSectionPerElectron(
@@ -131,10 +131,10 @@
 protected:
 
-  G4double MaxSecondaryEnergy(const G4ParticleDefinition*,
-			      G4double kinEnergy);
+  virtual G4double MaxSecondaryEnergy(const G4ParticleDefinition*,
+				      G4double kinEnergy);
 
 private:
 
-  void SetParticle(const G4ParticleDefinition* p);
+  inline void SetParticle(const G4ParticleDefinition* p);
 
   G4bool HasMaterial(const G4Material* material);
@@ -182,17 +182,4 @@
   G4bool   isInitialised;
 };
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
-
-inline G4double G4BraggModel::MaxSecondaryEnergy(
-                                            const G4ParticleDefinition* pd,
-                                                  G4double kinEnergy)
-{
-  if(pd != particle) SetParticle(pd);
-  G4double tau  = kinEnergy/mass;
-  G4double tmax = 2.0*electron_mass_c2*tau*(tau + 2.) /
-                  (1. + 2.0*(tau + 1.)*ratio + ratio*ratio);
-  return tmax;
-}
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Index: trunk/source/processes/electromagnetic/standard/include/G4ComptonScattering.hh
===================================================================
--- trunk/source/processes/electromagnetic/standard/include/G4ComptonScattering.hh	(revision 991)
+++ trunk/source/processes/electromagnetic/standard/include/G4ComptonScattering.hh	(revision 1005)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4ComptonScattering.hh,v 1.20 2007/05/23 08:47:34 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4ComptonScattering.hh,v 1.21 2009/02/20 12:06:37 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 //------------------ G4ComptonScattering physics process -----------------------
@@ -82,9 +82,8 @@
 
   // true for Gamma only.  
-  G4bool IsApplicable(const G4ParticleDefinition&);
+  virtual G4bool IsApplicable(const G4ParticleDefinition&);
   
   // Print few lines of informations about the process: validity range,
   virtual void PrintInfo();
-
 
 protected:
@@ -97,13 +96,4 @@
 };
 
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline 
-G4bool G4ComptonScattering::IsApplicable(const G4ParticleDefinition& p)
-{
-  return (&p == G4Gamma::Gamma());
-}
-
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
   
Index: trunk/source/processes/electromagnetic/standard/include/G4CoulombScattering.hh
===================================================================
--- trunk/source/processes/electromagnetic/standard/include/G4CoulombScattering.hh	(revision 991)
+++ trunk/source/processes/electromagnetic/standard/include/G4CoulombScattering.hh	(revision 1005)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4CoulombScattering.hh,v 1.11 2008/06/13 08:19:43 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4CoulombScattering.hh,v 1.12 2009/02/20 12:06:37 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // -------------------------------------------------------------------
@@ -104,11 +104,4 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
-inline G4bool G4CoulombScattering::IsApplicable(const G4ParticleDefinition& p)
-{
-  return (p.GetPDGCharge() != 0.0 && !p.IsShortLived());
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
 inline void G4CoulombScattering::SetThetaMin(G4double val)
 {
Index: trunk/source/processes/electromagnetic/standard/include/G4GammaConversion.hh
===================================================================
--- trunk/source/processes/electromagnetic/standard/include/G4GammaConversion.hh	(revision 991)
+++ trunk/source/processes/electromagnetic/standard/include/G4GammaConversion.hh	(revision 1005)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4GammaConversion.hh,v 1.22 2007/05/23 08:47:34 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4GammaConversion.hh,v 1.23 2009/02/20 12:06:37 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 //
@@ -85,5 +85,5 @@
 
   // true for Gamma only.
-  G4bool IsApplicable(const G4ParticleDefinition&);
+  virtual G4bool IsApplicable(const G4ParticleDefinition&);
 
   // Print few lines of informations about the process: validity range,
@@ -99,12 +99,4 @@
 };
 
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4bool G4GammaConversion::IsApplicable(const G4ParticleDefinition& p)
-{
-  return (&p == G4Gamma::Gamma());
-}
-
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
   
Index: trunk/source/processes/electromagnetic/standard/include/G4IonFluctuations.hh
===================================================================
--- trunk/source/processes/electromagnetic/standard/include/G4IonFluctuations.hh	(revision 991)
+++ trunk/source/processes/electromagnetic/standard/include/G4IonFluctuations.hh	(revision 1005)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4IonFluctuations.hh,v 1.8 2008/10/22 16:04:33 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4IonFluctuations.hh,v 1.9 2009/02/19 19:17:50 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // -------------------------------------------------------------------
@@ -84,5 +84,5 @@
 
   // Initialisation prestep
-  inline void SetParticleAndCharge(const G4ParticleDefinition*, G4double q2);
+  void SetParticleAndCharge(const G4ParticleDefinition*, G4double q2);
 
 private:
@@ -117,20 +117,4 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
-inline
-void G4IonFluctuations::SetParticleAndCharge(const G4ParticleDefinition* part,
-					     G4double q2)
-{
-  if(part != particle) {
-    particle       = part;
-    particleMass   = part->GetPDGMass();
-    charge         = part->GetPDGCharge()/eplus;
-    chargeSquare   = charge*charge;
-  }
-  effChargeSquare  = q2;
-  uniFluct.SetParticleAndCharge(part, q2);
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
 #endif
 
Index: trunk/source/processes/electromagnetic/standard/include/G4MollerBhabhaModel.hh
===================================================================
--- trunk/source/processes/electromagnetic/standard/include/G4MollerBhabhaModel.hh	(revision 991)
+++ trunk/source/processes/electromagnetic/standard/include/G4MollerBhabhaModel.hh	(revision 1005)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4MollerBhabhaModel.hh,v 1.19 2007/05/22 17:34:36 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4MollerBhabhaModel.hh,v 1.20 2009/02/20 12:06:37 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // -------------------------------------------------------------------
@@ -74,6 +74,6 @@
   virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&);
 
-  G4double MinEnergyCut(const G4ParticleDefinition*,
-			const G4MaterialCutsCouple*);
+  virtual G4double MinEnergyCut(const G4ParticleDefinition*,
+				const G4MaterialCutsCouple*);
 				
   virtual G4double ComputeCrossSectionPerElectron(
@@ -109,8 +109,8 @@
 protected:
 
-  G4double MaxSecondaryEnergy(const G4ParticleDefinition*,
-			      G4double kinEnergy);
+  virtual G4double MaxSecondaryEnergy(const G4ParticleDefinition*,
+				      G4double kinEnergy);
 			      
-  void SetParticle(const G4ParticleDefinition* p);			      
+  inline void SetParticle(const G4ParticleDefinition* p);			      
 
   const G4ParticleDefinition* particle;
@@ -127,15 +127,15 @@
   G4MollerBhabhaModel & operator=(const  G4MollerBhabhaModel &right);
   G4MollerBhabhaModel(const  G4MollerBhabhaModel&);
+
+  G4bool   isInitialised;
+
 };
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 
-inline G4double G4MollerBhabhaModel::MaxSecondaryEnergy(
-                                                   const G4ParticleDefinition*,
-                                                         G4double kinEnergy) 
+inline void G4MollerBhabhaModel::SetParticle(const G4ParticleDefinition* p)
 {
-  G4double tmax = kinEnergy;
-  if(isElectron) tmax *= 0.5;
-  return tmax;
+  particle = p;
+  if(p != theElectron) isElectron = false;
 }
 
Index: trunk/source/processes/electromagnetic/standard/include/G4PAIModel.hh
===================================================================
--- trunk/source/processes/electromagnetic/standard/include/G4PAIModel.hh	(revision 991)
+++ trunk/source/processes/electromagnetic/standard/include/G4PAIModel.hh	(revision 1005)
@@ -24,4 +24,6 @@
 // ********************************************************************
 //
+// $Id: G4PAIModel.hh,v 1.22 2009/02/19 19:17:50 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // -------------------------------------------------------------------
@@ -75,12 +77,12 @@
   virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&);
 
-  virtual void InitialiseMe(const G4ParticleDefinition*) {};
-
-  virtual G4double ComputeDEDX(const G4MaterialCutsCouple*,
+  virtual void InitialiseMe(const G4ParticleDefinition*);
+
+  virtual G4double ComputeDEDXPerVolume(const G4Material*,
 			       const G4ParticleDefinition*,
 			       G4double kineticEnergy,
 			       G4double cutEnergy);
 
-  virtual G4double CrossSection(const G4MaterialCutsCouple*,
+  virtual G4double CrossSectionPerVolume(const G4Material*,
 				const G4ParticleDefinition*,
 				G4double kineticEnergy,
@@ -118,6 +120,4 @@
 
   void SetVerboseLevel(G4int verbose){fVerbose=verbose;};
-
-
 
 protected:
@@ -192,28 +192,4 @@
 };
 
-/////////////////////////////////////////////////////////////////////
-
-inline G4double G4PAIModel::MaxSecondaryEnergy( const G4ParticleDefinition* p,
-                                                      G4double kinEnergy) 
-{
-  G4double tmax = kinEnergy;
-  if(p == fElectron) tmax *= 0.5;
-  else if(p != fPositron) { 
-    G4double mass = p->GetPDGMass();
-    G4double ratio= electron_mass_c2/mass;
-    G4double gamma= kinEnergy/mass + 1.0;
-    tmax = 2.0*electron_mass_c2*(gamma*gamma - 1.) /
-                  (1. + 2.0*gamma*ratio + ratio*ratio);
-  }
-  return tmax;
-}
-
-///////////////////////////////////////////////////////////////
-
-inline  void G4PAIModel::DefineForRegion(const G4Region* r) 
-{
-  fPAIRegionVector.push_back(r);
-}
-
 #endif
 
Index: trunk/source/processes/electromagnetic/standard/include/G4PAIPhotonModel.hh
===================================================================
--- trunk/source/processes/electromagnetic/standard/include/G4PAIPhotonModel.hh	(revision 991)
+++ trunk/source/processes/electromagnetic/standard/include/G4PAIPhotonModel.hh	(revision 1005)
@@ -24,4 +24,6 @@
 // ********************************************************************
 //
+// $Id: G4PAIPhotonModel.hh,v 1.12 2009/02/19 19:17:50 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // -------------------------------------------------------------------
@@ -74,16 +76,16 @@
   virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&);
   
-  virtual void InitialiseMe(const G4ParticleDefinition*) {};
-
-  virtual G4double ComputeDEDX(const G4MaterialCutsCouple*,
-			       const G4ParticleDefinition*,
-			       G4double kineticEnergy,
-			       G4double cutEnergy);
-
-  virtual G4double CrossSection(const G4MaterialCutsCouple*,
-				const G4ParticleDefinition*,
-				G4double kineticEnergy,
-				G4double cutEnergy,
-				G4double maxEnergy);
+  virtual void InitialiseMe(const G4ParticleDefinition*);
+
+  virtual G4double ComputeDEDXPerVolume(const G4Material*,
+					const G4ParticleDefinition*,
+					G4double kineticEnergy,
+					G4double cutEnergy);
+
+  virtual G4double CrossSectionPerVolume(const G4Material*,
+					 const G4ParticleDefinition*,
+					 G4double kineticEnergy,
+					 G4double cutEnergy,
+					 G4double maxEnergy);
 
   virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
@@ -122,10 +124,8 @@
                              G4double position, G4int iTransfer );
 
-
-
 protected:
 
   G4double MaxSecondaryEnergy(const G4ParticleDefinition*,
-                                    G4double kinEnergy);
+			      G4double kinEnergy);
 
 private:
@@ -145,6 +145,4 @@
   G4int                fVerbose; 
   G4PhysicsLogVector*  fProtonEnergyVector ;
-
-
 
   // vectors
@@ -204,28 +202,4 @@
 };
 
-/////////////////////////////////////////////////////////////////////
-
-inline G4double G4PAIPhotonModel::MaxSecondaryEnergy( const G4ParticleDefinition* p,
-                                                      G4double kinEnergy) 
-{
-  G4double tmax = kinEnergy;
-  if(p == fElectron) tmax *= 0.5;
-  else if(p != fPositron) { 
-    G4double mass = p->GetPDGMass();
-    G4double ratio= electron_mass_c2/mass;
-    G4double gamma= kinEnergy/mass + 1.0;
-    tmax = 2.0*electron_mass_c2*(gamma*gamma - 1.) /
-                  (1. + 2.0*gamma*ratio + ratio*ratio);
-  }
-  return tmax;
-}
-
-///////////////////////////////////////////////////////////////
-
-inline  void G4PAIPhotonModel::DefineForRegion(const G4Region* r) 
-{
-  fPAIRegionVector.push_back(r);
-}
-
 #endif
 
Index: trunk/source/processes/electromagnetic/standard/include/G4PEEffectModel.hh
===================================================================
--- trunk/source/processes/electromagnetic/standard/include/G4PEEffectModel.hh	(revision 991)
+++ trunk/source/processes/electromagnetic/standard/include/G4PEEffectModel.hh	(revision 1005)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4PEEffectModel.hh,v 1.6 2007/05/22 17:34:36 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4PEEffectModel.hh,v 1.7 2009/02/20 12:06:37 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // -------------------------------------------------------------------
@@ -41,4 +41,6 @@
 //
 // 06.02.2006 : added ComputeMeanFreePath()  (mma)
+// 20.02.2009 : move virtual inline to .cc, substitute
+//              ComputeMeanFreePath() by CrossSectionPerVolume (VI)
 //
 // Class Description:
@@ -70,14 +72,15 @@
   virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&);
 
-  G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition*,
-                                      G4double kinEnergy,
-                                      G4double Z,
-                                      G4double A,
-                                      G4double, G4double);
+  virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition*,
+					      G4double kinEnergy,
+					      G4double Z,
+					      G4double A,
+					      G4double, G4double);
 				      
-  G4double ComputeMeanFreePath( const G4ParticleDefinition*,
-                                      G4double kinEnergy,
-				const G4Material* material,      
-                                      G4double, G4double);
+  virtual G4double CrossSectionPerVolume(const G4Material*,
+					 const G4ParticleDefinition*,
+					 G4double kineticEnergy,
+					 G4double cutEnergy,
+					 G4double maxEnergy);
 
   virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
@@ -100,43 +103,4 @@
 };
 
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
-
-inline G4double G4PEEffectModel::ComputeCrossSectionPerAtom(
-                                       const G4ParticleDefinition*,
-                                             G4double energy,
-                                             G4double Z, G4double,
-                                             G4double, G4double)
-{
- G4double* SandiaCof = G4SandiaTable::GetSandiaCofPerAtom((G4int)Z, energy);
-
- G4double energy2 = energy*energy, energy3 = energy*energy2,
-          energy4 = energy2*energy2;
-
- return SandiaCof[0]/energy  + SandiaCof[1]/energy2 +
-        SandiaCof[2]/energy3 + SandiaCof[3]/energy4;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4double G4PEEffectModel::ComputeMeanFreePath(
-                                       const G4ParticleDefinition*,
-                                             G4double energy,
-				       const G4Material* material,
-                                             G4double, G4double)
-{
- G4double* SandiaCof = material->GetSandiaTable()
-                                ->GetSandiaCofForMaterial(energy);
-				
- G4double energy2 = energy*energy, energy3 = energy*energy2,
-          energy4 = energy2*energy2;
-	  
- G4double cross = SandiaCof[0]/energy  + SandiaCof[1]/energy2 +
-                  SandiaCof[2]/energy3 + SandiaCof[3]/energy4; 
- 
- G4double mfp = DBL_MAX;
- if (cross > 0.) mfp = 1./cross;
- return mfp;
-}
-
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
Index: trunk/source/processes/electromagnetic/standard/include/G4PhotoElectricEffect.hh
===================================================================
--- trunk/source/processes/electromagnetic/standard/include/G4PhotoElectricEffect.hh	(revision 991)
+++ trunk/source/processes/electromagnetic/standard/include/G4PhotoElectricEffect.hh	(revision 1005)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4PhotoElectricEffect.hh,v 1.24 2007/05/23 08:47:34 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4PhotoElectricEffect.hh,v 1.25 2009/02/20 12:06:37 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 //
@@ -91,12 +91,12 @@
 
   // true for Gamma only.
-  G4bool IsApplicable(const G4ParticleDefinition&);
+  virtual G4bool IsApplicable(const G4ParticleDefinition&);
 
   // Print few lines of informations about the process: validity range,
-  void PrintInfo();
+  virtual void PrintInfo();
 
 protected:
 
-  void InitialiseProcess(const G4ParticleDefinition*);
+  virtual void InitialiseProcess(const G4ParticleDefinition*);
 
 private:
@@ -105,13 +105,4 @@
 };
 
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline 
-G4bool G4PhotoElectricEffect::IsApplicable(const G4ParticleDefinition& p)
-{
-  return (&p == G4Gamma::Gamma());
-}
-
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 
Index: trunk/source/processes/electromagnetic/standard/include/G4UniversalFluctuation.hh
===================================================================
--- trunk/source/processes/electromagnetic/standard/include/G4UniversalFluctuation.hh	(revision 991)
+++ trunk/source/processes/electromagnetic/standard/include/G4UniversalFluctuation.hh	(revision 1005)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4UniversalFluctuation.hh,v 1.6 2008/10/22 16:04:33 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4UniversalFluctuation.hh,v 1.8 2009/02/19 19:17:50 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // -------------------------------------------------------------------
@@ -70,21 +70,20 @@
   virtual ~G4UniversalFluctuation();
 
-  G4double SampleFluctuations(const G4Material*,
-                          const G4DynamicParticle*,
- 				G4double&,
-                                G4double&,
-                                G4double&);
+  virtual G4double SampleFluctuations(const G4Material*,
+				      const G4DynamicParticle*,
+				      G4double&,
+				      G4double&,
+				      G4double&);
 
-  G4double Dispersion(    const G4Material*,
-                          const G4DynamicParticle*,
- 				G4double&,
-                                G4double&);
+  virtual G4double Dispersion(    const G4Material*,
+				  const G4DynamicParticle*,
+				  G4double&,
+				  G4double&);
 
-  void InitialiseMe(const G4ParticleDefinition*);
+  // Initialisation before the run
+  virtual void InitialiseMe(const G4ParticleDefinition*);
 
   // Initialisation prestep
-  inline void SetParticleAndCharge(const G4ParticleDefinition*, G4double q2);
-
-protected:
+  virtual void SetParticleAndCharge(const G4ParticleDefinition*, G4double q2);
 
 private:
@@ -126,17 +125,4 @@
 };
 
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline void 
-G4UniversalFluctuation::SetParticleAndCharge(const G4ParticleDefinition* part,
-					     G4double q2)
-{
-  if(part != particle) {
-    particle       = part;
-    particleMass   = part->GetPDGMass();
-  }
-  chargeSquare = q2;
-}
-
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 
Index: trunk/source/processes/electromagnetic/standard/include/G4WentzelVIModel.hh
===================================================================
--- trunk/source/processes/electromagnetic/standard/include/G4WentzelVIModel.hh	(revision 991)
+++ trunk/source/processes/electromagnetic/standard/include/G4WentzelVIModel.hh	(revision 1005)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4WentzelVIModel.hh,v 1.7 2008/08/04 08:49:09 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4WentzelVIModel.hh,v 1.8 2009/02/19 19:17:15 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // -------------------------------------------------------------------
@@ -66,5 +66,5 @@
 class G4LossTableManager;
 class G4ParticleChangeForMSC;
-class G4SafetyHelper;
+//class G4SafetyHelper;
 class G4ParticleDefinition;
 
@@ -133,5 +133,5 @@
   G4ParticleChangeForMSC*   fParticleChange;
 
-  G4SafetyHelper*           safetyHelper;
+  //  G4SafetyHelper*           safetyHelper;
   G4PhysicsTable*           theLambdaTable;
   G4PhysicsTable*           theLambda2Table;
Index: trunk/source/processes/electromagnetic/standard/include/G4eBremsstrahlung.hh
===================================================================
--- trunk/source/processes/electromagnetic/standard/include/G4eBremsstrahlung.hh	(revision 991)
+++ trunk/source/processes/electromagnetic/standard/include/G4eBremsstrahlung.hh	(revision 1005)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4eBremsstrahlung.hh,v 1.36 2007/05/23 08:47:34 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4eBremsstrahlung.hh,v 1.37 2009/02/20 12:06:37 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // -------------------------------------------------------------------
@@ -89,5 +89,5 @@
   virtual ~G4eBremsstrahlung();
 
-  G4bool IsApplicable(const G4ParticleDefinition& p);
+  virtual G4bool IsApplicable(const G4ParticleDefinition& p);
 
   // Print out of the class parameters
@@ -111,12 +111,4 @@
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4bool G4eBremsstrahlung::IsApplicable(const G4ParticleDefinition& p)
-{
-  return (&p == G4Electron::Electron() || &p == G4Positron::Positron());
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
 #endif
Index: trunk/source/processes/electromagnetic/standard/include/G4eBremsstrahlungModel.hh
===================================================================
--- trunk/source/processes/electromagnetic/standard/include/G4eBremsstrahlungModel.hh	(revision 991)
+++ trunk/source/processes/electromagnetic/standard/include/G4eBremsstrahlungModel.hh	(revision 1005)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4eBremsstrahlungModel.hh,v 1.25 2008/11/13 19:28:58 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4eBremsstrahlungModel.hh,v 1.26 2009/02/20 12:06:37 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // -------------------------------------------------------------------
@@ -75,6 +75,6 @@
   virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&);
 
-  G4double MinEnergyCut(const G4ParticleDefinition*, 
-			const G4MaterialCutsCouple*);
+  virtual G4double MinEnergyCut(const G4ParticleDefinition*, 
+				const G4MaterialCutsCouple*);
 
   virtual G4double ComputeDEDXPerVolume(const G4Material*,
@@ -102,7 +102,4 @@
 
 protected:
-
-  inline G4double MaxSecondaryEnergy(const G4ParticleDefinition*,
-				     G4double kineticEnergy);
 
   const G4Element* SelectRandomAtom(const G4MaterialCutsCouple* couple);
@@ -191,13 +188,3 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
-inline 
-G4double G4eBremsstrahlungModel::MaxSecondaryEnergy(
-                                 const G4ParticleDefinition*,
-    				       G4double kineticEnergy)
-{
-  return kineticEnergy;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
 #endif
Index: trunk/source/processes/electromagnetic/standard/include/G4eBremsstrahlungRelModel.hh
===================================================================
--- trunk/source/processes/electromagnetic/standard/include/G4eBremsstrahlungRelModel.hh	(revision 991)
+++ trunk/source/processes/electromagnetic/standard/include/G4eBremsstrahlungRelModel.hh	(revision 1005)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4eBremsstrahlungRelModel.hh,v 1.10 2008/11/14 09:25:19 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4eBremsstrahlungRelModel.hh,v 1.11 2009/02/20 12:06:37 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // -------------------------------------------------------------------
@@ -71,6 +71,6 @@
   virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&);
 
-  G4double MinEnergyCut(const G4ParticleDefinition*, 
-			const G4MaterialCutsCouple*);
+  virtual G4double MinEnergyCut(const G4ParticleDefinition*, 
+				const G4MaterialCutsCouple*);
 
   virtual G4double ComputeDEDXPerVolume(const G4Material*,
@@ -97,9 +97,4 @@
   inline G4double LPMconstant() const;
 
-protected:
-
-  inline G4double MaxSecondaryEnergy(const G4ParticleDefinition*,
-				     G4double kineticEnergy);
-
 private:
 
@@ -207,13 +202,4 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
-inline G4double 
-G4eBremsstrahlungRelModel::MaxSecondaryEnergy(const G4ParticleDefinition*,
-					      G4double kineticEnergy)
-{
-  return kineticEnergy;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
 
 inline G4double G4eBremsstrahlungRelModel::Phi1(G4double gg, G4double)
Index: trunk/source/processes/electromagnetic/standard/include/G4eIonisation.hh
===================================================================
--- trunk/source/processes/electromagnetic/standard/include/G4eIonisation.hh	(revision 991)
+++ trunk/source/processes/electromagnetic/standard/include/G4eIonisation.hh	(revision 1005)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4eIonisation.hh,v 1.35 2007/05/23 08:47:34 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4eIonisation.hh,v 1.36 2009/02/20 12:06:37 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // -------------------------------------------------------------------
@@ -88,5 +88,5 @@
   virtual ~G4eIonisation();
 
-  G4bool IsApplicable(const G4ParticleDefinition& p);
+  virtual G4bool IsApplicable(const G4ParticleDefinition& p);
 
   // Print out of the class parameters
@@ -98,6 +98,6 @@
 					   const G4ParticleDefinition*);
 
-  G4double MinPrimaryEnergy(const G4ParticleDefinition*,
-			    const G4Material*, G4double cut);
+  virtual G4double MinPrimaryEnergy(const G4ParticleDefinition*,
+				    const G4Material*, G4double cut);
 
 private:
@@ -114,23 +114,4 @@
 };
 
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4double G4eIonisation::MinPrimaryEnergy(const G4ParticleDefinition*,
-						const G4Material*,
-						G4double cut)
-{
-  G4double x = cut;
-  if(isElectron) x += cut;
-  return x;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4bool G4eIonisation::IsApplicable(const G4ParticleDefinition& p)
-{
-  return (&p == G4Electron::Electron() || &p == G4Positron::Positron());
-}
-
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 
Index: trunk/source/processes/electromagnetic/standard/include/G4eplusAnnihilation.hh
===================================================================
--- trunk/source/processes/electromagnetic/standard/include/G4eplusAnnihilation.hh	(revision 991)
+++ trunk/source/processes/electromagnetic/standard/include/G4eplusAnnihilation.hh	(revision 1005)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4eplusAnnihilation.hh,v 1.23 2007/05/23 08:47:34 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4eplusAnnihilation.hh,v 1.24 2009/02/20 12:06:37 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // -------------------------------------------------------------------
@@ -73,5 +73,5 @@
   virtual ~G4eplusAnnihilation();
 
-  G4bool IsApplicable(const G4ParticleDefinition& p);
+  virtual G4bool IsApplicable(const G4ParticleDefinition& p);
 
   virtual G4VParticleChange* AtRestDoIt(
@@ -79,5 +79,5 @@
                              const G4Step& stepData);
 
-  G4double AtRestGetPhysicalInteractionLength(
+  virtual G4double AtRestGetPhysicalInteractionLength(
                              const G4Track& track,
                              G4ForceCondition* condition
@@ -96,22 +96,4 @@
 };
 
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4bool G4eplusAnnihilation::IsApplicable(const G4ParticleDefinition& p)
-{
-  return (&p == G4Positron::Positron());
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline 
-G4double G4eplusAnnihilation::AtRestGetPhysicalInteractionLength(
-                              const G4Track&, G4ForceCondition* condition)
-{
-  *condition = NotForced;
-  return 0.0;
-}
-
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 
Index: trunk/source/processes/electromagnetic/standard/include/G4hIonisation.hh
===================================================================
--- trunk/source/processes/electromagnetic/standard/include/G4hIonisation.hh	(revision 991)
+++ trunk/source/processes/electromagnetic/standard/include/G4hIonisation.hh	(revision 1005)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4hIonisation.hh,v 1.41 2008/09/14 17:11:48 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4hIonisation.hh,v 1.42 2009/02/20 12:06:37 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // -------------------------------------------------------------------
@@ -93,8 +93,8 @@
   virtual ~G4hIonisation();
 
-  G4bool IsApplicable(const G4ParticleDefinition& p);
+  virtual G4bool IsApplicable(const G4ParticleDefinition& p);
 
-  G4double MinPrimaryEnergy(const G4ParticleDefinition* p,
-			    const G4Material*, G4double cut);
+  virtual G4double MinPrimaryEnergy(const G4ParticleDefinition* p,
+				    const G4Material*, G4double cut);
 
   // Print out of the class parameters
@@ -123,24 +123,4 @@
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4bool G4hIonisation::IsApplicable(const G4ParticleDefinition& p)
-{
-  return (p.GetPDGCharge() != 0.0 && p.GetPDGMass() > 10.0*MeV &&
-	 !p.IsShortLived());
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4double G4hIonisation::MinPrimaryEnergy(const G4ParticleDefinition*,
-						const G4Material*,
-						G4double cut)
-{
-  G4double x = 0.5*cut/electron_mass_c2;
-  G4double g = x*ratio + std::sqrt((1. + x)*(1. + x*ratio*ratio));
-  return mass*(g - 1.0);
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
 inline void G4hIonisation::ActivateNuclearStopping(G4bool val)
Index: trunk/source/processes/electromagnetic/standard/include/G4ionIonisation.hh
===================================================================
--- trunk/source/processes/electromagnetic/standard/include/G4ionIonisation.hh	(revision 991)
+++ trunk/source/processes/electromagnetic/standard/include/G4ionIonisation.hh	(revision 1005)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4ionIonisation.hh,v 1.56 2008/09/14 17:11:48 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4ionIonisation.hh,v 1.57 2009/02/20 12:06:37 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // -------------------------------------------------------------------
@@ -85,5 +85,5 @@
   virtual ~G4ionIonisation();
 
-  inline G4bool IsApplicable(const G4ParticleDefinition& p);
+  virtual G4bool IsApplicable(const G4ParticleDefinition& p);
 
   // Print out of the class parameters
@@ -102,5 +102,5 @@
 					   const G4ParticleDefinition*);
 
-  inline G4double MinPrimaryEnergy(const G4ParticleDefinition* p,
+  virtual G4double MinPrimaryEnergy(const G4ParticleDefinition* p,
 				   const G4Material*, G4double cut);
 
@@ -127,21 +127,4 @@
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4bool G4ionIonisation::IsApplicable(const G4ParticleDefinition& p)
-{
-  return (p.GetPDGCharge() != 0.0 && !p.IsShortLived() &&
-          p.GetParticleType() == "nucleus");
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4double G4ionIonisation::MinPrimaryEnergy(
-          const G4ParticleDefinition* p, const G4Material*, G4double cut)
-{
-  return 
-    p->GetPDGMass()*(std::sqrt(1. + 0.5*cut/CLHEP::electron_mass_c2) - 1.0);
-}
-
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
Index: trunk/source/processes/electromagnetic/standard/src/G4BetheBlochModel.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4BetheBlochModel.cc	(revision 991)
+++ trunk/source/processes/electromagnetic/standard/src/G4BetheBlochModel.cc	(revision 1005)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4BetheBlochModel.cc,v 1.24 2008/10/22 16:00:57 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4BetheBlochModel.cc,v 1.25 2009/02/20 12:06:37 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // -------------------------------------------------------------------
@@ -111,4 +111,6 @@
 
   corrFactor = chargeSquare;
+  // always false before the run
+  SetDeexcitationFlag(false);
 
   if(!isInitialised) {
@@ -453,3 +455,15 @@
 }
 
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+G4double G4BetheBlochModel::MaxSecondaryEnergy(const G4ParticleDefinition* pd,
+					       G4double kinEnergy) 
+{
+  if(isIon) SetParticle(pd);
+  G4double tau  = kinEnergy/mass;
+  G4double tmax = 2.0*electron_mass_c2*tau*(tau + 2.) /
+                  (1. + 2.0*(tau + 1.)*ratio + ratio*ratio);
+  return std::min(tmax,tlimit);
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Index: trunk/source/processes/electromagnetic/standard/src/G4BohrFluctuations.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4BohrFluctuations.cc	(revision 991)
+++ trunk/source/processes/electromagnetic/standard/src/G4BohrFluctuations.cc	(revision 1005)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4BohrFluctuations.cc,v 1.6 2007/09/27 14:02:41 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4BohrFluctuations.cc,v 1.7 2009/02/19 19:17:50 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // -------------------------------------------------------------------
@@ -137,3 +137,22 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
+G4double G4BohrFluctuations::Dispersion(const G4Material* material,
+					const G4DynamicParticle* dp,
+					G4double& tmax,
+					G4double& length)
+{
+  if(!particle) InitialiseMe(dp->GetDefinition());
 
+  G4double electronDensity = material->GetElectronDensity();
+  kineticEnergy = dp->GetKineticEnergy();
+  G4double etot = kineticEnergy + particleMass;
+  beta2 = kineticEnergy*(kineticEnergy + 2.0*particleMass)/(etot*etot);
+  G4double siga  = (1.0/beta2 - 0.5) * twopi_mc2_rcl2 * tmax * length
+                 * electronDensity * chargeSquare;
+
+  return siga;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+
Index: trunk/source/processes/electromagnetic/standard/src/G4BraggIonModel.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4BraggIonModel.cc	(revision 991)
+++ trunk/source/processes/electromagnetic/standard/src/G4BraggIonModel.cc	(revision 1005)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4BraggIonModel.cc,v 1.22 2008/10/22 16:00:57 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4BraggIonModel.cc,v 1.23 2009/02/20 12:06:37 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // -------------------------------------------------------------------
@@ -113,4 +113,7 @@
 
   corrFactor = chargeSquare;
+
+  // always false before the run
+  SetDeexcitationFlag(false);
 
   if(!isInitialised) {
@@ -352,4 +355,16 @@
   fParticleChange->SetProposedKineticEnergy(kineticEnergy);
   fParticleChange->SetProposedMomentumDirection(finalP);
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+G4double G4BraggIonModel::MaxSecondaryEnergy(const G4ParticleDefinition* pd,
+					     G4double kinEnergy)
+{
+  if(pd != particle) SetParticle(pd);
+  G4double tau  = kinEnergy/mass;
+  G4double tmax = 2.0*electron_mass_c2*tau*(tau + 2.) /
+                  (1. + 2.0*(tau + 1.)*ratio + ratio*ratio);
+  return tmax;
 }
 
Index: trunk/source/processes/electromagnetic/standard/src/G4BraggModel.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4BraggModel.cc	(revision 991)
+++ trunk/source/processes/electromagnetic/standard/src/G4BraggModel.cc	(revision 1005)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4BraggModel.cc,v 1.20 2008/10/22 16:01:46 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4BraggModel.cc,v 1.21 2009/02/20 12:06:37 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // -------------------------------------------------------------------
@@ -111,4 +111,7 @@
 {
   if(p != particle) SetParticle(p);
+
+  // always false before the run
+  SetDeexcitationFlag(false);
 
   if(!isInitialised) {
@@ -337,4 +340,16 @@
 
   vdp->push_back(delta);
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+G4double G4BraggModel::MaxSecondaryEnergy(const G4ParticleDefinition* pd,
+					  G4double kinEnergy)
+{
+  if(pd != particle) SetParticle(pd);
+  G4double tau  = kinEnergy/mass;
+  G4double tmax = 2.0*electron_mass_c2*tau*(tau + 2.) /
+                  (1. + 2.0*(tau + 1.)*ratio + ratio*ratio);
+  return tmax;
 }
 
Index: trunk/source/processes/electromagnetic/standard/src/G4ComptonScattering.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4ComptonScattering.cc	(revision 991)
+++ trunk/source/processes/electromagnetic/standard/src/G4ComptonScattering.cc	(revision 1005)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4ComptonScattering.cc,v 1.30 2008/10/15 17:53:44 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4ComptonScattering.cc,v 1.31 2009/02/20 12:06:37 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // 
@@ -84,4 +84,11 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
+G4bool G4ComptonScattering::IsApplicable(const G4ParticleDefinition& p)
+{
+  return (&p == G4Gamma::Gamma());
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
 void G4ComptonScattering::InitialiseProcess(const G4ParticleDefinition*)
 {
Index: trunk/source/processes/electromagnetic/standard/src/G4CoulombScattering.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4CoulombScattering.cc	(revision 991)
+++ trunk/source/processes/electromagnetic/standard/src/G4CoulombScattering.cc	(revision 1005)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4CoulombScattering.cc,v 1.19 2008/10/15 17:53:44 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4CoulombScattering.cc,v 1.20 2009/02/20 12:06:37 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // -------------------------------------------------------------------
@@ -79,4 +79,11 @@
 G4CoulombScattering::~G4CoulombScattering()
 {}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+G4bool G4CoulombScattering::IsApplicable(const G4ParticleDefinition& p)
+{
+  return (p.GetPDGCharge() != 0.0 && !p.IsShortLived());
+}
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Index: trunk/source/processes/electromagnetic/standard/src/G4GammaConversion.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4GammaConversion.cc	(revision 991)
+++ trunk/source/processes/electromagnetic/standard/src/G4GammaConversion.cc	(revision 1005)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4GammaConversion.cc,v 1.30 2008/10/15 17:53:44 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4GammaConversion.cc,v 1.31 2009/02/20 12:06:37 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // 
@@ -90,4 +90,11 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
+G4bool G4GammaConversion::IsApplicable(const G4ParticleDefinition& p)
+{
+  return (&p == G4Gamma::Gamma());
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
 void G4GammaConversion::InitialiseProcess(const G4ParticleDefinition*)
 {
Index: trunk/source/processes/electromagnetic/standard/src/G4IonFluctuations.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4IonFluctuations.cc	(revision 991)
+++ trunk/source/processes/electromagnetic/standard/src/G4IonFluctuations.cc	(revision 1005)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4IonFluctuations.cc,v 1.24 2008/10/22 16:25:21 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4IonFluctuations.cc,v 1.25 2009/02/19 19:17:50 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // -------------------------------------------------------------------
@@ -420,2 +420,17 @@
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+void G4IonFluctuations::SetParticleAndCharge(const G4ParticleDefinition* part,
+					     G4double q2)
+{
+  if(part != particle) {
+    particle       = part;
+    particleMass   = part->GetPDGMass();
+    charge         = part->GetPDGCharge()/eplus;
+    chargeSquare   = charge*charge;
+  }
+  effChargeSquare  = q2;
+  uniFluct.SetParticleAndCharge(part, q2);
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Index: trunk/source/processes/electromagnetic/standard/src/G4MollerBhabhaModel.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4MollerBhabhaModel.cc	(revision 991)
+++ trunk/source/processes/electromagnetic/standard/src/G4MollerBhabhaModel.cc	(revision 1005)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4MollerBhabhaModel.cc,v 1.30 2007/05/22 17:34:36 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4MollerBhabhaModel.cc,v 1.31 2009/02/20 12:06:37 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // -------------------------------------------------------------------
@@ -74,8 +74,9 @@
                                          const G4String& nam)
   : G4VEmModel(nam),
-  particle(0),
-  isElectron(true),
-  twoln10(2.0*log(10.0)),
-  lowLimit(0.2*keV)
+    particle(0),
+    isElectron(true),
+    twoln10(2.0*log(10.0)),
+    lowLimit(0.2*keV),
+    isInitialised(false)
 {
   theElectron = G4Electron::Electron();
@@ -87,12 +88,4 @@
 G4MollerBhabhaModel::~G4MollerBhabhaModel()
 {}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
-
-void G4MollerBhabhaModel::SetParticle(const G4ParticleDefinition* p)
-{
-  particle = p;
-  if(p != theElectron) isElectron = false;
-}
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -108,13 +101,29 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 
+G4double G4MollerBhabhaModel::MaxSecondaryEnergy(const G4ParticleDefinition*,
+						 G4double kinEnergy) 
+{
+  G4double tmax = kinEnergy;
+  if(isElectron) tmax *= 0.5;
+  return tmax;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
 void G4MollerBhabhaModel::Initialise(const G4ParticleDefinition* p,
                                      const G4DataVector&)
 {
   if(!particle) SetParticle(p);
-  if(pParticleChange)
+  SetDeexcitationFlag(false);
+
+  if(isInitialised) return;
+
+  isInitialised = true;
+  if(pParticleChange) {
     fParticleChange = reinterpret_cast<G4ParticleChangeForLoss*>
                                                      (pParticleChange);
-  else
+  } else {
     fParticleChange = new G4ParticleChangeForLoss();
+  }
 }
 
Index: trunk/source/processes/electromagnetic/standard/src/G4PAIModel.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4PAIModel.cc	(revision 991)
+++ trunk/source/processes/electromagnetic/standard/src/G4PAIModel.cc	(revision 1005)
@@ -24,4 +24,10 @@
 // ********************************************************************
 //
+// $Id: G4PAIModel.cc,v 1.46 2009/02/19 19:17:50 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
+//
+// -------------------------------------------------------------------
+//
+// GEANT4 Class
 // File name:     G4PAIModel.cc
 //
@@ -177,4 +183,7 @@
       fCutCouple = theCoupleTable->GetMaterialCutsCouple( fMaterial, 
 					  curReg->GetProductionCuts() );
+      //G4cout << "Reg <" <<curReg->GetName() << ">  mat <" 
+      //	     << fMaterial->GetName() << ">  fCouple= " 
+      //	     << fCutCouple<<G4endl;
       if( fCutCouple ) {
 	fMaterialCutsCoupleVector.push_back(fCutCouple);
@@ -197,4 +206,9 @@
   }
 }
+
+//////////////////////////////////////////////////////////////////
+
+void G4PAIModel::InitialiseMe(const G4ParticleDefinition*) 
+{}
 
 //////////////////////////////////////////////////////////////////
@@ -393,5 +407,6 @@
   {
     //  if ( x1 == x2  ) dNdxCut = y1 + (y2 - y1)*G4UniformRand() ;
-    if ( std::abs(x1-x2) <= eV  ) dNdxCut = y1 + (y2 - y1)*G4UniformRand() ;
+    //    if ( std::abs(x1-x2) <= eV  ) dNdxCut = y1 + (y2 - y1)*G4UniformRand() ;
+    if ( std::abs(x1-x2) <= eV  ) dNdxCut = y1 + (y2 - y1)*0.5 ;
     else             dNdxCut = y1 + (transferCut - x1)*(y2 - y1)/(x2 - x1) ;      
   }
@@ -435,5 +450,6 @@
   {
     //  if ( x1 == x2  ) dEdxCut = y1 + (y2 - y1)*G4UniformRand() ;
-    if ( std::abs(x1-x2) <= eV  ) dEdxCut = y1 + (y2 - y1)*G4UniformRand() ;
+    //    if ( std::abs(x1-x2) <= eV  ) dEdxCut = y1 + (y2 - y1)*G4UniformRand() ;
+    if ( std::abs(x1-x2) <= eV  ) dEdxCut = y1 + (y2 - y1)*0.5 ;
     else             dEdxCut = y1 + (transferCut - x1)*(y2 - y1)/(x2 - x1) ;      
   }
@@ -444,15 +460,20 @@
 //////////////////////////////////////////////////////////////////////////////
 
-G4double G4PAIModel::ComputeDEDX(const G4MaterialCutsCouple* matCC,
-                                 const G4ParticleDefinition* p,
-                                       G4double kineticEnergy,
-                                       G4double cutEnergy)
+G4double G4PAIModel::ComputeDEDXPerVolume(const G4Material*,
+					  const G4ParticleDefinition* p,
+					  G4double kineticEnergy,
+					  G4double cutEnergy)
 {
   G4int iTkin,iPlace;
   size_t jMat;
+  
+  //G4double cut = std::min(MaxSecondaryEnergy(p, kineticEnergy), cutEnergy);
+  G4double cut = cutEnergy;
+
   G4double massRatio  = fMass/p->GetPDGMass();
   G4double scaledTkin = kineticEnergy*massRatio;
   G4double charge     = p->GetPDGCharge();
-  G4double charge2    = charge*charge, dEdx;
+  G4double charge2    = charge*charge;
+  const G4MaterialCutsCouple* matCC = CurrentCouple();
 
   for( jMat = 0 ;jMat < fMaterialCutsCoupleVector.size() ; ++jMat )
@@ -470,6 +491,5 @@
   iPlace = iTkin - 1;
   if(iPlace < 0) iPlace = 0;
-  dEdx = charge2*( (*fdEdxVector)(iPlace) - GetdEdxCut(iPlace,cutEnergy) ) ;  
-
+  G4double dEdx = charge2*( (*fdEdxVector)(iPlace) - GetdEdxCut(iPlace,cut) );
   if( dEdx < 0.) dEdx = 0.;
   return dEdx;
@@ -478,17 +498,19 @@
 /////////////////////////////////////////////////////////////////////////
 
-G4double G4PAIModel::CrossSection( const G4MaterialCutsCouple* matCC,
-                                   const G4ParticleDefinition* p,
-                                         G4double kineticEnergy,
-                                         G4double cutEnergy,
-                                         G4double maxEnergy  ) 
+G4double G4PAIModel::CrossSectionPerVolume( const G4Material*,
+					    const G4ParticleDefinition* p,
+					    G4double kineticEnergy,
+					    G4double cutEnergy,
+					    G4double maxEnergy  ) 
 {
   G4int iTkin,iPlace;
   size_t jMat;
-  G4double tmax = min(MaxSecondaryEnergy(p, kineticEnergy), maxEnergy);
+  G4double tmax = std::min(MaxSecondaryEnergy(p, kineticEnergy), maxEnergy);
+  if(tmax <= cutEnergy) return 0.0;
   G4double massRatio  = fMass/p->GetPDGMass();
   G4double scaledTkin = kineticEnergy*massRatio;
   G4double charge     = p->GetPDGCharge();
   G4double charge2    = charge*charge, cross, cross1, cross2;
+  const G4MaterialCutsCouple* matCC = CurrentCouple();
 
   for( jMat = 0 ;jMat < fMaterialCutsCoupleVector.size() ; ++jMat )
@@ -935,4 +957,27 @@
 }
 
+/////////////////////////////////////////////////////////////////////
+
+G4double G4PAIModel::MaxSecondaryEnergy( const G4ParticleDefinition* p,
+					 G4double kinEnergy) 
+{
+  G4double tmax = kinEnergy;
+  if(p == fElectron) tmax *= 0.5;
+  else if(p != fPositron) { 
+    G4double mass = p->GetPDGMass();
+    G4double ratio= electron_mass_c2/mass;
+    G4double gamma= kinEnergy/mass + 1.0;
+    tmax = 2.0*electron_mass_c2*(gamma*gamma - 1.) /
+                  (1. + 2.0*gamma*ratio + ratio*ratio);
+  }
+  return tmax;
+}
+
+///////////////////////////////////////////////////////////////
+
+void G4PAIModel::DefineForRegion(const G4Region* r) 
+{
+  fPAIRegionVector.push_back(r);
+}
 
 //
Index: trunk/source/processes/electromagnetic/standard/src/G4PAIPhotonModel.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4PAIPhotonModel.cc	(revision 991)
+++ trunk/source/processes/electromagnetic/standard/src/G4PAIPhotonModel.cc	(revision 1005)
@@ -24,4 +24,10 @@
 // ********************************************************************
 //
+// $Id: G4PAIPhotonModel.cc,v 1.21 2009/02/19 19:17:50 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
+//
+// -------------------------------------------------------------------
+//
+// GEANT4 Class 
 // File name:     G4PAIPhotonModel.cc
 //
@@ -217,4 +223,9 @@
 //////////////////////////////////////////////////////////////////
 
+void G4PAIPhotonModel::InitialiseMe(const G4ParticleDefinition*)
+{}
+
+//////////////////////////////////////////////////////////////////
+
 void G4PAIPhotonModel::ComputeSandiaPhotoAbsCof()
 {
@@ -487,5 +498,6 @@
   {
     //  if ( x1 == x2  ) dNdxCut = y1 + (y2 - y1)*G4UniformRand() ;
-    if ( std::abs(x1-x2) <= eV  ) dNdxCut = y1 + (y2 - y1)*G4UniformRand() ;
+    //    if ( std::abs(x1-x2) <= eV  ) dNdxCut = y1 + (y2 - y1)*G4UniformRand() ;
+    if ( std::abs(x1-x2) <= eV  ) dNdxCut = y1 + (y2 - y1)*0.5 ;
     else             dNdxCut = y1 + (transferCut - x1)*(y2 - y1)/(x2 - x1) ;      
   }
@@ -530,5 +542,6 @@
   {
     //  if ( x1 == x2  ) dNdxCut = y1 + (y2 - y1)*G4UniformRand() ;
-    if ( std::abs(x1-x2) <= eV  ) dNdxCut = y1 + (y2 - y1)*G4UniformRand() ;
+    //    if ( std::abs(x1-x2) <= eV  ) dNdxCut = y1 + (y2 - y1)*G4UniformRand() ;
+    if ( std::abs(x1-x2) <= eV  ) dNdxCut = y1 + (y2 - y1)*0.5 ;
     else             dNdxCut = y1 + (transferCut - x1)*(y2 - y1)/(x2 - x1) ;      
   }
@@ -574,5 +587,6 @@
   {
     //  if ( x1 == x2  ) dNdxCut = y1 + (y2 - y1)*G4UniformRand() ;
-    if ( std::abs(x1-x2) <= eV  ) dNdxCut = y1 + (y2 - y1)*G4UniformRand() ;
+    //    if ( std::abs(x1-x2) <= eV  ) dNdxCut = y1 + (y2 - y1)*G4UniformRand() ;
+    if ( std::abs(x1-x2) <= eV  ) dNdxCut = y1 + (y2 - y1)*0.5 ;
     else             dNdxCut = y1 + (transferCut - x1)*(y2 - y1)/(x2 - x1) ;      
   }
@@ -617,5 +631,6 @@
   {
     //  if ( x1 == x2  ) dEdxCut = y1 + (y2 - y1)*G4UniformRand() ;
-    if ( std::abs(x1-x2) <= eV  ) dEdxCut = y1 + (y2 - y1)*G4UniformRand() ;
+    //    if ( std::abs(x1-x2) <= eV  ) dEdxCut = y1 + (y2 - y1)*G4UniformRand() ;
+    if ( std::abs(x1-x2) <= eV  ) dEdxCut = y1 + (y2 - y1)*0.5 ;
     else             dEdxCut = y1 + (transferCut - x1)*(y2 - y1)/(x2 - x1) ;      
   }
@@ -626,11 +641,15 @@
 //////////////////////////////////////////////////////////////////////////////
 
-G4double G4PAIPhotonModel::ComputeDEDX(const G4MaterialCutsCouple* matCC,
-                                 const G4ParticleDefinition* p,
-                                       G4double kineticEnergy,
-                                       G4double cutEnergy)
+G4double G4PAIPhotonModel::ComputeDEDXPerVolume(const G4Material*,
+						const G4ParticleDefinition* p,
+						G4double kineticEnergy,
+						G4double cutEnergy)
 {
   G4int iTkin,iPlace;
   size_t jMat;
+
+  //G4double cut = std::min(MaxSecondaryEnergy(p, kineticEnergy), cutEnergy);
+  G4double cut = cutEnergy;
+
   G4double particleMass = p->GetPDGMass();
   G4double scaledTkin   = kineticEnergy*proton_mass_c2/particleMass;
@@ -638,4 +657,5 @@
   G4double charge2      = charge*charge;
   G4double dEdx         = 0.;
+  const G4MaterialCutsCouple* matCC = CurrentCouple();
 
   for( jMat = 0 ;jMat < fMaterialCutsCoupleVector.size() ; ++jMat )
@@ -653,5 +673,5 @@
   iPlace = iTkin - 1;
   if(iPlace < 0) iPlace = 0;
-  dEdx = charge2*( (*fdEdxVector)(iPlace) - GetdEdxCut(iPlace,cutEnergy) ) ;  
+  dEdx = charge2*( (*fdEdxVector)(iPlace) - GetdEdxCut(iPlace,cut) ) ;  
 
   if( dEdx < 0.) dEdx = 0.;
@@ -661,13 +681,14 @@
 /////////////////////////////////////////////////////////////////////////
 
-G4double G4PAIPhotonModel::CrossSection( const G4MaterialCutsCouple* matCC,
-                                   const G4ParticleDefinition* p,
-                                         G4double kineticEnergy,
-                                         G4double cutEnergy,
-                                         G4double maxEnergy  ) 
+G4double G4PAIPhotonModel::CrossSectionPerVolume( const G4Material*,
+						  const G4ParticleDefinition* p,
+						  G4double kineticEnergy,
+						  G4double cutEnergy,
+						  G4double maxEnergy  ) 
 {
   G4int iTkin,iPlace;
   size_t jMat, jMatCC;
-  G4double tmax = min(MaxSecondaryEnergy(p, kineticEnergy), maxEnergy);
+  G4double tmax = std::min(MaxSecondaryEnergy(p, kineticEnergy), maxEnergy);
+  if(cutEnergy >= tmax) return 0.0;
   G4double particleMass = p->GetPDGMass();
   G4double scaledTkin   = kineticEnergy*proton_mass_c2/particleMass;
@@ -675,4 +696,6 @@
   G4double charge2      = charge*charge, cross, cross1, cross2;
   G4double photon1, photon2, plasmon1, plasmon2;
+
+  const G4MaterialCutsCouple* matCC = CurrentCouple();
 
   const G4ProductionCutsTable* theCoupleTable=
@@ -1225,4 +1248,28 @@
 }
 
+/////////////////////////////////////////////////////////////////////
+
+G4double G4PAIPhotonModel::MaxSecondaryEnergy( const G4ParticleDefinition* p,
+                                                      G4double kinEnergy) 
+{
+  G4double tmax = kinEnergy;
+  if(p == fElectron) tmax *= 0.5;
+  else if(p != fPositron) { 
+    G4double mass = p->GetPDGMass();
+    G4double ratio= electron_mass_c2/mass;
+    G4double gamma= kinEnergy/mass + 1.0;
+    tmax = 2.0*electron_mass_c2*(gamma*gamma - 1.) /
+                  (1. + 2.0*gamma*ratio + ratio*ratio);
+  }
+  return tmax;
+}
+
+///////////////////////////////////////////////////////////////
+
+void G4PAIPhotonModel::DefineForRegion(const G4Region* r) 
+{
+  fPAIRegionVector.push_back(r);
+}
+
 
 //
Index: trunk/source/processes/electromagnetic/standard/src/G4PEEffectModel.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4PEEffectModel.cc	(revision 991)
+++ trunk/source/processes/electromagnetic/standard/src/G4PEEffectModel.cc	(revision 1005)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4PEEffectModel.cc,v 1.6 2007/05/22 17:34:36 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4PEEffectModel.cc,v 1.7 2009/02/20 12:06:37 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // -------------------------------------------------------------------
@@ -41,4 +41,6 @@
 //
 // 04.12.05 : SetProposedKineticEnergy(0.) for the killed photon (mma)
+// 20.02.09 : Added initialisation of deexcitation flag and method
+//            CrossSectionPerVolume instead of mfp (V.Ivanchenko)
 //
 // Class Description:
@@ -66,4 +68,5 @@
   theGamma    = G4Gamma::Gamma();
   theElectron = G4Electron::Electron();
+  fminimalEnergy = 1.0*eV;
 }
 
@@ -71,6 +74,5 @@
 
 G4PEEffectModel::~G4PEEffectModel()
-{
-}
+{}
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -79,12 +81,49 @@
 				 const G4DataVector&)
 {
- if (isInitialized) return;
- if (pParticleChange)
-   fParticleChange =
-                  reinterpret_cast<G4ParticleChangeForGamma*>(pParticleChange);
-  else
-   fParticleChange = new G4ParticleChangeForGamma();
-
- fminimalEnergy = 1.0*eV;
+  // always false before the run
+  SetDeexcitationFlag(false);
+
+  if (isInitialized) return;
+  if (pParticleChange) {
+    fParticleChange = reinterpret_cast<G4ParticleChangeForGamma*>(pParticleChange);
+  } else {
+    fParticleChange = new G4ParticleChangeForGamma();
+  }
+  isInitialized = true;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
+
+G4double G4PEEffectModel::ComputeCrossSectionPerAtom(const G4ParticleDefinition*,
+						     G4double energy,
+						     G4double Z, G4double,
+						     G4double, G4double)
+{
+  G4double* SandiaCof = G4SandiaTable::GetSandiaCofPerAtom((G4int)Z, energy);
+
+  G4double energy2 = energy*energy;
+  G4double energy3 = energy*energy2;
+  G4double energy4 = energy2*energy2;
+
+  return SandiaCof[0]/energy  + SandiaCof[1]/energy2 +
+    SandiaCof[2]/energy3 + SandiaCof[3]/energy4;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+G4double G4PEEffectModel::CrossSectionPerVolume(const G4Material* material,
+						const G4ParticleDefinition*,
+						G4double energy,
+						G4double, G4double)
+{
+  G4double* SandiaCof = 
+    material->GetSandiaTable()->GetSandiaCofForMaterial(energy);
+				
+  G4double energy2 = energy*energy;
+  G4double energy3 = energy*energy2;
+  G4double energy4 = energy2*energy2;
+	  
+  return SandiaCof[0]/energy  + SandiaCof[1]/energy2 +
+    SandiaCof[2]/energy3 + SandiaCof[3]/energy4; 
 }
 
Index: trunk/source/processes/electromagnetic/standard/src/G4PhotoElectricEffect.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4PhotoElectricEffect.cc	(revision 991)
+++ trunk/source/processes/electromagnetic/standard/src/G4PhotoElectricEffect.cc	(revision 1005)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4PhotoElectricEffect.cc,v 1.41 2008/10/16 14:12:32 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4PhotoElectricEffect.cc,v 1.42 2009/02/20 12:06:37 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 //
@@ -89,4 +89,11 @@
 {}
 
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+G4bool G4PhotoElectricEffect::IsApplicable(const G4ParticleDefinition& p)
+{
+  return (&p == G4Gamma::Gamma());
+}
+
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 
Index: trunk/source/processes/electromagnetic/standard/src/G4UniversalFluctuation.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4UniversalFluctuation.cc	(revision 991)
+++ trunk/source/processes/electromagnetic/standard/src/G4UniversalFluctuation.cc	(revision 1005)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4UniversalFluctuation.cc,v 1.16 2008/10/22 16:04:33 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4UniversalFluctuation.cc,v 1.17 2009/02/19 11:26:01 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // -------------------------------------------------------------------
@@ -305,3 +305,16 @@
 }
 
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+void 
+G4UniversalFluctuation::SetParticleAndCharge(const G4ParticleDefinition* part,
+					     G4double q2)
+{
+  if(part != particle) {
+    particle       = part;
+    particleMass   = part->GetPDGMass();
+  }
+  chargeSquare = q2;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Index: trunk/source/processes/electromagnetic/standard/src/G4WentzelVIModel.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4WentzelVIModel.cc	(revision 991)
+++ trunk/source/processes/electromagnetic/standard/src/G4WentzelVIModel.cc	(revision 1005)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4WentzelVIModel.cc,v 1.16 2008/11/19 11:47:50 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4WentzelVIModel.cc,v 1.17 2009/02/19 19:17:15 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // -------------------------------------------------------------------
@@ -60,6 +60,6 @@
 #include "G4LossTableManager.hh"
 #include "G4ParticleChangeForMSC.hh"
-#include "G4TransportationManager.hh"
-#include "G4SafetyHelper.hh"
+//#include "G4TransportationManager.hh"
+//#include "G4SafetyHelper.hh"
 #include "G4PhysicsTableHelper.hh"
 #include "G4ElementVector.hh"
@@ -138,7 +138,5 @@
       fParticleChange = new G4ParticleChangeForMSC();
 
-    safetyHelper = G4TransportationManager::GetTransportationManager()
-      ->GetSafetyHelper();
-    safetyHelper->InitialiseHelper();
+    InitialiseSafetyHelper();
   }
 }
@@ -277,5 +275,5 @@
   // i.e. when it is needed for optimization purposes
   if(stepStatus != fGeomBoundary && presafety < tlimitminfix) 
-    presafety = safetyHelper->ComputeSafety(sp->GetPosition()); 
+    presafety = ComputeSafety(sp->GetPosition(), tlimit); 
   /*
   G4cout << "G4WentzelVIModel::ComputeTruePathLengthLimit tlimit= " 
@@ -570,35 +568,6 @@
 
     if(r > tlimitminfix) {
-      G4ThreeVector Position = *(fParticleChange->GetProposedPosition());
-      G4double fac= 1.;
-      if(r >= safety) {
-	//  ******* so safety is computed at boundary too ************
-	G4double newsafety = 
-	  safetyHelper->ComputeSafety(Position) - tlimitminfix;
-        if(newsafety <= 0.0) fac = 0.0;
-	else if(r > newsafety) fac = newsafety/r ;
-        //G4cout << "NewSafety= " << newsafety << " fac= " << fac 
-	// << " r= " << r << " sint= " << sint << " pos " << Position << G4endl;
-      }  
-
-      if(fac > 0.) {
-	// compute new endpoint of the Step
-	G4ThreeVector newPosition = Position + fac*pos;
-
-	// check safety after displacement
-	G4double postsafety = safetyHelper->ComputeSafety(newPosition);
-
-	// displacement to boundary
-	if(postsafety <= 0.0) {
-	  safetyHelper->Locate(newPosition, newDirection);
-
-	  // not on the boundary
-	} else { 
-	  safetyHelper->ReLocateWithinVolume(newPosition);
-	  // if(fac < 1.0) G4cout << "NewPosition " << newPosition << G4endl;
-	}
-     
-	fParticleChange->ProposePosition(newPosition);
-      } 
+      pos /= r;
+      ComputeDisplacement(fParticleChange, pos, r, safety);
     }
   }
Index: trunk/source/processes/electromagnetic/standard/src/G4eBremsstrahlung.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4eBremsstrahlung.cc	(revision 991)
+++ trunk/source/processes/electromagnetic/standard/src/G4eBremsstrahlung.cc	(revision 1005)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4eBremsstrahlung.cc,v 1.55 2008/11/14 19:23:07 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4eBremsstrahlung.cc,v 1.56 2009/02/20 12:06:37 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // -------------------------------------------------------------------
@@ -104,4 +104,11 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
+G4bool G4eBremsstrahlung::IsApplicable(const G4ParticleDefinition& p)
+{
+  return (&p == G4Electron::Electron() || &p == G4Positron::Positron());
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
 void G4eBremsstrahlung::InitialiseEnergyLossProcess(
                                                 const G4ParticleDefinition* p,
Index: trunk/source/processes/electromagnetic/standard/src/G4eBremsstrahlungRelModel.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4eBremsstrahlungRelModel.cc	(revision 991)
+++ trunk/source/processes/electromagnetic/standard/src/G4eBremsstrahlungRelModel.cc	(revision 1005)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4eBremsstrahlungRelModel.cc,v 1.12 2008/11/13 23:28:27 schaelic Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4eBremsstrahlungRelModel.cc,v 1.13 2009/02/20 12:06:37 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // -------------------------------------------------------------------
Index: trunk/source/processes/electromagnetic/standard/src/G4eIonisation.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4eIonisation.cc	(revision 991)
+++ trunk/source/processes/electromagnetic/standard/src/G4eIonisation.cc	(revision 1005)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4eIonisation.cc,v 1.56 2008/10/20 08:56:41 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4eIonisation.cc,v 1.57 2009/02/20 12:06:37 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // -------------------------------------------------------------------
@@ -103,4 +103,22 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
+G4double G4eIonisation::MinPrimaryEnergy(const G4ParticleDefinition*,
+					 const G4Material*,
+					 G4double cut)
+{
+  G4double x = cut;
+  if(isElectron) x += cut;
+  return x;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+G4bool G4eIonisation::IsApplicable(const G4ParticleDefinition& p)
+{
+  return (&p == G4Electron::Electron() || &p == G4Positron::Positron());
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
 void G4eIonisation::InitialiseEnergyLossProcess(
 		    const G4ParticleDefinition* part,
Index: trunk/source/processes/electromagnetic/standard/src/G4eplusAnnihilation.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4eplusAnnihilation.cc	(revision 991)
+++ trunk/source/processes/electromagnetic/standard/src/G4eplusAnnihilation.cc	(revision 1005)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4eplusAnnihilation.cc,v 1.29 2008/10/15 17:53:44 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4eplusAnnihilation.cc,v 1.30 2009/02/20 12:06:37 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // -------------------------------------------------------------------
@@ -79,4 +79,20 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
+G4bool G4eplusAnnihilation::IsApplicable(const G4ParticleDefinition& p)
+{
+  return (&p == G4Positron::Positron());
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+G4double G4eplusAnnihilation::AtRestGetPhysicalInteractionLength(
+                              const G4Track&, G4ForceCondition* condition)
+{
+  *condition = NotForced;
+  return 0.0;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
 void G4eplusAnnihilation::InitialiseProcess(const G4ParticleDefinition*)
 {
Index: trunk/source/processes/electromagnetic/standard/src/G4hIonisation.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4hIonisation.cc	(revision 991)
+++ trunk/source/processes/electromagnetic/standard/src/G4hIonisation.cc	(revision 1005)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4hIonisation.cc,v 1.81 2008/10/22 16:02:20 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4hIonisation.cc,v 1.82 2009/02/20 12:06:37 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // -------------------------------------------------------------------
@@ -122,4 +122,23 @@
 {}
 
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+G4bool G4hIonisation::IsApplicable(const G4ParticleDefinition& p)
+{
+  return (p.GetPDGCharge() != 0.0 && p.GetPDGMass() > 10.0*MeV &&
+	 !p.IsShortLived());
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+G4double G4hIonisation::MinPrimaryEnergy(const G4ParticleDefinition*,
+					 const G4Material*,
+					 G4double cut)
+{
+  G4double x = 0.5*cut/electron_mass_c2;
+  G4double g = x*ratio + std::sqrt((1. + x)*(1. + x*ratio*ratio));
+  return mass*(g - 1.0);
+}
+
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....  
 
Index: trunk/source/processes/electromagnetic/standard/src/G4ionIonisation.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4ionIonisation.cc	(revision 991)
+++ trunk/source/processes/electromagnetic/standard/src/G4ionIonisation.cc	(revision 1005)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4ionIonisation.cc,v 1.65 2008/10/15 17:53:44 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4ionIonisation.cc,v 1.66 2009/02/20 12:06:37 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // -------------------------------------------------------------------
@@ -104,4 +104,22 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
+G4bool G4ionIonisation::IsApplicable(const G4ParticleDefinition& p)
+{
+  return (p.GetPDGCharge() != 0.0 && !p.IsShortLived() &&
+          p.GetParticleType() == "nucleus");
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+G4double G4ionIonisation::MinPrimaryEnergy(const G4ParticleDefinition* p, 
+					   const G4Material*, 
+					   G4double cut)
+{
+  return 
+    p->GetPDGMass()*(std::sqrt(1. + 0.5*cut/CLHEP::electron_mass_c2) - 1.0);
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
 void G4ionIonisation::InitialiseEnergyLossProcess(
 		      const G4ParticleDefinition* part,
