Index: trunk/source/processes/hadronic/management/include/G4EnergyRangeManager.hh
===================================================================
--- trunk/source/processes/hadronic/management/include/G4EnergyRangeManager.hh	(revision 819)
+++ trunk/source/processes/hadronic/management/include/G4EnergyRangeManager.hh	(revision 962)
@@ -26,5 +26,5 @@
 //
 // $Id: G4EnergyRangeManager.hh,v 1.9 2006/06/29 19:58:05 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
  // Hadronic Process: Energy Range Manager
Index: trunk/source/processes/hadronic/management/include/G4HadLeadBias.hh
===================================================================
--- trunk/source/processes/hadronic/management/include/G4HadLeadBias.hh	(revision 819)
+++ trunk/source/processes/hadronic/management/include/G4HadLeadBias.hh	(revision 962)
@@ -24,5 +24,5 @@
 // ********************************************************************
 //
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // --------------------------------------------------------------------
Index: trunk/source/processes/hadronic/management/include/G4HadronInelasticProcess.hh
===================================================================
--- trunk/source/processes/hadronic/management/include/G4HadronInelasticProcess.hh	(revision 819)
+++ trunk/source/processes/hadronic/management/include/G4HadronInelasticProcess.hh	(revision 962)
@@ -43,38 +43,23 @@
 
 #include "G4HadronicProcess.hh"
-//#include "G4LPhysicsFreeVector.hh"
-#include "G4HadronCrossSections.hh" 
-#include "G4CrossSectionDataStore.hh"
-#include "G4HadronInelasticDataSet.hh"
-#include "G4ParticleChange.hh"
- 
 
- class G4HadronInelasticProcess : public G4HadronicProcess
- {
- public:
+class G4ParticleDefinition;
+
+class G4HadronInelasticProcess : public G4HadronicProcess
+{
+public:
     
-    G4HadronInelasticProcess(
-     const G4String &processName,
-     G4ParticleDefinition *aParticle );
+  G4HadronInelasticProcess(const G4String &processName,
+			   G4ParticleDefinition *aParticle );
     
-    virtual ~G4HadronInelasticProcess();
+  virtual ~G4HadronInelasticProcess();
         
-    void BuildThePhysicsTable();
-    
-    G4bool IsApplicable(const G4ParticleDefinition& aP);
+  virtual G4bool IsApplicable(const G4ParticleDefinition& aParticleType);
 
-    G4VParticleChange *PostStepDoIt(const G4Track &aTrack, const G4Step &aStep);
+private:
 
-  private:    
+  G4ParticleDefinition* theParticle;
 
-    virtual G4double GetMicroscopicCrossSection( const G4DynamicParticle *aParticle, 
-                                                 const G4Element *anElement, 
-						 G4double aTemp );
-   
- protected:
-
-    G4ParticleDefinition *theParticle;
-    G4ParticleChange theParticleChange;
- };
+};
  
 #endif
Index: trunk/source/processes/hadronic/management/include/G4HadronicProcess.hh
===================================================================
--- trunk/source/processes/hadronic/management/include/G4HadronicProcess.hh	(revision 819)
+++ trunk/source/processes/hadronic/management/include/G4HadronicProcess.hh	(revision 962)
@@ -26,14 +26,12 @@
 //
 //
- // This is the top level Hadronic Process class
- // The inelastic, elastic, capture, and fission processes
- // should derive from this class
- // This is an abstract base class, since the pure virtual function
- // PostStepDoIt has not been defined yet.
- // Note:  there is no .cc file
- //
- // original by H.P.Wellisch
- // J.L. Chuma, TRIUMF, 10-Mar-1997
- // Last modified: 04-Apr-1997
+// This is the top level Hadronic Process class
+// The inelastic, elastic, capture, and fission processes
+// should derive from this class
+//
+// original by H.P.Wellisch
+// J.L. Chuma, TRIUMF, 10-Mar-1997
+// Last modified: 04-Apr-1997
+// 19-May-2008 V.Ivanchenko cleanup and added comments
  
 #ifndef G4HadronicProcess_h
@@ -50,8 +48,7 @@
 #include "G4VCrossSectionDataSet.hh"
 #include "G4VLeadingParticleBiasing.hh"
-#include "G4Delete.hh"
+//#include "G4Delete.hh"
 #include "G4CrossSectionDataStore.hh"
-#include "G4HadronicException.hh"
-
+#include "G4HadronicProcessType.hh"
 
 class G4Track;
