Index: trunk/CHANGELOG
===================================================================
--- trunk/CHANGELOG	(revision 493)
+++ trunk/CHANGELOG	(revision 494)
@@ -9,4 +9,5 @@
    - updates in Resolution.cpp & Resolution_ATLAS.cpp
    - new method "invisible()" in PdgParticle, needed for invisible particles BSM
+   - new : calorimeter endcaps. DetectorCard have been updated; however, 100% backward compatible
 
  /-----------------------------------------\
Index: trunk/Delphes.cpp
===================================================================
--- trunk/Delphes.cpp	(revision 493)
+++ trunk/Delphes.cpp	(revision 494)
@@ -166,5 +166,5 @@
   DET->ReadParticleDataGroupTable();
   //DET->PDGtable.print();
- 
+
   //Trigger information
   cout <<"**        ########### Start reading TRIGGER card ##########        **"<< endl;
@@ -307,16 +307,26 @@
 			    -DET->CEN_max_calo_cen, DET->CEN_max_calo_cen,
 			    DET->ELG_Ccen,  DET->ELG_Ncen,  DET->ELG_Scen,
-			    DET->HAD_Chcal, DET->HAD_Nhcal, DET->HAD_Shcal);
+			    DET->HAD_Ccen,  DET->HAD_Ncen,  DET->HAD_Scen);
+  D_CaloElement ForwardECCalo("forwardendcapcalo",
+                            DET->CEN_max_calo_cen, DET->CEN_max_calo_ec,
+                            DET->ELG_Cec, DET->ELG_Nec, DET->ELG_Sec,
+                            DET->HAD_Cec, DET->HAD_Nec, DET->HAD_Sec );
+  D_CaloElement BackwardECCalo("backwardendcapcalo",
+                            -DET->CEN_max_calo_ec, -DET->CEN_max_calo_cen,
+                            DET->ELG_Cec, DET->ELG_Nec, DET->ELG_Sec,
+                            DET->HAD_Cec, DET->HAD_Nec, DET->HAD_Sec );
   D_CaloElement ForwardCalo("forwardcalo",
-			    DET->CEN_max_calo_cen, DET->CEN_max_calo_fwd, 
+			    DET->CEN_max_calo_ec, DET->CEN_max_calo_fwd, 
 			    DET->ELG_Cfwd,  DET->ELG_Nfwd,  DET->ELG_Sfwd,
-			    DET->HAD_Chf,   DET->HAD_Nhf,   DET->HAD_Shf  );
+			    DET->HAD_Cfwd,  DET->HAD_Nfwd,  DET->HAD_Sfwd  );
   D_CaloElement BackwardCalo("backwardcalo",
-			     -DET->CEN_max_calo_fwd, -DET->CEN_max_calo_cen,
+			     -DET->CEN_max_calo_fwd, -DET->CEN_max_calo_ec,
 			     DET->ELG_Cfwd,  DET->ELG_Nfwd,  DET->ELG_Sfwd,
-			     DET->HAD_Chf,   DET->HAD_Nhf,   DET->HAD_Shf  );
+			     DET->HAD_Cfwd,  DET->HAD_Nfwd,  DET->HAD_Sfwd  );
   //D_CaloElement CastorCalo("castor",5.5,6.6,1,0,0,1,0,0);
   list_of_calorimeters.addElement(CentralCalo);
+  list_of_calorimeters.addElement(ForwardECCalo);
   list_of_calorimeters.addElement(ForwardCalo);
+  list_of_calorimeters.addElement(BackwardECCalo);
   list_of_calorimeters.addElement(BackwardCalo);
   //list_of_calorimeters.addElement(CastorCalo);
Index: trunk/data/DetectorCard.dat
===================================================================
--- trunk/data/DetectorCard.dat	(revision 493)
+++ trunk/data/DetectorCard.dat	(revision 494)
@@ -3,32 +3,39 @@
 
 # Detector extension, in pseudorapidity units
-CEN_max_tracker    2.5                // Maximum tracker coverage          
-CEN_max_calo_cen   3.0                // central calorimeter coverage
-CEN_max_calo_fwd   5.0                // forward calorimeter pseudorapidity coverage
-CEN_max_mu         2.4                // muon chambers pseudorapidity coverage
+CEN_max_tracker    2.5              // Maximum tracker coverage          
+CEN_max_calo_cen   1.7              // central calorimeter coverage
+CEN_max_calo_ec    3.0              // calorimeter endcap coverage
+CEN_max_calo_fwd   5.0              // forward calorimeter pseudorapidity coverage
+CEN_max_mu         2.4              // muon chambers pseudorapidity coverage
   
-# Energy resolution for electron/photon
+# Energy resolution for electron/photon in central/endcap/fwd/zdc calos
 # \sigma/E = C + N/E + S/\sqrt{E}, E in GeV
 ELG_Scen          0.05              // S term for central ECAL
-ELG_Ncen          0.25              // N term for central ECAL
-ELG_Ccen          0.005             // C term for central ECAL
+ELG_Ncen          0.25              // N term 
+ELG_Ccen          0.005             // C term 
+ELG_Sec           0.05              // S term for ECAL endcap
+ELG_Nec           0.25              // N term
+ELG_Cec           0.005             // C term
 ELG_Sfwd          2.084             // S term for FCAL
-ELG_Nfwd          0.0               // N term for FCAL
-ELG_Cfwd          0.107             // C term for FCAL
+ELG_Nfwd          0.0               // N term 
+ELG_Cfwd          0.107             // C term 
 ELG_Szdc          0.70              // S term for ZDC
-ELG_Nzdc          0.0               // N term for ZDC
-ELG_Czdc          0.08              // C term for ZDC
+ELG_Nzdc          0.0               // N term
+ELG_Czdc          0.08              // C term
 
-# Energy resolution for hadrons in ecal/hcal/hf
+# Energy resolution for hadrons in central/endcap/fwd/zdc calos
 # \sigma/E = C + N/E + S/\sqrt{E}, E in GeV
-HAD_Shcal         1.5               // S term for central HCAL 
-HAD_Nhcal         0.                // N term for central HCAL
-HAD_Chcal         0.05              // C term for central HCAL
-HAD_Shf           2.7               // S term for FCAL
-HAD_Nhf           0.                // N term for FCAL
-HAD_Chf           0.13              // C term for FCAL
+HAD_Scen          1.5               // S term for central HCAL 
+HAD_Ncen          0.                // N term
+HAD_Ccen          0.05              // C term
+HAD_Sec           1.5               // S term for HCAL endcap
+HAD_Nec           0.                // N term
+HAD_Cec           0.05              // C term
+HAD_Sfwd          2.7               // S term for FCAL
+HAD_Nfwd          0.                // N term
+HAD_Cfwd          0.13              // C term
 HAD_Szdc          1.38              // S term for ZDC
