Index: trunk/source/processes/electromagnetic/adjoint/include/G4AdjointIonIonisationModel.hh
===================================================================
--- trunk/source/processes/electromagnetic/adjoint/include/G4AdjointIonIonisationModel.hh	(revision 1197)
+++ trunk/source/processes/electromagnetic/adjoint/include/G4AdjointIonIonisationModel.hh	(revision 1197)
@@ -0,0 +1,152 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4AdjointIonIonisationModel.hh,v 1.2 2009/11/20 10:31:20 ldesorgh Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
+//
+/////////////////////////////////////////////////////////////////////////////////
+//      Class:		G4IonIonisationModel
+//	Author:       	L. Desorgher
+// 	Organisation: 	SpaceIT GmbH
+//	Contract:	ESA contract 21435/08/NL/AT
+// 	Customer:     	ESA/ESTEC
+/////////////////////////////////////////////////////////////////////////////////
+//
+// CHANGE HISTORY
+// --------------
+//      ChangeHistory: 
+//	 	26th August 2009 creation by L. Desorgher  		
+//
+//-------------------------------------------------------------
+//	Documentation:
+//		Adjoint EM model for discrete reverse ion ionisation
+//
+
+#ifndef G4AdjointIonIonisationModel_h
+#define G4AdjointIonIonisationModel_h 1
+
+#include "globals.hh"
+#include "G4DynamicParticle.hh"
+#include "G4ParticleDefinition.hh"
+#include "G4MaterialCutsCouple.hh"
+#include "G4Material.hh"
+#include "G4Element.hh"
+#include "G4ElementVector.hh"
+#include "Randomize.hh"
+#include "G4ParticleDefinition.hh"
+#include "G4VEmModel.hh"
+#include "G4Electron.hh"
+#include "G4Gamma.hh"
+#include "G4ProductionCutsTable.hh"
+#include "G4VEmAdjointModel.hh"
+class G4PhysicsTable;
+class G4Region;
+class G4VParticleChange;
+class G4ParticleChange;
+class G4Track;
+class G4AdjointCSMatrix;
+
+
+class G4AdjointIonIonisationModel: public G4VEmAdjointModel
+{
+
+public:
+
+  G4AdjointIonIonisationModel();
+
+  virtual ~G4AdjointIonIonisationModel();
+  
+  
+  virtual void SampleSecondaries(const G4Track& aTrack,
+                                G4bool IsScatProjToProjCase,
+				G4ParticleChange* fParticleChange);
+
+
+  virtual G4double DiffCrossSectionPerAtomPrimToSecond(
+                                      G4double kinEnergyProj,  // kinetic energy of the primary particle before the interaction 
+                                      G4double kinEnergyProd, // kinetic energy of the secondary particle 
+				      G4double Z, 
+                                      G4double A = 0.);
+  
+  virtual void CorrectPostStepWeight(G4ParticleChange* fParticleChange, 
+  				     G4double old_weight, 
+				     G4double adjointPrimKinEnergy, 
+				     G4double projectileKinEnergy,
+				     G4bool IsScatProjToProjCase);				      				      
+ 
+  //Set/Get methods
+  //------------------
+  
+  virtual G4double GetSecondAdjEnergyMaxForScatProjToProjCase(G4double PrimAdjEnergy);
+  virtual G4double GetSecondAdjEnergyMinForScatProjToProjCase(G4double PrimAdjEnergy,G4double Tcut=0);
+  virtual G4double GetSecondAdjEnergyMaxForProdToProjCase(G4double PrimAdjEnergy);
+  virtual G4double GetSecondAdjEnergyMinForProdToProjCase(G4double PrimAdjEnergy);
+  
+  inline void SetUseOnlyBragg(G4bool aBool){use_only_bragg =aBool;}
+  
+  
+  void SetIon(G4ParticleDefinition* adj_ion, G4ParticleDefinition* fwd_ion);
+ 
+
+private: //Methods
+     
+    
+  void DefineProjectileProperty();
+  
+  //projectile property
+  G4double mass;
+  G4double tlimit;
+  G4double spin;
+  G4double magMoment2;
+  G4double chargeSquare;
+  G4double massRatio;
+  
+  G4double ratio, ratio2; 
+  G4double one_plus_ratio_2;
+  G4double formfact;
+  G4double twoln10;
+  G4double bg2lim;
+  G4double taulim;
+  G4double corrFactor;
+  G4bool   isIon;
+  G4double one_minus_ratio_2;
+  
+  G4bool use_only_bragg;
+  
+  
+  G4VEmModel* theBraggIonDirectEMModel; 
+  G4VEmModel* theBetheBlochDirectEMModel;				    
+
+  
+
+   
+   
+
+  
+};
+
+
+#endif
+
Index: trunk/source/processes/electromagnetic/adjoint/include/G4AdjointProcessEquivalentToDirectProcess.hh
===================================================================
--- trunk/source/processes/electromagnetic/adjoint/include/G4AdjointProcessEquivalentToDirectProcess.hh	(revision 1197)
+++ trunk/source/processes/electromagnetic/adjoint/include/G4AdjointProcessEquivalentToDirectProcess.hh	(revision 1197)
@@ -0,0 +1,173 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4AdjointProcessEquivalentToDirectProcess.hh,v 1.2 2009/11/20 10:31:20 ldesorgh Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
+//
+/////////////////////////////////////////////////////////////////////////////////
+//      Class:		G4AdjointProcessEquivalentToDirectProcess
+//	Author:       	L. Desorgher
+// 	Organisation: 	SpaceIT GmbH
+//	Contract:	ESA contract 21435/08/NL/AT
+// 	Customer:     	ESA/ESTEC
+/////////////////////////////////////////////////////////////////////////////////
+//
+// CHANGE HISTORY
+// --------------
+//      ChangeHistory: 
+//	 	25 Sept. 2009 Created by L.Desorgher. Inspired from G4WrapperProcess  		
+//
+//-------------------------------------------------------------
+//	Documentation:
+//		Adjoint process equivalent to direct process, used for some multiple scattering
+//
+// 
+
+
+#ifndef G4AdjointProcessEquivalentToDirectProcess_h 
+#define G4AdjointProcessEquivalentToDirectProcess_h 1
+
+#include "globals.hh"
+#include "G4ios.hh"
+#include "G4VProcess.hh"
+
+class G4AdjointProcessEquivalentToDirectProcess : public G4VProcess
+{
+  //  A virtual class for wrapper process objects.
+
+  public: // with description
+  //  constructor requires the process name and type
+      G4AdjointProcessEquivalentToDirectProcess(const G4String& aName, G4VProcess* aProcess,G4ParticleDefinition* fwd_particle_def);
+
+ 
+
+  public: 
+  //  destructor 
+      virtual ~G4AdjointProcessEquivalentToDirectProcess();
+
+ 
+  public: // with description
+  ////////////////////////////
+  // DoIt    /////////////////
+  ///////////////////////////
+      virtual G4VParticleChange* PostStepDoIt(
+                             const G4Track& track,
+                             const G4Step&  stepData
+                            );
+
+      virtual G4VParticleChange* AlongStepDoIt(
+                             const G4Track& track,
+                             const G4Step& stepData
+                            );
+      virtual G4VParticleChange* AtRestDoIt(
+                             const G4Track& track,
+                             const G4Step& stepData
+                            );
+  //////////////////////////
+  // GPIL    //////////////
+  /////////////////////////  
+      virtual G4double AlongStepGetPhysicalInteractionLength(
+                             const G4Track& track,
+                             G4double  previousStepSize,
+                             G4double  currentMinimumStep,
+                             G4double& proposedSafety,
+                             G4GPILSelection* selection);
+
+      virtual G4double AtRestGetPhysicalInteractionLength(
+                             const G4Track& track,
+                             G4ForceCondition* condition
+                            );
+
+      virtual G4double PostStepGetPhysicalInteractionLength(
+                             const G4Track& track,
+                             G4double   previousStepSize,
+                             G4ForceCondition* condition
+                            ) ;
+  
+  ////////////////////// 
+      virtual G4bool IsApplicable(const G4ParticleDefinition&);
+      // Returns true if this process object is applicable to
+      // the particle type
+      // Process will not be registered to a particle if IsApplicable is false   
+
+      virtual void BuildPhysicsTable(const G4ParticleDefinition&);
+      // Messaged by the Particle definition (via the Process manager)
+      // whenever cross section tables have to be rebuilt (i.e. if new
+      // materials have been defined). 
+      // It is overloaded by individual processes when they need physics
+      // tables. 
+
+      // Processes which Build (for example in their
+      // constructors) physics tables independent of cuts
+      // should preferably use a
+      // private void BuildThePhysicsTable()
+      // function. Not another BuildPhysicsTable, please.
+ 
+      virtual void PreparePhysicsTable(const G4ParticleDefinition&);
+      // Messaged by the Particle definition (via the Process manager)
+      // whenever cross section tables have to be prepare for rebuilt 
+      // (i.e. if new materials have been defined). 
+      // It is overloaded by individual processes when they need physics
+      // tables. 
+
+      // Processes which Build physics tables independent of cuts
+      // (for example in their constructors)
+      // should preferably use private 
+      // void BuildThePhysicsTable() and void PreparePhysicsTable().
+      // Not another BuildPhysicsTable, please.
+
+
+      virtual G4bool StorePhysicsTable(const G4ParticleDefinition* ,
+                                       const G4String& directory, 
+                                       G4bool          ascii = false); 
+      // Store PhysicsTable in a file. 
+      // (return false in case of failure at I/O ) 
+ 
+      virtual G4bool RetrievePhysicsTable( const G4ParticleDefinition* ,
+                                           const G4String& directory, 
+                                           G4bool          ascii = false);
+      // Retrieve Physics from a file. 
+      // (return true if the Physics Table can be build by using file)
+      // (return false if the process has no functionality or in case of failure)
+      // File name should be defined by each process 
+      // and the file should be placed under the directory specifed by the argument. 
+  ////////////////////////////
+      virtual void StartTracking(G4Track*);
+      virtual void EndTracking();
+      // inform Start/End of tracking for each track to the physics process 
+ 
+ 
+  
+   public:
+      virtual void      ResetNumberOfInteractionLengthLeft();
+      // reset (determine the value of)NumberOfInteractionLengthLeft
+   private:
+      G4ParticleDefinition* theFwdParticleDef; 
+      G4VProcess* theDirectProcess;  
+
+};
+
+
+#endif
Index: trunk/source/processes/electromagnetic/adjoint/include/G4AdjointeIonisationModel.hh
===================================================================
--- trunk/source/processes/electromagnetic/adjoint/include/G4AdjointeIonisationModel.hh	(revision 1197)
+++ trunk/source/processes/electromagnetic/adjoint/include/G4AdjointeIonisationModel.hh	(revision 1197)
@@ -0,0 +1,85 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4AdjointeIonisationModel.hh,v 1.2 2009/11/20 10:31:20 ldesorgh Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
+//
+/////////////////////////////////////////////////////////////////////////////////
+//      Module:		G4AdjointeIonisationModel
+//	Author:       	L. Desorgher
+// 	Organisation: 	SpaceIT GmbH
+//	Contract:	ESA contract 21435/08/NL/AT
+// 	Customer:     	ESA/ESTEC
+/////////////////////////////////////////////////////////////////////////////////
+//
+// CHANGE HISTORY
+// --------------
+//      ChangeHistory: 
+//	 	 September 2009 creation by L. Desorgher. Separate the concrete ionisation stuff from G4VEMAdjointModel  		
+//
+//-------------------------------------------------------------
+//	Documentation:
+//		Adjoint EM model for discrete reverse e- ionisation
+//
+
+#ifndef G4AdjointeIonisationModel_h
+#define G4AdjointeIonisationModel_h 1
+
+#include "globals.hh"
+#include "G4VEmAdjointModel.hh"
+#include "G4PEEffectModel.hh"
+
+class G4AdjointeIonisationModel: public G4VEmAdjointModel
+{
+
+public: //methods
+
+//Constructor, destructor
+  G4AdjointeIonisationModel();
+
+  virtual ~G4AdjointeIonisationModel();
+
+//Concrete implementation or virtual methods
+  
+  virtual void SampleSecondaries(const G4Track& aTrack,
+                                G4bool IsScatProjToProjCase,
+				G4ParticleChange* fParticleChange);
+  
+  virtual G4double DiffCrossSectionPerAtomPrimToSecond(
+                                      G4double kinEnergyProj,  // kinetic energy of the primary particle before the interaction 
+                                      G4double kinEnergyProd, // kinetic energy of the secondary particle 
+				      G4double Z, 
+                                      G4double A = 0.);
+
+				
+private:  
+  G4double DiffCrossSectionMoller(G4double kinEnergyProj,G4double kinEnergyProd);
+private: //attributes   
+   G4bool WithRapidSampling;
+   
+
+};
+#endif
+
Index: trunk/source/processes/electromagnetic/adjoint/include/G4AdjointhIonisationModel.hh
===================================================================
--- trunk/source/processes/electromagnetic/adjoint/include/G4AdjointhIonisationModel.hh	(revision 1197)
+++ trunk/source/processes/electromagnetic/adjoint/include/G4AdjointhIonisationModel.hh	(revision 1197)
@@ -0,0 +1,142 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4AdjointhIonisationModel.hh,v 1.2 2009/11/20 10:31:20 ldesorgh Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
+//
+/////////////////////////////////////////////////////////////////////////////////
+//      Module:		G4AdjointhIonisationModel
+//	Author:       	L. Desorgher
+// 	Organisation: 	SpaceIT GmbH
+//	Contract:	ESA contract 21435/08/NL/AT
+// 	Customer:     	ESA/ESTEC
+/////////////////////////////////////////////////////////////////////////////////
+//
+// CHANGE HISTORY
+// --------------
+//      ChangeHistory: 
+//	 	13th February 2009 creation by L. Desorgher  
+//		10 November 2009   Implementation of the rapid sampling.  	 		
+//
+//-------------------------------------------------------------
+//	Documentation:
+//		Adjoint EM model for discrete reverse hadron ionisation. Tested at the moment only for protons.
+//
+
+#ifndef G4AdjointhIonisationModel_h
+#define G4AdjointhIonisationModel_h 1
+
+#include "globals.hh"
+#include "G4DynamicParticle.hh"
+#include "G4ParticleDefinition.hh"
+#include "G4MaterialCutsCouple.hh"
+#include "G4Material.hh"
+#include "G4Element.hh"
+#include "G4ElementVector.hh"
+#include "Randomize.hh"
+#include "G4ParticleDefinition.hh"
+#include "G4VEmModel.hh"
+#include "G4Electron.hh"
+#include "G4Gamma.hh"
+#include "G4ProductionCutsTable.hh"
+#include "G4VEmAdjointModel.hh"
+class G4PhysicsTable;
+class G4Region;
+class G4VParticleChange;
+class G4ParticleChange;
+class G4Track;
+class G4AdjointCSMatrix;
+
+
+class G4AdjointhIonisationModel: public G4VEmAdjointModel
+{
+
+public:
+
+  G4AdjointhIonisationModel(G4ParticleDefinition* projectileDefinition);
+
+  virtual ~G4AdjointhIonisationModel();
+
+  virtual void SampleSecondaries(const G4Track& aTrack,
+                                G4bool IsScatProjToProjCase,
+				G4ParticleChange* fParticleChange);
+  void RapidSampleSecondaries(const G4Track& aTrack,
+                                G4bool IsScatProjToProjCase,
+				G4ParticleChange* fParticleChange);
+  virtual G4double DiffCrossSectionPerAtomPrimToSecond(
+                                      G4double kinEnergyProj,  // kinetic energy of the primary particle before the interaction 
+                                      G4double kinEnergyProd, // kinetic energy of the secondary particle 
+				      G4double Z, 
+                                      G4double A = 0.);
+ 
+  virtual G4double AdjointCrossSection(const G4MaterialCutsCouple* aCouple,
+				             G4double primEnergy,
+				             G4bool IsScatProjToProjCase); 				      
+ 
+  //Set/Get methods
+  //------------------
+  
+  virtual G4double GetSecondAdjEnergyMaxForScatProjToProjCase(G4double PrimAdjEnergy);
+  virtual G4double GetSecondAdjEnergyMinForScatProjToProjCase(G4double PrimAdjEnergy,G4double Tcut=0);
+  virtual G4double GetSecondAdjEnergyMaxForProdToProjCase(G4double PrimAdjEnergy);
+  virtual G4double GetSecondAdjEnergyMinForProdToProjCase(G4double PrimAdjEnergy);
+ 
+
+private: //Methods
+     
+    
+  void DefineProjectileProperty();
+  
+  //projectile property
+  G4double mass;
+  G4double tlimit;
+  G4double spin;
+  G4double magMoment2;
+  G4double chargeSquare;
+  G4double ratio, ratio2; 
+  G4double one_plus_ratio_2;
+  G4double formfact;
+  G4double twoln10;
+  G4double bg2lim;
+  G4double taulim;
+  G4double corrFactor;
+  G4bool   isIon;
+  G4double one_minus_ratio_2;
+  
+  
+  G4VEmModel* theBraggDirectEMModel;	
+  G4double term_Cross1, term_Cross2;			    
+
+
+
+   
+   
+
+  
+};
+
+
+#endif
+
Index: trunk/source/processes/electromagnetic/adjoint/include/G4AdjointhMultipleScattering.hh
===================================================================
--- trunk/source/processes/electromagnetic/adjoint/include/G4AdjointhMultipleScattering.hh	(revision 1197)
+++ trunk/source/processes/electromagnetic/adjoint/include/G4AdjointhMultipleScattering.hh	(revision 1197)
@@ -0,0 +1,129 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4AdjointhMultipleScattering.hh,v 1.2 2009/11/20 10:31:20 ldesorgh Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
+//
+/////////////////////////////////////////////////////////////////////////////////
+//      Class:		G4AdjointhMultipleScattering
+//	Author:       	L. Desorgher
+// 	Organisation: 	SpaceIT GmbH
+//	Contract:	ESA contract 21435/08/NL/AT
+// 	Customer:     	ESA/ESTEC
+/////////////////////////////////////////////////////////////////////////////////
+//
+// GEANT4 Class header file
+//
+// File name:     G4AdjointhMultipleScattering
+//
+// Author:        Desorgher Laurent
+//
+// Creation date: 03.06.2009 cloned from G4hMultipleScattering by U.Laszlo with slight modification for adjoint_ion. 
+//
+//
+//------------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////
+//
+// CHANGE HISTORY
+// --------------
+//      ChangeHistory: 
+//	 	03.06.2009  Creation by L. Desorgher. Cloned from G4hMultipleScattering by U.Laszlo with slight modifications.	  		
+//		09.11.2009  Remove 	AlongStepGetPhysicalInteractionLength, to call the one of the base class.
+//-------------------------------------------------------------
+//	Documentation:
+//		The class simulates the multiple scattering for adjoint proton of charged particle. In this approximate implementation the reverse multiple scattering 
+//		is the same than the foward one. This should be changed in the future to have the MultipleScaterring computed for the energy  at the end of the step 
+//		and not before the step. 
+//
+
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+#ifndef G4AdjointhMultipleScattering_h
+#define G4AdjointhMultipleScattering_h 1
+
+#include "G4VMultipleScattering.hh"
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+class G4VMscModel;
+
+class G4AdjointhMultipleScattering : public G4VMultipleScattering
+
+{
+public:    // with description
+
+  G4AdjointhMultipleScattering(const G4String& processName="msc");
+
+  virtual ~G4AdjointhMultipleScattering();
+
+  // returns true for charged particles, false otherwise
+  G4bool IsApplicable (const G4ParticleDefinition& p);
+
+  // PrG4int few lines of informations about the process: validity range,
+  void PrintInfo();
+
+  // geom. step length distribution should be sampled or not
+  void Setsamplez(G4bool value) { samplez = value;};
+
+  // to reduce the energy/step dependence
+  void Setdtrl(G4double value) { dtrl = value;};
+
+  // 'soften' step limitation above lambdalimit
+  void SetLambdalimit(G4double value) { lambdalimit = value;};
+
+ /* // The function overloads the corresponding function of the base
+  // class.It limits the step near to boundaries only
+  // and invokes the method GetMscContinuousStepLimit at every step.
+  G4double AlongStepGetPhysicalInteractionLength(
+                                            const G4Track&,
+					    G4double  previousStepSize,
+					    G4double  currentMinimalStep,
+					    G4double& currentSafety,
+					    G4GPILSelection* selection);
+	*/				    
+
+protected:
+
+  // This function initialise models
+  void InitialiseProcess(const G4ParticleDefinition*);
+
+private:        // data members
+
+  G4VMscModel* mscUrban;
+
+  G4double lambdalimit;
+  G4double dtrl;
+
+  G4bool   samplez;
+  G4bool   isInitialized;
+  G4bool   isIon;
+
+};
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+#endif
Index: trunk/source/processes/electromagnetic/adjoint/include/G4IonInverseIonisation.hh
===================================================================
--- trunk/source/processes/electromagnetic/adjoint/include/G4IonInverseIonisation.hh	(revision 1197)
+++ trunk/source/processes/electromagnetic/adjoint/include/G4IonInverseIonisation.hh	(revision 1197)
@@ -0,0 +1,66 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4IonInverseIonisation.hh,v 1.2 2009/11/20 10:31:20 ldesorgh Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
+//
+/////////////////////////////////////////////////////////////////////////////////
+//      Module:		G4IonInverseIonisation
+//	Author:       	L. Desorgher
+// 	Organisation: 	SpaceIT GmbH
+//	Contract:	ESA contract 21435/08/NL/AT
+// 	Customer:     	ESA/ESTEC
+/////////////////////////////////////////////////////////////////////////////////
+//
+// CHANGE HISTORY
+// --------------
+//      ChangeHistory: 
+//	 	25 August 2009 creation by L. Desorgher  		
+//
+//-------------------------------------------------------------
+//	Documentation:
+//		Adjoint/reverse discrete ionisation for ions
+//
+
+#ifndef G4IonInverseIonisation_h
+#define G4IonInverseIonisation_h 1
+
+#include "G4VAdjointReverseReaction.hh"
+#include "globals.hh"
+#include "G4eIonisation.hh"
+#include "G4AdjointIonIonisationModel.hh"
+class G4IonInverseIonisation: public G4VAdjointReverseReaction
+
+{
+public:
+
+  G4IonInverseIonisation(G4bool whichScatCase, G4String process_name, G4AdjointIonIonisationModel* aEmAdjointModel);
+  ~G4IonInverseIonisation();
+  
+private:
+    
+};
+
+#endif
Index: trunk/source/processes/electromagnetic/adjoint/include/G4VAdjointReverseReaction.hh
===================================================================
--- trunk/source/processes/electromagnetic/adjoint/include/G4VAdjointReverseReaction.hh	(revision 1197)
+++ trunk/source/processes/electromagnetic/adjoint/include/G4VAdjointReverseReaction.hh	(revision 1197)
@@ -0,0 +1,127 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4VAdjointReverseReaction.hh,v 1.2 2009/11/20 10:31:20 ldesorgh Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
+//
+/////////////////////////////////////////////////////////////////////////////////
+//      Module:		G4VAdjointReverseReaction
+//	Author:       	L. Desorgher
+// 	Organisation: 	SpaceIT GmbH
+//	Contract:	ESA contract 21435/08/NL/AT
+// 	Customer:     	ESA/ESTEC
+/////////////////////////////////////////////////////////////////////////////////
+//
+// CHANGE HISTORY
+// --------------
+//      ChangeHistory: 
+//	 	1st April 2007 creation by L. Desorgher  		
+//
+//-------------------------------------------------------------
+//	Documentation:
+//		Abstract class for adjoint/reverse discrete scattering
+//
+
+#ifndef G4VAdjointReverseReaction_h
+#define G4VAdjointReverseReaction_h 1
+
+#include "globals.hh"
+#include "G4DynamicParticle.hh"
+#include "G4ParticleDefinition.hh"
+#include "G4MaterialCutsCouple.hh"
+#include "G4Material.hh"
+#include "G4Element.hh"
+#include "G4ElementVector.hh"
+#include "Randomize.hh"
+#include "G4ParticleDefinition.hh"
+#include "G4VDiscreteProcess.hh"
+
+
+
+class G4PhysicsTable;
+class G4Region;
+class G4VParticleChange;
+class G4ParticleChange;
+class G4Track;
+class G4VEmAdjointModel;
+class G4AdjointCSMatrix;
+class G4AdjointCSManager;
+class G4Material;
+class G4MaterialCutsCouple;
+
+
+class G4VAdjointReverseReaction : public G4VDiscreteProcess
+{
+
+public:
+
+  G4VAdjointReverseReaction(G4String process_name,G4bool whichScatCase);
+
+  virtual ~G4VAdjointReverseReaction();
+  
+public:
+  void PreparePhysicsTable(const G4ParticleDefinition&);
+  
+  void BuildPhysicsTable(const G4ParticleDefinition&);
+  
+  virtual G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&); 
+  inline void SetIntegralMode(G4bool aBool){IsIntegralModeUsed = aBool;}
+ 
+protected :// with description  
+	
+   virtual G4double GetMeanFreePath(const G4Track& track,
+                                         G4double previousStepSize,
+                                         G4ForceCondition* condition);
+
+protected:
+   G4VEmAdjointModel* theAdjointEMModel;	
+   G4ParticleChange* fParticleChange;
+   G4AdjointCSManager* theAdjointCSManager;
+   G4bool IsScatProjToProjCase;
+   
+  
+
+private:
+  G4Material*  currentMaterial;
+  G4MaterialCutsCouple* currentCouple;
+  size_t   currentMaterialIndex; 
+  G4double currentTcut;
+  G4double lastCS;
+  std::vector<G4double> CS_Vs_Element;
+  G4bool IsFwdCSUsed;
+  
+  //For integral mode
+  //------------------
+  G4bool IsIntegralModeUsed;
+  
+  
+  
+
+ 
+
+};  
+
+#endif
+
Index: trunk/source/processes/electromagnetic/adjoint/include/G4hInverseIonisation.hh
===================================================================
--- trunk/source/processes/electromagnetic/adjoint/include/G4hInverseIonisation.hh	(revision 1197)
+++ trunk/source/processes/electromagnetic/adjoint/include/G4hInverseIonisation.hh	(revision 1197)
@@ -0,0 +1,66 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4hInverseIonisation.hh,v 1.2 2009/11/20 10:31:20 ldesorgh Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
+//
+/////////////////////////////////////////////////////////////////////////////////
+//      Module:		G4hInverseIonisation.hh
+//	Author:       	L. Desorgher
+// 	Organisation: 	SpaceIT GmbH
+//	Contract:	ESA contract 21435/08/NL/AT
+// 	Customer:     	ESA/ESTEC
+/////////////////////////////////////////////////////////////////////////////////
+//
+// CHANGE HISTORY
+// --------------
+//      ChangeHistory: 
+//	 	15 February 2009 creation by L. Desorgher  		
+//
+//-------------------------------------------------------------
+//	Documentation:
+//		Adjoint/reverse discrete ionisation for proton
+//
+
+#ifndef G4hInverseIonisation_h
+#define G4hInverseIonisation_h 1
+
+#include "G4VAdjointReverseReaction.hh"
+#include "globals.hh"
+#include "G4eIonisation.hh"
+#include "G4AdjointhIonisationModel.hh"
+class G4hInverseIonisation: public G4VAdjointReverseReaction
+
+{
+public:
+
+  G4hInverseIonisation(G4bool whichScatCase, G4String process_name, G4AdjointhIonisationModel* aEmAdjointModel);
+  ~G4hInverseIonisation();
+  
+private:
+    
+};
+
+#endif
Index: trunk/source/processes/electromagnetic/adjoint/src/G4AdjointIonIonisationModel.cc
===================================================================
--- trunk/source/processes/electromagnetic/adjoint/src/G4AdjointIonIonisationModel.cc	(revision 1197)
+++ trunk/source/processes/electromagnetic/adjoint/src/G4AdjointIonIonisationModel.cc	(revision 1197)
@@ -0,0 +1,363 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4AdjointIonIonisationModel.cc,v 1.2 2009/11/20 10:31:20 ldesorgh Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
+//
+#include "G4AdjointIonIonisationModel.hh"
+#include "G4AdjointCSManager.hh"
+
+
+#include "G4Integrator.hh"
+#include "G4TrackStatus.hh"
+#include "G4ParticleChange.hh"
+#include "G4AdjointElectron.hh"
+#include "G4AdjointProton.hh"
+#include "G4AdjointInterpolator.hh"
+#include "G4BetheBlochModel.hh"
+#include "G4BraggIonModel.hh"
+#include "G4Proton.hh"
+#include "G4GenericIon.hh"
+#include "G4NistManager.hh"
+
+////////////////////////////////////////////////////////////////////////////////
+//
+G4AdjointIonIonisationModel::G4AdjointIonIonisationModel():
+  G4VEmAdjointModel("Adjoint_IonIonisation")
+{ 
+
+
+  UseMatrix =true;
+  UseMatrixPerElement = true;
+  ApplyCutInRange = true;
+  UseOnlyOneMatrixForAllElements = true;
+  CS_biasing_factor =1.;
+  second_part_of_same_type =false;
+  use_only_bragg = false; // for the Ion ionisation using the parametrised table model the cross sections and the sample of secondaries is done
+  				// as in the BraggIonModel, Therefore the use of this flag;  
+  
+  //The direct EM Model is taken has BetheBloch it is only used for the computation 
+  // of the differential cross section.
+  //The Bragg model could be used  as an alternative as  it offers the same differential cross section
+  
+  theBetheBlochDirectEMModel = new G4BetheBlochModel(G4GenericIon::GenericIon());
+  theBraggIonDirectEMModel = new G4BraggIonModel(G4GenericIon::GenericIon()); 
+  theAdjEquivOfDirectSecondPartDef=G4AdjointElectron::AdjointElectron();
+  theDirectPrimaryPartDef =0;
+  theAdjEquivOfDirectPrimPartDef =0;
+ /* theDirectPrimaryPartDef =fwd_ion;
+  theAdjEquivOfDirectPrimPartDef =adj_ion;
+ 
+  DefineProjectileProperty();*/
+
+
+
+
+}
+////////////////////////////////////////////////////////////////////////////////
+//
+G4AdjointIonIonisationModel::~G4AdjointIonIonisationModel()
+{;}
+////////////////////////////////////////////////////////////////////////////////
+//
+void G4AdjointIonIonisationModel::SampleSecondaries(const G4Track& aTrack,
+                                G4bool IsScatProjToProjCase,
+				G4ParticleChange* fParticleChange)
+{ 
+ const G4DynamicParticle* theAdjointPrimary =aTrack.GetDynamicParticle();
+  
+ //Elastic inverse scattering 
+ //---------------------------------------------------------
+ G4double adjointPrimKinEnergy = theAdjointPrimary->GetKineticEnergy();
+ G4double adjointPrimP =theAdjointPrimary->GetTotalMomentum();
+
+ if (adjointPrimKinEnergy>HighEnergyLimit*0.999){
+ 	return;
+ }
+ 
+ //Sample secondary energy
+ //-----------------------
+ G4double projectileKinEnergy = SampleAdjSecEnergyFromCSMatrix(adjointPrimKinEnergy, IsScatProjToProjCase);
+ CorrectPostStepWeight(fParticleChange, 
+			      aTrack.GetWeight(), 
+			      adjointPrimKinEnergy,
+			      projectileKinEnergy,
+			      IsScatProjToProjCase); //Caution !!!this weight correction should be always applied
+
+ 		 
+ //Kinematic: 
+ //we consider a two body elastic scattering for the forward processes where the projectile knock on an e- at rest  and gives
+ // him part of its  energy
+ //----------------------------------------------------------------------------------------
+ 
+ G4double projectileM0 = theAdjEquivOfDirectPrimPartDef->GetPDGMass();
+ G4double projectileTotalEnergy = projectileM0+projectileKinEnergy;
+ G4double projectileP2 = projectileTotalEnergy*projectileTotalEnergy - projectileM0*projectileM0;	
+ 
+ 
+ 
+ //Companion
+ //-----------
+ G4double companionM0 = theAdjEquivOfDirectPrimPartDef->GetPDGMass();
+ if (IsScatProjToProjCase) {
+  	companionM0=theAdjEquivOfDirectSecondPartDef->GetPDGMass();
+ } 
+ G4double companionTotalEnergy =companionM0+ projectileKinEnergy-adjointPrimKinEnergy;
+ G4double companionP2 = companionTotalEnergy*companionTotalEnergy - companionM0*companionM0;	
+ 
+ 
+ //Projectile momentum
+ //--------------------
+ G4double  P_parallel = (adjointPrimP*adjointPrimP +  projectileP2 - companionP2)/(2.*adjointPrimP);
+ G4double  P_perp = std::sqrt( projectileP2 -  P_parallel*P_parallel);
+ G4ThreeVector dir_parallel=theAdjointPrimary->GetMomentumDirection();
+ G4double phi =G4UniformRand()*2.*3.1415926;
+ G4ThreeVector projectileMomentum = G4ThreeVector(P_perp*std::cos(phi),P_perp*std::sin(phi),P_parallel);
+ projectileMomentum.rotateUz(dir_parallel);
+ 
+ 
+ 
+ if (!IsScatProjToProjCase ){ //kill the primary and add a secondary
+ 	fParticleChange->ProposeTrackStatus(fStopAndKill);
+ 	fParticleChange->AddSecondary(new G4DynamicParticle(theAdjEquivOfDirectPrimPartDef,projectileMomentum));
+	//G4cout<<"projectileMomentum "<<projectileMomentum<<G4endl;
+ }
+ else {
+ 	fParticleChange->ProposeEnergy(projectileKinEnergy);
+	fParticleChange->ProposeMomentumDirection(projectileMomentum.unit());
+ }	
+     	
+
+  
+
+}
+		
+////////////////////////////////////////////////////////////////////////////////
+//
+G4double G4AdjointIonIonisationModel::DiffCrossSectionPerAtomPrimToSecond(
+                                      G4double kinEnergyProj, 
+                                      G4double kinEnergyProd,
+				      G4double Z, 
+                                      G4double A)
+{//Probably that here the Bragg Model should be also used for kinEnergyProj/nuc<2MeV
+  
+
+ 
+ G4double dSigmadEprod=0;
+ G4double Emax_proj = GetSecondAdjEnergyMaxForProdToProjCase(kinEnergyProd);
+ G4double Emin_proj = GetSecondAdjEnergyMinForProdToProjCase(kinEnergyProd);
+ 
+ G4double kinEnergyProjScaled = massRatio*kinEnergyProj;
+ 
+ 
+ if (kinEnergyProj>Emin_proj && kinEnergyProj<=Emax_proj){ //the produced particle should have a kinetic energy smaller than the projectile 
+	G4double Tmax=kinEnergyProj;
+	
+        G4double E1=kinEnergyProd;
+ 	G4double E2=kinEnergyProd*1.000001;
+ 	G4double dE=(E2-E1);
+	G4double sigma1,sigma2;
+	theDirectEMModel =theBraggIonDirectEMModel;
+ 	if (kinEnergyProjScaled >2.*MeV && !use_only_bragg) theDirectEMModel = theBetheBlochDirectEMModel; //Bethe Bloch Model
+	sigma1=theDirectEMModel->ComputeCrossSectionPerAtom(theDirectPrimaryPartDef,kinEnergyProj,Z,A ,E1,1.e20);
+	sigma2=theDirectEMModel->ComputeCrossSectionPerAtom(theDirectPrimaryPartDef,kinEnergyProj,Z,A ,E2,1.e20);
+	
+	dSigmadEprod=(sigma1-sigma2)/dE;
+	
+	//G4double chargeSqRatio =  currentModel->GetChargeSquareRatio(theDirectPrimaryPartDef,currentMaterial,E);
+	
+	
+	
+	if (dSigmadEprod>1.) {
+		G4cout<<"sigma1 "<<kinEnergyProj/MeV<<'\t'<<kinEnergyProd/MeV<<'\t'<<sigma1<<G4endl;
+		G4cout<<"sigma2 "<<kinEnergyProj/MeV<<'\t'<<kinEnergyProd/MeV<<'\t'<<sigma2<<G4endl;
+		G4cout<<"dsigma "<<kinEnergyProj/MeV<<'\t'<<kinEnergyProd/MeV<<'\t'<<dSigmadEprod<<G4endl;
+		
+	}
+	
+	 
+	
+	 
+	 
+	 
+	 if (theDirectEMModel == theBetheBlochDirectEMModel ){
+	 //correction of differential cross section at high energy to correct for the suppression of particle at secondary at high
+	 //energy used in the Bethe Bloch Model. This correction consist to multiply by g the probability function used
+	 //to test the rejection of a secondary
+	 //-------------------------
+	 
+	 //Source code taken from    G4BetheBlochModel::SampleSecondaries
+	 
+	 	G4double deltaKinEnergy = kinEnergyProd;
+	 
+	 //Part of the taken code
+	 //----------------------
+	 
+	 
+	 
+	 // projectile formfactor - suppresion of high energy
+         // delta-electron production at high energy
+	 
+	 
+	 	G4double x = formfact*deltaKinEnergy;
+         	if(x > 1.e-6) {
+			G4double totEnergy     = kinEnergyProj + mass;
+         		G4double etot2         = totEnergy*totEnergy;
+	 		G4double beta2 = kinEnergyProj*(kinEnergyProj + 2.0*mass)/etot2;
+	 		G4double f;
+	 		G4double f1 = 0.0;
+			f = 1.0 - beta2*deltaKinEnergy/Tmax;
+    	 		if( 0.5 == spin ) {
+      				f1 = 0.5*deltaKinEnergy*deltaKinEnergy/etot2;
+      				f += f1;
+    	 		}
+			G4double x1 = 1.0 + x;
+    			G4double g  = 1.0/(x1*x1);
+    			if( 0.5 == spin ) {
+      				G4double x2 = 0.5*electron_mass_c2*deltaKinEnergy/(mass*mass);
+      				g *= (1.0 + magMoment2*(x2 - f1/f)/(1.0 + x2));
+    			}
+    			if(g > 1.0) {
+      				G4cout << "### G4BetheBlochModel in Adjoint Sim WARNING: g= " << g
+	     			<< G4endl;
+				g=1.;
+			}
+			//G4cout<<"g"<<g<<G4endl;
+			dSigmadEprod*=g;		
+    	 	}
+	}	
+	 
+  }
+
+ return dSigmadEprod;	
+}
+//////////////////////////////////////////////////////////////////////////////////////////////
+//
+void G4AdjointIonIonisationModel::SetIon(G4ParticleDefinition* adj_ion, G4ParticleDefinition* fwd_ion)
+{ theDirectPrimaryPartDef =fwd_ion;
+  theAdjEquivOfDirectPrimPartDef =adj_ion;
+ 
+  DefineProjectileProperty();
+}
+//////////////////////////////////////////////////////////////////////////////////////////////
+//
+void G4AdjointIonIonisationModel::CorrectPostStepWeight(G4ParticleChange* fParticleChange, G4double old_weight,
+							G4double adjointPrimKinEnergy, G4double projectileKinEnergy,G4bool )
+{
+ //It is needed because the direct cross section used to compute the differential cross section is not the one used in 
+ // the direct model where the GenericIon stuff is considered with correction of effective charge.  In the direct model the samnepl of secondaries does
+ // not reflect the integral cross section. The integral fwd cross section that we used to compute the differential CS
+ // match the sample of secondaries in the forward case despite the fact that its is not the same total CS than in the FWD case. For this reasion an extra
+ // weight correction is needed at the end.
+ 
+
+ G4double new_weight=old_weight;
+ 
+ //the correction of CS due to the problem explained above
+ G4double kinEnergyProjScaled = massRatio*projectileKinEnergy;
+ theDirectEMModel =theBraggIonDirectEMModel;
+ if (kinEnergyProjScaled >2.*MeV && !use_only_bragg) theDirectEMModel = theBetheBlochDirectEMModel; //Bethe Bloch Model
+ G4double UsedFwdCS=theDirectEMModel->ComputeCrossSectionPerAtom(theDirectPrimaryPartDef,projectileKinEnergy,1,1 ,currentTcutForDirectSecond,1.e20);
+ G4double chargeSqRatio =1.;
+ if (chargeSquare>1.) chargeSqRatio =  theDirectEMModel->GetChargeSquareRatio(theDirectPrimaryPartDef,currentMaterial,projectileKinEnergy);
+ G4double  CorrectFwdCS = chargeSqRatio*theDirectEMModel->ComputeCrossSectionPerAtom(G4GenericIon::GenericIon(),kinEnergyProjScaled,1,1 ,currentTcutForDirectSecond,1.e20);
+ if (UsedFwdCS >0)  new_weight*= CorrectFwdCS/UsedFwdCS;//May be some check is needed if UsedFwdCS ==0 probably that then we should avoid a secondary to be produced, 
+ 
+ 
+ //additional CS crorrection  needed for cross section biasing in general. 
+ //May be wrong for ions!!! Most of the time not used!
+  G4double w_corr =1./CS_biasing_factor;
+  w_corr*=G4AdjointCSManager::GetAdjointCSManager()->GetPostStepWeightCorrection();
+  new_weight*=w_corr;
+ 
+  new_weight*=projectileKinEnergy/adjointPrimKinEnergy;
+ 
+ fParticleChange->SetParentWeightByProcess(false);
+ fParticleChange->SetSecondaryWeightByProcess(false);
+ fParticleChange->ProposeParentWeight(new_weight);
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+//
+void G4AdjointIonIonisationModel::DefineProjectileProperty()
+{   
+    //Slightly modified code taken from G4BetheBlochModel::SetParticle
+    //------------------------------------------------
+    G4String pname = theDirectPrimaryPartDef->GetParticleName();
+    if (theDirectPrimaryPartDef->GetParticleType() == "nucleus" &&
+	pname != "deuteron" && pname != "triton") {
+      isIon = true;
+    }
+    
+    mass = theDirectPrimaryPartDef->GetPDGMass();
+    massRatio= G4GenericIon::GenericIon()->GetPDGMass()/mass;
+    spin = theDirectPrimaryPartDef->GetPDGSpin();
+    G4double q = theDirectPrimaryPartDef->GetPDGCharge()/eplus;
+    chargeSquare = q*q;
+    ratio = electron_mass_c2/mass;
+    ratio2 = ratio*ratio;
+    one_plus_ratio_2=(1+ratio)*(1+ratio);
+    one_minus_ratio_2=(1-ratio)*(1-ratio);
+    G4double magmom = theDirectPrimaryPartDef->GetPDGMagneticMoment()
+      *mass/(0.5*eplus*hbar_Planck*c_squared);
+    magMoment2 = magmom*magmom - 1.0;
+    formfact = 0.0;
+    if(theDirectPrimaryPartDef->GetLeptonNumber() == 0) {
+      G4double x = 0.8426*GeV;
+      if(spin == 0.0 && mass < GeV) {x = 0.736*GeV;}
+      else if(mass > GeV) {
+        x /= G4NistManager::Instance()->GetZ13(mass/proton_mass_c2);
+	//	tlimit = 51.2*GeV*A13[iz]*A13[iz];
+      }
+      formfact = 2.0*electron_mass_c2/(x*x);
+      tlimit   = 2.0/formfact;
+   }
+}
+
+
+//////////////////////////////////////////////////////////////////////////////
+//
+G4double G4AdjointIonIonisationModel::GetSecondAdjEnergyMaxForScatProjToProjCase(G4double PrimAdjEnergy)
+{ 
+  G4double Tmax=PrimAdjEnergy*one_plus_ratio_2/(one_minus_ratio_2-2.*ratio*PrimAdjEnergy/mass);
+  return Tmax;
+}
+//////////////////////////////////////////////////////////////////////////////
+//
+G4double G4AdjointIonIonisationModel::GetSecondAdjEnergyMinForScatProjToProjCase(G4double PrimAdjEnergy,G4double Tcut)
+{ return PrimAdjEnergy+Tcut;
+}
+//////////////////////////////////////////////////////////////////////////////
+//				
+G4double G4AdjointIonIonisationModel::GetSecondAdjEnergyMaxForProdToProjCase(G4double )
+{ return HighEnergyLimit;
+}
+//////////////////////////////////////////////////////////////////////////////
+//
+G4double G4AdjointIonIonisationModel::GetSecondAdjEnergyMinForProdToProjCase(G4double PrimAdjEnergy)
+{  G4double Tmin= (2*PrimAdjEnergy-4*mass + std::sqrt(4.*PrimAdjEnergy*PrimAdjEnergy +16.*mass*mass + 8.*PrimAdjEnergy*mass*(1/ratio +ratio)))/4.;
+   return Tmin;
+}
Index: trunk/source/processes/electromagnetic/adjoint/src/G4AdjointProcessEquivalentToDirectProcess.cc
===================================================================
--- trunk/source/processes/electromagnetic/adjoint/src/G4AdjointProcessEquivalentToDirectProcess.cc	(revision 1197)
+++ trunk/source/processes/electromagnetic/adjoint/src/G4AdjointProcessEquivalentToDirectProcess.cc	(revision 1197)
@@ -0,0 +1,321 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4AdjointProcessEquivalentToDirectProcess.cc,v 1.1 2009/11/11 00:31:19 ldesorgh Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
+//
+// 
+// ------------------------------------------------------------
+//        GEANT 4 class implementation file 
+//
+// Class Description
+//
+// This class is for adjoint process equivalent to direct process
+
+// ------------------------------------------------------------
+//   Created by L.Desorgher          25 Sept. 2009  Inspired from G4WrapperProcess
+// ------------------------------------------------------------
+
+#include "G4AdjointProcessEquivalentToDirectProcess.hh"
+#include "G4DynamicParticle.hh"
+G4AdjointProcessEquivalentToDirectProcess::G4AdjointProcessEquivalentToDirectProcess(const G4String& aName,
+										     G4VProcess* aProcess,
+										     G4ParticleDefinition* fwd_particle_def)
+:G4VProcess(aName)
+{  
+   theDirectProcess =aProcess;
+   theProcessType = theDirectProcess->GetProcessType();
+   theFwdParticleDef  = fwd_particle_def;
+}
+
+
+G4AdjointProcessEquivalentToDirectProcess::~G4AdjointProcessEquivalentToDirectProcess()
+{
+  if (theDirectProcess!=0) delete theDirectProcess;
+}
+
+void G4AdjointProcessEquivalentToDirectProcess::ResetNumberOfInteractionLengthLeft()
+{
+  theDirectProcess->ResetNumberOfInteractionLengthLeft();
+}
+
+G4double G4AdjointProcessEquivalentToDirectProcess::
+AlongStepGetPhysicalInteractionLength( const G4Track& track,
+                                             G4double  previousStepSize,
+                                             G4double  currentMinimumStep,
+                                             G4double& proposedSafety,
+                                             G4GPILSelection* selection     )
+{ 
+  
+
+  //Change the particle definition to the direct one
+  //------------------------------------------------
+  G4DynamicParticle* theDynPart = const_cast<G4DynamicParticle*> (track.GetDynamicParticle());
+  G4ParticleDefinition* adjPartDef = theDynPart->GetDefinition();
+  
+  G4DecayProducts* decayProducts = const_cast<G4DecayProducts*>  (theDynPart->GetPreAssignedDecayProducts());
+  theDynPart->SetPreAssignedDecayProducts((G4DecayProducts*)(0));
+  theDynPart->SetDefinition(theFwdParticleDef);
+  
+  
+  //Call the direct process
+  //----------------------
+  G4double GPIL =  theDirectProcess->
+         AlongStepGetPhysicalInteractionLength( track,
+                                                previousStepSize,
+                                                currentMinimumStep,
+                                                proposedSafety,
+                                                selection     );
+  
+  
+  //Restore the adjoint particle definition to the direct one
+  //------------------------------------------------
+  theDynPart->SetDefinition(adjPartDef);
+  theDynPart->SetPreAssignedDecayProducts(decayProducts);
+  
+  
+  return GPIL;
+						
+}
+
+G4double G4AdjointProcessEquivalentToDirectProcess::
+AtRestGetPhysicalInteractionLength( const G4Track& track,
+                                          G4ForceCondition* condition )
+{ //Change the particle definition to the direct one
+  //------------------------------------------------
+  G4DynamicParticle* theDynPart = const_cast<G4DynamicParticle*> (track.GetDynamicParticle());
+  G4ParticleDefinition* adjPartDef = theDynPart->GetDefinition();
+  
+  G4DecayProducts* decayProducts =  const_cast<G4DecayProducts*>  (theDynPart->GetPreAssignedDecayProducts());
+  theDynPart->SetPreAssignedDecayProducts((G4DecayProducts*)(0));
+  theDynPart->SetDefinition(theFwdParticleDef);
+  
+  
+  //Call the direct process
+  //----------------------
+
+   
+  G4double GPIL =  theDirectProcess->AtRestGetPhysicalInteractionLength( track, condition );
+  
+  //Restore the adjoint particle definition to the direct one
+  //------------------------------------------------
+  theDynPart->SetDefinition(adjPartDef);
+  theDynPart->SetPreAssignedDecayProducts(decayProducts);
+  
+  return GPIL;
+						
+  
+}
+
+G4double G4AdjointProcessEquivalentToDirectProcess::
+PostStepGetPhysicalInteractionLength( const G4Track& track,
+                                            G4double   previousStepSize,
+                                            G4ForceCondition* condition )
+{
+  //Change the particle definition to the direct one
+  //------------------------------------------------
+  G4DynamicParticle* theDynPart = const_cast<G4DynamicParticle*> (track.GetDynamicParticle());
+  G4ParticleDefinition* adjPartDef = theDynPart->GetDefinition();
+  
+  G4DecayProducts* decayProducts =  const_cast<G4DecayProducts*>  (theDynPart->GetPreAssignedDecayProducts());
+ 
+  theDynPart->SetPreAssignedDecayProducts((G4DecayProducts*)(0));
+  theDynPart->SetDefinition(theFwdParticleDef);
+  
+  
+  //Call the direct process
+  //----------------------
+
+   
+  G4double GPIL = theDirectProcess->PostStepGetPhysicalInteractionLength( track,
+                                                             previousStepSize,
+                                                             condition );
+   
+  //Restore the adjoint particle definition to the direct one
+  //------------------------------------------------
+  theDynPart->SetDefinition(adjPartDef);
+  theDynPart->SetPreAssignedDecayProducts(decayProducts);
+  
+   return GPIL;
+  
+  				     
+}
+/*
+      
+void G4AdjointProcessEquivalentToDirectProcess::SetProcessManager(const G4ProcessManager* procMan)
+{
+   theDirectProcess->SetProcessManager(procMan); 
+}
+
+const G4ProcessManager* G4AdjointProcessEquivalentToDirectProcess::GetProcessManager()
+{
+  return     theDirectProcess->GetProcessManager();
+}
+*/
+G4VParticleChange* G4AdjointProcessEquivalentToDirectProcess::PostStepDoIt( const G4Track& track,
+                                                   const G4Step&  stepData )
+{
+  //Change the particle definition to the direct one
+  //------------------------------------------------
+  G4DynamicParticle* theDynPart = const_cast<G4DynamicParticle*> (track.GetDynamicParticle());
+  G4ParticleDefinition* adjPartDef = theDynPart->GetDefinition();
+  
+  G4DecayProducts* decayProducts =  const_cast<G4DecayProducts*>  (theDynPart->GetPreAssignedDecayProducts());
+ 
+  theDynPart->SetPreAssignedDecayProducts((G4DecayProducts*)(0));
+  theDynPart->SetDefinition(theFwdParticleDef);
+  
+  
+  //Call the direct process
+  //----------------------
+  
+  G4VParticleChange* partChange = theDirectProcess->PostStepDoIt( track, stepData );
+  
+  
+  //Restore the adjoint particle definition to the direct one
+  //------------------------------------------------
+  theDynPart->SetDefinition(adjPartDef);
+  theDynPart->SetPreAssignedDecayProducts(decayProducts);
+  
+  return partChange;
+  
+  
+          
+}
+
+G4VParticleChange* G4AdjointProcessEquivalentToDirectProcess::AlongStepDoIt( const G4Track& track,
+                                                    const G4Step& stepData )
+{ 
+  //Change the particle definition to the direct one
+  //------------------------------------------------
+  G4DynamicParticle* theDynPart = const_cast<G4DynamicParticle*> (track.GetDynamicParticle());
+  G4ParticleDefinition* adjPartDef = theDynPart->GetDefinition();
+  
+  G4DecayProducts* decayProducts =  const_cast<G4DecayProducts*>  (theDynPart->GetPreAssignedDecayProducts());
+ 
+  theDynPart->SetPreAssignedDecayProducts((G4DecayProducts*)(0));
+  theDynPart->SetDefinition(theFwdParticleDef);
+  
+  
+  //Call the direct process
+  //----------------------
+  G4VParticleChange* partChange =theDirectProcess->AlongStepDoIt( track, stepData );
+  
+  //Restore the adjoint particle definition to the direct one
+  //------------------------------------------------
+  theDynPart->SetDefinition(adjPartDef);
+  theDynPart->SetPreAssignedDecayProducts(decayProducts);
+  
+  return partChange;        
+}
+ 
+G4VParticleChange* G4AdjointProcessEquivalentToDirectProcess::AtRestDoIt( const G4Track& track,
+                                                 const G4Step& stepData )
+{
+  //Change the particle definition to the direct one
+  //------------------------------------------------
+  G4DynamicParticle* theDynPart = const_cast<G4DynamicParticle*> (track.GetDynamicParticle());
+  G4ParticleDefinition* adjPartDef = theDynPart->GetDefinition();
+  
+  G4DecayProducts* decayProducts =  const_cast<G4DecayProducts*>  (theDynPart->GetPreAssignedDecayProducts());
+ 
+  theDynPart->SetPreAssignedDecayProducts((G4DecayProducts*)(0));
+  theDynPart->SetDefinition(theFwdParticleDef);
+  
+  
+  //Call the direct process
+  //----------------------
+  G4VParticleChange* partChange =theDirectProcess->AtRestDoIt( track, stepData );
+  
+  //Restore the adjoint particle definition to the direct one
+  //------------------------------------------------
+  theDynPart->SetDefinition(adjPartDef);
+  theDynPart->SetPreAssignedDecayProducts(decayProducts);
+  
+   return partChange; 
+  
+       
+}
+
+G4bool G4AdjointProcessEquivalentToDirectProcess::IsApplicable(const G4ParticleDefinition&)
+{
+  return     theDirectProcess->IsApplicable(*theFwdParticleDef);
+}
+
+void G4AdjointProcessEquivalentToDirectProcess::BuildPhysicsTable(const G4ParticleDefinition& )
+{
+  return     theDirectProcess->BuildPhysicsTable(*theFwdParticleDef);
+}
+
+void G4AdjointProcessEquivalentToDirectProcess::PreparePhysicsTable(const G4ParticleDefinition& )
+{
+  return     theDirectProcess->PreparePhysicsTable(*theFwdParticleDef);
+}
+
+G4bool G4AdjointProcessEquivalentToDirectProcess::
+StorePhysicsTable(const G4ParticleDefinition* ,
+                  const G4String& directory, 
+                        G4bool          ascii)
+{
+  return theDirectProcess->StorePhysicsTable(theFwdParticleDef,  directory,  ascii);
+} 
+ 
+G4bool G4AdjointProcessEquivalentToDirectProcess::
+RetrievePhysicsTable( const G4ParticleDefinition* ,
+                      const G4String& directory, 
+                            G4bool          ascii)
+{
+  return theDirectProcess->RetrievePhysicsTable(theFwdParticleDef,  directory,  ascii);
+}  
+
+void G4AdjointProcessEquivalentToDirectProcess::StartTracking(G4Track* track)
+{
+  //Change the particle definition to the direct one
+  //------------------------------------------------
+  G4DynamicParticle* theDynPart = const_cast<G4DynamicParticle*> (track->GetDynamicParticle());
+  G4ParticleDefinition* adjPartDef = theDynPart->GetDefinition();
+  
+  G4DecayProducts* decayProducts =  const_cast<G4DecayProducts*> (theDynPart->GetPreAssignedDecayProducts());
+  theDynPart->SetPreAssignedDecayProducts((G4DecayProducts*)(0));
+  theDynPart->SetDefinition(theFwdParticleDef);
+  
+  theDirectProcess->StartTracking(track);
+  
+   //Restore the adjoint particle definition to the direct one
+  //------------------------------------------------
+  theDynPart->SetDefinition(adjPartDef);
+  theDynPart->SetPreAssignedDecayProducts(decayProducts);
+  
+  
+  return; 
+  
+}
+
+void G4AdjointProcessEquivalentToDirectProcess::EndTracking()
+{
+  theDirectProcess->EndTracking(); 
+}
+
Index: trunk/source/processes/electromagnetic/adjoint/src/G4AdjointeIonisationModel.cc
===================================================================
--- trunk/source/processes/electromagnetic/adjoint/src/G4AdjointeIonisationModel.cc	(revision 1197)
+++ trunk/source/processes/electromagnetic/adjoint/src/G4AdjointeIonisationModel.cc	(revision 1197)
@@ -0,0 +1,216 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4AdjointeIonisationModel.cc,v 1.2 2009/11/20 10:31:20 ldesorgh Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
+//
+#include "G4AdjointeIonisationModel.hh"
+#include "G4AdjointCSManager.hh"
+
+
+#include "G4Integrator.hh"
+#include "G4TrackStatus.hh"
+#include "G4ParticleChange.hh"
+#include "G4AdjointElectron.hh"
+#include  "G4Gamma.hh"
+#include "G4AdjointGamma.hh"
+
+
+////////////////////////////////////////////////////////////////////////////////
+//
+G4AdjointeIonisationModel::G4AdjointeIonisationModel():
+ G4VEmAdjointModel("Inv_eIon_model")
+
+{
+  
+  UseMatrix =true;
+  UseMatrixPerElement = true;
+  ApplyCutInRange = true;
+  UseOnlyOneMatrixForAllElements = true;
+  CS_biasing_factor =1.;
+  WithRapidSampling = false; 
+  
+  theAdjEquivOfDirectPrimPartDef =G4AdjointElectron::AdjointElectron();
+  theAdjEquivOfDirectSecondPartDef=G4AdjointElectron::AdjointElectron();
+  theDirectPrimaryPartDef=G4Electron::Electron();
+  second_part_of_same_type=true;
+}
+////////////////////////////////////////////////////////////////////////////////
+//
+G4AdjointeIonisationModel::~G4AdjointeIonisationModel()
+{;}
+////////////////////////////////////////////////////////////////////////////////
+//
+void G4AdjointeIonisationModel::SampleSecondaries(const G4Track& aTrack,
+                                G4bool IsScatProjToProjCase,
+				G4ParticleChange* fParticleChange)
+{ 
+
+
+ const G4DynamicParticle* theAdjointPrimary =aTrack.GetDynamicParticle();
+  
+ //Elastic inverse scattering 
+ //---------------------------------------------------------
+ G4double adjointPrimKinEnergy = theAdjointPrimary->GetKineticEnergy();
+ G4double adjointPrimP =theAdjointPrimary->GetTotalMomentum();
+
+ if (adjointPrimKinEnergy>HighEnergyLimit*0.999){
+ 	return;
+ }
+ 
+ //Sample secondary energy
+ //-----------------------
+ G4double projectileKinEnergy;
+ if (!WithRapidSampling ) { //used by default
+ 	projectileKinEnergy = SampleAdjSecEnergyFromCSMatrix(adjointPrimKinEnergy, IsScatProjToProjCase);
+	
+	CorrectPostStepWeight(fParticleChange, 
+			      aTrack.GetWeight(), 
+			      adjointPrimKinEnergy,
+			      projectileKinEnergy,
+			      IsScatProjToProjCase); //Caution !!!this weight correction should be always applied
+ }
+  else { //only  for test at the moment
+  	
+	G4double Emin,Emax;
+	if (IsScatProjToProjCase) {
+		Emin=GetSecondAdjEnergyMinForScatProjToProjCase(adjointPrimKinEnergy,currentTcutForDirectSecond);
+		Emax=GetSecondAdjEnergyMaxForScatProjToProjCase(adjointPrimKinEnergy);
+	}
+	else {
+		Emin=GetSecondAdjEnergyMinForProdToProjCase(adjointPrimKinEnergy);
+		Emax=GetSecondAdjEnergyMaxForProdToProjCase(adjointPrimKinEnergy);
+	}
+	projectileKinEnergy = Emin*std::pow(Emax/Emin,G4UniformRand());
+	
+	
+	
+	lastCS=lastAdjointCSForScatProjToProjCase;
+  	if ( !IsScatProjToProjCase) lastCS=lastAdjointCSForProdToProjCase;
+	
+	G4double new_weight=aTrack.GetWeight();
+	G4double used_diffCS=lastCS*std::log(Emax/Emin)/projectileKinEnergy;
+	G4double needed_diffCS=adjointPrimKinEnergy/projectileKinEnergy;
+	if (!IsScatProjToProjCase) needed_diffCS *=DiffCrossSectionPerVolumePrimToSecond(currentMaterial,projectileKinEnergy,adjointPrimKinEnergy);
+	else needed_diffCS *=DiffCrossSectionPerVolumePrimToScatPrim(currentMaterial,projectileKinEnergy,adjointPrimKinEnergy);
+	new_weight*=needed_diffCS/used_diffCS;
+	fParticleChange->SetParentWeightByProcess(false);
+ 	fParticleChange->SetSecondaryWeightByProcess(false);
+ 	fParticleChange->ProposeParentWeight(new_weight);
+	
+  
+ }	
+					  
+ 
+ 		 
+ //Kinematic: 
+ //we consider a two body elastic scattering for the forward processes where the projectile knock on an e- at rest  and gives
+ // him part of its  energy
+ //----------------------------------------------------------------------------------------
+ 
+ G4double projectileM0 = theAdjEquivOfDirectPrimPartDef->GetPDGMass();
+ G4double projectileTotalEnergy = projectileM0+projectileKinEnergy;
+ G4double projectileP2 = projectileTotalEnergy*projectileTotalEnergy - projectileM0*projectileM0;	
+ 
+ 
+ 
+ //Companion
+ //-----------
+ G4double companionM0 = theAdjEquivOfDirectPrimPartDef->GetPDGMass();
+ if (IsScatProjToProjCase) {
+  	companionM0=theAdjEquivOfDirectSecondPartDef->GetPDGMass();
+ } 
+ G4double companionTotalEnergy =companionM0+ projectileKinEnergy-adjointPrimKinEnergy;
+ G4double companionP2 = companionTotalEnergy*companionTotalEnergy - companionM0*companionM0;	
+ 
+ 
+ //Projectile momentum
+ //--------------------
+ G4double  P_parallel = (adjointPrimP*adjointPrimP +  projectileP2 - companionP2)/(2.*adjointPrimP);
+ G4double  P_perp = std::sqrt( projectileP2 -  P_parallel*P_parallel);
+ G4ThreeVector dir_parallel=theAdjointPrimary->GetMomentumDirection();
+ G4double phi =G4UniformRand()*2.*3.1415926;
+ G4ThreeVector projectileMomentum = G4ThreeVector(P_perp*std::cos(phi),P_perp*std::sin(phi),P_parallel);
+ projectileMomentum.rotateUz(dir_parallel);
+ 
+ 
+ 
+ if (!IsScatProjToProjCase ){ //kill the primary and add a secondary
+ 	fParticleChange->ProposeTrackStatus(fStopAndKill);
+ 	fParticleChange->AddSecondary(new G4DynamicParticle(theAdjEquivOfDirectPrimPartDef,projectileMomentum));
+	//G4cout<<"projectileMomentum "<<projectileMomentum<<G4endl;
+ }
+ else {
+ 	fParticleChange->ProposeEnergy(projectileKinEnergy);
+	fParticleChange->ProposeMomentumDirection(projectileMomentum.unit());
+ }	
+     	
+
+  
+
+}
+////////////////////////////////////////////////////////////////////////////////
+//
+//The implementation here is correct for energy loss process, for the photoelectric and compton scattering the method should be redefine  
+G4double G4AdjointeIonisationModel::DiffCrossSectionPerAtomPrimToSecond(
+                                      G4double kinEnergyProj, 
+                                      G4double kinEnergyProd,
+				      G4double Z, 
+                                      G4double )
+{
+ G4double dSigmadEprod=0;
+ G4double Emax_proj = GetSecondAdjEnergyMaxForProdToProjCase(kinEnergyProd);
+ G4double Emin_proj = GetSecondAdjEnergyMinForProdToProjCase(kinEnergyProd);
+ 
+ 
+ if (kinEnergyProj>Emin_proj && kinEnergyProj<=Emax_proj){ //the produced particle should have a kinetic energy smaller than the projectile 
+	dSigmadEprod=Z*DiffCrossSectionMoller(kinEnergyProj,kinEnergyProd);
+ }
+ return dSigmadEprod;	
+ 
+ 
+ 
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+G4double G4AdjointeIonisationModel::DiffCrossSectionMoller(G4double kinEnergyProj,G4double kinEnergyProd){
+  G4double electron_mass_c2=0.51099906*MeV;
+  G4double energy = kinEnergyProj + electron_mass_c2;
+  G4double x   = kinEnergyProd/kinEnergyProj;
+  G4double gam    = energy/electron_mass_c2;
+  G4double gamma2 = gam*gam;
+  G4double beta2  = 1.0 - 1.0/gamma2;
+  
+  G4double g = (2.0*gam - 1.0)/gamma2;
+  G4double y = 1.0 - x;
+  G4double fac=twopi_mc2_rcl2/electron_mass_c2;
+  G4double dCS = fac*( 1.-g + ((1.0 - g*x)/(x*x)) + ((1.0 - g*y)/(y*y)))/(beta2*(gam-1));
+  return dCS/kinEnergyProj;
+  
+ 
+
+}  
+
Index: trunk/source/processes/electromagnetic/adjoint/src/G4AdjointhIonisationModel.cc
===================================================================
--- trunk/source/processes/electromagnetic/adjoint/src/G4AdjointhIonisationModel.cc	(revision 1197)
+++ trunk/source/processes/electromagnetic/adjoint/src/G4AdjointhIonisationModel.cc	(revision 1197)
@@ -0,0 +1,502 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4AdjointhIonisationModel.cc,v 1.2 2009/11/20 10:31:20 ldesorgh Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
+//
+#include "G4AdjointhIonisationModel.hh"
+#include "G4AdjointCSManager.hh"
+#include "G4Integrator.hh"
+#include "G4TrackStatus.hh"
+#include "G4ParticleChange.hh"
+#include "G4AdjointElectron.hh"
+#include "G4AdjointProton.hh"
+#include "G4AdjointInterpolator.hh"
+#include "G4BetheBlochModel.hh"
+#include "G4BraggModel.hh"
+#include "G4Proton.hh"
+#include "G4NistManager.hh"
+
+////////////////////////////////////////////////////////////////////////////////
+//
+G4AdjointhIonisationModel::G4AdjointhIonisationModel(G4ParticleDefinition* projectileDefinition):
+  G4VEmAdjointModel("Adjoint_hIonisation")
+{ 
+
+
+
+  UseMatrix =true;
+  UseMatrixPerElement = true;
+  ApplyCutInRange = true;
+  UseOnlyOneMatrixForAllElements = true; 
+  CS_biasing_factor =1.;
+  second_part_of_same_type =false;
+  
+  //The direct EM Modfel is taken has BetheBloch it is only used for the computation 
+  // of the differential cross section.
+  //The Bragg model could be used  as an alternative as  it offers the same differential cross section
+  
+  theDirectEMModel = new G4BetheBlochModel(projectileDefinition);
+  theBraggDirectEMModel = new G4BraggModel(projectileDefinition); 
+  theAdjEquivOfDirectSecondPartDef=G4AdjointElectron::AdjointElectron();
+  
+  theDirectPrimaryPartDef = projectileDefinition;
+  if (projectileDefinition == G4Proton::Proton()) {
+  	theAdjEquivOfDirectPrimPartDef = G4AdjointProton::AdjointProton();
+	
+  }
+  
+  DefineProjectileProperty();
+  
+  
+  
+ 
+
+
+
+
+}
+////////////////////////////////////////////////////////////////////////////////
+//
+G4AdjointhIonisationModel::~G4AdjointhIonisationModel()
+{;}
+
+
+////////////////////////////////////////////////////////////////////////////////
+//
+void G4AdjointhIonisationModel::SampleSecondaries(const G4Track& aTrack,
+                                G4bool IsScatProjToProjCase,
+				G4ParticleChange* fParticleChange)
+{ 
+ if (!UseMatrix) return RapidSampleSecondaries(aTrack,IsScatProjToProjCase,fParticleChange);
+ 
+ const G4DynamicParticle* theAdjointPrimary =aTrack.GetDynamicParticle();
+  
+ //Elastic inverse scattering 
+ //---------------------------------------------------------
+ G4double adjointPrimKinEnergy = theAdjointPrimary->GetKineticEnergy();
+ G4double adjointPrimP =theAdjointPrimary->GetTotalMomentum();
+
+ if (adjointPrimKinEnergy>HighEnergyLimit*0.999){
+ 	return;
+ }
+ 
+ //Sample secondary energy
+ //-----------------------
+ G4double projectileKinEnergy = SampleAdjSecEnergyFromCSMatrix(adjointPrimKinEnergy, IsScatProjToProjCase);
+ CorrectPostStepWeight(fParticleChange, 
+			      aTrack.GetWeight(), 
+			      adjointPrimKinEnergy,
+			      projectileKinEnergy,
+			      IsScatProjToProjCase); //Caution !!!this weight correction should be always applied
+
+ 		 
+ //Kinematic: 
+ //we consider a two body elastic scattering for the forward processes where the projectile knock on an e- at rest  and gives
+ // him part of its  energy
+ //----------------------------------------------------------------------------------------
+ 
+ G4double projectileM0 = theAdjEquivOfDirectPrimPartDef->GetPDGMass();
+ G4double projectileTotalEnergy = projectileM0+projectileKinEnergy;
+ G4double projectileP2 = projectileTotalEnergy*projectileTotalEnergy - projectileM0*projectileM0;	
+ 
+ 
+ 
+ //Companion
+ //-----------
+ G4double companionM0 = theAdjEquivOfDirectPrimPartDef->GetPDGMass();
+ if (IsScatProjToProjCase) {
+  	companionM0=theAdjEquivOfDirectSecondPartDef->GetPDGMass();
+ } 
+ G4double companionTotalEnergy =companionM0+ projectileKinEnergy-adjointPrimKinEnergy;
+ G4double companionP2 = companionTotalEnergy*companionTotalEnergy - companionM0*companionM0;	
+ 
+ 
+ //Projectile momentum
+ //--------------------
+ G4double  P_parallel = (adjointPrimP*adjointPrimP +  projectileP2 - companionP2)/(2.*adjointPrimP);
+ G4double  P_perp = std::sqrt( projectileP2 -  P_parallel*P_parallel);
+ G4ThreeVector dir_parallel=theAdjointPrimary->GetMomentumDirection();
+ G4double phi =G4UniformRand()*2.*3.1415926;
+ G4ThreeVector projectileMomentum = G4ThreeVector(P_perp*std::cos(phi),P_perp*std::sin(phi),P_parallel);
+ projectileMomentum.rotateUz(dir_parallel);
+ 
+ 
+ 
+ if (!IsScatProjToProjCase ){ //kill the primary and add a secondary
+ 	fParticleChange->ProposeTrackStatus(fStopAndKill);
+ 	fParticleChange->AddSecondary(new G4DynamicParticle(theAdjEquivOfDirectPrimPartDef,projectileMomentum));
+	//G4cout<<"projectileMomentum "<<projectileMomentum<<G4endl;
+ }
+ else {
+ 	fParticleChange->ProposeEnergy(projectileKinEnergy);
+	fParticleChange->ProposeMomentumDirection(projectileMomentum.unit());
+ }	
+     	
+
+  
+
+}
+
+////////////////////////////////////////////////////////////////////////////////
+//
+void G4AdjointhIonisationModel::RapidSampleSecondaries(const G4Track& aTrack,
+                       G4bool IsScatProjToProjCase,
+	               G4ParticleChange* fParticleChange)
+{ 
+
+ const G4DynamicParticle* theAdjointPrimary =aTrack.GetDynamicParticle();
+ DefineCurrentMaterial(aTrack.GetMaterialCutsCouple());
+ 
+ 
+ G4double adjointPrimKinEnergy = theAdjointPrimary->GetKineticEnergy();
+ G4double adjointPrimP =theAdjointPrimary->GetTotalMomentum();
+ 
+ if (adjointPrimKinEnergy>HighEnergyLimit*0.999){
+ 	return;
+ }
+  
+ G4double projectileKinEnergy =0.;
+ G4double eEnergy=0.;
+ G4double newCS=currentMaterial->GetElectronDensity()*twopi_mc2_rcl2*mass;
+ if (!IsScatProjToProjCase){//1/E^2 distribution
+ 	
+	eEnergy=adjointPrimKinEnergy;
+	G4double Emax = GetSecondAdjEnergyMaxForProdToProjCase(adjointPrimKinEnergy);
+        G4double Emin=  GetSecondAdjEnergyMinForProdToProjCase(adjointPrimKinEnergy);
+	if (Emin>=Emax) return;
+	G4double a=1./Emax;
+	G4double b=1./Emin;
+	newCS=newCS*(b-a)/eEnergy;
+	
+	projectileKinEnergy =1./(b- (b-a)*G4UniformRand()); 
+	
+ 	
+ }
+ else {	G4double Emax = GetSecondAdjEnergyMaxForScatProjToProjCase(adjointPrimKinEnergy);
+	G4double Emin = GetSecondAdjEnergyMinForScatProjToProjCase(adjointPrimKinEnergy,currentTcutForDirectSecond);
+	if (Emin>=Emax) return;
+	G4double diff1=Emin-adjointPrimKinEnergy;
+	G4double diff2=Emax-adjointPrimKinEnergy;
+	
+	G4double t1=adjointPrimKinEnergy*(1./diff1-1./diff2);
+	G4double t2=adjointPrimKinEnergy*(1./Emin-1./Emax);
+	G4double f31=diff1/Emin;
+	G4double f32=diff2/Emax/f31;
+	G4double t3=2.*log(f32);
+	G4double sum_t=t1+t2+t3;
+	newCS=newCS*sum_t/adjointPrimKinEnergy/adjointPrimKinEnergy;
+	G4double t=G4UniformRand()*sum_t;
+	if (t <=t1 ){
+		G4double q= G4UniformRand()*t1/adjointPrimKinEnergy ;
+		projectileKinEnergy =adjointPrimKinEnergy +1./(1./diff1-q);
+		
+	}
+	else if (t <=t2 )  {
+		G4double q= G4UniformRand()*t2/adjointPrimKinEnergy;
+		projectileKinEnergy =1./(1./Emin-q);
+	}
+	else {	
+		projectileKinEnergy=adjointPrimKinEnergy/(1.-f31*pow(f32,G4UniformRand()));
+		
+	}
+	eEnergy=projectileKinEnergy-adjointPrimKinEnergy;
+	
+	
+ }
+
+ 
+
+ G4double diffCS_perAtom_Used=twopi_mc2_rcl2*mass*adjointPrimKinEnergy/projectileKinEnergy/projectileKinEnergy/eEnergy/eEnergy; 
+  
+  
+						  	
+ //Weight correction
+ //-----------------------
+ //First w_corr is set to the ratio between adjoint total CS and fwd total CS
+ G4double w_corr=G4AdjointCSManager::GetAdjointCSManager()->GetPostStepWeightCorrection();
+ 
+ //G4cout<<w_corr<<G4endl;
+ w_corr*=newCS/lastCS;
+ //G4cout<<w_corr<<G4endl;
+ //Then another correction is needed due to the fact that a biaised differential CS has been used rather than the one consistent with the direct model
+ //Here we consider the true  diffCS as the one obtained by the numerical differentiation over Tcut of the direct CS
+ 
+ G4double diffCS = DiffCrossSectionPerAtomPrimToSecond(projectileKinEnergy, eEnergy,1,1);
+ w_corr*=diffCS/diffCS_perAtom_Used;
+ //G4cout<<w_corr<<G4endl;
+	   
+ G4double new_weight = aTrack.GetWeight()*w_corr;
+ fParticleChange->SetParentWeightByProcess(false);
+ fParticleChange->SetSecondaryWeightByProcess(false);
+ fParticleChange->ProposeParentWeight(new_weight);
+ 
+ 
+ 
+ 
+ //Kinematic: 
+ //we consider a two body elastic scattering for the forward processes where the projectile knock on an e- at rest  and gives
+ // him part of its  energy
+ //----------------------------------------------------------------------------------------
+ 
+ G4double projectileM0 = theAdjEquivOfDirectPrimPartDef->GetPDGMass();
+ G4double projectileTotalEnergy = projectileM0+projectileKinEnergy;
+ G4double projectileP2 = projectileTotalEnergy*projectileTotalEnergy - projectileM0*projectileM0;	
+ 
+ 
+ 
+ //Companion
+ //-----------
+ G4double companionM0 = theAdjEquivOfDirectPrimPartDef->GetPDGMass();
+ if (IsScatProjToProjCase) {
+  	companionM0=theAdjEquivOfDirectSecondPartDef->GetPDGMass();
+ } 
+ G4double companionTotalEnergy =companionM0+ projectileKinEnergy-adjointPrimKinEnergy;
+ G4double companionP2 = companionTotalEnergy*companionTotalEnergy - companionM0*companionM0;	
+ 
+ 
+ //Projectile momentum
+ //--------------------
+ G4double  P_parallel = (adjointPrimP*adjointPrimP +  projectileP2 - companionP2)/(2.*adjointPrimP);
+ G4double  P_perp = std::sqrt( projectileP2 -  P_parallel*P_parallel);
+ G4ThreeVector dir_parallel=theAdjointPrimary->GetMomentumDirection();
+ G4double phi =G4UniformRand()*2.*3.1415926;
+ G4ThreeVector projectileMomentum = G4ThreeVector(P_perp*std::cos(phi),P_perp*std::sin(phi),P_parallel);
+ projectileMomentum.rotateUz(dir_parallel);
+ 
+ 
+ 
+ if (!IsScatProjToProjCase ){ //kill the primary and add a secondary
+ 	fParticleChange->ProposeTrackStatus(fStopAndKill);
+ 	fParticleChange->AddSecondary(new G4DynamicParticle(theAdjEquivOfDirectPrimPartDef,projectileMomentum));
+	//G4cout<<"projectileMomentum "<<projectileMomentum<<G4endl;
+ }
+ else {
+ 	fParticleChange->ProposeEnergy(projectileKinEnergy);
+	fParticleChange->ProposeMomentumDirection(projectileMomentum.unit());
+ }	
+     	
+
+ 
+ 
+
+
+
+} 
+		
+////////////////////////////////////////////////////////////////////////////////
+//
+G4double G4AdjointhIonisationModel::DiffCrossSectionPerAtomPrimToSecond(
+                                      G4double kinEnergyProj, 
+                                      G4double kinEnergyProd,
+				      G4double Z, 
+                                      G4double A)
+{//Probably that here the Bragg Model should be also used for kinEnergyProj/nuc<2MeV
+  
+
+ 
+ G4double dSigmadEprod=0;
+ G4double Emax_proj = GetSecondAdjEnergyMaxForProdToProjCase(kinEnergyProd);
+ G4double Emin_proj = GetSecondAdjEnergyMinForProdToProjCase(kinEnergyProd);
+ 
+ 
+ if (kinEnergyProj>Emin_proj && kinEnergyProj<=Emax_proj){ //the produced particle should have a kinetic energy smaller than the projectile 
+	G4double Tmax=kinEnergyProj;
+	
+        G4double E1=kinEnergyProd;
+ 	G4double E2=kinEnergyProd*1.000001;
+ 	G4double dE=(E2-E1);
+	G4double sigma1,sigma2;
+ 	if (kinEnergyProj >2.*MeV){
+	    sigma1=theDirectEMModel->ComputeCrossSectionPerAtom(theDirectPrimaryPartDef,kinEnergyProj,Z,A ,E1,1.e20);
+	    sigma2=theDirectEMModel->ComputeCrossSectionPerAtom(theDirectPrimaryPartDef,kinEnergyProj,Z,A ,E2,1.e20);
+        }
+	else {
+	    sigma1=theBraggDirectEMModel->ComputeCrossSectionPerAtom(theDirectPrimaryPartDef,kinEnergyProj,Z,A ,E1,1.e20);
+	    sigma2=theBraggDirectEMModel->ComputeCrossSectionPerAtom(theDirectPrimaryPartDef,kinEnergyProj,Z,A ,E2,1.e20);
+	}
+	
+ 	
+	dSigmadEprod=(sigma1-sigma2)/dE;
+	if (dSigmadEprod>1.) {
+		G4cout<<"sigma1 "<<kinEnergyProj/MeV<<'\t'<<kinEnergyProd/MeV<<'\t'<<sigma1<<G4endl;
+		G4cout<<"sigma2 "<<kinEnergyProj/MeV<<'\t'<<kinEnergyProd/MeV<<'\t'<<sigma2<<G4endl;
+		G4cout<<"dsigma "<<kinEnergyProj/MeV<<'\t'<<kinEnergyProd/MeV<<'\t'<<dSigmadEprod<<G4endl;
+		
+	}
+	
+	 
+	
+	 //correction of differential cross section at high energy to correct for the suppression of particle at secondary at high
+	 //energy used in the Bethe Bloch Model. This correction consist to multiply by g the probability function used
+	 //to test the rejection of a secondary
+	 //-------------------------
+	 
+	 //Source code taken from    G4BetheBlochModel::SampleSecondaries
+	 
+	 G4double deltaKinEnergy = kinEnergyProd;
+	 
+	 //Part of the taken code
+	 //----------------------
+	 
+	 
+	 
+	 // projectile formfactor - suppresion of high energy
+         // delta-electron production at high energy
+	 G4double x = formfact*deltaKinEnergy;
+          if(x > 1.e-6) {
+		
+		
+		G4double totEnergy     = kinEnergyProj + mass;
+         	G4double etot2         = totEnergy*totEnergy;
+	 	G4double beta2 = kinEnergyProj*(kinEnergyProj + 2.0*mass)/etot2;
+	 	G4double f;
+	 	G4double f1 = 0.0;
+		f = 1.0 - beta2*deltaKinEnergy/Tmax;
+    	 	if( 0.5 == spin ) {
+      			f1 = 0.5*deltaKinEnergy*deltaKinEnergy/etot2;
+      			f += f1;
+    	 	}
+		G4double x1 = 1.0 + x;
+    		G4double g  = 1.0/(x1*x1);
+    		if( 0.5 == spin ) {
+      			G4double x2 = 0.5*electron_mass_c2*deltaKinEnergy/(mass*mass);
+      			g *= (1.0 + magMoment2*(x2 - f1/f)/(1.0 + x2));
+    		}
+    		if(g > 1.0) {
+      			G4cout << "### G4BetheBlochModel in Adjoint Sim WARNING: g= " << g
+	     			<< G4endl;
+			g=1.;
+		}
+		//G4cout<<"g"<<g<<G4endl;
+		dSigmadEprod*=g;		
+    	 }
+	 
+  }
+
+ return dSigmadEprod;	
+}
+
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+//
+void G4AdjointhIonisationModel::DefineProjectileProperty()
+{   
+    //Slightly modified code taken from G4BetheBlochModel::SetParticle
+    //------------------------------------------------
+    G4String pname = theDirectPrimaryPartDef->GetParticleName();
+    if (theDirectPrimaryPartDef->GetParticleType() == "nucleus" &&
+	pname != "deuteron" && pname != "triton") {
+      isIon = true;
+    }
+    
+    mass = theDirectPrimaryPartDef->GetPDGMass();
+    spin = theDirectPrimaryPartDef->GetPDGSpin();
+    G4double q = theDirectPrimaryPartDef->GetPDGCharge()/eplus;
+    chargeSquare = q*q;
+    ratio = electron_mass_c2/mass;
+    ratio2 = ratio*ratio;
+    one_plus_ratio_2=(1+ratio)*(1+ratio);
+    one_minus_ratio_2=(1-ratio)*(1-ratio);
+    G4double magmom = theDirectPrimaryPartDef->GetPDGMagneticMoment()
+      *mass/(0.5*eplus*hbar_Planck*c_squared);
+    magMoment2 = magmom*magmom - 1.0;
+    formfact = 0.0;
+    if(theDirectPrimaryPartDef->GetLeptonNumber() == 0) {
+      G4double x = 0.8426*GeV;
+      if(spin == 0.0 && mass < GeV) {x = 0.736*GeV;}
+      else if(mass > GeV) {
+        x /= G4NistManager::Instance()->GetZ13(mass/proton_mass_c2);
+	//	tlimit = 51.2*GeV*A13[iz]*A13[iz];
+      }
+      formfact = 2.0*electron_mass_c2/(x*x);
+      tlimit   = 2.0/formfact;
+   }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+//
+G4double G4AdjointhIonisationModel::AdjointCrossSection(const G4MaterialCutsCouple* aCouple,
+				             G4double primEnergy,
+				             G4bool IsScatProjToProjCase)
+{ 
+  if (UseMatrix) return G4VEmAdjointModel::AdjointCrossSection(aCouple,primEnergy,IsScatProjToProjCase);
+  DefineCurrentMaterial(aCouple);
+  	
+  
+  G4double Cross=currentMaterial->GetElectronDensity()*twopi_mc2_rcl2*mass;
+  
+  if (!IsScatProjToProjCase ){
+  	G4double Emax_proj = GetSecondAdjEnergyMaxForProdToProjCase(primEnergy);
+  	G4double Emin_proj = GetSecondAdjEnergyMinForProdToProjCase(primEnergy);
+	if (Emax_proj>Emin_proj && primEnergy > currentTcutForDirectSecond) {
+		Cross*=(1./Emin_proj -1./Emax_proj)/primEnergy;
+	} 
+	else Cross=0.;
+		
+	
+
+	
+	
+	
+  }
+  else {
+  	G4double Emax_proj = GetSecondAdjEnergyMaxForScatProjToProjCase(primEnergy);
+	G4double Emin_proj = GetSecondAdjEnergyMinForScatProjToProjCase(primEnergy,currentTcutForDirectSecond);
+	G4double diff1=Emin_proj-primEnergy;
+	G4double diff2=Emax_proj-primEnergy;
+	G4double t1=(1./diff1+1./Emin_proj-1./diff2-1./Emax_proj)/primEnergy;
+	G4double t2=2.*log(diff2*Emin_proj/Emax_proj/diff1)/primEnergy/primEnergy;
+	Cross*=(t1+t2);
+
+  	
+  }
+  lastCS =Cross;
+  return Cross;	
+}
+//////////////////////////////////////////////////////////////////////////////
+//
+G4double G4AdjointhIonisationModel::GetSecondAdjEnergyMaxForScatProjToProjCase(G4double PrimAdjEnergy)
+{ 
+  G4double Tmax=PrimAdjEnergy*one_plus_ratio_2/(one_minus_ratio_2-2.*ratio*PrimAdjEnergy/mass);
+  return Tmax;
+}
+//////////////////////////////////////////////////////////////////////////////
+//
+G4double G4AdjointhIonisationModel::GetSecondAdjEnergyMinForScatProjToProjCase(G4double PrimAdjEnergy,G4double Tcut)
+{ return PrimAdjEnergy+Tcut;
+}
+//////////////////////////////////////////////////////////////////////////////
+//				
+G4double G4AdjointhIonisationModel::GetSecondAdjEnergyMaxForProdToProjCase(G4double )
+{ return HighEnergyLimit;
+}
+//////////////////////////////////////////////////////////////////////////////
+//
+G4double G4AdjointhIonisationModel::GetSecondAdjEnergyMinForProdToProjCase(G4double PrimAdjEnergy)
+{  G4double Tmin= (2*PrimAdjEnergy-4*mass + std::sqrt(4.*PrimAdjEnergy*PrimAdjEnergy +16.*mass*mass + 8.*PrimAdjEnergy*mass*(1/ratio +ratio)))/4.;
+   return Tmin;
+}
Index: trunk/source/processes/electromagnetic/adjoint/src/G4AdjointhMultipleScattering.cc
===================================================================
--- trunk/source/processes/electromagnetic/adjoint/src/G4AdjointhMultipleScattering.cc	(revision 1197)
+++ trunk/source/processes/electromagnetic/adjoint/src/G4AdjointhMultipleScattering.cc	(revision 1197)
@@ -0,0 +1,149 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4AdjointhMultipleScattering.cc,v 1.2 2009/11/20 10:31:20 ldesorgh Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
+//
+
+//
+// GEANT4 Class file
+//
+// File name:     G4AdjointhMultipleScattering
+//
+// Author:        Desorgher Laurent
+//
+// Creation date: 03.06.2009 cloned from G4hMultipleScattering by U.Laszlo with slight modification for adjoint_ion. 
+//
+// -----------------------------------------------------------------------------
+//
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+#include "G4AdjointhMultipleScattering.hh"
+#include "G4UrbanMscModel.hh"
+#include "G4UrbanMscModel90.hh"
+#include "G4MscStepLimitType.hh"
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+using namespace std;
+
+G4AdjointhMultipleScattering::G4AdjointhMultipleScattering(const G4String& processName)
+  : G4VMultipleScattering(processName)
+{
+  isInitialized = false;  
+  isIon         = false;
+  SetStepLimitType(fMinimal);
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+G4AdjointhMultipleScattering::~G4AdjointhMultipleScattering()
+{}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+G4bool G4AdjointhMultipleScattering::IsApplicable (const G4ParticleDefinition& p)
+{
+  return (p.GetPDGCharge() != 0.0 && !p.IsShortLived());
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+void G4AdjointhMultipleScattering::InitialiseProcess(const G4ParticleDefinition* p)
+{
+  // Modification of parameters between runs
+  if(isInitialized) {
+    if (p->GetParticleType() != "adjoint_nucleus" && p->GetPDGMass() < GeV) {
+      mscUrban->SetStepLimitType(StepLimitType());
+      mscUrban->SetLateralDisplasmentFlag(LateralDisplasmentFlag());
+      mscUrban->SetSkin(Skin());
+      mscUrban->SetRangeFactor(RangeFactor());
+      mscUrban->SetGeomFactor(GeomFactor());
+    }
+    return;
+  }
+
+  // defaults for ions, which cannot be overwritten
+  if (p->GetParticleType() == "adjoint_nucleus" || p->GetPDGMass() > GeV) {
+    SetStepLimitType(fMinimal);
+    SetLateralDisplasmentFlag(false);
+    SetBuildLambdaTable(false);
+    if(p->GetParticleType() == "adjoint_nucleus") isIon = true;
+  }
+
+  // initialisation of parameters
+  G4String part_name = p->GetParticleName();
+  mscUrban = new G4UrbanMscModel90();
+
+  mscUrban->SetStepLimitType(StepLimitType());
+  mscUrban->SetLateralDisplasmentFlag(LateralDisplasmentFlag());
+  mscUrban->SetSkin(Skin());
+  mscUrban->SetRangeFactor(RangeFactor());
+  mscUrban->SetGeomFactor(GeomFactor());
+
+  AddEmModel(1,mscUrban);
+  isInitialized = true;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+void G4AdjointhMultipleScattering::PrintInfo()
+{
+  G4cout << "      RangeFactor= " << RangeFactor()
+	 << ", step limit type: " << StepLimitType()
+         << ", lateralDisplacement: " << LateralDisplasmentFlag()
+	 << ", skin= " << Skin()  
+    //	 << ", geomFactor= " << GeomFactor()  
+	 << G4endl;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+/*G4double G4AdjointhMultipleScattering::AlongStepGetPhysicalInteractionLength(
+                             const G4Track& track,
+                             double,
+                             G4double currentMinimalStep,
+                             G4double& currentSafety,
+                             G4GPILSelection* selection)
+{
+  // get Step limit proposed by the process
+  valueGPILSelectionMSC = NotCandidateForSelection;
+
+  G4double escaled = track.GetKineticEnergy();
+  if(isIon) escaled *= track.GetDynamicParticle()->GetMass()/proton_mass_c2;
+
+  G4double steplength = GetMscContinuousStepLimit(track,
+						  escaled,
+						  currentMinimalStep,
+						  currentSafety);
+  // G4cout << "StepLimit= " << steplength << G4endl;
+  // set return value for G4GPILSelection
+  *selection = valueGPILSelectionMSC;
+  return  steplength;
+}
+*/
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
Index: trunk/source/processes/electromagnetic/adjoint/src/G4IonInverseIonisation.cc
===================================================================
--- trunk/source/processes/electromagnetic/adjoint/src/G4IonInverseIonisation.cc	(revision 1197)
+++ trunk/source/processes/electromagnetic/adjoint/src/G4IonInverseIonisation.cc	(revision 1197)
@@ -0,0 +1,51 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4IonInverseIonisation.cc,v 1.2 2009/11/20 10:31:20 ldesorgh Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
+//
+///////////////////////////////////////////////////////
+// File name:     G4IonInverseIonisation
+//
+// Author:        Laurent Desorgher
+//
+// Creation date: 25.08.2009
+//
+///////////////////////////////////////////////////////
+#include "G4IonInverseIonisation.hh"
+#include "G4VEmAdjointModel.hh"
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+G4IonInverseIonisation::G4IonInverseIonisation(G4bool whichScatCase,G4String process_name,G4AdjointIonIonisationModel* aEmAdjointModel):
+				G4VAdjointReverseReaction(process_name,whichScatCase)
+{theAdjointEMModel = aEmAdjointModel;
+ theAdjointEMModel->SetSecondPartOfSameType(false);
+ SetIntegralMode(true); 
+}
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+G4IonInverseIonisation::~G4IonInverseIonisation(){
+}
Index: trunk/source/processes/electromagnetic/adjoint/src/G4VAdjointReverseReaction.cc
===================================================================
--- trunk/source/processes/electromagnetic/adjoint/src/G4VAdjointReverseReaction.cc	(revision 1197)
+++ trunk/source/processes/electromagnetic/adjoint/src/G4VAdjointReverseReaction.cc	(revision 1197)
@@ -0,0 +1,138 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4VAdjointReverseReaction.cc,v 1.2 2009/11/20 10:31:20 ldesorgh Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
+//
+#include "G4VAdjointReverseReaction.hh"
+#include "G4AdjointCSManager.hh"
+#include "G4AdjointCSMatrix.hh"
+#include "G4AdjointInterpolator.hh"
+#include "G4AdjointCSMatrix.hh"
+#include "G4VEmAdjointModel.hh"
+#include "G4ElementTable.hh"
+#include "G4Element.hh"
+#include "G4Material.hh"
+#include "G4MaterialCutsCouple.hh"
+#include "G4AdjointCSManager.hh"
+#include "G4ParticleChange.hh"
+#include "G4AdjointElectron.hh"
+
+
+G4VAdjointReverseReaction::
+	G4VAdjointReverseReaction(G4String process_name, G4bool whichScatCase):
+			G4VDiscreteProcess(process_name)
+{theAdjointCSManager = G4AdjointCSManager::GetAdjointCSManager();
+ IsScatProjToProjCase=whichScatCase;
+ fParticleChange=new G4ParticleChange();
+ 
+}
+//////////////////////////////////////////////////////////////////////////////
+//
+G4VAdjointReverseReaction::
+	~G4VAdjointReverseReaction()
+{;
+}			
+//////////////////////////////////////////////////////////////////////////////
+//
+void G4VAdjointReverseReaction::PreparePhysicsTable(const G4ParticleDefinition&)
+{;
+}
+//////////////////////////////////////////////////////////////////////////////
+//
+void G4VAdjointReverseReaction::BuildPhysicsTable(const G4ParticleDefinition&)
+{
+
+ theAdjointCSManager->BuildCrossSectionMatrices(); //do not worry it will be done just once
+ theAdjointCSManager->BuildTotalSigmaTables();
+
+}
+//////////////////////////////////////////////////////////////////////////////
+//
+G4VParticleChange* G4VAdjointReverseReaction::PostStepDoIt(const G4Track& track, const G4Step&  )
+{ 
+  
+  
+  
+  fParticleChange->Initialize(track);
+ 
+ /* if (IsFwdCSUsed && IsIntegralModeUsed){ //INtegral mode still unstable
+  	 G4double Tkin = step.GetPostStepPoint()->GetKineticEnergy();
+  	 G4double fwdCS = theAdjointCSManager->GetTotalForwardCS(track.GetDefinition(), Tkin, track.GetMaterialCutsCouple());
+	 //G4cout<<"lastCS "<<lastCS<<G4endl;
+	 if (fwdCS<lastCS*G4UniformRand()) { // the reaction does not take place, same integral method as the one used for forward ionisation in  G4 
+	 	ClearNumberOfInteractionLengthLeft();
+  		return fParticleChange;
+	 } 
+	 
+  }
+ */
+ 
+  theAdjointEMModel->SampleSecondaries(track,
+                                       IsScatProjToProjCase,
+					fParticleChange);
+  
+  ClearNumberOfInteractionLengthLeft();
+  return fParticleChange;
+  			
+   
+  
+}
+//////////////////////////////////////////////////////////////////////////////
+//
+G4double G4VAdjointReverseReaction::GetMeanFreePath(const G4Track& track,
+                                         					     G4double ,
+                                         					     G4ForceCondition* condition)
+{ *condition = NotForced;
+  G4double preStepKinEnergy = track.GetKineticEnergy();
+  
+  G4double Sigma =
+  		theAdjointEMModel->AdjointCrossSection(track.GetMaterialCutsCouple(),preStepKinEnergy,IsScatProjToProjCase);
+  		
+  G4double fwd_TotCS;
+  Sigma *=  theAdjointCSManager->GetCrossSectionCorrection(track.GetDefinition(),preStepKinEnergy,track.GetMaterialCutsCouple(),IsFwdCSUsed, fwd_TotCS);
+  //G4cout<<fwd_TotCS<<G4endl;
+  /*if (IsFwdCSUsed && IsIntegralModeUsed){ //take the maximum cross section only for charged particle		
+  	G4double e_sigma_max, sigma_max;
+	theAdjointCSManager->GetMaxFwdTotalCS(track.GetDefinition(),
+	 		   	     track.GetMaterialCutsCouple(), e_sigma_max, sigma_max);
+	if (e_sigma_max > preStepKinEnergy){
+		Sigma*=sigma_max/fwd_TotCS;
+	}		     
+  }
+  */		
+
+  G4double mean_free_path = 1.e60 *mm; 
+  if (Sigma>0) mean_free_path = 1./Sigma;
+  lastCS=Sigma;
+  
+  /*G4cout<<"Sigma  "<<Sigma<<G4endl;
+  G4cout<<"mean_free_path [mm] "<<mean_free_path/mm<<G4endl;
+  */
+  
+
+  return mean_free_path;
+}					 
+				 
Index: trunk/source/processes/electromagnetic/adjoint/src/G4hInverseIonisation.cc
===================================================================
--- trunk/source/processes/electromagnetic/adjoint/src/G4hInverseIonisation.cc	(revision 1197)
+++ trunk/source/processes/electromagnetic/adjoint/src/G4hInverseIonisation.cc	(revision 1197)
@@ -0,0 +1,51 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4hInverseIonisation.cc,v 1.2 2009/11/20 10:31:20 ldesorgh Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
+//
+///////////////////////////////////////////////////////
+// File name:     G4hInverseIonisation
+//
+// Author:        Laurent Desorgher
+//
+// Creation date: 15.02.2009
+//
+///////////////////////////////////////////////////////
+#include "G4hInverseIonisation.hh"
+#include "G4VEmAdjointModel.hh"
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+G4hInverseIonisation::G4hInverseIonisation(G4bool whichScatCase,G4String process_name,G4AdjointhIonisationModel* aEmAdjointModel):
+				G4VAdjointReverseReaction(process_name,whichScatCase)
+{theAdjointEMModel = aEmAdjointModel;
+ theAdjointEMModel->SetSecondPartOfSameType(false);
+ SetIntegralMode(true); 
+}
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+G4hInverseIonisation::~G4hInverseIonisation(){
+}
Index: trunk/source/processes/electromagnetic/lowenergy/include/G4DNAMoleculeManager.hh
===================================================================
--- trunk/source/processes/electromagnetic/lowenergy/include/G4DNAMoleculeManager.hh	(revision 1197)
+++ trunk/source/processes/electromagnetic/lowenergy/include/G4DNAMoleculeManager.hh	(revision 1197)
@@ -0,0 +1,58 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+
+
+#ifndef   G4DNAGENERICMOLECULEMANAGER_HH
+ #define  G4DNAGENERICMOLECULEMANAGER_HH 1
+ 
+ #include "globals.hh"
+ 
+ #include <map>
+ 
+ class G4Ions;
+ class G4ParticleDefinition;
+ 
+ class G4DNAGenericIonsManager
+ {
+  public:
+   static G4DNAGenericIonsManager *      Instance(void);
+   G4ParticleDefinition *                GetIon(const G4String & name);
+
+  private:
+                                         G4DNAGenericIonsManager();
+                                        ~G4DNAGenericIonsManager();
+
+                                         G4DNAGenericIonsManager(const G4DNAGenericIonsManager &);
+   const G4DNAGenericIonsManager        &operator=(const G4DNAGenericIonsManager &);
+
+   static G4DNAGenericIonsManager *      theInstance;
+   
+   typedef std::map<G4String, G4ParticleDefinition *> IonsMap;
+
+   IonsMap                               map;
+ };
+#endif /* G4DNAGENERICIONSMANAGER_HH */
Index: trunk/source/processes/electromagnetic/lowenergy/include/G4LivermorePolarizedGammaConversionModel.hh
===================================================================
--- trunk/source/processes/electromagnetic/lowenergy/include/G4LivermorePolarizedGammaConversionModel.hh	(revision 1197)
+++ trunk/source/processes/electromagnetic/lowenergy/include/G4LivermorePolarizedGammaConversionModel.hh	(revision 1197)
@@ -0,0 +1,137 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4LivermorePolarizedGammaConversionModel.hh,v 1.1 2009/10/30 14:52:05 flongo Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
+//
+
+#ifndef G4LivermorePolarizedGammaConversionModel_h
+#define G4LivermorePolarizedGammaConversionModel_h 1
+
+#include "G4VEmModel.hh"
+#include "G4Electron.hh"
+#include "G4Positron.hh"
+#include "G4ParticleChangeForGamma.hh"
+#include "G4CrossSectionHandler.hh"
+#include "G4LogLogInterpolation.hh"
+#include "G4CompositeEMDataSet.hh"
+#include "G4ProductionCutsTable.hh"
+#include "G4ForceCondition.hh"
+
+
+class G4LivermorePolarizedGammaConversionModel : public G4VEmModel
+{
+
+public:
+
+  G4LivermorePolarizedGammaConversionModel(const G4ParticleDefinition* p = 0, 
+		                   const G4String& nam = "LivermorePolarizedGammaConversion");
+
+  virtual ~G4LivermorePolarizedGammaConversionModel();
+
+  virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&);
+
+  virtual G4double ComputeCrossSectionPerAtom(
+                                const G4ParticleDefinition*,
+                                      G4double kinEnergy, 
+                                      G4double Z, 
+                                      G4double A=0, 
+                                      G4double cut=0,
+                                      G4double emax=DBL_MAX);
+
+  virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
+				 const G4MaterialCutsCouple*,
+				 const G4DynamicParticle*,
+				 G4double tmin,
+				 G4double maxEnergy);
+
+protected:
+
+  G4ParticleChangeForGamma* fParticleChange;
+
+  G4double GetMeanFreePath(const G4Track& aTrack, 
+			   G4double previousStepSize, 
+			   G4ForceCondition* condition);
+private:
+
+  G4double lowEnergyLimit;  
+  G4double highEnergyLimit; 
+  G4bool isInitialised;
+  G4int verboseLevel;
+
+  G4VEMDataSet* meanFreePathTable;
+  G4VCrossSectionHandler* crossSectionHandler;
+
+
+  // specific methods for polarization 
+  
+  G4ThreeVector GetRandomPolarization(G4ThreeVector& direction0); // Random Polarization
+  G4ThreeVector GetPerpendicularPolarization(const G4ThreeVector& direction0, const G4ThreeVector& polarization0) const;
+  G4ThreeVector SetPerpendicularVector(G4ThreeVector& a); // temporary
+  void SystemOfRefChange(G4ThreeVector& direction0, G4ThreeVector& direction1, 
+			 G4ThreeVector& polarization0);
+
+  // Gamma Conversion methods 
+
+
+  G4double SetPhi(G4double);
+  G4double SetPsi(G4double, G4double); //
+
+  G4double ScreenFunction1(G4double screenVariable);
+  G4double ScreenFunction2(G4double screenVariable);
+  void SetTheta(G4double*, G4double*, G4double);
+
+  G4double Poli(G4double , G4double, G4double, G4double);
+  G4double Fln(G4double, G4double, G4double);
+
+  G4double Encu(G4double*, G4double*, G4double);
+
+  G4double Flor(G4double*, G4double);
+  G4double Glor(G4double*, G4double);
+
+  G4double Fdlor(G4double*, G4double);
+  G4double Fintlor(G4double*, G4double);
+  G4double Finvlor(G4double*, G4double,G4double);
+
+  G4double Ftan(G4double*, G4double);
+
+  //G4double Gtan(G4double*, G4double);
+
+  G4double Fdtan(G4double*, G4double);
+  G4double Finttan(G4double*, G4double);
+  G4double Finvtan(G4double*, G4double, G4double);
+
+  G4double smallEnergy;
+  G4double Psi, Phi;
+
+  
+  G4LivermorePolarizedGammaConversionModel & operator=(const  G4LivermorePolarizedGammaConversionModel &right);
+  G4LivermorePolarizedGammaConversionModel(const  G4LivermorePolarizedGammaConversionModel&);
+
+};
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+#endif
Index: trunk/source/processes/electromagnetic/lowenergy/include/G4LivermorePolarizedPhotoElectricModel.hh
===================================================================
--- trunk/source/processes/electromagnetic/lowenergy/include/G4LivermorePolarizedPhotoElectricModel.hh	(revision 1197)
+++ trunk/source/processes/electromagnetic/lowenergy/include/G4LivermorePolarizedPhotoElectricModel.hh	(revision 1197)
@@ -0,0 +1,128 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4LivermorePolarizedPhotoElectricModel.hh,v 1.1 2009/10/30 14:52:05 flongo Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
+//
+
+#ifndef G4LivermorePolarizedPhotoElectricModel_h
+#define G4LivermorePolarizedPhotoElectricModel_h 1
+
+#include "G4VEmModel.hh"
+#include "G4Electron.hh"
+#include "G4ParticleChangeForGamma.hh"
+#include "G4CrossSectionHandler.hh"
+#include "G4LogLogInterpolation.hh"
+#include "G4CompositeEMDataSet.hh"
+#include "G4ShellData.hh"
+#include "G4DopplerProfile.hh"
+#include "G4AtomicDeexcitation.hh"
+#include "G4AtomicTransitionManager.hh"
+#include "G4AtomicShell.hh"
+#include "G4ProductionCutsTable.hh"
+#include "G4ForceCondition.hh"
+
+
+class G4LivermorePolarizedPhotoElectricModel : public G4VEmModel
+{
+
+public:
+
+  G4LivermorePolarizedPhotoElectricModel(const G4ParticleDefinition* p = 0, 
+		                   const G4String& nam = "LivermorePolarizedPhotoElectric");
+
+  virtual ~G4LivermorePolarizedPhotoElectricModel();
+
+  virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&);
+
+  virtual G4double ComputeCrossSectionPerAtom(
+                                const G4ParticleDefinition*,
+                                      G4double kinEnergy, 
+                                      G4double Z, 
+                                      G4double A=0, 
+                                      G4double cut=0,
+                                      G4double emax=DBL_MAX);
+
+  virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
+				 const G4MaterialCutsCouple*,
+				 const G4DynamicParticle*,
+				 G4double tmin,
+				 G4double maxEnergy);
+
+
+  void SetCutForLowEnSecPhotons(G4double);
+
+  void SetCutForLowEnSecElectrons(G4double);
+
+  void ActivateAuger(G4bool);
+
+
+
+protected:
+
+  G4ParticleChangeForGamma* fParticleChange;
+
+  G4double GetMeanFreePath(const G4Track& aTrack, 
+			   G4double previousStepSize, 
+			   G4ForceCondition* condition);
+private:
+
+  G4double lowEnergyLimit;  
+  G4double highEnergyLimit; 
+  G4bool isInitialised;
+  G4int verboseLevel;
+
+  G4VEMDataSet* meanFreePathTable;
+  G4VCrossSectionHandler* crossSectionHandler;
+  G4VCrossSectionHandler* shellCrossSectionHandler;
+
+  G4double cutForLowEnergySecondaryPhotons;
+  G4double cutForLowEnergySecondaryElectrons;
+
+  G4AtomicDeexcitation deexcitationManager;
+
+
+  // specific methods for polarization 
+  
+  G4ThreeVector GetRandomPolarization(G4ThreeVector& direction0); // Random Polarization
+  G4ThreeVector GetPerpendicularPolarization(const G4ThreeVector& direction0, const G4ThreeVector& polarization0) const;
+  
+  G4ThreeVector SetPerpendicularVector(G4ThreeVector& a); // temporary
+  G4ThreeVector SetNewPolarization(G4double epsilon, G4double sinSqrTheta, 
+				   G4double phi, G4double cosTheta);
+  G4double SetPhi(G4double, G4double, G4double);
+  G4double SetCosTheta(G4double);
+  
+  void SystemOfRefChange(G4ThreeVector& direction0, G4ThreeVector& direction1, 
+			 G4ThreeVector& polarization0);
+  
+  G4LivermorePolarizedPhotoElectricModel & operator=(const  G4LivermorePolarizedPhotoElectricModel &right);
+  G4LivermorePolarizedPhotoElectricModel(const  G4LivermorePolarizedPhotoElectricModel&);
+
+};
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+#endif
Index: trunk/source/processes/electromagnetic/lowenergy/include/G4OrlicLiCrossSection.hh
===================================================================
--- trunk/source/processes/electromagnetic/lowenergy/include/G4OrlicLiCrossSection.hh	(revision 1197)
+++ trunk/source/processes/electromagnetic/lowenergy/include/G4OrlicLiCrossSection.hh	(revision 1197)
@@ -0,0 +1,82 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4OrlicLiCrossSection.hh,v 1.2 2009/06/11 15:46:18 mantero Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
+//
+// Author: Haifa Ben Abdelouahed
+//         
+//
+// History:
+// -----------
+//  23 Apr 2008   H. Ben Abdelouahed   1st implementation
+//  28 Apr 2008   MGP        Major revision according to a design iteration
+//  21 Apr 2009	  ALF Some correction for compatibility to G4VShellCrossSection
+//		  and changed name to G4OrlicLiCrossSection 
+//
+// -------------------------------------------------------------------
+
+// Class description:
+// Low Energy Electromagnetic Physics, Cross section, proton ionisation, L shell
+// Further documentation available from http://www.ge.infn.it/geant4/lowE
+
+// -------------------------------------------------------------------
+
+
+#ifndef G4ORLICLICROSSSECTION_HH
+#define G4ORLICLICROSSSECTION_HH 1
+
+#include "globals.hh"
+#include "G4AtomicTransitionManager.hh"
+
+class G4OrlicLiCrossSection 
+
+{
+public:
+
+  G4OrlicLiCrossSection();
+
+  virtual ~G4OrlicLiCrossSection();
+
+
+//according to I.ORLIC, C.H.SOW and S.M.TANG,International Journal of PIXE.Vol.4(1997) 217-230	
+		     
+  G4double CalculateL1CrossSection(G4int zTarget, G4double energyIncident);
+
+  G4double CalculateL2CrossSection(G4int zTarget, G4double energyIncident);				    
+ 
+  G4double CalculateL3CrossSection(G4int zTarget, G4double energyIncident);
+
+private:
+
+
+  G4OrlicLiCrossSection(const G4OrlicLiCrossSection&);
+  G4OrlicLiCrossSection & operator = (const G4OrlicLiCrossSection &right);
+
+  G4AtomicTransitionManager*  transitionManager;
+
+};
+
+#endif
Index: trunk/source/processes/electromagnetic/lowenergy/include/G4ecpssrKCrossSection.hh
===================================================================
--- trunk/source/processes/electromagnetic/lowenergy/include/G4ecpssrKCrossSection.hh	(revision 1197)
+++ trunk/source/processes/electromagnetic/lowenergy/include/G4ecpssrKCrossSection.hh	(revision 1197)
@@ -0,0 +1,114 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4ecpssrKCrossSection.hh,v 1.2 2009/06/11 15:46:18 mantero Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
+//
+// Author: Haifa Ben Abdelouahed
+//         
+//
+// History:
+// -----------
+//  21 Apr 2008   H. Ben Abdelouahed   1st implementation
+//  21 Apr 2008   MGP        Major revision according to a design iteration
+//  21 Apr 2009	  ALF Some correction for compatibility to G4VShellCrossSection
+//		  and changed name to G4ecpssrKCrossSection
+//
+// -------------------------------------------------------------------
+
+// Class description:
+// Low Energy Electromagnetic Physics, Cross section, p ionisation, K shell
+// Further documentation available from http://www.ge.infn.it/geant4/lowE
+
+// -------------------------------------------------------------------
+
+
+#ifndef G4ECPSSRKCROSSSECTION_HH
+#define G4ECPSSRKCROSSSECTION_HH 1
+
+#include "globals.hh"
+#include <map>
+#include <vector>
+
+#include "G4DNACrossSectionDataSet.hh"
+
+
+class G4ecpssrKCrossSection
+{
+public:
+
+  G4ecpssrKCrossSection();
+
+  ~G4ecpssrKCrossSection();
+			     
+  
+  G4double CalculateCrossSection(G4int, G4double, G4double);//according to W.Brandt and G.Lapicki, Phys.Rev.A23(1981)
+  
+  //  G4double CalculateVelocity(G4int zTarget,G4double massIncident, G4double energyIncident); 
+  
+  G4double  ExpIntFunction(G4int n,G4double x);//Exponential Integral Function
+  
+  
+  
+private:
+  
+  G4ecpssrKCrossSection(const G4ecpssrKCrossSection&);
+  G4ecpssrKCrossSection & operator = (const G4ecpssrKCrossSection &right);
+
+  G4double FunctionFK(G4double k, G4double theta);
+
+  G4double LogLogInterpolate(G4double e1, G4double e2, G4double e, G4double xs1, G4double xs2);
+   
+  G4double LinLogInterpolate(G4double e1, G4double e2, G4double e, G4double xs1, G4double xs2);
+   
+  G4double QuadInterpolator(G4double e11, 
+ 		            G4double e12, 
+			    G4double e21, 
+			    G4double e22, 
+			    G4double x11,
+			    G4double x12, 
+			    G4double x21, 
+			    G4double x22, 
+			    G4double t1, 
+			    G4double t2, 
+			    G4double t, 
+			    G4double e);
+
+  typedef std::map<double, std::map<double, double> > TriDimensionMap;
+
+  TriDimensionMap FKData;
+  std::vector<double> dummyVec;
+
+  typedef std::map<double, std::vector<double> > VecMap;
+  VecMap aVecMap;
+
+  G4int verboseLevel;
+
+  G4DNACrossSectionDataSet* tableC1;
+  G4DNACrossSectionDataSet* tableC2;
+  G4DNACrossSectionDataSet* tableC3;
+};
+  
+#endif
Index: trunk/source/processes/electromagnetic/lowenergy/include/G4ecpssrLiCrossSection.hh
===================================================================
--- trunk/source/processes/electromagnetic/lowenergy/include/G4ecpssrLiCrossSection.hh	(revision 1197)
+++ trunk/source/processes/electromagnetic/lowenergy/include/G4ecpssrLiCrossSection.hh	(revision 1197)
@@ -0,0 +1,117 @@
+
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4ecpssrLiCrossSection.hh,v 1.2 2009/06/22 13:54:00 mantero Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
+//
+// Author: Haifa Ben Abdelouahed
+//         
+//
+// History:
+// -----------
+//  23 Apr 2008   H. Ben Abdelouahed   1st implementation
+//  28 Apr 2008   MGP        Major revision according to a design iteration
+//  29 Apr 2009   ALF Updated Desing for Integration
+//
+// -------------------------------------------------------------------
+
+// Class description:
+// Low Energy Electromagnetic Physics, Cross section, p and alpha ionisation, L shell
+// Further documentation available from http://www.ge.infn.it/geant4/lowE
+
+// -------------------------------------------------------------------
+
+
+#ifndef G4ECPSSRLICROSSSECTION_HH
+#define G4ECPSSRLICROSSSECTION_HH 1
+
+#include "globals.hh"
+#include <map>
+#include <vector>
+
+class G4ecpssrLiCrossSection 
+
+{
+public:
+
+  G4ecpssrLiCrossSection();
+
+  ~G4ecpssrLiCrossSection();
+			     
+  G4double CalculateL1CrossSection(G4int zTarget,G4double massIncident, G4double energyIncident);//according to W.Brandt and G.Lapicki, Phys.Rev.A23(1981)
+
+  G4double CalculateL2CrossSection(G4int zTarget,G4double massIncident, G4double energyIncident);//according to W.Brandt and G.Lapicki, Phys.Rev.A23(1981)
+
+  G4double CalculateL3CrossSection(G4int zTarget,G4double massIncident, G4double energyIncident);//according to W.Brandt and G.Lapicki, Phys.Rev.A23(1981)
+				    
+  G4double CalculateVelocity(G4int subShell, G4int zTarget,G4double massIncident, G4double energyIncident); 
+			      
+  G4double  ExpIntFunction(G4int n,G4double x);//Exponential Integral Function
+
+   
+
+private:
+
+
+  G4ecpssrLiCrossSection(const G4ecpssrLiCrossSection&);
+  G4ecpssrLiCrossSection & operator = (const G4ecpssrLiCrossSection &right);
+
+  G4double FunctionFL1(G4double k, G4double theta);
+  
+  G4double FunctionFL2(G4double k, G4double theta);
+
+
+  G4double LogLogInterpolate(G4double e1, G4double e2, G4double e, G4double xs1, G4double xs2);
+   
+  G4double LinLogInterpolate(G4double e1, G4double e2, G4double e, G4double xs1, G4double xs2);
+   
+  G4double QuadInterpolator(G4double e11, 
+ 		            G4double e12, 
+			    G4double e21, 
+			    G4double e22, 
+			    G4double x11,
+			    G4double x12, 
+			    G4double x21, 
+			    G4double x22, 
+			    G4double t1, 
+			    G4double t2, 
+			    G4double t, 
+			    G4double e);
+
+  typedef std::map<double, std::map<double, double> > TriDimensionMap;
+
+  TriDimensionMap FL1Data;
+  
+  TriDimensionMap FL2Data;
+
+std::vector<double> dummyVec;
+
+  typedef std::map<double, std::vector<double> > VecMap;
+  VecMap aVecMap;
+
+};
+
+#endif
Index: trunk/source/processes/electromagnetic/lowenergy/include/G4empCrossSection.hh
===================================================================
--- trunk/source/processes/electromagnetic/lowenergy/include/G4empCrossSection.hh	(revision 1197)
+++ trunk/source/processes/electromagnetic/lowenergy/include/G4empCrossSection.hh	(revision 1197)
@@ -0,0 +1,90 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4empCrossSection.hh,v 1.1 2009/06/17 16:39:55 mantero Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
+//
+//         
+//
+// History:
+// -----------
+//  21 Apr 2009   ALF  1st implementation
+//
+// -------------------------------------------------------------------
+
+// Class description:
+// Low Energy Electromagnetic Physics, Cross section, p ionisation, K shell
+// Further documentation available from http://www.ge.infn.it/geant4/lowE
+
+// -------------------------------------------------------------------
+
+
+#ifndef G4EMPCROSSSECTION_HH
+#define G4EMPCROSSSECTION_HH 1
+
+#include "globals.hh"
+#include "G4VhShellCrossSection.hh"
+#include "G4PaulKCrossSection.hh"
+#include "G4OrlicLiCrossSection.hh"
+
+class G4empCrossSection : public G4VhShellCrossSection 
+{
+public:
+
+  G4empCrossSection();
+
+  ~G4empCrossSection();
+			     
+
+  std::vector<G4double> GetCrossSection(G4int Z,
+					G4double incidentEnergy,
+					G4double mass,
+					G4double deltaEnergy,
+					G4bool testFlag = false) const;
+
+  std::vector<G4double> Probabilities(G4int Z,
+				      G4double incidentEnergy,
+				      G4double mass,
+				      G4double deltaEnergy) const;
+  
+  
+  void SetTotalCS(G4double);
+  
+  
+  
+private:
+  
+  G4double totalCS;
+              
+  G4PaulKCrossSection*  paulShellK;
+  G4OrlicLiCrossSection* orlicShellLi;  
+			
+			
+  G4empCrossSection(const G4empCrossSection&);
+  G4empCrossSection & operator = (const G4empCrossSection &right);
+  
+};
+
+#endif
Index: trunk/source/processes/electromagnetic/lowenergy/include/G4teoCrossSection.hh
===================================================================
--- trunk/source/processes/electromagnetic/lowenergy/include/G4teoCrossSection.hh	(revision 1197)
+++ trunk/source/processes/electromagnetic/lowenergy/include/G4teoCrossSection.hh	(revision 1197)
@@ -0,0 +1,92 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4teoCrossSection.hh,v 1.4 2009/06/25 15:52:08 mantero Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
+//
+//         
+//
+// History:
+// -----------
+//  21 Apr 2008   ALF  1st implementation
+//  29 Apr 2009   ALF Updated Desing for Integration
+//
+// -------------------------------------------------------------------
+
+// Class description:
+// Low Energy Electromagnetic Physics, Cross section, p ionisation, K shell
+// Further documentation available from http://www.ge.infn.it/geant4/lowE
+
+// -------------------------------------------------------------------
+
+
+#ifndef G4TEOCROSSSECTION_HH
+#define G4ETEOCROSSSECTION_HH 1
+
+#include "globals.hh"
+#include "G4VhShellCrossSection.hh"
+
+#include "G4ecpssrKCrossSection.hh"
+#include "G4ecpssrLiCrossSection.hh"
+
+class G4teoCrossSection : public G4VhShellCrossSection 
+{
+public:
+
+  G4teoCrossSection(G4String);
+
+  ~G4teoCrossSection();
+			     
+
+  std::vector<G4double> GetCrossSection(G4int Z,
+					G4double incidentEnergy,
+					G4double mass,
+					G4double deltaEnergy = 0,
+					G4bool testFlag = false) const;
+
+  std::vector<G4double> Probabilities(G4int Z,
+				      G4double incidentEnergy,
+				      G4double mass,
+				      G4double deltaEnergy = 0) const;
+  
+  
+  void SetTotalCS(G4double);
+  
+  
+  
+private:
+  
+  G4double totalCS;
+              
+  G4ecpssrKCrossSection*  ecpssrShellK;
+  G4ecpssrLiCrossSection*  ecpssrShellLi;
+			
+			
+  G4teoCrossSection(const G4teoCrossSection&);
+  G4teoCrossSection & operator = (const G4teoCrossSection &right);
+  
+};
+
+#endif
Index: trunk/source/processes/electromagnetic/lowenergy/src/G4LivermorePolarizedGammaConversionModel.cc
===================================================================
--- trunk/source/processes/electromagnetic/lowenergy/src/G4LivermorePolarizedGammaConversionModel.cc	(revision 1197)
+++ trunk/source/processes/electromagnetic/lowenergy/src/G4LivermorePolarizedGammaConversionModel.cc	(revision 1197)
@@ -0,0 +1,945 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+
+#include "G4LivermorePolarizedGammaConversionModel.hh"
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+using namespace std;
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+G4LivermorePolarizedGammaConversionModel::G4LivermorePolarizedGammaConversionModel(const G4ParticleDefinition*,
+                                             const G4String& nam)
+  :G4VEmModel(nam),isInitialised(false),meanFreePathTable(0),crossSectionHandler(0)
+{
+  lowEnergyLimit = 1.0220000 * MeV; 
+  highEnergyLimit = 100 * GeV;
+  SetLowEnergyLimit(lowEnergyLimit);
+  SetHighEnergyLimit(highEnergyLimit);
+  smallEnergy = 2.*MeV;
+
+
+  verboseLevel= 0;
+  // Verbosity scale:
+  // 0 = nothing 
+  // 1 = warning for energy non-conservation 
+  // 2 = details of energy budget
+  // 3 = calculation of cross sections, file openings, samping of atoms
+  // 4 = entering in methods
+
+  G4cout << "Livermore Polarized GammaConversion is constructed " << G4endl
+         << "Energy range: "
+         << lowEnergyLimit / keV << " keV - "
+         << highEnergyLimit / GeV << " GeV"
+         << G4endl;
+
+  crossSectionHandler = new G4CrossSectionHandler();
+  crossSectionHandler->Initialise(0,1.0220*MeV,100.*GeV,400);
+
+
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+G4LivermorePolarizedGammaConversionModel::~G4LivermorePolarizedGammaConversionModel()
+{  
+  //  if (meanFreePathTable)   delete meanFreePathTable;
+  if (crossSectionHandler) delete crossSectionHandler;
+}
+
+
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+void G4LivermorePolarizedGammaConversionModel::Initialise(const G4ParticleDefinition* particle,
+                                       const G4DataVector& cuts)
+{
+  if (verboseLevel > 3)
+    G4cout << "Calling G4LivermorePolarizedGammaConversionModel::Initialise()" << G4endl;
+
+  if (crossSectionHandler)
+  {
+    crossSectionHandler->Clear();
+    delete crossSectionHandler;
+  }
+
+
+  // Energy limits
+  
+  if (LowEnergyLimit() < lowEnergyLimit)
+    {
+      G4cout << "G4LivermorePolarizedGammaConversionModel: low energy limit increased from " << 
+	LowEnergyLimit()/eV << " eV to " << lowEnergyLimit << " eV" << G4endl;
+      SetLowEnergyLimit(lowEnergyLimit);
+    }
+
+  if (HighEnergyLimit() > highEnergyLimit)
+    {
+      G4cout << "G4LivermorePolarizedGammaConversionModel: high energy limit decreased from " << 
+	HighEnergyLimit()/GeV << " GeV to " << highEnergyLimit << " GeV" << G4endl;
+      SetHighEnergyLimit(highEnergyLimit);
+    }
+
+  // Reading of data files - all materials are read
+  
+  crossSectionHandler = new G4CrossSectionHandler;
+  crossSectionHandler->Clear();
+  G4String crossSectionFile = "pair/pp-cs-";
+  crossSectionHandler->LoadData(crossSectionFile);
+
+  //  meanFreePathTable = 0;
+  //meanFreePathTable = crossSectionHandler->BuildMeanFreePathForMaterials();
+
+
+  //
+  if (verboseLevel > 2) 
+    G4cout << "Loaded cross section files for Livermore Polarized GammaConversion model" << G4endl;
+
+  InitialiseElementSelectors(particle,cuts);
+
+  G4cout << "Livermore Polarized GammaConversion model is initialized " << G4endl
+         << "Energy range: "
+         << LowEnergyLimit() / keV << " keV - "
+         << HighEnergyLimit() / GeV << " GeV"
+         << G4endl;
+
+  //
+    
+  if(isInitialised) return;
+
+  if(pParticleChange)
+    fParticleChange = reinterpret_cast<G4ParticleChangeForGamma*>(pParticleChange);
+  else
+    fParticleChange = new G4ParticleChangeForGamma();
+    
+  isInitialised = true;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+G4double G4LivermorePolarizedGammaConversionModel::ComputeCrossSectionPerAtom(
+                                       const G4ParticleDefinition*,
+                                             G4double GammaEnergy,
+                                             G4double Z, G4double,
+                                             G4double, G4double)
+{
+  if (verboseLevel > 3)
+    G4cout << "Calling ComputeCrossSectionPerAtom() of G4LivermorePolarizedGammaConversionModel" << G4endl;
+
+  G4double cs = crossSectionHandler->FindValue(G4int(Z), GammaEnergy);
+  return cs;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+void G4LivermorePolarizedGammaConversionModel::SampleSecondaries(std::vector<G4DynamicParticle*>* fvect,
+							       const G4MaterialCutsCouple* couple,
+							       const G4DynamicParticle* aDynamicGamma,
+							       G4double,
+							       G4double)
+{
+
+  // Fluorescence generated according to:
+  // J. Stepanek ,"A program to determine the radiation spectra due to a single atomic
+  // subshell ionisation by a particle or due to deexcitation or decay of radionuclides",
+  // Comp. Phys. Comm. 1206 pp 1-1-9 (1997)
+
+  if (verboseLevel > 3)
+    G4cout << "Calling SampleSecondaries() of G4LivermorePolarizedGammaConversionModel" << G4endl;
+
+  G4double photonEnergy = aDynamicGamma->GetKineticEnergy();
+  // Within energy limit?
+
+  if(photonEnergy <= lowEnergyLimit)
+    {
+      fParticleChange->ProposeTrackStatus(fStopAndKill);
+      fParticleChange->SetProposedKineticEnergy(0.);
+      return;
+    }
+
+
+  G4ThreeVector gammaPolarization0 = aDynamicGamma->GetPolarization();
+  G4ThreeVector gammaDirection0 = aDynamicGamma->GetMomentumDirection();
+
+  // Make sure that the polarization vector is perpendicular to the
+  // gamma direction. If not
+
+  if(!(gammaPolarization0.isOrthogonal(gammaDirection0, 1e-6))||(gammaPolarization0.mag()==0))
+    { // only for testing now
+      gammaPolarization0 = GetRandomPolarization(gammaDirection0);
+    }
+  else
+    {
+      if ( gammaPolarization0.howOrthogonal(gammaDirection0) != 0)
+	{
+	  gammaPolarization0 = GetPerpendicularPolarization(gammaDirection0, gammaPolarization0);
+	}
+    }
+
+  // End of Protection
+
+
+  G4double epsilon ;
+  G4double epsilon0 = electron_mass_c2 / photonEnergy ;
+
+  // Do it fast if photon energy < 2. MeV
+
+  if (photonEnergy < smallEnergy )
+    {
+      epsilon = epsilon0 + (0.5 - epsilon0) * G4UniformRand();
+    }
+  else
+    {
+
+ // Select randomly one element in the current material
+
+      //     G4int Z = crossSectionHandler->SelectRandomAtom(couple,photonEnergy);
+      const G4Element* element = crossSectionHandler->SelectRandomElement(couple,photonEnergy);
+
+      if (element == 0)
+        {
+          G4cout << "G4LivermorePolarizedGammaConversionModel::PostStepDoIt - element = 0" << G4endl;
+        }
+      G4IonisParamElm* ionisation = element->GetIonisation();
+      if (ionisation == 0)
+        {
+          G4cout << "G4LivermorePolarizedGammaConversionModel::PostStepDoIt - ionisation = 0" << G4endl;
+        }
+
+
+
+      // Extract Coulomb factor for this Element
+
+      G4double fZ = 8. * (ionisation->GetlogZ3());
+      if (photonEnergy > 50. * MeV) fZ += 8. * (element->GetfCoulomb());
+
+      // Limits of the screening variable
+      G4double screenFactor = 136. * epsilon0 / (element->GetIonisation()->GetZ3()) ;
+      G4double screenMax = exp ((42.24 - fZ)/8.368) - 0.952 ;
+      G4double screenMin = std::min(4.*screenFactor,screenMax) ;
+
+      // Limits of the energy sampling
+      G4double epsilon1 = 0.5 - 0.5 * sqrt(1. - screenMin / screenMax) ;
+      G4double epsilonMin = std::max(epsilon0,epsilon1);
+      G4double epsilonRange = 0.5 - epsilonMin ;
+
+      // Sample the energy rate of the created electron (or positron)
+      G4double screen;
+      G4double gReject ;
+
+      G4double f10 = ScreenFunction1(screenMin) - fZ;
+      G4double f20 = ScreenFunction2(screenMin) - fZ;
+      G4double normF1 = std::max(f10 * epsilonRange * epsilonRange,0.);
+      G4double normF2 = std::max(1.5 * f20,0.);
+
+      do {
+        if (normF1 / (normF1 + normF2) > G4UniformRand() )
+          {
+            epsilon = 0.5 - epsilonRange * pow(G4UniformRand(), 0.3333) ;
+            screen = screenFactor / (epsilon * (1. - epsilon));
+            gReject = (ScreenFunction1(screen) - fZ) / f10 ;
+          }
+        else
+          {
+            epsilon = epsilonMin + epsilonRange * G4UniformRand();
+            screen = screenFactor / (epsilon * (1 - epsilon));
+            gReject = (ScreenFunction2(screen) - fZ) / f20 ;
+
+
+	  }
+      } while ( gReject < G4UniformRand() );
+
+    }   //  End of epsilon sampling
+  
+  // Fix charges randomly
+  
+  G4double electronTotEnergy;
+  G4double positronTotEnergy;
+
+
+  if (CLHEP::RandBit::shootBit())
+    {
+      electronTotEnergy = (1. - epsilon) * photonEnergy;
+      positronTotEnergy = epsilon * photonEnergy;
+    }
+  else
+    {
+      positronTotEnergy = (1. - epsilon) * photonEnergy;
+      electronTotEnergy = epsilon * photonEnergy;
+    }
+
+  // Scattered electron (positron) angles. ( Z - axis along the parent photon)
+  // Universal distribution suggested by L. Urban (Geant3 manual (1993) Phys211),
+  // derived from Tsai distribution (Rev. Mod. Phys. 49, 421 (1977)
+
+  G4double u;
+  const G4double a1 = 0.625;
+  G4double a2 = 3. * a1;
+
+  if (0.25 > G4UniformRand())
+    {
+      u = - log(G4UniformRand() * G4UniformRand()) / a1 ;
+    }
+  else
+    {
+      u = - log(G4UniformRand() * G4UniformRand()) / a2 ;
+    }
+
+  G4double Ene = electronTotEnergy/electron_mass_c2; // Normalized energy
+
+  G4double cosTheta = 0.;
+  G4double sinTheta = 0.;
+
+  SetTheta(&cosTheta,&sinTheta,Ene);
+
+  //  G4double theta = u * electron_mass_c2 / photonEnergy ;
+  //  G4double phi  = twopi * G4UniformRand() ;
+
+  G4double phi,psi=0.;
+
+  //corrected e+ e- angular angular distribution //preliminary!
+
+  //  if(photonEnergy>50*MeV)
+  // {
+  phi = SetPhi(photonEnergy);
+  psi = SetPsi(photonEnergy,phi);
+  //  }
+  //else
+  // {
+  //psi = G4UniformRand()*2.*pi;
+  //phi = pi; // coplanar
+  // }
+
+  Psi = psi;
+  Phi = phi;
+  //G4cout << "PHI " << phi << G4endl;
+  //G4cout << "PSI " << psi << G4endl;
+
+  G4double phie = psi; //azimuthal angle for the electron
+
+  G4double dirX = sinTheta*cos(phie);
+  G4double dirY = sinTheta*sin(phie);
+  G4double dirZ = cosTheta;
+  G4ThreeVector electronDirection(dirX,dirY,dirZ);
+  // Kinematics of the created pair:
+  // the electron and positron are assumed to have a symetric angular
+  // distribution with respect to the Z axis along the parent photon
+
+  //G4double localEnergyDeposit = 0. ;
+
+  G4double electronKineEnergy = std::max(0.,electronTotEnergy - electron_mass_c2) ;
+
+  SystemOfRefChange(gammaDirection0,electronDirection,
+		    gammaPolarization0);
+
+  G4DynamicParticle* particle1 = new G4DynamicParticle (G4Electron::Electron(),
+							electronDirection,
+							electronKineEnergy);
+
+  // The e+ is always created (even with kinetic energy = 0) for further annihilation
+
+  Ene = positronTotEnergy/electron_mass_c2; // Normalized energy
+
+  cosTheta = 0.;
+  sinTheta = 0.;
+
+  SetTheta(&cosTheta,&sinTheta,Ene);
+  G4double phip = phie+phi; //azimuthal angle for the positron
+
+  dirX = sinTheta*cos(phip);
+  dirY = sinTheta*sin(phip);
+  dirZ = cosTheta;
+  G4ThreeVector positronDirection(dirX,dirY,dirZ);
+
+  G4double positronKineEnergy = std::max(0.,positronTotEnergy - electron_mass_c2) ;
+  SystemOfRefChange(gammaDirection0,positronDirection,
+		    gammaPolarization0);
+
+  // Create G4DynamicParticle object for the particle2
+  G4DynamicParticle* particle2 = new G4DynamicParticle(G4Positron::Positron(),
+                                                       positronDirection, positronKineEnergy);
+
+
+  fvect->push_back(particle1);
+  fvect->push_back(particle2);
+
+
+
+  // Kill the incident photon
+
+
+
+  // Create lists of pointers to DynamicParticles (photons and electrons)
+  // (Is the electron vector necessary? To be checked)
+  //  std::vector<G4DynamicParticle*>* photonVector = 0;
+  //std::vector<G4DynamicParticle*> electronVector;
+
+  fParticleChange->ProposeMomentumDirection( 0., 0., 0. );
+  fParticleChange->SetProposedKineticEnergy(0.);
+  fParticleChange->ProposeTrackStatus(fStopAndKill);
+
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+G4double G4LivermorePolarizedGammaConversionModel::ScreenFunction1(G4double screenVariable)
+{
+  // Compute the value of the screening function 3*phi1 - phi2
+
+  G4double value;
+
+  if (screenVariable > 1.)
+    value = 42.24 - 8.368 * log(screenVariable + 0.952);
+  else
+    value = 42.392 - screenVariable * (7.796 - 1.961 * screenVariable);
+
+  return value;
+}
+
+
+
+G4double G4LivermorePolarizedGammaConversionModel::ScreenFunction2(G4double screenVariable)
+{
+  // Compute the value of the screening function 1.5*phi1 - 0.5*phi2
+
+  G4double value;
+
+  if (screenVariable > 1.)
+    value = 42.24 - 8.368 * log(screenVariable + 0.952);
+  else
+    value = 41.405 - screenVariable * (5.828 - 0.8945 * screenVariable);
+
+  return value;
+}
+
+
+void G4LivermorePolarizedGammaConversionModel::SetTheta(G4double* p_cosTheta, G4double* p_sinTheta, G4double Energy)
+{
+
+  // to avoid computational errors since Theta could be very small
+  // Energy in Normalized Units (!)
+
+  G4double Momentum = sqrt(Energy*Energy -1);
+  G4double Rand = G4UniformRand();
+
+  *p_cosTheta = (Energy*((2*Rand)- 1) + Momentum)/((Momentum*(2*Rand-1))+Energy);
+  *p_sinTheta = (2*sqrt(Rand*(1-Rand)))/(Momentum*(2*Rand-1)+Energy);
+}
+
+
+
+G4double G4LivermorePolarizedGammaConversionModel::SetPhi(G4double Energy)
+{
+
+
+  G4double value = 0.;
+  G4double Ene = Energy/MeV;
+
+  G4double pl[4];
+
+
+  G4double pt[2];
+  G4double xi = 0;
+  G4double xe = 0.;
+  G4double n1=0.;
+  G4double n2=0.;
+
+
+  if (Ene>=50.)
+    {
+      const G4double ay0=5.6, by0=18.6, aa0=2.9, ba0 = 8.16E-3;
+      const G4double aw = 0.0151, bw = 10.7, cw = -410.;
+
+      const G4double axc = 3.1455, bxc = -1.11, cxc = 310.;
+
+      pl[0] = Fln(ay0,by0,Ene);
+      pl[1] = aa0 + ba0*(Ene);
+      pl[2] = Poli(aw,bw,cw,Ene);
+      pl[3] = Poli(axc,bxc,cxc,Ene);
+
+      const G4double abf = 3.1216, bbf = 2.68;
+      pt[0] = -1.4;
+      pt[1] = abf + bbf/Ene;
+
+
+
+      //G4cout << "PL > 50. "<< pl[0] << " " << pl[1] << " " << pl[2] << " " <<pl[3] << " " << G4endl;
+
+      xi = 3.0;
+      xe = Encu(pl,pt,xi);
+      //G4cout << "ENCU "<< xe << G4endl;
+      n1 = Fintlor(pl,pi) - Fintlor(pl,xe);
+      n2 = Finttan(pt,xe) - Finttan(pt,0.);
+    }
+  else
+    {
+      const G4double ay0=0.144, by0=0.11;
+      const G4double aa0=2.7, ba0 = 2.74;
+      const G4double aw = 0.21, bw = 10.8, cw = -58.;
+      const G4double axc = 3.17, bxc = -0.87, cxc = -6.;
+
+      pl[0] = Fln(ay0, by0, Ene);
+      pl[1] = Fln(aa0, ba0, Ene);
+      pl[2] = Poli(aw,bw,cw,Ene);
+      pl[3] = Poli(axc,bxc,cxc,Ene);
+
+      //G4cout << "PL < 50."<< pl[0] << " " << pl[1] << " " << pl[2] << " " <<pl[3] << " " << G4endl;
+      //G4cout << "ENCU "<< xe << G4endl;
+      n1 = Fintlor(pl,pi) - Fintlor(pl,xe);
+
+    }
+
+
+  G4double n=0.;
+  n = n1+n2;
+
+  G4double c1 = 0.;
+  c1 = Glor(pl, xe);
+
+  G4double xm = 0.;
+  xm = Flor(pl,pl[3])*Glor(pl,pl[3]);
+
+  G4double r1,r2,r3;
+  G4double xco=0.;
+
+  if (Ene>=50.)
+    {
+      r1= G4UniformRand();
+      if( r1>=n2/n)
+        {
+          do
+	    {
+              r2 = G4UniformRand();
+              value = Finvlor(pl,xe,r2);
+              xco = Glor(pl,value)/c1;
+              r3 = G4UniformRand();
+            } while(r3>=xco);
+        }
+      else
+        {
+          value = Finvtan(pt,n,r1);
+        }
+    }
+  else
+    {
+      do
+        {
+          r2 = G4UniformRand();
+          value = Finvlor(pl,xe,r2);
+          xco = Glor(pl,value)/c1;
+          r3 = G4UniformRand();
+        } while(r3>=xco);
+    }
+
+  //  G4cout << "PHI = " <<value <<  G4endl;
+  return value;
+}
+G4double G4LivermorePolarizedGammaConversionModel::SetPsi(G4double Energy, G4double Phi)
+{
+
+  G4double value = 0.;
+  G4double Ene = Energy/MeV;
+
+  G4double p0l[4];
+  G4double ppml[4];
+  G4double p0t[2];
+  G4double ppmt[2];
+
+  G4double xi = 0.;
+  G4double xe0 = 0.;
+  G4double xepm = 0.;
+
+  if (Ene>=50.)
+    {
+      const G4double ay00 = 3.4, by00 = 9.8, aa00 = 1.34, ba00 = 5.3;
+      const G4double aw0 = 0.014, bw0 = 9.7, cw0 = -2.E4;
+      const G4double axc0 = 3.1423, bxc0 = -2.35, cxc0 = 0.;
+      const G4double ay0p = 1.53, by0p = 3.2, aap = 0.67, bap = 8.5E-3;
+      const G4double awp = 6.9E-3, bwp = 12.6, cwp = -3.8E4;
+      const G4double axcp = 2.8E-3,bxcp = -3.133;
+      const G4double abf0 = 3.1213, bbf0 = 2.61;
+      const G4double abfpm = 3.1231, bbfpm = 2.84;
+
+      p0l[0] = Fln(ay00, by00, Ene);
+      p0l[1] = Fln(aa00, ba00, Ene);
+      p0l[2] = Poli(aw0, bw0, cw0, Ene);
+      p0l[3] = Poli(axc0, bxc0, cxc0, Ene);
+
+      ppml[0] = Fln(ay0p, by0p, Ene);
+      ppml[1] = aap + bap*(Ene);
+      ppml[2] = Poli(awp, bwp, cwp, Ene);
+      ppml[3] = Fln(axcp,bxcp,Ene);
+
+      p0t[0] = -0.81;
+      p0t[1] = abf0 + bbf0/Ene;
+      ppmt[0] = -0.6;
+      ppmt[1] = abfpm + bbfpm/Ene;
+
+      //G4cout << "P0L > 50"<< p0l[0] << " " << p0l[1] << " " << p0l[2] << " " <<p0l[3] << " " << G4endl;
+      //G4cout << "PPML > 50"<< ppml[0] << " " << ppml[1] << " " << ppml[2] << " " <<ppml[3] << " " << G4endl;
+
+      xi = 3.0;
+      xe0 = Encu(p0l, p0t, xi);
+      //G4cout << "ENCU1 "<< xe0 << G4endl;
+      xepm = Encu(ppml, ppmt, xi);
+
+
+      //G4cout << "ENCU2 "<< xepm << G4endl;
+
+    }
+  else
+    {
+      const G4double ay00 = 2.82, by00 = 6.35;
+      const G4double aa00 = -1.75, ba00 = 0.25;
+
+      const G4double aw0 = 0.028, bw0 = 5., cw0 = -50.;
+      const G4double axc0 = 3.14213, bxc0 = -2.3, cxc0 = 5.7;
+      const G4double ay0p = 1.56, by0p = 3.6;
+      const G4double aap = 0.86, bap = 8.3E-3;
+      const G4double awp = 0.022, bwp = 7.4, cwp = -51.;
+      const G4double xcp = 3.1486;
+
+      p0l[0] = Fln(ay00, by00, Ene);
+      p0l[1] = aa00+pow(Ene, ba00);
+      p0l[2] = Poli(aw0, bw0, cw0, Ene);
+      p0l[3] = Poli(axc0, bxc0, cxc0, Ene);
+      ppml[0] = Fln(ay0p, by0p, Ene);
+      ppml[1] = aap + bap*(Ene);
+      ppml[2] = Poli(awp, bwp, cwp, Ene);
+      ppml[3] = xcp;
+
+    }
+
+
+
+  G4double a,b=0.;
+
+  if (Ene>=50.)
+    {
+      if (Phi>xepm)
+	{
+          b = (ppml[0]+2*ppml[1]*ppml[2]*Flor(ppml,Phi));
+        }
+      else
+        {
+          b = Ftan(ppmt,Phi);
+        }
+      if (Phi>xe0)
+        {
+          a = (p0l[0]+2*p0l[1]*p0l[2]*Flor(p0l,Phi));
+        }
+      else
+        {
+          a = Ftan(p0t,Phi);
+        }
+    }
+  else
+    {
+      b = (ppml[0]+2*ppml[1]*ppml[2]*Flor(ppml,Phi));
+      a = (p0l[0]+2*p0l[1]*p0l[2]*Flor(p0l,Phi));
+    }
+  G4double nr =0.;
+
+  if (b>a)
+    {
+      nr = 1./b;
+    }
+  else
+    {
+      nr = 1./a;
+    }
+
+  G4double r1,r2=0.;
+  G4double r3 =-1.;
+  do
+    {
+      r1 = G4UniformRand();
+      r2 = G4UniformRand();
+      value = r2*pi;
+      r3 = nr*(a*cos(value)*cos(value) + b*sin(value)*sin(value));
+    }while(r1>r3);
+
+  return value;
+}
+
+
+G4double G4LivermorePolarizedGammaConversionModel::Poli
+(G4double a, G4double b, G4double c, G4double x)
+{
+  G4double value=0.;
+  if(x>0.)
+    {
+      value =(a + b/x + c/(x*x*x));
+    }
+  else
+    {
+      //G4cout << "ERROR in Poli! " << G4endl;
+    }
+  return value;
+}
+G4double G4LivermorePolarizedGammaConversionModel::Fln
+(G4double a, G4double b, G4double x)
+{
+  G4double value=0.;
+  if(x>0.)
+    {
+      value =(a*log(x)-b);
+    }
+  else
+    {
+      //G4cout << "ERROR in Fln! " << G4endl;
+    }
+  return value;
+}
+
+
+G4double G4LivermorePolarizedGammaConversionModel::Encu
+(G4double* p_p1, G4double* p_p2, G4double x)
+{
+  G4double value=0.;
+  G4int i=0;
+  G4double fx = 1.;
+
+  do
+    {
+      x -= (Flor(p_p1, x)*Glor(p_p1,x) - Ftan(p_p2, x))/
+        (Fdlor(p_p1,x) - Fdtan(p_p2,x));
+      fx = Flor(p_p1,x)*Glor(p_p1,x) - Ftan(p_p2, x);
+      i += 1;
+      //G4cout << abs(fx) << " " << i << " " << x << "dentro ENCU " << G4endl;
+    } while( (i<100) && (abs(fx) > 1e-6)) ;
+
+  if (i>100||x>pi) x = 3.0;
+  value = x;
+
+  if (value<0.) value=0.;
+
+  return value;
+}
+
+
+
+
+G4double G4LivermorePolarizedGammaConversionModel::Flor(G4double* p_p1, G4double x)
+{
+  G4double value =0.;
+  // G4double y0 = p_p1[0];
+  // G4double A = p_p1[1];
+  G4double w = p_p1[2];
+  G4double xc = p_p1[3];
+
+  value = 1./(pi*(w*w + 4.*(x-xc)*(x-xc)));
+  return value;
+}
+
+G4double G4LivermorePolarizedGammaConversionModel::Glor(G4double* p_p1, G4double x)
+{
+  G4double value =0.;
+  G4double y0 = p_p1[0];
+  G4double A = p_p1[1];
+  G4double w = p_p1[2];
+  G4double xc = p_p1[3];
+
+  value = (y0 *pi*(w*w +  4.*(x-xc)*(x-xc)) + 2.*A*w);
+  return value;
+}
+
+G4double G4LivermorePolarizedGammaConversionModel::Fdlor(G4double* p_p1, G4double x)
+{
+  G4double value =0.;
+  //G4double y0 = p_p1[0];
+  G4double A = p_p1[1];
+  G4double w = p_p1[2];
+  G4double xc = p_p1[3];
+
+  value = (-16.*A*w*(x-xc))/
+    (pi*(w*w+4.*(x-xc)*(x-xc))*(w*w+4.*(x-xc)*(x-xc)));
+  return value;
+}
+
+
+G4double G4LivermorePolarizedGammaConversionModel::Fintlor(G4double* p_p1, G4double x)
+{
+  G4double value =0.;
+  G4double y0 = p_p1[0];
+  G4double A = p_p1[1];
+  G4double w = p_p1[2];
+  G4double xc = p_p1[3];
+
+  value = y0*x + A*atan( 2*(x-xc)/w) / pi;
+  return value;
+}
+
+
+G4double G4LivermorePolarizedGammaConversionModel::Finvlor(G4double* p_p1, G4double x, G4double r)
+{
+  G4double value = 0.;
+  G4double nor = 0.;
+  //G4double y0 = p_p1[0];
+  //  G4double A = p_p1[1];
+  G4double w = p_p1[2];
+  G4double xc = p_p1[3];
+
+  nor = atan(2.*(pi-xc)/w)/(2.*pi*w) - atan(2.*(x-xc)/w)/(2.*pi*w);
+  value = xc - (w/2.)*tan(-2.*r*nor*pi*w+atan(2*(xc-x)/w));
+
+  return value;
+}
+
+G4double G4LivermorePolarizedGammaConversionModel::Ftan(G4double* p_p1, G4double x)
+{
+  G4double value =0.;
+  G4double a = p_p1[0];
+  G4double b = p_p1[1];
+
+  value = a /(x-b);
+  return value;
+}
+
+
+G4double G4LivermorePolarizedGammaConversionModel::Fdtan(G4double* p_p1, G4double x)
+{
+  G4double value =0.;
+  G4double a = p_p1[0];
+  G4double b = p_p1[1];
+
+  value = -1.*a / ((x-b)*(x-b));
+  return value;
+}
+
+
+G4double G4LivermorePolarizedGammaConversionModel::Finttan(G4double* p_p1, G4double x)
+{
+  G4double value =0.;
+  G4double a = p_p1[0];
+  G4double b = p_p1[1];
+
+
+  value = a*log(b-x);
+  return value;
+}
+
+G4double G4LivermorePolarizedGammaConversionModel::Finvtan(G4double* p_p1, G4double cnor, G4double r)
+{
+  G4double value =0.;
+  G4double a = p_p1[0];
+  G4double b = p_p1[1];
+
+  value = b*(1-exp(r*cnor/a));
+
+  return value;
+}
+
+
+
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+G4ThreeVector G4LivermorePolarizedGammaConversionModel::SetPerpendicularVector(G4ThreeVector& a)
+{
+  G4double dx = a.x();
+  G4double dy = a.y();
+  G4double dz = a.z();
+  G4double x = dx < 0.0 ? -dx : dx;
+  G4double y = dy < 0.0 ? -dy : dy;
+  G4double z = dz < 0.0 ? -dz : dz;
+  if (x < y) {
+    return x < z ? G4ThreeVector(-dy,dx,0) : G4ThreeVector(0,-dz,dy);
+  }else{
+    return y < z ? G4ThreeVector(dz,0,-dx) : G4ThreeVector(-dy,dx,0);
+  }
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+G4ThreeVector G4LivermorePolarizedGammaConversionModel::GetRandomPolarization(G4ThreeVector& direction0)
+{
+  G4ThreeVector d0 = direction0.unit();
+  G4ThreeVector a1 = SetPerpendicularVector(d0); //different orthogonal
+  G4ThreeVector a0 = a1.unit(); // unit vector
+
+  G4double rand1 = G4UniformRand();
+  
+  G4double angle = twopi*rand1; // random polar angle
+  G4ThreeVector b0 = d0.cross(a0); // cross product
+  
+  G4ThreeVector c;
+  
+  c.setX(std::cos(angle)*(a0.x())+std::sin(angle)*b0.x());
+  c.setY(std::cos(angle)*(a0.y())+std::sin(angle)*b0.y());
+  c.setZ(std::cos(angle)*(a0.z())+std::sin(angle)*b0.z());
+  
+  G4ThreeVector c0 = c.unit();
+
+  return c0;
+  
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+G4ThreeVector G4LivermorePolarizedGammaConversionModel::GetPerpendicularPolarization
+(const G4ThreeVector& gammaDirection, const G4ThreeVector& gammaPolarization) const
+{
+
+  // 
+  // The polarization of a photon is always perpendicular to its momentum direction.
+  // Therefore this function removes those vector component of gammaPolarization, which
+  // points in direction of gammaDirection
+  //
+  // Mathematically we search the projection of the vector a on the plane E, where n is the
+  // plains normal vector.
+  // The basic equation can be found in each geometry book (e.g. Bronstein):
+  // p = a - (a o n)/(n o n)*n
+  
+  return gammaPolarization - gammaPolarization.dot(gammaDirection)/gammaDirection.dot(gammaDirection) * gammaDirection;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+
+void G4LivermorePolarizedGammaConversionModel::SystemOfRefChange
+    (G4ThreeVector& direction0,G4ThreeVector& direction1,
+     G4ThreeVector& polarization0)
+{
+  // direction0 is the original photon direction ---> z
+  // polarization0 is the original photon polarization ---> x
+  // need to specify y axis in the real reference frame ---> y 
+  G4ThreeVector Axis_Z0 = direction0.unit();
+  G4ThreeVector Axis_X0 = polarization0.unit();
+  G4ThreeVector Axis_Y0 = (Axis_Z0.cross(Axis_X0)).unit(); // to be confirmed;
+  
+  G4double direction_x = direction1.getX();
+  G4double direction_y = direction1.getY();
+  G4double direction_z = direction1.getZ();
+  
+  direction1 = (direction_x*Axis_X0 + direction_y*Axis_Y0 +  direction_z*Axis_Z0).unit();
+  
+}
+
+
+
+
Index: trunk/source/processes/electromagnetic/lowenergy/src/G4LivermorePolarizedPhotoElectricModel.cc
===================================================================
--- trunk/source/processes/electromagnetic/lowenergy/src/G4LivermorePolarizedPhotoElectricModel.cc	(revision 1197)
+++ trunk/source/processes/electromagnetic/lowenergy/src/G4LivermorePolarizedPhotoElectricModel.cc	(revision 1197)
@@ -0,0 +1,553 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+
+#include "G4LivermorePolarizedPhotoElectricModel.hh"
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+using namespace std;
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+G4LivermorePolarizedPhotoElectricModel::G4LivermorePolarizedPhotoElectricModel(const G4ParticleDefinition*,
+                                             const G4String& nam)
+  :G4VEmModel(nam),isInitialised(false),meanFreePathTable(0),crossSectionHandler(0), shellCrossSectionHandler(0)
+{
+  lowEnergyLimit = 250 * eV; // SI - Could be 10 eV ?
+  highEnergyLimit = 100 * GeV;
+  SetLowEnergyLimit(lowEnergyLimit);
+  SetHighEnergyLimit(highEnergyLimit);
+  
+  verboseLevel= 0;
+  // Verbosity scale:
+  // 0 = nothing 
+  // 1 = warning for energy non-conservation 
+  // 2 = details of energy budget
+  // 3 = calculation of cross sections, file openings, sampling of atoms
+  // 4 = entering in methods
+
+  G4cout << "Livermore Polarized PhotoElectric is constructed " << G4endl
+         << "Energy range: "
+         << lowEnergyLimit / keV << " keV - "
+         << highEnergyLimit / GeV << " GeV"
+         << G4endl;
+
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+G4LivermorePolarizedPhotoElectricModel::~G4LivermorePolarizedPhotoElectricModel()
+{  
+  if (meanFreePathTable)   delete meanFreePathTable;
+  if (crossSectionHandler) delete crossSectionHandler;
+  if (shellCrossSectionHandler) delete shellCrossSectionHandler;
+}
+
+
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+void G4LivermorePolarizedPhotoElectricModel::Initialise(const G4ParticleDefinition* particle,
+                                       const G4DataVector& cuts)
+{
+  if (verboseLevel > 3)
+    G4cout << "Calling G4LivermorePolarizedPhotoElectricModel::Initialise()" << G4endl;
+
+  if (crossSectionHandler)
+  {
+    crossSectionHandler->Clear();
+    delete crossSectionHandler;
+  }
+
+  if (shellCrossSectionHandler)
+    {
+      shellCrossSectionHandler->Clear();
+      delete shellCrossSectionHandler;
+    }
+
+
+  // Energy limits
+  
+  if (LowEnergyLimit() < lowEnergyLimit)
+    {
+      G4cout << "G4LivermorePolarizedPhotoElectricModel: low energy limit increased from " << 
+	LowEnergyLimit()/eV << " eV to " << lowEnergyLimit << " eV" << G4endl;
+      SetLowEnergyLimit(lowEnergyLimit);
+    }
+
+  if (HighEnergyLimit() > highEnergyLimit)
+    {
+      G4cout << "G4LivermorePolarizedPhotoElectricModel: high energy limit decreased from " << 
+	HighEnergyLimit()/GeV << " GeV to " << highEnergyLimit << " GeV" << G4endl;
+      SetHighEnergyLimit(highEnergyLimit);
+    }
+
+  // Reading of data files - all materials are read
+  
+  crossSectionHandler = new G4CrossSectionHandler;
+  crossSectionHandler->Clear();
+  G4String crossSectionFile = "phot/pe-cs-";
+  crossSectionHandler->LoadData(crossSectionFile);
+
+  meanFreePathTable = 0;
+  meanFreePathTable = crossSectionHandler->BuildMeanFreePathForMaterials();
+
+  shellCrossSectionHandler = new G4CrossSectionHandler();
+  shellCrossSectionHandler->Clear();
+  G4String shellCrossSectionFile = "phot/pe-ss-cs-";
+  shellCrossSectionHandler->LoadShellData(shellCrossSectionFile);
+
+
+  //
+  if (verboseLevel > 2) 
+    G4cout << "Loaded cross section files for Livermore Polarized PhotoElectric model" << G4endl;
+
+  InitialiseElementSelectors(particle,cuts);
+
+  G4cout << "Livermore Polarized PhotoElectric model is initialized " << G4endl
+         << "Energy range: "
+         << LowEnergyLimit() / keV << " keV - "
+         << HighEnergyLimit() / GeV << " GeV"
+         << G4endl;
+
+  //
+    
+  if(isInitialised) return;
+
+  if(pParticleChange)
+    fParticleChange = reinterpret_cast<G4ParticleChangeForGamma*>(pParticleChange);
+  else
+    fParticleChange = new G4ParticleChangeForGamma();
+    
+  isInitialised = true;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+G4double G4LivermorePolarizedPhotoElectricModel::ComputeCrossSectionPerAtom(
+                                       const G4ParticleDefinition*,
+                                             G4double GammaEnergy,
+                                             G4double Z, G4double,
+                                             G4double, G4double)
+{
+  if (verboseLevel > 3)
+    G4cout << "Calling ComputeCrossSectionPerAtom() of G4LivermorePolarizedPhotoElectricModel" << G4endl;
+
+  G4double cs = crossSectionHandler->FindValue(G4int(Z), GammaEnergy);
+  return cs;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+void G4LivermorePolarizedPhotoElectricModel::SampleSecondaries(std::vector<G4DynamicParticle*>* fvect,
+							       const G4MaterialCutsCouple* couple,
+							       const G4DynamicParticle* aDynamicGamma,
+							       G4double,
+							       G4double)
+{
+
+  // Fluorescence generated according to:
+  // J. Stepanek ,"A program to determine the radiation spectra due to a single atomic
+  // subshell ionisation by a particle or due to deexcitation or decay of radionuclides",
+  // Comp. Phys. Comm. 1206 pp 1-1-9 (1997)
+
+  if (verboseLevel > 3)
+    G4cout << "Calling SampleSecondaries() of G4LivermorePolarizedPhotoElectricModel" << G4endl;
+
+  G4double photonEnergy = aDynamicGamma->GetKineticEnergy();
+  // Within energy limit?
+
+  if(photonEnergy <= lowEnergyLimit)
+    {
+      fParticleChange->ProposeTrackStatus(fStopAndKill);
+      fParticleChange->SetProposedKineticEnergy(0.);
+      fParticleChange->ProposeLocalEnergyDeposit(photonEnergy);
+      return;
+    }
+
+
+  G4ThreeVector gammaPolarization0 = aDynamicGamma->GetPolarization();
+
+  // Protection: a polarisation parallel to the
+  // direction causes problems;
+  // in that case find a random polarization
+
+  G4ThreeVector photonDirection = aDynamicGamma->GetMomentumDirection();
+
+  // Make sure that the polarization vector is perpendicular to the
+  // gamma direction. If not
+
+  if(!(gammaPolarization0.isOrthogonal(photonDirection, 1e-6))||(gammaPolarization0.mag()==0))
+    { // only for testing now
+      gammaPolarization0 = GetRandomPolarization(photonDirection);
+    }
+  else
+    {
+      if ( gammaPolarization0.howOrthogonal(photonDirection) != 0)
+	{
+	  gammaPolarization0 = GetPerpendicularPolarization(photonDirection, gammaPolarization0);
+	}
+    }
+
+  // End of Protection
+
+  //  G4double E0_m = photonEnergy / electron_mass_c2 ;
+
+  // Select randomly one element in the current material
+
+  G4int Z = crossSectionHandler->SelectRandomAtom(couple,photonEnergy);
+
+  // Select the ionised shell in the current atom according to shell cross sections
+
+  size_t shellIndex = shellCrossSectionHandler->SelectRandomShell(Z,photonEnergy);
+
+  const G4AtomicTransitionManager* transitionManager = G4AtomicTransitionManager::Instance();
+  const G4AtomicShell* shell = transitionManager->Shell(Z,shellIndex);
+  G4double bindingEnergy = shell->BindingEnergy();
+  G4int shellId = shell->ShellId();
+
+  // Create lists of pointers to DynamicParticles (photons and electrons)
+  // (Is the electron vector necessary? To be checked)
+  std::vector<G4DynamicParticle*>* photonVector = 0;
+  std::vector<G4DynamicParticle*> electronVector;
+
+  G4double energyDeposit = 0.0;
+
+  // Primary outgoing  electron
+
+  G4double eKineticEnergy = photonEnergy - bindingEnergy;
+
+
+  if (eKineticEnergy > 0.)
+    { 
+
+      G4double costheta = SetCosTheta(eKineticEnergy);
+      G4double sintheta = sqrt(1. - costheta*costheta);
+      G4double phi = SetPhi(photonEnergy,eKineticEnergy,costheta);
+      G4double dirX = sintheta*cos(phi);
+      G4double dirY = sintheta*sin(phi);
+      G4double dirZ = costheta;
+      G4ThreeVector electronDirection(dirX, dirY, dirZ);
+      SystemOfRefChange(photonDirection, electronDirection, gammaPolarization0);
+      G4DynamicParticle* electron = new G4DynamicParticle (G4Electron::Electron(), 
+							   electronDirection, 
+							   eKineticEnergy);
+      electronVector.push_back(electron);
+    }
+  else
+    {
+      bindingEnergy = photonEnergy;
+    }
+  
+
+  G4int nElectrons = electronVector.size();
+  size_t nTotPhotons = 0;
+  G4int nPhotons=0;
+
+  const G4ProductionCutsTable* theCoupleTable=
+    G4ProductionCutsTable::GetProductionCutsTable();
+  size_t index = couple->GetIndex();
+  G4double cutg = (*(theCoupleTable->GetEnergyCutsVector(0)))[index];
+  cutg = std::min(cutForLowEnergySecondaryPhotons,cutg);
+
+  G4double cute = (*(theCoupleTable->GetEnergyCutsVector(1)))[index];
+  cute = std::min(cutForLowEnergySecondaryPhotons,cute);
+
+  G4DynamicParticle* aPhoton;
+
+  // Generation of fluorescence
+  // Data in EADL are available only for Z > 5
+  // Protection to avoid generating photons in the unphysical case of
+  // shell binding energy > photon energy
+  if (Z > 5  && (bindingEnergy > cutg || bindingEnergy > cute))
+    {
+      photonVector = deexcitationManager.GenerateParticles(Z,shellId);
+      nTotPhotons = photonVector->size();
+      for (size_t k=0; k<nTotPhotons; k++)
+        {
+          aPhoton = (*photonVector)[k];
+          if (aPhoton)
+            {
+              G4double itsCut = cutg;
+              if(aPhoton->GetDefinition() == G4Electron::Electron()) itsCut = cute;
+
+	      G4double itsEnergy = aPhoton->GetKineticEnergy();
+
+              if (itsEnergy > itsCut && itsEnergy <= bindingEnergy)
+                {
+                  nPhotons++;
+                  // Local energy deposit is given as the sum of the
+                  // energies of incident photons minus the energies
+                  // of the outcoming fluorescence photons
+                  bindingEnergy -= itsEnergy;
+
+                }
+	      else
+                {
+                  delete aPhoton;
+                  (*photonVector)[k] = 0;
+                }
+	    }
+	} 
+    }      
+  energyDeposit += bindingEnergy;
+  // Final state
+
+  for (G4int l = 0; l<nElectrons; l++ )
+    {
+      aPhoton = electronVector[l];
+      if(aPhoton) {
+        fvect->push_back(aPhoton);
+      }
+    }
+  for ( size_t ll = 0; ll < nTotPhotons; ll++)
+    {
+      aPhoton = (*photonVector)[ll];
+      if(aPhoton) {
+        fvect->push_back(aPhoton);
+      }
+    }
+
+  delete photonVector;
+
+  if (energyDeposit < 0)
+    {
+      G4cout << "WARNING - "
+             << "G4LowEnergyPhotoElectric::PostStepDoIt - Negative energy deposit"
+             << G4endl;
+      energyDeposit = 0;
+    }
+
+  // kill incident photon
+  fParticleChange->ProposeMomentumDirection( 0., 0., 0. );
+  fParticleChange->SetProposedKineticEnergy(0.);
+  fParticleChange->ProposeTrackStatus(fStopAndKill);
+  fParticleChange->ProposeLocalEnergyDeposit(energyDeposit);
+
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+void G4LivermorePolarizedPhotoElectricModel::SetCutForLowEnSecPhotons(G4double cut)
+{
+  cutForLowEnergySecondaryPhotons = cut;
+  deexcitationManager.SetCutForSecondaryPhotons(cut);
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+void G4LivermorePolarizedPhotoElectricModel::SetCutForLowEnSecElectrons(G4double cut)
+{
+  cutForLowEnergySecondaryElectrons = cut;
+  deexcitationManager.SetCutForAugerElectrons(cut);
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+void G4LivermorePolarizedPhotoElectricModel::ActivateAuger(G4bool val)
+{
+  deexcitationManager.ActivateAugerElectronProduction(val);
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+
+G4double G4LivermorePolarizedPhotoElectricModel::SetCosTheta(G4double energyE)
+
+{
+  G4double rand1,rand2,onemcost,greject;
+  G4double masarep = 510.99906*keV;
+
+  G4double gamma = 1. + energyE/masarep;
+  G4double gamma2 = gamma*gamma;
+
+  G4double beta = sqrt((gamma2 - 1.)/gamma2);
+
+  G4double alfa = 1./beta - 1.;
+
+  G4double g1 = 0.5*beta*gamma*(gamma-1.)*(gamma-2.);
+
+  G4double alfap2 = alfa+2.;
+
+  G4double grejectmax = 2.*(g1+1./alfa);
+
+  do
+    {
+      rand1 = G4UniformRand();
+      onemcost = 2.*alfa*(2.*rand1 + alfap2 * sqrt(rand1))/
+	(alfap2*alfap2 - 4.*rand1);
+      greject = (2. - onemcost)*(g1+1./(alfa+onemcost));
+      rand2 = G4UniformRand();
+    }
+  while (rand2*grejectmax > greject);
+  G4double cosTheta = 1. - onemcost;
+  return cosTheta;
+} 
+
+
+
+G4double G4LivermorePolarizedPhotoElectricModel::SetPhi(G4double Ph_energy,
+						   G4double E_energy,
+						   G4double costheta)
+{
+  G4double epsilon = E_energy/electron_mass_c2;
+  G4double k = Ph_energy/electron_mass_c2;
+  G4double gamma = 1. + epsilon;
+  G4double gamma2 = gamma*gamma;
+  G4double beta = sqrt((gamma2 - 1.)/gamma2);
+
+  G4double d = (2./(k*gamma*(1-beta*costheta))-1)*(1/k);
+
+  G4double norm_factor = 1 +2*d;
+
+  G4double rnd1; 
+  G4double rnd2;
+  G4double phi, phiprob;
+
+  do
+    {
+      rnd1 =G4UniformRand();
+      rnd2 =G4UniformRand();
+      phi = rnd1*twopi;
+      phiprob = 1 +2*d*cos(phi)*cos(phi);
+    }
+  while (rnd2*norm_factor > phiprob);
+  return phi;
+}
+
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+G4ThreeVector G4LivermorePolarizedPhotoElectricModel::SetPerpendicularVector(G4ThreeVector& a)
+{
+  G4double dx = a.x();
+  G4double dy = a.y();
+  G4double dz = a.z();
+  G4double x = dx < 0.0 ? -dx : dx;
+  G4double y = dy < 0.0 ? -dy : dy;
+  G4double z = dz < 0.0 ? -dz : dz;
+  if (x < y) {
+    return x < z ? G4ThreeVector(-dy,dx,0) : G4ThreeVector(0,-dz,dy);
+  }else{
+    return y < z ? G4ThreeVector(dz,0,-dx) : G4ThreeVector(-dy,dx,0);
+  }
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+G4ThreeVector G4LivermorePolarizedPhotoElectricModel::GetRandomPolarization(G4ThreeVector& direction0)
+{
+  G4ThreeVector d0 = direction0.unit();
+  G4ThreeVector a1 = SetPerpendicularVector(d0); //different orthogonal
+  G4ThreeVector a0 = a1.unit(); // unit vector
+
+  G4double rand1 = G4UniformRand();
+  
+  G4double angle = twopi*rand1; // random polar angle
+  G4ThreeVector b0 = d0.cross(a0); // cross product
+  
+  G4ThreeVector c;
+  
+  c.setX(std::cos(angle)*(a0.x())+std::sin(angle)*b0.x());
+  c.setY(std::cos(angle)*(a0.y())+std::sin(angle)*b0.y());
+  c.setZ(std::cos(angle)*(a0.z())+std::sin(angle)*b0.z());
+  
+  G4ThreeVector c0 = c.unit();
+
+  return c0;
+  
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+G4ThreeVector G4LivermorePolarizedPhotoElectricModel::GetPerpendicularPolarization
+(const G4ThreeVector& gammaDirection, const G4ThreeVector& gammaPolarization) const
+{
+
+  // 
+  // The polarization of a photon is always perpendicular to its momentum direction.
+  // Therefore this function removes those vector component of gammaPolarization, which
+  // points in direction of gammaDirection
+  //
+  // Mathematically we search the projection of the vector a on the plane E, where n is the
+  // plains normal vector.
+  // The basic equation can be found in each geometry book (e.g. Bronstein):
+  // p = a - (a o n)/(n o n)*n
+  
+  return gammaPolarization - gammaPolarization.dot(gammaDirection)/gammaDirection.dot(gammaDirection) * gammaDirection;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+
+void G4LivermorePolarizedPhotoElectricModel::SystemOfRefChange
+    (G4ThreeVector& direction0,G4ThreeVector& direction1,
+     G4ThreeVector& polarization0)
+{
+  // direction0 is the original photon direction ---> z
+  // polarization0 is the original photon polarization ---> x
+  // need to specify y axis in the real reference frame ---> y 
+  G4ThreeVector Axis_Z0 = direction0.unit();
+  G4ThreeVector Axis_X0 = polarization0.unit();
+  G4ThreeVector Axis_Y0 = (Axis_Z0.cross(Axis_X0)).unit(); // to be confirmed;
+  
+  G4double direction_x = direction1.getX();
+  G4double direction_y = direction1.getY();
+  G4double direction_z = direction1.getZ();
+  
+  direction1 = (direction_x*Axis_X0 + direction_y*Axis_Y0 +  direction_z*Axis_Z0).unit();
+  
+}
+
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+G4double G4LivermorePolarizedPhotoElectricModel::GetMeanFreePath(const G4Track& track,
+						      G4double,
+						      G4ForceCondition*)
+{
+
+  const G4DynamicParticle* photon = track.GetDynamicParticle();
+  G4double energy = photon->GetKineticEnergy();
+  G4Material* material = track.GetMaterial();
+  //  size_t materialIndex = material->GetIndex();
+
+  G4double meanFreePath = DBL_MAX;
+
+  //  if (energy > highEnergyLimit)
+  //    meanFreePath = meanFreePathTable->FindValue(highEnergyLimit,materialIndex);
+  //  else if (energy < lowEnergyLimit) meanFreePath = DBL_MAX;
+  //  else meanFreePath = meanFreePathTable->FindValue(energy,materialIndex);
+
+  G4double cross = shellCrossSectionHandler->ValueForMaterial(material,energy);
+  if(cross > 0.0) meanFreePath = 1.0/cross;
+
+  return meanFreePath;
+
+
+}
+
+
Index: trunk/source/processes/electromagnetic/lowenergy/src/G4OrlicLiCrossSection.cc
===================================================================
--- trunk/source/processes/electromagnetic/lowenergy/src/G4OrlicLiCrossSection.cc	(revision 1197)
+++ trunk/source/processes/electromagnetic/lowenergy/src/G4OrlicLiCrossSection.cc	(revision 1197)
@@ -0,0 +1,469 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//$Id: G4OrlicLiCrossSection.cc,v 1.4 2009/11/11 09:14:53 mantero Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
+//
+// Author: Haifa Ben Abdelouahed
+//         
+//
+// History:
+// -----------
+//  23 Apr 2008   H. Ben Abdelouahed   1st implementation
+//  28 Apr 2008   MGP        Major revision according to a design iteration
+//  21 Apr 2009	  ALF Some correction for compatibility to G4VShellCrossSection
+//		  and changed name to G4OrlicLiCrossSection 
+//  11 Nov 2009	  ALF update and code cleaning for the Dec Release
+//
+// -------------------------------------------------------------------
+// Class description:
+// Low Energy Electromagnetic Physics, Cross section, proton ionisation, L shell
+// Further documentation available from http://www.ge.infn.it/geant4/lowE
+// -------------------------------------------------------------------
+
+
+#include "globals.hh"
+#include "G4OrlicLiCrossSection.hh"
+#include "G4Proton.hh"
+
+
+G4OrlicLiCrossSection::G4OrlicLiCrossSection()
+{ 
+
+  transitionManager =  G4AtomicTransitionManager::Instance();
+
+}
+
+G4OrlicLiCrossSection::~G4OrlicLiCrossSection()
+{ 
+
+}
+
+//this L-CrossSection calculation method is done according to 
+//I.ORLIC, C.H.SOW and S.M.TANG,International Journal of PIXE.Vol.4(1997) 217-230	
+ 
+
+//*****************************************************************************************************************************************
+
+G4double G4OrlicLiCrossSection::CalculateL1CrossSection(G4int zTarget, G4double energyIncident)
+  			       
+{
+
+  if ( (energyIncident < 0.1*MeV) || energyIncident > 10*MeV )
+
+    {return 0;}
+
+
+
+  G4double  massIncident; 
+
+  G4Proton* aProtone = G4Proton::Proton();
+    
+   massIncident = aProtone->GetPDGMass(); 
+ 
+  G4double l1BindingEnergy = (transitionManager->Shell(zTarget,1)->BindingEnergy())/keV;
+ 
+  G4double lamda =  massIncident/electron_mass_c2;
+
+  G4double normalizedEnergy =  (energyIncident/keV)/(lamda*l1BindingEnergy);
+
+  G4double x = std::log(normalizedEnergy);
+
+  G4double a0 = 0.;
+  G4double a1 = 0.;
+  G4double a2 = 0.;
+  G4double a3 = 0.;
+  G4double a4 = 0.;
+  G4double a5 = 0.;
+  G4double a6 = 0.;  
+  G4double a7 = 0.;  
+  G4double a8 = 0.; 
+  G4double a9 = 0.;
+
+                                       
+   if ( zTarget>=14 && zTarget<=40)  
+    {
+
+      return 0;
+      /*
+      // parameters used for calculating total L cross section
+      a0=12.5081;
+      a1=0.2177;
+      a2=-0.3758;
+      a3=0.0096;
+      a4=0.0073;
+      a5=0.0022;
+      a6=0.;
+      a7=0.;
+      a8=0.;
+      a9=0.; */
+    }
+  else 
+    { 
+       if ( zTarget>=41 &&  zTarget<=50 )
+       { 	  
+      a0=11.274881;
+      a1=-0.187401;
+      a2=-0.943341;
+      a3=-1.47817;
+      a4=-1.282343;
+      a5=-0.386544; 
+      a6=-0.037932;
+      a7=0.;
+      a8=0.;
+      a9=0.;
+	}
+     
+      else  
+	{
+	  if ( zTarget>=51 &&  zTarget<=60 ) 
+	    { 
+	      a0=11.242637;
+	      a1=-0.162515;
+	      a2=1.035774;
+	      a3=3.970908;
+	      a4=3.968233;
+	      a5=1.655714;
+	      a6=0.058885;
+	      a7=-0.155743;
+	      a8=-0.042228;
+	      a9=-0.003371; 
+	    } 
+	
+	  else  
+	    {
+	      if ( zTarget>=61 &&  zTarget<=70 ) 
+		{ 
+		  a0=6.476722;
+		  a1=-25.804787;
+		  a2=-54.061629;
+		  a3=-56.684589;
+		  a4=-33.223367;
+		  a5=-11.034979; 
+		  a6=-2.042851;
+		  a7=-0.194075;
+		  a8=-0.007252;
+		  a9=0.;
+		} 
+	      else  
+		{
+		  if ( zTarget>=71 &&  zTarget<=80 ) 
+		    { 
+		      a0=12.776794;
+		      a1=6.562907;
+		      a2=10.158703;
+		      a3=7.432592;
+		      a4=2.332036;
+		      a5=0.317946; 
+		      a6=0.014479;
+		      a7=0.;
+		      a8=0.;
+		      a9=0.;
+		    } 
+		  else  
+		    {
+		      if ( zTarget>=81 &&  zTarget<=92 ) 
+			{ 
+			  a0=28.243087;
+			  a1=50.199585;
+			  a2=58.281684;
+			  a3=34.130538;
+			  a4=10.268531;
+			  a5=1.525302; 
+			  a6=0.08835;
+			  a7=0.;
+			  a8=0.;
+			  a9=0.;
+			}
+		      else
+			{ 
+			  G4cout << "ERROR: L1 Cross-Section exist only for ZTarget between 41 and 92!!! " << G4endl;
+			
+			}
+		    }
+		}
+	    }
+	}
+      }
+      
+
+G4double analyticalFunction = a0 + (a1*x)+(a2*x*x)+(a3*std::pow(x,3))+(a4*std::pow(x,4))+(a5*std::pow(x,5))+(a6*std::pow(x,6))+
+	(a7*std::pow(x,7))+(a8*std::pow(x,8))+(a9*std::pow(x,9)); 
+
+
+
+  G4double L1crossSection =  std::exp(analyticalFunction)/(l1BindingEnergy*l1BindingEnergy);  
+
+
+  if (L1crossSection >= 0) {
+    return L1crossSection;
+  }
+  else {return 0;}
+
+}
+
+//*****************************************************************************************************************************************
+
+
+G4double G4OrlicLiCrossSection::CalculateL2CrossSection(G4int zTarget, G4double energyIncident)
+  			       
+{
+
+
+  if ( (energyIncident < 0.1*MeV) || energyIncident > 10*MeV )
+
+    {return 0;}
+
+
+  G4double  massIncident; 
+
+  G4Proton* aProtone = G4Proton::Proton();
+    
+   massIncident = aProtone->GetPDGMass(); 
+ 
+ G4double L2crossSection;
+
+ if (zTarget<41)
+   { 
+     L2crossSection =0.;
+   }
+ else
+   {
+
+ G4double l2BindingEnergy = (transitionManager->Shell(zTarget,2)->BindingEnergy())/keV;
+ 
+  G4double lamda =  massIncident/electron_mass_c2;
+
+  G4double normalizedEnergy =  (energyIncident/keV)/(lamda*l2BindingEnergy);
+
+  G4double x = std::log(normalizedEnergy);
+
+  G4double a0 = 0.;
+  G4double a1 = 0.;
+  G4double a2 = 0.;
+  G4double a3 = 0.;
+  G4double a4 = 0.;
+  G4double a5 = 0.;
+ 
+      if ( zTarget>=41 &&  zTarget<=50 ) 
+	{ 
+      a0=11.194798;
+      a1=0.178807;
+      a2=-0.449865;
+      a3=-0.063528;
+      a4=-0.015364;
+      a5=0.; 
+	}
+     
+      else  
+	{
+	  if ( zTarget>=51 &&  zTarget<=60 ) 
+	    { 
+	      a0=11.241409;
+	      a1=0.149635;
+	      a2=-0.633269;
+	      a3=-0.17834;
+	      a4=-0.034743;
+	      a5=0.006474;
+
+	    } 
+	
+	  else  
+	    {
+	      if ( zTarget>=61 &&  zTarget<=70 ) 
+		{ 
+		  a0=11.247424;
+		  a1=0.203051;
+		  a2=-0.219083;
+		  a3=0.164514;
+		  a4=0.058692;
+		  a5=0.007866; 
+		} 
+	      else  
+		{
+		  if ( zTarget>=71 &&  zTarget<=80 ) 
+		    { 
+		      a0=11.229924;
+		      a1=-0.087241;
+		      a2=-0.753908;
+		      a3=-0.181546;
+		      a4=-0.030406;
+		      a5=0.; 
+		    } 
+		  else  
+		    {
+		      if ( zTarget>=81 &&  zTarget<=92 ) 
+			{ 
+			  a0=11.586671;
+			  a1=0.730838;
+			  a2=-0.056713;
+			  a3=0.053262;
+			  a4=-0.003672;
+			  a5=0.; 
+			}
+		      else
+			{ 
+			  G4cout << "ERROR: L2 Cross-Section exist only for ZTarget between 41 and 92!!! " << G4endl;
+		       
+			}
+		    }
+		}
+	    }
+	}
+      
+
+ G4double analyticalFunction = a0 + (a1*x)+(a2*x*x)+(a3*std::pow(x,3))+(a4*std::pow(x,4))+(a5*std::pow(x,5)); 
+
+
+   L2crossSection =  std::exp(analyticalFunction)/(l2BindingEnergy*l2BindingEnergy); 
+                                                                            
+   } 
+
+  if (L2crossSection >= 0) {
+    return L2crossSection;
+  }
+  else {return 0;}
+   
+}
+
+//*****************************************************************************************************************************************
+
+
+G4double G4OrlicLiCrossSection::CalculateL3CrossSection(G4int zTarget, G4double energyIncident)
+  			       
+{
+
+  if ( (energyIncident < 0.1*MeV) || energyIncident > 10*MeV )
+
+    {return 0;}
+
+
+
+  G4double  massIncident; 
+
+  G4Proton* aProtone = G4Proton::Proton();
+    
+  massIncident = aProtone->GetPDGMass(); 
+
+ 
+ G4double L3crossSection;
+
+ if (zTarget<41)
+   { 
+     L3crossSection =0.;
+   }
+ else
+   {
+
+ G4double l3BindingEnergy = (transitionManager->Shell(zTarget,3)->BindingEnergy())/keV;
+ 
+ 
+  G4double lamda =  massIncident/electron_mass_c2;
+
+  G4double normalizedEnergy =  (energyIncident/keV)/(lamda*l3BindingEnergy);
+
+  G4double x = std::log(normalizedEnergy);
+
+
+  G4double a0 = 0.;
+  G4double a1 = 0.;
+  G4double a2 = 0.;
+  G4double a3 = 0.;
+  G4double a4 = 0.;
+ 
+      if ( zTarget>=41 &&  zTarget<=50 ) 
+	{ 
+      a0=11.91837;
+      a1=0.03064;
+      a2=-0.657644;
+      a3=-0.14532;
+      a4=-0.026059;      
+	}
+     
+      else  
+	{
+	  if ( zTarget>=51 &&  zTarget<=60 ) 
+	    { 
+	      a0=11.909485;
+	      a1=0.15918;
+	      a2=-0.588004;
+	      a3=-0.159466;
+	      a4=-0.033184;	      
+	    } 
+	
+	  else  
+	    {
+	      if ( zTarget>=61 &&  zTarget<=70 ) 
+		{ 
+		  a0=11.878472;
+		  a1=-0.137007;
+		  a2=-0.959475;
+		  a3=-0.316505;
+		  a4=-0.054154;	 
+		} 
+	      else  
+		{
+		  if ( zTarget>=71 &&  zTarget<=80 ) 
+		    { 
+		      a0=11.802538;
+		      a1=-0.371796;
+		      a2=-1.052238;
+		      a3=-0.28766;
+		      a4=-0.042608;	     
+		    } 
+		  else  
+		    {
+		      if ( zTarget>=81 &&  zTarget<=92 ) 
+			{ 
+			  a0=11.423712;
+			  a1=-1.428823;
+			  a2=-1.946979;
+			  a3=-0.585198;
+			  a4=-0.076467;			 
+			}
+		      else
+			{ 
+			  G4cout << "ERROR: L3 Cross-Section exist only for ZTarget between 41 and 92!!! " << G4endl;
+		       
+			}
+		    }
+		}
+	    }
+	}
+      
+
+ G4double analyticalFunction = a0 + (a1*x)+(a2*x*x)+(a3*std::pow(x,3))+(a4*std::pow(x,4)); 
+
+
+   L3crossSection =  std::exp(analyticalFunction)/(l3BindingEnergy*l3BindingEnergy); 
+                                                                            
+   } 
+  if (L3crossSection >= 0) {
+    return L3crossSection;
+  }
+  else {return 0;}
+
+
+}
Index: trunk/source/processes/electromagnetic/lowenergy/src/G4ecpssrKCrossSection.cc
===================================================================
--- trunk/source/processes/electromagnetic/lowenergy/src/G4ecpssrKCrossSection.cc	(revision 1197)
+++ trunk/source/processes/electromagnetic/lowenergy/src/G4ecpssrKCrossSection.cc	(revision 1197)
@@ -0,0 +1,638 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//$Id: G4ecpssrKCrossSection.cc,v 1.7 2009/11/11 09:14:53 mantero Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
+//
+// Author: Haifa Ben Abdelouahed
+//         
+//
+// History:
+// -----------
+//  21 Apr 2008   H. Ben Abdelouahed   1st implementation
+//  21 Apr 2008   MGP        Major revision according to a design iteration
+//  21 Apr 2009	  ALF Some correction for compatibility to G4VShellCrossSection
+//		  and changed name to G4ecpssrKCrossSection 
+//  11 Nov 2009   ALF update and code cleaning for the Dec Release 
+//
+// -------------------------------------------------------------------
+// Class description:
+// Low Energy Electromagnetic Physics, Cross section, p ionisation, K shell
+// Further documentation available from http://www.ge.infn.it/geant4/lowE
+// -------------------------------------------------------------------
+
+
+#include "globals.hh"
+#include "G4ecpssrKCrossSection.hh"
+#include "G4AtomicTransitionManager.hh"
+#include "G4NistManager.hh"
+#include "G4Proton.hh"
+#include "G4Alpha.hh"
+#include <math.h>
+#include <iostream>
+
+#include "G4SemiLogInterpolation.hh"
+
+
+G4ecpssrKCrossSection::G4ecpssrKCrossSection()
+{ 
+
+    // Storing FK data needed for medium velocities region
+
+    char *path = getenv("G4LEDATA");
+ 
+    if (!path)
+    G4Exception("G4ecpssrKCrossSection::CalculateCrossSection: G4LEDATA environment variable not set");
+
+    std::ostringstream fileName;
+    fileName << path << "/pixe/uf/FK.dat";
+    std::ifstream FK(fileName.str().c_str());
+
+    if (!FK) G4Exception("G4ecpssrKCrossSection::CalculateCrossSection: error opening FK data file");
+      
+    dummyVec.push_back(0.);
+
+    while(!FK.eof())
+    {
+	double x;
+	double y;
+	
+	FK>>x>>y;
+
+	//  Mandatory vector initialization
+        if (x != dummyVec.back()) 
+        { 
+          dummyVec.push_back(x); 
+          aVecMap[x].push_back(-1.);
+        }
+	  
+        FK>>FKData[x][y];
+
+        if (y != aVecMap[x].back()) aVecMap[x].push_back(y);
+          
+    }
+
+  // Storing C coefficients for high velocity formula
+
+  G4String fileC1("pixe/uf/c1");
+  tableC1 = new G4DNACrossSectionDataSet(new G4SemiLogInterpolation, 1.,1.);
+  tableC1->LoadData(fileC1);
+
+  G4String fileC2("pixe/uf/c2");
+  tableC2 = new G4DNACrossSectionDataSet(new G4SemiLogInterpolation, 1.,1.);
+  tableC2->LoadData(fileC2);
+
+  G4String fileC3("pixe/uf/c3");
+  tableC3 = new G4DNACrossSectionDataSet(new G4SemiLogInterpolation, 1.,1.);
+  tableC3->LoadData(fileC3);
+
+  //
+
+  verboseLevel=0;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+void print (G4double elem)
+{
+  G4cout << elem << " ";
+}
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+G4ecpssrKCrossSection::~G4ecpssrKCrossSection()
+{ 
+
+  delete tableC1;
+  delete tableC2;
+  delete tableC3;
+
+}
+
+//---------------------------------this "ExpIntFunction" function allows fast evaluation of the n order exponential integral function En(x)------
+
+G4double G4ecpssrKCrossSection::ExpIntFunction(G4int n,G4double x)
+
+{
+  G4int i;
+  G4int ii;
+  G4int nm1;
+  G4double a;
+  G4double b;
+  G4double c;
+  G4double d;
+  G4double del;
+  G4double fact;
+  G4double h;
+  G4double psi;
+  G4double ans = 0;
+  const G4double euler= 0.5772156649;
+  const G4int maxit= 100;
+  const G4double fpmin = 1.0e-30;
+  const G4double eps = 1.0e-7;
+  nm1=n-1;
+  if (n<0 || x<0.0 || (x==0.0 && (n==0 || n==1)))
+  G4cout << "bad arguments in ExpIntFunction" << G4endl;
+  else {
+       if (n==0) ans=std::exp(-x)/x;
+        else {
+           if (x==0.0) ans=1.0/nm1;
+              else {
+                   if (x > 1.0) {
+                         	b=x+n;
+                        	c=1.0/fpmin;
+                        	d=1.0/b;
+				h=d;
+				for (i=1;i<=maxit;i++) {
+				  a=-i*(nm1+i);
+				  b +=2.0;
+				  d=1.0/(a*d+b);
+				  c=b+a/c;
+				  del=c*d;
+				  h *=del;
+				      if (std::fabs(del-1.0) < eps) {
+					ans=h*std::exp(-x);
+					return ans;
+				      }
+				}
+		   } else {
+		     ans = (nm1!=0 ? 1.0/nm1 : -std::log(x)-euler);
+		     fact=1.0;
+		     for (i=1;i<=maxit;i++) {
+		       fact *=-x/i;
+		       if (i !=nm1) del = -fact/(i-nm1);
+		       else {
+			 psi = -euler;
+			 for (ii=1;ii<=nm1;ii++) psi +=1.0/ii;
+			 del=fact*(-std::log(x)+psi);
+		       }
+		       ans += del;
+		       if (std::fabs(del) < std::fabs(ans)*eps) return ans;
+		     }
+		   }
+	      }
+	}
+  }
+return ans;
+}
+//-----------------------------------------------------------------------------------------------------------
+
+ 
+
+G4double G4ecpssrKCrossSection::CalculateCrossSection(G4int zTarget,G4double massIncident, G4double energyIncident) 
+ 
+ //this K-CrossSection calculation method is done according to W.Brandt and G.Lapicki, Phys.Rev.A23(1981)//					                
+
+{
+
+  //if (energyIncident < 150 *keV) {return 0;}
+
+  G4NistManager* massManager = G4NistManager::Instance();   
+
+  G4AtomicTransitionManager*  transitionManager =  G4AtomicTransitionManager::Instance();
+
+  G4double  zIncident = 0; 
+  G4Proton* aProtone = G4Proton::Proton();
+  G4Alpha* aAlpha = G4Alpha::Alpha();
+
+  if (massIncident == aProtone->GetPDGMass() )
+  {
+
+   zIncident = (aProtone->GetPDGCharge())/eplus; 
+
+   //   G4cout << "zincident:" << zIncident << G4endl;
+    }
+  else
+    {
+      if (massIncident == aAlpha->GetPDGMass())
+	{
+	  
+	  zIncident  = (aAlpha->GetPDGCharge())/eplus; 
+	  
+	  //	  G4cout << "zincident:" << zIncident << G4endl;
+	}
+      else
+	{ 
+	  G4cout << "we can treat only Proton or Alpha incident particles " << G4endl;
+	  return 0;
+	}
+    }
+  
+  ///////////////////////////////////////////
+  //from here I will substitute this version with Seb's one. 
+  ///////////////////////////////////////////
+
+
+  if (verboseLevel>0) G4cout << "  massIncident=" << massIncident<< G4endl;
+
+  G4double kBindingEnergy = transitionManager->Shell(zTarget,0)->BindingEnergy();
+  if (verboseLevel>0) G4cout << "  kBindingEnergy=" << kBindingEnergy/eV<< G4endl;
+
+  G4double massTarget = (massManager->GetAtomicMassAmu(zTarget))*amu_c2;
+  if (verboseLevel>0) G4cout << "  massTarget=" <<  massTarget<< G4endl;
+ 
+  G4double systemMass =((massIncident*massTarget)/(massIncident+massTarget))/electron_mass_c2; //the mass of the system (projectile, target) 
+  if (verboseLevel>0) G4cout << "  systemMass=" <<  systemMass<< G4endl;
+
+  const G4double zkshell= 0.3;
+
+  G4double screenedzTarget = zTarget-zkshell; // screenedzTarget is the screened nuclear charge of the target
+
+  const G4double rydbergMeV= 13.6e-6;
+ 
+  G4double tetaK = kBindingEnergy/((screenedzTarget*screenedzTarget)*rydbergMeV);  //tetaK denotes the reduced binding energy of the electron
+  if (verboseLevel>0) G4cout << "  tetaK=" <<  tetaK<< G4endl;
+
+  G4double velocity =(2./(tetaK*screenedzTarget))*std::pow(((energyIncident*electron_mass_c2)/(massIncident*rydbergMeV)),0.5);
+  if (verboseLevel>0) G4cout << "  velocity=" << velocity<< G4endl;
+
+  const G4double bohrPow2Barn=(Bohr_radius*Bohr_radius)/barn ;        
+  if (verboseLevel>0) G4cout << "  bohrPow2Barn=" <<  bohrPow2Barn<< G4endl;
+
+  G4double sigma0 = 8.*pi*(zIncident*zIncident)*bohrPow2Barn*std::pow(screenedzTarget,-4.);     //sigma0 is the initial cross section of K shell at stable state
+  if (verboseLevel>0) G4cout << "  sigma0=" <<  sigma0<< G4endl;
+
+  const G4double kAnalyticalApproximation= 1.5; 
+ 
+  G4double x = kAnalyticalApproximation/velocity;
+  if (verboseLevel>0) G4cout << "  x=" << x<< G4endl;
+
+
+
+
+  G4double electrIonizationEnergy;                                         
+                                       
+  if ( x<0.035)  
+    {
+      electrIonizationEnergy= 0.75*pi*(std::log(1./(x*x))-1.);  
+    }
+  else 
+    { 
+      if ( x<3.) 
+	{ 
+	  electrIonizationEnergy =std::exp(-2.*x)/(0.031+(0.213*std::pow(x,0.5))+(0.005*x)-(0.069*std::pow(x,3./2.))+(0.324*x*x));
+	}
+     
+      else  
+	{
+	 electrIonizationEnergy =2.*std::exp(-2.*x)/std::pow(x,1.6); }
+    }
+
+  if (verboseLevel>0) G4cout << "  electrIonizationEnergy=" << electrIonizationEnergy<< G4endl;
+
+  G4double hFunction =(electrIonizationEnergy*2.)/(tetaK*std::pow(velocity,3)); //hFunction represents the correction for polarization effet
+  
+  if (verboseLevel>0) G4cout << "  hFunction=" << hFunction<< G4endl;
+    
+  G4double gFunction = (1.+(9.*velocity)+(31.*velocity*velocity)+(98.*std::pow(velocity,3.))+(12.*std::pow(velocity,4.))+(25.*std::pow(velocity,5.))
+			+(4.2*std::pow(velocity,6.))+(0.515*std::pow(velocity,7.)))/std::pow(1.+velocity,9.); //gFunction represents the correction for binding effet
+  if (verboseLevel>0) G4cout << "  gFunction=" << gFunction<< G4endl;
+ 
+  //-----------------------------------------------------------------------------------------------------------------------------
+
+  G4double sigmaPSS = 1.+(((2.*zIncident)/(screenedzTarget*tetaK))*(gFunction-hFunction)); //describes the perturbed stationnairy state of the affected atomic electon
+  if (verboseLevel>0) G4cout << "  sigmaPSS=" << sigmaPSS<< G4endl;
+  if (verboseLevel>0) G4cout << "  sigmaPSS*tetaK=" << sigmaPSS*tetaK<< G4endl;
+
+  //----------------------------------------------------------------------------------------------------------------------------
+  
+  const G4double cNaturalUnit= 1/fine_structure_const;  // it's the speed of light according to Atomic-Unit-System
+  if (verboseLevel>0) G4cout << "  cNaturalUnit=" << cNaturalUnit<< G4endl;
+  
+  G4double ykFormula=0.4*(screenedzTarget/cNaturalUnit)*(screenedzTarget/cNaturalUnit)/(velocity/sigmaPSS);
+  if (verboseLevel>0) G4cout << "  ykFormula=" << ykFormula<< G4endl;
+ 
+  G4double relativityCorrection = std::pow((1.+(1.1*ykFormula*ykFormula)),0.5)+ykFormula;// the relativistic correction parameter
+  if (verboseLevel>0) G4cout << "  relativityCorrection=" << relativityCorrection<< G4endl;
+
+  G4double reducedVelocity = velocity*std::pow(relativityCorrection,0.5);  // presents the reduced collision velocity parameter 
+  if (verboseLevel>0) G4cout << "  reducedVelocity=" << reducedVelocity<< G4endl;
+
+  G4double etaOverTheta2 = (energyIncident*electron_mass_c2)/(massIncident*rydbergMeV*screenedzTarget*screenedzTarget)
+                           /(sigmaPSS*tetaK)/(sigmaPSS*tetaK);
+  if (verboseLevel>0) G4cout << "  etaOverTheta2=" << etaOverTheta2<< G4endl;
+
+  // low velocity formula
+  
+  G4double universalFunction = (std::pow(2.,9.)/45.)*std::pow(reducedVelocity/sigmaPSS,8.)*std::pow((1.+(1.72*(reducedVelocity/sigmaPSS)*(reducedVelocity/sigmaPSS))),-4.);// is the reduced universal cross section
+  if (verboseLevel>0) G4cout << "  universalFunction by Brandt 1981 =" << universalFunction<< G4endl;
+
+  // Alternative formula by Rice 1977, closer to tabulated data than the above function from Brandt 1981
+     
+     G4double x_ = etaOverTheta2;
+     if (verboseLevel>0) G4cout << "  x_=" << x_ << G4endl;
+
+     G4double b0 = pow(2.,17)/45.;
+     if (verboseLevel>0) G4cout << "  b0=" << b0 << G4endl;
+
+     G4double b1 = 19*(sigmaPSS*tetaK) - 480./11.;
+     if (verboseLevel>0) G4cout << "  b1=" << b1 << G4endl;
+
+     G4double b2 = (720./7.)*(23*(sigmaPSS*tetaK)*(sigmaPSS*tetaK)/11 - 97*(sigmaPSS*tetaK)/9. + 160./13);
+     if (verboseLevel>0) G4cout << "  b2=" << b2 << G4endl;
+
+     universalFunction = b0*x_*x_*x_*x_*(1+b1*x_+b2*x_*x_);
+
+     if (verboseLevel>0) G4cout << "  universalFunction by Rice 1977 =" << universalFunction<< G4endl;
+
+  
+  if ( etaOverTheta2 < 0.01 )
+  {
+     if (verboseLevel>0) G4cout << "  Notice : FK is computed from low velocity formula" << G4endl;
+     
+  }
+
+  else
+  
+  {
+    
+    if ( etaOverTheta2 > 95 && (sigmaPSS*tetaK) > 0.4 && (sigmaPSS*tetaK) < 1.7 )
+    {
+      // From Rice 1977
+      
+      if (verboseLevel>0) G4cout << "  Notice : FK is computed from high velocity formula" << G4endl;
+
+      if (verboseLevel>0) G4cout << "  sigmaPSS*tetaK=" << sigmaPSS*tetaK << G4endl;
+    
+      G4double C1= tableC1->FindValue(sigmaPSS*tetaK);
+      G4double C2= tableC2->FindValue(sigmaPSS*tetaK);
+      G4double C3= tableC3->FindValue(sigmaPSS*tetaK);
+      if (verboseLevel>0) G4cout << "  C1=" << C1 << G4endl;
+      if (verboseLevel>0) G4cout << "  C2=" << C2 << G4endl;
+      if (verboseLevel>0) G4cout << "  C3=" << C3 << G4endl;
+   
+      G4double etaK = (energyIncident*electron_mass_c2)/(massIncident*rydbergMeV*screenedzTarget*screenedzTarget);
+      if (verboseLevel>0) G4cout << "  etaK=" << etaK << G4endl;
+
+      G4double etaT = (sigmaPSS*tetaK)*(sigmaPSS*tetaK)*(95.); // at any theta, the largest tabulated etaOverTheta2 is 95
+      if (verboseLevel>0) G4cout << "  etaT=" << etaT << G4endl;
+    
+      G4double fKT = FunctionFK((sigmaPSS*tetaK),95.)*(etaT/(sigmaPSS*tetaK));
+      if (FunctionFK((sigmaPSS*tetaK),95.)<=0.) G4cout << 
+      "*** WARNING : G4ecpssrCrossSection::CalculateCrossSection is unable to interpolate FK function in high velocity region ! ***" << G4endl;
+      if (verboseLevel>0) G4cout << "  FunctionFK=" << FunctionFK((sigmaPSS*tetaK),95.) << G4endl;
+      if (verboseLevel>0) G4cout << "  fKT=" << fKT << G4endl;
+    
+      G4double GK = C2/(4*etaK) + C3/(32*etaK*etaK);
+      if (verboseLevel>0) G4cout << "  GK=" << GK << G4endl;
+      G4double GT = C2/(4*etaT) + C3/(32*etaT*etaT);
+      if (verboseLevel>0) G4cout << "  GT=" << GT << G4endl;
+    
+      G4double DT = fKT - C1*std::log(etaT) + GT;
+      if (verboseLevel>0) G4cout << "  DT=" << DT << G4endl;
+
+      G4double fKK = C1*std::log(etaK) + DT - GK;
+      if (verboseLevel>0) G4cout << "  fKK=" << fKK << G4endl;
+    
+      G4double universalFunction3= fKK/(etaK/tetaK);
+      if (verboseLevel>0) G4cout << "  universalFunction3=" << universalFunction3 << G4endl;
+
+      universalFunction=universalFunction3;
+    
+    }
+    else
+    {
+      // From Rice 1977
+      
+      if (verboseLevel>0) G4cout << "  Notice : FK is computed from INTERPOLATED data" << G4endl;
+     
+      G4double universalFunction2 = FunctionFK((sigmaPSS*tetaK),etaOverTheta2);
+      if (universalFunction2<=0) G4cout << 
+      "*** WARNING : G4ecpssrCrossSection::CalculateCrossSection is unable to interpolate FK function in medium velocity region ! ***" << G4endl;
+      
+      if (verboseLevel>0) G4cout << "  universalFunction2=" << universalFunction2 << " for theta=" << sigmaPSS*tetaK << " and etaOverTheta2=" << etaOverTheta2 << G4endl;
+      
+      universalFunction=universalFunction2;
+    }
+        
+  }
+  
+  //----------------------------------------------------------------------------------------------------------------------
+
+  G4double sigmaPSSR = (sigma0/(sigmaPSS*tetaK))*universalFunction; //sigmaPSSR is the straight-line K-shell ionization cross section
+  if (verboseLevel>0) G4cout << "  sigmaPSSR=" << sigmaPSSR<< G4endl;
+  
+  //-----------------------------------------------------------------------------------------------------------------------
+
+  G4double pssDeltaK = (4./(systemMass*sigmaPSS*tetaK))*(sigmaPSS/velocity)*(sigmaPSS/velocity);
+  if (verboseLevel>0) G4cout << "  pssDeltaK=" << pssDeltaK<< G4endl;
+
+  G4double energyLoss = std::pow(1-pssDeltaK,0.5); //energyLoss incorporates the straight-line energy-loss 
+  if (verboseLevel>0) G4cout << "  energyLoss=" << energyLoss<< G4endl;
+
+  G4double energyLossFunction = (std::pow(2.,-9)/8.)*((((9.*energyLoss)-1.)*std::pow(1.+energyLoss,9.))+(((9.*energyLoss)+1.)*std::pow(1.-energyLoss,9.)));//energy loss function 
+  if (verboseLevel>0) G4cout << "  energyLossFunction=" <<  energyLossFunction<< G4endl;
+
+  //----------------------------------------------------------------------------------------------------------------------------------------------
+
+  G4double coulombDeflection = (4.*pi*zIncident/systemMass)*std::pow(tetaK*sigmaPSS,-2.)*std::pow(velocity/sigmaPSS,-3.)*(zTarget/screenedzTarget); //incorporates Coulomb deflection parameter 
+ 
+  G4double cParameter = 2.*coulombDeflection/(energyLoss*(energyLoss+1.));
+  
+  if (verboseLevel>0) G4cout << "  cParameter=" << cParameter<< G4endl;
+
+  G4double coulombDeflectionFunction = 9.*ExpIntFunction(10,cParameter);                         //this function describes Coulomb-deflection effect
+  if (verboseLevel>0) G4cout << "  ExpIntFunction(10,cParameter) =" << ExpIntFunction(10,cParameter) << G4endl;
+  if (verboseLevel>0) G4cout << "  coulombDeflectionFunction =" << coulombDeflectionFunction << G4endl;
+
+  //--------------------------------------------------------------------------------------------------------------------------------------------------
+ 
+  G4double crossSection =  0;
+  
+  crossSection = energyLossFunction* coulombDeflectionFunction*sigmaPSSR;  //this ECPSSR cross section is estimated at perturbed-stationnairy-state(PSS)
+                                                                           //and it's reduced by the energy-loss(E),the Coulomb deflection(C),
+                                                                           //and the relativity(R) effects
+
+  //--------------------------------------------------------------------------------------------------------------------------------------------------   
+
+  if (crossSection >= 0) {
+    return crossSection;
+  }
+  else {return 0;}
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+G4double G4ecpssrKCrossSection::FunctionFK(G4double k, G4double theta) 							  
+{
+
+  G4double sigma = 0.;
+  G4double valueT1 = 0;
+  G4double valueT2 = 0;
+  G4double valueE21 = 0;
+  G4double valueE22 = 0;
+  G4double valueE12 = 0;
+  G4double valueE11 = 0;
+  G4double xs11 = 0;   
+  G4double xs12 = 0; 
+  G4double xs21 = 0; 
+  G4double xs22 = 0; 
+
+  // PROTECTION TO ALLOW INTERPOLATION AT MINIMUM AND MAXIMUM EtaK/Theta2 values 
+  // (in particular for FK computation at 95 for high velocity formula)
+  
+  if (
+  theta==9.5e-2 ||
+  theta==9.5e-1 ||
+  theta==9.5e+00 ||
+  theta==9.5e+01
+  ) theta=theta-1e-12;
+
+  if (
+  theta==1.e-2 ||
+  theta==1.e-1 ||
+  theta==1.e+00 ||
+  theta==1.e+01
+  ) theta=theta+1e-12;
+
+  // END PROTECTION
+  
+  {
+    std::vector<double>::iterator t2 = std::upper_bound(dummyVec.begin(),dummyVec.end(), k);
+    std::vector<double>::iterator t1 = t2-1;
+ 
+    std::vector<double>::iterator e12 = std::upper_bound(aVecMap[(*t1)].begin(),aVecMap[(*t1)].end(), theta);
+    std::vector<double>::iterator e11 = e12-1; 
+	  
+    std::vector<double>::iterator e22 = std::upper_bound(aVecMap[(*t2)].begin(),aVecMap[(*t2)].end(), theta);
+    std::vector<double>::iterator e21 = e22-1;
+	  	
+    valueT1  =*t1;
+    valueT2  =*t2;
+    valueE21 =*e21;
+    valueE22 =*e22;
+    valueE12 =*e12;
+    valueE11 =*e11;
+
+    xs11 = FKData[valueT1][valueE11];
+    xs12 = FKData[valueT1][valueE12];
+    xs21 = FKData[valueT2][valueE21];
+    xs22 = FKData[valueT2][valueE22];
+
+/*
+verboseLevel=1;
+
+if (verboseLevel>0) G4cout << "x1= " << valueT1 << G4endl;
+if (verboseLevel>0) G4cout << " vector of y for x1" << G4endl;
+for_each (aVecMap[(*t1)].begin(),aVecMap[(*t1)].end(), print);
+
+if (verboseLevel>0) G4cout << G4endl;
+
+if (verboseLevel>0) G4cout << "x2= " << valueT2 << G4endl;
+if (verboseLevel>0) G4cout << " vector of y for x2" << G4endl;
+for_each (aVecMap[(*t2)].begin(),aVecMap[(*t2)].end(), print);
+
+if (verboseLevel>0) G4cout << G4endl;
+
+if (verboseLevel>0) G4cout 
+<< "  " 
+<< valueT1 << " "
+<< valueT2 << " "
+<< valueE11 << " "
+<< valueE12 << " "
+<< valueE21<< " "
+<< valueE22 << " " 
+<< xs11 << " " 
+<< xs12 << " " 
+<< xs21 << " " 
+<< xs22 << " " 
+<< G4endl;
+//verboseLevel=0;
+*/
+
+}
+     
+  G4double xsProduct = xs11 * xs12 * xs21 * xs22;
+  
+  if (xs11==0 || xs12==0 ||xs21==0 ||xs22==0) return (0.);
+     
+  if (xsProduct != 0.)
+  {
+    sigma = QuadInterpolator(  valueE11, valueE12, 
+    			       valueE21, valueE22, 
+			       xs11, xs12, 
+			       xs21, xs22, 
+			       valueT1, valueT2, 
+			       k, theta );
+  }
+
+  return sigma;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+G4double G4ecpssrKCrossSection::LinLogInterpolate(G4double e1, 
+						        G4double e2, 
+						        G4double e, 
+						        G4double xs1, 
+						        G4double xs2)
+{
+  G4double d1 = std::log(xs1);
+  G4double d2 = std::log(xs2);
+  G4double value = std::exp(d1 + (d2 - d1)*(e - e1)/ (e2 - e1));
+  return value;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+G4double G4ecpssrKCrossSection::LogLogInterpolate(G4double e1, 
+						        G4double e2, 
+						        G4double e, 
+						        G4double xs1, 
+						        G4double xs2)
+{
+  G4double a = (std::log10(xs2)-std::log10(xs1)) / (std::log10(e2)-std::log10(e1));
+  G4double b = std::log10(xs2) - a*std::log10(e2);
+  G4double sigma = a*std::log10(e) + b;
+  G4double value = (std::pow(10.,sigma));
+  return value;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+G4double G4ecpssrKCrossSection::QuadInterpolator(G4double e11, G4double e12, 
+						       G4double e21, G4double e22, 
+						       G4double xs11, G4double xs12, 
+						       G4double xs21, G4double xs22, 
+						       G4double t1, G4double t2, 
+						       G4double t, G4double e)
+{
+// Log-Log
+/*
+  G4double interpolatedvalue1 = LogLogInterpolate(e11, e12, e, xs11, xs12);
+  G4double interpolatedvalue2 = LogLogInterpolate(e21, e22, e, xs21, xs22);
+  G4double value = LogLogInterpolate(t1, t2, t, interpolatedvalue1, interpolatedvalue2);
+*/
+
+// Lin-Log
+  G4double interpolatedvalue1 = LinLogInterpolate(e11, e12, e, xs11, xs12);
+  G4double interpolatedvalue2 = LinLogInterpolate(e21, e22, e, xs21, xs22);
+  G4double value = LinLogInterpolate(t1, t2, t, interpolatedvalue1, interpolatedvalue2);
+  return value;
+}
+
+
+
+
+
Index: trunk/source/processes/electromagnetic/lowenergy/src/G4ecpssrLiCrossSection.cc
===================================================================
--- trunk/source/processes/electromagnetic/lowenergy/src/G4ecpssrLiCrossSection.cc	(revision 1197)
+++ trunk/source/processes/electromagnetic/lowenergy/src/G4ecpssrLiCrossSection.cc	(revision 1197)
@@ -0,0 +1,982 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//$Id: G4ecpssrLiCrossSection.cc,v 1.7 2009/11/11 09:14:53 mantero Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
+//
+// Author: Haifa Ben Abdelouahed
+//         
+//
+// History:
+// -----------
+//  23 Apr 2008   H. Ben Abdelouahed   1st implementation
+//  28 Apr 2008   MGP        Major revision according to a design iteration
+//  29 Apr 2009   ALF Updated Desing for Integration
+//  02 May 2009   ALF + Haifa L1,L2,L3 Extensions
+//  11 Nov 2009   ALF code cleaning for the Dec release
+//
+// -------------------------------------------------------------------
+// Class description:
+// Low Energy Electromagnetic Physics, Cross section, p and alpha ionisation, L shell
+// Further documentation available from http://www.ge.infn.it/geant4/lowE
+// -------------------------------------------------------------------
+
+
+#include "globals.hh"
+#include "G4ecpssrLiCrossSection.hh"
+#include "G4AtomicTransitionManager.hh"
+#include "G4NistManager.hh"
+#include "G4Proton.hh"
+#include "G4Alpha.hh"
+#include <math.h>
+
+G4ecpssrLiCrossSection::G4ecpssrLiCrossSection()
+{ 
+
+
+ // Storing FLi data needed for 0.2 to 3.0  velocities region
+
+    char *path = getenv("G4LEDATA");
+ 
+    if (!path)
+    G4Exception("G4ecpssrLCrossSection::CalculateCrossSection: G4LEDDATA environment variable not set");
+
+     std::ostringstream fileName1;
+     std::ostringstream fileName2;
+    fileName1 << path << "/pixe/uf/FL1.dat";
+    fileName2 << path << "/pixe/uf/FL2.dat";
+   
+    std::ifstream FL1(fileName1.str().c_str());
+    std::ifstream FL2(fileName1.str().c_str());
+   
+   
+    if (!FL1) G4Exception("G4ecpssrLCrossSection::CalculateCrossSection: error opening FL1 data file");
+    if (!FL2) G4Exception("G4ecpssrLCrossSection::CalculateCrossSection: error opening FL2 data file");
+  
+ dummyVec.push_back(0.);
+
+    while(!FL1.eof())
+    {
+	double x1;
+	double y1;
+	
+	FL1>>x1>>y1;
+
+	//  Mandatory vector initialization
+        if (x1 != dummyVec.back()) 
+        { 
+          dummyVec.push_back(x1); 
+          aVecMap[x1].push_back(-1.);
+        }
+	  
+        FL1>>FL1Data[x1][y1];
+
+        if (y1 != aVecMap[x1].back()) aVecMap[x1].push_back(y1);
+    }
+ while(!FL2.eof())
+    {
+	double x2;
+	double y2;
+	
+	FL2>>x2>>y2;
+
+	//  Mandatory vector initialization
+        if (x2 != dummyVec.back()) 
+        { 
+          dummyVec.push_back(x2); 
+          aVecMap[x2].push_back(-1.);
+        }
+	  
+        FL2>>FL2Data[x2][y2];
+
+        if (y2 != aVecMap[x2].back()) aVecMap[x2].push_back(y2);    
+    }
+
+
+}
+
+G4ecpssrLiCrossSection::~G4ecpssrLiCrossSection()
+{ }
+
+//---------------------------------this "ExpIntFunction" function allows fast evaluation of the n order exponential integral function En(x)------
+
+G4double G4ecpssrLiCrossSection::ExpIntFunction(G4int n,G4double x)
+
+{
+  G4int i;
+  G4int ii;
+  G4int nm1;
+  G4double a;
+  G4double b;
+  G4double c;
+  G4double d;
+  G4double del;
+  G4double fact;
+  G4double h;
+  G4double psi;
+  G4double ans = 0;
+  const G4double euler= 0.5772156649;
+  const G4int maxit= 100;
+  const G4double fpmin = 1.0e-30;
+  const G4double eps = 1.0e-7;
+  nm1=n-1;
+  if (n<0 || x<0.0 || (x==0.0 && (n==0 || n==1)))
+  G4cout << "bad arguments in ExpIntFunction" << G4endl;
+  else {
+       if (n==0) ans=exp(-x)/x;
+        else {
+           if (x==0.0) ans=1.0/nm1;
+              else {
+                   if (x > 1.0) {
+                         	b=x+n;
+                        	c=1.0/fpmin;
+                        	d=1.0/b;
+				h=d;
+				for (i=1;i<=maxit;i++) {
+				  a=-i*(nm1+i);
+				  b +=2.0;
+				  d=1.0/(a*d+b);
+				  c=b+a/c;
+				  del=c*d;
+				  h *=del;
+				      if (fabs(del-1.0) < eps) {
+					ans=h*exp(-x);
+					return ans;
+				      }
+				}
+		   } else {
+		     ans = (nm1!=0 ? 1.0/nm1 : -log(x)-euler);
+		     fact=1.0;
+		     for (i=1;i<=maxit;i++) {
+		       fact *=-x/i;
+		       if (i !=nm1) del = -fact/(i-nm1);
+		       else {
+			 psi = -euler;
+			 for (ii=1;ii<=nm1;ii++) psi +=1.0/ii;
+			 del=fact*(-log(x)+psi);
+		       }
+		       ans += del;
+		       if (fabs(del) < fabs(ans)*eps) return ans;
+		     }
+		   }
+	      }
+	}
+  }
+return ans;
+}
+//-----------------------------------------------------------------------------------------------------------
+
+ 
+G4double G4ecpssrLiCrossSection::CalculateL1CrossSection(G4int zTarget,G4double massIncident, G4double energyIncident)
+ 
+ //this L-CrossSection calculation method is done according to W.Brandt and G.Lapicki, Phys.Rev.A23(1981)//					                
+
+{
+
+  G4NistManager* massManager = G4NistManager::Instance();   
+
+  G4AtomicTransitionManager*  transitionManager =  G4AtomicTransitionManager::Instance();
+
+
+  G4int zIncident = 0; 
+  G4Proton* aProtone = G4Proton::Proton();
+  G4Alpha* aAlpha = G4Alpha::Alpha();
+
+  if (massIncident == aProtone->GetPDGMass() )
+  {
+
+   zIncident = (G4int)((aProtone->GetPDGCharge())/eplus); 
+
+   //G4cout << "zincident:" << zIncident << G4endl;
+  }
+  else
+    {
+      if (massIncident == aAlpha->GetPDGMass())
+	{
+	  
+	  zIncident  =(G4int) ((aAlpha->GetPDGCharge())/eplus); 
+	  
+	  //G4cout << "zincident:" << zIncident << G4endl;
+	}
+      else
+	{ 
+	  G4cout << "we can treat only Proton or Alpha incident particles " << G4endl;
+	  massIncident =0.;
+	}
+    }
+
+
+  G4double l1BindingEnergy = transitionManager->Shell(zTarget,1)->BindingEnergy();
+  
+
+
+
+
+         
+  G4double massTarget = (massManager->GetAtomicMassAmu(zTarget))*amu_c2;
+ 
+  G4double systemMass =((massIncident*massTarget)/(massIncident+massTarget))/electron_mass_c2;//the mass of the system (projectile, target) 
+
+  const G4double zlshell= 4.15;
+
+  G4double screenedzTarget = zTarget-zlshell;         // screenedzTarget is the screened nuclear charge of the target
+
+  const G4double rydbergMeV= 13.6056923e-6;
+
+  const G4double nl= 2.;        // nl is the quantum number of the L shell 
+     
+  G4double tetal1 = (l1BindingEnergy*nl*nl)/((screenedzTarget*screenedzTarget)*rydbergMeV);  //tetal1 denotes the reduced L1-shell-binding-energy of the electron
+
+
+
+
+
+
+  const G4double bohrPow2Barn=(Bohr_radius*Bohr_radius)/barn ;        
+  
+  G4double sigma0 = 8.*pi*(zIncident*zIncident)*bohrPow2Barn*pow(screenedzTarget,-4.);     //sigma0 is the initial cross section of L shell at stable state
+
+  //---------------------------------------------------------------------------------------------------------------------
+
+  G4double velocityl1 = CalculateVelocity(1, zTarget, massIncident, energyIncident);   //is the scaled velocity parameter of the system  
+
+
+
+  
+  //---------------------------------------------------------------------------------------------------------------------
+  
+  const G4double l1AnalyticalApproximation= 1.5; 
+
+
+
+  G4double x1 = nl*l1AnalyticalApproximation/velocityl1;
+
+
+
+
+
+  //-----------------------------------------x of l1 sub shell--------------------------------------
+ 
+ G4double electrIonizationEnergyl1;
+                                       
+                                       
+  if ( x1<0.035 && x1>= 0.)  
+    {
+      electrIonizationEnergyl1= 0.75*pi*(log(1./(x1*x1))-1.);  
+    }
+  else 
+    { 
+      if ( x1<3.&& x1>=0.035) 
+	{ 
+	  electrIonizationEnergyl1 =exp(-2.*x1)/(0.031+(0.213*pow(x1,0.5))+(0.005*x1)-(0.069*pow(x1,3./2.))+(0.324*x1*x1));
+	}
+     
+      else  
+	{
+	  if ( x1<=11.&& x1>=3.) {
+	    electrIonizationEnergyl1 =2.*exp(-2.*x1)/pow(x1,1.6);
+	  }
+	  else {
+	    electrIonizationEnergyl1 =0.;
+	      }
+	}
+    }
+
+
+ 
+ 
+
+  //-------------------------------------------------------- h and g functions for l1 -------------------------------------------------
+
+
+  G4double hFunctionl1 =(electrIonizationEnergyl1*2.*nl)/(tetal1*pow(velocityl1,3)); //hFunction represents the correction for polarization effet
+    
+ 
+  G4double gFunctionl1 = (1.+(9.*velocityl1)+(31.*velocityl1*velocityl1)+(49.*pow(velocityl1,3.))+(162.*pow(velocityl1,4.))+(63.*pow(velocityl1,5.))
+			  +(18.*pow(velocityl1,6.))+(1.97*pow(velocityl1,7.)))/pow(1.+velocityl1,9.); //gFunction represents the correction for binding effet
+
+
+
+
+  //-----------------------------------------------------------------------------------------------------------------------------
+
+  G4double sigmaPSS_l1 = 1.+(((2.*zIncident)/(screenedzTarget*tetal1))*(gFunctionl1-hFunctionl1)); //describes the perturbed stationnairy state of the affected atomic electon
+ 
+ 
+
+ 
+
+
+
+ //----------------------------------------------------------------------------------------------------------------------------
+  //const G4double cNaturalUnit= 1/fine_structure_const;  // it's the speed of light according to Atomic-Unit-System
+  //--------------------------------------------------------------------------------------------------------------
+
+  //G4double yl1Formula=0.4*(screenedzTarget/cNaturalUnit)*(screenedzTarget/cNaturalUnit)/(nl*(velocityl1/sigmaPSS_l1));
+
+ 
+
+  //-----------------------------------------------Relativity effect correction L1 -------------------------------------------------------------
+
+  //G4double relativityCorrectionl1 = pow((1.+(1.1*yl1Formula*yl1Formula)),0.5)+yl1Formula;// the relativistic correction parameter
+  //G4double reducedVelocityl1 = velocityl1*pow(relativityCorrectionl1,0.5);  // presents the reduced collision velocity parameter 
+
+
+
+
+
+
+
+  //-------------------------------------------------------------------------------------------------------------------
+   //------------------------------------------------------------UNIVERSAL FUNCTION ---------------------------------
+  //------------------------------------------------------------------------------------------------------------
+                                                  // is the reduced universal cross section
+
+  G4double universalFunction_l1 ;
+
+ 
+ 
+    //-------------------------------------------------------------------------------------------------------------------
+   //------------------------------------------------------------ LIMITS OF ECPSSR MODEL ---------------------------
+  //------------------------------------------------------------------------------------------------------------
+
+
+  G4double L1etaOverTheta2 = (energyIncident*electron_mass_c2)/(massIncident*rydbergMeV*screenedzTarget*screenedzTarget)/(sigmaPSS_l1*tetal1)/(sigmaPSS_l1*tetal1);
+
+
+     universalFunction_l1 = FunctionFL1((sigmaPSS_l1*tetal1), L1etaOverTheta2);
+        
+
+
+
+     //-----------------------------------------------------------------------------------------------------------------------
+    //---------------------------------------------------------------------------   PSSR Li CROSS SECTION  -------------
+   //-----------------------------------------------------------------------------------------------------------------------
+
+   G4double sigmaPSSR_l1 = (sigma0/(sigmaPSS_l1*tetal1))*universalFunction_l1; //sigmaPSSR is the straight-line L-shell ionization cross section
+
+
+
+   //----------------------------------------------------------------------------------------------------------------------
+  
+  G4double pssDeltal1 = (4./(systemMass*sigmaPSS_l1*tetal1))*(sigmaPSS_l1/velocityl1)*(sigmaPSS_l1/velocityl1);
+
+
+
+  G4double energyLossl1 = pow(1-pssDeltal1,0.5); //energyLoss incorporates the straight-line energy-loss 
+
+
+
+
+
+     //-----------------------------------------------------------------------------------------------------------------------
+    //----------------------------------------------------------------------------ENERGY LOSS CORRECTION-------------
+   //-----------------------------------------------------------------------------------------------------------------------
+
+/* 
+ G4double energyLossFunction_L1 = (pow(2.,-9)/8.)*((((9.*energyLossl1)-1.)*pow(1.+energyLossl1,9.))+(((9.*energyLossl1)+1.)*pow(1.-energyLossl1,9.))); 
+  G4double energyLossFunction_L2 = (pow(2.,-11)/10.)*((((11.*energyLossl2)-1.)*pow(1.+energyLossl2,11.))+(((11.*energyLossl2)+1.)*pow(1.-energyLossl2,11.)));
+  G4double energyLossFunction_L3 = (pow(2.,-11)/10.)*((((11.*energyLossl3)-1.)*pow(1.+energyLossl3,11.))+(((11.*energyLossl3)+1.)*pow(1.-energyLossl3,11.)));
+*/
+
+
+     //-----------------------------------------------------------------------------------------------------------------------
+    //----------------------------------------------------------------------------COULOMB DEFLECTION CORRECTION-------------
+   //-----------------------------------------------------------------------------------------------------------------------
+
+
+  G4double coulombDeflectionl1 = (4.*pi*zIncident/systemMass)*pow(tetal1*sigmaPSS_l1,-2.)*pow(velocityl1/sigmaPSS_l1,-3.)*(zTarget/screenedzTarget); //incorporates Coulomb deflection parameter 
+
+
+
+
+  G4double cParameterl1 = 2.*coulombDeflectionl1/(energyLossl1*(energyLossl1+1.));
+
+
+
+  G4double coulombDeflectionFunction_l1 = 9.*ExpIntFunction(10,cParameterl1);                         //this function describes Coulomb-deflection effect
+
+
+
+      //--------------------------------------------------------------------------------------------------------------------------------------------------
+     //-----------------------------------------------------------------------------------------------------------------------
+    //---------------------------------------------------------------------------   ECPSSR Li CROSS SECTION  -------------
+   //-----------------------------------------------------------------------------------------------------------------------
+  //--------------------------------------------------------------------------------------------------------------------------------------------------
+ 
+  /*
+   G4double crossSection_L1 = energyLossFunction_L1 * coulombDeflectionFunction_l1 * sigmaPSSR_l1;  //this ECPSSR cross section is estimated at perturbed-stationnairy-state(PSS)
+   G4double crossSection_L2 = energyLossFunction_L2 * coulombDeflectionFunction_l2 * sigmaPSSR_l2;         //and it's reduced by the energy-loss(E),the Coulomb deflection(C),
+   G4double crossSection_L3 = energyLossFunction_L3 * coulombDeflectionFunction_l3 * sigmaPSSR_l3;              //and the relativity(R) effects
+  */
+
+   G4double crossSection_L1 =  coulombDeflectionFunction_l1 * sigmaPSSR_l1; 
+
+ 
+ if (crossSection_L1 >= 0) {
+    return crossSection_L1;
+  }
+  else {return 0;}
+}
+
+G4double G4ecpssrLiCrossSection::CalculateL2CrossSection(G4int zTarget,G4double massIncident, G4double energyIncident)
+ 
+ //this L-CrossSection calculation method is done according to W.Brandt and G.Lapicki, Phys.Rev.A23(1981)//					                
+
+{
+
+
+  G4NistManager* massManager = G4NistManager::Instance();   
+
+  G4AtomicTransitionManager*  transitionManager =  G4AtomicTransitionManager::Instance();
+
+
+  G4int zIncident = 0; 
+  G4Proton* aProtone = G4Proton::Proton();
+  G4Alpha* aAlpha = G4Alpha::Alpha();
+
+  if (massIncident == aProtone->GetPDGMass() )
+  {
+
+   zIncident =(G4int) ((aProtone->GetPDGCharge())/eplus); 
+
+   //   G4cout << "zincident:" << zIncident << G4endl;
+    }
+  else
+    {
+      if (massIncident == aAlpha->GetPDGMass())
+	{
+	  
+	  zIncident  = (G4int) ((aAlpha->GetPDGCharge())/eplus); 
+	  
+	  //	  G4cout << "zincident:" << zIncident << G4endl;
+	}
+      else
+	{ 
+	  G4cout << "we can treat only Proton or Alpha incident particles " << G4endl;
+	  massIncident =0.;
+	}
+    }
+
+  G4double l2BindingEnergy = transitionManager->Shell(zTarget,2)->BindingEnergy();
+
+  G4double massTarget = (massManager->GetAtomicMassAmu(zTarget))*amu_c2;
+  G4double systemMass =((massIncident*massTarget)/(massIncident+massTarget))/electron_mass_c2;//the mass of the system (projectile, target) 
+  const G4double zlshell= 4.15;
+  G4double screenedzTarget = zTarget-zlshell;         // screenedzTarget is the screened nuclear charge of the target
+  const G4double rydbergMeV= 13.6056923e-6;
+  const G4double nl= 2.;        // nl is the quantum number of the L shell 
+
+  G4double tetal2 = (l2BindingEnergy*nl*nl)/((screenedzTarget*screenedzTarget)*rydbergMeV); 
+
+  const G4double bohrPow2Barn=(Bohr_radius*Bohr_radius)/barn ;        
+  G4double sigma0 = 8.*pi*(zIncident*zIncident)*bohrPow2Barn*pow(screenedzTarget,-4.);     //sigma0 is the initial cross section of L shell at stable state
+
+  G4double velocityl2 = CalculateVelocity(2,  zTarget, massIncident, energyIncident);
+
+  const G4double l2AnalyticalApproximation= 1.25;
+
+  G4double x2 = nl*l2AnalyticalApproximation/velocityl2;
+
+  //---------------------------------------------------------------x of l2 sub shell------------------------------------------
+ 
+G4double electrIonizationEnergyl2;
+                                       
+                                       
+  if ( x2<0.035 && x2>= 0.)  
+    {
+      electrIonizationEnergyl2= 0.75*pi*(log(1./(x2*x2))-1.);  
+    }
+  else 
+    { 
+      if ( x2<3. && x2 >=0.035) 
+	{ 
+	  electrIonizationEnergyl2 =exp(-2.*x2)/(0.031+(0.213*pow(x2,0.5))+(0.005*x2)-(0.069*pow(x2,3./2.))+(0.324*x2*x2));
+	}
+     
+      else  
+	{
+	  
+	  if ( x2<=11.&& x2>=3.) {
+	    electrIonizationEnergyl2 =2.*exp(-2.*x2)/pow(x2,1.6);
+	  }
+	  else {
+	    electrIonizationEnergyl2=0.;
+	  }
+	  
+	}
+    }
+  
+  //----------------------------------------------------------------------------- h and g functions for l2  ----------------------------
+  
+  
+  G4double hFunctionl2 =(electrIonizationEnergyl2*2.*nl)/(tetal2*pow(velocityl2,3)); //hFunction represents the correction for polarization effet
+  
+  G4double gFunctionl2 = (1.+(10.*velocityl2)+(45.*velocityl2*velocityl2)+(102.*pow(velocityl2,3.))+(331.*pow(velocityl2,4.))+(6.7*pow(velocityl2,5.))
+			  +(58.*pow(velocityl2,6.))+(7.8*pow(velocityl2,7.))+ (0.888*pow(velocityl2,8.)) )/pow(1.+velocityl2,10.); //gFunction represents the correction for binding effet
+  
+  
+  G4double sigmaPSS_l2 = 1.+(((2.*zIncident)/(screenedzTarget*tetal2))*(gFunctionl2-hFunctionl2)); 
+  
+  //----------------------------------------------------------------------------------------------------------------------------
+  //const G4double cNaturalUnit= 1/fine_structure_const;  // it's the speed of light according to Atomic-Unit-System
+  //--------------------------------------------------------------------------------------------------------------
+  
+  //G4double yl2Formula=0.15*(screenedzTarget/cNaturalUnit)*(screenedzTarget/cNaturalUnit)/(velocityl2/sigmaPSS_l2);
+  
+  //-----------------------------------------------Relativity effect correction L2 --------------------------------------------------------------
+  
+  //G4double relativityCorrectionl2 = pow((1.+(1.1*yl2Formula*yl2Formula)),0.5)+yl2Formula;// the relativistic correction parameter
+  //  G4double reducedVelocityl2 = velocityl2*pow(relativityCorrectionl2,0.5);  // presents the reduced collision velocity parameter 
+  
+  G4double L2etaOverTheta2 = (energyIncident*electron_mass_c2)/(massIncident*rydbergMeV*screenedzTarget*screenedzTarget)/(sigmaPSS_l2*tetal2)/(sigmaPSS_l2*tetal2);
+  
+  
+  G4double universalFunction_l2 ;
+  
+  
+  universalFunction_l2 = FunctionFL2((sigmaPSS_l2*tetal2), L2etaOverTheta2);
+  
+  G4double sigmaPSSR_l2 = (sigma0/(sigmaPSS_l2*tetal2))*universalFunction_l2;
+  G4double pssDeltal2 = (4./(systemMass*sigmaPSS_l2*tetal2))*(sigmaPSS_l2/velocityl2)*(sigmaPSS_l2/velocityl2);
+  G4double energyLossl2 = pow(1-pssDeltal2,0.5);  
+  
+  G4double coulombDeflectionl2 = (4.*pi*zIncident/systemMass)*pow(tetal2*sigmaPSS_l2,-2.)*pow(velocityl2/sigmaPSS_l2,-3.)*(zTarget/screenedzTarget); //incorporates Coulomb deflection parameter 
+  G4double cParameterl2 = 2.*coulombDeflectionl2/(energyLossl2*(energyLossl2+1.));
+  G4double coulombDeflectionFunction_l2 = 11.*ExpIntFunction(12,cParameterl2);
+  
+  G4double crossSection_L2 = coulombDeflectionFunction_l2 * sigmaPSSR_l2 ;         
+  
+  
+  if (crossSection_L2 >= 0) {
+    return crossSection_L2;
+  }
+  else {return 0;}
+  
+  
+}
+
+
+G4double G4ecpssrLiCrossSection::CalculateL3CrossSection(G4int zTarget,G4double massIncident, G4double energyIncident)
+ 
+ //this L-CrossSection calculation method is done according to W.Brandt and G.Lapicki, Phys.Rev.A23(1981)//					                
+
+{
+
+
+  G4NistManager* massManager = G4NistManager::Instance();   
+
+  G4AtomicTransitionManager*  transitionManager =  G4AtomicTransitionManager::Instance();
+
+
+  G4int zIncident = 0; 
+  G4Proton* aProtone = G4Proton::Proton();
+  G4Alpha* aAlpha = G4Alpha::Alpha();
+
+  if (massIncident == aProtone->GetPDGMass() )
+  {
+
+   zIncident = (G4int) ((aProtone->GetPDGCharge())/eplus); 
+
+   //   G4cout << "zincident:" << zIncident << G4endl;
+    }
+  else
+    {
+      if (massIncident == aAlpha->GetPDGMass())
+	{
+	  
+	  zIncident  =(G4int) ((aAlpha->GetPDGCharge())/eplus); 
+	  
+	  //	  G4cout << "zincident:" << zIncident << G4endl;
+	}
+      else
+	{ 
+	  G4cout << "we can treat only Proton or Alpha incident particles " << G4endl;
+	  massIncident =0.;
+	}
+    }
+
+  G4double l3BindingEnergy = transitionManager->Shell(zTarget,3)->BindingEnergy();
+        
+  G4double massTarget = (massManager->GetAtomicMassAmu(zTarget))*amu_c2;
+ 
+  G4double systemMass =((massIncident*massTarget)/(massIncident+massTarget))/electron_mass_c2;//the mass of the system (projectile, target) 
+
+  const G4double zlshell= 4.15;
+
+  G4double screenedzTarget = zTarget-zlshell;         // screenedzTarget is the screened nuclear charge of the target
+
+  const G4double rydbergMeV= 13.6056923e-6;
+
+  const G4double nl= 2.;        // nl is the quantum number of the L shell 
+     
+  G4double tetal3 = (l3BindingEnergy*nl*nl)/((screenedzTarget*screenedzTarget)*rydbergMeV); 
+
+
+
+  const G4double bohrPow2Barn=(Bohr_radius*Bohr_radius)/barn ;        
+  
+  G4double sigma0 = 8.*pi*(zIncident*zIncident)*bohrPow2Barn*pow(screenedzTarget,-4.);     //sigma0 is the initial cross section of L shell at stable state
+
+  //---------------------------------------------------------------------------------------------------------------------
+
+  G4double velocityl3 = CalculateVelocity(3, zTarget, massIncident, energyIncident);
+
+  const G4double l3AnalyticalApproximation= 1.25;
+
+  G4double x3 = nl*l3AnalyticalApproximation/velocityl3;
+
+
+  //--------------------------------------------------------------------- x of l3 sub shell---------------------------------
+
+
+ G4double electrIonizationEnergyl3;
+                                     
+                                       
+  if ( x3<0.035 && x3>=0. )  
+    {
+      electrIonizationEnergyl3= 0.75*pi*(log(1./(x3*x3))-1.);  
+    }
+  else 
+    { 
+      if ( x3<3. && x3 >= 0.035) 
+	{ 
+	  electrIonizationEnergyl3 =exp(-2.*x3)/(0.031+(0.213*pow(x3,0.5))+(0.005*x3)-(0.069*pow(x3,3./2.))+(0.324*x3*x3));
+	}
+     
+      else  
+	{
+	  if ( x3<=11.&& x3>=3.) {
+	    electrIonizationEnergyl3 =2.*exp(-2.*x3)/pow(x3,1.6);
+	  }
+	  else {
+            electrIonizationEnergyl3=0.;
+	  }
+	  
+	}
+    }
+
+ //------------------------------------------------------------ h and g function  for l3  ---------------------------------------------
+
+
+  G4double hFunctionl3 =(electrIonizationEnergyl3*2.*nl)/(tetal3*pow(velocityl3,3)); //hFunction represents the correction for polarization effet
+    
+ 
+  G4double gFunctionl3 = (1.+(10.*velocityl3)+(45.*velocityl3*velocityl3)+(102.*pow(velocityl3,3.))+(331.*pow(velocityl3,4.))+(6.7*pow(velocityl3,5.))
+			  +(58.*pow(velocityl3,6.))+(7.8*pow(velocityl3,7.))+ (0.888*pow(velocityl3,8.)) )/pow(1.+velocityl3,10.); //gFunction represents the correction for binding effet
+  //-----------------------------------------------------------------------------------------------------------------------------
+
+  G4double sigmaPSS_l3 = 1.+(((2.*zIncident)/(screenedzTarget*tetal3))*(gFunctionl3-hFunctionl3)); 
+
+
+  //----------------------------------------------------------------------------------------------------------------------------
+  //const G4double cNaturalUnit= 1/fine_structure_const;  // it's the speed of light according to Atomic-Unit-System
+  //--------------------------------------------------------------------------------------------------------------
+
+  //G4double yl3Formula=0.15*(screenedzTarget/cNaturalUnit)*(screenedzTarget/cNaturalUnit)/(velocityl3/sigmaPSS_l3);
+
+ //-----------------------------------------------Relativity effect correction L3 --------------------------------------------------------------
+
+ //G4double relativityCorrectionl3 = pow((1.+(1.1*yl3Formula*yl3Formula)),0.5)+yl3Formula;// the relativistic correction parameter
+ //G4double reducedVelocityl3 = velocityl3*pow(relativityCorrectionl3,0.5);  // presents the reduced collision velocity parameter 
+
+  G4double universalFunction_l3 ;
+
+  G4double L3etaOverTheta2 = (energyIncident*electron_mass_c2)/(massIncident*rydbergMeV*screenedzTarget*screenedzTarget)/(sigmaPSS_l3*tetal3)/(sigmaPSS_l3*tetal3);
+  
+  universalFunction_l3 = 2*FunctionFL2((sigmaPSS_l3*tetal3), L3etaOverTheta2);
+  
+  
+  G4double sigmaPSSR_l3 = (sigma0/(sigmaPSS_l3*tetal3))*universalFunction_l3;
+  
+  G4double pssDeltal3 = (4./(systemMass*sigmaPSS_l3*tetal3))*(sigmaPSS_l3/velocityl3)*(sigmaPSS_l3/velocityl3);
+
+  G4double energyLossl3 = pow(1-pssDeltal3,0.5); 
+
+  G4double coulombDeflectionl3 = (4.*pi*zIncident/systemMass)*pow(tetal3*sigmaPSS_l3,-2.)*pow(velocityl3/sigmaPSS_l3,-3.)*(zTarget/screenedzTarget); //incorporates Coulomb deflection parameter 
+
+  G4double cParameterl3 = 2.*coulombDeflectionl3/(energyLossl3*(energyLossl3+1.));
+  
+  G4double coulombDeflectionFunction_l3 = 11.*ExpIntFunction(12,cParameterl3);
+  
+  G4double crossSection_L3 = coulombDeflectionFunction_l3 * sigmaPSSR_l3;              
+  
+  if (crossSection_L3 >= 0) {
+    return crossSection_L3;
+  }
+  else {return 0;}
+  
+}
+
+
+
+G4double G4ecpssrLiCrossSection::CalculateVelocity(G4int subShell, G4int zTarget, G4double massIncident,  G4double energyIncident) 
+			                     
+{  
+
+  G4AtomicTransitionManager*  transitionManager =  G4AtomicTransitionManager::Instance();
+
+  G4double liBindingEnergy = transitionManager->Shell(zTarget,subShell)->BindingEnergy();
+
+  
+  G4Proton* aProtone = G4Proton::Proton();
+  G4Alpha* aAlpha = G4Alpha::Alpha();
+  
+  if (!(massIncident == aProtone->GetPDGMass() || massIncident == aAlpha->GetPDGMass()))
+    {
+      G4cout << "we can treat only Proton or Alpha incident particles " << G4endl;
+      return 0;
+    }
+  
+  
+  const G4double zlshell= 4.15;      
+  
+  G4double screenedzTarget = zTarget- zlshell;                                  
+  
+  const G4double rydbergMeV= 13.6e-6;
+  
+  const G4double nl= 2.;        // nl is the quantum number of the L shell 
+  
+  G4double tetali = (liBindingEnergy*nl*nl)/(screenedzTarget*screenedzTarget*rydbergMeV);     
+
+   G4double velocity =(2.*nl/(tetali*screenedzTarget))*pow(((energyIncident*electron_mass_c2)/(massIncident*rydbergMeV)),0.5);
+  
+  return velocity;
+}
+
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+
+G4double G4ecpssrLiCrossSection::FunctionFL1(G4double k, G4double theta) 							  
+{
+
+  G4double sigma = 0.;
+  G4double valueT1 = 0;
+  G4double valueT2 = 0;
+  G4double valueE21 = 0;
+  G4double valueE22 = 0;
+  G4double valueE12 = 0;
+  G4double valueE11 = 0;
+  G4double xs11 = 0;   
+  G4double xs12 = 0; 
+  G4double xs21 = 0; 
+  G4double xs22 = 0; 
+
+  // PROTECTION TO ALLOW INTERPOLATION AT MINIMUM AND MAXIMUM EtaK/Theta2 values 
+  // (in particular for FK computation at 95 for high velocity formula)
+  
+  if (
+  theta==9.5e-2 ||
+  theta==9.5e-1 ||
+  theta==9.5e+00 ||
+  theta==9.5e+01
+  ) theta=theta-1e-12;
+
+  if (
+  theta==1.e-2 ||
+  theta==1.e-1 ||
+  theta==1.e+00 ||
+  theta==1.e+01
+  ) theta=theta+1e-12;
+
+  // END PROTECTION
+  
+  {
+    std::vector<double>::iterator t2 = std::upper_bound(dummyVec.begin(),dummyVec.end(), k);
+    std::vector<double>::iterator t1 = t2-1;
+ 
+    std::vector<double>::iterator e12 = std::upper_bound(aVecMap[(*t1)].begin(),aVecMap[(*t1)].end(), theta);
+    std::vector<double>::iterator e11 = e12-1; 
+	  
+    std::vector<double>::iterator e22 = std::upper_bound(aVecMap[(*t2)].begin(),aVecMap[(*t2)].end(), theta);
+    std::vector<double>::iterator e21 = e22-1;
+	  	
+    valueT1  =*t1;
+    valueT2  =*t2;
+    valueE21 =*e21;
+    valueE22 =*e22;
+    valueE12 =*e12;
+    valueE11 =*e11;
+
+    xs11 = FL1Data[valueT1][valueE11];
+    xs12 = FL1Data[valueT1][valueE12];
+    xs21 = FL1Data[valueT2][valueE21];
+    xs22 = FL1Data[valueT2][valueE22];
+
+}
+     
+  G4double xsProduct = xs11 * xs12 * xs21 * xs22;
+  
+  if (xs11==0 || xs12==0 ||xs21==0 ||xs22==0) return (0.);
+     
+  if (xsProduct != 0.)
+  {
+    sigma = QuadInterpolator(  valueE11, valueE12, 
+    			       valueE21, valueE22, 
+			       xs11, xs12, 
+			       xs21, xs22, 
+			       valueT1, valueT2, 
+			       k, theta );
+  }
+
+  return sigma;
+}
+
+
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+
+G4double G4ecpssrLiCrossSection::FunctionFL2(G4double k, G4double theta) 							  
+{
+
+  G4double sigma = 0.;
+  G4double valueT1 = 0;
+  G4double valueT2 = 0;
+  G4double valueE21 = 0;
+  G4double valueE22 = 0;
+  G4double valueE12 = 0;
+  G4double valueE11 = 0;
+  G4double xs11 = 0;   
+  G4double xs12 = 0; 
+  G4double xs21 = 0; 
+  G4double xs22 = 0; 
+
+  // PROTECTION TO ALLOW INTERPOLATION AT MINIMUM AND MAXIMUM EtaK/Theta2 values 
+  // (in particular for FK computation at 95 for high velocity formula)
+  
+  if (
+  theta==9.5e-2 ||
+  theta==9.5e-1 ||
+  theta==9.5e+00 ||
+  theta==9.5e+01
+  ) theta=theta-1e-12;
+
+  if (
+  theta==1.e-2 ||
+  theta==1.e-1 ||
+  theta==1.e+00 ||
+  theta==1.e+01
+  ) theta=theta+1e-12;
+
+  // END PROTECTION
+  
+  {
+    std::vector<double>::iterator t2 = std::upper_bound(dummyVec.begin(),dummyVec.end(), k);
+    std::vector<double>::iterator t1 = t2-1;
+ 
+    std::vector<double>::iterator e12 = std::upper_bound(aVecMap[(*t1)].begin(),aVecMap[(*t1)].end(), theta);
+    std::vector<double>::iterator e11 = e12-1; 
+	  
+    std::vector<double>::iterator e22 = std::upper_bound(aVecMap[(*t2)].begin(),aVecMap[(*t2)].end(), theta);
+    std::vector<double>::iterator e21 = e22-1;
+	  	
+    valueT1  =*t1;
+    valueT2  =*t2;
+    valueE21 =*e21;
+    valueE22 =*e22;
+    valueE12 =*e12;
+    valueE11 =*e11;
+
+    xs11 = FL2Data[valueT1][valueE11];
+    xs12 = FL2Data[valueT1][valueE12];
+    xs21 = FL2Data[valueT2][valueE21];
+    xs22 = FL2Data[valueT2][valueE22];
+
+
+}
+     
+  G4double xsProduct = xs11 * xs12 * xs21 * xs22;
+  
+  if (xs11==0 || xs12==0 ||xs21==0 ||xs22==0) return (0.);
+     
+  if (xsProduct != 0.)
+  {
+    sigma = QuadInterpolator(  valueE11, valueE12, 
+    			       valueE21, valueE22, 
+			       xs11, xs12, 
+			       xs21, xs22, 
+			       valueT1, valueT2, 
+			       k, theta );
+  }
+
+  return sigma;
+}
+
+
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+G4double G4ecpssrLiCrossSection::LinLogInterpolate(G4double e1, 
+						        G4double e2, 
+						        G4double e, 
+						        G4double xs1, 
+						        G4double xs2)
+{
+  G4double d1 = std::log(xs1);
+  G4double d2 = std::log(xs2);
+  G4double value = std::exp(d1 + (d2 - d1)*(e - e1)/ (e2 - e1));
+  return value;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+G4double G4ecpssrLiCrossSection::LogLogInterpolate(G4double e1, 
+						        G4double e2, 
+						        G4double e, 
+						        G4double xs1, 
+						        G4double xs2)
+{
+  G4double a = (std::log10(xs2)-std::log10(xs1)) / (std::log10(e2)-std::log10(e1));
+  G4double b = std::log10(xs2) - a*std::log10(e2);
+  G4double sigma = a*std::log10(e) + b;
+  G4double value = (std::pow(10.,sigma));
+  return value;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+G4double G4ecpssrLiCrossSection::QuadInterpolator(G4double e11, G4double e12, 
+						       G4double e21, G4double e22, 
+						       G4double xs11, G4double xs12, 
+						       G4double xs21, G4double xs22, 
+						       G4double t1, G4double t2, 
+						       G4double t, G4double e)
+{
+// Log-Log
+/*
+  G4double interpolatedvalue1 = LogLogInterpolate(e11, e12, e, xs11, xs12);
+  G4double interpolatedvalue2 = LogLogInterpolate(e21, e22, e, xs21, xs22);
+  G4double value = LogLogInterpolate(t1, t2, t, interpolatedvalue1, interpolatedvalue2);
+*/
+
+// Lin-Log
+  G4double interpolatedvalue1 = LinLogInterpolate(e11, e12, e, xs11, xs12);
+  G4double interpolatedvalue2 = LinLogInterpolate(e21, e22, e, xs21, xs22);
+  G4double value = LinLogInterpolate(t1, t2, t, interpolatedvalue1, interpolatedvalue2);
+  return value;
+}
+
Index: trunk/source/processes/electromagnetic/lowenergy/src/G4empCrossSection.cc
===================================================================
--- trunk/source/processes/electromagnetic/lowenergy/src/G4empCrossSection.cc	(revision 1197)
+++ trunk/source/processes/electromagnetic/lowenergy/src/G4empCrossSection.cc	(revision 1197)
@@ -0,0 +1,123 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//$Id: G4empCrossSection.cc,v 1.2 2009/06/25 15:52:08 mantero Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
+//
+//         
+//
+// History:
+// -----------
+//  29 Apr 2009   ALF   1st implementation
+//
+// -------------------------------------------------------------------
+// Class description:
+// empirical model for K and L Ionization CS for Protons and Alpha
+// Further documentation available from http://www.ge.infn.it/geant4/lowE
+// -------------------------------------------------------------------
+
+
+#include "globals.hh"
+#include "G4empCrossSection.hh"
+#include "G4Proton.hh"
+//#include "G4Alpha.hh"
+//#include <math.h>
+
+G4empCrossSection::G4empCrossSection()
+  :totalCS(0)
+{ 
+
+  paulShellK = new G4PaulKCrossSection();
+  orlicShellLi = new G4OrlicLiCrossSection();
+
+}
+
+G4empCrossSection::~G4empCrossSection()
+{ 
+
+  delete paulShellK;
+  delete orlicShellLi;
+
+}
+
+std::vector<G4double> G4empCrossSection::GetCrossSection(G4int Z,
+							     G4double incidentEnergy,
+							     G4double mass,
+							     G4double deltaEnergy,
+							     G4bool testFlag) const
+{
+
+  deltaEnergy = 0;
+  testFlag = 0;
+
+  std::vector<G4double> crossSections;
+
+  crossSections.push_back( paulShellK->CalculateKCrossSection(Z, mass, incidentEnergy) );
+  
+  G4Proton* aProtone = G4Proton::Proton();
+  
+  if (mass == aProtone->GetPDGMass() ) {
+    
+    crossSections.push_back( orlicShellLi->CalculateL1CrossSection(Z, incidentEnergy) );
+    crossSections.push_back( orlicShellLi->CalculateL2CrossSection(Z, incidentEnergy) );
+    crossSections.push_back( orlicShellLi->CalculateL3CrossSection(Z, incidentEnergy) );
+  }
+  
+  return crossSections;
+
+}
+
+
+
+
+std::vector<G4double> G4empCrossSection::Probabilities(G4int Z,
+							   G4double incidentEnergy,
+							   G4double mass,
+							   G4double deltaEnergy) const
+{
+  
+std::vector<G4double> crossSections = GetCrossSection(Z, incidentEnergy, mass, deltaEnergy);
+
+  for (size_t i=0; i<crossSections.size(); i++ ) {
+    
+    if (totalCS) {
+      crossSections[i] = crossSections[i]/totalCS;
+    }
+    
+  }
+
+  return crossSections;
+
+}
+
+
+void G4empCrossSection::SetTotalCS(G4double val){
+
+  totalCS = val;
+
+}
+
+
+
Index: trunk/source/processes/electromagnetic/lowenergy/src/G4teoCrossSection.cc
===================================================================
--- trunk/source/processes/electromagnetic/lowenergy/src/G4teoCrossSection.cc	(revision 1197)
+++ trunk/source/processes/electromagnetic/lowenergy/src/G4teoCrossSection.cc	(revision 1197)
@@ -0,0 +1,145 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//$Id: G4teoCrossSection.cc,v 1.5 2009/11/11 09:14:53 mantero Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
+//
+//         
+//
+// History:
+// -----------
+//  21 Apr 2009   ALF   1st implementation
+//  29 Apr 2009   ALF Updated Desing for Integration
+//  11 Nov 2009   ALF update and code cleaning for the Dec Release 
+//
+// -------------------------------------------------------------------
+// Class description:
+// Low Energy Electromagnetic Physics, Cross section, p ionisation, K shell
+// Further documentation available from http://www.ge.infn.it/geant4/lowE
+// -------------------------------------------------------------------
+
+
+#include "globals.hh"
+#include "G4teoCrossSection.hh"
+//#include "G4AtomicTransitionManager.hh"
+//#include "G4NistManager.hh"
+#include "G4Proton.hh"
+//#include "G4Alpha.hh"
+//#include <math.h>
+
+G4teoCrossSection::G4teoCrossSection(G4String shellModel = "ecpssr")
+  :totalCS(0)
+{ 
+
+  if (shellModel == "ecpssr") {
+
+    ecpssrShellK = new G4ecpssrKCrossSection();
+
+    ecpssrShellLi = new G4ecpssrLiCrossSection();
+  }
+  else {
+
+    G4cout << "G4teoCrossSection: sorry, only ECPSSR model available at the moment" << G4endl;
+
+    ecpssrShellK = new G4ecpssrKCrossSection();
+
+    ecpssrShellLi = new G4ecpssrLiCrossSection();
+
+  }
+
+
+}
+
+G4teoCrossSection::~G4teoCrossSection()
+{ 
+
+  delete ecpssrShellK;
+  delete ecpssrShellLi;
+
+}
+
+std::vector<G4double> G4teoCrossSection::GetCrossSection(G4int Z,
+							     G4double incidentEnergy,
+							     G4double mass,
+							     G4double deltaEnergy,
+							     G4bool testFlag) const
+{
+
+  deltaEnergy = 0;
+  testFlag = 0;
+
+
+  std::vector<G4double> crossSections;
+
+  crossSections.push_back( ecpssrShellK->CalculateCrossSection(Z, mass, incidentEnergy) );
+  
+  //  G4Proton* aProtone = G4Proton::Proton();
+  
+  //  if (mass == aProtone->GetPDGMass() ) {
+    
+
+  //  }
+  
+    crossSections.push_back( ecpssrShellLi->CalculateL1CrossSection(Z, mass, incidentEnergy) );
+    crossSections.push_back( ecpssrShellLi->CalculateL2CrossSection(Z, mass, incidentEnergy) );
+    crossSections.push_back( ecpssrShellLi->CalculateL3CrossSection(Z, mass, incidentEnergy) );
+
+
+  return crossSections;
+
+}
+
+
+
+
+std::vector<G4double> G4teoCrossSection::Probabilities(G4int Z,
+							   G4double incidentEnergy,
+							   G4double mass,
+							   G4double deltaEnergy) const
+{
+  
+std::vector<G4double> crossSections = GetCrossSection(Z, incidentEnergy, mass, deltaEnergy);
+
+  for (size_t i=0; i<crossSections.size(); i++ ) {
+    
+    if (totalCS) {
+      crossSections[i] = crossSections[i]/totalCS;
+    }
+    
+  }
+
+  return crossSections;
+
+}
+
+
+void G4teoCrossSection::SetTotalCS(G4double val){
+
+  totalCS = val;
+
+}
+
+
+
Index: trunk/source/processes/electromagnetic/standard/include/G4ICRU49NuclearStoppingModel.hh
===================================================================
--- trunk/source/processes/electromagnetic/standard/include/G4ICRU49NuclearStoppingModel.hh	(revision 1197)
+++ trunk/source/processes/electromagnetic/standard/include/G4ICRU49NuclearStoppingModel.hh	(revision 1197)
@@ -0,0 +1,119 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4ICRU49NuclearStoppingModel.hh,v 1.2 2009/11/10 19:25:47 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
+//
+// -------------------------------------------------------------------
+//
+//
+// GEANT4 Class header file
+//
+//
+// File name:     G4ICRU49NuclearStoppingModel
+//
+// Author:        V.Ivanchenko 
+//
+// Creation date: 20.07.2009 
+//
+// Modifications:
+//
+//
+// Class Description:
+//
+// Implementation of the ICRU'49 model of nuclear stopping 
+
+// -------------------------------------------------------------------
+//
+
+#ifndef G4ICRU49NuclearStoppingModel_h
+#define G4ICRU49NuclearStoppingModel_h 1
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+#include "G4VEmModel.hh"
+
+class G4ParticleChangeForLoss;
+class G4Pow;
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+class G4ICRU49NuclearStoppingModel : public G4VEmModel
+{
+
+public:
+
+  G4ICRU49NuclearStoppingModel(const G4String& nam = "ICRU49NucStopping");
+
+  virtual ~G4ICRU49NuclearStoppingModel();
+
+  virtual void Initialise(const G4ParticleDefinition*, 
+			  const G4DataVector&);
+
+  // main method to compute dEdx
+  virtual G4double ComputeDEDXPerVolume(const G4Material*,
+                                        const G4ParticleDefinition*,
+                                        G4double kineticEnergy,
+                                        G4double cutEnergy = DBL_MAX);
+
+  virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
+				 const G4MaterialCutsCouple*,
+				 const G4DynamicParticle*, 
+				 G4double, G4double);
+
+  inline void SetFluctuationFlag(G4bool);
+
+private:
+
+  void InitialiseNuclearStopping();
+
+  G4double NuclearStoppingPower(G4double kineticEnergy,
+				G4double Z1, G4double Z2,
+				G4double A1, G4double A2);
+
+  //  hide assignment operator
+  G4ICRU49NuclearStoppingModel & operator=(const  G4ICRU49NuclearStoppingModel &right);
+  G4ICRU49NuclearStoppingModel(const  G4ICRU49NuclearStoppingModel&);
+
+  G4Pow* g4pow;
+
+  static G4double ed[104];
+  static G4double ad[104];
+
+  G4double theZieglerFactor;
+
+  // flags
+  G4bool   lossFlucFlag;
+};
+
+inline void G4ICRU49NuclearStoppingModel::SetFluctuationFlag(G4bool val)
+{
+  lossFlucFlag = val;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+#endif
+
Index: trunk/source/processes/electromagnetic/standard/include/G4LindhardPartition.hh
===================================================================
--- trunk/source/processes/electromagnetic/standard/include/G4LindhardPartition.hh	(revision 1197)
+++ trunk/source/processes/electromagnetic/standard/include/G4LindhardPartition.hh	(revision 1197)
@@ -0,0 +1,69 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4LindhardPartition.hh,v 1.1 2009/11/05 11:42:24 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
+//
+
+/*
+ *  G4LindhardPartition.hh
+ *
+ *  Created by Marcus Mendenhall on 1/14/08.
+ *  Copyright 2008 Vanderbilt University, Nashville, TN, USA. All rights reserved.
+ *
+ */
+
+#include "globals.hh"
+
+class G4Material;
+
+class G4VNIELPartition 
+{
+public:
+	G4VNIELPartition() { }
+	virtual ~G4VNIELPartition() { }
+	
+	// return the fraction of the specified energy which will be deposited as NIEL
+	// if an incoming particle with z1, a1 is stopped in the specified material
+	// a1 is in atomic mass units, energy in native G4 energy units.
+	virtual G4double PartitionNIEL(
+		G4int z1, G4double a1, const G4Material *material, G4double energy
+	) const =0;
+};
+
+class G4LindhardRobinsonPartition : public G4VNIELPartition
+{
+public:
+	G4LindhardRobinsonPartition();
+	virtual ~G4LindhardRobinsonPartition() { }
+	
+	virtual G4double PartitionNIEL(
+		G4int z1, G4double a1, const G4Material *material, G4double energy
+	) const ;
+	
+	G4double z23[120];
+        size_t   max_z;
+};
+
Index: trunk/source/processes/electromagnetic/standard/include/G4NuclearStopping.hh
===================================================================
--- trunk/source/processes/electromagnetic/standard/include/G4NuclearStopping.hh	(revision 1197)
+++ trunk/source/processes/electromagnetic/standard/include/G4NuclearStopping.hh	(revision 1197)
@@ -0,0 +1,109 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4NuclearStopping.hh,v 1.2 2009/11/10 19:25:47 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
+//
+// -----------------------------------------------------------------------------
+//
+// GEANT4 Class header file
+//
+// Author:        Vladimir Ivanchenko
+//
+// Creation date: 20 July 2009
+// 
+// Modified:
+//
+//------------------------------------------------------------------------------
+//
+
+// class description
+//
+//  The class simulates nuclear stopping due to multiple scattering
+//
+// class description - end
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+#ifndef G4NuclearStopping_h
+#define G4NuclearStopping_h 1
+
+#include "G4VEmProcess.hh"
+#include "globals.hh"
+#include "G4Track.hh"
+#include "G4Step.hh"
+#include "G4ParticleDefinition.hh"
+#include "G4GPILSelection.hh"
+#include "G4ParticleChangeForLoss.hh"
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+class G4ICRU49NuclearStoppingModel;
+
+class G4NuclearStopping : public G4VEmProcess
+{
+
+public:    // with description
+
+  G4NuclearStopping(const G4String& processName="nuclearStopping");
+
+  virtual ~G4NuclearStopping();
+
+  // returns true for charged particles, false otherwise
+  G4bool IsApplicable (const G4ParticleDefinition& p);
+
+  // implementation of pure virtual method
+  G4double AlongStepGetPhysicalInteractionLength(const G4Track& track,
+						 G4double  previousStepSize,
+						 G4double  currentMinimumStep,
+						 G4double& proposedSafety,
+						 G4GPILSelection* selection);
+
+  // implementation of energy loss along step
+  G4VParticleChange* AlongStepDoIt(const G4Track& track,
+				   const G4Step&  step);
+
+  // Print few lines of informations about the process: validity range,
+  void PrintInfo();
+
+protected:
+
+  // This function initialise process
+  void InitialiseProcess(const G4ParticleDefinition*);
+
+private:       
+
+  G4ParticleChangeForLoss nParticleChange;
+
+  G4ICRU49NuclearStoppingModel* modelICRU49;
+
+  G4bool   isInitialized;
+
+};
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+#endif
Index: trunk/source/processes/electromagnetic/standard/include/G4UrbanMscModel92.hh
===================================================================
--- trunk/source/processes/electromagnetic/standard/include/G4UrbanMscModel92.hh	(revision 1197)
+++ trunk/source/processes/electromagnetic/standard/include/G4UrbanMscModel92.hh	(revision 1197)
@@ -0,0 +1,230 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4UrbanMscModel92.hh,v 1.1 2009/11/01 13:04:12 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
+//
+// -------------------------------------------------------------------
+//
+//
+// GEANT4 Class header file
+//
+//
+// File name:     G4UrbanMscModel92
+//
+// Author:        Laszlo Urban
+//
+// Creation date: 06.03.2008
+//
+// Modifications:
+//
+// 28-10-2009  V.Ivanchenko moved G4UrbanMscModel to G4UrbanMscModel92, 
+//             now it is a frozen version of the Urban model corresponding 
+//             to g4 9.2
+//
+// Class Description:
+//
+// Implementation of the model of multiple scattering based on
+// H.W.Lewis Phys Rev 78 (1950) 526 and L.Urban model
+
+// -------------------------------------------------------------------
+//
+
+#ifndef G4UrbanMscModel92_h
+#define G4UrbanMscModel92_h 1
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+#include "G4VMscModel.hh"
+#include "G4PhysicsTable.hh"
+#include "G4MscStepLimitType.hh"
+
+class G4ParticleChangeForMSC;
+class G4SafetyHelper;
+class G4LossTableManager;
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+class G4UrbanMscModel92 : public G4VMscModel
+{
+
+public:
+
+  G4UrbanMscModel92(const G4String& nam = "UrbanMsc92");
+
+  virtual ~G4UrbanMscModel92();
+
+  void Initialise(const G4ParticleDefinition*, const G4DataVector&);
+
+  G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition* particle,
+				      G4double KineticEnergy,
+				      G4double AtomicNumber,
+				      G4double AtomicWeight=0., 
+				      G4double cut =0.,
+				      G4double emax=DBL_MAX);
+
+  void SampleScattering(const G4DynamicParticle*,
+			G4double safety);
+
+  G4double ComputeTruePathLengthLimit(const G4Track& track,
+				      G4PhysicsTable* theLambdaTable,
+				      G4double currentMinimalStep);
+
+  G4double ComputeGeomPathLength(G4double truePathLength);
+
+  G4double ComputeTrueStepLength(G4double geomStepLength);
+
+  G4double ComputeTheta0(G4double truePathLength,
+                         G4double KineticEnergy);
+
+private:
+
+  G4double SimpleScattering(G4double xmeanth, G4double x2meanth);
+
+  G4double SampleCosineTheta(G4double trueStepLength, G4double KineticEnergy);
+
+  G4double SampleDisplacement();
+
+  G4double LatCorrelation();
+
+  inline G4double GetLambda(G4double kinEnergy);
+
+  inline void SetParticle(const G4ParticleDefinition*);
+
+  inline void UpdateCache();
+
+  //  hide assignment operator
+  G4UrbanMscModel92 & operator=(const  G4UrbanMscModel92 &right);
+  G4UrbanMscModel92(const  G4UrbanMscModel92&);
+
+  const G4ParticleDefinition* particle;
+  G4ParticleChangeForMSC*     fParticleChange;
+
+  G4PhysicsTable*             theLambdaTable;
+  const G4MaterialCutsCouple* couple;
+  G4LossTableManager*         theManager;
+
+  G4double mass;
+  G4double charge,ChargeSquare;
+  G4double masslimite,lambdalimit,fr;
+
+  G4double taubig;
+  G4double tausmall;
+  G4double taulim;
+  G4double currentTau;
+  G4double tlimit;
+  G4double tlimitmin;
+  G4double tlimitminfix;
+  G4double tgeom;
+
+  G4double geombig;
+  G4double geommin;
+  G4double geomlimit;
+  G4double skindepth;
+  G4double smallstep;
+
+  G4double presafety;
+
+  G4double lambda0;
+  G4double lambdaeff;
+  G4double tPathLength;
+  G4double zPathLength;
+  G4double par1,par2,par3;
+
+  G4double stepmin;
+
+  G4double currentKinEnergy;
+  G4double currentRange; 
+  G4double rangeinit;
+  G4double currentRadLength;
+
+  G4double theta0max,rellossmax;
+  G4double third;
+
+  G4int    currentMaterialIndex;
+
+  G4double y;
+  G4double Zold;
+  G4double Zeff,Z2,Z23,lnZ;
+  G4double coeffth1,coeffth2;
+  G4double coeffc1,coeffc2;
+  G4double scr1ini,scr2ini,scr1,scr2;
+
+  G4bool   isInitialized;
+  G4bool   inside;
+  G4bool   insideskin;
+};
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+inline
+G4double G4UrbanMscModel92::GetLambda(G4double e)
+{
+  G4double x;
+  if(theLambdaTable) {
+    G4bool b;
+    x = ((*theLambdaTable)[currentMaterialIndex])->GetValue(e, b);
+  } else {
+    x = CrossSection(couple,particle,e);
+  }
+  if(x > DBL_MIN) x = 1./x;
+  else            x = DBL_MAX;
+  return x;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+inline
+void G4UrbanMscModel92::SetParticle(const G4ParticleDefinition* p)
+{
+  if (p != particle) {
+    particle = p;
+    mass = p->GetPDGMass();
+    charge = p->GetPDGCharge()/eplus;
+    ChargeSquare = charge*charge;
+  }
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+inline
+void G4UrbanMscModel92::UpdateCache()                                   
+{
+    lnZ = std::log(Zeff);
+    coeffth1 = 0.885+lnZ*(0.104-0.0170*lnZ);
+    coeffth2 = 0.028+lnZ*(0.012-0.00125*lnZ);
+    coeffc1  = 2.134-lnZ*(0.1045-0.00602*lnZ);
+    coeffc2  = 0.001126-lnZ*(0.0001089+0.0000247*lnZ);
+    Z2 = Zeff*Zeff;
+    Z23 = std::exp(2.*lnZ/3.);
+    scr1     = scr1ini*Z23;
+    scr2     = scr2ini*Z2*ChargeSquare;
+  //  lastMaterial = couple->GetMaterial();
+    Zold = Zeff;
+}
+
+#endif
+
Index: trunk/source/processes/electromagnetic/standard/include/G4UrbanMscModel93.hh
===================================================================
--- trunk/source/processes/electromagnetic/standard/include/G4UrbanMscModel93.hh	(revision 1197)
+++ trunk/source/processes/electromagnetic/standard/include/G4UrbanMscModel93.hh	(revision 1197)
@@ -0,0 +1,235 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4UrbanMscModel93.hh,v 1.1 2009/11/01 13:04:12 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
+//
+// -------------------------------------------------------------------
+//
+//
+// GEANT4 Class header file
+//
+//
+// File name:     G4UrbanMscModel93
+//
+// Author:        Laszlo Urban
+//
+// Creation date: 06.03.2008
+//
+// Modifications:
+// 23-04-2009 L.Urban updated parameterization in UpdateCache method
+// 28-10-2009 V.Ivanchenko moved G4UrbanMscModel2 to G4UrbanMscModel93, 
+//            now it is a frozen version of the Urban model corresponding 
+//            to g4 9.3
+//
+//
+// Class Description:
+//
+// Implementation of the model of multiple scattering based on
+// H.W.Lewis Phys Rev 78 (1950) 526 and L.Urban model
+
+// -------------------------------------------------------------------
+//
+
+#ifndef G4UrbanMscModel93_h
+#define G4UrbanMscModel93_h 1
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+#include "G4VMscModel.hh"
+#include "G4PhysicsTable.hh"
+#include "G4MscStepLimitType.hh"
+
+class G4ParticleChangeForMSC;
+class G4SafetyHelper;
+class G4LossTableManager;
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+class G4UrbanMscModel93 : public G4VMscModel
+{
+
+public:
+
+  G4UrbanMscModel93(const G4String& nam = "UrbanMsc93");
+
+  virtual ~G4UrbanMscModel93();
+
+  void Initialise(const G4ParticleDefinition*, const G4DataVector&);
+
+  G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition* particle,
+				      G4double KineticEnergy,
+				      G4double AtomicNumber,
+				      G4double AtomicWeight=0., 
+				      G4double cut =0.,
+				      G4double emax=DBL_MAX);
+
+  void SampleScattering(const G4DynamicParticle*,
+			G4double safety);
+
+  G4double ComputeTruePathLengthLimit(const G4Track& track,
+				      G4PhysicsTable* theLambdaTable,
+				      G4double currentMinimalStep);
+
+  G4double ComputeGeomPathLength(G4double truePathLength);
+
+  G4double ComputeTrueStepLength(G4double geomStepLength);
+
+  G4double ComputeTheta0(G4double truePathLength,
+                         G4double KineticEnergy);
+
+private:
+
+  G4double SimpleScattering(G4double xmeanth, G4double x2meanth);
+
+  G4double SampleCosineTheta(G4double trueStepLength, G4double KineticEnergy);
+
+  G4double SampleDisplacement();
+
+  G4double LatCorrelation();
+
+  inline G4double GetLambda(G4double kinEnergy);
+
+  inline void SetParticle(const G4ParticleDefinition*);
+
+  inline void UpdateCache();
+
+  //  hide assignment operator
+  G4UrbanMscModel93 & operator=(const  G4UrbanMscModel93 &right);
+  G4UrbanMscModel93(const  G4UrbanMscModel93&);
+
+  const G4ParticleDefinition* particle;
+  G4ParticleChangeForMSC*     fParticleChange;
+
+  G4PhysicsTable*             theLambdaTable;
+  const G4MaterialCutsCouple* couple;
+  G4LossTableManager*         theManager;
+
+  G4double mass;
+  G4double charge,ChargeSquare;
+  G4double masslimite,lambdalimit,fr;
+
+  G4double taubig;
+  G4double tausmall;
+  G4double taulim;
+  G4double currentTau;
+  G4double tlimit;
+  G4double tlimitmin;
+  G4double tlimitminfix;
+  G4double tgeom;
+
+  G4double geombig;
+  G4double geommin;
+  G4double geomlimit;
+  G4double skindepth;
+  G4double smallstep;
+
+  G4double presafety;
+
+  G4double lambda0;
+  G4double lambdaeff;
+  G4double tPathLength;
+  G4double zPathLength;
+  G4double par1,par2,par3;
+
+  G4double stepmin;
+
+  G4double currentKinEnergy;
+  G4double currentRange; 
+  G4double rangeinit;
+  G4double currentRadLength;
+
+  G4double theta0max,rellossmax;
+  G4double third;
+
+  G4int    currentMaterialIndex;
+
+  G4double y;
+  G4double Zold;
+  G4double Zeff,Z2,Z23,lnZ;
+  G4double coeffth1,coeffth2;
+  G4double coeffc1,coeffc2;
+  G4double scr1ini,scr2ini,scr1,scr2;
+
+  G4bool   isInitialized;
+  G4bool   inside;
+  G4bool   insideskin;
+};
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+inline
+G4double G4UrbanMscModel93::GetLambda(G4double e)
+{
+  G4double x;
+  if(theLambdaTable) {
+    G4bool b;
+    x = ((*theLambdaTable)[currentMaterialIndex])->GetValue(e, b);
+  } else {
+    x = CrossSection(couple,particle,e);
+  }
+  if(x > DBL_MIN) x = 1./x;
+  else            x = DBL_MAX;
+  return x;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+inline
+void G4UrbanMscModel93::SetParticle(const G4ParticleDefinition* p)
+{
+  if (p != particle) {
+    particle = p;
+    mass = p->GetPDGMass();
+    charge = p->GetPDGCharge()/eplus;
+    ChargeSquare = charge*charge;
+  }
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+inline
+void G4UrbanMscModel93::UpdateCache()                                   
+{
+    lnZ = std::log(Zeff);
+    //new correction in theta0 formula
+    coeffth1 = (1.-8.7780e-2/Zeff)*(0.87+0.03*lnZ);                   
+    coeffth2 = (4.0780e-2+1.7315e-4*Zeff)*(0.87+0.03*lnZ);              
+    // tail parameters
+    G4double lnZ1 = std::log(Zeff+1.);
+    coeffc1  = 2.943-0.197*lnZ1;                  
+    coeffc2  = 0.0987-0.0143*lnZ1;                              
+    // for single scattering
+    Z2 = Zeff*Zeff;
+    Z23 = std::exp(2.*lnZ/3.);
+    scr1     = scr1ini*Z23;
+    scr2     = scr2ini*Z2*ChargeSquare;
+                                              
+    Zold = Zeff;
+}
+
+#endif
+
Index: trunk/source/processes/electromagnetic/standard/include/G4alphaIonisation.hh
===================================================================
--- trunk/source/processes/electromagnetic/standard/include/G4alphaIonisation.hh	(revision 1197)
+++ trunk/source/processes/electromagnetic/standard/include/G4alphaIonisation.hh	(revision 1197)
@@ -0,0 +1,127 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4alphaIonisation.hh,v 1.1 2009/11/10 11:50:30 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
+//
+// -------------------------------------------------------------------
+//
+// GEANT4 Class header file
+//
+//
+// File name:     G4alphaIonisation
+//
+// Author:        Vladimir Ivanchenko
+//
+// Creation date: 28.10.2009
+//
+// Modifications:
+//
+//
+// Class Description:
+//
+// This class manages the ionisation process for He ions. Effective charge,
+// nuclear stopping power, energy loss corrections are taken into account.
+// It inherites from G4VEnergyLossLoss.
+//
+
+// -------------------------------------------------------------------
+//
+
+#ifndef G4alphaIonisation_h
+#define G4alphaIonisation_h 1
+
+#include "G4VEnergyLossProcess.hh"
+
+class G4Material;
+
+class G4alphaIonisation : public G4VEnergyLossProcess
+{
+public:
+
+  G4alphaIonisation(const G4String& name = "alphaIoni");
+
+  virtual ~G4alphaIonisation();
+
+  virtual G4bool IsApplicable(const G4ParticleDefinition& p);
+
+  // Print out of the class parameters
+  virtual void PrintInfo();
+
+  void ActivateNuclearStopping(G4bool);
+
+protected:
+
+  virtual void InitialiseEnergyLossProcess(const G4ParticleDefinition*,
+					   const G4ParticleDefinition*);
+
+  virtual G4double MinPrimaryEnergy(const G4ParticleDefinition* p,
+				   const G4Material*, G4double cut);
+
+  inline G4double BetheBlochEnergyThreshold();
+
+  inline G4bool NuclearStoppingFlag();
+
+private:
+
+  // hide assignment operator
+  G4alphaIonisation & operator=(const G4alphaIonisation &right);
+  G4alphaIonisation(const G4alphaIonisation&);
+
+  const G4ParticleDefinition* theParticle;
+
+  G4double   mass;
+  G4double   ratio;
+  G4double   eth;
+
+  G4bool     isInitialised;
+  G4bool     nuclearStopping;
+};
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline void G4alphaIonisation::ActivateNuclearStopping(G4bool val)
+{
+  nuclearStopping = val;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4double G4alphaIonisation::BetheBlochEnergyThreshold()
+{
+  return eth;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+inline G4bool G4alphaIonisation::NuclearStoppingFlag()
+{
+  return nuclearStopping;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+#endif
Index: trunk/source/processes/electromagnetic/standard/src/G4ICRU49NuclearStoppingModel.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4ICRU49NuclearStoppingModel.cc	(revision 1197)
+++ trunk/source/processes/electromagnetic/standard/src/G4ICRU49NuclearStoppingModel.cc	(revision 1197)
@@ -0,0 +1,311 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4ICRU49NuclearStoppingModel.cc,v 1.2 2009/11/10 19:25:47 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
+//
+// -------------------------------------------------------------------
+//
+// GEANT4 Class file
+//
+//
+// File name:   G4ICRU49NuclearStoppingModel
+//
+// Author:      V.Ivanchenko 
+//
+// Creation date: 09.04.2008 from G4MuMscModel
+//
+// Modifications:
+//
+//
+// Class Description:
+//
+// Implementation of the model of ICRU'49 nuclear stopping
+
+// -------------------------------------------------------------------
+//
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+#include "G4ICRU49NuclearStoppingModel.hh"
+#include "Randomize.hh"
+#include "G4LossTableManager.hh"
+#include "G4ParticleChangeForLoss.hh"
+#include "G4ElementVector.hh"
+#include "G4ProductionCutsTable.hh"
+#include "G4Step.hh"
+#include "G4Pow.hh"
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+G4double G4ICRU49NuclearStoppingModel::ad[] = {0.0};
+G4double G4ICRU49NuclearStoppingModel::ed[] = {0.0};
+
+using namespace std;
+
+G4ICRU49NuclearStoppingModel::G4ICRU49NuclearStoppingModel(const G4String& nam) 
+  : G4VEmModel(nam),lossFlucFlag(false)
+{
+  theZieglerFactor = eV*cm2*1.0e-15;
+  g4pow = G4Pow::GetInstance();
+  if(ad[0] == 0.0) InitialiseNuclearStopping();
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+G4ICRU49NuclearStoppingModel::~G4ICRU49NuclearStoppingModel()
+{}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+void G4ICRU49NuclearStoppingModel::Initialise(const G4ParticleDefinition*, 
+					      const G4DataVector&)
+{}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+void 
+G4ICRU49NuclearStoppingModel::SampleSecondaries(std::vector<G4DynamicParticle*>*,
+						const G4MaterialCutsCouple*,
+						const G4DynamicParticle*,
+						G4double, G4double)
+{}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+G4double 
+G4ICRU49NuclearStoppingModel::ComputeDEDXPerVolume(const G4Material* mat,
+						   const G4ParticleDefinition* p,
+						   G4double kinEnergy,
+						   G4double)
+{
+  G4double nloss = 0.0;
+  if(kinEnergy <= 0.0) return nloss; 
+
+  // projectile
+  G4double m1 = p->GetPDGMass();
+  G4double z1 = std::fabs(p->GetPDGCharge()/eplus);
+
+  if(kinEnergy*proton_mass_c2/m1 > z1*z1*100.*MeV) return nloss;
+
+  // Projectile nucleus
+  m1 /= amu_c2;
+
+  //  loop for the elements in the material
+  G4int numberOfElements = mat->GetNumberOfElements();
+  const G4ElementVector* theElementVector = mat->GetElementVector();
+  const G4double* atomDensity  = mat->GetAtomicNumDensityVector();
+ 
+  for (G4int iel=0; iel<numberOfElements; iel++) {
+    const G4Element* element = (*theElementVector)[iel] ;
+    G4double z2 = element->GetZ();
+    G4double m2 = element->GetA()*mole/g ;
+    nloss += (NuclearStoppingPower(kinEnergy, z1, z2, m1, m2))
+           * atomDensity[iel] ;
+  }
+  nloss *= theZieglerFactor;
+  return nloss;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+G4double 
+G4ICRU49NuclearStoppingModel::NuclearStoppingPower(G4double kineticEnergy,
+						   G4double z1, G4double z2,
+						   G4double m1, G4double m2)
+{
+  G4double energy = kineticEnergy/keV ;  // energy in keV
+  G4double nloss = 0.0;
+  G4double z12 = z1*z2;
+  G4int iz1 = G4int(z1);
+  G4int iz2 = G4int(z2);
+  
+  G4double rm;
+  if(iz1 > 1) rm = (m1 + m2) * ( g4pow->Z23(iz1) + g4pow->Z23(iz2) );
+  else        rm = (m1 + m2) * g4pow->Z13(iz2);
+
+  G4double er = 32.536 * m2 * energy / ( z12 * rm ) ;  // reduced energy
+
+  if (er >= ed[0]) nloss = ad[0];
+  else {
+    // the table is inverse in energy
+    for (G4int i=102; i>=0; --i)
+    {
+      if (er <= ed[i]) {
+	nloss = (ad[i] - ad[i+1])*(er - ed[i+1])/(ed[i] - ed[i+1]) + ad[i+1];
+	break;
+      }
+    }
+  }
+
+  // Stragling
+  if(lossFlucFlag) {
+    //    G4double sig = 4.0 * m1 * m2 / ((m1 + m2)*(m1 + m2)*
+    //              (4.0 + 0.197*std::pow(er,-1.6991)+6.584*std::pow(er,-1.0494))) ;
+    G4double sig = 4.0 * m1 * m2 / ((m1 + m2)*(m1 + m2)*
+				    (4.0 + 0.197/(er*er) + 6.584/er));
+
+    nloss *= G4RandGauss::shoot(1.0,sig) ;
+    lossFlucFlag = false;
+  }
+   
+  nloss *= 8.462 * z12 * m1 / rm ; // Return to [ev/(10^15 atoms/cm^2]
+
+  if ( nloss < 0.0) nloss = 0.0 ;
+
+  return nloss;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+void G4ICRU49NuclearStoppingModel::InitialiseNuclearStopping()
+{
+  const G4double nuca[104][2] = {
+  { 1.0E+8, 5.831E-8},
+  { 8.0E+7, 7.288E-8},
+  { 6.0E+7, 9.719E-8},
+  { 5.0E+7, 1.166E-7},
+  { 4.0E+7, 1.457E-7},
+  { 3.0E+7, 1.942E-7},
+  { 2.0E+7, 2.916E-7},
+  { 1.5E+7, 3.887E-7},
+
+  { 1.0E+7, 5.833E-7},
+  { 8.0E+6, 7.287E-7},
+  { 6.0E+6, 9.712E-7},
+  { 5.0E+6, 1.166E-6},
+  { 4.0E+6, 1.457E-6},
+  { 3.0E+6, 1.941E-6},
+  { 2.0E+6, 2.911E-6},
+  { 1.5E+6, 3.878E-6},
+
+  { 1.0E+6, 5.810E-6},
+  { 8.0E+5, 7.262E-6},
+  { 6.0E+5, 9.663E-6},
+  { 5.0E+5, 1.157E-5},
+  { 4.0E+5, 1.442E-5},
+  { 3.0E+5, 1.913E-5},
+  { 2.0E+5, 2.845E-5},
+  { 1.5E+5, 3.762E-5},
+
+  { 1.0E+5, 5.554E-5},
+  { 8.0E+4, 6.866E-5},
+  { 6.0E+4, 9.020E-5},
+  { 5.0E+4, 1.070E-4},
+  { 4.0E+4, 1.319E-4},
+  { 3.0E+4, 1.722E-4},
+  { 2.0E+4, 2.499E-4},
+  { 1.5E+4, 3.248E-4},
+
+  { 1.0E+4, 4.688E-4},
+  { 8.0E+3, 5.729E-4},
+  { 6.0E+3, 7.411E-4},
+  { 5.0E+3, 8.718E-4},
+  { 4.0E+3, 1.063E-3},
+  { 3.0E+3, 1.370E-3},
+  { 2.0E+3, 1.955E-3},
+  { 1.5E+3, 2.511E-3},
+
+  { 1.0E+3, 3.563E-3},
+  { 8.0E+2, 4.314E-3},
+  { 6.0E+2, 5.511E-3},
+  { 5.0E+2, 6.430E-3},
+  { 4.0E+2, 7.756E-3},
+  { 3.0E+2, 9.855E-3},
+  { 2.0E+2, 1.375E-2},
+  { 1.5E+2, 1.736E-2},
+
+  { 1.0E+2, 2.395E-2},
+  { 8.0E+1, 2.850E-2},
+  { 6.0E+1, 3.552E-2},
+  { 5.0E+1, 4.073E-2},
+  { 4.0E+1, 4.802E-2},
+  { 3.0E+1, 5.904E-2},
+  { 1.5E+1, 9.426E-2},
+
+  { 1.0E+1, 1.210E-1},
+  { 8.0E+0, 1.377E-1},
+  { 6.0E+0, 1.611E-1},
+  { 5.0E+0, 1.768E-1},
+  { 4.0E+0, 1.968E-1},
+  { 3.0E+0, 2.235E-1},
+  { 2.0E+0, 2.613E-1},
+  { 1.5E+0, 2.871E-1},
+
+  { 1.0E+0, 3.199E-1},
+  { 8.0E-1, 3.354E-1},
+  { 6.0E-1, 3.523E-1},
+  { 5.0E-1, 3.609E-1},
+  { 4.0E-1, 3.693E-1},
+  { 3.0E-1, 3.766E-1},
+  { 2.0E-1, 3.803E-1},
+  { 1.5E-1, 3.788E-1},
+
+  { 1.0E-1, 3.711E-1},
+  { 8.0E-2, 3.644E-1},
+  { 6.0E-2, 3.530E-1},
+  { 5.0E-2, 3.444E-1},
+  { 4.0E-2, 3.323E-1},
+  { 3.0E-2, 3.144E-1},
+  { 2.0E-2, 2.854E-1},
+  { 1.5E-2, 2.629E-1},
+
+  { 1.0E-2, 2.298E-1},
+  { 8.0E-3, 2.115E-1},
+  { 6.0E-3, 1.883E-1},
+  { 5.0E-3, 1.741E-1},
+  { 4.0E-3, 1.574E-1},
+  { 3.0E-3, 1.372E-1},
+  { 2.0E-3, 1.116E-1},
+  { 1.5E-3, 9.559E-2},
+
+  { 1.0E-3, 7.601E-2},
+  { 8.0E-4, 6.668E-2},
+  { 6.0E-4, 5.605E-2},
+  { 5.0E-4, 5.008E-2},
+  { 4.0E-4, 4.352E-2},
+  { 3.0E-4, 3.617E-2},
+  { 2.0E-4, 2.768E-2},
+  { 1.5E-4, 2.279E-2},
+
+  { 1.0E-4, 1.723E-2},
+  { 8.0E-5, 1.473E-2},
+  { 6.0E-5, 1.200E-2},
+  { 5.0E-5, 1.052E-2},
+  { 4.0E-5, 8.950E-3},
+  { 3.0E-5, 7.246E-3},
+  { 2.0E-5, 5.358E-3},
+  { 1.5E-5, 4.313E-3},
+  { 0.0, 3.166E-3}
+  };
+
+  for(G4int i=0; i<104; ++i) {
+    ed[i] = nuca[i][0];
+    ad[i] = nuca[i][1];
+  }
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Index: trunk/source/processes/electromagnetic/standard/src/G4LindhardPartition.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4LindhardPartition.cc	(revision 1197)
+++ trunk/source/processes/electromagnetic/standard/src/G4LindhardPartition.cc	(revision 1197)
@@ -0,0 +1,100 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4LindhardPartition.cc,v 1.1 2009/11/05 11:42:24 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
+//
+
+/*
+ *  G4LindhardPartition.cc
+ *
+ *  Created by Marcus Mendenhall on 1/14/08.
+ *  Copyright 2008 Vanderbilt University, Nashville, TN, USA. All rights reserved.
+ *
+ */
+
+#include "G4LindhardPartition.hh"
+#include "G4Material.hh"
+#include "G4Element.hh"
+
+/*
+for a first cut, we will compute NIEL from a Lindhard-Robinson partition
+based on the most abundant element in the material.
+
+this is from IEEE Trans. Nucl Science Vol. 48 No.1 February 2001 page 162++
+Insoo Jun, "Effects of Secondary Particles on the Total Dose..."
+and, by reference,
+Lindhard, Nielsen, Scharff & Thompson, 
+"Integral Equations Governing Radiation Efects...", 
+Mat. Fys. Medd. Dan. Vid. Selsk. vol 33 #10, pp1-42, 1963
+and
+Robinson, "The dependence of radiation effects on primary recoil energy",
+in Proc. Int. Conf. Radiation-Induced Voids in Metal,  
+Albany, NY 1972 pp. 397-439
+def lindhard_robinson(z1, a1, z2, a2, ke):
+el=30.724*z1*z2*math.sqrt(z1**0.6667+z2**0.6667)*(a1+a2)/a2
+fl=0.0793*z1**0.6667*math.sqrt(z2)*(a1+a2)**1.5/
+((z1**0.6667+z2**0.6667)**0.75*a1**1.5*math.sqrt(a2))
+eps=ke*(1.0/el)
+return 1.0/(1+fl*(3.4008*eps**0.16667+0.40244*eps**0.75+eps))
+*/
+
+G4LindhardRobinsonPartition::G4LindhardRobinsonPartition() 
+{
+  max_z = 120;
+  for(size_t i=1; i<max_z; i++) {z23[i]=std::pow((G4double)i, 2./3.);}
+}
+
+G4double G4LindhardRobinsonPartition::PartitionNIEL(
+   G4int z1, G4double a1, const G4Material *material, G4double energy) const
+{
+  size_t nMatElements = material->GetNumberOfElements();
+	
+  const G4double *atomDensities=material->GetVecNbOfAtomsPerVolume();
+  G4double maxdens=0.0;
+  size_t maxindex=0;
+  for (size_t k=0 ; k < nMatElements ; k++ )
+    {
+      if(atomDensities[k] > maxdens) {
+	maxdens=atomDensities[k];
+	maxindex=k;
+      }
+    }
+  const G4Element *element=material->GetElement(maxindex);
+
+  G4int z2=G4int(element->GetZ());
+	
+  G4double a2=element->GetA()/(Avogadro*amu);
+	
+  G4double zpow=z23[z1]+z23[z2];
+  G4double asum=a1+a2;
+	
+  G4double el=30.724*z1*z2*std::sqrt(zpow)*asum/a2;
+  G4double fl=0.0793*z23[z1]*std::sqrt(z2*asum*asum*asum/(a1*a1*a1*a2))/std::pow(zpow, 0.75);
+  G4double eps=(energy/eV)*(1.0/el);
+
+  return 1.0/(1+fl*(3.4008*std::pow(eps, 0.16667)+0.40244*std::pow(eps, 0.75)+eps));
+}
+
Index: trunk/source/processes/electromagnetic/standard/src/G4NuclearStopping.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4NuclearStopping.cc	(revision 1197)
+++ trunk/source/processes/electromagnetic/standard/src/G4NuclearStopping.cc	(revision 1197)
@@ -0,0 +1,142 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4NuclearStopping.cc,v 1.2 2009/11/10 19:25:47 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
+//
+// -----------------------------------------------------------------------------
+//
+// GEANT4 Class file
+//
+// File name:     G4NuclearStopping
+//
+// Author:        Vladimir Ivanchenko
+//
+// Creation date: 20 July 2009
+// 
+// Modified:
+//
+// -----------------------------------------------------------------------------
+//
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+#include "G4NuclearStopping.hh"
+#include "G4ICRU49NuclearStoppingModel.hh"
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+using namespace std;
+
+G4NuclearStopping::G4NuclearStopping(const G4String& processName)
+  : G4VEmProcess(processName)
+{
+  isInitialized = false;  
+  SetProcessSubType(fCoulombScattering);
+  enableAlongStepDoIt = true; 
+  modelICRU49 = 0;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+G4NuclearStopping::~G4NuclearStopping()
+{
+  delete modelICRU49;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+G4bool G4NuclearStopping::IsApplicable (const G4ParticleDefinition& p)
+{
+  return (p.GetPDGCharge() != 0.0 && !p.IsShortLived());
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+void G4NuclearStopping::InitialiseProcess(const G4ParticleDefinition*)
+{
+  if(!isInitialized) {
+    isInitialized = true;
+    SetBuildTableFlag(false);
+    //    SetSecondaryParticle(G4Electron::Electron());
+    if(!Model()) {
+      modelICRU49 = new G4ICRU49NuclearStoppingModel();
+      SetModel(modelICRU49);
+    }
+    AddEmModel(1, Model());
+    Model()->SetParticleChange(&nParticleChange);
+  }
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+G4double 
+G4NuclearStopping::AlongStepGetPhysicalInteractionLength(
+     const G4Track&, G4double, G4double, G4double&, G4GPILSelection* selection)
+{
+  *selection = NotCandidateForSelection;
+  return DBL_MAX;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+G4VParticleChange* G4NuclearStopping::AlongStepDoIt(const G4Track& track,
+						    const G4Step&  step)
+{
+  nParticleChange.InitializeForAlongStep(track);
+  G4double length = step.GetStepLength();
+  if(length > 0.0) {
+
+    G4double T1 = step.GetPreStepPoint()->GetKineticEnergy();
+    G4double T2 = step.GetPostStepPoint()->GetKineticEnergy();
+    if(T2 > 0.0) {
+
+      // primary
+      G4double T = 0.5*(T1 + T2);
+      const G4ParticleDefinition* part = track.GetDefinition();
+      const G4MaterialCutsCouple* couple = track.GetMaterialCutsCouple(); 
+      G4VEmModel* mod = SelectModel(T, couple->GetIndex());
+
+      // sample stopping
+      if(modelICRU49) modelICRU49->SetFluctuationFlag(true);
+      G4double nloss = 
+	length*mod->ComputeDEDXPerVolume(couple->GetMaterial(), part, T);
+      if(nloss > T1) nloss = T1;
+      nParticleChange.SetProposedKineticEnergy(T1 - nloss);
+      nParticleChange.ProposeLocalEnergyDeposit(nloss);
+      nParticleChange.ProposeNonIonizingEnergyDeposit(nloss);
+      if(modelICRU49) modelICRU49->SetFluctuationFlag(false);
+    }
+  }
+  return &nParticleChange;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+void G4NuclearStopping::PrintInfo()
+{}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
Index: trunk/source/processes/electromagnetic/standard/src/G4UrbanMscModel92.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4UrbanMscModel92.cc	(revision 1197)
+++ trunk/source/processes/electromagnetic/standard/src/G4UrbanMscModel92.cc	(revision 1197)
@@ -0,0 +1,1056 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4UrbanMscModel92.cc,v 1.1 2009/11/01 13:05:01 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
+//
+// -------------------------------------------------------------------
+//
+// GEANT4 Class file
+//
+//
+// File name:   G4UrbanMscModel92
+//
+// Author:      Laszlo Urban
+//
+// Creation date: 06.03.2008
+//
+// Modifications:
+//
+// 06-03-2008 starting point : G4UrbanMscModel2 = G4UrbanMscModel 9.1 ref 02
+//
+// 13-03-08  Bug in SampleScattering (which caused lateral asymmetry) fixed
+//           (L.Urban)
+//
+// 14-03-08  Simplification of step limitation in ComputeTruePathLengthLimit,
+//           + tlimitmin is the same for UseDistancetoBoundary and
+//           UseSafety (L.Urban)           
+//
+// 16-03-08  Reorganization of SampleCosineTheta + new method SimpleScattering
+//           SimpleScattering is used if the relative energy loss is too big
+//           or theta0 is too big (see data members rellossmax, theta0max)
+//           (L.Urban)          
+//
+// 17-03-08  tuning of the correction factor in ComputeTheta0 (L.Urban)
+//
+// 19-03-08  exponent c of the 'tail' model function is not equal to 2 any more,
+//           value of c has been extracted from some e- scattering data (L.Urban) 
+//
+// 24-03-08  Step limitation in ComputeTruePathLengthLimit has been
+//           simplified further + some data members have been removed (L.Urban)
+//
+// 24-07-08  central part of scattering angle (theta0) has been tuned
+//           tail of the scattering angle distribution has been tuned
+//           using some e- and proton scattering data
+//
+// 05-08-08  bugfix in ComputeTruePathLengthLimit (L.Urban)
+//
+// 09-10-08  theta0 and tail have been retuned using some e-,mu,proton
+//           scattering data (L.Urban)
+//           + single scattering without path length correction for
+//           small steps (t < tlimitmin, for UseDistanceToBoundary only)
+//
+// 15-10-08  Moliere-Bethe screening in the single scattering part(L.Urban)          
+//
+// 17-10-08  stepping similar to that in model (9.1) for UseSafety case
+//           for e+/e- in order to speed up the code for calorimeters
+//
+// 23-10-08  bugfix in the screeningparameter of the single scattering part,
+//           some technical change in order to speed up the code (UpdateCache)
+//
+// 27-10-08  bugfix in ComputeTruePathLengthLimit (affects UseDistanceToBoundary
+//           stepping type only) (L.Urban)          
+//
+// 28-10-09  V.Ivanchenko moved G4UrbanMscModel to G4UrbanMscModel92, 
+//           now it is a frozen version of the Urban model corresponding 
+//           to g4 9.2
+
+// Class Description:
+//
+// Implementation of the model of multiple scattering based on
+// H.W.Lewis Phys Rev 78 (1950) 526 and others
+
+// -------------------------------------------------------------------
+// In its present form the model can be  used for simulation 
+//   of the e-/e+, muon and charged hadron multiple scattering
+//
+
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+#include "G4UrbanMscModel92.hh"
+#include "Randomize.hh"
+#include "G4Electron.hh"
+#include "G4LossTableManager.hh"
+#include "G4ParticleChangeForMSC.hh"
+
+#include "G4Poisson.hh"
+#include "globals.hh"
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+using namespace std;
+
+G4UrbanMscModel92::G4UrbanMscModel92(const G4String& nam)
+  : G4VMscModel(nam),
+    isInitialized(false)
+{
+  masslimite    = 0.6*MeV;
+  lambdalimit   = 1.*mm;
+  fr            = 0.02;
+  //  facsafety     = 0.3;
+  taubig        = 8.0;
+  tausmall      = 1.e-16;
+  taulim        = 1.e-6;
+  currentTau    = taulim;
+  tlimitminfix  = 1.e-6*mm;            
+  stepmin       = tlimitminfix;
+  smallstep     = 1.e10;
+  currentRange  = 0. ;
+  rangeinit     = 0.;
+  tlimit        = 1.e10*mm;
+  tlimitmin     = 10.*tlimitminfix;            
+  tgeom         = 1.e50*mm;
+  geombig       = 1.e50*mm;
+  geommin       = 1.e-3*mm;
+  geomlimit     = geombig;
+  presafety     = 0.*mm;
+                          
+  y             = 0.;
+
+  Zold          = 0.;
+  Zeff          = 1.;
+  Z2            = 1.;                
+  Z23           = 1.;                    
+  lnZ           = 0.;
+  coeffth1      = 0.;
+  coeffth2      = 0.;
+  coeffc1       = 0.;
+  coeffc2       = 0.;
+  scr1ini       = fine_structure_const*fine_structure_const*
+                  electron_mass_c2*electron_mass_c2/(0.885*0.885*4.*pi);
+  scr2ini       = 3.76*fine_structure_const*fine_structure_const;
+  scr1          = 0.;
+  scr2          = 0.;
+
+  theta0max     = pi/6.;
+  rellossmax    = 0.50;
+  third         = 1./3.;
+  particle      = 0;
+  theManager    = G4LossTableManager::Instance(); 
+  inside        = false;  
+  insideskin    = false;
+
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+G4UrbanMscModel92::~G4UrbanMscModel92()
+{}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+void G4UrbanMscModel92::Initialise(const G4ParticleDefinition* p,
+				   const G4DataVector&)
+{
+  skindepth = skin*stepmin;
+  if(isInitialized) return;
+  // set values of some data members
+  SetParticle(p);
+
+  fParticleChange = GetParticleChangeForMSC();
+  InitialiseSafetyHelper();
+
+  isInitialized = true;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+G4double G4UrbanMscModel92::ComputeCrossSectionPerAtom( 
+                             const G4ParticleDefinition* part,
+                                   G4double KineticEnergy,
+                                   G4double AtomicNumber,G4double,
+				   G4double, G4double)
+{
+  const G4double sigmafactor = twopi*classic_electr_radius*classic_electr_radius;
+  const G4double epsfactor = 2.*electron_mass_c2*electron_mass_c2*
+                            Bohr_radius*Bohr_radius/(hbarc*hbarc);
+  const G4double epsmin = 1.e-4 , epsmax = 1.e10;
+
+  const G4double Zdat[15] = { 4.,  6., 13., 20., 26., 29., 32., 38., 47.,
+                             50., 56., 64., 74., 79., 82. };
+
+  const G4double Tdat[22] = { 100*eV,  200*eV,  400*eV,  700*eV,
+                               1*keV,   2*keV,   4*keV,   7*keV,
+			      10*keV,  20*keV,  40*keV,  70*keV,
+                             100*keV, 200*keV, 400*keV, 700*keV,
+                               1*MeV,   2*MeV,   4*MeV,   7*MeV,
+			      10*MeV,  20*MeV};
+
+  // corr. factors for e-/e+ lambda for T <= Tlim
+          G4double celectron[15][22] =
+          {{1.125,1.072,1.051,1.047,1.047,1.050,1.052,1.054,
+            1.054,1.057,1.062,1.069,1.075,1.090,1.105,1.111,
+            1.112,1.108,1.100,1.093,1.089,1.087            },
+           {1.408,1.246,1.143,1.096,1.077,1.059,1.053,1.051,
+            1.052,1.053,1.058,1.065,1.072,1.087,1.101,1.108,
+            1.109,1.105,1.097,1.090,1.086,1.082            },
+           {2.833,2.268,1.861,1.612,1.486,1.309,1.204,1.156,
+            1.136,1.114,1.106,1.106,1.109,1.119,1.129,1.132,
+            1.131,1.124,1.113,1.104,1.099,1.098            },
+           {3.879,3.016,2.380,2.007,1.818,1.535,1.340,1.236,
+            1.190,1.133,1.107,1.099,1.098,1.103,1.110,1.113,
+            1.112,1.105,1.096,1.089,1.085,1.098            },
+           {6.937,4.330,2.886,2.256,1.987,1.628,1.395,1.265,
+            1.203,1.122,1.080,1.065,1.061,1.063,1.070,1.073,
+            1.073,1.070,1.064,1.059,1.056,1.056            },
+           {9.616,5.708,3.424,2.551,2.204,1.762,1.485,1.330,
+            1.256,1.155,1.099,1.077,1.070,1.068,1.072,1.074,
+            1.074,1.070,1.063,1.059,1.056,1.052            },
+           {11.72,6.364,3.811,2.806,2.401,1.884,1.564,1.386,
+            1.300,1.180,1.112,1.082,1.073,1.066,1.068,1.069,
+            1.068,1.064,1.059,1.054,1.051,1.050            },
+           {18.08,8.601,4.569,3.183,2.662,2.025,1.646,1.439,
+            1.339,1.195,1.108,1.068,1.053,1.040,1.039,1.039,
+            1.039,1.037,1.034,1.031,1.030,1.036            },
+           {18.22,10.48,5.333,3.713,3.115,2.367,1.898,1.631,
+            1.498,1.301,1.171,1.105,1.077,1.048,1.036,1.033,
+            1.031,1.028,1.024,1.022,1.021,1.024            },
+           {14.14,10.65,5.710,3.929,3.266,2.453,1.951,1.669,
+            1.528,1.319,1.178,1.106,1.075,1.040,1.027,1.022,
+            1.020,1.017,1.015,1.013,1.013,1.020            },
+           {14.11,11.73,6.312,4.240,3.478,2.566,2.022,1.720,
+            1.569,1.342,1.186,1.102,1.065,1.022,1.003,0.997,
+            0.995,0.993,0.993,0.993,0.993,1.011            },
+           {22.76,20.01,8.835,5.287,4.144,2.901,2.219,1.855,
+            1.677,1.410,1.224,1.121,1.073,1.014,0.986,0.976,
+            0.974,0.972,0.973,0.974,0.975,0.987            },
+           {50.77,40.85,14.13,7.184,5.284,3.435,2.520,2.059,
+            1.837,1.512,1.283,1.153,1.091,1.010,0.969,0.954,
+            0.950,0.947,0.949,0.952,0.954,0.963            },
+           {65.87,59.06,15.87,7.570,5.567,3.650,2.682,2.182,
+            1.939,1.579,1.325,1.178,1.108,1.014,0.965,0.947,
+            0.941,0.938,0.940,0.944,0.946,0.954            },
+           {55.60,47.34,15.92,7.810,5.755,3.767,2.760,2.239,
+            1.985,1.609,1.343,1.188,1.113,1.013,0.960,0.939,
+            0.933,0.930,0.933,0.936,0.939,0.949            }};
+	    
+           G4double cpositron[15][22] = {
+           {2.589,2.044,1.658,1.446,1.347,1.217,1.144,1.110,
+            1.097,1.083,1.080,1.086,1.092,1.108,1.123,1.131,
+            1.131,1.126,1.117,1.108,1.103,1.100            },
+           {3.904,2.794,2.079,1.710,1.543,1.325,1.202,1.145,
+            1.122,1.096,1.089,1.092,1.098,1.114,1.130,1.137,
+            1.138,1.132,1.122,1.113,1.108,1.102            },
+           {7.970,6.080,4.442,3.398,2.872,2.127,1.672,1.451,
+            1.357,1.246,1.194,1.179,1.178,1.188,1.201,1.205,
+            1.203,1.190,1.173,1.159,1.151,1.145            },
+           {9.714,7.607,5.747,4.493,3.815,2.777,2.079,1.715,
+            1.553,1.353,1.253,1.219,1.211,1.214,1.225,1.228,
+            1.225,1.210,1.191,1.175,1.166,1.174            },
+           {17.97,12.95,8.628,6.065,4.849,3.222,2.275,1.820,
+            1.624,1.382,1.259,1.214,1.202,1.202,1.214,1.219,
+            1.217,1.203,1.184,1.169,1.160,1.151            },
+           {24.83,17.06,10.84,7.355,5.767,3.707,2.546,1.996,
+            1.759,1.465,1.311,1.252,1.234,1.228,1.238,1.241,
+            1.237,1.222,1.201,1.184,1.174,1.159            },
+           {23.26,17.15,11.52,8.049,6.375,4.114,2.792,2.155,
+            1.880,1.535,1.353,1.281,1.258,1.247,1.254,1.256,
+            1.252,1.234,1.212,1.194,1.183,1.170            },
+           {22.33,18.01,12.86,9.212,7.336,4.702,3.117,2.348,
+            2.015,1.602,1.385,1.297,1.268,1.251,1.256,1.258,
+            1.254,1.237,1.214,1.195,1.185,1.179            },
+           {33.91,24.13,15.71,10.80,8.507,5.467,3.692,2.808,
+            2.407,1.873,1.564,1.425,1.374,1.330,1.324,1.320,
+            1.312,1.288,1.258,1.235,1.221,1.205            },
+           {32.14,24.11,16.30,11.40,9.015,5.782,3.868,2.917,
+            2.490,1.925,1.596,1.447,1.391,1.342,1.332,1.327,
+            1.320,1.294,1.264,1.240,1.226,1.214            },
+           {29.51,24.07,17.19,12.28,9.766,6.238,4.112,3.066,
+            2.602,1.995,1.641,1.477,1.414,1.356,1.342,1.336,
+            1.328,1.302,1.270,1.245,1.231,1.233            },
+           {38.19,30.85,21.76,15.35,12.07,7.521,4.812,3.498,
+            2.926,2.188,1.763,1.563,1.484,1.405,1.382,1.371,
+            1.361,1.330,1.294,1.267,1.251,1.239            },
+           {49.71,39.80,27.96,19.63,15.36,9.407,5.863,4.155,
+            3.417,2.478,1.944,1.692,1.589,1.480,1.441,1.423,
+            1.409,1.372,1.330,1.298,1.280,1.258            },
+           {59.25,45.08,30.36,20.83,16.15,9.834,6.166,4.407,
+            3.641,2.648,2.064,1.779,1.661,1.531,1.482,1.459,
+            1.442,1.400,1.354,1.319,1.299,1.272            },
+           {56.38,44.29,30.50,21.18,16.51,10.11,6.354,4.542,
+            3.752,2.724,2.116,1.817,1.692,1.554,1.499,1.474,
+            1.456,1.412,1.364,1.328,1.307,1.282            }};
+
+  //data/corrections for T > Tlim  
+  G4double Tlim = 10.*MeV;
+  G4double beta2lim = Tlim*(Tlim+2.*electron_mass_c2)/
+                      ((Tlim+electron_mass_c2)*(Tlim+electron_mass_c2));
+  G4double bg2lim   = Tlim*(Tlim+2.*electron_mass_c2)/
+                      (electron_mass_c2*electron_mass_c2);
+
+  G4double sig0[15] = {0.2672*barn,  0.5922*barn, 2.653*barn,  6.235*barn,
+                      11.69*barn  , 13.24*barn  , 16.12*barn, 23.00*barn ,
+		      35.13*barn  , 39.95*barn  , 50.85*barn, 67.19*barn ,
+                      91.15*barn  , 104.4*barn  , 113.1*barn};
+		      		       
+  G4double hecorr[15] = {120.70, 117.50, 105.00, 92.92, 79.23,  74.510,  68.29,
+                          57.39,  41.97,  36.14, 24.53, 10.21,  -7.855, -16.84,
+			 -22.30};
+
+  G4double sigma;
+  SetParticle(part);
+
+  G4double Z23 = 2.*log(AtomicNumber)/3.; Z23 = exp(Z23);
+
+  // correction if particle .ne. e-/e+
+  // compute equivalent kinetic energy
+  // lambda depends on p*beta ....
+
+  G4double eKineticEnergy = KineticEnergy;
+
+  if(mass > electron_mass_c2)
+  {
+     G4double TAU = KineticEnergy/mass ;
+     G4double c = mass*TAU*(TAU+2.)/(electron_mass_c2*(TAU+1.)) ;
+     G4double w = c-2. ;
+     G4double tau = 0.5*(w+sqrt(w*w+4.*c)) ;
+     eKineticEnergy = electron_mass_c2*tau ;
+  }
+
+  G4double eTotalEnergy = eKineticEnergy + electron_mass_c2 ;
+  G4double beta2 = eKineticEnergy*(eTotalEnergy+electron_mass_c2)
+                                 /(eTotalEnergy*eTotalEnergy);
+  G4double bg2   = eKineticEnergy*(eTotalEnergy+electron_mass_c2)
+                                 /(electron_mass_c2*electron_mass_c2);
+
+  G4double eps = epsfactor*bg2/Z23;
+
+  if     (eps<epsmin)  sigma = 2.*eps*eps;
+  else if(eps<epsmax)  sigma = log(1.+2.*eps)-2.*eps/(1.+2.*eps);
+  else                 sigma = log(2.*eps)-1.+1./eps;
+
+  sigma *= ChargeSquare*AtomicNumber*AtomicNumber/(beta2*bg2);
+
+  // interpolate in AtomicNumber and beta2 
+  G4double c1,c2,cc1,cc2,corr;
+
+  // get bin number in Z
+  G4int iZ = 14;
+  while ((iZ>=0)&&(Zdat[iZ]>=AtomicNumber)) iZ -= 1;
+  if (iZ==14)                               iZ = 13;
+  if (iZ==-1)                               iZ = 0 ;
+
+  G4double Z1 = Zdat[iZ];
+  G4double Z2 = Zdat[iZ+1];
+  G4double ratZ = (AtomicNumber-Z1)*(AtomicNumber+Z1)/
+                  ((Z2-Z1)*(Z2+Z1));
+
+  if(eKineticEnergy <= Tlim) 
+  {
+    // get bin number in T (beta2)
+    G4int iT = 21;
+    while ((iT>=0)&&(Tdat[iT]>=eKineticEnergy)) iT -= 1;
+    if(iT==21)                                  iT = 20;
+    if(iT==-1)                                  iT = 0 ;
+
+    //  calculate betasquare values
+    G4double T = Tdat[iT],   E = T + electron_mass_c2;
+    G4double b2small = T*(E+electron_mass_c2)/(E*E);
+
+    T = Tdat[iT+1]; E = T + electron_mass_c2;
+    G4double b2big = T*(E+electron_mass_c2)/(E*E);
+    G4double ratb2 = (beta2-b2small)/(b2big-b2small);
+
+    if (charge < 0.)
+    {
+       c1 = celectron[iZ][iT];
+       c2 = celectron[iZ+1][iT];
+       cc1 = c1+ratZ*(c2-c1);
+
+       c1 = celectron[iZ][iT+1];
+       c2 = celectron[iZ+1][iT+1];
+       cc2 = c1+ratZ*(c2-c1);
+
+       corr = cc1+ratb2*(cc2-cc1);
+
+       sigma *= sigmafactor/corr;
+    }
+    else              
+    {
+       c1 = cpositron[iZ][iT];
+       c2 = cpositron[iZ+1][iT];
+       cc1 = c1+ratZ*(c2-c1);
+
+       c1 = cpositron[iZ][iT+1];
+       c2 = cpositron[iZ+1][iT+1];
+       cc2 = c1+ratZ*(c2-c1);
+
+       corr = cc1+ratb2*(cc2-cc1);
+
+       sigma *= sigmafactor/corr;
+    }
+  }
+  else
+  {
+    c1 = bg2lim*sig0[iZ]*(1.+hecorr[iZ]*(beta2-beta2lim))/bg2;
+    c2 = bg2lim*sig0[iZ+1]*(1.+hecorr[iZ+1]*(beta2-beta2lim))/bg2;
+    if((AtomicNumber >= Z1) && (AtomicNumber <= Z2))
+      sigma = c1+ratZ*(c2-c1) ;
+    else if(AtomicNumber < Z1)
+      sigma = AtomicNumber*AtomicNumber*c1/(Z1*Z1);
+    else if(AtomicNumber > Z2)
+      sigma = AtomicNumber*AtomicNumber*c2/(Z2*Z2);
+  }
+  return sigma;
+
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+G4double G4UrbanMscModel92::ComputeTruePathLengthLimit(
+                             const G4Track& track,
+			     G4PhysicsTable* theTable,
+			     G4double currentMinimalStep)
+{
+  tPathLength = currentMinimalStep;
+  G4StepPoint* sp = track.GetStep()->GetPreStepPoint();
+  G4StepStatus stepStatus = sp->GetStepStatus();
+
+  const G4DynamicParticle* dp = track.GetDynamicParticle();
+
+  if(stepStatus == fUndefined) {
+    inside = false;
+    insideskin = false;
+    tlimit = geombig;
+    SetParticle( dp->GetDefinition() );
+  }
+
+  theLambdaTable = theTable;
+  couple = track.GetMaterialCutsCouple();
+  currentMaterialIndex = couple->GetIndex();
+  currentKinEnergy = dp->GetKineticEnergy();
+  currentRange = 
+    theManager->GetRangeFromRestricteDEDX(particle,currentKinEnergy,couple);
+  lambda0 = GetLambda(currentKinEnergy);
+
+  // stop here if small range particle
+  if(inside) return tPathLength;            
+  
+  if(tPathLength > currentRange) tPathLength = currentRange;
+
+  presafety = sp->GetSafety();
+
+  //    G4cout << "G4UrbanMscModel92::ComputeTruePathLengthLimit tPathLength= " 
+  //	   <<tPathLength<<" safety= " << presafety
+  //	   << " range= " <<currentRange<<G4endl;
+
+  // far from geometry boundary
+  if(currentRange < presafety)
+    {
+      inside = true;
+      return tPathLength;  
+    }
+
+  // standard  version
+  //
+  if (steppingAlgorithm == fUseDistanceToBoundary)
+    {
+      //compute geomlimit and presafety 
+      G4double geomlimit = ComputeGeomLimit(track, presafety, currentRange);
+
+      // is it far from boundary ?
+      if(currentRange < presafety)
+	{
+	  inside = true;
+	  return tPathLength;   
+	}
+
+      smallstep += 1.;
+      insideskin = false;
+
+      if((stepStatus == fGeomBoundary) || (stepStatus == fUndefined))
+	{
+          rangeinit = currentRange;
+	  if(stepStatus == fUndefined) smallstep = 1.e10;
+	  else  smallstep = 1.;
+
+	  // constraint from the geometry 
+	  if((geomlimit < geombig) && (geomlimit > geommin))
+	    {
+	      if(stepStatus == fGeomBoundary)  
+	        tgeom = geomlimit/facgeom;
+	      else
+	        tgeom = 2.*geomlimit/facgeom;
+	    }
+            else
+              tgeom = geombig;
+
+          //define stepmin here (it depends on lambda!)
+          //rough estimation of lambda_elastic/lambda_transport
+          G4double rat = currentKinEnergy/MeV ;
+          rat = 1.e-3/(rat*(10.+rat)) ;
+          //stepmin ~ lambda_elastic
+          stepmin = rat*lambda0;
+          skindepth = skin*stepmin;
+
+          //define tlimitmin
+          tlimitmin = 10.*stepmin;
+          if(tlimitmin < tlimitminfix) tlimitmin = tlimitminfix;
+
+        }
+
+      //step limit 
+      tlimit = facrange*rangeinit;              
+      if(tlimit < facsafety*presafety)
+        tlimit = facsafety*presafety; 
+
+      //lower limit for tlimit
+      if(tlimit < tlimitmin) tlimit = tlimitmin;
+
+      if(tlimit > tgeom) tlimit = tgeom;
+
+      //  G4cout << "tgeom= " << tgeom << " geomlimit= " << geomlimit  
+      //     << " tlimit= " << tlimit << " presafety= " << presafety << G4endl;
+
+      // shortcut
+      if((tPathLength < tlimit) && (tPathLength < presafety) &&
+         (smallstep >= skin) && (tPathLength < geomlimit-0.999*skindepth))
+	return tPathLength;   
+
+      // step reduction near to boundary
+      if(smallstep < skin)
+	{
+	  tlimit = stepmin;
+	  insideskin = true;
+	}
+      else if(geomlimit < geombig)
+	{
+	  if(geomlimit > skindepth)
+	    {
+	      if(tlimit > geomlimit-0.999*skindepth)
+		tlimit = geomlimit-0.999*skindepth;
+	    }
+	  else
+	    {
+	      insideskin = true;
+	      if(tlimit > stepmin) tlimit = stepmin;
+	    }
+	}
+
+      if(tlimit < stepmin) tlimit = stepmin;
+
+      if(tPathLength > tlimit) tPathLength = tlimit  ; 
+
+    }
+    // for 'normal' simulation with or without magnetic field 
+    //  there no small step/single scattering at boundaries
+  else if(steppingAlgorithm == fUseSafety)
+    {
+      // compute presafety again if presafety <= 0 and no boundary
+      // i.e. when it is needed for optimization purposes
+      if((stepStatus != fGeomBoundary) && (presafety < tlimitminfix)) 
+	presafety = ComputeSafety(sp->GetPosition(),tPathLength); 
+
+      // is far from boundary
+      if(currentRange < presafety)
+        {
+          inside = true;
+          return tPathLength;  
+        }
+
+      if((stepStatus == fGeomBoundary) || (stepStatus == fUndefined))
+      {
+        rangeinit = currentRange;
+        fr = facrange;
+        // 9.1 like stepping for e+/e- only (not for muons,hadrons)
+        if(mass < masslimite) 
+        {
+          if(lambda0 > currentRange)
+            rangeinit = lambda0;
+          if(lambda0 > lambdalimit)
+            fr *= 0.75+0.25*lambda0/lambdalimit;
+        }
+
+        //lower limit for tlimit
+        G4double rat = currentKinEnergy/MeV ;
+        rat = 1.e-3/(rat*(10.+rat)) ;
+        tlimitmin = 10.*lambda0*rat;
+        if(tlimitmin < tlimitminfix) tlimitmin = tlimitminfix;
+      }
+      //step limit
+      tlimit = fr*rangeinit;               
+
+      if(tlimit < facsafety*presafety)
+        tlimit = facsafety*presafety;
+
+      //lower limit for tlimit
+      if(tlimit < tlimitmin) tlimit = tlimitmin;
+
+      if(tPathLength > tlimit) tPathLength = tlimit;
+    }
+  
+  // version similar to 7.1 (needed for some experiments)
+  else
+    {
+      if (stepStatus == fGeomBoundary)
+	{
+	  if (currentRange > lambda0) tlimit = facrange*currentRange;
+	  else                        tlimit = facrange*lambda0;
+
+	  if(tlimit < tlimitmin) tlimit = tlimitmin;
+	  if(tPathLength > tlimit) tPathLength = tlimit;
+	}
+    }
+  // G4cout << "tPathLength= " << tPathLength << "  geomlimit= " << geomlimit 
+  //	 << " currentMinimalStep= " << currentMinimalStep << G4endl;
+  return tPathLength ;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+G4double G4UrbanMscModel92::ComputeGeomPathLength(G4double)
+{
+  lambdaeff = lambda0;
+  par1 = -1. ;  
+  par2 = par3 = 0. ;  
+
+  //  do the true -> geom transformation
+  zPathLength = tPathLength;
+
+  // z = t for very small tPathLength
+  if(tPathLength < tlimitminfix) return zPathLength;
+
+  // this correction needed to run MSC with eIoni and eBrem inactivated
+  // and makes no harm for a normal run
+  if(tPathLength > currentRange)
+    tPathLength = currentRange ;
+
+  G4double tau   = tPathLength/lambda0 ;
+
+  if ((tau <= tausmall) || insideskin) {
+    zPathLength  = tPathLength;
+    if(zPathLength > lambda0) zPathLength = lambda0;
+    return zPathLength;
+  }
+
+  G4double zmean = tPathLength;
+  if (tPathLength < currentRange*dtrl) {
+    if(tau < taulim) zmean = tPathLength*(1.-0.5*tau) ;
+    else             zmean = lambda0*(1.-exp(-tau));
+  } else if(currentKinEnergy < mass)  {
+    par1 = 1./currentRange ;
+    par2 = 1./(par1*lambda0) ;
+    par3 = 1.+par2 ;
+    if(tPathLength < currentRange)
+      zmean = (1.-exp(par3*log(1.-tPathLength/currentRange)))/(par1*par3) ;
+    else
+      zmean = 1./(par1*par3) ;
+  } else {
+    G4double T1 = theManager->GetEnergy(particle,currentRange-tPathLength,couple);
+    G4double lambda1 = GetLambda(T1);
+
+    par1 = (lambda0-lambda1)/(lambda0*tPathLength) ;
+    par2 = 1./(par1*lambda0) ;
+    par3 = 1.+par2 ;
+    zmean = (1.-exp(par3*log(lambda1/lambda0)))/(par1*par3) ;
+  }
+
+  zPathLength = zmean ;
+
+  //  sample z
+  if(samplez)
+  {
+    const G4double  ztmax = 0.99 ;
+    G4double zt = zmean/tPathLength ;
+
+    if (tPathLength > stepmin && zt < ztmax)              
+    {
+      G4double u,cz1;
+      if(zt >= third)
+      {
+        G4double cz = 0.5*(3.*zt-1.)/(1.-zt) ;
+        cz1 = 1.+cz ;
+        G4double u0 = cz/cz1 ;
+        G4double grej ;
+        do {
+            u = exp(log(G4UniformRand())/cz1) ;
+            grej = exp(cz*log(u/u0))*(1.-u)/(1.-u0) ;
+           } while (grej < G4UniformRand()) ;
+      }
+      else
+      {
+        cz1 = 1./zt-1.;
+        u = 1.-exp(log(G4UniformRand())/cz1) ;
+      }
+      zPathLength = tPathLength*u ;
+    }
+  }
+
+  if(zPathLength > lambda0) zPathLength = lambda0;
+
+  return zPathLength;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+G4double G4UrbanMscModel92::ComputeTrueStepLength(G4double geomStepLength)
+{
+  // step defined other than transportation 
+  if(geomStepLength == zPathLength && tPathLength <= currentRange)
+    return tPathLength;
+
+  // t = z for very small step
+  zPathLength = geomStepLength;
+  tPathLength = geomStepLength;
+  if(geomStepLength < tlimitminfix) return tPathLength;
+  
+  // recalculation
+  if((geomStepLength > lambda0*tausmall) && !insideskin)
+  {
+    if(par1 <  0.)
+      tPathLength = -lambda0*log(1.-geomStepLength/lambda0) ;
+    else 
+    {
+      if(par1*par3*geomStepLength < 1.)
+        tPathLength = (1.-exp(log(1.-par1*par3*geomStepLength)/par3))/par1 ;
+      else 
+        tPathLength = currentRange;
+    }  
+  }
+  if(tPathLength < geomStepLength) tPathLength = geomStepLength;
+
+  return tPathLength;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+G4double G4UrbanMscModel92::ComputeTheta0(G4double trueStepLength,
+					  G4double KineticEnergy)
+{
+  // for all particles take the width of the central part
+  //  from a  parametrization similar to the Highland formula
+  // ( Highland formula: Particle Physics Booklet, July 2002, eq. 26.10)
+  const G4double c_highland = 13.6*MeV ;
+  G4double betacp = sqrt(currentKinEnergy*(currentKinEnergy+2.*mass)*
+                         KineticEnergy*(KineticEnergy+2.*mass)/
+                      ((currentKinEnergy+mass)*(KineticEnergy+mass)));
+  y = trueStepLength/currentRadLength;
+  G4double theta0 = c_highland*std::abs(charge)*sqrt(y)/betacp;
+  y = log(y);
+  // correction factor from e-/proton scattering data
+  G4double corr = coeffth1+coeffth2*y;                
+  if(y < -6.5) corr -= 0.011*(6.5+y);
+  theta0 *= corr ;                                               
+
+  return theta0;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+void G4UrbanMscModel92::SampleScattering(const G4DynamicParticle* dynParticle,
+					 G4double safety)
+{
+  G4double kineticEnergy = dynParticle->GetKineticEnergy();
+
+  if((kineticEnergy <= 0.0) || (tPathLength <= tlimitminfix) ||
+     (tPathLength/tausmall < lambda0)) return;
+
+  G4double cth  = SampleCosineTheta(tPathLength,kineticEnergy);
+
+  // protection against 'bad' cth values
+  if(std::abs(cth) > 1.) return;
+
+  G4double sth  = sqrt((1.0 - cth)*(1.0 + cth));
+  G4double phi  = twopi*G4UniformRand();
+  G4double dirx = sth*cos(phi);
+  G4double diry = sth*sin(phi);
+
+  G4ThreeVector oldDirection = dynParticle->GetMomentumDirection();
+  G4ThreeVector newDirection(dirx,diry,cth);
+  newDirection.rotateUz(oldDirection);
+  fParticleChange->ProposeMomentumDirection(newDirection);
+
+  if (latDisplasment && safety > tlimitminfix) {
+
+    G4double r = SampleDisplacement();
+    /*
+    G4cout << "G4UrbanMscModel92::SampleSecondaries: e(MeV)= " << kineticEnergy
+	   << " sinTheta= " << sth << " r(mm)= " << r
+           << " trueStep(mm)= " << tPathLength
+           << " geomStep(mm)= " << zPathLength
+           << G4endl;
+    */
+    if(r > 0.)
+      {
+        G4double latcorr = LatCorrelation();
+        if(latcorr > r) latcorr = r;
+
+        // sample direction of lateral displacement
+        // compute it from the lateral correlation
+        G4double Phi = 0.;
+        if(std::abs(r*sth) < latcorr)
+          Phi  = twopi*G4UniformRand();
+        else
+        {
+          G4double psi = std::acos(latcorr/(r*sth));
+          if(G4UniformRand() < 0.5)
+            Phi = phi+psi;
+          else
+            Phi = phi-psi;
+        }
+
+        dirx = std::cos(Phi);
+        diry = std::sin(Phi);
+
+        G4ThreeVector latDirection(dirx,diry,0.0);
+        latDirection.rotateUz(oldDirection);
+
+	ComputeDisplacement(fParticleChange, latDirection, r, safety);
+      }
+  }
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+G4double G4UrbanMscModel92::SampleCosineTheta(G4double trueStepLength,
+					      G4double KineticEnergy)
+{
+  G4double cth = 1. ;
+  G4double tau = trueStepLength/lambda0 ;
+
+  Zeff = couple->GetMaterial()->GetTotNbOfElectPerVolume()/
+         couple->GetMaterial()->GetTotNbOfAtomsPerVolume() ;
+
+  if(Zold != Zeff)  
+    UpdateCache();
+
+  if(insideskin)
+  {
+    //no scattering, single or plural scattering
+    G4double mean = trueStepLength/stepmin ;
+
+    G4int n = G4Poisson(mean);
+    if(n > 0)
+    {
+      //screening (Moliere-Bethe)
+      G4double mom2 = KineticEnergy*(2.*mass+KineticEnergy);
+      G4double beta2 = mom2/((KineticEnergy+mass)*(KineticEnergy+mass));
+      G4double ascr = scr1/mom2;
+      ascr *= 1.13+scr2/beta2;
+      G4double ascr1 = 1.+2.*ascr;
+      G4double bp1=ascr1+1.;
+      G4double bm1=ascr1-1.;
+
+      // single scattering from screened Rutherford x-section
+      G4double ct,st,phi;
+      G4double sx=0.,sy=0.,sz=0.;
+      for(G4int i=1; i<=n; i++)
+      {
+        ct = ascr1-bp1*bm1/(2.*G4UniformRand()+bm1);
+        if(ct < -1.) ct = -1.;
+        if(ct >  1.) ct =  1.; 
+        st = sqrt(1.-ct*ct);
+        phi = twopi*G4UniformRand();
+        sx += st*cos(phi);
+        sy += st*sin(phi);
+        sz += ct;
+      }
+      cth = sz/sqrt(sx*sx+sy*sy+sz*sz);
+    }
+  }
+  else
+  {
+    if(trueStepLength >= currentRange*dtrl) 
+    {
+      if(par1*trueStepLength < 1.)
+	tau = -par2*log(1.-par1*trueStepLength) ;
+      // for the case if ioni/brems are inactivated
+      // see the corresponding condition in ComputeGeomPathLength 
+      else if(1.-KineticEnergy/currentKinEnergy > taulim)
+	tau = taubig ;
+    }
+    currentTau = tau ;
+    lambdaeff = trueStepLength/currentTau;
+    currentRadLength = couple->GetMaterial()->GetRadlen();
+
+    if (tau >= taubig) cth = -1.+2.*G4UniformRand();
+    else if (tau >= tausmall)
+    {
+      G4double xsi = 3.0;  
+      G4double x0 = 1.;
+      G4double a = 1., ea = 0., eaa = 1.;
+      G4double b=2.,b1=3.,bx=1.,eb1=3.,ebx=1.;
+      G4double prob = 1. , qprob = 1. ;
+      G4double xmean1 = 1., xmean2 = 0.;
+      G4double xmeanth = exp(-tau);
+      G4double x2meanth = (1.+2.*exp(-2.5*tau))/3.;
+
+      G4double relloss = 1.-KineticEnergy/currentKinEnergy;
+      if(relloss > rellossmax) 
+        return SimpleScattering(xmeanth,x2meanth);
+
+      G4double theta0 = ComputeTheta0(trueStepLength,KineticEnergy);
+
+      // protection for very small angles
+      if(theta0 < tausmall) return cth;
+    
+      if(theta0 > theta0max)
+        return SimpleScattering(xmeanth,x2meanth);
+      G4double sth = sin(0.5*theta0);
+      a = 0.25/(sth*sth);
+
+      ea = exp(-xsi);
+      eaa = 1.-ea ;
+      xmean1 = 1.-(1.-(1.+xsi)*ea)/(a*eaa);
+      x0 = 1.-xsi/a;
+
+      if(xmean1 <= 0.999*xmeanth)
+        return SimpleScattering(xmeanth,x2meanth);
+
+      // from MUSCAT H,Be,Fe data 
+      G4double c = coeffc1;                         
+      if(y > -13.5) 
+        c += coeffc2*exp(3.*log(y+13.5));
+
+      if(abs(c-3.) < 0.001)  c = 3.001;      
+      if(abs(c-2.) < 0.001)  c = 2.001;      
+
+      G4double c1 = c-1.;
+
+      //from continuity of derivatives
+      b = 1.+(c-xsi)/a;
+
+      b1 = b+1.;
+      bx = c/a;
+      eb1 = exp(c1*log(b1));
+      ebx = exp(c1*log(bx));
+
+      xmean2 = (x0*eb1+ebx-(eb1*bx-b1*ebx)/(c-2.))/(eb1-ebx);
+      
+      G4double f1x0 = a*ea/eaa;
+      G4double f2x0 = c1*eb1/(bx*(eb1-ebx));
+      prob = f2x0/(f1x0+f2x0);
+
+      qprob = xmeanth/(prob*xmean1+(1.-prob)*xmean2);
+
+      // sampling of costheta
+      if(G4UniformRand() < qprob)
+      {
+        if(G4UniformRand() < prob)
+          cth = 1.+log(ea+G4UniformRand()*eaa)/a ;
+        else
+          cth = b-b1*bx/exp(log(ebx+(eb1-ebx)*G4UniformRand())/c1) ;
+      }
+      else
+        cth = -1.+2.*G4UniformRand();
+    }
+  }  
+  return cth ;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+G4double G4UrbanMscModel92::SimpleScattering(G4double xmeanth,G4double x2meanth)
+{
+  // 'large angle scattering'
+  // 2 model functions with correct xmean and x2mean
+  G4double a = (2.*xmeanth+9.*x2meanth-3.)/(2.*xmeanth-3.*x2meanth+1.);
+  G4double prob = (a+2.)*xmeanth/a;
+
+  // sampling
+  G4double cth = 1.;
+  if(G4UniformRand() < prob)
+    cth = -1.+2.*exp(log(G4UniformRand())/(a+1.));
+  else
+    cth = -1.+2.*G4UniformRand();
+  return cth;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+G4double G4UrbanMscModel92::SampleDisplacement()
+{
+  const G4double kappa = 2.5;
+  const G4double kappapl1 = kappa+1.;
+  const G4double kappami1 = kappa-1.;
+  G4double rmean = 0.0;
+  if ((currentTau >= tausmall) && !insideskin) {
+    if (currentTau < taulim) {
+      rmean = kappa*currentTau*currentTau*currentTau*
+             (1.-kappapl1*currentTau*0.25)/6. ;
+
+    } else {
+      G4double etau = 0.0;
+      if (currentTau<taubig) etau = exp(-currentTau);
+      rmean = -kappa*currentTau;
+      rmean = -exp(rmean)/(kappa*kappami1);
+      rmean += currentTau-kappapl1/kappa+kappa*etau/kappami1;
+    }
+    if (rmean>0.) rmean = 2.*lambdaeff*sqrt(rmean/3.0);
+    else          rmean = 0.;
+  }
+
+  // protection against z > t ...........................
+  if(rmean > 0.) {
+    G4double zt = (tPathLength-zPathLength)*(tPathLength+zPathLength);
+    if(zt <= 0.)
+      rmean = 0.;
+    else if(rmean*rmean > zt)
+      rmean = sqrt(zt);
+  }
+  return rmean;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+G4double G4UrbanMscModel92::LatCorrelation()
+{
+  const G4double kappa = 2.5;
+  const G4double kappami1 = kappa-1.;
+
+  G4double latcorr = 0.;
+  if((currentTau >= tausmall) && !insideskin)
+  {
+    if(currentTau < taulim)
+      latcorr = lambdaeff*kappa*currentTau*currentTau*
+                (1.-(kappa+1.)*currentTau/3.)/3.;
+    else
+    {
+      G4double etau = 0.;
+      if(currentTau < taubig) etau = exp(-currentTau);
+      latcorr = -kappa*currentTau;
+      latcorr = exp(latcorr)/kappami1;
+      latcorr += 1.-kappa*etau/kappami1 ;
+      latcorr *= 2.*lambdaeff/3. ;
+    }
+  }
+
+  return latcorr;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Index: trunk/source/processes/electromagnetic/standard/src/G4UrbanMscModel93.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4UrbanMscModel93.cc	(revision 1197)
+++ trunk/source/processes/electromagnetic/standard/src/G4UrbanMscModel93.cc	(revision 1197)
@@ -0,0 +1,1062 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4UrbanMscModel93.cc,v 1.1 2009/11/01 13:05:01 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
+//
+// -------------------------------------------------------------------
+//
+// GEANT4 Class file
+//
+//
+// File name:   G4UrbanMscModel93
+//
+// Author:      Laszlo Urban
+//
+// Creation date: 06.03.2008
+//
+// Modifications:
+//
+// 06-03-2008 starting point : G4UrbanMscModel2 = G4UrbanMscModel 9.1 ref 02
+//
+// 13-03-08  Bug in SampleScattering (which caused lateral asymmetry) fixed
+//           (L.Urban)
+//
+// 14-03-08  Simplification of step limitation in ComputeTruePathLengthLimit,
+//           + tlimitmin is the same for UseDistancetoBoundary and
+//           UseSafety (L.Urban)           
+//
+// 16-03-08  Reorganization of SampleCosineTheta + new method SimpleScattering
+//           SimpleScattering is used if the relative energy loss is too big
+//           or theta0 is too big (see data members rellossmax, theta0max)
+//           (L.Urban)          
+//
+// 17-03-08  tuning of the correction factor in ComputeTheta0 (L.Urban)
+//
+// 19-03-08  exponent c of the 'tail' model function is not equal to 2 any more,
+//           value of c has been extracted from some e- scattering data (L.Urban) 
+//
+// 24-03-08  Step limitation in ComputeTruePathLengthLimit has been
+//           simplified further + some data members have been removed (L.Urban)
+//
+// 24-07-08  central part of scattering angle (theta0) has been tuned
+//           tail of the scattering angle distribution has been tuned
+//           using some e- and proton scattering data
+//
+// 05-08-08  bugfix in ComputeTruePathLengthLimit (L.Urban)
+//
+// 09-10-08  theta0 and tail have been retuned using some e-,mu,proton
+//           scattering data (L.Urban)
+//           + single scattering without path length correction for
+//           small steps (t < tlimitmin, for UseDistanceToBoundary only)
+//
+// 15-10-08  Moliere-Bethe screening in the single scattering part(L.Urban)          
+//
+// 17-10-08  stepping similar to that in model (9.1) for UseSafety case
+//           for e+/e- in order to speed up the code for calorimeters
+//
+// 23-10-08  bugfix in the screeningparameter of the single scattering part,
+//           some technical change in order to speed up the code (UpdateCache)
+//
+// 27-10-08  bugfix in ComputeTruePathLengthLimit (affects UseDistanceToBoundary
+//           stepping type only) (L.Urban)          
+//
+// 28-10-09  V.Ivanchenko moved G4UrbanMscModel2 to G4UrbanMscModel93, 
+//           now it is a frozen version of the Urban model corresponding 
+//           to g4 9.3
+
+// Class Description:
+//
+// Implementation of the model of multiple scattering based on
+// H.W.Lewis Phys Rev 78 (1950) 526 and others
+
+// -------------------------------------------------------------------
+// In its present form the model can be  used for simulation 
+//   of the e-/e+, muon and charged hadron multiple scattering
+//
+
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+#include "G4UrbanMscModel93.hh"
+#include "Randomize.hh"
+#include "G4Electron.hh"
+#include "G4LossTableManager.hh"
+#include "G4ParticleChangeForMSC.hh"
+
+#include "G4Poisson.hh"
+#include "globals.hh"
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+using namespace std;
+
+G4UrbanMscModel93::G4UrbanMscModel93(const G4String& nam)
+  : G4VMscModel(nam),
+    isInitialized(false)
+{
+  masslimite    = 0.6*MeV;
+  lambdalimit   = 1.*mm;
+  fr            = 0.02;
+  //facsafety     = 0.3;
+  taubig        = 8.0;
+  tausmall      = 1.e-16;
+  taulim        = 1.e-6;
+  currentTau    = taulim;
+  tlimitminfix  = 1.e-6*mm;            
+  stepmin       = tlimitminfix;
+  smallstep     = 1.e10;
+  currentRange  = 0. ;
+  rangeinit     = 0.;
+  tlimit        = 1.e10*mm;
+  tlimitmin     = 10.*tlimitminfix;            
+  tgeom         = 1.e50*mm;
+  geombig       = 1.e50*mm;
+  geommin       = 1.e-3*mm;
+  geomlimit     = geombig;
+  presafety     = 0.*mm;
+                          
+  y             = 0.;
+
+  Zold          = 0.;
+  Zeff          = 1.;
+  Z2            = 1.;                
+  Z23           = 1.;                    
+  lnZ           = 0.;
+  coeffth1      = 0.;
+  coeffth2      = 0.;
+  coeffc1       = 0.;
+  coeffc2       = 0.;
+  scr1ini       = fine_structure_const*fine_structure_const*
+                  electron_mass_c2*electron_mass_c2/(0.885*0.885*4.*pi);
+  scr2ini       = 3.76*fine_structure_const*fine_structure_const;
+  scr1          = 0.;
+  scr2          = 0.;
+
+  theta0max     = pi/6.;
+  rellossmax    = 0.50;
+  third         = 1./3.;
+  particle      = 0;
+  theManager    = G4LossTableManager::Instance(); 
+  inside        = false;  
+  insideskin    = false;
+
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+G4UrbanMscModel93::~G4UrbanMscModel93()
+{}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+void G4UrbanMscModel93::Initialise(const G4ParticleDefinition* p,
+				   const G4DataVector&)
+{
+  skindepth = skin*stepmin;
+  if(isInitialized) return;
+  // set values of some data members
+  SetParticle(p);
+
+  fParticleChange = GetParticleChangeForMSC();
+  InitialiseSafetyHelper();
+
+  isInitialized = true;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+G4double G4UrbanMscModel93::ComputeCrossSectionPerAtom( 
+                             const G4ParticleDefinition* part,
+                                   G4double KineticEnergy,
+                                   G4double AtomicNumber,G4double,
+				   G4double, G4double)
+{
+  const G4double sigmafactor = twopi*classic_electr_radius*classic_electr_radius;
+  const G4double epsfactor = 2.*electron_mass_c2*electron_mass_c2*
+                            Bohr_radius*Bohr_radius/(hbarc*hbarc);
+  const G4double epsmin = 1.e-4 , epsmax = 1.e10;
+
+  const G4double Zdat[15] = { 4.,  6., 13., 20., 26., 29., 32., 38., 47.,
+                             50., 56., 64., 74., 79., 82. };
+
+  const G4double Tdat[22] = { 100*eV,  200*eV,  400*eV,  700*eV,
+                               1*keV,   2*keV,   4*keV,   7*keV,
+			      10*keV,  20*keV,  40*keV,  70*keV,
+                             100*keV, 200*keV, 400*keV, 700*keV,
+                               1*MeV,   2*MeV,   4*MeV,   7*MeV,
+			      10*MeV,  20*MeV};
+
+  // corr. factors for e-/e+ lambda for T <= Tlim
+          G4double celectron[15][22] =
+          {{1.125,1.072,1.051,1.047,1.047,1.050,1.052,1.054,
+            1.054,1.057,1.062,1.069,1.075,1.090,1.105,1.111,
+            1.112,1.108,1.100,1.093,1.089,1.087            },
+           {1.408,1.246,1.143,1.096,1.077,1.059,1.053,1.051,
+            1.052,1.053,1.058,1.065,1.072,1.087,1.101,1.108,
+            1.109,1.105,1.097,1.090,1.086,1.082            },
+           {2.833,2.268,1.861,1.612,1.486,1.309,1.204,1.156,
+            1.136,1.114,1.106,1.106,1.109,1.119,1.129,1.132,
+            1.131,1.124,1.113,1.104,1.099,1.098            },
+           {3.879,3.016,2.380,2.007,1.818,1.535,1.340,1.236,
+            1.190,1.133,1.107,1.099,1.098,1.103,1.110,1.113,
+            1.112,1.105,1.096,1.089,1.085,1.098            },
+           {6.937,4.330,2.886,2.256,1.987,1.628,1.395,1.265,
+            1.203,1.122,1.080,1.065,1.061,1.063,1.070,1.073,
+            1.073,1.070,1.064,1.059,1.056,1.056            },
+           {9.616,5.708,3.424,2.551,2.204,1.762,1.485,1.330,
+            1.256,1.155,1.099,1.077,1.070,1.068,1.072,1.074,
+            1.074,1.070,1.063,1.059,1.056,1.052            },
+           {11.72,6.364,3.811,2.806,2.401,1.884,1.564,1.386,
+            1.300,1.180,1.112,1.082,1.073,1.066,1.068,1.069,
+            1.068,1.064,1.059,1.054,1.051,1.050            },
+           {18.08,8.601,4.569,3.183,2.662,2.025,1.646,1.439,
+            1.339,1.195,1.108,1.068,1.053,1.040,1.039,1.039,
+            1.039,1.037,1.034,1.031,1.030,1.036            },
+           {18.22,10.48,5.333,3.713,3.115,2.367,1.898,1.631,
+            1.498,1.301,1.171,1.105,1.077,1.048,1.036,1.033,
+            1.031,1.028,1.024,1.022,1.021,1.024            },
+           {14.14,10.65,5.710,3.929,3.266,2.453,1.951,1.669,
+            1.528,1.319,1.178,1.106,1.075,1.040,1.027,1.022,
+            1.020,1.017,1.015,1.013,1.013,1.020            },
+           {14.11,11.73,6.312,4.240,3.478,2.566,2.022,1.720,
+            1.569,1.342,1.186,1.102,1.065,1.022,1.003,0.997,
+            0.995,0.993,0.993,0.993,0.993,1.011            },
+           {22.76,20.01,8.835,5.287,4.144,2.901,2.219,1.855,
+            1.677,1.410,1.224,1.121,1.073,1.014,0.986,0.976,
+            0.974,0.972,0.973,0.974,0.975,0.987            },
+           {50.77,40.85,14.13,7.184,5.284,3.435,2.520,2.059,
+            1.837,1.512,1.283,1.153,1.091,1.010,0.969,0.954,
+            0.950,0.947,0.949,0.952,0.954,0.963            },
+           {65.87,59.06,15.87,7.570,5.567,3.650,2.682,2.182,
+            1.939,1.579,1.325,1.178,1.108,1.014,0.965,0.947,
+            0.941,0.938,0.940,0.944,0.946,0.954            },
+           {55.60,47.34,15.92,7.810,5.755,3.767,2.760,2.239,
+            1.985,1.609,1.343,1.188,1.113,1.013,0.960,0.939,
+            0.933,0.930,0.933,0.936,0.939,0.949            }};
+	    
+           G4double cpositron[15][22] = {
+           {2.589,2.044,1.658,1.446,1.347,1.217,1.144,1.110,
+            1.097,1.083,1.080,1.086,1.092,1.108,1.123,1.131,
+            1.131,1.126,1.117,1.108,1.103,1.100            },
+           {3.904,2.794,2.079,1.710,1.543,1.325,1.202,1.145,
+            1.122,1.096,1.089,1.092,1.098,1.114,1.130,1.137,
+            1.138,1.132,1.122,1.113,1.108,1.102            },
+           {7.970,6.080,4.442,3.398,2.872,2.127,1.672,1.451,
+            1.357,1.246,1.194,1.179,1.178,1.188,1.201,1.205,
+            1.203,1.190,1.173,1.159,1.151,1.145            },
+           {9.714,7.607,5.747,4.493,3.815,2.777,2.079,1.715,
+            1.553,1.353,1.253,1.219,1.211,1.214,1.225,1.228,
+            1.225,1.210,1.191,1.175,1.166,1.174            },
+           {17.97,12.95,8.628,6.065,4.849,3.222,2.275,1.820,
+            1.624,1.382,1.259,1.214,1.202,1.202,1.214,1.219,
+            1.217,1.203,1.184,1.169,1.160,1.151            },
+           {24.83,17.06,10.84,7.355,5.767,3.707,2.546,1.996,
+            1.759,1.465,1.311,1.252,1.234,1.228,1.238,1.241,
+            1.237,1.222,1.201,1.184,1.174,1.159            },
+           {23.26,17.15,11.52,8.049,6.375,4.114,2.792,2.155,
+            1.880,1.535,1.353,1.281,1.258,1.247,1.254,1.256,
+            1.252,1.234,1.212,1.194,1.183,1.170            },
+           {22.33,18.01,12.86,9.212,7.336,4.702,3.117,2.348,
+            2.015,1.602,1.385,1.297,1.268,1.251,1.256,1.258,
+            1.254,1.237,1.214,1.195,1.185,1.179            },
+           {33.91,24.13,15.71,10.80,8.507,5.467,3.692,2.808,
+            2.407,1.873,1.564,1.425,1.374,1.330,1.324,1.320,
+            1.312,1.288,1.258,1.235,1.221,1.205            },
+           {32.14,24.11,16.30,11.40,9.015,5.782,3.868,2.917,
+            2.490,1.925,1.596,1.447,1.391,1.342,1.332,1.327,
+            1.320,1.294,1.264,1.240,1.226,1.214            },
+           {29.51,24.07,17.19,12.28,9.766,6.238,4.112,3.066,
+            2.602,1.995,1.641,1.477,1.414,1.356,1.342,1.336,
+            1.328,1.302,1.270,1.245,1.231,1.233            },
+           {38.19,30.85,21.76,15.35,12.07,7.521,4.812,3.498,
+            2.926,2.188,1.763,1.563,1.484,1.405,1.382,1.371,
+            1.361,1.330,1.294,1.267,1.251,1.239            },
+           {49.71,39.80,27.96,19.63,15.36,9.407,5.863,4.155,
+            3.417,2.478,1.944,1.692,1.589,1.480,1.441,1.423,
+            1.409,1.372,1.330,1.298,1.280,1.258            },
+           {59.25,45.08,30.36,20.83,16.15,9.834,6.166,4.407,
+            3.641,2.648,2.064,1.779,1.661,1.531,1.482,1.459,
+            1.442,1.400,1.354,1.319,1.299,1.272            },
+           {56.38,44.29,30.50,21.18,16.51,10.11,6.354,4.542,
+            3.752,2.724,2.116,1.817,1.692,1.554,1.499,1.474,
+            1.456,1.412,1.364,1.328,1.307,1.282            }};
+
+  //data/corrections for T > Tlim  
+  G4double Tlim = 10.*MeV;
+  G4double beta2lim = Tlim*(Tlim+2.*electron_mass_c2)/
+                      ((Tlim+electron_mass_c2)*(Tlim+electron_mass_c2));
+  G4double bg2lim   = Tlim*(Tlim+2.*electron_mass_c2)/
+                      (electron_mass_c2*electron_mass_c2);
+
+  G4double sig0[15] = {0.2672*barn,  0.5922*barn, 2.653*barn,  6.235*barn,
+                      11.69*barn  , 13.24*barn  , 16.12*barn, 23.00*barn ,
+		      35.13*barn  , 39.95*barn  , 50.85*barn, 67.19*barn ,
+                      91.15*barn  , 104.4*barn  , 113.1*barn};
+		      		       
+  G4double hecorr[15] = {120.70, 117.50, 105.00, 92.92, 79.23,  74.510,  68.29,
+                          57.39,  41.97,  36.14, 24.53, 10.21,  -7.855, -16.84,
+			 -22.30};
+
+  G4double sigma;
+  SetParticle(part);
+
+  G4double Z23 = 2.*log(AtomicNumber)/3.; Z23 = exp(Z23);
+
+  // correction if particle .ne. e-/e+
+  // compute equivalent kinetic energy
+  // lambda depends on p*beta ....
+
+  G4double eKineticEnergy = KineticEnergy;
+
+  if(mass > electron_mass_c2)
+  {
+     G4double TAU = KineticEnergy/mass ;
+     G4double c = mass*TAU*(TAU+2.)/(electron_mass_c2*(TAU+1.)) ;
+     G4double w = c-2. ;
+     G4double tau = 0.5*(w+sqrt(w*w+4.*c)) ;
+     eKineticEnergy = electron_mass_c2*tau ;
+  }
+
+  G4double eTotalEnergy = eKineticEnergy + electron_mass_c2 ;
+  G4double beta2 = eKineticEnergy*(eTotalEnergy+electron_mass_c2)
+                                 /(eTotalEnergy*eTotalEnergy);
+  G4double bg2   = eKineticEnergy*(eTotalEnergy+electron_mass_c2)
+                                 /(electron_mass_c2*electron_mass_c2);
+
+  G4double eps = epsfactor*bg2/Z23;
+
+  if     (eps<epsmin)  sigma = 2.*eps*eps;
+  else if(eps<epsmax)  sigma = log(1.+2.*eps)-2.*eps/(1.+2.*eps);
+  else                 sigma = log(2.*eps)-1.+1./eps;
+
+  sigma *= ChargeSquare*AtomicNumber*AtomicNumber/(beta2*bg2);
+
+  // interpolate in AtomicNumber and beta2 
+  G4double c1,c2,cc1,cc2,corr;
+
+  // get bin number in Z
+  G4int iZ = 14;
+  while ((iZ>=0)&&(Zdat[iZ]>=AtomicNumber)) iZ -= 1;
+  if (iZ==14)                               iZ = 13;
+  if (iZ==-1)                               iZ = 0 ;
+
+  G4double Z1 = Zdat[iZ];
+  G4double Z2 = Zdat[iZ+1];
+  G4double ratZ = (AtomicNumber-Z1)*(AtomicNumber+Z1)/
+                  ((Z2-Z1)*(Z2+Z1));
+
+  if(eKineticEnergy <= Tlim) 
+  {
+    // get bin number in T (beta2)
+    G4int iT = 21;
+    while ((iT>=0)&&(Tdat[iT]>=eKineticEnergy)) iT -= 1;
+    if(iT==21)                                  iT = 20;
+    if(iT==-1)                                  iT = 0 ;
+
+    //  calculate betasquare values
+    G4double T = Tdat[iT],   E = T + electron_mass_c2;
+    G4double b2small = T*(E+electron_mass_c2)/(E*E);
+
+    T = Tdat[iT+1]; E = T + electron_mass_c2;
+    G4double b2big = T*(E+electron_mass_c2)/(E*E);
+    G4double ratb2 = (beta2-b2small)/(b2big-b2small);
+
+    if (charge < 0.)
+    {
+       c1 = celectron[iZ][iT];
+       c2 = celectron[iZ+1][iT];
+       cc1 = c1+ratZ*(c2-c1);
+
+       c1 = celectron[iZ][iT+1];
+       c2 = celectron[iZ+1][iT+1];
+       cc2 = c1+ratZ*(c2-c1);
+
+       corr = cc1+ratb2*(cc2-cc1);
+
+       sigma *= sigmafactor/corr;
+    }
+    else              
+    {
+       c1 = cpositron[iZ][iT];
+       c2 = cpositron[iZ+1][iT];
+       cc1 = c1+ratZ*(c2-c1);
+
+       c1 = cpositron[iZ][iT+1];
+       c2 = cpositron[iZ+1][iT+1];
+       cc2 = c1+ratZ*(c2-c1);
+
+       corr = cc1+ratb2*(cc2-cc1);
+
+       sigma *= sigmafactor/corr;
+    }
+  }
+  else
+  {
+    c1 = bg2lim*sig0[iZ]*(1.+hecorr[iZ]*(beta2-beta2lim))/bg2;
+    c2 = bg2lim*sig0[iZ+1]*(1.+hecorr[iZ+1]*(beta2-beta2lim))/bg2;
+    if((AtomicNumber >= Z1) && (AtomicNumber <= Z2))
+      sigma = c1+ratZ*(c2-c1) ;
+    else if(AtomicNumber < Z1)
+      sigma = AtomicNumber*AtomicNumber*c1/(Z1*Z1);
+    else if(AtomicNumber > Z2)
+      sigma = AtomicNumber*AtomicNumber*c2/(Z2*Z2);
+  }
+  return sigma;
+
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+G4double G4UrbanMscModel93::ComputeTruePathLengthLimit(
+                             const G4Track& track,
+			     G4PhysicsTable* theTable,
+			     G4double currentMinimalStep)
+{
+  tPathLength = currentMinimalStep;
+  G4StepPoint* sp = track.GetStep()->GetPreStepPoint();
+  G4StepStatus stepStatus = sp->GetStepStatus();
+
+  const G4DynamicParticle* dp = track.GetDynamicParticle();
+
+  if(stepStatus == fUndefined) {
+    inside = false;
+    insideskin = false;
+    tlimit = geombig;
+    SetParticle( dp->GetDefinition() );
+  }
+
+  theLambdaTable = theTable;
+  couple = track.GetMaterialCutsCouple();
+  currentMaterialIndex = couple->GetIndex();
+  currentKinEnergy = dp->GetKineticEnergy();
+  currentRange = 
+    theManager->GetRangeFromRestricteDEDX(particle,currentKinEnergy,couple);
+  lambda0 = GetLambda(currentKinEnergy);
+
+  // stop here if small range particle
+  if(inside) return tPathLength;            
+  
+  if(tPathLength > currentRange) tPathLength = currentRange;
+
+  presafety = sp->GetSafety();
+
+  //G4cout << "G4Urban2::StepLimit tPathLength= " 
+  //	 <<tPathLength<<" safety= " << presafety
+  //       << " range= " <<currentRange<< " lambda= "<<lambda0
+  //	 << " Alg: " << steppingAlgorithm <<G4endl;
+
+  // far from geometry boundary
+  if(currentRange < presafety)
+    {
+      inside = true;
+      return tPathLength;  
+    }
+
+  // standard  version
+  //
+  if (steppingAlgorithm == fUseDistanceToBoundary)
+    {
+      //compute geomlimit and presafety 
+      G4double geomlimit = ComputeGeomLimit(track, presafety, currentRange);
+
+      // is it far from boundary ?
+      if(currentRange < presafety)
+	{
+	  inside = true;
+	  return tPathLength;   
+	}
+
+      smallstep += 1.;
+      insideskin = false;
+
+      if((stepStatus == fGeomBoundary) || (stepStatus == fUndefined))
+        {
+          rangeinit = currentRange;
+          if(stepStatus == fUndefined) smallstep = 1.e10;
+          else  smallstep = 1.;
+
+          //define stepmin here (it depends on lambda!)
+          //rough estimation of lambda_elastic/lambda_transport
+          G4double rat = currentKinEnergy/MeV ;
+          rat = 1.e-3/(rat*(10.+rat)) ;
+          //stepmin ~ lambda_elastic
+          stepmin = rat*lambda0;
+          skindepth = skin*stepmin;
+          //define tlimitmin
+          tlimitmin = 10.*stepmin;
+          if(tlimitmin < tlimitminfix) tlimitmin = tlimitminfix;
+	  //G4cout << "rangeinit= " << rangeinit << " stepmin= " << stepmin
+	  //	 << " tlimitmin= " << tlimitmin << " geomlimit= " << geomlimit <<G4endl;
+          // constraint from the geometry
+          if((geomlimit < geombig) && (geomlimit > geommin))
+            {
+              // geomlimit is a geometrical step length
+              // transform it to true path length (estimation)
+              if((1.-geomlimit/lambda0) > 0.)
+                geomlimit = -lambda0*log(1.-geomlimit/lambda0)+tlimitmin ;
+
+              if(stepStatus == fGeomBoundary)
+                tgeom = geomlimit/facgeom;
+              else
+                tgeom = 2.*geomlimit/facgeom;
+            }
+            else
+              tgeom = geombig;
+        }
+
+
+      //step limit 
+      tlimit = facrange*rangeinit;              
+      if(tlimit < facsafety*presafety)
+        tlimit = facsafety*presafety; 
+
+      //lower limit for tlimit
+      if(tlimit < tlimitmin) tlimit = tlimitmin;
+
+      if(tlimit > tgeom) tlimit = tgeom;
+
+      //G4cout << "tgeom= " << tgeom << " geomlimit= " << geomlimit  
+      //      << " tlimit= " << tlimit << " presafety= " << presafety << G4endl;
+
+      // shortcut
+      if((tPathLength < tlimit) && (tPathLength < presafety) &&
+         (smallstep >= skin) && (tPathLength < geomlimit-0.999*skindepth))
+	return tPathLength;   
+
+      // step reduction near to boundary
+      if(smallstep < skin)
+	{
+	  tlimit = stepmin;
+	  insideskin = true;
+	}
+      else if(geomlimit < geombig)
+	{
+	  if(geomlimit > skindepth)
+	    {
+	      if(tlimit > geomlimit-0.999*skindepth)
+		tlimit = geomlimit-0.999*skindepth;
+	    }
+	  else
+	    {
+	      insideskin = true;
+	      if(tlimit > stepmin) tlimit = stepmin;
+	    }
+	}
+
+      if(tlimit < stepmin) tlimit = stepmin;
+
+      if(tPathLength > tlimit) tPathLength = tlimit  ; 
+
+    }
+    // for 'normal' simulation with or without magnetic field 
+    //  there no small step/single scattering at boundaries
+  else if(steppingAlgorithm == fUseSafety)
+    {
+      // compute presafety again if presafety <= 0 and no boundary
+      // i.e. when it is needed for optimization purposes
+      if((stepStatus != fGeomBoundary) && (presafety < tlimitminfix)) 
+	presafety = ComputeSafety(sp->GetPosition(),tPathLength); 
+
+      // is far from boundary
+      if(currentRange < presafety)
+        {
+          inside = true;
+          return tPathLength;  
+        }
+
+      if((stepStatus == fGeomBoundary) || (stepStatus == fUndefined))
+      {
+        rangeinit = currentRange;
+        fr = facrange;
+        // 9.1 like stepping for e+/e- only (not for muons,hadrons)
+        if(mass < masslimite) 
+        {
+          if(lambda0 > currentRange)
+            rangeinit = lambda0;
+          if(lambda0 > lambdalimit)
+            fr *= 0.75+0.25*lambda0/lambdalimit;
+        }
+
+        //lower limit for tlimit
+        G4double rat = currentKinEnergy/MeV ;
+        rat = 1.e-3/(rat*(10.+rat)) ;
+        tlimitmin = 10.*lambda0*rat;
+        if(tlimitmin < tlimitminfix) tlimitmin = tlimitminfix;
+      }
+      //step limit
+      tlimit = fr*rangeinit;               
+
+      if(tlimit < facsafety*presafety)
+        tlimit = facsafety*presafety;
+
+      //lower limit for tlimit
+      if(tlimit < tlimitmin) tlimit = tlimitmin;
+
+      if(tPathLength > tlimit) tPathLength = tlimit;
+    }
+  
+  // version similar to 7.1 (needed for some experiments)
+  else
+    {
+      if (stepStatus == fGeomBoundary)
+	{
+	  if (currentRange > lambda0) tlimit = facrange*currentRange;
+	  else                        tlimit = facrange*lambda0;
+
+	  if(tlimit < tlimitmin) tlimit = tlimitmin;
+	  if(tPathLength > tlimit) tPathLength = tlimit;
+	}
+    }
+  //G4cout << "tPathLength= " << tPathLength 
+  //	 << " currentMinimalStep= " << currentMinimalStep << G4endl;
+  return tPathLength ;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+G4double G4UrbanMscModel93::ComputeGeomPathLength(G4double)
+{
+  lambdaeff = lambda0;
+  par1 = -1. ;  
+  par2 = par3 = 0. ;  
+
+  //  do the true -> geom transformation
+  zPathLength = tPathLength;
+
+  // z = t for very small tPathLength
+  if(tPathLength < tlimitminfix) return zPathLength;
+
+  // this correction needed to run MSC with eIoni and eBrem inactivated
+  // and makes no harm for a normal run
+  if(tPathLength > currentRange)
+    tPathLength = currentRange ;
+
+  G4double tau   = tPathLength/lambda0 ;
+
+  if ((tau <= tausmall) || insideskin) {
+    zPathLength  = tPathLength;
+    if(zPathLength > lambda0) zPathLength = lambda0;
+    return zPathLength;
+  }
+
+  G4double zmean = tPathLength;
+  if (tPathLength < currentRange*dtrl) {
+    if(tau < taulim) zmean = tPathLength*(1.-0.5*tau) ;
+    else             zmean = lambda0*(1.-exp(-tau));
+  } else if(currentKinEnergy < mass)  {
+    par1 = 1./currentRange ;
+    par2 = 1./(par1*lambda0) ;
+    par3 = 1.+par2 ;
+    if(tPathLength < currentRange)
+      zmean = (1.-exp(par3*log(1.-tPathLength/currentRange)))/(par1*par3) ;
+    else
+      zmean = 1./(par1*par3) ;
+  } else {
+    G4double T1 = theManager->GetEnergy(particle,currentRange-tPathLength,couple);
+    G4double lambda1 = GetLambda(T1);
+
+    par1 = (lambda0-lambda1)/(lambda0*tPathLength) ;
+    par2 = 1./(par1*lambda0) ;
+    par3 = 1.+par2 ;
+    zmean = (1.-exp(par3*log(lambda1/lambda0)))/(par1*par3) ;
+  }
+
+  zPathLength = zmean ;
+
+  //  sample z
+  if(samplez)
+  {
+    const G4double  ztmax = 0.99 ;
+    G4double zt = zmean/tPathLength ;
+
+    if (tPathLength > stepmin && zt < ztmax)              
+    {
+      G4double u,cz1;
+      if(zt >= third)
+      {
+        G4double cz = 0.5*(3.*zt-1.)/(1.-zt) ;
+        cz1 = 1.+cz ;
+        G4double u0 = cz/cz1 ;
+        G4double grej ;
+        do {
+            u = exp(log(G4UniformRand())/cz1) ;
+            grej = exp(cz*log(u/u0))*(1.-u)/(1.-u0) ;
+           } while (grej < G4UniformRand()) ;
+      }
+      else
+      {
+        cz1 = 1./zt-1.;
+        u = 1.-exp(log(G4UniformRand())/cz1) ;
+      }
+      zPathLength = tPathLength*u ;
+    }
+  }
+
+  if(zPathLength > lambda0) zPathLength = lambda0;
+  //G4cout << "zPathLength= " << zPathLength << " lambda1= " << lambda0 << G4endl;
+  return zPathLength;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+G4double G4UrbanMscModel93::ComputeTrueStepLength(G4double geomStepLength)
+{
+  // step defined other than transportation 
+  if(geomStepLength == zPathLength && tPathLength <= currentRange)
+    return tPathLength;
+
+  // t = z for very small step
+  zPathLength = geomStepLength;
+  tPathLength = geomStepLength;
+  if(geomStepLength < tlimitminfix) return tPathLength;
+  
+  // recalculation
+  if((geomStepLength > lambda0*tausmall) && !insideskin)
+  {
+    if(par1 <  0.)
+      tPathLength = -lambda0*log(1.-geomStepLength/lambda0) ;
+    else 
+    {
+      if(par1*par3*geomStepLength < 1.)
+        tPathLength = (1.-exp(log(1.-par1*par3*geomStepLength)/par3))/par1 ;
+      else 
+        tPathLength = currentRange;
+    }  
+  }
+  if(tPathLength < geomStepLength) tPathLength = geomStepLength;
+  //G4cout << "tPathLength= " << tPathLength << " step= " << geomStepLength << G4endl;
+
+  return tPathLength;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+G4double G4UrbanMscModel93::ComputeTheta0(G4double trueStepLength,
+					  G4double KineticEnergy)
+{
+  // for all particles take the width of the central part
+  //  from a  parametrization similar to the Highland formula
+  // ( Highland formula: Particle Physics Booklet, July 2002, eq. 26.10)
+  const G4double c_highland = 13.6*MeV ;
+  G4double betacp = sqrt(currentKinEnergy*(currentKinEnergy+2.*mass)*
+                         KineticEnergy*(KineticEnergy+2.*mass)/
+                      ((currentKinEnergy+mass)*(KineticEnergy+mass)));
+  y = trueStepLength/currentRadLength;
+  G4double theta0 = c_highland*std::abs(charge)*sqrt(y)/betacp;
+  y = log(y);
+  // correction factor from e- scattering data
+  G4double corr = coeffth1+coeffth2*y;                
+
+  theta0 *= corr ;                                               
+
+  return theta0;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+void G4UrbanMscModel93::SampleScattering(const G4DynamicParticle* dynParticle,
+					 G4double safety)
+{
+  G4double kineticEnergy = dynParticle->GetKineticEnergy();
+
+  if((kineticEnergy <= 0.0) || (tPathLength <= tlimitminfix) ||
+     (tPathLength/tausmall < lambda0)) return;
+
+  G4double cth  = SampleCosineTheta(tPathLength,kineticEnergy);
+
+  // protection against 'bad' cth values
+  if(std::abs(cth) > 1.) return;
+
+  G4double sth  = sqrt((1.0 - cth)*(1.0 + cth));
+  G4double phi  = twopi*G4UniformRand();
+  G4double dirx = sth*cos(phi);
+  G4double diry = sth*sin(phi);
+
+  G4ThreeVector oldDirection = dynParticle->GetMomentumDirection();
+  G4ThreeVector newDirection(dirx,diry,cth);
+  newDirection.rotateUz(oldDirection);
+  fParticleChange->ProposeMomentumDirection(newDirection);
+
+  if (latDisplasment && safety > tlimitminfix) {
+
+    G4double r = SampleDisplacement();
+    /*    
+    G4cout << "G4UrbanMscModel93::SampleSecondaries: e(MeV)= " << kineticEnergy
+	   << " sinTheta= " << sth << " r(mm)= " << r
+           << " trueStep(mm)= " << tPathLength
+           << " geomStep(mm)= " << zPathLength
+           << G4endl;
+    */
+    if(r > 0.)
+      {
+        G4double latcorr = LatCorrelation();
+        if(latcorr > r) latcorr = r;
+
+        // sample direction of lateral displacement
+        // compute it from the lateral correlation
+        G4double Phi = 0.;
+        if(std::abs(r*sth) < latcorr)
+          Phi  = twopi*G4UniformRand();
+        else
+        {
+          G4double psi = std::acos(latcorr/(r*sth));
+          if(G4UniformRand() < 0.5)
+            Phi = phi+psi;
+          else
+            Phi = phi-psi;
+        }
+
+        dirx = std::cos(Phi);
+        diry = std::sin(Phi);
+
+        G4ThreeVector latDirection(dirx,diry,0.0);
+        latDirection.rotateUz(oldDirection);
+
+	ComputeDisplacement(fParticleChange, latDirection, r, safety);
+      }
+  }
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+G4double G4UrbanMscModel93::SampleCosineTheta(G4double trueStepLength,
+					      G4double KineticEnergy)
+{
+  G4double cth = 1. ;
+  G4double tau = trueStepLength/lambda0 ;
+
+  Zeff = couple->GetMaterial()->GetTotNbOfElectPerVolume()/
+         couple->GetMaterial()->GetTotNbOfAtomsPerVolume() ;
+
+  if(Zold != Zeff)  
+    UpdateCache();
+
+  if(insideskin)
+  {
+    //no scattering, single or plural scattering
+    G4double mean = trueStepLength/stepmin ;
+
+    G4int n = G4Poisson(mean);
+    if(n > 0)
+    {
+      //screening (Moliere-Bethe)
+      G4double mom2 = KineticEnergy*(2.*mass+KineticEnergy);
+      G4double beta2 = mom2/((KineticEnergy+mass)*(KineticEnergy+mass));
+      G4double ascr = scr1/mom2;
+      ascr *= 1.13+scr2/beta2;
+      G4double ascr1 = 1.+2.*ascr;
+      G4double bp1=ascr1+1.;
+      G4double bm1=ascr1-1.;
+
+      // single scattering from screened Rutherford x-section
+      G4double ct,st,phi;
+      G4double sx=0.,sy=0.,sz=0.;
+      for(G4int i=1; i<=n; i++)
+      {
+        ct = ascr1-bp1*bm1/(2.*G4UniformRand()+bm1);
+        if(ct < -1.) ct = -1.;
+        if(ct >  1.) ct =  1.; 
+        st = sqrt(1.-ct*ct);
+        phi = twopi*G4UniformRand();
+        sx += st*cos(phi);
+        sy += st*sin(phi);
+        sz += ct;
+      }
+      cth = sz/sqrt(sx*sx+sy*sy+sz*sz);
+    }
+  }
+  else
+  {
+    if(trueStepLength >= currentRange*dtrl) 
+    {
+      if(par1*trueStepLength < 1.)
+	tau = -par2*log(1.-par1*trueStepLength) ;
+      // for the case if ioni/brems are inactivated
+      // see the corresponding condition in ComputeGeomPathLength 
+      else if(1.-KineticEnergy/currentKinEnergy > taulim)
+	tau = taubig ;
+    }
+    currentTau = tau ;
+    lambdaeff = trueStepLength/currentTau;
+    currentRadLength = couple->GetMaterial()->GetRadlen();
+
+    if (tau >= taubig) cth = -1.+2.*G4UniformRand();
+    else if (tau >= tausmall)
+    {
+      G4double xsi = 3.;
+      G4double x0 = 1.;
+      G4double a = 1., ea = 0., eaa = 1.;
+      G4double b=2.,b1=3.,bx=1.,eb1=3.,ebx=1.;
+      G4double prob = 1. , qprob = 1. ;
+      G4double xmean1 = 1., xmean2 = 0.;
+      G4double xmeanth = exp(-tau);
+      G4double x2meanth = (1.+2.*exp(-2.5*tau))/3.;
+
+      G4double relloss = 1.-KineticEnergy/currentKinEnergy;
+      if(relloss > rellossmax) 
+        return SimpleScattering(xmeanth,x2meanth);
+
+      G4double theta0 = ComputeTheta0(trueStepLength,KineticEnergy);
+
+      // protection for very small angles
+      if(theta0 < tausmall) return cth;
+    
+      if(theta0 > theta0max)
+        return SimpleScattering(xmeanth,x2meanth);
+      G4double sth = sin(0.5*theta0);
+      a = 0.25/(sth*sth);
+
+      ea = exp(-xsi);
+      eaa = 1.-ea ;
+      xmean1 = 1.-(1.-(1.+xsi)*ea)/(a*eaa);
+      x0 = 1.-xsi/a;
+
+      if(xmean1 <= 0.999*xmeanth)
+        return SimpleScattering(xmeanth,x2meanth);
+
+      // from e- and muon scattering data                    
+      G4double c = coeffc1+coeffc2*y; ;                         
+
+      if(abs(c-3.) < 0.001)  c = 3.001;      
+      if(abs(c-2.) < 0.001)  c = 2.001;      
+      if(abs(c-1.) < 0.001)  c = 1.001;      
+
+      G4double c1 = c-1.;
+
+      //from continuity of derivatives
+      b = 1.+(c-xsi)/a;
+
+      b1 = b+1.;
+      bx = c/a;
+      eb1 = exp(c1*log(b1));
+      ebx = exp(c1*log(bx));
+
+      xmean2 = (x0*eb1+ebx-(eb1*bx-b1*ebx)/(c-2.))/(eb1-ebx);
+      
+      G4double f1x0 = a*ea/eaa;
+      G4double f2x0 = c1*eb1/(bx*(eb1-ebx));
+      prob = f2x0/(f1x0+f2x0);
+
+      qprob = xmeanth/(prob*xmean1+(1.-prob)*xmean2);
+
+      // sampling of costheta
+      if(G4UniformRand() < qprob)
+      {
+        if(G4UniformRand() < prob)
+          cth = 1.+log(ea+G4UniformRand()*eaa)/a ;
+        else
+          cth = b-b1*bx/exp(log(ebx+(eb1-ebx)*G4UniformRand())/c1) ;
+      }
+      else
+        cth = -1.+2.*G4UniformRand();
+    }
+  }  
+  return cth ;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+G4double G4UrbanMscModel93::SimpleScattering(G4double xmeanth,G4double x2meanth)
+{
+  // 'large angle scattering'
+  // 2 model functions with correct xmean and x2mean
+  G4double a = (2.*xmeanth+9.*x2meanth-3.)/(2.*xmeanth-3.*x2meanth+1.);
+  G4double prob = (a+2.)*xmeanth/a;
+
+  // sampling
+  G4double cth = 1.;
+  if(G4UniformRand() < prob)
+    cth = -1.+2.*exp(log(G4UniformRand())/(a+1.));
+  else
+    cth = -1.+2.*G4UniformRand();
+  return cth;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+G4double G4UrbanMscModel93::SampleDisplacement()
+{
+  const G4double kappa = 2.5;
+  const G4double kappapl1 = kappa+1.;
+  const G4double kappami1 = kappa-1.;
+  G4double rmean = 0.0;
+  if ((currentTau >= tausmall) && !insideskin) {
+    if (currentTau < taulim) {
+      rmean = kappa*currentTau*currentTau*currentTau*
+             (1.-kappapl1*currentTau*0.25)/6. ;
+
+    } else {
+      G4double etau = 0.0;
+      if (currentTau<taubig) etau = exp(-currentTau);
+      rmean = -kappa*currentTau;
+      rmean = -exp(rmean)/(kappa*kappami1);
+      rmean += currentTau-kappapl1/kappa+kappa*etau/kappami1;
+    }
+    if (rmean>0.) rmean = 2.*lambdaeff*sqrt(rmean/3.0);
+    else          rmean = 0.;
+  }
+
+  // protection against z > t ...........................
+  if(rmean > 0.) {
+    G4double zt = (tPathLength-zPathLength)*(tPathLength+zPathLength);
+    if(zt <= 0.)
+      rmean = 0.;
+    else if(rmean*rmean > zt)
+      rmean = sqrt(zt);
+  }
+  return rmean;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+
+G4double G4UrbanMscModel93::LatCorrelation()
+{
+  const G4double kappa = 2.5;
+  const G4double kappami1 = kappa-1.;
+
+  G4double latcorr = 0.;
+  if((currentTau >= tausmall) && !insideskin)
+  {
+    if(currentTau < taulim)
+      latcorr = lambdaeff*kappa*currentTau*currentTau*
+                (1.-(kappa+1.)*currentTau/3.)/3.;
+    else
+    {
+      G4double etau = 0.;
+      if(currentTau < taubig) etau = exp(-currentTau);
+      latcorr = -kappa*currentTau;
+      latcorr = exp(latcorr)/kappami1;
+      latcorr += 1.-kappa*etau/kappami1 ;
+      latcorr *= 2.*lambdaeff/3. ;
+    }
+  }
+
+  return latcorr;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Index: trunk/source/processes/electromagnetic/standard/src/G4alphaIonisation.cc
===================================================================
--- trunk/source/processes/electromagnetic/standard/src/G4alphaIonisation.cc	(revision 1197)
+++ trunk/source/processes/electromagnetic/standard/src/G4alphaIonisation.cc	(revision 1197)
@@ -0,0 +1,158 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4alphaIonisation.cc,v 1.1 2009/11/10 11:50:30 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
+//
+// -------------------------------------------------------------------
+//
+// GEANT4 Class file
+//
+//
+// File name:     G4alphaIonisation
+//
+// Author:        Vladimir Ivanchenko
+//
+// Creation date: 28.10.2009 created from G4ionIonisation
+//
+// Modifications:
+//
+//
+//
+// -------------------------------------------------------------------
+//
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+#include "G4alphaIonisation.hh"
+#include "G4Electron.hh"
+#include "G4Alpha.hh"
+#include "G4BraggIonModel.hh"
+#include "G4BetheBlochModel.hh"
+#include "G4UnitsTable.hh"
+#include "G4LossTableManager.hh"
+#include "G4IonFluctuations.hh"
+#include "G4UniversalFluctuation.hh"
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+using namespace std;
+
+G4alphaIonisation::G4alphaIonisation(const G4String& name)
+  : G4VEnergyLossProcess(name),
+    theParticle(0),
+    isInitialised(false),
+    nuclearStopping(true)
+{
+  //  SetLinearLossLimit(0.15);
+  SetStepFunction(0.2, 0.1*mm);
+  //  SetIntegral(true);
+  SetProcessSubType(fIonisation);
+  //  SetVerboseLevel(1);
+  mass = 0.0;
+  ratio = 0.0;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+G4alphaIonisation::~G4alphaIonisation()
+{}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+G4bool G4alphaIonisation::IsApplicable(const G4ParticleDefinition& p)
+{
+  return (p.GetPDGCharge() == 2*eplus);
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+G4double G4alphaIonisation::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 G4alphaIonisation::InitialiseEnergyLossProcess(
+		      const G4ParticleDefinition* part,
+		      const G4ParticleDefinition* bpart)
+{
+  if(!isInitialised) {
+
+    theParticle = part;
+    G4String pname = part->GetParticleName();
+
+    // define base particle
+    const G4ParticleDefinition* theBaseParticle = 0;
+    if(bpart == 0) { 
+      if(pname != "alpha") { theBaseParticle = G4Alpha::Alpha(); }
+    } else { theBaseParticle = bpart; }
+
+    mass  = part->GetPDGMass();
+    ratio = electron_mass_c2/mass;
+
+    SetBaseParticle(theBaseParticle);
+    SetSecondaryParticle(G4Electron::Electron());
+
+    if (!EmModel(1)) SetEmModel(new G4BraggIonModel(), 1);
+    EmModel(1)->SetLowEnergyLimit(MinKinEnergy());
+
+    // model limit defined for alpha
+    eth = (EmModel(1)->HighEnergyLimit())*mass/proton_mass_c2;
+    EmModel(1)->SetHighEnergyLimit(eth);
+
+    if (!FluctModel()) SetFluctModel(new G4UniversalFluctuation());
+    AddEmModel(1, EmModel(1), new G4IonFluctuations());
+
+    if (!EmModel(2)) SetEmModel(new G4BetheBlochModel(),2);  
+    EmModel(2)->SetLowEnergyLimit(eth);
+    EmModel(2)->SetHighEnergyLimit(MaxKinEnergy());
+    AddEmModel(2, EmModel(2), FluctModel());    
+
+    isInitialised = true;
+  }
+  // reinitialisation of corrections for the new run
+  EmModel(1)->ActivateNuclearStopping(nuclearStopping);
+  EmModel(2)->ActivateNuclearStopping(nuclearStopping);
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+void G4alphaIonisation::PrintInfo()
+{
+  if (G4Alpha::Alpha() == theParticle) {
+    if(EmModel(1) && EmModel(2)) {
+      G4cout << "      NuclearStopping= " << nuclearStopping
+	     << G4endl;
+    }
+  }
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Index: trunk/source/processes/electromagnetic/utils/include/G4AtomicShell.hh
===================================================================
--- trunk/source/processes/electromagnetic/utils/include/G4AtomicShell.hh	(revision 1197)
+++ trunk/source/processes/electromagnetic/utils/include/G4AtomicShell.hh	(revision 1197)
@@ -0,0 +1,92 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4AtomicShell.hh,v 1.1 2009/07/24 17:22:32 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
+//
+// -------------------------------------------------------------------
+//
+// GEANT4 Class header file
+//
+//
+// Authors: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
+//          Alfonso Mantero (Alfonso.Mantero@ge.infn.it)
+//
+// History:
+// -----------
+//  
+//  16 Sept 2001 Modified according to a design iteration in the 
+//              LowEnergy category
+//  24 July 2009 Moved to utils subdirectory and make inline methods (VI) 
+//
+// -------------------------------------------------------------------
+
+// Class description:
+// A container of atomic shell data   
+
+// -------------------------------------------------------------------
+
+
+#ifndef G4AtomicShell_h 
+#define G4AtomicShell_h 1
+#include "globals.hh"
+
+class G4AtomicShell {
+
+public:
+
+  // The data and the methods of this class are relative to
+  // a given shell
+ 
+  G4AtomicShell(G4int id, G4double bindingEnergy);
+ 
+  ~G4AtomicShell();
+
+  // Returns the binding energy of the shell
+  inline G4double BindingEnergy() const; 
+
+  // Returns the id of the shell
+  inline G4int ShellId() const;
+
+private:
+  
+  G4int identifier;
+  G4double bindingEnergy;
+
+};
+
+inline G4double G4AtomicShell::BindingEnergy() const {
+
+  return bindingEnergy;
+}
+
+inline G4int G4AtomicShell::ShellId() const{
+
+  return identifier;
+}
+
+#endif
+
+
Index: trunk/source/processes/electromagnetic/utils/include/G4VAtomDeexcitation.hh
===================================================================
--- trunk/source/processes/electromagnetic/utils/include/G4VAtomDeexcitation.hh	(revision 1197)
+++ trunk/source/processes/electromagnetic/utils/include/G4VAtomDeexcitation.hh	(revision 1197)
@@ -0,0 +1,152 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4VAtomDeexcitation.hh,v 1.1 2009/07/09 11:42:52 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
+//
+// -------------------------------------------------------------------
+//
+// GEANT4 Class header file
+//
+//
+// File name:     G4VAtomDeexcitation
+//
+// Author:        Alfonso Mantero & Vladimir Ivanchenko
+//
+// Creation date: 30.06.2009
+//
+// Modifications:
+//
+// Class Description:
+//
+// Abstract interface to energy loss models
+
+// -------------------------------------------------------------------
+//
+
+#ifndef G4VAtomDeexcitation_h
+#define G4VAtomDeexcitation_h 1
+
+#include "globals.hh"
+#include <vector>
+
+class G4AtomicShell;
+class G4ParticleDefinition;
+class G4DynamicParticle;
+
+class G4VAtomDeexcitation {
+
+  G4VAtomDeexcitation(const G4String& pname = "");
+
+  virtual ~G4VAtomDeexcitation();
+
+  //initialization
+  virtual void PreparePhysicsTable(const G4ParticleDefinition&);
+  virtual void BuildPhysicsTable(const G4ParticleDefinition&);
+
+  // Get atomic shell by shell index, used by discrete processes 
+  // (for example, photoelectric), when shell vacancy sampled by the model
+  virtual const G4AtomicChell* GetAtomicShell(G4int Z, G4int ShellIndex);
+
+  // selection of random shell for ionisation process
+  virtual const G4AtomicShell* SelectRandomShell(const G4DynamicParticle*, 
+						 G4int Z);
+
+  // generation of deexcitation for given atom and shell vacancy
+  virtual void GenerateParticles(std::vector<G4DynamicParticle*>*, 
+				 const G4AtomicChell*, G4int Z);
+
+  // access or compute PIXE cross section 
+  virtual G4double GetPIXECrossSection (const G4ParticleDefinition*, 
+					G4int Z, G4double kinE);
+
+  // calculate PIXE cross section from the models
+  virtual G4double CalculatePIXECrossSection(const G4ParticleDefinition*,
+					     G4int Z, G4double kinE);
+
+  // Sampling of PIXE for ionisation processes
+  virtual void 
+  AlongStepDeexcitation(std::vector<G4DynamicParticle*>* secVect, 
+			const G4DynamicParticle* icidentParticle, 
+			const G4MaterialCutsCouple*, 
+			G4double trueStepLenght, 
+			G4double eLoss);
+
+  // Check if deexcitation is active for a given geometry volume
+  G4bool CheckActiveRegion(G4int coupleIndex);
+
+  // Access flags defined in the CheckActiveVolume method
+  inline G4bool IsFluorescenceActive() const; 
+  inline G4bool IsPIXECrossSectionActive() const; 
+
+  // PIXE model name
+  inline void SetPIXECrossSectionModel(const G4String&);
+  inline const G4String& PIXECrossSectionModel() const;
+
+  // Activation of deexcitation per detector region
+  void SetFluorescenceActiveRegion(const G4Region* region = 0);
+  void SetAugerActiveRegion(const G4Region* region = 0);
+  void SetPIXECrossSectionActiveRegion(const G4Region* region = 0); 
+
+  void SetFluorescenceActiveRegion(const G4String& rname = "");
+  void SetAugerActiveRegion(const G4String& rname = "");
+  void SetPIXECrossSectionActiveRegion(const G4String& rname = ""); 
+
+private:
+
+  // copy constructor and hide assignment operator
+  G4VAtomDeexcitation(G4VAtomDeexcitation &);
+  G4VAtomDeexcitation & operator=(const G4VAtomDeexcitation &right);
+
+  G4String namePIXE;
+  G4bool isFluoActive;
+  G4bool isPIXEActive;
+
+};
+
+inline G4bool IsFluorescenceActive() const
+{
+  return isFluoActive;
+}
+
+inline G4bool IsPIXECrossSectionActive() const 
+{
+  return isPIXEActive;
+}
+
+inline 
+void G4VAtomDeexcitation::SetPIXECrossSectionModel(const G4String& n)
+{
+  namePIXE = n;
+}
+
+inline 
+const G4String& G4VAtomDeexcitation::PIXECrossSectionModel() const
+{
+  return namePIXE;
+}
+
+#endif
+
Index: trunk/source/processes/electromagnetic/utils/src/G4AtomicShell.cc
===================================================================
--- trunk/source/processes/electromagnetic/utils/src/G4AtomicShell.cc	(revision 1197)
+++ trunk/source/processes/electromagnetic/utils/src/G4AtomicShell.cc	(revision 1197)
@@ -0,0 +1,50 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4AtomicShell.cc,v 1.2 ????
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
+//
+// Authors: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
+//          Alfonso Mantero (Alfonso.Mantero@ge.infn.it)
+//
+// History:
+// -----------
+//  16 Sept 2001 EG  Modified according to a design iteration in the 
+//                   LowEnergy category
+//
+// -------------------------------------------------------------------
+
+#include "G4AtomicShell.hh"
+
+G4AtomicShell::G4AtomicShell(G4int id, G4double energy)
+{
+  identifier = id;
+  bindingEnergy = energy;
+} 
+
+G4AtomicShell::~G4AtomicShell()
+{}
+
