Index: trunk/source/processes/hadronic/models/util/include/G4Fragment.hh
===================================================================
--- trunk/source/processes/hadronic/models/util/include/G4Fragment.hh	(revision 1337)
+++ trunk/source/processes/hadronic/models/util/include/G4Fragment.hh	(revision 1340)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4Fragment.hh,v 1.11 2010/05/19 10:23:00 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-04-beta-01 $
+// $Id: G4Fragment.hh,v 1.16 2010/09/28 16:09:00 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-03-ref-09 $
 //
 //---------------------------------------------------------------------
@@ -41,29 +41,29 @@
 //            method which allowing to compute this value once and use 
 //            many times
+// 26.09.2010 V.Ivanchenko added number of protons, neutrons, proton holes
+//            and neutron holes as members of the class and Get/Set methods;
+//            removed not needed 'const'; removed old debug staff and unused
+//            private methods; add comments and reorder methods for 
+//            better reading
 
 #ifndef G4Fragment_h
 #define G4Fragment_h 1
 
-#include "G4ios.hh"
-#include <iomanip>
 #include <vector>
 
 #include "globals.hh"
 #include "G4LorentzVector.hh"
-//#include "G4ParticleMomentum.hh"
 #include "G4ThreeVector.hh"
 #include "G4NucleiProperties.hh"
-#include "G4ParticleTable.hh"
-#include "G4IonTable.hh"
+//#include "G4ParticleTable.hh"
+//#include "G4IonTable.hh"
 #include "Randomize.hh"
 #include "G4Proton.hh"
 #include "G4Neutron.hh"
-#include "G4HadronicException.hh"
 #include "G4HadTmpUtil.hh"
 
-
 class G4ParticleDefinition;
 
-class G4Fragment;     // Forward deckaration
+class G4Fragment;     
 typedef std::vector<G4Fragment*> G4FragmentVector;
 
@@ -84,8 +84,9 @@
 
   // A,Z and 4-momentum - main constructor for fragment
-  G4Fragment(const G4int A, const G4int Z, const G4LorentzVector& aMomentum);
-
-  // 4-momentum and pointer to G4particleDefinition (for gammas)
-  G4Fragment(const G4LorentzVector& aMomentum, G4ParticleDefinition * aParticleDefinition);
+  G4Fragment(G4int A, G4int Z, const G4LorentzVector& aMomentum);
+
+  // 4-momentum and pointer to G4particleDefinition (for gammas, e-)
+  G4Fragment(const G4LorentzVector& aMomentum, 
+	     G4ParticleDefinition* aParticleDefinition);
 
   // ============= OPERATORS ==================
@@ -98,11 +99,5 @@
   friend std::ostream& operator<<(std::ostream&, const G4Fragment&);
 
-  // ============= METHODS ==================
-
-  inline G4double GetA() const;
-  inline void SetA(const G4double value);
-  
-  inline G4double GetZ() const;
-  inline void SetZ(const G4double value);
+  // ============= GENERAL METHODS ==================
 
   inline G4int GetZ_asInt() const;
@@ -111,51 +106,63 @@
   
   inline G4double GetExcitationEnergy() const;
-  void SetExcitationEnergy(const G4double value);
-  
-  inline const G4LorentzVector& GetMomentum() const;
-  inline void SetMomentum(const G4LorentzVector& value);
-  
-  inline const G4ThreeVector& GetAngularMomentum() const;
-  inline void SetAngularMomentum(const G4ThreeVector& value);
-  
-  inline G4int GetNumberOfExcitons() const;
-  
-  inline G4int GetNumberOfHoles() const;
-  inline void SetNumberOfHoles(const G4int value);
-  
-  inline G4int GetNumberOfCharged() const;
-  void SetNumberOfCharged(const G4int value);
-
-  inline G4int GetNumberOfParticles() const;
-  inline void SetNumberOfParticles(const G4int value);
-
-  inline G4ParticleDefinition * GetParticleDefinition() const;
-  inline void SetParticleDefinition(G4ParticleDefinition * aParticleDefinition);
-
-  inline G4double GetCreationTime() const;
-  inline void SetCreationTime(const G4double time);
 
   inline G4double GetGroundStateMass() const;
    
   inline G4double GetBindingEnergy() const;
+  
+  inline const G4LorentzVector& GetMomentum() const;
+  inline void SetMomentum(const G4LorentzVector& value);
+  
+  inline const G4ThreeVector& GetAngularMomentum() const;
+  inline void SetAngularMomentum(const G4ThreeVector& value);
 
   // computation of mass for any Z and A