-HAD_Nzdc          0.                // N term for ZDC
-HAD_Czdc          0.13              // C term for ZDC
+HAD_Nzdc          0.                // N term
+HAD_Czdc          0.13              // C term
 
 # Time resolution for ZDC/RP220/RP420
@@ -74,4 +81,5 @@
 ISOL_Cone        0.5      //Cone  for isolation criteria
 ISOL_Calo_ET     2.0      //minimal tower transverse energy for isolation criteria. 1E99 means "off"
+ISOL_Calo_Cone   0.4      //Cone for calorimetric isolation
 ISOL_Calo_Grid   3        //Grid size (N x N) for calorimetric isolation
 
Index: trunk/data/DetectorCard_ATLAS.dat
===================================================================
--- trunk/data/DetectorCard_ATLAS.dat	(revision 493)
+++ trunk/data/DetectorCard_ATLAS.dat	(revision 494)
@@ -3,33 +3,39 @@
 
 # Detector extension, in pseudorapidity units
-CEN_max_tracker    2.5                // Maximum tracker coverage          
-CEN_max_calo_cen   3.2                // central calorimeter coverage
-CEN_max_calo_fwd   4.9                // forward calorimeter pseudorapidity coverage
-CEN_max_mu         2.7                // muon chambers pseudorapidity coverage
+CEN_max_tracker    2.5              // Maximum tracker coverage          
+CEN_max_calo_cen   1.7              // central calorimeter coverage
+CEN_max_calo_ec    3.2              // end-cap calorimeter coverage
+CEN_max_calo_fwd   4.9              // forward calorimeter pseudorapidity coverage
+CEN_max_mu         2.7              // muon chambers pseudorapidity coverage
   
-# Energy resolution for electron/photon
+# Energy resolution for electron/photon in central/endcap/fwd/zdc calos
 # \sigma/E = C + N/E + S/\sqrt{E}, E in GeV
-ELG_Scen          0.10                // S term for central ECAL  http://arxiv.org/pdf/physics/0608012v1
-ELG_Ncen          0.0                 // N term for central ECAL  http://arxiv.org/pdf/physics/0608012v1
-ELG_Ccen          0.0017              // C term for central ECAL  http://arxiv.org/pdf/physics/0608012v1
-ELG_Sfwd          0.30407             // S term for forward FCAL  http://villaolmo.mib.infn.it/ICATPP9th_2005/Calorimetry/Schram.p.pdf
-ELG_Nfwd          1.1533              // N term for central FCAL  http://villaolmo.mib.infn.it/ICATPP9th_2005/Calorimetry/Schram.p.pdf
-ELG_Cfwd          0.0313              // C term for forward FCAL  http://villaolmo.mib.infn.it/ICATPP9th_2005/Calorimetry/Schram.p.pdf
+ELG_Scen          0.101             // S term for central ECAL  http://arxiv.org/pdf/physics/0608012v1 ; jinst8_08_s08003
+ELG_Ncen          0.0               // N term  
+ELG_Ccen          0.0017            // C term  
+ELG_Sec           0.101             // S term for ECAL endcap
+ELG_Nec           0.0               // N term  
+ELG_Cec           0.0017            // C term 
+ELG_Sfwd          0.285             // S term for forward FCAL  http://villaolmo.mib.infn.it/ICATPP9th_2005/Calorimetry/Schram.p.pdf
+ELG_Nfwd          0                 // N term  
+ELG_Cfwd          0.035             // C term  
 ELG_Szdc          0.70              // S term for ZDC
-ELG_Nzdc          0.0               // N term for ZDC
-ELG_Czdc          0.08              // C term for ZDC
+ELG_Nzdc          0.0               // N term  
+ELG_Czdc          0.08              // C term  
 
-
-# Energy resolution for hadrons in ecal/hcal/hf
+# Energy resolution for hadrons in central/endcap/fwd/zdc calos
 # \sigma/E = C + N/E + S/\sqrt{E}, E in GeV
-HAD_Shcal         0.58               // S term for central HCAL    http://arxiv.org/pdf/hep-ex/0004009v1
-HAD_Nhcal         1.7                // N term for central HCAL    http://arxiv.org/pdf/hep-ex/0004009v1
-HAD_Chcal         0.025              // C term for central HCAL    http://arxiv.org/pdf/hep-ex/0004009v1
-HAD_Shf           0.9681             // S term for FCAL            http://villaolmo.mib.infn.it/ICATPP9th_2005/Calorimetry/Schram.p.pdf
-HAD_Nhf           0.                 // N term for FCAL            http://villaolmo.mib.infn.it/ICATPP9th_2005/Calorimetry/Schram.p.pdf
-HAD_Chf           0.0524             // C term for FCAL            http://villaolmo.mib.infn.it/ICATPP9th_2005/Calorimetry/Schram.p.pdf
+HAD_Scen          0.5205            // S term for central HCAL    http://arxiv.org/pdf/hep-ex/0004009v1
+HAD_Ncen          1.59              // N term
+HAD_Ccen          0.0302            // C term
+HAD_Sec           0.706             // S term for HCAL endcap 
+HAD_Nec           0                 // N term
+HAD_Cec           0.05              // C term
+HAD_Sfwd          0.942             // S term for FCAL            http://villaolmo.mib.infn.it/ICATPP9th_2005/Calorimetry/Schram.p.pdf
+HAD_Nfwd          0.                // N term 
+HAD_Cfwd          0.075             // C term 
 HAD_Szdc          1.38              // S term for ZDC
-HAD_Nzdc          0.                // N term for ZDC
-HAD_Czdc          0.13              // C term for ZDC
+HAD_Nzdc          0.                // N term 
+HAD_Czdc          0.13              // C term 
 
 # Time resolution for ZDC/RP220/RP420
@@ -111,11 +117,12 @@
 VFD_s_zdc         140                   // distance of the Zero Degree Calorimeter, from the IP, in [m]
 
+#Hector parameters
 RP_220_s          220                   // distance of the RP to the IP, in meters
 RP_220_x          0.002                 // distance of the RP to the beam, in meters
 RP_420_s          420                   // distance of the RP to the IP, in meters
 RP_420_x          0.004                 // distance of the RP to the beam, in meters
