Index: trunk/source/processes/hadronic/models/binary_cascade/History
===================================================================
--- trunk/source/processes/hadronic/models/binary_cascade/History	(revision 1228)
+++ trunk/source/processes/hadronic/models/binary_cascade/History	(revision 1340)
@@ -13,4 +13,18 @@
      * Please list in reverse chronological order (last date on top)
      ---------------------------------------------------------------
+
+8 Sep 2010, G.Folger		         had-binary-V09-03-02
+- Binary{LightIon}Cascade: use integer (A,Z) interface of nucleus
+- *Field.cc: use integer A,Z from G4V3DNucleus, and for G4FermiMomentum
+
+31-Aug-2010, V.Ivanchenko                had-binary-V09-03-01
+- G4GeneratorPrecompoundInterface - define default deexcitation with 
+                                    G4PreCompoundModel in the constructor
+                                    of the class
+
+28-Aug-2010, V.Ivanchenko                had-binary-V09-03-00
+- G4GeneratorPrecompoundInterface - minor cleanup as a part of PreCompound
+                                    model cleanup: use integer Z and A,
+                                    added pointers to proton and neutron
 
 4-Dec-2009, Gunter Folger                had-binary-V09-02-06
Index: trunk/source/processes/hadronic/models/binary_cascade/include/G4GeneratorPrecompoundInterface.hh
===================================================================
--- trunk/source/processes/hadronic/models/binary_cascade/include/G4GeneratorPrecompoundInterface.hh	(revision 1228)
+++ trunk/source/processes/hadronic/models/binary_cascade/include/G4GeneratorPrecompoundInterface.hh	(revision 1340)
@@ -24,17 +24,18 @@
 // ********************************************************************
 //
-
-#ifndef G4GeneratorPrecompoundInterface_h
-#define G4GeneratorPrecompoundInterface_h 1
-
-#include "G4Fancy3DNucleus.hh"
-#include "G4Nucleon.hh"
-#include "G4Nucleus.hh"
-#include "G4VIntraNuclearTransportModel.hh"
-#include "G4KineticTrackVector.hh"
-#include "G4FragmentVector.hh"
-#include "G4ReactionProductVector.hh"
-#include "G4ReactionProduct.hh"
-
+//
+// $Id: G4GeneratorPrecompoundInterface.hh,v 1.6 2010/08/31 16:16:51 vnivanch Exp $
+// GEANT4 tag $Name: had-binary-V09-03-03 $
+//
+// -----------------------------------------------------------------------------
+//      GEANT 4 class header file
+//
+//      History: first implementation
+//      HPW, 10DEC 98, the decay part originally written by Gunter Folger 
+//                in his FTF-test-program.
+//
+//
+// -----------------------------------------------------------------------------
+//
 // Class Description
 // Trivial implementation of an intra-nuclear transport. It pworvides coupling
@@ -43,22 +44,49 @@
 // Class Description - End
 
+#ifndef G4GeneratorPrecompoundInterface_h
+#define G4GeneratorPrecompoundInterface_h 1
+
+#include "G4VIntraNuclearTransportModel.hh"
+#include "G4ReactionProductVector.hh"
+#include "G4HadProjectile.hh"
+#include "G4Nucleus.hh"
+#include "globals.hh"
+
+class G4KineticTrackVector;
+class G4V3DNucleus;
+class G4ParticleDefinition;
+
 class G4GeneratorPrecompoundInterface : public G4VIntraNuclearTransportModel 
 {
 public:
-   G4GeneratorPrecompoundInterface();    
-   ~G4GeneratorPrecompoundInterface(){}
+
+  G4GeneratorPrecompoundInterface(G4VPreCompoundModel* p = 0);    
+  virtual ~G4GeneratorPrecompoundInterface();
+
+  virtual G4HadFinalState* 
+  ApplyYourself(const G4HadProjectile &aTrack, G4Nucleus &targetNucleus );
+
+  virtual G4ReactionProductVector* 
+  Propagate(G4KineticTrackVector* theSecondaries, G4V3DNucleus* theNucleus);
+ 
+  inline void SetCaptureThreshold(G4double);
 
 private:
-   G4int operator==(G4GeneratorPrecompoundInterface& right) {return (this == &right);}
-   G4int operator!=(G4GeneratorPrecompoundInterface& right) {return (this != &right);}
-      
-public:
-   G4HadFinalState * ApplyYourself(const G4HadProjectile &aTrack, G4Nucleus &targetNucleus );
-   G4ReactionProductVector* Propagate(G4KineticTrackVector* theSecondaries, G4V3DNucleus* theNucleus);
-   G4double SetCaptureThreshold(G4double);
 
-private:
-   G4double CaptureThreshold;   
+  G4GeneratorPrecompoundInterface(const G4GeneratorPrecompoundInterface& right);
+  const G4GeneratorPrecompoundInterface& operator=(const G4GeneratorPrecompoundInterface &right);
+  G4int operator==(G4GeneratorPrecompoundInterface& right) {return (this == &right);}
+  G4int operator!=(G4GeneratorPrecompoundInterface& right) {return (this != &right);}
+
+  G4double CaptureThreshold;
+  const G4ParticleDefinition* proton;
+  const G4ParticleDefinition* neutron;
 };
