Index: trunk/source/processes/electromagnetic/muons/History
===================================================================
--- trunk/source/processes/electromagnetic/muons/History	(revision 1015)
+++ trunk/source/processes/electromagnetic/muons/History	(revision 1055)
@@ -1,3 +1,3 @@
-$Id: History,v 1.124 2008/11/13 14:14:07 vnivanch Exp $
+$Id: History,v 1.127 2009/04/12 17:19:01 vnivanch Exp $
 -------------------------------------------------------------------
 
@@ -17,4 +17,15 @@
      * Reverse chronological order (last date on top), please *
      ----------------------------------------------------------
+
+12 April 09: V.Ivant (emmuons-V09-02-02)
+G4MuBetheBlochModel, G4MuBremsstrahlungModel, G4MuPairProductionModel
+  - simplified initialisation
+
+26 February 09: V.Ivant (emmuons-V09-02-01)
+G4MuIonisation - fixed initialisation alowing to configure external model
+                 of fluctuations
+
+20 February 09: V.Ivant (emmuons-V09-02-00)
+- Cleanup: improved comments, move virtual methods from .hh to .cc
 
 12 November 08: V.Ivant (emmuons-V09-01-15)
Index: trunk/source/processes/electromagnetic/muons/include/G4MuBetheBlochModel.hh
===================================================================
--- trunk/source/processes/electromagnetic/muons/include/G4MuBetheBlochModel.hh	(revision 1015)
+++ trunk/source/processes/electromagnetic/muons/include/G4MuBetheBlochModel.hh	(revision 1055)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4MuBetheBlochModel.hh,v 1.17 2007/05/22 17:35:58 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4MuBetheBlochModel.hh,v 1.18 2009/02/20 14:48:16 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
 //
 // -------------------------------------------------------------------
@@ -76,8 +76,8 @@
   virtual ~G4MuBetheBlochModel();
 
-  void Initialise(const G4ParticleDefinition*, const G4DataVector&);
+  virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&);
 
-  G4double MinEnergyCut(const G4ParticleDefinition*,
-                        const G4MaterialCutsCouple*);
+  virtual G4double MinEnergyCut(const G4ParticleDefinition*,
+				const G4MaterialCutsCouple*);
 			
   virtual G4double ComputeCrossSectionPerElectron(
@@ -113,10 +113,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);
 
   // hide assignment operator
@@ -141,14 +141,14 @@
 };
 
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 
-inline G4double G4MuBetheBlochModel::MaxSecondaryEnergy(
-          const G4ParticleDefinition*,
-                G4double kinEnergy) 
+inline void G4MuBetheBlochModel::SetParticle(const G4ParticleDefinition* p)
 {
-  G4double tau  = kinEnergy/mass;
-  G4double tmax = 2.0*electron_mass_c2*tau*(tau + 2.) /
-                  (1. + 2.0*(tau + 1.)*ratio + ratio*ratio);
-  return tmax;
+  if(!particle) {
+    particle = p;
+    mass = particle->GetPDGMass();
+    massSquare = mass*mass;
+    ratio = electron_mass_c2/mass;
+  }
 }
 
Index: trunk/source/processes/electromagnetic/muons/include/G4MuBremsstrahlung.hh
===================================================================
--- trunk/source/processes/electromagnetic/muons/include/G4MuBremsstrahlung.hh	(revision 1015)
+++ trunk/source/processes/electromagnetic/muons/include/G4MuBremsstrahlung.hh	(revision 1055)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4MuBremsstrahlung.hh,v 1.30 2008/02/29 17:50:05 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4MuBremsstrahlung.hh,v 1.31 2009/02/20 14:48:16 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
 //
 // -------------------------------------------------------------------
@@ -86,17 +86,17 @@
   virtual ~G4MuBremsstrahlung();
 
-  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
-  void PrintInfo();
+  virtual void PrintInfo();
 
 protected:
 
-  void InitialiseEnergyLossProcess(const G4ParticleDefinition*,
-				   const G4ParticleDefinition*);
+  virtual void InitialiseEnergyLossProcess(const G4ParticleDefinition*,
+					   const G4ParticleDefinition*);
 
 private:
