From fecc4d7f33c72eb1ec939cac791e8516f32a1164 Mon Sep 17 00:00:00 2001
From: christos <christos@cern.ch>
Date: Tue, 17 Dec 2019 02:29:54 +0000
Subject: [PATCH] use EMFraction*clusterE for the EM energy as the egamma
 EMFraction can account for E4 scintillators

---
 .../egammaAlgs/python/egammaSelectedTrackCopy.py    |  2 +-
 .../python/egammaSelectedTrackCopyConfig.py         |  2 +-
 .../src/egammaCaloClusterSelector.cxx               | 13 ++++++-------
 3 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/Reconstruction/egamma/egammaAlgs/python/egammaSelectedTrackCopy.py b/Reconstruction/egamma/egammaAlgs/python/egammaSelectedTrackCopy.py
index c894dab626e9..56cad5d9d0e3 100644
--- a/Reconstruction/egamma/egammaAlgs/python/egammaSelectedTrackCopy.py
+++ b/Reconstruction/egamma/egammaAlgs/python/egammaSelectedTrackCopy.py
@@ -15,7 +15,7 @@ from egammaCaloTools import egammaCaloToolsConf
 egammaCaloClusterGSFSelector = ToolFactory( egammaCaloToolsConf.egammaCaloClusterSelector,
                                             name = 'caloClusterGSFSelector',
                                             EMEtRanges = [2500.],
-                                            EMFCuts = [0.7]
+                                            EMFCuts = [0.65]
                                           )  
 
 egammaSelectedTrackCopy = AlgFactory( egammaAlgsConf.egammaSelectedTrackCopy,
diff --git a/Reconstruction/egamma/egammaAlgs/python/egammaSelectedTrackCopyConfig.py b/Reconstruction/egamma/egammaAlgs/python/egammaSelectedTrackCopyConfig.py
index 026cbd58df74..f5e60230a93d 100644
--- a/Reconstruction/egamma/egammaAlgs/python/egammaSelectedTrackCopyConfig.py
+++ b/Reconstruction/egamma/egammaAlgs/python/egammaSelectedTrackCopyConfig.py
@@ -19,7 +19,7 @@ def egammaSelectedTrackCopyCfg(flags, name='egammaSelectedTrackCopy', **kwargs):
     if "egammaCaloClusterSelector" not in kwargs:
         egammaCaloClusterGSFSelector = egammaCaloClusterSelector(name='caloClusterGSFSelector',
                                                                  EMEtRanges = [2500.],
-                                                                 EMFCuts = [0.7]
+                                                                 EMFCuts = [0.65]
                                                                  )
 
         kwargs["egammaCaloClusterSelector"] = egammaCaloClusterGSFSelector
diff --git a/Reconstruction/egamma/egammaCaloTools/src/egammaCaloClusterSelector.cxx b/Reconstruction/egamma/egammaCaloTools/src/egammaCaloClusterSelector.cxx
index 39314800fdf1..daefab1ce4f0 100644
--- a/Reconstruction/egamma/egammaCaloTools/src/egammaCaloClusterSelector.cxx
+++ b/Reconstruction/egamma/egammaCaloTools/src/egammaCaloClusterSelector.cxx
@@ -97,8 +97,11 @@ bool egammaCaloClusterSelector::passSelection(const xAOD::CaloCluster* cluster)
   const double eta2 = fabs(cluster->etaBE(2));
   if(eta2>10){
     return false;
-  }  
-  const double EMEnergy= cluster->energyBE(0)+cluster->energyBE(1)+cluster->energyBE(2)+cluster->energyBE(3);
+  }
+  //use the egamma definition of EMFrac (includes presampler , helps with eff in the crack)
+  static const  SG::AuxElement::ConstAccessor<float> acc("EMFraction");
+  const double emFrac = acc.isAvailable(*cluster)? acc(*cluster) : 0.;
+  const double EMEnergy= cluster->e()* emFrac;
   const double EMEt = EMEnergy/cosh(eta2);
   const double bin = findETBin(EMEt);
   /* Check for the minimum EM Et required this should be the 0th entry in EMEtRanges*/
@@ -106,11 +109,7 @@ bool egammaCaloClusterSelector::passSelection(const xAOD::CaloCluster* cluster)
     ATH_MSG_DEBUG("Cluster EM Et is lower than the lowest cut in EMEtRanges dont make ROI");
     return false;
   }
-
-  //use the egamma definition of EMFrac (includes presampler , helps with eff in the crack)
-  static const  SG::AuxElement::ConstAccessor<float> acc("EMFraction");
-  const double emFrac = acc.isAvailable(*cluster)? acc(*cluster) : 0.;
-  /* EM fraction cut*/
+ /* EM fraction cut*/
   if ( m_EMFCuts.size() != 0 && emFrac < m_EMFCuts[bin] ){
     ATH_MSG_DEBUG("Cluster failed EM Fraction cut: don't make ROI");
     return false;
-- 
GitLab