-RP_beam1Card      data/LHCB1IR1.tfs
-RP_beam2Card      data/LHCB2IR1.tfs
-RP_IP_name        IP1
+RP_beam1Card      data/LHCB1IR1.tfs     // beam optics file, beam 1
+RP_beam2Card      data/LHCB2IR1.tfs     // beam optics file, beam 2
+RP_IP_name        IP1                   // tag for IP in Hector ; 'IP1' for ATLAS
 RP_offsetEl_x     0.097                 // horizontal separation between both beam, in meters
 RP_offsetEl_y     0                     // vertical separation between both beam, in meters
Index: trunk/data/DetectorCard_CMS.dat
===================================================================
--- trunk/data/DetectorCard_CMS.dat	(revision 493)
+++ trunk/data/DetectorCard_CMS.dat	(revision 494)
@@ -1,34 +1,41 @@
-DETECTOR CARD      # DO NOT REMOVE THIS IS A TAG!
+DETECTOR CARD      // DO NOT REMOVE THIS IS A TAG!
+# any line containing a dash symbol (#) will be completely ignored, whatever the position of this symbol
 
 # Detector extension, in pseudorapidity units
-CEN_max_tracker    2.5                // Maximum tracker coverage          
-CEN_max_calo_cen   3.0                // central calorimeter coverage
-CEN_max_calo_fwd   5.0                // forward calorimeter pseudorapidity coverage
-CEN_max_mu         2.4                // muon chambers pseudorapidity coverage
+CEN_max_tracker    2.5              // Maximum tracker coverage          
+CEN_max_calo_cen   1.7              // central calorimeter coverage
+CEN_max_calo_ec    3.0              // calorimeter endcap coverage
+CEN_max_calo_fwd   5.0              // forward calorimeter pseudorapidity coverage
+CEN_max_mu         2.4              // muon chambers pseudorapidity coverage
   
-# Energy resolution for electron/photon
+# Energy resolution for electron/photon in central/endcap/fwd/zdc calos
 # \sigma/E = C + N/E + S/\sqrt{E}, E in GeV
 ELG_Scen          0.05              // S term for central ECAL
-ELG_Ncen          0.25              // N term for central ECAL
-ELG_Ccen          0.005             // C term for central ECAL
+ELG_Ncen          0.25              // N term 
+ELG_Ccen          0.005             // C term 
+ELG_Sec           0.05              // S term for ECAL endcap
+ELG_Nec           0.25              // N term 
+ELG_Cec           0.005             // C term 
 ELG_Sfwd          2.084             // S term for FCAL
-ELG_Nfwd          0.0               // N term for FCAL
-ELG_Cfwd          0.107             // C term for FCAL
+ELG_Nfwd          0.0               // N term 
+ELG_Cfwd          0.107             // C term 
 ELG_Szdc          0.70              // S term for ZDC
-ELG_Nzdc          0.0               // N term for ZDC
-ELG_Czdc          0.08              // C term for ZDC
+ELG_Nzdc          0.0               // N term 
+ELG_Czdc          0.08              // C term 
 
-
-# Energy resolution for hadrons in ecal/hcal/hf
+# Energy resolution for hadrons in central/endcap/fwd/zdc calos
 # \sigma/E = C + N/E + S/\sqrt{E}, E in GeV
-HAD_Shcal         1.5               // S term for central HCAL 
-HAD_Nhcal         0.                // N term for central HCAL
-HAD_Chcal         0.05              // C term for central HCAL
-HAD_Shf           2.7               // S term for FCAL
-HAD_Nhf           0.                // N term for FCAL
-HAD_Chf           0.13              // C term for FCAL
+HAD_Scen          1.5               // S term for central HCAL 
+HAD_Ncen          0.                // N term 
+HAD_Ccen          0.05              // C term
+HAD_Sec           1.5               // S term for HCAL endcap
+HAD_Nec           0.                // N term
+HAD_Cec           0.05              // C term
+HAD_Sfwd          2.7               // S term for FCAL
+HAD_Nfwd          0.                // N term 
+HAD_Cfwd          0.13              // C term 
 HAD_Szdc          1.38              // S term for ZDC
-HAD_Nzdc          0.                // N term for ZDC
-HAD_Czdc          0.13              // C term for ZDC
+HAD_Nzdc          0.                // N term 
+HAD_Czdc          0.13              // C term
 
 # Time resolution for ZDC/RP220/RP420
@@ -59,5 +66,5 @@
 #
 
-# Thresholds for reconstructed objetcs, Pt in GeV
+# Thresholds for reconstructed objects, Pt in GeV
 PTCUT_elec       10.0
 PTCUT_muon       10.0
@@ -110,11 +117,12 @@
 VFD_s_zdc         140                   // distance of the Zero Degree Calorimeter, from the IP, in [m]
 
+#Hector parameters
 RP_220_s          220                   // distance of the RP to the IP, in meters
 RP_220_x          0.002                 // distance of the RP to the beam, in meters
 RP_420_s          420                   // distance of the RP to the IP, in meters
 RP_420_x          0.004                 // distance of the RP to the beam, in meters
-RP_beam1Card      data/LHCB1IR5_v6.500.tfs
-RP_beam2Card      data/LHCB2IR5_v6.500.tfs
-RP_IP_name        IP5
+RP_beam1Card      data/LHCB1IR5_v6.500.tfs // beam optics file, beam 1
+RP_beam2Card      data/LHCB2IR5_v6.500.tfs // beam optics file, beam 2
+RP_IP_name        IP5			// tag for IP in Hector ; 'IP1' for ATLAS
 RP_offsetEl_x     0.097                 // horizontal separation between both beam, in meters
 RP_offsetEl_y     0                     // vertical separation between both beam, in meters
Index: trunk/interface/SmearUtil.h
===================================================================
--- trunk/interface/SmearUtil.h	(revision 493)
+++ trunk/interface/SmearUtil.h	(revision 494)
@@ -92,29 +92,30 @@
   ~RESOLution() { delete [] TOWER_eta_edges; delete [] TOWER_dphi;};
  
-  // Detector coverage
+  // Detector coverage for the central detector
   float CEN_max_tracker;    // tracker pseudorapidity coverage
   float CEN_max_calo_cen;   // central calorimeter pseudorapidity coverage
+  float CEN_max_calo_ec;    // calorimeter endcap pseudorapidity coverage
   float CEN_max_calo_fwd;   // forward calorimeter pseudorapidity coverage
   float CEN_max_mu;         // muon chambers pseudorapidity coverage
 
-  float VFD_min_calo_vfd;  // very forward calorimeter pseudorapidity coverage
-  float VFD_max_calo_vfd;  // very forward calorimeter pseudorapidity coverage
+  float VFD_min_calo_vfd;   // very forward calorimeter pseudorapidity coverage
+  float VFD_max_calo_vfd;   // very forward calorimeter pseudorapidity coverage
   float VFD_min_zdc;        // coverage for Zero Degree Calorimeter, for photons and neutrons
