Index: trunk/source/processes/hadronic/models/coherent_elastic/GNUmakefile
===================================================================
--- trunk/source/processes/hadronic/models/coherent_elastic/GNUmakefile	(revision 1055)
+++ trunk/source/processes/hadronic/models/coherent_elastic/GNUmakefile	(revision 1196)
@@ -1,3 +1,3 @@
-# $Id: GNUmakefile,v 1.5 2006/04/18 16:53:05 vnivanch Exp $
+# $Id: GNUmakefile,v 1.7 2009/11/16 19:20:18 mkossov Exp $
 # -----------------------------------------------------------
 # GNUmakefile for hadronic library.  Gabriele Cosmo, 18/9/96.
@@ -20,8 +20,9 @@
             -I$(G4BASE)/geometry/management/include \
             -I$(G4BASE)/processes/management/include \
+            -I$(G4BASE)/processes/cuts/include \
             -I$(G4BASE)/processes/hadronic/management/include/ \
             -I$(G4BASE)/processes/hadronic/models/management/include/ \
-            -I$(G4BASE)/processes/hadronic/models/chiral_inv_phase_space/interface/include/ \
             -I$(G4BASE)/processes/hadronic/models/chiral_inv_phase_space/body/include/ \
+            -I$(G4BASE)/processes/hadronic/models/chiral_inv_phase_space/cross_sections/include/ \
             -I$(G4BASE)/processes/hadronic/models/neutron_hp/include/ \
             -I$(G4BASE)/processes/hadronic/util/include \
Index: trunk/source/processes/hadronic/models/coherent_elastic/History
===================================================================
--- trunk/source/processes/hadronic/models/coherent_elastic/History	(revision 1055)
+++ trunk/source/processes/hadronic/models/coherent_elastic/History	(revision 1196)
@@ -15,4 +15,27 @@
      ---------------------------------------------------------------
 
+19 November 2009 - M.Kosov (hadr-cohe-V09-02-03)
+------------------------------------------------------
+- Correct dependencies on CHIPS
+
+08 October 2009 - V.Ivanchenko (hadr-cohe-V09-02-02)
+------------------------------------------------------
+- G4CHIPSElastic, G4HadronElastic - use static pointer to G4VQCrossSection
+                                    in order to gurantee unique version
+                                    of CHIPS cross section class
+
+05 October 2009 - V.Ivanchenko (hadr-cohe-V09-02-01)
+------------------------------------------------------
+- Make a correct tag format
+
+22 September 2009 - V.Ivanchenko (hadr-cohe-V09-01-09)
+------------------------------------------------------
+  Migrated to the hadronic model design of elastic scattering
+  G4WHadronElasticProcess - new elastic process
+  G4VHadronElastic - base class for elastic models with default
+                     GHEISHA model
+  G4ElasticHadrNucleusHE - capable to work with old and new interfaces
+  G4CHIPSElastic - model interface to CHIPS parameterization
+  G4HadronElastic - remove hand made NaN finder and G4cout at destructor 
 
 02 March 2009 - D. Wright for V.Grichine (hadr-cohe-V09-02-00)
Index: trunk/source/processes/hadronic/models/coherent_elastic/include/G4ChargeExchange.hh
===================================================================
--- trunk/source/processes/hadronic/models/coherent_elastic/include/G4ChargeExchange.hh	(revision 1055)
+++ trunk/source/processes/hadronic/models/coherent_elastic/include/G4ChargeExchange.hh	(revision 1196)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4ChargeExchange.hh,v 1.4 2008/11/19 18:28:36 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4ChargeExchange.hh,v 1.6 2009/09/22 16:21:46 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
 //
 //
Index: trunk/source/processes/hadronic/models/coherent_elastic/include/G4ChargeExchangeProcess.hh
===================================================================
--- trunk/source/processes/hadronic/models/coherent_elastic/include/G4ChargeExchangeProcess.hh	(revision 1055)
+++ trunk/source/processes/hadronic/models/coherent_elastic/include/G4ChargeExchangeProcess.hh	(revision 1196)
@@ -26,5 +26,5 @@
 //
 // $Id: G4ChargeExchangeProcess.hh,v 1.3 2008/11/20 12:35:19 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
 //
 //
Index: trunk/source/processes/hadronic/models/coherent_elastic/include/G4DiffuseElastic.hh
===================================================================
--- trunk/source/processes/hadronic/models/coherent_elastic/include/G4DiffuseElastic.hh	(revision 1055)
+++ trunk/source/processes/hadronic/models/coherent_elastic/include/G4DiffuseElastic.hh	(revision 1196)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4DiffuseElastic.hh,v 1.15 2009/02/20 15:38:07 grichine Exp $
-// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
+// $Id: G4DiffuseElastic.hh,v 1.17 2009/09/22 16:21:46 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
 //
 //