@@ -60,181 +57,162 @@
 class G4ParticleChange;
 
- class G4HadronicProcess : public G4VDiscreteProcess
- {
- public:
-    
-    G4HadronicProcess( const G4String &processName = "Hadronic", 
-                       G4ProcessType   aType = fHadronic );    
-    virtual ~G4HadronicProcess();
-
-    void RegisterMe( G4HadronicInteraction *a );
-
-    void AddDataSet(G4VCrossSectionDataSet * aDataSet)
-    {
-       theCrossSectionDataStore->AddDataSet(aDataSet);
-    }
+class G4HadronicProcess : public G4VDiscreteProcess
+{
+public:
+    
+  G4HadronicProcess( const G4String &processName = "Hadronic", 
+		     G4ProcessType   aType = fHadronic );    
+
+  virtual ~G4HadronicProcess();
+
+  // register generator of secondaries
+  void RegisterMe( G4HadronicInteraction *a );
+
+  // get cross section per element
+  virtual 
+  G4double GetMicroscopicCrossSection(const G4DynamicParticle *aParticle, 
+				      const G4Element *anElement, 
+				      G4double aTemp );
+
+  // generic PostStepDoIt recommended for all derived classes
+  virtual G4VParticleChange* PostStepDoIt(const G4Track& aTrack, 
+					  const G4Step& aStep);
+
+  // initialisation of physics tables and G4HadronicProcessStore
+  virtual void PreparePhysicsTable(const G4ParticleDefinition&);
+
+  // build physics tables and print out the configuration of the process
+  virtual void BuildPhysicsTable(const G4ParticleDefinition&);
+
+  // dump physics tables 
+  inline void DumpPhysicsTable(const G4ParticleDefinition& p)
+  { theCrossSectionDataStore->DumpPhysicsTable(p); }
+
+  // add cross section data set
+  inline void AddDataSet(G4VCrossSectionDataSet * aDataSet)
+  { theCrossSectionDataStore->AddDataSet(aDataSet);}
+
+  // access to the manager
+  inline G4EnergyRangeManager *GetManagerPointer()
+  { return &theEnergyRangeManager; }
+          
+  // get inverse cross section per volume
+  G4double GetMeanFreePath(const G4Track &aTrack, G4double, 
+			   G4ForceCondition *);
+
+protected:    
+
+  // reset number of interaction length and save  
+  virtual void ResetNumberOfInteractionLengthLeft()
+  { G4VProcess::ResetNumberOfInteractionLengthLeft(); 
+    theInitialNumberOfInteractionLength = 
+      G4VProcess::theNumberOfInteractionLengthLeft;
+  }
+
+  // generic method to choose secondary generator 
+  // recommended for all derived classes
+  inline G4HadronicInteraction *ChooseHadronicInteraction(
+      G4double kineticEnergy, G4Material *aMaterial, G4Element *anElement )
+  { return theEnergyRangeManager.GetHadronicInteraction(kineticEnergy,
+							aMaterial,anElement);
+  }
+
+public:
+
+  // Methods for isotope production    
+  static void EnableIsotopeProductionGlobally();
+  static void DisableIsotopeProductionGlobally();
+    
+  void EnableIsotopeCounting()  {isoIsOnAnyway = 1;}
+  void DisableIsotopeCounting() {isoIsOnAnyway = -1;}
+    
+  void RegisterIsotopeProductionModel(G4VIsotopeProduction * aModel)
+  { theProductionModels.push_back(aModel); }
+
+  static G4IsoParticleChange * GetIsotopeProductionInfo();
+
+  void BiasCrossSectionByFactor(G4double aScale);
+    
+protected:
+            
+  // obsolete method will be removed
+  inline const G4EnergyRangeManager &GetEnergyRangeManager() const
+  { return theEnergyRangeManager; }
+    
+  // obsolete method will be removed
+  inline void SetEnergyRangeManager( const G4EnergyRangeManager &value )
+  { theEnergyRangeManager = value; }
+
+  // access to the chosen generator
+  inline G4HadronicInteraction *GetHadronicInteraction()
+  { return theInteraction; }
+    
+  // access to the cross section data store
+  inline G4CrossSectionDataStore* GetCrossSectionDataStore()
+  { return theCrossSectionDataStore; }
+   
+  // access to the cross section data set
+  inline G4double GetLastCrossSection() 
+  { return theLastCrossSection; }
+
+private:
+    
+  void FillTotalResult(G4HadFinalState * aR, const G4Track & aT);
+
+  G4HadFinalState * DoIsotopeCounting(G4HadFinalState * aResult,
+				      const G4Track & aTrack,
+				      const G4Nucleus & aNucleus);
+                                          
+  G4IsoResult * ExtractResidualNucleus(const G4Track & aTrack,
+				       const G4Nucleus & aNucleus,
+				       G4HadFinalState * aResult);
+
+  inline G4double GetTotalNumberOfInteractionLengthTraversed()
+  { return theInitialNumberOfInteractionLength
+      -G4VProcess::theNumberOfInteractionLengthLeft;
+  }
         
-    virtual G4VParticleChange *PostStepDoIt( const G4Track &aTrack, 
-                                            const G4Step &aStep ) = 0;
-        
-    virtual 
-    G4double GetMicroscopicCrossSection(const G4DynamicParticle *aParticle, 
-                                        const G4Element *anElement, 
-					G4double aTemp ) = 0;
-    
-    G4double GetMeanFreePath(const G4Track &aTrack, G4double, 
-                             G4ForceCondition *);
-
-    // Set methods for isotope production
-    
-    static void EnableIsotopeProductionGlobally();
-    static void DisableIsotopeProductionGlobally();
-    
-    void EnableIsotopeCounting()  {isoIsOnAnyway = 1;}
-    void DisableIsotopeCounting() {isoIsOnAnyway = -1;}
-    
-    void RegisterIsotopeProductionModel(G4VIsotopeProduction * aModel)
-    { theProductionModels.push_back(aModel); }
-
-    static G4IsoParticleChange * GetIsotopeProductionInfo() 
-    { 
-      G4IsoParticleChange * anIsoResult = theIsoResult;
-      if(theIsoResult) theOldIsoResult = theIsoResult;
-      theIsoResult = 0;
-      return anIsoResult;
-    }
-
-    void BiasCrossSectionByFactor(G4double aScale) 
-    {
-      xBiasOn = true;
-      aScaleFactor = aScale;
-      G4String it = GetProcessName(); 
-      if( (it != "PhotonInelastic") && 
-          (it != "ElectroNuclear") && 
-	  (it != "PositronNuclear") )
-      {
-        G4Exception("G4HadronicProcess", "007", FatalException,
-                    "Cross-section biasing available only for gamma and electro nuclear reactions.");
-      }
-      if(aScale<100)
-      {
-        G4Exception("G4HadronicProcess", "001", JustWarning,
-                    "Cross-section bias readjusted to be above safe limit. New value is 100");        
-        aScaleFactor = 100.;
-      }
-    }
-    
- protected:
-    
-    virtual void ResetNumberOfInteractionLengthLeft()
-    {
-      G4VProcess::theNumberOfInteractionLengthLeft =  
-                                         -std::log( G4UniformRand() );
-      theInitialNumberOfInteractionLength = 
-                                 G4VProcess::theNumberOfInteractionLengthLeft;
-    }
-
-    G4VParticleChange *GeneralPostStepDoIt( const G4Track &aTrack, 
-                                           const G4Step &aStep );
-    
-    void SetDispatch( G4HadronicProcess *value )
-    { dispatch=value; }
-    
-    G4Element* ChooseAandZ(const G4DynamicParticle *aParticle,
-                           const G4Material *aMaterial);
-
-    inline const G4EnergyRangeManager &GetEnergyRangeManager() const
-    { return theEnergyRangeManager; }
-    
-    inline void SetEnergyRangeManager( const G4EnergyRangeManager &value )
-    { theEnergyRangeManager = value; }
-
-    inline G4HadronicInteraction *ChooseHadronicInteraction(
-     G4double kineticEnergy, G4Material *aMaterial, G4Element *anElement )
-    {
-      G4EnergyRangeManager* ERMan = GetManagerPointer();
-      if(!ERMan->GetHadronicInteractionCounter())
-        G4cout<< "*G4HadronicProcess::ChooseHadronicInteraction: process = "
-              << GetProcessName() << ", nM=" 
-              << ERMan->GetHadronicInteractionCounter() << G4endl;
-      return ERMan->GetHadronicInteraction(kineticEnergy,aMaterial,anElement);
-    }
-
-    inline G4HadronicInteraction *GetHadronicInteraction()
-    { return theInteraction; }
-    
- public:
-    inline G4EnergyRangeManager *GetManagerPointer()
-    { return &theEnergyRangeManager; }
- protected:
-
-    G4CrossSectionDataStore* GetCrossSectionDataStore()
-    {
-       return theCrossSectionDataStore;
-    }
-   
-    G4double GetLastCrossSection() {return theLastCrossSection;}
- private:
-    
-    G4HadFinalState * DoIsotopeCounting(G4HadFinalState * aResult,
-                                          const G4Track & aTrack,
-                                          const G4Nucleus & aNucleus);
-                                          
-    G4IsoResult * ExtractResidualNucleus(const G4Track & aTrack,
-                                         const G4Nucleus & aNucleus,
-                                         G4HadFinalState * aResult);
-
-    G4double GetTotalNumberOfInteractionLengthTraversed()
-    {
-      return theInitialNumberOfInteractionLength
-            -G4VProcess::theNumberOfInteractionLengthLeft;
-    }
-    
-
-    void FillTotalResult(G4HadFinalState * aR, const G4Track & aT);
-    
-    void SetCrossSectionDataStore(G4CrossSectionDataStore* aDataStore)
-    {
-       theCrossSectionDataStore = aDataStore;
-    }
-    
-    G4double XBiasSurvivalProbability();
-    G4double XBiasSecondaryWeight();
-    
- private:
-    
-    G4EnergyRangeManager theEnergyRangeManager;
-    
-    G4HadronicInteraction *theInteraction;
-
-    G4CrossSectionDataStore* theCrossSectionDataStore;
- 
-    G4Nucleus targetNucleus;
-    
-    G4HadronicProcess *dispatch;
-
-// swiches for isotope production
-    
-    static G4bool isoIsEnabled; // true or false; local swich overrides
-    G4int isoIsOnAnyway; // true(1), false(-1) or default(0)
-    
-    G4IsoParticleChange theIsoPC;
-    std::vector<G4VIsotopeProduction *> theProductionModels;
-    
-    std::vector<G4VLeadingParticleBiasing *> theBias;
-
-    static G4IsoParticleChange* theIsoResult;
-    static G4IsoParticleChange* theOldIsoResult;
-    
-    G4ParticleChange* theTotalResult; 
-    
-    G4double theInitialNumberOfInteractionLength;   
-
-    G4double aScaleFactor;
-    G4bool xBiasOn;
-    G4double theLastCrossSection;
-
-    G4int ModelingState;
- };
+  //  inline void SetCrossSectionDataStore(G4CrossSectionDataStore* aDataStore)
+  //  { theCrossSectionDataStore = aDataStore; }
+    
+  G4double XBiasSurvivalProbability();
+  G4double XBiasSecondaryWeight();
+    
+private:
+    
+  G4EnergyRangeManager theEnergyRangeManager;
+    
+  G4HadronicInteraction *theInteraction;
+
+  G4CrossSectionDataStore* theCrossSectionDataStore;
+ 
+  G4Nucleus targetNucleus;
+    
+  G4HadronicProcess *dispatch;
+
+  bool G4HadronicProcess_debug_flag;
+
+  // swiches for isotope production    
+  static G4bool isoIsEnabled; // true or false; local swich overrides
+  G4int isoIsOnAnyway; // true(1), false(-1) or default(0)
+    
+  G4IsoParticleChange theIsoPC;
+  std::vector<G4VIsotopeProduction *> theProductionModels;
+    
+  std::vector<G4VLeadingParticleBiasing *> theBias;
+
+  static G4IsoParticleChange* theIsoResult;
+  static G4IsoParticleChange* theOldIsoResult;
+    
+  G4ParticleChange* theTotalResult; 
+    
+  G4double theInitialNumberOfInteractionLength;   
+
+  G4double aScaleFactor;
+  G4bool xBiasOn;
+  G4double theLastCrossSection;
+
+  G4int ModelingState;
+};
  
 #endif
Index: trunk/source/processes/hadronic/management/include/G4VLeadingParticleBiasing.hh
===================================================================
--- trunk/source/processes/hadronic/management/include/G4VLeadingParticleBiasing.hh	(revision 819)
+++ trunk/source/processes/hadronic/management/include/G4VLeadingParticleBiasing.hh	(revision 962)
@@ -25,5 +25,5 @@
 //
 // $Id: G4VLeadingParticleBiasing.hh,v 1.6 2006/06/29 19:58:19 gunter Exp $
-// GEANT4 tag $Name:  $
+// GEANT4 tag $Name: geant4-09-02-ref-02 $
 //
 // --------------------------------------------------------------------