+
+inline 
+void G4GeneratorPrecompoundInterface::SetCaptureThreshold(G4double value)
+{
+  CaptureThreshold=value;
+}
 
 #endif // G4GeneratorPrecompoundInterface_h
Index: trunk/source/processes/hadronic/models/binary_cascade/include/G4NeutronField.hh
===================================================================
--- trunk/source/processes/hadronic/models/binary_cascade/include/G4NeutronField.hh	(revision 1228)
+++ trunk/source/processes/hadronic/models/binary_cascade/include/G4NeutronField.hh	(revision 1340)
@@ -77,6 +77,6 @@
 
   G4FermiMomentum theFermi;
-  G4double theA;
-  G4double theZ;
+  G4int theA;
+  G4int theZ;
   const G4VNuclearDensity * theDensity;
   G4double theR;
Index: trunk/source/processes/hadronic/models/binary_cascade/include/G4ProtonField.hh
===================================================================
--- trunk/source/processes/hadronic/models/binary_cascade/include/G4ProtonField.hh	(revision 1228)
+++ trunk/source/processes/hadronic/models/binary_cascade/include/G4ProtonField.hh	(revision 1340)
@@ -76,6 +76,6 @@
   }
   
-  G4double theA;
-  G4double theZ;
+  G4int theA;
+  G4int theZ;
   G4double theBarrier;
   G4double theRadius;
Index: trunk/source/processes/hadronic/models/binary_cascade/src/G4AntiProtonField.cc
===================================================================
--- trunk/source/processes/hadronic/models/binary_cascade/src/G4AntiProtonField.cc	(revision 1228)
+++ trunk/source/processes/hadronic/models/binary_cascade/src/G4AntiProtonField.cc	(revision 1340)
@@ -85,7 +85,7 @@
   G4double antiProtonMass = anAntiProton->GetPDGMass();
 
-  G4double A = theNucleus->GetMassNumber();
-  G4double Z = theNucleus->GetCharge();
-  G4double bindingEnergy = G4NucleiProperties::GetBindingEnergy(G4lrint(A), G4lrint(Z));
+  G4int A = theNucleus->GetMassNumber();
+  G4int Z = theNucleus->GetCharge();
+  G4double bindingEnergy = G4NucleiProperties::GetBindingEnergy(A, Z);
   G4double nucleusMass = Z*proton_mass_c2+(A-Z)*neutron_mass_c2+bindingEnergy;
   G4double reducedMass = antiProtonMass*nucleusMass/(antiProtonMass+nucleusMass);
@@ -99,6 +99,6 @@
 G4double G4AntiProtonField::GetBarrier()
 {
-  G4double A = theNucleus->GetMassNumber();
-  G4double Z = theNucleus->GetCharge();
+  G4int A = theNucleus->GetMassNumber();
+  G4int Z = theNucleus->GetCharge();
   G4double coulombBarrier = (1.44/1.14) * MeV * Z / (1.0 + std::pow(A,1./3.));
   return -coulombBarrier;
Index: trunk/source/processes/hadronic/models/binary_cascade/src/G4BinaryCascade.cc
===================================================================
--- trunk/source/processes/hadronic/models/binary_cascade/src/G4BinaryCascade.cc	(revision 1228)
+++ trunk/source/processes/hadronic/models/binary_cascade/src/G4BinaryCascade.cc	(revision 1340)
@@ -206,5 +206,5 @@
     }
 
-    the3DNucleus->Init(aNucleus.GetN(), aNucleus.GetZ());
+    the3DNucleus->Init(aNucleus.GetA_asInt(), aNucleus.GetZ_asInt());
     thePropagator->Init(the3DNucleus);
     //      GF Leak on kt??? but where to delete?
Index: trunk/source/processes/hadronic/models/binary_cascade/src/G4BinaryLightIonReaction.cc
===================================================================
--- trunk/source/processes/hadronic/models/binary_cascade/src/G4BinaryLightIonReaction.cc	(revision 1228)
+++ trunk/source/processes/hadronic/models/binary_cascade/src/G4BinaryLightIonReaction.cc	(revision 1340)
@@ -53,8 +53,8 @@
   if(getenv("BLICDEBUG") ) G4cerr << " ######### Binary Light Ion Reaction number starts ######### "<<eventcounter<<G4endl;
     G4ping debug("debug_G4BinaryLightIonReaction");
-    G4double a1=aTrack.GetDefinition()->GetBaryonNumber();
-    G4double z1=aTrack.GetDefinition()->GetPDGCharge();
-    G4double a2=targetNucleus.GetN();
-    G4double z2=targetNucleus.GetZ();
+    G4int a1=aTrack.GetDefinition()->GetBaryonNumber();
+    G4int z1=G4lrint(aTrack.GetDefinition()->GetPDGCharge());
+    G4int a2=targetNucleus.GetA_asInt();
+    G4int z2=targetNucleus.GetZ_asInt();
     debug.push_back(a1);
     debug.push_back(z1);