Index: trunk/source/processes/hadronic/models/coherent_elastic/include/G4ElasticHadrNucleusHE.hh
===================================================================
--- trunk/source/processes/hadronic/models/coherent_elastic/include/G4ElasticHadrNucleusHE.hh	(revision 1055)
+++ trunk/source/processes/hadronic/models/coherent_elastic/include/G4ElasticHadrNucleusHE.hh	(revision 1196)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4ElasticHadrNucleusHE.hh,v 1.45 2007/12/19 18:27:16 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4ElasticHadrNucleusHE.hh,v 1.47 2009/09/22 16:21:46 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
 //
 // G4ElasticHadrNucleusHe.hh
@@ -51,6 +51,5 @@
 #include "G4ParticleChange.hh"
 #include "G4Nucleus.hh"
-
-#include "G4HadronicInteraction.hh"
+#include "G4VHadronElastic.hh"
 
 class G4NistManager;
@@ -72,5 +71,5 @@
 
   G4ElasticData(const G4ParticleDefinition* h, 
-	      G4int Z, G4double A, G4double* eGeV);
+		G4int Z, G4double A, G4double* eGeV);
 
   ~G4ElasticData(){}
@@ -106,5 +105,5 @@
 //
 
-class G4ElasticHadrNucleusHE : public G4HadronicInteraction
+class G4ElasticHadrNucleusHE : public G4VHadronElastic
 {
 public:
@@ -114,9 +113,12 @@
   virtual ~G4ElasticHadrNucleusHE();
 
-  G4HadFinalState * ApplyYourself(const G4HadProjectile& aTrack,
-				  G4Nucleus& G4Nucleus);
-
-  G4double SampleT(const G4ParticleDefinition* p, G4double plab, 
+  virtual G4double SampleInvariantT(const G4ParticleDefinition* p, 
+				    G4double plab, 
+				    G4int Z, G4int A);
+
+  G4double SampleT(const G4ParticleDefinition* p, 
+		   G4double plab, 
 		   G4int Z, G4int A);
+
   G4double HadronNucleusQ2_2(G4ElasticData * pElD, G4int Z, 
 			     G4double plabGeV, G4double tmax);
Index: trunk/source/processes/hadronic/models/coherent_elastic/include/G4HadronElastic.hh
===================================================================
--- trunk/source/processes/hadronic/models/coherent_elastic/include/G4HadronElastic.hh	(revision 1055)
+++ trunk/source/processes/hadronic/models/coherent_elastic/include/G4HadronElastic.hh	(revision 1196)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4HadronElastic.hh,v 1.27 2008/05/19 09:59:44 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4HadronElastic.hh,v 1.31 2009/10/08 18:56:57 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
 //
 //
@@ -108,5 +108,6 @@
 		  G4double rr);
 
-  G4VQCrossSection*           qCManager;
+  static G4VQCrossSection* qCManager;
+
   G4ElasticHadrNucleusHE*     hElastic;
 
@@ -123,9 +124,4 @@
   G4double lowestEnergyLimit;  
   G4double plabLowLimit;
-
-  G4int nnans;
-  G4int npos;
-  G4int nneg;
-  G4int neneg;
 
 };
Index: trunk/source/processes/hadronic/models/coherent_elastic/include/G4UHadronElasticProcess.hh
===================================================================
--- trunk/source/processes/hadronic/models/coherent_elastic/include/G4UHadronElasticProcess.hh	(revision 1055)
+++ trunk/source/processes/hadronic/models/coherent_elastic/include/G4UHadronElasticProcess.hh	(revision 1196)
@@ -26,5 +26,5 @@
 //
 // $Id: G4UHadronElasticProcess.hh,v 1.10 2006/11/16 20:09:13 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
 //
 // Geant4 Hadron Elastic Scattering Process -- header file
Index: trunk/source/processes/hadronic/models/coherent_elastic/src/G4ChargeExchange.cc
===================================================================
--- trunk/source/processes/hadronic/models/coherent_elastic/src/G4ChargeExchange.cc	(revision 1055)
+++ trunk/source/processes/hadronic/models/coherent_elastic/src/G4ChargeExchange.cc	(revision 1196)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4ChargeExchange.cc,v 1.13 2008/11/20 12:35:19 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
+// $Id: G4ChargeExchange.cc,v 1.16 2009/09/22 16:21:46 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
 //
 //
@@ -312,6 +312,6 @@
     dd = 10.;
   }
