From be244f858d9d8dfac1dd88a86f46cefceee5307c Mon Sep 17 00:00:00 2001
From: Walter Lampl <Walter.Lampl@cern.ch>
Date: Wed, 17 Dec 2014 17:47:02 +0100
Subject: [PATCH] CaloLumiBCIDTool: Add accessor with Identifier (obo Naoko)
 (CaloTools-00-09-46)

	* CaloLumiBCIDTool: Add accessor with Identifier (obo Naoko)
	* tag CaloTools-00-09-46

2014-11-14 Walter Lampl <walter.lampl@ cern.ch>
	* use hash from CaloDDE instead of re-computing it
	* tag CaloTools-00-09-45

2014-11-08  scott snyder  <snyder@bnl.gov>

        * Tagging CaloTools-00-09-44.
	* Fix coverity warning.
---
 .../CaloTools/CaloTools/CaloLumiBCIDTool.h    |  2 +-
 .../CaloTools/src/CaloLumiBCIDTool.cxx        | 22 +++++++++++++++++--
 Calorimeter/CaloTools/src/CaloNoiseTool.cxx   |  2 +-
 3 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/Calorimeter/CaloTools/CaloTools/CaloLumiBCIDTool.h b/Calorimeter/CaloTools/CaloTools/CaloLumiBCIDTool.h
index de006bf82429..59529862621b 100755
--- a/Calorimeter/CaloTools/CaloTools/CaloLumiBCIDTool.h
+++ b/Calorimeter/CaloTools/CaloTools/CaloLumiBCIDTool.h
@@ -102,7 +102,7 @@ public:
 
   float average(const CaloDetDescrElement* caloDDE,unsigned int bcid);
 
-
+  float average(const Identifier caloDDE,unsigned int bcid);
 };
 
 #endif
diff --git a/Calorimeter/CaloTools/src/CaloLumiBCIDTool.cxx b/Calorimeter/CaloTools/src/CaloLumiBCIDTool.cxx
index 0ec79df58bc7..2590ceb530c0 100755
--- a/Calorimeter/CaloTools/src/CaloLumiBCIDTool.cxx
+++ b/Calorimeter/CaloTools/src/CaloLumiBCIDTool.cxx
@@ -406,10 +406,28 @@ float CaloLumiBCIDTool::average(const CaloDetDescrElement* caloDDE,unsigned int
     StatusCode sc = this->computeValues(bcid);
     if (sc.isFailure()) return 0.;
   }
-  const Identifier CellID = caloDDE->identify();
+  // const Identifier CellID = caloDDE->identify();
+  //if (m_calocell_id->is_tile(CellID)) return 0.;
 
-  if (m_calocell_id->is_tile(CellID)) return 0.;
+  if (caloDDE->is_tile()) return 0;
+  int i2 = (int) caloDDE->calo_hash();//(m_calocell_id->calo_cell_hash(CellID));
+  if (i2>=m_ncell) return 0.;
+  unsigned int index = m_symCellIndex[i2];
+  if (index>=m_eshift_sym.size()) return 0.;
+  return m_eshift_sym[index];
+}
+
+//-------------------------------------------------
+
+float CaloLumiBCIDTool::average(const Identifier CellID,unsigned int bcid)
+{
+  if (bcid != m_bcid && bcid !=0 ) m_cacheValid=false;
+  if (!m_cacheValid) {
+    StatusCode sc = this->computeValues(bcid);
+    if (sc.isFailure()) return 0.;
+  }
 
+  if (m_calocell_id->is_tile(CellID)) return 0.;  
   int i2 = (int) (m_calocell_id->calo_cell_hash(CellID));
   if (i2>=m_ncell) return 0.;
   unsigned int index = m_symCellIndex[i2];
diff --git a/Calorimeter/CaloTools/src/CaloNoiseTool.cxx b/Calorimeter/CaloTools/src/CaloNoiseTool.cxx
index e67ba962dbfc..5c474ca13b50 100755
--- a/Calorimeter/CaloTools/src/CaloNoiseTool.cxx
+++ b/Calorimeter/CaloTools/src/CaloNoiseTool.cxx
@@ -284,7 +284,7 @@ CaloNoiseTool::geoInit(IOVSVC_CALLBACK_ARGS)
     m_CachedGetNoiseCDDE=&CaloNoiseTool::totalNoiseRMS;
     m_CachedGetNoiseCELL=&CaloNoiseTool::totalNoiseRMS;
   }
-  if(m_CachedGetNoiseCELL==NULL || 
+  if(m_CachedGetNoiseCDDE==NULL || 
      m_CachedGetNoiseCELL==NULL) {
     log << MSG::ERROR << "Unknown noise !" << endreq;
     return StatusCode::FAILURE;
-- 
GitLab