-  float VFD_s_zdc;   // distance of the Zero Degree Calorimeter, from the Interaction poin, in [m]
-
-  float RP_220_s; // distance of the RP to the IP, in meters
-  float RP_220_x; // distance of the RP to the beam, in meters
-  float RP_420_s; // distance of the RP to the IP, in meters
-  float RP_420_x; // distance of the RP to the beam, in meters
-  string RP_beam1Card;   // optics file for beam 1
-  string RP_beam2Card;   // optics file for beam 2
-  string RP_IP_name;     // label for IP in the optics file ("IP1" or "IP5")
-  float  RP_offsetEl_s;  // distance from IP (in meter) where both beams separate
-  float  RP_offsetEl_x;  // distance of separation in horizontal plane, in meter
-  float  RP_offsetEl_y;  // distance of separation in vertical plane, in meter
-  float  RP_cross_x;	 // IP offset in horizontal plane, in micrometer
-  float  RP_cross_y;     // IP offset in vertical plane, in micrometer
-  float  RP_cross_ang_x; // half crossing angle, in microradian, horizontal plane
-  float  RP_cross_ang_y; // half crossing angle, in microradian, vertical plane
+  float VFD_s_zdc;          // distance of the Zero Degree Calorimeter, from the Interaction poin, in [m]
+
+  float RP_220_s;           // distance of the RP to the IP, in meters
+  float RP_220_x;           // distance of the RP to the beam, in meters
+  float RP_420_s;           // distance of the RP to the IP, in meters
+  float RP_420_x;           // distance of the RP to the beam, in meters
+  string RP_beam1Card;      // optics file for beam 1
+  string RP_beam2Card;      // optics file for beam 2
+  string RP_IP_name;        // label for IP in the optics file ("IP1" or "IP5")
+  float  RP_offsetEl_s;     // distance from IP (in meter) where both beams separate
+  float  RP_offsetEl_x;     // distance of separation in horizontal plane, in meter
+  float  RP_offsetEl_y;     // distance of separation in vertical plane, in meter
+  float  RP_cross_x;	    // IP offset in horizontal plane, in micrometer
+  float  RP_cross_y;        // IP offset in vertical plane, in micrometer
+  float  RP_cross_ang_x;    // half crossing angle, in microradian, horizontal plane
+  float  RP_cross_ang_y;    // half crossing angle, in microradian, vertical plane
 
 
@@ -124,4 +125,7 @@
   float ELG_Ncen;   // N term for central ECAL
   float ELG_Ccen;   // C term for central ECAL
+  float ELG_Sec ;   // S term for central ECAL endcap
+  float ELG_Nec ;   // N term for central ECAL endcap
+  float ELG_Cec ;   // C term for central ECAL endcap
   float ELG_Sfwd;   // S term for forward ECAL
   float ELG_Cfwd;   // C term for forward ECAL
@@ -131,15 +135,18 @@
   float ELG_Nzdc;   // N term for zdc-em sections
   
-  //energy resolution for hadrons in ecal/hcal/hf
+  //energy resolution for hadrons in ecal/hcal/fwd
   // \sigma/E = C + N/E + S/\sqrt{E}
-  float HAD_Shcal;   // S term for central HCAL // hadronic calorimeter
-  float HAD_Nhcal;   // N term for central HCAL
-  float HAD_Chcal;   // C term for central HCAL
-  float HAD_Shf;     // S term for central HF // forward calorimeter
-  float HAD_Nhf;     // N term for central HF
-  float HAD_Chf;     // C term for central HF
-  float HAD_Szdc;    // S term for zdc-had sections
-  float HAD_Czdc;    // C term for zdc-had sections
-  float HAD_Nzdc;    // N term for zdc-had sections
+  float HAD_Scen;   // S term for central HCAL // hadronic calorimeter -- previously HAD_Shcal
+  float HAD_Ncen;   // N term for central HCAL			       -- previously HAD_Nhcal
+  float HAD_Ccen;   // C term for central HCAL			       -- previously HAD_Chcal
+  float HAD_Sec ;   // S term for central HCAL endcap
+  float HAD_Nec ;   // N term for central HCAL endcap
+  float HAD_Cec ;   // C term for central HCAL endcap
+  float HAD_Sfwd;   // S term for central FCAL // forward calorimeter  -- previously HAD_Shf
+  float HAD_Nfwd;   // N term for central FCAL                         -- previously HAD_Nhf
+  float HAD_Cfwd;   // C term for central FCAL                         -- previously HAD_Chf
+  float HAD_Szdc;   // S term for zdc-had sections
+  float HAD_Czdc;   // C term for zdc-had sections
+  float HAD_Nzdc;   // N term for zdc-had sections
  
   // muon smearing
@@ -295,3 +302,4 @@
 void print_header();
 string get_time_date();
+void warning(const string oldname, const string newname);
 #endif
Index: trunk/src/FrogUtil.cc
===================================================================
--- trunk/src/FrogUtil.cc	(revision 493)
+++ trunk/src/FrogUtil.cc	(revision 494)
@@ -341,6 +341,8 @@
   unsigned int DetIdCountCalo = 1;
   
-  float rayConeD = tan(EtaToTheta(DET->CEN_max_calo_cen))*Lenght_Tracker/2;
-  float rayConeF = tan(EtaToTheta(DET->CEN_max_calo_cen))*Lenght_Calo/2;
+  //float rayConeD = tan(EtaToTheta(DET->CEN_max_calo_cen))*Lenght_Tracker/2;
+  //float rayConeF = tan(EtaToTheta(DET->CEN_max_calo_cen))*Lenght_Calo/2;
+  float rayConeD = tan(EtaToTheta(DET->CEN_max_calo_ec))*Lenght_Tracker/2;
+  float rayConeF = tan(EtaToTheta(DET->CEN_max_calo_ec))*Lenght_Calo/2;
   ray=Rayon_Calo;
   if(ray<rayConeF)ray=rayConeF;
@@ -457,5 +459,6 @@
   rayConeD = tan(EtaToTheta(DET->CEN_max_calo_fwd))*Lenght_Muon;
   rayConeF = tan(EtaToTheta(DET->CEN_max_calo_fwd))*Lenght_CaloFwd;
