diff --git a/Calorimeter/CaloRec/python/CaloClusterTopoGetter.py b/Calorimeter/CaloRec/python/CaloClusterTopoGetter.py index 431ece67c754945316c58822807277c26fc9697b..da8d1da47ce23e065e3aa49285657b5ffd23401e 100644 --- a/Calorimeter/CaloRec/python/CaloClusterTopoGetter.py +++ b/Calorimeter/CaloRec/python/CaloClusterTopoGetter.py @@ -39,13 +39,6 @@ CaloNoiseCondAlg() #For LCWeightsTool needs electronic noise CaloNoiseCondAlg(noisetype="electronicNoise") -from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault -theCaloNoiseTool = CaloNoiseToolDefault() -from AthenaCommon.AppMgr import ToolSvc -ToolSvc += theCaloNoiseTool - - - def addSnapshot(corrName,contName): from AthenaCommon.AlgSequence import AlgSequence @@ -125,7 +118,6 @@ class CaloClusterTopoGetter ( Configured ) : # H1Weight = H1ClusterCellWeightTool("H1Weight") # H1Weight.CorrectionKey = "H1ClusterCellWeights" # H1Weight.SignalOverNoiseCut = 2.0 - # H1Weight.CaloNoiseTool = theCaloNoiseTool # # OOCC = OutOfClusterCorrectionTool("OOCC") # OOCC.CorrectionKey = "OOCCorrection" @@ -262,8 +254,6 @@ class CaloClusterTopoGetter ( Configured ) : TopoMoments_Truth.LArHVFraction=LArHVFraction(HVScaleCorrKey="LArHVScaleCorr") TopoMoments_Truth.WeightingOfNegClusters = jobproperties.CaloTopoClusterFlags.doTreatEnergyCutAsAbsolute() TopoMoments_Truth.MaxAxisAngle = 20*deg - TopoMoments_Truth.CaloNoiseTool = theCaloNoiseTool - TopoMoments_Truth.UsePileUpNoise = True TopoMoments_Truth.TwoGaussianNoise = jobproperties.CaloTopoClusterFlags.doTwoGaussianNoise() TopoMoments_Truth.MinBadLArQuality = 4000 TopoMoments_Truth.MomentsNames = ["FIRST_PHI_DigiHSTruth" diff --git a/Calorimeter/CaloRec/src/CaloClusterMomentsMaker_DigiHSTruth.cxx b/Calorimeter/CaloRec/src/CaloClusterMomentsMaker_DigiHSTruth.cxx index 6e08483aa3825d0e90c0fa9132ab3919c91e9c5d..022a9bc0db7a2c0182fecc6a74ca8ea5b18eb291 100755 --- a/Calorimeter/CaloRec/src/CaloClusterMomentsMaker_DigiHSTruth.cxx +++ b/Calorimeter/CaloRec/src/CaloClusterMomentsMaker_DigiHSTruth.cxx @@ -22,7 +22,6 @@ #include "CaloGeoHelpers/proxim.h" #include "CaloEvent/CaloPrefetch.h" #include "CaloDetDescr/CaloDetDescrManager.h" -#include "CaloInterface/ICalorimeterNoiseTool.h" #include "CaloGeoHelpers/CaloPhiRange.h" #include "CaloIdentifier/CaloCell_ID.h" #include "GeoModelInterfaces/IGeoModelSvc.h" @@ -127,10 +126,8 @@ CaloClusterMomentsMaker_DigiHSTruth::CaloClusterMomentsMaker_DigiHSTruth(const s m_calculateSignificance(false), m_calculateIsolation(false), m_calculateLArHVFraction(false), - m_usePileUpNoise(true), m_twoGaussianNoise(false), m_caloDepthTool("CaloDepthTool",this), - m_noiseTool("CaloNoiseTool"), m_larHVFraction("LArHVFraction",this), m_absOpt(false) { @@ -156,12 +153,10 @@ CaloClusterMomentsMaker_DigiHSTruth::CaloClusterMomentsMaker_DigiHSTruth(const s declareProperty("MinRLateral",m_minRLateral); declareProperty("MinLLongitudinal",m_minLLongitudinal); declareProperty("MinBadLArQuality",m_minBadLArQuality); - declareProperty("UsePileUpNoise",m_usePileUpNoise); // use 2-gaussian noise for Tile declareProperty("TwoGaussianNoise",m_twoGaussianNoise); - declareProperty("CaloNoiseTool",m_noiseTool,"Tool Handle for noise tool"); declareProperty("LArHVFraction",m_larHVFraction,"Tool Handle for LArHVFraction"); - declareProperty("WeightingOfNegClusters", m_absOpt); + declareProperty("WeightingOfNegClusters", m_absOpt); /// Not used anymore (with xAOD), but required to when configured from /// COOL via CaloRunClusterCorrections. @@ -254,14 +249,7 @@ StatusCode CaloClusterMomentsMaker_DigiHSTruth::initialize() ATH_CHECK(m_caloDepthTool.retrieve()); if (m_calculateSignificance) { - - if(m_noiseTool.retrieve().isFailure()){ - msg(MSG::WARNING) - << "Unable to find Noise Tool" << endmsg; - } - else { - msg(MSG::INFO) << "Noise Tool retrieved" << endmsg; - } + ATH_CHECK(m_noiseCDOKey.initialize()); } if (m_calculateLArHVFraction) { @@ -313,6 +301,12 @@ CaloClusterMomentsMaker_DigiHSTruth::execute(const EventContext& ctx, std::vector<clusterPair_t> clusterIdx; const clusterIdx_t noCluster = std::numeric_limits<clusterIdx_t>::max(); + const CaloNoise* noise=nullptr; + if (m_calculateSignificance) { + SG::ReadCondHandle<CaloNoise> noiseHdl{m_noiseCDOKey,ctx}; + noise=*noiseHdl; + } + // Counters for number of empty and non-empty neighbor cells per sampling layer // Only used when cluster isolation moment is calculated. int nbEmpty[CaloCell_ID::Unknown]; @@ -476,23 +470,9 @@ CaloClusterMomentsMaker_DigiHSTruth::execute(const EventContext& ctx, ePos += ene*weight; } if ( m_calculateSignificance ) { - double sigma = 0; - if ( m_usePileUpNoise ) { - if(m_twoGaussianNoise) { - sigma = m_noiseTool->getEffectiveSigma(pCell,ICalorimeterNoiseTool::MAXSYMMETRYHANDLING,ICalorimeterNoiseTool::TOTALNOISE); - } - else { - sigma = m_noiseTool->getNoise(pCell,ICalorimeterNoiseTool::TOTALNOISE); - } - } - else { - if(m_twoGaussianNoise) { - sigma = m_noiseTool->getEffectiveSigma(pCell,ICalorimeterNoiseTool::MAXSYMMETRYHANDLING,ICalorimeterNoiseTool::ELECTRONICNOISE); - } - else { - sigma = m_noiseTool->getNoise(pCell,ICalorimeterNoiseTool::ELECTRONICNOISE); - } - } + const float sigma = m_twoGaussianNoise ? \ + noise->getEffectiveSigma(pCell->ID(),pCell->gain(),pCell->energy()) : \ + noise->getNoise(pCell->ID(),pCell->gain()); sumSig2 += sigma*sigma; // use geomtery weighted energy of cell for leading cell significance double Sig = (sigma>0?ene*weight/sigma:0); diff --git a/Calorimeter/CaloRec/src/CaloClusterMomentsMaker_DigiHSTruth.h b/Calorimeter/CaloRec/src/CaloClusterMomentsMaker_DigiHSTruth.h index 4d9b2523a4f76fdfa1855b24c07e0fecab88f9c8..b19cb230f4882746f39ae5282dcb72537ddfa278 100755 --- a/Calorimeter/CaloRec/src/CaloClusterMomentsMaker_DigiHSTruth.h +++ b/Calorimeter/CaloRec/src/CaloClusterMomentsMaker_DigiHSTruth.h @@ -29,8 +29,6 @@ #include "GaudiKernel/ToolHandle.h" -class StoreGateSvc; -class ICalorimeterNoiseTool; class CaloDetDescrManager; class CaloDetDescrElement; class CaloCell_ID; @@ -41,6 +39,8 @@ class LArHVFraction; #include "CaloRec/CaloClusterCollectionProcessor.h" #include "CaloDetDescr/CaloDepthTool.h" #include "CaloInterface/ILArHVFraction.h" +#include "CaloConditions/CaloNoise.h" +#include "StoreGate/ReadCondHandleKey.h" //#include "fastjet/PseudoJet.hh" #include <string> #include <vector> @@ -117,22 +117,15 @@ class CaloClusterMomentsMaker_DigiHSTruth final: public extends<AthAlgTool, Calo /// Set to true to calculate E and N of cells affected by LAr HV corrections bool m_calculateLArHVFraction; - /** - * @brief switch to use the pile-up noise CaloNoiseTool - * - * if usePileUpNoise is set to true the relevant sigma for each cell - * will be the quadratic sum of the electronics noise at current - * cell gain and its pile-up noise at the current - * luminosity. Otherwise it will be just the electronics noise. */ - bool m_usePileUpNoise; - /** * @brief if set to true use 2-gaussian noise description for * TileCal */ bool m_twoGaussianNoise; ToolHandle<CaloDepthTool> m_caloDepthTool; - ToolHandle<ICalorimeterNoiseTool> m_noiseTool; + /** @brief Key of the CaloNoise Conditions data object. Typical values + are '"electronicNoise', 'pileupNoise', or '"totalNoise' (default) */ + SG::ReadCondHandleKey<CaloNoise> m_noiseCDOKey{this,"CaloNoiseKey","totalNoise","SG Key of CaloNoise data object"}; ToolHandle<ILArHVFraction> m_larHVFraction; /// Not used anymore (with xAOD), but required to when configured from diff --git a/Calorimeter/CaloRec/src/CaloTopoClusterMaker.h b/Calorimeter/CaloRec/src/CaloTopoClusterMaker.h index 366b892adcf647a6f6ee45245f4504eebf0423dc..91040ba3e280c4316d4af439bc1e090092556a44 100644 --- a/Calorimeter/CaloRec/src/CaloTopoClusterMaker.h +++ b/Calorimeter/CaloRec/src/CaloTopoClusterMaker.h @@ -39,7 +39,6 @@ #include "AthenaKernel/IOVSvcDefs.h" #include "Identifier/IdentifierHash.h" #include "CaloRec/CaloClusterCollectionProcessor.h" -#include "CaloInterface/ICalorimeterNoiseTool.h" #include "LArCabling/LArOnOffIdMapping.h" #include "CaloConditions/CaloNoise.h" #include "StoreGate/ReadCondHandleKey.h"