@@ -70,20 +70,12 @@
     if(a2<a1)
     {
-      debug.push_back("swapping....");
       swapped = true;
-      G4double tmp(0);
+      G4int tmp(0);
       tmp = a2; a2=a1; a1=tmp;
       tmp = z2; z2=z1; z1=tmp;
-      G4double m1=G4ParticleTable::GetParticleTable()->GetIonTable()->GetIonMass(G4lrint(z1),G4lrint(a1));
+      G4double m1=G4ParticleTable::GetParticleTable()->GetIonTable()->GetIonMass(z1,a1);
       G4LorentzVector it(m1, G4ThreeVector(0,0,0));
       mom = toBreit*it;
     }
-    debug.push_back("After swap");
-    debug.push_back(a1);
-    debug.push_back(z1);
-    debug.push_back(a2);
-    debug.push_back(z2);
-    debug.push_back(mom);
-    debug.dump();
 
     G4ReactionProductVector * result = NULL;
@@ -92,5 +84,5 @@
 
 
-//    G4double m1=G4ParticleTable::GetParticleTable()->GetIonTable()->GetIonMass(G4lrint(z1),G4lrint(a1));
+//    G4double m1=G4ParticleTable::GetParticleTable()->GetIonTable()->GetIonMass(z1,a1);
 //    G4cout << "Entering the decision point "
 //           << (mom.t()-mom.mag())/a1 << " "
@@ -107,9 +99,9 @@
       aPreFrag.SetA(a1+a2);
       aPreFrag.SetZ(z1+z2);
-      aPreFrag.SetNumberOfParticles(G4lrint(a1));
-      aPreFrag.SetNumberOfCharged(G4lrint(z1));
+      aPreFrag.SetNumberOfParticles(a1);
+      aPreFrag.SetNumberOfCharged(z1);
       aPreFrag.SetNumberOfHoles(0);
       G4ThreeVector plop(0.,0., mom.vect().mag());
-      G4double m2=G4ParticleTable::GetParticleTable()->GetIonTable()->GetIonMass(G4lrint(z2),G4lrint(a2));
+      G4double m2=G4ParticleTable::GetParticleTable()->GetIonTable()->GetIonMass(z2,a2);
       m_nucl=m2;
       G4LorentzVector aL(mom.t()+m2, plop);
@@ -117,5 +109,5 @@
       G4ParticleDefinition * preFragDef;
       preFragDef = G4ParticleTable::GetParticleTable()
-                      ->FindIon(G4lrint(z1+z2),G4lrint(a1+a2),0,G4lrint(z1+z2));  
+                      ->FindIon(z1+z2,a1+a2,0,z1+z2);  
       aPreFrag.SetParticleDefinition(preFragDef);
 
@@ -225,6 +217,6 @@
 	               << ", kinetic energy " << aTrack.GetKineticEnergy() 
 		       << G4endl;
-	      G4cerr << " Target nucleus (A,Z)=(" <<  targetNucleus.GetN()
-	               << "," << targetNucleus.GetZ() << G4endl;
+	      G4cerr << " Target nucleus (A,Z)=(" <<  targetNucleus.GetA_asInt()
+	               << "," << targetNucleus.GetZ_asInt() << G4endl;
 	      G4cerr << " if frequent, please submit above information as bug report"
   		      << G4endl << G4endl;
@@ -399,5 +391,5 @@
 	aProRes.SetNumberOfParticles(0);
 	aProRes.SetNumberOfCharged(0);
-	aProRes.SetNumberOfHoles(G4lrint(a1)-resA);
+	aProRes.SetNumberOfHoles(a1-resA);
 	G4double mFragment=G4ParticleTable::GetParticleTable()->GetIonTable()->GetIonMass(resZ,resA);
 	G4LorentzVector pFragment(0,0,0,mFragment+std::max(0.,theStatisticalExEnergy) );
@@ -420,6 +412,6 @@
 	            << ", kinetic energy " << aTrack.GetKineticEnergy() 
 		    << G4endl;
-	   G4cerr << " Target nucleus (A,Z)=(" <<  targetNucleus.GetN()
-	            << "," << targetNucleus.GetZ() << G4endl;
+	   G4cerr << " Target nucleus (A,Z)=(" <<  targetNucleus.GetA_asInt()
+	            << "," << targetNucleus.GetZ_asInt() << G4endl;
 	   G4cerr << " if frequent, please submit above information as bug report"
   	     	   << G4endl << G4endl;
Index: trunk/source/processes/hadronic/models/binary_cascade/src/G4GeneratorPrecompoundInterface.cc
===================================================================
--- trunk/source/processes/hadronic/models/binary_cascade/src/G4GeneratorPrecompoundInterface.cc	(revision 1228)
+++ trunk/source/processes/hadronic/models/binary_cascade/src/G4GeneratorPrecompoundInterface.cc	(revision 1340)
@@ -24,176 +24,175 @@
 // ********************************************************************
 //
+// $Id: G4GeneratorPrecompoundInterface.cc,v 1.10 2010/08/31 16:16:51 vnivanch Exp $
+// GEANT4 tag $Name: had-binary-V09-03-03 $
+//
+// -----------------------------------------------------------------------------
+//      GEANT 4 class file
+//
+//      History: first implementation
+//      HPW, 10DEC 98, the decay part originally written by Gunter Folger 
+//                in his FTF-test-program.
+//
+//
+// -----------------------------------------------------------------------------
+
 #include "G4GeneratorPrecompoundInterface.hh"
 #include "G4DynamicParticleVector.hh"