-  ray=tan(EtaToTheta(DET->CEN_max_calo_cen))*Lenght_CaloFwd;
+  //ray=tan(EtaToTheta(DET->CEN_max_calo_cen))*Lenght_CaloFwd;
+  ray=tan(EtaToTheta(DET->CEN_max_calo_ec))*Lenght_CaloFwd;
    
   for(double phi=0; phi<=twopi/frac;phi+=dphi){
Index: trunk/src/SmearUtil.cc
===================================================================
--- trunk/src/SmearUtil.cc	(revision 493)
+++ trunk/src/SmearUtil.cc	(revision 494)
@@ -54,5 +54,6 @@
   // Detector characteristics
   CEN_max_tracker   = 2.5;                // Maximum tracker coverage          
-  CEN_max_calo_cen  = 3.0;                // central calorimeter coverage
+  CEN_max_calo_cen  = 1.7;                // central calorimeter coverage
+  CEN_max_calo_ec   = 3.0;                // calorimeter endcap coverage
   CEN_max_calo_fwd  = 5.0;                // forward calorimeter pseudorapidity coverage
   CEN_max_mu        = 2.4;                // muon chambers pseudorapidity coverage
@@ -61,24 +62,30 @@
   // \sigma/E = C + N/E + S/\sqrt{E}
   ELG_Scen          = 0.05;              // S term for central ECAL
-  ELG_Ncen          = 0.25;              // N term for central ECAL
-  ELG_Ccen          = 0.005;             // C term for central ECAL
+  ELG_Ncen          = 0.25;              // N term 
+  ELG_Ccen          = 0.005;             // C term 
+  ELG_Sec           = 0.05;              // S term for central ECAL endcap
+  ELG_Nec           = 0.25;              // S term 
+  ELG_Cec           = 0.005;              // S term 
   ELG_Sfwd          = 2.084;             // S term for FCAL
-  ELG_Nfwd          = 0.0;               // N term for FCAL
-  ELG_Cfwd          = 0.107;             // C term for FCAL
+  ELG_Nfwd          = 0.0;               // N term 
+  ELG_Cfwd          = 0.107;             // C term 
   ELG_Szdc          = 0.70;              // S term for ZDC
-  ELG_Nzdc          = 0.0;               // N term for ZDC
-  ELG_Czdc          = 0.08;              // C term for ZDC 
-
-  // Energy resolution for hadrons in ecal/hcal/hf
+  ELG_Nzdc          = 0.0;               // N term 
+  ELG_Czdc          = 0.08;              // C term
+
+  // Energy resolution for hadrons in ecal/hcal/fwd
   // \sigma/E = C + N/E + S/\sqrt{E}
-  HAD_Shcal         = 1.5;               // S term for central HCAL
-  HAD_Nhcal         = 0.;                // N term for central HCAL
-  HAD_Chcal         = 0.05;              // C term for central HCAL
-  HAD_Shf           = 2.7;               // S term for FCAL 
-  HAD_Nhf           = 0.;                // N term for FCAL
-  HAD_Chf           = 0.13;              // C term for FCAL
+  HAD_Scen          = 1.5;               // S term for central HCAL
+  HAD_Ncen          = 0.;                // N term
+  HAD_Ccen          = 0.05;              // C term
+  HAD_Sec           = 1.5;               // S term for HCAL endcap
+  HAD_Nec           = 0.;                // N term 
+  HAD_Cec           = 0.05;              // C term 
+  HAD_Sfwd          = 2.7;               // S term for FCAL 
+  HAD_Nfwd          = 0.;                // N term
+  HAD_Cfwd          = 0.13;              // C term
   HAD_Szdc          = 1.38;              // S term for ZDC
-  HAD_Nzdc          = 0.;                // N term for ZDC 
-  HAD_Czdc          = 0.13;              // C term for ZDC 
+  HAD_Nzdc          = 0.;                // N term
+  HAD_Czdc          = 0.13;              // C term
 
   // Muon smearing
@@ -218,4 +225,5 @@
   CEN_max_tracker   = DET.CEN_max_tracker; 
   CEN_max_calo_cen  = DET.CEN_max_calo_cen;
+  CEN_max_calo_ec   = DET.CEN_max_calo_ec;
   CEN_max_calo_fwd  = DET.CEN_max_calo_fwd;
   CEN_max_mu        = DET.CEN_max_mu;
@@ -225,4 +233,7 @@
   ELG_Ncen          = DET.ELG_Ncen;
   ELG_Ccen          = DET.ELG_Ccen;
+  ELG_Sec           = DET.ELG_Sec;
+  ELG_Nec           = DET.ELG_Nec;
+  ELG_Cec           = DET.ELG_Cec;
   ELG_Cfwd          = DET.ELG_Cfwd;
   ELG_Sfwd          = DET.ELG_Sfwd;
@@ -232,11 +243,14 @@
   ELG_Nzdc          = DET.ELG_Nzdc;
 
-  // Energy resolution for hadrons in ecal/hcal/hf/zdc
-  HAD_Shcal         = DET.HAD_Shcal;
-  HAD_Nhcal         = DET.HAD_Nhcal;
-  HAD_Chcal         = DET.HAD_Chcal;
-  HAD_Shf           = DET.HAD_Shf;
-  HAD_Nhf           = DET.HAD_Nhf;
-  HAD_Chf           = DET.HAD_Chf;
+  // Energy resolution for hadrons in ecal/hcal/fwd/zdc
+  HAD_Scen          = DET.HAD_Scen;
+  HAD_Ncen          = DET.HAD_Ncen;
+  HAD_Ccen          = DET.HAD_Ccen;
+  HAD_Sec           = DET.HAD_Sec;
+  HAD_Nec           = DET.HAD_Nec;
+  HAD_Cec           = DET.HAD_Cec;
+  HAD_Sfwd           = DET.HAD_Sfwd;
+  HAD_Nfwd           = DET.HAD_Nfwd;
+  HAD_Cfwd           = DET.HAD_Cfwd;
   HAD_Szdc          = DET.HAD_Szdc;
   HAD_Nzdc          = DET.HAD_Nzdc;
@@ -365,4 +379,5 @@
   CEN_max_tracker   = DET.CEN_max_tracker; 
   CEN_max_calo_cen  = DET.CEN_max_calo_cen;
+  CEN_max_calo_ec   = DET.CEN_max_calo_ec;
   CEN_max_calo_fwd  = DET.CEN_max_calo_fwd;
   CEN_max_mu        = DET.CEN_max_mu;
@@ -372,4 +387,7 @@
   ELG_Ncen          = DET.ELG_Ncen;
   ELG_Ccen          = DET.ELG_Ccen;
+  ELG_Sec           = DET.ELG_Sec;
+  ELG_Nec           = DET.ELG_Nec;
+  ELG_Cec           = DET.ELG_Cec;
   ELG_Cfwd          = DET.ELG_Cfwd;
   ELG_Sfwd          = DET.ELG_Sfwd;
@@ -379,11 +397,14 @@
   ELG_Nzdc          = DET.ELG_Nzdc;
 
-  // Energy resolution for hadrons in ecal/hcal/hf
-  HAD_Shcal         = DET.HAD_Shcal;
-  HAD_Nhcal         = DET.HAD_Nhcal;
-  HAD_Chcal         = DET.HAD_Chcal;
-  HAD_Shf           = DET.HAD_Shf;
-  HAD_Nhf           = DET.HAD_Nhf;
-  HAD_Chf           = DET.HAD_Chf;
+  // Energy resolution for hadrons in ecal/hcal/fwd/zdc
+  HAD_Scen          = DET.HAD_Scen ;
+  HAD_Ncen          = DET.HAD_Ncen;
+  HAD_Ccen          = DET.HAD_Ccen;
+  HAD_Sec           = DET.HAD_Sec;
+  HAD_Nec           = DET.HAD_Nec;
+  HAD_Cec           = DET.HAD_Cec;
+  HAD_Sfwd          = DET.HAD_Sfwd;
+  HAD_Nfwd          = DET.HAD_Nfwd;
+  HAD_Cfwd          = DET.HAD_Cfwd;
   HAD_Szdc          = DET.HAD_Szdc;
   HAD_Nzdc          = DET.HAD_Nzdc;
@@ -528,4 +549,5 @@
     return;
   }
