From fd78960e74292da5519bf270fb6fc48880ffcc1e Mon Sep 17 00:00:00 2001
From: Walter Lampl <Walter.Lampl@cern.ch>
Date: Tue, 13 Nov 2018 10:33:43 +0100
Subject: [PATCH] Bugfix in CaloClusterMomentsMaker: Respect
 m_calculateLArHVFraction flag

---
 Calorimeter/CaloRec/src/CaloClusterMomentsMaker.cxx | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/Calorimeter/CaloRec/src/CaloClusterMomentsMaker.cxx b/Calorimeter/CaloRec/src/CaloClusterMomentsMaker.cxx
index ff4c32a6ead..7ebcf71ff79 100644
--- a/Calorimeter/CaloRec/src/CaloClusterMomentsMaker.cxx
+++ b/Calorimeter/CaloRec/src/CaloClusterMomentsMaker.cxx
@@ -538,11 +538,11 @@ CaloClusterMomentsMaker::execute(const EventContext& ctx,
 	  ncell++;
 	}
       } //end of loop over all cells
-
-      const auto hvFrac=m_larHVFraction->getLArHVFrac(theCluster->getCellLinks(),ctx);
-      eBadLArHV= hvFrac.first;
-      nBadLArHV=hvFrac.second;
-      
+      if (m_calculateLArHVFraction) {
+	const auto hvFrac=m_larHVFraction->getLArHVFrac(theCluster->getCellLinks(),ctx);
+	eBadLArHV= hvFrac.first;
+	nBadLArHV=hvFrac.second;
+      }
 
       if ( w > 0 ) {
 	mass = w*w - mx*mx - my*my - mz*mz;
-- 
GitLab