-#include "G4IonTable.hh"
+#include "G4KineticTrackVector.hh"
+#include "G4Proton.hh"
+#include "G4Neutron.hh"
+#include "G4V3DNucleus.hh"
+#include "G4Nucleon.hh"
+#include "G4FragmentVector.hh"
+#include "G4ReactionProduct.hh"
+#include "G4PreCompoundModel.hh"
+#include "G4ExcitationHandler.hh"
 
-//
-// HPW, 10DEC 98, the decay part originally written by Gunter Folger in his FTF-test-program.
-//
-   
-    G4GeneratorPrecompoundInterface::G4GeneratorPrecompoundInterface()
-    : CaptureThreshold(80*MeV)
-    {}
-      
-   G4HadFinalState* G4GeneratorPrecompoundInterface::
-   ApplyYourself(const G4HadProjectile &, G4Nucleus & )
-   {
-     std::cout << "G4GeneratorPrecompoundInterface: ApplyYourself interface called stand-allone."<< G4endl;
-     std::cout << "This class is only a mediator between generator and precompound"<<G4endl;
-     std::cout << "Please remove from your physics list."<<G4endl;
-     throw G4HadronicException(__FILE__, __LINE__, "SEVERE: G4GeneratorPrecompoundInterface model interface called stand-allone.");
-     return new G4HadFinalState;
-   }
-   
-   G4ReactionProductVector* G4GeneratorPrecompoundInterface::
-   Propagate(G4KineticTrackVector* theSecondaries, G4V3DNucleus* theNucleus)
-   {
-     G4ReactionProductVector * theTotalResult = new G4ReactionProductVector;
+G4GeneratorPrecompoundInterface::G4GeneratorPrecompoundInterface(G4VPreCompoundModel* p) 
+  : CaptureThreshold(80*MeV)
+{
+  proton = G4Proton::Proton();
+  neutron = G4Neutron::Neutron();
+  if(p) { SetDeExcitation(p); }
+  else  { SetDeExcitation(new G4PreCompoundModel(new G4ExcitationHandler())); }
+}
+         
+G4GeneratorPrecompoundInterface::~G4GeneratorPrecompoundInterface()
+{}
+         
+G4ReactionProductVector* G4GeneratorPrecompoundInterface::
+Propagate(G4KineticTrackVector* theSecondaries, G4V3DNucleus* theNucleus)
+{
+  G4ReactionProductVector * theTotalResult = new G4ReactionProductVector;
 
-     // decay the strong resonances
-     G4KineticTrackVector *result1, *secondaries, *result;
-     result1=theSecondaries;
-     result=new G4KineticTrackVector();
-
-     for (unsigned int aResult=0; aResult < result1->size(); aResult++)
-     {
-       G4ParticleDefinition * pdef;
-       pdef=result1->operator[](aResult)->GetDefinition();
-       secondaries=NULL;
-       if ( pdef->IsShortLived() )
-       {
+  // decay the strong resonances
+  G4KineticTrackVector *result1, *secondaries, *result;
+  result1=theSecondaries;
+  result=new G4KineticTrackVector();
+  //G4cout << "### G4GeneratorPrecompoundInterface::Propagate " 
+  //	 << result1->size() << " tracks " << theDeExcitation << G4endl;
+  for (unsigned int aResult=0; aResult < result1->size(); ++aResult)
+    {
+      G4ParticleDefinition * pdef;
+      pdef=result1->operator[](aResult)->GetDefinition();
+      secondaries=0;
+      if ( pdef->IsShortLived() )
+	{
 	  secondaries = result1->operator[](aResult)->Decay();
-       }
-       if ( secondaries == NULL )
-       {
+	}
+      if ( 0 == secondaries )
+	{
 	  result->push_back(result1->operator[](aResult));
 	  result1->operator[](aResult)=NULL;	//protect for clearAndDestroy 
-       } 
-       else
-       {
-	 for (unsigned int aSecondary=0; aSecondary<secondaries->size(); aSecondary++)
+	} 
+      else
+	{
+	  unsigned int amax = secondaries->size();
+	  for (unsigned int aSecondary=0; aSecondary<amax; ++aSecondary)
+	    {
+	      result1->push_back(secondaries->operator[](aSecondary));
+	    }
+	  delete secondaries;
+	}
+    }
+  //G4cout << "Delete tracks" << G4endl;
+  std::for_each(result1->begin(), result1->end(), DeleteKineticTrack());
+  delete result1;
+     
+  // prepare the fragment
+  G4int anA=theNucleus->GetMassNumber();
+  G4int aZ=theNucleus->GetCharge();
+  G4int numberOfEx = 0;
+  G4int numberOfCh = 0;
+  G4int numberOfHoles = 0;
+  G4double exEnergy = 0.0;
+  G4double R = theNucleus->GetNuclearRadius();
+  G4ThreeVector exciton3Momentum(0.,0.,0.);
+
+  // loop over secondaries
+  unsigned int amax = result->size();
+  for(unsigned int list=0; list<amax; ++list)
+    {
+      G4KineticTrack *aTrack = result->operator[](list);
+      G4ParticleDefinition* part = aTrack->GetDefinition();
+      G4double e = aTrack->Get4Momentum().e();
+      G4double mass = aTrack->Get4Momentum().mag();
+      G4ThreeVector mom = aTrack->Get4Momentum().vect();
+      if((part != proton && part != neutron) ||
+         (e > mass + CaptureThreshold) ||
+	 (aTrack->GetPosition().mag() > R))
+	{
+	  G4ReactionProduct * theNew = new G4ReactionProduct(part);
+	  theNew->SetMomentum(mom);
+	  theNew->SetTotalEnergy(e);
+	  theTotalResult->push_back(theNew);            
+	}
+      else
+	{
+	  // within the nucleus, neutron or proton
+	  // now calculate  A, Z of the fragment, momentum, number of exciton states
+	  ++anA;
+	  ++numberOfEx;
+	  G4int Z = G4int(part->GetPDGCharge()/eplus + 0.1);
+	  aZ += Z;
+	  numberOfCh += Z;
+	  exciton3Momentum += mom;
+	  exEnergy += (e - mass);
+	}
+    }
+     
+  // loop over wounded nucleus
+  G4Nucleon * theCurrentNucleon = 
+    theNucleus->StartLoop() ? theNucleus->GetNextNucleon() : 0;
+  while(0 != theCurrentNucleon)
+    {
+      if(theCurrentNucleon->AreYouHit()) 
+	{
+	  ++numberOfHoles;
+	  ++numberOfEx;
+	  --anA;
+	  aZ -= G4int(theCurrentNucleon->GetDefinition()->GetPDGCharge()/eplus + 0.1);
+	  exciton3Momentum -= theCurrentNucleon->Get4Momentum().vect();
+	  exEnergy += theCurrentNucleon->GetBindingEnergy();
+	}
+      theCurrentNucleon = theNucleus->GetNextNucleon();
+    }   
+ 
+  if(0!=anA && 0!=aZ)
+    {
+      G4double fMass =  G4NucleiProperties::GetNuclearMass(anA, aZ);
+      fMass += exEnergy;
+
+      G4LorentzVector exciton4Momentum(exciton3Momentum, 
+				       std::sqrt(exciton3Momentum.mag2() + fMass*fMass));
+    
+      G4Fragment anInitialState(anA, aZ, exciton4Momentum);
+      anInitialState.SetNumberOfParticles(numberOfEx-numberOfHoles);
+      anInitialState.SetNumberOfCharged(numberOfCh);
+      anInitialState.SetNumberOfHoles(numberOfHoles);
+      G4ReactionProductVector * aPreResult = theDeExcitation->DeExcite(anInitialState);
+
+      // fill pre-compound part into the result, and return
+      unsigned int amax = aPreResult->size();
+       for(unsigned int ll=0; ll<amax; ++ll)
 	 {
-	     result1->push_back(secondaries->operator[](aSecondary));
+	   theTotalResult->push_back(aPreResult->operator[](ll));
 	 }
-	 delete secondaries;
-       }
-     }
-     std::for_each(result1->begin(), result1->end(), DeleteKineticTrack());
-     delete result1;
+       delete aPreResult;
+    }
      
-     
-     
-     // prepare the fragment
-     G4Fragment anInitialState;
-     G4int anA=theNucleus->GetMassNumber();
-     G4int aZ=theNucleus->GetCharge();
-     G4int numberOfEx = 0;
-     G4int numberOfCh = 0;
-     G4int numberOfHoles = 0;
-     G4double exEnergy = 0;
-     G4ThreeVector exciton3Momentum(0,0,0);
-     // loop over secondaries
-     for(unsigned int list=0; list < result->size(); list++)
-     {
-       G4KineticTrack *aTrack = result->operator[](list);
-       if(aTrack->GetDefinition() != G4Proton::Proton() && 
-          aTrack->GetDefinition() != G4Neutron::Neutron())
-       {
-	 G4ReactionProduct * theNew = new G4ReactionProduct(aTrack->GetDefinition());
-	 theNew->SetMomentum(aTrack->Get4Momentum().vect());
-	 theNew->SetTotalEnergy(aTrack->Get4Momentum().e());
-         theTotalResult->push_back(theNew);            
-       }
-       else if(aTrack->Get4Momentum().t() - aTrack->Get4Momentum().mag()>CaptureThreshold)
-       {
-	 G4ReactionProduct * theNew = new G4ReactionProduct(aTrack->GetDefinition());
-	 theNew->SetMomentum(aTrack->Get4Momentum().vect());
-	 theNew->SetTotalEnergy(aTrack->Get4Momentum().e());
-         theTotalResult->push_back(theNew);            
-       }
-       else if(aTrack->GetPosition().mag() > theNucleus->GetNuclearRadius())
-       {
-	 G4ReactionProduct * theNew = new G4ReactionProduct(aTrack->GetDefinition());
-	 theNew->SetMomentum(aTrack->Get4Momentum().vect());
-	 theNew->SetTotalEnergy(aTrack->Get4Momentum().e());
-         theTotalResult->push_back(theNew);            
-       }
-       else
-       {
-         // within the nucleus, neutron or proton
-         // now calculate  A, Z of the fragment, momentum, number of exciton states
-         anA++;;
-         numberOfEx++;
-         aZ += G4int(aTrack->GetDefinition()->GetPDGCharge());
-         numberOfCh += G4int(aTrack->GetDefinition()->GetPDGCharge());
-         exciton3Momentum += aTrack->Get4Momentum().vect();
-         exEnergy += (aTrack->Get4Momentum().t()-aTrack->Get4Momentum().m());
-       }
-     }
-     
-     // loop over wounded nucleus
-     G4Nucleon * theCurrentNucleon = theNucleus->StartLoop() ? theNucleus->GetNextNucleon() : NULL;
-     while(theCurrentNucleon != NULL)
-     {
-       if(theCurrentNucleon->AreYouHit()) 
-       {
-         numberOfHoles++;
-         numberOfEx++;
-         anA--;
-         aZ -= G4int(theCurrentNucleon->GetDefinition()->GetPDGCharge());
-         exciton3Momentum -= theCurrentNucleon->Get4Momentum().vect();
-         exEnergy+=theCurrentNucleon->GetBindingEnergy();
-       }
-       theCurrentNucleon = theNucleus->GetNextNucleon();
-     }   
- 
-     if(!theDeExcitation)
-     {
-       // throw G4HadronicException(__FILE__, __LINE__, "Please register an evaporation phase with G4GeneratorPrecompoundInterface.");
-     }
-     else if(0!=anA && 0!=aZ)
-     {
-       G4double residualMass =  
-                G4ParticleTable::GetParticleTable()->GetIonTable()->GetIonMass(aZ ,anA);
-         residualMass += exEnergy;
-
-       G4LorentzVector exciton4Momentum(exciton3Momentum, 
-                                        std::sqrt(exciton3Momentum.mag2()+residualMass*residualMass));
-    
-       anInitialState.SetA(anA);
-       anInitialState.SetZ(aZ);
-       anInitialState.SetNumberOfParticles(numberOfEx-numberOfHoles);
-       anInitialState.SetNumberOfCharged(numberOfCh);
-       anInitialState.SetNumberOfHoles(numberOfHoles);
-       anInitialState.SetMomentum(exciton4Momentum);
-//      anInitialState.SetExcitationEnergy(exEnergy); // now a redundant call.
-
-     // call pre-compound
-       const G4Fragment aFragment(anInitialState);
-       G4ReactionProductVector * aPreResult = theDeExcitation->DeExcite(aFragment);
-
-       // fill pre-compound part into the result, and return
-       for(unsigned int ll=0; ll<aPreResult->size(); ll++)
-       {
-         theTotalResult->push_back(aPreResult->operator[](ll));
-       }
-       delete aPreResult;
-     }
-     else
-     {
-       // throw G4HadronicException(__FILE__, __LINE__, "Please register an evaporation phase with G4GeneratorPrecompoundInterface.");
-     }
-     // now return
-     
-     std::for_each(result->begin(), result->end(), DeleteKineticTrack());
-     delete result;
-     return theTotalResult;
-   }
+  std::for_each(result->begin(), result->end(), DeleteKineticTrack());
+  delete result;
+  return theTotalResult;
+}
   