+  bool CEN_max_calo_ec_flag = false;
   
   while (getline(fichier_a_lire,temp_string)) {
@@ -534,11 +556,12 @@
     string varname;
     float value; int ivalue; string svalue;
-    
+
     if(strstr(temp_string.c_str(),"#")) { }
     else if(strstr(temp_string.c_str(),"CEN_max_tracker"))  {curstring >> varname >> value; CEN_max_tracker   = value;}
     else if(strstr(temp_string.c_str(),"CEN_max_calo_cen")) {curstring >> varname >> value; CEN_max_calo_cen  = value;}
+    else if(strstr(temp_string.c_str(),"CEN_max_calo_ec"))  {CEN_max_calo_ec_flag=true; curstring >> varname >> value; CEN_max_calo_ec   = value;}
     else if(strstr(temp_string.c_str(),"CEN_max_calo_fwd")) {curstring >> varname >> value; CEN_max_calo_fwd  = value;}
     else if(strstr(temp_string.c_str(),"CEN_max_mu"))       {curstring >> varname >> value; CEN_max_mu        = value;}
-    
+
     else if(strstr(temp_string.c_str(),"VFD_min_calo_vfd")) {curstring >> varname >> value; VFD_min_calo_vfd  = value;}
     else if(strstr(temp_string.c_str(),"VFD_max_calo_vfd")) {curstring >> varname >> value; VFD_max_calo_vfd  = value;}
@@ -565,4 +588,7 @@
     else if(strstr(temp_string.c_str(),"ELG_Ncen"))         {curstring >> varname >> value; ELG_Ncen          = value;}
     else if(strstr(temp_string.c_str(),"ELG_Ccen"))         {curstring >> varname >> value; ELG_Ccen          = value;}
+    else if(strstr(temp_string.c_str(),"ELG_Sec"))          {curstring >> varname >> value; ELG_Sec           = value;}
+    else if(strstr(temp_string.c_str(),"ELG_Nec"))          {curstring >> varname >> value; ELG_Nec           = value;}
+    else if(strstr(temp_string.c_str(),"ELG_Cec"))          {curstring >> varname >> value; ELG_Cec           = value;}
     else if(strstr(temp_string.c_str(),"ELG_Sfwd"))         {curstring >> varname >> value; ELG_Sfwd          = value;}
     else if(strstr(temp_string.c_str(),"ELG_Cfwd"))         {curstring >> varname >> value; ELG_Cfwd          = value;}
@@ -572,13 +598,26 @@
     else if(strstr(temp_string.c_str(),"ELG_Nzdc"))         {curstring >> varname >> value; ELG_Nzdc          = value;}
 
-    else if(strstr(temp_string.c_str(),"HAD_Shcal"))        {curstring >> varname >> value; HAD_Shcal         = value;}
-    else if(strstr(temp_string.c_str(),"HAD_Nhcal"))        {curstring >> varname >> value; HAD_Nhcal         = value;}
-    else if(strstr(temp_string.c_str(),"HAD_Chcal"))        {curstring >> varname >> value; HAD_Chcal         = value;}
-    else if(strstr(temp_string.c_str(),"HAD_Shf"))          {curstring >> varname >> value; HAD_Shf           = value;}
-    else if(strstr(temp_string.c_str(),"HAD_Nhf"))          {curstring >> varname >> value; HAD_Nhf           = value;}
-    else if(strstr(temp_string.c_str(),"HAD_Chf"))          {curstring >> varname >> value; HAD_Chf           = value;}
+    else if(strstr(temp_string.c_str(),"HAD_Shcal"))        {warning("HAD_Shcal","HAD_Scen"); curstring >> varname >> value; HAD_Scen          = value;}
+    else if(strstr(temp_string.c_str(),"HAD_Nhcal"))        {warning("HAD_Nhcal","HAD_Ncen"); curstring >> varname >> value; HAD_Ncen          = value;}
+    else if(strstr(temp_string.c_str(),"HAD_Chcal"))        {warning("HAD_Chcal","HAD_Ccen"); curstring >> varname >> value; HAD_Ccen          = value;}
+    else if(strstr(temp_string.c_str(),"HAD_Shf"))          {warning("HAD_Shf","HAD_Sfwd"); curstring >> varname >> value; HAD_Sfwd          = value;}
+    else if(strstr(temp_string.c_str(),"HAD_Nhf"))          {warning("HAD_Nhf","HAD_Nfwd"); curstring >> varname >> value; HAD_Nfwd          = value;}
+    else if(strstr(temp_string.c_str(),"HAD_Chf"))          {warning("HAD_Chf","HAD_Cfwd"); curstring >> varname >> value; HAD_Cfwd          = value;}
+
+
+
+    else if(strstr(temp_string.c_str(),"HAD_Scen"))         {curstring >> varname >> value; HAD_Scen          = value;}
+    else if(strstr(temp_string.c_str(),"HAD_Ncen"))         {curstring >> varname >> value; HAD_Ncen          = value;}
+    else if(strstr(temp_string.c_str(),"HAD_Ccen"))         {curstring >> varname >> value; HAD_Ccen          = value;}
+    else if(strstr(temp_string.c_str(),"HAD_Sec"))          {curstring >> varname >> value; HAD_Sec           = value;}
+    else if(strstr(temp_string.c_str(),"HAD_Nec"))          {curstring >> varname >> value; HAD_Nec           = value;}
+    else if(strstr(temp_string.c_str(),"HAD_Cec"))          {curstring >> varname >> value; HAD_Cec           = value;}
+    else if(strstr(temp_string.c_str(),"HAD_Sfwd"))         {curstring >> varname >> value; HAD_Sfwd          = value;}
+    else if(strstr(temp_string.c_str(),"HAD_Nfwd"))         {curstring >> varname >> value; HAD_Nfwd          = value;}
+    else if(strstr(temp_string.c_str(),"HAD_Cfwd"))         {curstring >> varname >> value; HAD_Cfwd          = value;}
     else if(strstr(temp_string.c_str(),"HAD_Szdc"))         {curstring >> varname >> value; HAD_Szdc          = value;}
     else if(strstr(temp_string.c_str(),"HAD_Nzdc"))         {curstring >> varname >> value; HAD_Nzdc          = value;}
     else if(strstr(temp_string.c_str(),"HAD_Czdc"))         {curstring >> varname >> value; HAD_Czdc          = value;}
+
     else if(strstr(temp_string.c_str(),"ZDC_T_resolution")) {curstring >> varname >> value; ZDC_T_resolution  = value;}
     else if(strstr(temp_string.c_str(),"RP220_T_resolution")) {curstring >> varname >> value; RP220_T_resolution  = value;}
@@ -632,4 +671,23 @@
 
     else if(strstr(temp_string.c_str(),"PdgTableFilename"))     {curstring >> varname >> svalue; PdgTableFilename = svalue;}
+  }
+
+  // for compatibility with old data cards
+  if(!CEN_max_calo_ec_flag) {
+	cout << "**   Warning \'CEN_max_calo_ec\' not found in datacard.              **"<< endl;
+	cout << "**     Same values will be applied for calorimeter endcaps         **"<< endl;
+        cout << "**     as for central calorimeters                                 **"<< endl;
+        string text = "**     Please update your card ("+ datacard +")";
+	cout << left << setw(67) << text << right << setw(2) << "**" << endl;
+	cout << "** This change is 100\% backward compatibly with older DetectorCard. **" << endl;
+	cout << "** However, please update your DetectorCard. **" << endl;
+	CEN_max_calo_ec	 = CEN_max_calo_cen;
+	CEN_max_calo_cen = CEN_max_calo_cen/2;	
+        ELG_Sec = ELG_Scen;
+        ELG_Nec = ELG_Ncen;
+        ELG_Cec = ELG_Ccen;
+	HAD_Sec = HAD_Scen;
+        HAD_Nec = HAD_Ncen;
+        HAD_Cec = HAD_Ccen;
   }
  