-  inline G4double ComputeGroundStateMass(const G4int Z, const G4int A) const;
-
-#ifdef PRECOMPOUND_TEST 
-  G4String GetCreatorModel() const;
-  void SetCreatorModel(const G4String & aModel); 
-#endif
+  inline G4double ComputeGroundStateMass(G4int Z, G4int A) const;
+
+  // obsolete methods
+  inline G4double GetZ() const;
+  inline G4double GetA() const;
+  inline void SetZ(G4double value);
+  inline void SetA(G4double value);
+  
+  // ============= METHODS FOR PRE-COMPOUND MODEL ===============
+
+  inline G4int GetNumberOfExcitons() const;
+  
+  inline G4int GetNumberOfParticles() const;
+  inline G4int GetNumberOfCharged() const;
+  inline void SetNumberOfExcitedParticle(G4int valueTot, G4int valueP);
+
+  inline G4int GetNumberOfHoles() const;
+  inline G4int GetNumberOfChargedHoles() const;
+  inline void SetNumberOfHoles(G4int valueTot, G4int valueP=0);
+  
+  // these methods will be removed in future
+  inline void SetNumberOfParticles(G4int value);
+  inline void SetNumberOfCharged(G4int value);
+
+  // ============= METHODS FOR PHOTON EVAPORATION ===============
+
+  inline G4int GetNumberOfElectrons() const;
+  inline void SetNumberOfElectrons(G4int value);
+
+  inline G4ParticleDefinition * GetParticleDefinition() const;
+  inline void SetParticleDefinition(G4ParticleDefinition * p);
+
+  inline G4double GetCreationTime() const;
+  inline void SetCreationTime(G4double time);
+
+  // ============= PRIVATE METHODS ==============================
 
 private:
 
-  void ExcitationEnegryWarning();
+  void ExcitationEnergyWarning();
+
+  void NumberOfExitationWarning(const G4String&);
+
+  inline void CalculateExcitationEnergy();
 
   inline void CalculateGroundStateMass();
 
-  inline void CalculateExcitationEnergy();
-
-  G4ThreeVector IsotropicRandom3Vector(const G4double Magnitude = 1.0) const;
-  
   // ============= DATA MEMBERS ==================
 
@@ -173,12 +180,18 @@
   
   G4ThreeVector theAngularMomentum;
+
+  // Exciton model data members
   
   G4int numberOfParticles;
   
+  G4int numberOfCharged;
+
   G4int numberOfHoles;
   
-  G4int numberOfCharged;
-
-  // Gamma evaporation requeriments
+  G4int numberOfChargedHoles;
+
+  // Gamma evaporation data members
+
+  G4int numberOfShellElectrons;
 
   G4ParticleDefinition * theParticleDefinition;
@@ -186,35 +199,17 @@
   G4double theCreationTime;
 
-#ifdef PRECOMPOUND_TEST 
-  G4String theCreatorModel;
-#endif 
 };
 
-// Class G4Fragment 
+// ============= INLINE METHOD IMPLEMENTATIONS ===================
+
+inline void G4Fragment::CalculateExcitationEnergy()
+{
+  theExcitationEnergy = theMomentum.mag() - theGroundStateMass;
+  if(theExcitationEnergy < 0.0) { ExcitationEnergyWarning(); }
+}
+	 
 inline void G4Fragment::CalculateGroundStateMass() 
 {
   theGroundStateMass = G4NucleiProperties::GetNuclearMass(theA, theZ);
-}
-
-inline G4double G4Fragment::GetA() const
-{
-  return G4double(theA);
-}
-
-inline void G4Fragment::SetA(const G4double value)
-{
-  theA = G4lrint(value);
-  CalculateGroundStateMass();
-}
-
-inline G4double G4Fragment::GetZ()  const
-{
-  return G4double(theZ);
-}
-
-inline void G4Fragment::SetZ(const G4double value)
-{
-  theZ = G4lrint(value);
-  CalculateGroundStateMass();
 }
 
@@ -238,87 +233,7 @@
 inline G4double G4Fragment::GetExcitationEnergy()  const
 {
-  // temporary fix for what seems to be
-  // a problem with rounding errors for on-shell lorentz-vectors in CLHEP.
-  // HPW Apr 1999 @@@@@@@ 
-  
-  //VI  if(std::abs(theExcitationEnergy)<10*eV) return 0; 
   return theExcitationEnergy;
 }
 
-inline const G4LorentzVector& G4Fragment::GetMomentum()  const
-{
-  return theMomentum;
-}
-
-inline const G4ThreeVector& G4Fragment::GetAngularMomentum()  const
-{
-  return theAngularMomentum;
-}
-
-inline void G4Fragment::SetAngularMomentum(const G4ThreeVector& value)
-{
-  theAngularMomentum = value;
-}
-
-inline G4int G4Fragment::GetNumberOfExcitons()  const
-{
-  return numberOfParticles + numberOfHoles;
-}
-
-inline void G4Fragment::SetNumberOfParticles(const G4int value)
-{
-  numberOfParticles = value;
-}
-
-inline G4int G4Fragment::GetNumberOfHoles()  const
-{
-  return numberOfHoles;
-}
-
-inline void G4Fragment::SetNumberOfHoles(const G4int value)
-{
-  numberOfHoles = value;
-}
-
-inline G4int G4Fragment::GetNumberOfCharged()  const
-{
-  return numberOfCharged;
-}
-
-inline void G4Fragment::SetNumberOfCharged(const G4int value)
-{
-  if (value <= numberOfParticles) { numberOfCharged = value; }
-  else 
-  {
-    G4String text = "G4Fragment::SetNumberOfCharged: Number of charged particles can't be greater than number of particles";
-    throw G4HadronicException(__FILE__, __LINE__, text);
-  }
-}
-
-inline G4int G4Fragment::GetNumberOfParticles()  const
-{
-  return numberOfParticles;
-}
-
-inline G4ParticleDefinition * G4Fragment::GetParticleDefinition(void) const
-{
-  return theParticleDefinition;
-}
-
-inline void G4Fragment::SetParticleDefinition(G4ParticleDefinition * aParticleDefinition)
-{
-  theParticleDefinition = aParticleDefinition;
-}
-
-inline G4double G4Fragment::GetCreationTime() const 
-{
-  return theCreationTime;
-}
-
-inline void G4Fragment::SetCreationTime(const G4double time)
-{
-  theCreationTime = time;
-}
-
 inline G4double G4Fragment::GetGroundStateMass() const
 {
@@ -326,16 +241,4 @@
 }
 