-  G4double x1 = (1.0 - exp(-tmax*bb))*aa/bb;
-  G4double x2 = (1.0 - exp(-tmax*dd))*cc/dd;
+  G4double x1 = (1.0 - std::exp(-tmax*bb))*aa/bb;
+  G4double x2 = (1.0 - std::exp(-tmax*dd))*cc/dd;
   
   G4double t;
Index: trunk/source/processes/hadronic/models/coherent_elastic/src/G4ChargeExchangeProcess.cc
===================================================================
--- trunk/source/processes/hadronic/models/coherent_elastic/src/G4ChargeExchangeProcess.cc	(revision 1055)
+++ trunk/source/processes/hadronic/models/coherent_elastic/src/G4ChargeExchangeProcess.cc	(revision 1196)
@@ -26,5 +26,5 @@
 //
 // $Id: G4ChargeExchangeProcess.cc,v 1.15 2008/11/27 16:43:00 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
 //
 //
Index: trunk/source/processes/hadronic/models/coherent_elastic/src/G4DiffuseElastic.cc
===================================================================
--- trunk/source/processes/hadronic/models/coherent_elastic/src/G4DiffuseElastic.cc	(revision 1055)
+++ trunk/source/processes/hadronic/models/coherent_elastic/src/G4DiffuseElastic.cc	(revision 1196)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4DiffuseElastic.cc,v 1.23 2009/03/02 09:17:43 grichine Exp $
-// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
+// $Id: G4DiffuseElastic.cc,v 1.25 2009/09/22 16:21:46 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
 //
 //
Index: trunk/source/processes/hadronic/models/coherent_elastic/src/G4ElasticHadrNucleusHE.cc
===================================================================
--- trunk/source/processes/hadronic/models/coherent_elastic/src/G4ElasticHadrNucleusHE.cc	(revision 1055)
+++ trunk/source/processes/hadronic/models/coherent_elastic/src/G4ElasticHadrNucleusHE.cc	(revision 1196)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4ElasticHadrNucleusHE.cc,v 1.79 2008/01/14 10:39:13 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4ElasticHadrNucleusHE.cc,v 1.81 2009/09/22 16:21:46 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
 //
 //
@@ -220,5 +220,6 @@
 
 G4ElasticHadrNucleusHE::G4ElasticHadrNucleusHE()
-  :G4HadronicInteraction("G4ElasticHadrNucleusHE")
+  : G4VHadronElastic("hElasticGlauber")
+  //  :G4HadronicInteraction("G4ElasticHadrNucleusHE")
 {
   verboseLevel = 0;
@@ -299,5 +300,5 @@
 //
 //
-
+/*
 G4HadFinalState * G4ElasticHadrNucleusHE::ApplyYourself(
                           const  G4HadProjectile  &aTrack,
@@ -457,12 +458,13 @@
   return &theParticleChange;
 }
-
+*/
 //////////////////////////////////////////////////////////////////////////
 //
 //
 
-G4double G4ElasticHadrNucleusHE::
-                     SampleT(  const G4ParticleDefinition* p,
-                                     G4double inLabMom, G4int Z, G4int N)
+G4double 
+G4ElasticHadrNucleusHE::SampleInvariantT(const G4ParticleDefinition* p,
+					 G4double inLabMom, 
+					 G4int Z, G4int N)
 {
   G4double plab  = inLabMom/GeV;   // (GeV/c)
@@ -542,4 +544,16 @@
     }
   return  Q2*GeV2;
+}
+
+//////////////////////////////////////////////////////////////////////////
+//
+//
+
+G4double 
+G4ElasticHadrNucleusHE::SampleT(const G4ParticleDefinition* p,
+				G4double inLabMom, 
+				G4int Z, G4int N)
+{
+  return SampleInvariantT(p, inLabMom, Z, N);
 }
 
Index: trunk/source/processes/hadronic/models/coherent_elastic/src/G4HadronElastic.cc
===================================================================
--- trunk/source/processes/hadronic/models/coherent_elastic/src/G4HadronElastic.cc	(revision 1055)
+++ trunk/source/processes/hadronic/models/coherent_elastic/src/G4HadronElastic.cc	(revision 1196)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4HadronElastic.cc,v 1.61 2008/08/05 07:37:39 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// $Id: G4HadronElastic.cc,v 1.65 2009/10/08 18:56:57 vnivanch Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
 //
 //
@@ -79,4 +79,6 @@
 #include "G4PionMinus.hh"
 
+G4VQCrossSection* G4HadronElastic::qCManager = 0;
+
 G4HadronElastic::G4HadronElastic(G4ElasticHadrNucleusHE* HModel) 
   : G4HadronicInteraction("G4HadronElastic"), hElastic(HModel)
@@ -91,5 +93,5 @@
   plabLowLimit     = 20.0*MeV;
 