@@ -766,5 +824,7 @@
   f_out << left << setw(30) <<"* Maximum central calorimeter:               "<<""
 	<< left << setw(10) <<CEN_max_calo_cen  <<""<< right << setw(15)<<"*"<<"\n";
-  f_out << left << setw(30) <<"* Maximum forward calorimeter:               "<<""
+  f_out << left << setw(30) <<"* Maximum endcap calorimeter:                "<<""
+	<< left << setw(10) <<CEN_max_calo_ec  <<""<< right << setw(15)<<"*"<<"\n";
+  f_out << left << setw(30) <<"* Maximum central calorimeter:               "<<""
 	<< left << setw(10) <<CEN_max_calo_fwd  <<""<< right << setw(15)<<"*"<<"\n";
   f_out << left << setw(30) <<"* Muon chambers coverage:                    "<<""
@@ -790,17 +850,17 @@
     f_out << left << setw(35) <<"* Datacard for beam 2: "<<""
           << left << setw(25) <<RP_beam2Card            <<""<< right << setw(10)<<"*"<<"\n";
-    f_out << left << setw(44) <<"* Beam separation, in meters(hor):"<<""
+    f_out << left << setw(54) <<"* Beam separation, in meters(hor):"<<""
           << left << setw(6) << RP_offsetEl_x          <<""<< right << setw(10)<<"*"<<"\n";
-    f_out << left << setw(44) <<"* Beam separation, in meters(ver):"<<""
+    f_out << left << setw(54) <<"* Beam separation, in meters(ver):"<<""
           << left << setw(6) << RP_offsetEl_y          <<""<< right << setw(10)<<"*"<<"\n";
-    f_out << left << setw(44) <<"* Distance from IP for Beam separation (m):"<<""
+    f_out << left << setw(54) <<"* Distance from IP for Beam separation (m):"<<""
           << left << setw(6) <<RP_offsetEl_s           <<""<< right << setw(10)<<"*"<<"\n";
-    f_out << left << setw(44) <<"* X offset of beam crossing in micrometers:"<<""
+    f_out << left << setw(54) <<"* X offset of beam crossing in micrometers:"<<""
           << left << setw(6) <<RP_cross_x           <<""<< right << setw(10)<<"*"<<"\n";
-    f_out << left << setw(44) <<"* Y offset of beam crossing in micrometers:"<<""
+    f_out << left << setw(54) <<"* Y offset of beam crossing in micrometers:"<<""
           << left << setw(6) <<RP_cross_y           <<""<< right << setw(10)<<"*"<<"\n";
-    f_out << left << setw(44) <<"* X Angle of beam crossing:"<<""
+    f_out << left << setw(54) <<"* X Angle of beam crossing:"<<""
           << left << setw(6) <<RP_cross_ang_x          <<""<< right << setw(10)<<"*"<<"\n";
-    f_out << left << setw(44) <<"* Y Angle of beam crossing:"<<""
+    f_out << left << setw(54) <<"* Y Angle of beam crossing:"<<""
           << left << setw(6) <<RP_cross_ang_y          <<""<< right << setw(10)<<"*"<<"\n";
     f_out<<"*                                                                    *"<<"\n";
@@ -845,4 +905,12 @@
   f_out << left << setw(30) <<"* C term for central ECAL: "<<""
 	<< left << setw(30) <<ELG_Ccen       <<""<< right << setw(10)<<"*"<<"\n";
+  f_out << left << setw(30) <<"* S term for ECAL end-cap: "<<""
+        << left << setw(30) <<ELG_Sec       <<""<< right << setw(10)<<"*"<<"\n";
+  f_out << left << setw(30) <<"* N term for ECAL end-cap: "<<""
+        << left << setw(30) <<ELG_Nec       <<""<< right << setw(10)<<"*"<<"\n";
+  f_out << left << setw(30) <<"* C term for ECAL end-cap: "<<""
+        << left << setw(30) <<ELG_Cec       <<""<< right << setw(10)<<"*"<<"\n";
+
+
   f_out << left << setw(30) <<"* S term for FCAL: "<<""
 	<< left << setw(30) <<ELG_Sfwd       <<""<< right << setw(10)<<"*"<<"\n";