-inline G4double 
-G4Fragment::ComputeGroundStateMass(const G4int Z, const G4int A) const
-{
-  return G4NucleiProperties::GetNuclearMass(A, Z); 
-}
-
-inline void G4Fragment::CalculateExcitationEnergy()
-{
-  theExcitationEnergy = theMomentum.mag() - theGroundStateMass;
-  if(theExcitationEnergy < 0.0) { ExcitationEnegryWarning(); }
-}
-	
 inline G4double G4Fragment::GetBindingEnergy() const
 {
@@ -344,4 +247,9 @@
 }
 
+inline const G4LorentzVector& G4Fragment::GetMomentum()  const
+{
+  return theMomentum;
+}
+
 inline void G4Fragment::SetMomentum(const G4LorentzVector& value)
 {
@@ -350,4 +258,130 @@
 }
 
+inline const G4ThreeVector& G4Fragment::GetAngularMomentum()  const
+{
+  return theAngularMomentum;
+}
+
+inline void G4Fragment::SetAngularMomentum(const G4ThreeVector& value)
+{
+  theAngularMomentum = value;
+}
+
+inline G4double 
+G4Fragment::ComputeGroundStateMass(G4int Z, G4int A) const
+{
+  return G4NucleiProperties::GetNuclearMass(A, Z); 
+}
+
+inline G4double G4Fragment::GetZ()  const
+{
+  return G4double(theZ);
+}
+
+inline G4double G4Fragment::GetA() const
+{
+  return G4double(theA);
+}
+
+inline void G4Fragment::SetZ(const G4double value)
+{
+  theZ = G4lrint(value);
+  CalculateGroundStateMass();
+}
+
+inline void G4Fragment::SetA(const G4double value)
+{
+  theA = G4lrint(value);
+  CalculateGroundStateMass();
+}
+
+inline G4int G4Fragment::GetNumberOfExcitons()  const
+{
+  return numberOfParticles + numberOfHoles;
+}
+
+inline G4int G4Fragment::GetNumberOfParticles()  const
+{
+  return numberOfParticles;
+}
+
+inline G4int G4Fragment::GetNumberOfCharged()  const
+{
+  return numberOfCharged;
+}
+
+inline 
+void G4Fragment::SetNumberOfExcitedParticle(G4int valueTot, G4int valueP)
+{
+  numberOfParticles = valueTot;
+  numberOfCharged = valueP;
+  if(valueTot < valueP)  { 
+    NumberOfExitationWarning("SetNumberOfExcitedParticle"); 
+  }
+}
+
+inline G4int G4Fragment::GetNumberOfHoles()  const
+{
+  return numberOfHoles;
+}
+
+inline G4int G4Fragment::GetNumberOfChargedHoles()  const
+{
+  return numberOfChargedHoles;
+}
+
+inline void G4Fragment::SetNumberOfHoles(G4int valueTot, G4int valueP)
+{
+  numberOfHoles = valueTot;
+  numberOfChargedHoles = valueP;
+  if(valueTot < valueP)  { 
+    NumberOfExitationWarning("SetNumberOfHoles"); 
+  }
+}
+
+inline void G4Fragment::SetNumberOfParticles(G4int value)
+{
+  numberOfParticles = value;
+}
+
+inline void G4Fragment::SetNumberOfCharged(G4int value)
+{
+  numberOfCharged = value;
+  if(value > numberOfParticles)  { 
+    NumberOfExitationWarning("SetNumberOfCharged"); 
+  }
+}
+
+inline G4int G4Fragment::GetNumberOfElectrons() const
+{
+  return numberOfShellElectrons;
+}
+
+inline void G4Fragment::SetNumberOfElectrons(G4int value)
+{
+  numberOfShellElectrons = value;
+}
+
+inline 
+G4ParticleDefinition * G4Fragment::GetParticleDefinition(void) const
+{
+  return theParticleDefinition;
+}
+
+inline void G4Fragment::SetParticleDefinition(G4ParticleDefinition * p)
+{
+  theParticleDefinition = p;
+}
+
+inline G4double G4Fragment::GetCreationTime() const 
+{
+  return theCreationTime;
+}
+
+inline void G4Fragment::SetCreationTime(G4double time)
+{
+  theCreationTime = time;
+}
+
 #endif
 