-G4double G4GeneratorPrecompoundInterface::SetCaptureThreshold(G4double value)
+G4HadFinalState* G4GeneratorPrecompoundInterface::
+ApplyYourself(const G4HadProjectile &, G4Nucleus & )
 {
-    G4double old=CaptureThreshold;
-    CaptureThreshold=value;
-    return old;
-
+  G4cout << "G4GeneratorPrecompoundInterface: ApplyYourself interface called stand-allone."
+	 << G4endl;
+  G4cout << "This class is only a mediator between generator and precompound"<<G4endl;
+  G4cout << "Please remove from your physics list."<<G4endl;
+  throw G4HadronicException(__FILE__, __LINE__, "SEVERE: G4GeneratorPrecompoundInterface model interface called stand-allone.");
+  return new G4HadFinalState;
 }
Index: trunk/source/processes/hadronic/models/binary_cascade/src/G4KaonMinusField.cc
===================================================================
--- trunk/source/processes/hadronic/models/binary_cascade/src/G4KaonMinusField.cc	(revision 1228)
+++ trunk/source/processes/hadronic/models/binary_cascade/src/G4KaonMinusField.cc	(revision 1340)
@@ -83,7 +83,7 @@
   G4double kaonMass = G4KaonMinus::KaonMinus()->GetPDGMass();
 