@@ -864,15 +932,21 @@
   f_out<<"*                                                                    *"<<"\n";
   f_out << left << setw(30) <<"* S term for central HCAL: "<<""
-	<< left << setw(30) <<HAD_Shcal       <<""<< right << setw(10)<<"*"<<"\n";
+	<< left << setw(30) <<HAD_Scen       <<""<< right << setw(10)<<"*"<<"\n";
   f_out << left << setw(30) <<"* N term for central HCAL: "<<""
-	<< left << setw(30) <<HAD_Nhcal       <<""<< right << setw(10)<<"*"<<"\n";
+	<< left << setw(30) <<HAD_Ncen       <<""<< right << setw(10)<<"*"<<"\n";
   f_out << left << setw(30) <<"* C term for central HCAL: "<<""
-	<< left << setw(30) <<HAD_Chcal       <<""<< right << setw(10)<<"*"<<"\n";
+	<< left << setw(30) <<HAD_Ccen       <<""<< right << setw(10)<<"*"<<"\n";
+  f_out << left << setw(30) <<"* S term for HCAL endcap:  "<<""
+        << left << setw(30) <<HAD_Sec       <<""<< right << setw(10)<<"*"<<"\n";
+  f_out << left << setw(30) <<"* N term for HCAL endcap:  "<<""
+        << left << setw(30) <<HAD_Nec       <<""<< right << setw(10)<<"*"<<"\n";
+  f_out << left << setw(30) <<"* C term for HCAL endcap:  "<<""
+        << left << setw(30) <<HAD_Cec       <<""<< right << setw(10)<<"*"<<"\n";
   f_out << left << setw(30) <<"* S term for FCAL: "<<""
-	<< left << setw(30) <<HAD_Shf         <<""<< right << setw(10)<<"*"<<"\n";
+	<< left << setw(30) <<HAD_Sfwd        <<""<< right << setw(10)<<"*"<<"\n";
   f_out << left << setw(30) <<"* N term for FCAL: "<<""
-	<< left << setw(30) <<HAD_Nhf         <<""<< right << setw(10)<<"*"<<"\n";
+	<< left << setw(30) <<HAD_Nfwd        <<""<< right << setw(10)<<"*"<<"\n";
   f_out << left << setw(30) <<"* C term for FCAL: "<<""
-	<< left << setw(30) <<HAD_Chf         <<""<< right << setw(10)<<"*"<<"\n";
+	<< left << setw(30) <<HAD_Cfwd        <<""<< right << setw(10)<<"*"<<"\n";
   f_out << left << setw(30) <<"* S term for ZDC: "<<""
         << left << setw(30) <<HAD_Szdc        <<""<< right << setw(10)<<"*"<<"\n";
@@ -1129,5 +1203,11 @@
 					 pow(ELG_Scen*sqrt(energy),2) ));
   } 
-  if(fabs(electron.Eta()) > CEN_max_tracker && fabs(electron.Eta()) < CEN_max_calo_fwd){
+  else if(fabs(electron.Eta()) >= CEN_max_tracker && fabs(electron.Eta()) < CEN_max_calo_ec){
+    energyS = gRandom->Gaus(energy, sqrt(
+                                         pow(ELG_Nec,2) +
+                                         pow(ELG_Cec*energy,2) +
+                                         pow(ELG_Sec*sqrt(energy),2) ) );
+  }
+  else if(fabs(electron.Eta()) >= CEN_max_calo_ec && fabs(electron.Eta()) < CEN_max_calo_fwd){
     energyS = gRandom->Gaus(energy, sqrt(
 					 pow(ELG_Nfwd,2) +
@@ -1173,8 +1253,7 @@
   if(fabs(hadron.Eta()) < CEN_max_calo_cen) {
    energyS1 = gRandom->Gaus(energy_hcal, sqrt(
-					      pow(HAD_Nhcal,2) +
-					      pow(HAD_Chcal*energy_hcal,2) + 
-					      pow(HAD_Shcal*sqrt(energy_hcal),2) )) ;
-     
+					      pow(HAD_Ncen,2) +
+					      pow(HAD_Ccen*energy_hcal,2) + 
+					      pow(HAD_Scen*sqrt(energy_hcal),2) )) ;
       
    energyS2 =  gRandom->Gaus(energy_ecal, sqrt(
@@ -1185,9 +1264,22 @@
   energyS = ((energyS1>0)?energyS1:0) + ((energyS2>0)?energyS2:0);
   } 
-  if(fabs(hadron.Eta()) > CEN_max_calo_cen && fabs(hadron.Eta()) < CEN_max_calo_fwd){ 
+  else if(fabs(hadron.Eta()) >= CEN_max_calo_cen && fabs(hadron.Eta()) < CEN_max_calo_ec) {
+   energyS1 = gRandom->Gaus(energy_hcal, sqrt(
+                                              pow(HAD_Nec,2) +
+                                              pow(HAD_Cec*energy_hcal,2) +
+                                              pow(HAD_Sec*sqrt(energy_hcal),2) )) ;
+
+   energyS2 =  gRandom->Gaus(energy_ecal, sqrt(
+                                      pow(ELG_Nec,2) +
+                                      pow(ELG_Cec*energy_ecal,2) +
+                                      pow(ELG_Sec*sqrt(energy_ecal),2) ) );
+
+  energyS = ((energyS1>0)?energyS1:0) + ((energyS2>0)?energyS2:0);
+  }
+  else if(fabs(hadron.Eta()) >= CEN_max_calo_ec && fabs(hadron.Eta()) < CEN_max_calo_fwd){ 
     energyS = gRandom->Gaus(energy, sqrt(
-			    pow(HAD_Nhf,2) +
-			    pow(HAD_Chf*energy,2) +
-			    pow(HAD_Shf*sqrt(energy),2) ));
+			    pow(HAD_Nfwd,2) +
+			    pow(HAD_Cfwd*energy,2) +
+			    pow(HAD_Sfwd*sqrt(energy),2) ));
 }
   
@@ -1667,2 +1759,7 @@
 }
 
+void warning(const string oldname, const string newname) {
+  string text = "** Warning in datacard: " + oldname + " deprecated. Use " + newname + " instead.";
+  cout << left  << setw(67) << text 
+       << right << setw(2)  <<"**" << endl;
+}