-  qCManager   = G4QElasticCrossSection::GetPointer();
+  if(!qCManager) {qCManager = G4QElasticCrossSection::GetPointer();}
   if(!hElastic) hElastic = new G4ElasticHadrNucleusHE();
 
@@ -101,8 +103,4 @@
   thePionMinus= G4PionMinus::PionMinus();
 
-  nnans = 0;
-  npos  = 0;
-  nneg  = 0;
-  neneg = 0;
 }
 
@@ -110,12 +108,4 @@
 {
   delete hElastic;
-  if( (nnans + npos + nneg + neneg) > 0 ) {
-    G4cout << "### G4HadronElastic destructor Warnings: ";
-    if(nnans > 0) G4cout << "###          N(nans)    = " << nnans;
-    if(npos > 0)  G4cout << "###          N(cost > 1)= " << npos;
-    if(nneg > 0)  G4cout << "###          N(cost <-1)= " << nneg;
-    if(neneg > 0) G4cout << "###          N(E < 0)=    " << neneg;
-    G4cout << "###" << G4endl;
-  }
 }
 
@@ -234,9 +224,20 @@
   }
 
-  // NaN finder
-  if(!(t < 0.0 || t >= 0.0)) {
-    if (verboseLevel > 0) {
+  if(gtype == fSWave) t = G4UniformRand()*tmax;
+
+  if(verboseLevel>1) {
+    G4cout <<"type= " << gtype <<" t= " << t << " tmax= " << tmax 
+	   << " ptot= " << ptot << G4endl;
+  }
+  // Sampling in CM system
+  G4double phi  = G4UniformRand()*twopi;
+  G4double cost = 1. - 2.0*t/tmax;
+  G4double sint;
+
+  // problem in sampling
+  if(cost > 1.0 || cost < -1.0) {
+    if(verboseLevel > 0) {
       G4cout << "G4HadronElastic:WARNING: Z= " << Z << " N= " 
-	     << N << " pdg= " <<  projPDG
+	     << N << " " << aParticle->GetDefinition()->GetParticleName()
 	     << " mom(GeV)= " << plab/GeV 
 	     << " the model type " << gtype;
@@ -244,42 +245,9 @@
       else if(gtype ==  fLElastic) G4cout << " LElastic ";
       else if(gtype ==  fHElastic) G4cout << " HElastic ";
-      G4cout << " S-wave will be sampled" 
+      G4cout << " cost= " << cost 
 	     << G4endl; 
     }
-    t = 0.0;
-    nnans++;
-  }
-
-  if(gtype == fSWave) t = G4UniformRand()*tmax;
-
-  if(verboseLevel>1) {
-    G4cout <<"type= " << gtype <<" t= " << t << " tmax= " << tmax 
-	   << " ptot= " << ptot << G4endl;
-  }
-  // Sampling in CM system
-  G4double phi  = G4UniformRand()*twopi;
-  G4double cost = 1. - 2.0*t/tmax;
-  G4double sint;
-
-  // problem in sampling
-  if(cost >= 1.0) {
     cost = 1.0;
     sint = 0.0;
-    npos++;
-  } else if(cost < -1 ) {
-    /*
-    G4cout << "G4HadronElastic:WARNING: Z= " << Z << " N= " 
-	   << N << " " << aParticle->GetDefinition()->GetParticleName()
-	   << " mom(GeV)= " << plab/GeV 
-	   << " the model type " << gtype;
-    if(gtype ==  fQElastic) G4cout << " CHIPS ";
-    else if(gtype ==  fLElastic) G4cout << " LElastic ";
-    else if(gtype ==  fHElastic) G4cout << " HElastic ";
-    G4cout << " cost= " << cost 
-	   << G4endl; 
-    */
-    cost = 1.0;
-    sint = 0.0;
-    nneg++;
 
     // normal situation
@@ -305,5 +273,4 @@
   if(eFinal <= lowestEnergyLimit) {
     if(eFinal < 0.0 && verboseLevel > 0) {
-      neneg++;
       G4cout << "G4HadronElastic WARNING ekin= " << eFinal
 	     << " after scattering of " 
Index: trunk/source/processes/hadronic/models/coherent_elastic/src/G4UHadronElasticProcess.cc
===================================================================
--- trunk/source/processes/hadronic/models/coherent_elastic/src/G4UHadronElasticProcess.cc	(revision 1055)
+++ trunk/source/processes/hadronic/models/coherent_elastic/src/G4UHadronElasticProcess.cc	(revision 1196)
@@ -25,5 +25,5 @@
 //
 // $Id: G4UHadronElasticProcess.cc,v 1.39 2008/10/22 08:16:40 vnivanch Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
 //
 // Geant4 Hadron Elastic Scattering Process -- header file