-  G4double A = theNucleus->GetMassNumber();
-  G4double Z = theNucleus->GetCharge();
-  G4double bindingEnergy = G4NucleiProperties::GetBindingEnergy(G4lrint(A), G4lrint(Z));
+  G4int A = theNucleus->GetMassNumber();
+  G4int Z = theNucleus->GetCharge();
+  G4double bindingEnergy = G4NucleiProperties::GetBindingEnergy(A, Z);
   G4double nucleusMass = Z*proton_mass_c2+(A-Z)*neutron_mass_c2+bindingEnergy;
   G4double reducedMass = kaonMass*nucleusMass/(kaonMass+nucleusMass);
@@ -97,6 +97,6 @@
 G4double G4KaonMinusField::GetBarrier()
 {
-  G4double A = theNucleus->GetMassNumber();
-  G4double Z = theNucleus->GetCharge();
+  G4int A = theNucleus->GetMassNumber();
+  G4int Z = theNucleus->GetCharge();
   G4double coulombBarrier = (1.44/1.14) * MeV * Z / (1.0 + std::pow(A,1./3.));
   return -coulombBarrier;
Index: trunk/source/processes/hadronic/models/binary_cascade/src/G4KaonPlusField.cc
===================================================================
--- trunk/source/processes/hadronic/models/binary_cascade/src/G4KaonPlusField.cc	(revision 1228)
+++ trunk/source/processes/hadronic/models/binary_cascade/src/G4KaonPlusField.cc	(revision 1340)
@@ -83,7 +83,7 @@
   G4double kaonMass = G4KaonPlus::KaonPlus()->GetPDGMass();
 
-  G4double A = theNucleus->GetMassNumber();
-  G4double Z = theNucleus->GetCharge();
-  G4double bindingEnergy = G4NucleiProperties::GetBindingEnergy(G4lrint(A), G4lrint(Z));
+  G4int A = theNucleus->GetMassNumber();
+  G4int Z = theNucleus->GetCharge();
+  G4double bindingEnergy = G4NucleiProperties::GetBindingEnergy(A, Z);
   G4double nucleusMass = Z*proton_mass_c2+(A-Z)*neutron_mass_c2+bindingEnergy;
   G4double reducedMass = kaonMass*nucleusMass/(kaonMass+nucleusMass);
@@ -96,6 +96,6 @@
 G4double G4KaonPlusField::GetBarrier()
 {
-  G4double A = theNucleus->GetMassNumber();
-  G4double Z = theNucleus->GetCharge();
+  G4int A = theNucleus->GetMassNumber();
+  G4int Z = theNucleus->GetCharge();
   G4double coulombBarrier = (1.44/1.14) * MeV * Z / (1.0 + std::pow(A,1./3.));
   return coulombBarrier;
Index: trunk/source/processes/hadronic/models/binary_cascade/src/G4KaonZeroField.cc
===================================================================
--- trunk/source/processes/hadronic/models/binary_cascade/src/G4KaonZeroField.cc	(revision 1228)
+++ trunk/source/processes/hadronic/models/binary_cascade/src/G4KaonZeroField.cc	(revision 1340)
@@ -83,7 +83,7 @@
   G4double kaonMass = G4KaonZero::KaonZero()->GetPDGMass();
 
-  G4double A = theNucleus->GetMassNumber();
-  G4double Z = theNucleus->GetCharge();
-  G4double bindingEnergy = G4NucleiProperties::GetBindingEnergy(G4lrint(A), G4lrint(Z));
+  G4int A = theNucleus->GetMassNumber();
+  G4int Z = theNucleus->GetCharge();
+  G4double bindingEnergy = G4NucleiProperties::GetBindingEnergy(A, Z);
   G4double nucleusMass = Z*proton_mass_c2+(A-Z)*neutron_mass_c2+bindingEnergy;
   G4double reducedMass = kaonMass*nucleusMass/(kaonMass+nucleusMass);
Index: trunk/source/processes/hadronic/models/binary_cascade/src/G4PionMinusField.cc
===================================================================
--- trunk/source/processes/hadronic/models/binary_cascade/src/G4PionMinusField.cc	(revision 1228)
+++ trunk/source/processes/hadronic/models/binary_cascade/src/G4PionMinusField.cc	(revision 1340)
@@ -80,6 +80,6 @@
   if(aPosition.mag() >= radius) return 0.0;
 
-  G4double A = theNucleus->GetMassNumber();
-  G4double Z = theNucleus->GetCharge();
+  G4int A = theNucleus->GetMassNumber();
+  G4int Z = theNucleus->GetCharge();
   G4double pionMinusMass = G4PionMinus::PionMinus()->GetPDGMass();
   G4double bindingEnergy = G4NucleiProperties::GetBindingEnergy(G4lrint(A), G4lrint(Z));
@@ -96,6 +96,6 @@
 G4double G4PionMinusField::GetBarrier()
 {
-  G4double A = theNucleus->GetMassNumber();
-  G4double Z = theNucleus->GetCharge();
+  G4int A = theNucleus->GetMassNumber();
+  G4int Z = theNucleus->GetCharge();
   G4double coulombBarrier = (1.44/1.14) * MeV * Z / (1.0 + std::pow(A,1./3.));
   return -coulombBarrier;
Index: trunk/source/processes/hadronic/models/binary_cascade/src/G4PionPlusField.cc
===================================================================
--- trunk/source/processes/hadronic/models/binary_cascade/src/G4PionPlusField.cc	(revision 1228)
+++ trunk/source/processes/hadronic/models/binary_cascade/src/G4PionPlusField.cc	(revision 1340)
@@ -83,7 +83,7 @@
   G4double pionPlusMass = G4PionPlus::PionPlus()->GetPDGMass();
 
-  G4double A = theNucleus->GetMassNumber();
-  G4double Z = theNucleus->GetCharge();
-  G4double bindingEnergy = G4NucleiProperties::GetBindingEnergy(G4lrint(A), G4lrint(Z));
+  G4int A = theNucleus->GetMassNumber();
+  G4int Z = theNucleus->GetCharge();
+  G4double bindingEnergy = G4NucleiProperties::GetBindingEnergy(A, Z);
   G4double nucleusMass = Z*proton_mass_c2+(A-Z)*neutron_mass_c2+bindingEnergy;
   G4double reducedMass = pionPlusMass*nucleusMass/(pionPlusMass+nucleusMass);
@@ -98,6 +98,6 @@
 G4double G4PionPlusField::GetBarrier()
 {
-  G4double A = theNucleus->GetMassNumber();
-  G4double Z = theNucleus->GetCharge();
+  G4int A = theNucleus->GetMassNumber();
+  G4int Z = theNucleus->GetCharge();
   G4double coulombBarrier = (1.44/1.14) * MeV * Z / (1.0 + std::pow(A,1./3.));
   return coulombBarrier;
Index: trunk/source/processes/hadronic/models/binary_cascade/src/G4PionZeroField.cc
===================================================================
--- trunk/source/processes/hadronic/models/binary_cascade/src/G4PionZeroField.cc	(revision 1228)
+++ trunk/source/processes/hadronic/models/binary_cascade/src/G4PionZeroField.cc	(revision 1340)
@@ -82,8 +82,8 @@
 
   G4double pionZeroMass = G4PionZero::PionZero()->GetPDGMass();
-  G4double A = theNucleus->GetMassNumber();
-  G4double Z = theNucleus->GetCharge();
+  G4int A = theNucleus->GetMassNumber();
+  G4int Z = theNucleus->GetCharge();
 
-  G4double bindingEnergy = G4NucleiProperties::GetBindingEnergy(G4lrint(A), G4lrint(Z));
+  G4double bindingEnergy = G4NucleiProperties::GetBindingEnergy(A, Z);
   G4double nucleusMass = Z*proton_mass_c2+(A-Z)*neutron_mass_c2+bindingEnergy;
   G4double reducedMass = pionZeroMass*nucleusMass/(pionZeroMass+nucleusMass);
Index: trunk/source/processes/hadronic/models/binary_cascade/src/G4SigmaMinusField.cc
===================================================================
--- trunk/source/processes/hadronic/models/binary_cascade/src/G4SigmaMinusField.cc	(revision 1228)
+++ trunk/source/processes/hadronic/models/binary_cascade/src/G4SigmaMinusField.cc	(revision 1340)
@@ -82,7 +82,7 @@
   G4double sigmaMinusMass = G4SigmaMinus::SigmaMinus()->GetPDGMass();
 
-  G4double A = theNucleus->GetMassNumber();
-  G4double Z = theNucleus->GetCharge();
-  G4double bindingEnergy = G4NucleiProperties::GetBindingEnergy(G4lrint(A), G4lrint(Z));
+  G4int A = theNucleus->GetMassNumber();
+  G4int Z = theNucleus->GetCharge();
+  G4double bindingEnergy = G4NucleiProperties::GetBindingEnergy(A, Z);
   G4double nucleusMass = Z*proton_mass_c2+(A-Z)*neutron_mass_c2+bindingEnergy;
   G4double reducedMass = sigmaMinusMass*nucleusMass/(sigmaMinusMass+nucleusMass);
Index: trunk/source/processes/hadronic/models/binary_cascade/src/G4SigmaPlusField.cc
===================================================================
--- trunk/source/processes/hadronic/models/binary_cascade/src/G4SigmaPlusField.cc	(revision 1228)
+++ trunk/source/processes/hadronic/models/binary_cascade/src/G4SigmaPlusField.cc	(revision 1340)
@@ -83,7 +83,7 @@
   G4double sigmaPlusMass = G4SigmaPlus::SigmaPlus()->GetPDGMass();
 
-  G4double A = theNucleus->GetMassNumber();
-  G4double Z = theNucleus->GetCharge();
-  G4double bindingEnergy = G4NucleiProperties::GetBindingEnergy(G4lrint(A), G4lrint(Z));
+  G4int A = theNucleus->GetMassNumber();
+  G4int Z = theNucleus->GetCharge();
+  G4double bindingEnergy = G4NucleiProperties::GetBindingEnergy(A, Z);
   G4double nucleusMass = Z*proton_mass_c2+(A-Z)*neutron_mass_c2+bindingEnergy;
   G4double reducedMass = sigmaPlusMass*nucleusMass/(sigmaPlusMass+nucleusMass);
Index: trunk/source/processes/hadronic/models/binary_cascade/src/G4SigmaZeroField.cc
===================================================================
--- trunk/source/processes/hadronic/models/binary_cascade/src/G4SigmaZeroField.cc	(revision 1228)
+++ trunk/source/processes/hadronic/models/binary_cascade/src/G4SigmaZeroField.cc	(revision 1340)
@@ -83,7 +83,7 @@
   G4double sigmaZeroMass = G4SigmaZero::SigmaZero()->GetPDGMass();
 
-  G4double A = theNucleus->GetMassNumber();
-  G4double Z = theNucleus->GetCharge();
-  G4double bindingEnergy = G4NucleiProperties::GetBindingEnergy(G4lrint(A), G4lrint(Z));
+  G4int A = theNucleus->GetMassNumber();
+  G4int Z = theNucleus->GetCharge();
+  G4double bindingEnergy = G4NucleiProperties::GetBindingEnergy(A, Z);
   G4double nucleusMass = Z*proton_mass_c2+(A-Z)*neutron_mass_c2+bindingEnergy;
   G4double reducedMass = sigmaZeroMass*nucleusMass/(sigmaZeroMass+nucleusMass);