@@ -114,23 +114,4 @@
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline 
-G4bool G4MuBremsstrahlung::IsApplicable(const G4ParticleDefinition& p)
-{
-  return (p.GetPDGCharge() != 0.0 && p.GetPDGMass() > 10.0*MeV);
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline 
-G4double G4MuBremsstrahlung::MinPrimaryEnergy(const G4ParticleDefinition*,
-					      const G4Material*,
-					      G4double)
-{
-  return lowestKinEnergy;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
 #endif
Index: trunk/source/processes/electromagnetic/muons/include/G4MuBremsstrahlungModel.hh
===================================================================
--- trunk/source/processes/electromagnetic/muons/include/G4MuBremsstrahlungModel.hh	(revision 1015)
+++ trunk/source/processes/electromagnetic/muons/include/G4MuBremsstrahlungModel.hh	(revision 1055)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4MuBremsstrahlungModel.hh,v 1.21 2008/07/22 16:11:34 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4MuBremsstrahlungModel.hh,v 1.22 2009/02/20 14:48:16 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
 //
 // -------------------------------------------------------------------
@@ -78,10 +78,8 @@
   virtual ~G4MuBremsstrahlungModel();
 
-  void SetParticle(const G4ParticleDefinition*);
+  virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&);
 
-  void Initialise(const G4ParticleDefinition*, const G4DataVector&);
-
-  G4double MinEnergyCut(const G4ParticleDefinition*,
-                        const G4MaterialCutsCouple*);
+  virtual G4double MinEnergyCut(const G4ParticleDefinition*,
+				const G4MaterialCutsCouple*);
 			      
   virtual G4double ComputeCrossSectionPerAtom(
@@ -97,9 +95,9 @@
                                 G4double cutEnergy);
 			      
-  void SampleSecondaries(std::vector<G4DynamicParticle*>*,
-			 const G4MaterialCutsCouple*,
-			 const G4DynamicParticle*,
-			 G4double tmin,
-			 G4double maxEnergy);
+  virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
+				 const G4MaterialCutsCouple*,
+				 const G4DynamicParticle*,
+				 G4double tmin,
+				 G4double maxEnergy);
 
   inline void SetLowestKineticEnergy(G4double e);
@@ -117,6 +115,5 @@
 						   G4double gammaEnergy);
 
-  G4double MaxSecondaryEnergy(const G4ParticleDefinition*,
-			      G4double kineticEnergy);
+  inline void SetParticle(const G4ParticleDefinition*);
 
 private:
@@ -160,25 +157,7 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 
-inline 
-G4double G4MuBremsstrahlungModel::MaxSecondaryEnergy(const G4ParticleDefinition*,
-						     G4double kineticEnergy)
-{
-  return kineticEnergy;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
-
 inline void G4MuBremsstrahlungModel::SetLowestKineticEnergy(G4double e) 
 {
   lowestKinEnergy = e;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
-
-inline
-G4double G4MuBremsstrahlungModel::MinEnergyCut(const G4ParticleDefinition*,
-                                               const G4MaterialCutsCouple*)
-{
-  return minThreshold;
 }
 
Index: trunk/source/processes/electromagnetic/muons/include/G4MuIonisation.hh
===================================================================
--- trunk/source/processes/electromagnetic/muons/include/G4MuIonisation.hh	(revision 1015)
+++ trunk/source/processes/electromagnetic/muons/include/G4MuIonisation.hh	(revision 1055)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4MuIonisation.hh,v 1.30 2007/05/23 08:49:32 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4MuIonisation.hh,v 1.31 2009/02/20 14:48:16 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
 //
 // -------------------------------------------------------------------
@@ -95,11 +95,11 @@
   virtual ~G4MuIonisation();
 
-  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
-  void PrintInfo();
+  virtual void PrintInfo();
 
 protected:
@@ -127,23 +127,4 @@
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4bool G4MuIonisation::IsApplicable(const G4ParticleDefinition& p)
-{
-  return (p.GetPDGCharge() != 0.0 && p.GetPDGMass() > 10.0*MeV);
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline G4double G4MuIonisation::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....
 
 #endif
Index: trunk/source/processes/electromagnetic/muons/include/G4MuPairProduction.hh
===================================================================
--- trunk/source/processes/electromagnetic/muons/include/G4MuPairProduction.hh	(revision 1015)
+++ trunk/source/processes/electromagnetic/muons/include/G4MuPairProduction.hh	(revision 1055)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4MuPairProduction.hh,v 1.30 2008/02/29 17:50:05 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4MuPairProduction.hh,v 1.31 2009/02/20 14:48:16 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
 //
 // -------------------------------------------------------------------
@@ -84,16 +84,16 @@
   virtual ~G4MuPairProduction();
 
-  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
-  void PrintInfo();
+  virtual void PrintInfo();
 
 protected:
 
-  void InitialiseEnergyLossProcess(const G4ParticleDefinition*,
-				   const G4ParticleDefinition*);
+  virtual void InitialiseEnergyLossProcess(const G4ParticleDefinition*,
+					   const G4ParticleDefinition*);
 
 private:
@@ -113,23 +113,4 @@
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline 
-G4bool G4MuPairProduction::IsApplicable(const G4ParticleDefinition& p)
-{
-  return (p.GetPDGCharge() != 0.0 && p.GetPDGMass() > 10.0*MeV);
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
-
-inline 
-G4double G4MuPairProduction::MinPrimaryEnergy(const G4ParticleDefinition*,
-					      const G4Material*,
-					      G4double)
-{
-  return lowestKinEnergy;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
 #endif
Index: trunk/source/processes/electromagnetic/muons/include/G4MuPairProductionModel.hh
===================================================================
--- trunk/source/processes/electromagnetic/muons/include/G4MuPairProductionModel.hh	(revision 1015)
+++ trunk/source/processes/electromagnetic/muons/include/G4MuPairProductionModel.hh	(revision 1055)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4MuPairProductionModel.hh,v 1.27 2008/07/22 16:11:34 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4MuPairProductionModel.hh,v 1.28 2009/02/20 14:48:16 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
 //
 // -------------------------------------------------------------------
@@ -79,5 +79,5 @@
   virtual ~G4MuPairProductionModel();
 
-  void Initialise(const G4ParticleDefinition*, const G4DataVector&);
+  virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&);
 
 			
@@ -100,8 +100,8 @@
 				 G4double maxEnergy);
 
+  virtual G4double MinEnergyCut(const G4ParticleDefinition*,
+			       const G4MaterialCutsCouple*);
+
   inline void SetLowestKineticEnergy(G4double e);
-
-  inline G4double MinEnergyCut(const G4ParticleDefinition*,
-			       const G4MaterialCutsCouple*);
 
   inline void SetParticle(const G4ParticleDefinition*);
@@ -120,6 +120,6 @@
 						   G4double pairEnergy);
 
-  inline G4double MaxSecondaryEnergy(const G4ParticleDefinition*,
-				     G4double kineticEnergy);
+  virtual G4double MaxSecondaryEnergy(const G4ParticleDefinition*,
+				      G4double kineticEnergy);
 
   inline void SetCurrentElement(G4double Z);
@@ -193,13 +193,4 @@
 
 inline
-G4double G4MuPairProductionModel::MinEnergyCut(const G4ParticleDefinition*,
-                                               const G4MaterialCutsCouple* )
-{
-  return minPairEnergy;
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
-
-inline
 void G4MuPairProductionModel::SetParticle(const G4ParticleDefinition* p)
 {
@@ -208,14 +199,4 @@
     particleMass = particle->GetPDGMass();
   }
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
-
-inline G4double G4MuPairProductionModel::MaxSecondaryEnergy(
-                                 const G4ParticleDefinition*,
-    				       G4double kineticEnergy)
-{
-  G4double maxPairEnergy = kineticEnergy + particleMass*(1.0 - 0.75*sqrte*z13);
-  return maxPairEnergy;
 }
 
Index: trunk/source/processes/electromagnetic/muons/src/G4MuBetheBlochModel.cc
===================================================================
--- trunk/source/processes/electromagnetic/muons/src/G4MuBetheBlochModel.cc	(revision 1015)
+++ trunk/source/processes/electromagnetic/muons/src/G4MuBetheBlochModel.cc	(revision 1055)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4MuBetheBlochModel.cc,v 1.24 2008/03/25 12:31:04 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4MuBetheBlochModel.cc,v 1.26 2009/04/12 17:19:01 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
 //
 // -------------------------------------------------------------------
@@ -88,4 +88,5 @@
   theElectron = G4Electron::Electron();
   corr = G4LossTableManager::Instance()->EmCorrections();
+  fParticleChange = 0;
 
   if(p) SetParticle(p);
@@ -99,16 +100,4 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 
-void G4MuBetheBlochModel::SetParticle(const G4ParticleDefinition* p)
-{
-  if(!particle) {
-    particle = p;
-    mass = particle->GetPDGMass();
-    massSquare = mass*mass;
-    ratio = electron_mass_c2/mass;
-  }
-}
-
-//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
-
 G4double G4MuBetheBlochModel::MinEnergyCut(const G4ParticleDefinition*,
                                            const G4MaterialCutsCouple* couple)
@@ -117,4 +106,15 @@
 }
 
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
+
+G4double G4MuBetheBlochModel::MaxSecondaryEnergy(const G4ParticleDefinition*,
+						 G4double kinEnergy) 
+{
+  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......
 
@@ -123,10 +123,5 @@
 {
   if(p) SetParticle(p);
-
-  if(pParticleChange)
-    fParticleChange = reinterpret_cast<G4ParticleChangeForLoss*>
-                                                             (pParticleChange);
-  else
-    fParticleChange = new G4ParticleChangeForLoss();
+  if(!fParticleChange) fParticleChange = GetParticleChangeForLoss();
 }
 
Index: trunk/source/processes/electromagnetic/muons/src/G4MuBremsstrahlung.cc
===================================================================
--- trunk/source/processes/electromagnetic/muons/src/G4MuBremsstrahlung.cc	(revision 1015)
+++ trunk/source/processes/electromagnetic/muons/src/G4MuBremsstrahlung.cc	(revision 1055)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4MuBremsstrahlung.cc,v 1.41 2008/10/16 13:37:04 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4MuBremsstrahlung.cc,v 1.42 2009/02/20 14:48:16 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
 //
 // -------------------------------------------------------------------
@@ -93,4 +93,20 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
+G4bool G4MuBremsstrahlung::IsApplicable(const G4ParticleDefinition& p)
+{
+  return (p.GetPDGCharge() != 0.0 && p.GetPDGMass() > 10.0*MeV);
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+G4double G4MuBremsstrahlung::MinPrimaryEnergy(const G4ParticleDefinition*,
+					      const G4Material*,
+					      G4double)
+{
+  return lowestKinEnergy;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
 void G4MuBremsstrahlung::InitialiseEnergyLossProcess(
 				 const G4ParticleDefinition* part,
Index: trunk/source/processes/electromagnetic/muons/src/G4MuBremsstrahlungModel.cc
===================================================================
--- trunk/source/processes/electromagnetic/muons/src/G4MuBremsstrahlungModel.cc	(revision 1015)
+++ trunk/source/processes/electromagnetic/muons/src/G4MuBremsstrahlungModel.cc	(revision 1055)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4MuBremsstrahlungModel.cc,v 1.32 2008/07/22 16:11:34 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4MuBremsstrahlungModel.cc,v 1.35 2009/04/12 17:48:45 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
 //
 // -------------------------------------------------------------------
@@ -111,4 +111,12 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 
+G4double G4MuBremsstrahlungModel::MinEnergyCut(const G4ParticleDefinition*,
+                                               const G4MaterialCutsCouple*)
+{
+  return minThreshold;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
 void G4MuBremsstrahlungModel::Initialise(const G4ParticleDefinition* p,
                                          const G4DataVector& cuts)
@@ -131,5 +139,5 @@
     if(nn > 0) {
       for (G4int ii=0; ii<nn; ii++){
-	G4DataVector* a=partialSumSigma[ii];
+	G4DataVector* a = partialSumSigma[ii];
 	if ( a )  delete a;    
       } 
@@ -154,11 +162,5 @@
 
   // define pointer to G4ParticleChange
-  if(!fParticleChange) {
-    if(pParticleChange)
-      fParticleChange = 
-	reinterpret_cast<G4ParticleChangeForLoss*>(pParticleChange);
-    else
-      fParticleChange = new G4ParticleChangeForLoss();
-  }
+  if(!fParticleChange) fParticleChange = GetParticleChangeForLoss();
 }
 
Index: trunk/source/processes/electromagnetic/muons/src/G4MuIonisation.cc
===================================================================
--- trunk/source/processes/electromagnetic/muons/src/G4MuIonisation.cc	(revision 1015)
+++ trunk/source/processes/electromagnetic/muons/src/G4MuIonisation.cc	(revision 1055)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4MuIonisation.cc,v 1.57 2008/10/27 10:55:07 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4MuIonisation.cc,v 1.59 2009/02/26 11:04:20 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
 //
 // -------------------------------------------------------------------
@@ -86,4 +86,5 @@
 #include "G4MuBetheBlochModel.hh"
 #include "G4UniversalFluctuation.hh"
+#include "G4IonFluctuations.hh"
 #include "G4BohrFluctuations.hh"
 #include "G4UnitsTable.hh"
@@ -112,4 +113,22 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
+G4bool G4MuIonisation::IsApplicable(const G4ParticleDefinition& p)
+{
+  return (p.GetPDGCharge() != 0.0 && p.GetPDGMass() > 10.0*MeV);
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+G4double G4MuIonisation::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....
+
 void G4MuIonisation::InitialiseEnergyLossProcess(const G4ParticleDefinition* part,
                                                  const G4ParticleDefinition* bpart)
@@ -123,18 +142,24 @@
     SetSecondaryParticle(G4Electron::Electron());
 
-    flucModel = new G4UniversalFluctuation();
+    // Bragg peak model
+    if (!EmModel(1)) SetEmModel(new G4BraggModel(),1);
+    EmModel(1)->SetLowEnergyLimit(MinKinEnergy());
+    EmModel(1)->SetHighEnergyLimit(0.2*MeV);
+    AddEmModel(1, EmModel(1), new G4IonFluctuations());
 
-    G4VEmModel* em = new G4BraggModel();
-    em->SetLowEnergyLimit(MinKinEnergy());
-    em->SetHighEnergyLimit(0.2*MeV);
-    AddEmModel(1, em, flucModel);
-    G4VEmModel* em1 = new G4BetheBlochModel();
-    em1->SetLowEnergyLimit(0.2*MeV);
-    em1->SetHighEnergyLimit(1.0*GeV);
-    AddEmModel(2, em1, flucModel);
-    G4VEmModel* em2 = new G4MuBetheBlochModel();
-    em2->SetLowEnergyLimit(1.0*GeV);
-    em2->SetHighEnergyLimit(MaxKinEnergy());
-    AddEmModel(3, em2, flucModel);
+    // high energy fluctuation model
+    if (!FluctModel()) SetFluctModel(new G4UniversalFluctuation());
+
+    // moderate energy model
+    if (!EmModel(2)) SetEmModel(new G4BetheBlochModel(),2);
+    EmModel(2)->SetLowEnergyLimit(0.2*MeV);
+    EmModel(2)->SetHighEnergyLimit(1.0*GeV);
+    AddEmModel(2, EmModel(2), FluctModel());
+
+    // high energy model
+    if (!EmModel(3)) SetEmModel(new G4MuBetheBlochModel(),3);
+    EmModel(3)->SetLowEnergyLimit(1.0*GeV);
+    EmModel(3)->SetHighEnergyLimit(MaxKinEnergy());
+    AddEmModel(3, EmModel(3), FluctModel());
 
     ratio = electron_mass_c2/mass;
Index: trunk/source/processes/electromagnetic/muons/src/G4MuPairProduction.cc
===================================================================
--- trunk/source/processes/electromagnetic/muons/src/G4MuPairProduction.cc	(revision 1015)
+++ trunk/source/processes/electromagnetic/muons/src/G4MuPairProduction.cc	(revision 1055)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4MuPairProduction.cc,v 1.51 2008/10/16 13:37:04 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4MuPairProduction.cc,v 1.52 2009/02/20 14:48:16 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
 //
 // -------------------------------------------------------------------
@@ -100,4 +100,20 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 
+G4bool G4MuPairProduction::IsApplicable(const G4ParticleDefinition& p)
+{
+  return (p.GetPDGCharge() != 0.0 && p.GetPDGMass() > 10.0*MeV);
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+G4double G4MuPairProduction::MinPrimaryEnergy(const G4ParticleDefinition*,
+					      const G4Material*,
+					      G4double)
+{
+  return lowestKinEnergy;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
 void G4MuPairProduction::InitialiseEnergyLossProcess(
                          const G4ParticleDefinition* part,
Index: trunk/source/processes/electromagnetic/muons/src/G4MuPairProductionModel.cc
===================================================================
--- trunk/source/processes/electromagnetic/muons/src/G4MuPairProductionModel.cc	(revision 1015)
+++ trunk/source/processes/electromagnetic/muons/src/G4MuPairProductionModel.cc	(revision 1055)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4MuPairProductionModel.cc,v 1.39 2008/07/22 16:11:34 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4MuPairProductionModel.cc,v 1.41 2009/04/12 17:19:01 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
 //
 // -------------------------------------------------------------------
@@ -137,4 +137,21 @@
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 
+G4double G4MuPairProductionModel::MinEnergyCut(const G4ParticleDefinition*,
+                                               const G4MaterialCutsCouple* )
+{
+  return minPairEnergy;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+G4double G4MuPairProductionModel::MaxSecondaryEnergy(const G4ParticleDefinition*,
+						     G4double kineticEnergy)
+{
+  G4double maxPairEnergy = kineticEnergy + particleMass*(1.0 - 0.75*sqrte*z13);
+  return maxPairEnergy;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
 void G4MuPairProductionModel::Initialise(const G4ParticleDefinition* p,
                                          const G4DataVector&)
@@ -144,11 +161,5 @@
     MakeSamplingTables();
   }
-  if(!fParticleChange) {
-    if(pParticleChange) 
-      fParticleChange = 
-	reinterpret_cast<G4ParticleChangeForLoss*>(pParticleChange);
-    else 
-      fParticleChange = new G4ParticleChangeForLoss();
-  }
+  if(!fParticleChange) fParticleChange = GetParticleChangeForLoss();
 }
 
