diff --git a/Calorimeter/CaloClusterCorrection/python/CaloTopoEMmoments.py b/Calorimeter/CaloClusterCorrection/python/CaloTopoEMmoments.py index ab0d046475b1912ac7f35a31e9749252362a71c4..6d6c00be6f4dc0c0adb57aa39ef03fa230e50005 100755 --- a/Calorimeter/CaloClusterCorrection/python/CaloTopoEMmoments.py +++ b/Calorimeter/CaloClusterCorrection/python/CaloTopoEMmoments.py @@ -16,10 +16,8 @@ from CaloRec import CaloRecConf from CaloClusterCorrection.common import * from AthenaCommon.SystemOfUnits import deg -from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault -theCaloNoiseTool = CaloNoiseToolDefault() -from AthenaCommon.AppMgr import ToolSvc -ToolSvc += theCaloNoiseTool +from CaloTools.CaloNoiseCondAlg import CaloNoiseCondAlg +CaloNoiseCondAlg() # # This table lists all available versions of this correction. @@ -73,8 +71,6 @@ def make_CaloTopoEMmoments (name = None, class CaloTopoEMmoments_parms: MaxAxisAngle = 20*deg - CaloNoiseTool = theCaloNoiseTool - UsePileUpNoise = True MinBadLArQuality = 4000 MomentsNames = [ "FIRST_PHI" diff --git a/Calorimeter/CaloClusterCorrection/src/CaloClusterLocalCalib.cxx b/Calorimeter/CaloClusterCorrection/src/CaloClusterLocalCalib.cxx index df5f27b2c68e6bf1e9e0322009b084b9cd58a407..a3ce4540f53d53c2d91d21f247d58bd63ad8f899 100755 --- a/Calorimeter/CaloClusterCorrection/src/CaloClusterLocalCalib.cxx +++ b/Calorimeter/CaloClusterCorrection/src/CaloClusterLocalCalib.cxx @@ -57,7 +57,7 @@ StatusCode CaloClusterLocalCalib::initialize() { return StatusCode::SUCCESS; } -StatusCode CaloClusterLocalCalib::execute(const EventContext& /*ctx*/, +StatusCode CaloClusterLocalCalib::execute(const EventContext& ctx, CaloCluster* theCluster) const { CaloRecoStatus& recoStatus=theCluster->recoStatus(); @@ -135,7 +135,7 @@ StatusCode CaloClusterLocalCalib::execute(const EventContext& /*ctx*/, // Weight the new cluster for (const ToolHandle<IClusterCellWeightTool>& tool : m_calibTools) { - if (tool->weight(myCluster).isFailure()) + if (tool->weight(myCluster,ctx).isFailure()) msg(MSG::ERROR) << " failed to weight cluster " << endmsg; } @@ -187,7 +187,7 @@ StatusCode CaloClusterLocalCalib::execute(const EventContext& /*ctx*/, else{ for (const ToolHandle<IClusterCellWeightTool>& tool : m_calibTools) { - if (tool->weight(theCluster).isFailure()) + if (tool->weight(theCluster,ctx).isFailure()) msg(MSG::ERROR) << " failed to weight cluster " << endmsg; } diff --git a/Calorimeter/CaloConditions/CaloConditions/CaloNoise.h b/Calorimeter/CaloConditions/CaloConditions/CaloNoise.h index 846c0331f4874501fe1812754306afa9b7a57131..3bbe947bff51a36282a9cb3a9311378e280b055e 100644 --- a/Calorimeter/CaloConditions/CaloConditions/CaloNoise.h +++ b/Calorimeter/CaloConditions/CaloConditions/CaloNoise.h @@ -15,6 +15,10 @@ class CaloNoise { ///Conditions Data Object holding the calorimeter noise per cell and per gain public: + + enum NOISETYPE{ELEC=0, + PILEUP, + TOTAL}; CaloNoise() =delete; @@ -22,7 +26,7 @@ class CaloNoise { /// Explicit constructor with number of cells and gains and ptr to CaloCell_ID obj CaloNoise(const size_t nLArCells, const size_t nLArGains, const size_t nTileCells, const size_t nTileGains, - const CaloCell_Base_ID* caloCellId); + const CaloCell_Base_ID* caloCellId, const NOISETYPE noisetype); /// Accessor by IdentifierHash and gain. float getNoise(const IdentifierHash h, const int gain) const { @@ -41,17 +45,16 @@ class CaloNoise { return getNoise(h,gain); } - float getEffectiveSigma(const Identifier id, const int gain, const float energy) { - IdentifierHash h=m_caloCellId->calo_cell_hash(id); - if (h<m_tileHashOffset) { - return m_larNoise[gain][h]; - } - else - return calcSig(h-m_tileHashOffset,gain,energy); + float getEffectiveSigma(const Identifier id, const int gain, const float energy) const { + IdentifierHash h=m_caloCellId->calo_cell_hash(id); + if (h<m_tileHashOffset) { + return m_larNoise[gain][h]; + } + else { + return getTileEffSigma(h-m_tileHashOffset,gain,energy); + } } - float calcSig(const IdentifierHash tilehash, const int gain, const float energy) const; - /// Non-const accessor to underlying storage for filling: boost::multi_array<float, 2>& larStorage() {return m_larNoise;} boost::multi_array<float, 2>& tileStorage() {return m_tileNoise;} @@ -59,6 +62,9 @@ class CaloNoise { void setTileBlob(const CaloCondBlobFlt* flt, const float lumi); private: + float calcSig(const IdentifierHash tilehash, const int gain, const float energy) const; + float getTileEffSigma(const IdentifierHash subHash, const int gain, const float e) const; + const CaloCell_Base_ID* m_caloCellId; //Flat structure, choosen based on profiling done by Scott in Nov 2013 @@ -70,7 +76,7 @@ class CaloNoise { //For double-gaussian noise: const CaloCondBlobFlt* m_tileBlob=nullptr; float m_lumi=0; - + NOISETYPE m_noiseType=TOTAL; }; #include "AthenaKernel/CLASS_DEF.h" diff --git a/Calorimeter/CaloConditions/src/CaloNoise.cxx b/Calorimeter/CaloConditions/src/CaloNoise.cxx index ce5727349f9a7e79c9df5bc3f260cbc652c9403e..e6b21288dac2743b8aaf7a82ccd8b35f8b227fea 100644 --- a/Calorimeter/CaloConditions/src/CaloNoise.cxx +++ b/Calorimeter/CaloConditions/src/CaloNoise.cxx @@ -6,8 +6,8 @@ #include "TMath.h" CaloNoise::CaloNoise(const size_t nLArCells, const size_t nLArGains, const size_t nTileCells, const size_t nTileGains, - const CaloCell_Base_ID* caloCellId) : - m_caloCellId(caloCellId) { + const CaloCell_Base_ID* caloCellId,const NOISETYPE noisetype) : + m_caloCellId(caloCellId),m_noiseType(noisetype) { m_larNoise.resize(boost::extents[nLArGains][nLArCells]); m_tileNoise.resize(boost::extents[nTileGains][nTileCells]); IdentifierHash h1,h2; @@ -25,23 +25,17 @@ CaloNoise::~CaloNoise() { } -//The following method is copied (amost unchagned) from CaloNoiseToolDB +//The following method is copied (amost unchanged) from CaloNoiseToolDB #define sqrt2 1.4142135623730950 #define invsqrt2 0.707106781186547524 -float CaloNoise::calcSig(const IdentifierHash subHash, const int gain, const float e) const { - const unsigned int dbGain = CaloCondUtils::getDbCaloGain(gain); - if (!m_tileBlob) { - //No data (like pileup-noise only): return cached noise - return m_tileNoise[dbGain][subHash]; - } +float CaloNoise::calcSig(const IdentifierHash subHash, const int dbGain, const float e) const { const double sigma1 = m_tileBlob->getData(subHash,dbGain,2); const double sigma2 = m_tileBlob->getData(subHash,dbGain,3); const double ratio = m_tileBlob->getData(subHash,dbGain,4); - if((sigma1 == 0. && sigma2 == 0.) || e == 0.) return 0.; if(sigma1 == 0.) return e/sigma2; if((ratio == 0.) || sigma2 == 0.) return e/sigma1; @@ -66,15 +60,40 @@ float CaloNoise::calcSig(const IdentifierHash subHash, const int gain, const flo // if instead you want to return the sigma-equivalent C.L. // (with sign!) use the following line - const double sigma= sqrt2*TMath::ErfInverse(z); + return sqrt2*TMath::ErfInverse(z); +} + + +float CaloNoise::getTileEffSigma(const IdentifierHash subHash, const int gain, const float e) const { - const float elecNoise= (sigma != 0.) ? fabs(e/sigma) : 0.0; + const unsigned int dbGain = CaloCondUtils::getDbCaloGain(gain); + if (!m_tileBlob) { + //No data (pilup-noise only): return cached noise + return m_tileNoise[dbGain][subHash]; + } - if (m_lumi>0) { - const float b= m_tileBlob->getData(subHash,dbGain,1); - return std::sqrt(elecNoise*elecNoise+b*b*m_lumi); + const float sigma=calcSig(subHash,dbGain,e); + const float a= (sigma != 0.) ? fabs(e/sigma) : 0.0; + + if (m_noiseType==CaloNoise::ELEC) { + return a; + } + + //Case: Total Noise + const float b= m_tileBlob->getData(subHash,dbGain,1); + const int objver = m_tileBlob->getObjVersion(); + float x=0; + if(objver==1){ + //=== Total noise parameterized as + //=== Sigma**2 = a**2 + b**2 * Lumi + x = std::sqrt( a*a + b*b*m_lumi ); + } + else if (objver==2) { + //== parameterization for pedestal = a + b*Lumi + x = a+b*m_lumi; } - else { - return elecNoise; + else{ + throw CaloCond::VersionConflict("CaloNoise::get2dEffSigma ",objver); } + return x; } diff --git a/Calorimeter/CaloInterface/CaloInterface/IClusterCellWeightTool.h b/Calorimeter/CaloInterface/CaloInterface/IClusterCellWeightTool.h index 0a15b2a9a3b3cfe11da7a2374a2a4bfa0fe4993f..da266ef1429b8714f053581fd2d6a2d40512294f 100755 --- a/Calorimeter/CaloInterface/CaloInterface/IClusterCellWeightTool.h +++ b/Calorimeter/CaloInterface/CaloInterface/IClusterCellWeightTool.h @@ -17,9 +17,10 @@ * constituents and weight them. */ #include "GaudiKernel/IAlgTool.h" -#include "AthenaKernel/IOVSvcDefs.h" #include "xAODCaloEvent/CaloClusterFwd.h" +class EventContext; + class IClusterCellWeightTool : virtual public IAlgTool { public: @@ -36,11 +37,7 @@ class IClusterCellWeightTool : virtual public IAlgTool * * this method is purely virtual because every derived class needs * to implement it. */ - virtual StatusCode weight(xAOD::CaloCluster* thisCluster) const = 0; - - // Now obsolete. - virtual StatusCode LoadConditionsData(IOVSVC_CALLBACK_ARGS) - { return StatusCode::SUCCESS; } + virtual StatusCode weight(xAOD::CaloCluster* thisCluster, const EventContext& ctx) const = 0; }; #endif diff --git a/Calorimeter/CaloRec/python/CaloClusterTopoEMGetters.py b/Calorimeter/CaloRec/python/CaloClusterTopoEMGetters.py index 89ebb519c074bacef7d838a50cbf6d312a42aa52..94435cba6502fd3405da803f9c2262b5735e3142 100644 --- a/Calorimeter/CaloRec/python/CaloClusterTopoEMGetters.py +++ b/Calorimeter/CaloRec/python/CaloClusterTopoEMGetters.py @@ -22,9 +22,6 @@ from CaloRec.CaloRecConf import CaloTopoClusterMaker, CaloTopoClusterSplitter from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault theCaloNoiseTool = CaloNoiseToolDefault() -from AthenaCommon.AppMgr import ToolSvc -ToolSvc += theCaloNoiseTool - class CaloClusterTopoEMGetterBase (CaloClusterGetterBase): _inputGetter = jp.CaloRecFlags.clusterCellGetterName() @@ -53,9 +50,6 @@ class CaloClusterTopoEMGetterBase (CaloClusterGetterBase): SeedSamplingNames = [ "PreSamplerB", "EMB1", "EMB2", "EMB3", "PreSamplerE", "EME1", "EME2", "EME3"], - CaloNoiseTool=theCaloNoiseTool, - UseCaloNoiseTool=True, - UsePileUpNoise=True, NeighborOption = "all3D", # note E or AbsE CellThresholdOnEorAbsEinSigma = self._cellThreshold, diff --git a/Calorimeter/CaloRec/python/CaloClusterTopoGetter.py b/Calorimeter/CaloRec/python/CaloClusterTopoGetter.py index 7846eb2ae07ad81f5775ccee7cab2227887a3667..431ece67c754945316c58822807277c26fc9697b 100644 --- a/Calorimeter/CaloRec/python/CaloClusterTopoGetter.py +++ b/Calorimeter/CaloRec/python/CaloClusterTopoGetter.py @@ -34,11 +34,19 @@ from RecExConfig.RecFlags import rec from LArCellRec.LArCellRecConf import LArHVFraction +from CaloTools.CaloNoiseCondAlg import CaloNoiseCondAlg +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 topSequence = AlgSequence() @@ -137,7 +145,6 @@ class CaloClusterTopoGetter ( Configured ) : LCWeight = CaloLCWeightTool("LCWeight") LCWeight.CorrectionKey = "H1ClusterCellWeights" LCWeight.SignalOverNoiseCut = 2.0 - LCWeight.CaloNoiseTool = theCaloNoiseTool LCWeight.UseHadProbability = True LCOut = CaloLCOutOfClusterTool("LCOut") @@ -155,7 +162,6 @@ class CaloClusterTopoGetter ( Configured ) : #DMTool.SignalOverNoiseCut = 1.0 #DMTool.ClusterRecoStatus = 0 #DMTool.WeightModeDM = 2 - #DMTool.CaloNoiseTool = theCaloNoiseTool LCDeadMaterial = CaloLCDeadMaterialTool("LCDeadMaterial") LCDeadMaterial.HadDMCoeffKey = "HadDMCoeff2" @@ -205,8 +211,6 @@ class CaloClusterTopoGetter ( Configured ) : TopoMoments = CaloClusterMomentsMaker ("TopoMoments") TopoMoments.WeightingOfNegClusters = jobproperties.CaloTopoClusterFlags.doTreatEnergyCutAsAbsolute() TopoMoments.MaxAxisAngle = 20*deg - TopoMoments.CaloNoiseTool = theCaloNoiseTool - TopoMoments.UsePileUpNoise = True TopoMoments.TwoGaussianNoise = jobproperties.CaloTopoClusterFlags.doTwoGaussianNoise() TopoMoments.MinBadLArQuality = 4000 TopoMoments.MomentsNames = ["FIRST_PHI" @@ -366,9 +370,6 @@ class CaloClusterTopoGetter ( Configured ) : "TileExt0", "TileExt1", "TileExt2", "TileGap1", "TileGap2", "TileGap3", "FCAL0", "FCAL1", "FCAL2"] - TopoMaker.CaloNoiseTool=theCaloNoiseTool - TopoMaker.UseCaloNoiseTool=True - TopoMaker.UsePileUpNoise=True TopoMaker.NeighborOption = "super3D" TopoMaker.RestrictHECIWandFCalNeighbors = False TopoMaker.RestrictPSNeighbors = True diff --git a/Calorimeter/CaloRec/src/CaloClusterMomentsMaker.cxx b/Calorimeter/CaloRec/src/CaloClusterMomentsMaker.cxx index 7ebcf71ff79d4fda079bf6f0215ab61d3954c28d..d97e53c389c8901441c701335663aa56bc3f9b2c 100644 --- a/Calorimeter/CaloRec/src/CaloClusterMomentsMaker.cxx +++ b/Calorimeter/CaloRec/src/CaloClusterMomentsMaker.cxx @@ -23,7 +23,6 @@ #include "CaloGeoHelpers/proxim.h" #include "CaloEvent/CaloPrefetch.h" #include "CaloDetDescr/CaloDetDescrManager.h" -#include "CaloInterface/ICalorimeterNoiseTool.h" #include "CaloInterface/ILArHVFraction.h" #include "CaloGeoHelpers/CaloPhiRange.h" #include "CaloIdentifier/CaloCell_ID.h" @@ -129,10 +128,8 @@ CaloClusterMomentsMaker::CaloClusterMomentsMaker(const std::string& type, 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) { @@ -159,10 +156,8 @@ CaloClusterMomentsMaker::CaloClusterMomentsMaker(const std::string& type, 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"); /// Not used anymore (with xAOD), but required to when configured from @@ -249,16 +244,7 @@ StatusCode CaloClusterMomentsMaker::initialize() 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; - } - } - else { - m_noiseTool.disable(); + ATH_CHECK(m_noiseCDOKey.initialize()); } if (m_calculateLArHVFraction) { @@ -309,6 +295,13 @@ CaloClusterMomentsMaker::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]; @@ -445,23 +438,10 @@ CaloClusterMomentsMaker::execute(const EventContext& ctx, } 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.h b/Calorimeter/CaloRec/src/CaloClusterMomentsMaker.h index 650bffeeb304643041202ef7bc0a28fce97ca291..a5b7f37bd162b588ece6403e0e76a0a6236ec48d 100644 --- a/Calorimeter/CaloRec/src/CaloClusterMomentsMaker.h +++ b/Calorimeter/CaloRec/src/CaloClusterMomentsMaker.h @@ -30,17 +30,16 @@ #include "GaudiKernel/ToolHandle.h" -class StoreGateSvc; -class ICalorimeterNoiseTool; class CaloDetDescrManager; class CaloDetDescrElement; class CaloCell_ID; -#include "StoreGate/DataHandle.h" -#include "AthenaKernel/IOVSvcDefs.h" #include "CaloRec/CaloClusterCollectionProcessor.h" #include "CaloDetDescr/CaloDepthTool.h" #include "CaloInterface/ILArHVFraction.h" +#include "CaloConditions/CaloNoise.h" +#include "StoreGate/ReadCondHandleKey.h" + #include <string> #include <vector> @@ -115,24 +114,16 @@ class CaloClusterMomentsMaker: public AthAlgTool, virtual public CaloClusterColl /// 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; - // FIXME: mutable - mutable ToolHandle<ICalorimeterNoiseTool> m_noiseTool; - //ToolHandle<ILArHVCorrTool> m_larHVScaleRetriever; + + /** @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; diff --git a/Calorimeter/CaloRec/src/CaloTopoClusterMaker.cxx b/Calorimeter/CaloRec/src/CaloTopoClusterMaker.cxx index d51d1b3d7a11de732d2bd882e29d32daed1e4896..fa627c12b0190286b7410278cbea4621e49260cb 100644 --- a/Calorimeter/CaloRec/src/CaloTopoClusterMaker.cxx +++ b/Calorimeter/CaloRec/src/CaloTopoClusterMaker.cxx @@ -31,7 +31,6 @@ #include "CaloEvent/CaloCellContainer.h" #include "CaloEvent/CaloPrefetch.h" #include "CaloDetDescr/CaloDetDescrManager.h" -#include "CaloInterface/ICalorimeterNoiseTool.h" #include "AthAllocators/ArenaPoolAllocator.h" #include "AthAllocators/ArenaHandle.h" #include "GaudiKernel/StatusCode.h" @@ -47,24 +46,6 @@ using CLHEP::MeV; -namespace { - - /* -struct CaloClusterSort -{ - CaloClusterSort (xAOD::CaloCluster* cl, float et) - : m_et (et), m_cl (cl) {} - bool operator< (const CaloClusterSort& other) const - { return m_et < other.m_et; } - operator xAOD::CaloCluster* () const { return m_cl; } - - float m_et; - xAOD::CaloCluster* m_cl; -}; - */ - -} // anonymous namespace - //############################################################################# CaloTopoClusterMaker::CaloTopoClusterMaker(const std::string& type, @@ -78,13 +59,6 @@ CaloTopoClusterMaker::CaloTopoClusterMaker(const std::string& type, m_cellThresholdOnEorAbsEinSigma ( 0.), m_neighborThresholdOnEorAbsEinSigma( 3.), m_seedThresholdOnEorAbsEinSigma ( 6.), - m_cellThresholdOnEtorAbsEt ( 0.*MeV), - m_neighborThresholdOnEtorAbsEt ( 100.*MeV), - m_seedThresholdOnEtorAbsEt ( 200.*MeV), - m_useNoiseTool (false), - m_usePileUpNoise (false), - m_noiseTool ("CaloNoiseTool"), - m_noiseSigma ( 100.*MeV), m_neighborOption ("super3D"), m_nOption (LArNeighbours::super3D), m_restrictHECIWandFCalNeighbors (false), @@ -118,13 +92,6 @@ CaloTopoClusterMaker::CaloTopoClusterMaker(const std::string& type, m_neighborThresholdOnEorAbsEinSigma); declareProperty("CellThresholdOnEorAbsEinSigma", m_cellThresholdOnEorAbsEinSigma); - // Additional E_t cuts in MeV in case usePileUpNoise is set to false - declareProperty("SeedThresholdOnEtorAbsEt", - m_seedThresholdOnEtorAbsEt); - declareProperty("NeighborThresholdOnEtorAbsEt", - m_neighborThresholdOnEtorAbsEt); - declareProperty("CellThresholdOnEtorAbsEt", - m_cellThresholdOnEtorAbsEt); // Seed and cluster cuts are in E or Abs E declareProperty("SeedCutsInAbsE",m_seedCutsInAbsE); @@ -135,16 +102,6 @@ CaloTopoClusterMaker::CaloTopoClusterMaker(const std::string& type, // Cell cuts are in E or Abs E declareProperty("CellCutsInAbsE",m_cellCutsInAbsE); - // Noise Sigma - declareProperty("NoiseSigma",m_noiseSigma); - - // NoiseTool - declareProperty("UseCaloNoiseTool",m_useNoiseTool); - declareProperty("CaloNoiseTool",m_noiseTool,"Tool Handle for noise tool"); - - // PileUpNoise - declareProperty("UsePileUpNoise",m_usePileUpNoise); - // Neighbor Option declareProperty("NeighborOption",m_neighborOption); @@ -311,44 +268,9 @@ StatusCode CaloTopoClusterMaker::initialize() msg() << " " << caloName; msg() << endmsg; - //---- retrieve the noise tool ---------------- + //---- retrieve the noise CDO ---------------- - if (m_useNoiseTool) { - - if(m_noiseTool.retrieve().isFailure()){ - ATH_MSG_WARNING( "Unable to find Noise Tool" ); - } - else { - ATH_MSG_INFO( "Noise Tool retrieved" ); - } - } - else { - ATH_MSG_INFO( "Noise Sigma " - << m_noiseSigma << " MeV is selected!" - << (!m_usePileUpNoise? - " The noise sigma will just be the electronics noise!":"") - ); - } - - if ( m_useNoiseTool && m_usePileUpNoise ) { - ATH_MSG_INFO( "Pile-Up Noise from Noise Tool" - << " is selected! The noise sigma will be the" - << " quadratic sum of the electronics noise and the pile up!" ); - } - else { - ATH_MSG_INFO( "Additional E_t cuts (instead of Pile-Up Noise):" - << (m_seedCutsInAbsE?" SeedThresholdOnAbsEt=":" SeedThresholdOnEt=") - << m_seedThresholdOnEtorAbsEt - << " MeV, " - << (m_neighborCutsInAbsE?"NeighborThresholdOnAbsEt=": - "NeighborThresholdOnEt=") - << m_neighborThresholdOnEtorAbsEt - << " MeV, " - << (m_cellCutsInAbsE?"CellThresholdOnAbsEt=": - "CellThresholdOnEt=") - << m_cellThresholdOnEtorAbsEt - << " MeV" ); - } + ATH_CHECK(m_noiseCDOKey.initialize()); ATH_MSG_INFO( (m_seedCutsInAbsE?"ClusterAbsEtCut= ":"ClusterEtCut= ") << m_clusterEtorAbsEtCut << " MeV" ); @@ -365,7 +287,7 @@ StatusCode CaloTopoClusterMaker::initialize() } } - ATH_CHECK( m_cablingKey.initialize() ); + //ATH_CHECK( m_cablingKey.initialize() ); return StatusCode::SUCCESS; @@ -401,6 +323,10 @@ CaloTopoClusterMaker::execute(const EventContext& ctx, std::vector<HashCell> cellVector (m_hashMax - m_hashMin); HashCell* hashCells = cellVector.data() - m_hashMin; + + SG::ReadCondHandle<CaloNoise> noiseHdl{m_noiseCDOKey,ctx}; + const CaloNoise* noiseCDO=*noiseHdl; + //---- Get the CellContainers ---------------- // for (const std::string& cellsName : m_cellsNames) { @@ -426,36 +352,19 @@ CaloTopoClusterMaker::execute(const EventContext& ctx, ++iCell, ++cellIter) { CaloPrefetch::nextDDE(cellIter, cellIterEnd, 2); - // noise() member does not exist for CaloCell - need to use noise tool const CaloCell* pCell = *cellIter; - // take the noise for the current gain of the cell - // the highest gain would be nice to use, but this is not possible - // in runs with fixed gain because it might not be defined ... - float noiseSigma; - if ( m_useNoiseTool ) { - if ( m_usePileUpNoise ) { - if(m_twogaussiannoise) noiseSigma = m_noiseTool->getEffectiveSigma(pCell,ICalorimeterNoiseTool::MAXSYMMETRYHANDLING,ICalorimeterNoiseTool::TOTALNOISE); - else noiseSigma = m_noiseTool->getNoise(pCell,ICalorimeterNoiseTool::TOTALNOISE); - } - else - if(m_twogaussiannoise) noiseSigma = m_noiseTool->getEffectiveSigma(pCell,ICalorimeterNoiseTool::MAXSYMMETRYHANDLING,ICalorimeterNoiseTool::ELECTRONICNOISE); - else noiseSigma = m_noiseTool->getNoise(pCell,ICalorimeterNoiseTool::ELECTRONICNOISE); - } - else - noiseSigma = m_noiseSigma; + const float noiseSigma = m_twogaussiannoise ? \ + noiseCDO->getEffectiveSigma(pCell->ID(),pCell->gain(),pCell->energy()) : \ + noiseCDO->getNoise(pCell->ID(),pCell->gain()); + float signedE = pCell->energy(); float signedEt = pCell->et(); float signedRatio = epsilon; // not 0 in order to keep bad cells if ( finite(noiseSigma) && noiseSigma > 0 && !CaloBadCellHelper::isBad(pCell,m_treatL1PredictedCellsAsGood) ) signedRatio = signedE/noiseSigma; - bool passedCellCut = (m_cellCutsInAbsE?std::abs(signedRatio):signedRatio) - > m_cellThresholdOnEorAbsEinSigma - && (m_usePileUpNoise || ((m_cellCutsInAbsE?std::abs(signedEt):signedEt) - > m_cellThresholdOnEtorAbsEt)); - bool passedNeighborCut = (m_neighborCutsInAbsE?std::abs(signedRatio):signedRatio) > m_neighborThresholdOnEorAbsEinSigma - && ( m_usePileUpNoise || ((m_neighborCutsInAbsE?std::abs(signedEt):signedEt) > m_neighborThresholdOnEtorAbsEt )); - bool passedSeedCut = (m_seedCutsInAbsE?std::abs(signedRatio):signedRatio) > m_seedThresholdOnEorAbsEinSigma - && ( m_usePileUpNoise || ((m_seedCutsInAbsE?std::abs(signedEt):signedEt) > m_seedThresholdOnEtorAbsEt )); + bool passedCellCut = (m_cellCutsInAbsE?std::abs(signedRatio):signedRatio) > m_cellThresholdOnEorAbsEinSigma; + bool passedNeighborCut = (m_neighborCutsInAbsE?std::abs(signedRatio):signedRatio) > m_neighborThresholdOnEorAbsEinSigma; + bool passedSeedCut = (m_seedCutsInAbsE?std::abs(signedRatio):signedRatio) > m_seedThresholdOnEorAbsEinSigma; if ( passedCellCut || passedNeighborCut || passedSeedCut ) { const CaloDetDescrElement* dde = pCell->caloDDE(); @@ -619,8 +528,7 @@ CaloTopoClusterMaker::execute(const EventContext& ctx, // check neighbor threshold only since seed cells are already in // the original list bool isAboveNeighborThreshold = - (m_neighborCutsInAbsE?std::abs(pNCell->getSignedRatio()):pNCell->getSignedRatio()) > m_neighborThresholdOnEorAbsEinSigma - && ( m_usePileUpNoise || ((m_neighborCutsInAbsE?std::abs(pNCell->getSignedEt()):pNCell->getSignedEt()) > m_neighborThresholdOnEtorAbsEt )); + (m_neighborCutsInAbsE?std::abs(pNCell->getSignedRatio()):pNCell->getSignedRatio()) > m_neighborThresholdOnEorAbsEinSigma; // checking the neighbors if ( isAboveNeighborThreshold && !pNCell->getUsed() ) { pNCell->setUsed(); diff --git a/Calorimeter/CaloRec/src/CaloTopoClusterMaker.h b/Calorimeter/CaloRec/src/CaloTopoClusterMaker.h index 47d34826142c4608e61928914a31fb586f712b9b..366b892adcf647a6f6ee45245f4504eebf0423dc 100644 --- a/Calorimeter/CaloRec/src/CaloTopoClusterMaker.h +++ b/Calorimeter/CaloRec/src/CaloTopoClusterMaker.h @@ -1,8 +1,8 @@ +//Dear emacs, this is -*-c++-*- /* Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ -//Dear emacs, this is -*-c++-*- #ifndef CALOTOPOCLUSTERMAKER_H #define CALOTOPOCLUSTERMAKER_H /** @@ -41,6 +41,7 @@ #include "CaloRec/CaloClusterCollectionProcessor.h" #include "CaloInterface/ICalorimeterNoiseTool.h" #include "LArCabling/LArOnOffIdMapping.h" +#include "CaloConditions/CaloNoise.h" #include "StoreGate/ReadCondHandleKey.h" class Identifier; @@ -48,9 +49,8 @@ class CaloDetDescrManager; class CaloDetDescrElement; -class CaloTopoClusterMaker: public AthAlgTool, virtual public CaloClusterCollectionProcessor -{ - public: +class CaloTopoClusterMaker: public AthAlgTool, virtual public CaloClusterCollectionProcessor { +public: CaloTopoClusterMaker(const std::string& type, const std::string& name, const IInterface* parent); @@ -62,7 +62,7 @@ class CaloTopoClusterMaker: public AthAlgTool, virtual public CaloClusterCollect void getClusterSize(); - private: +private: const CaloCell_ID* m_calo_id; @@ -128,66 +128,13 @@ class CaloTopoClusterMaker: public AthAlgTool, virtual public CaloClusterCollect * would be included in both clusters. */ float m_seedThresholdOnEorAbsEinSigma; - /** - * @brief optional cut on \f$E_\perp\f$ or \f$|E|_\perp\f$ on the - * cell level - * - * This and the following 2 variables define on cell, neighbor and - * seed level additional thresholds on \f$E_\perp\f$ or - * \f$|E|_\perp\f$. They are treated like the noise cuts above on - * each level and used only in case m_usePileUpNoise is set to - * false. Usually m_usePileUpNoise should be set to true and using - * these cuts is not recommended. */ - float m_cellThresholdOnEtorAbsEt; - - /** @brief optional cut on \f$E_\perp\f$ or \f$|E|_\perp\f$ on the - neighbor level */ - float m_neighborThresholdOnEtorAbsEt; - - /** @brief optional cut on \f$E_\perp\f$ or \f$|E|_\perp\f$ on the - seed level */ - float m_seedThresholdOnEtorAbsEt; - - /** - * @brief switch to use the CaloNoiseTool - * - * the CaloNoiseTool should be used whenever possible in order to - * get the electronics noise and the pile-up noise for each cell - * according to the current conditions. In case this switch is set - * to false a constant noise value for all cells will be used. */ - bool m_useNoiseTool; + /** @brief Key of the CaloNoise Conditions data object. Typical values + are '"electronicNoise', 'pileupNoise', or '"totalNoise' (default) */ - /** - * @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. This - * switch can be set to true only if m_useNoiseTool is set to true - * as well. It is recommended to set usePileUpNoise to true even - * for situations (like single particle MC) where no pile-up noise - * is expected since the CaloNoiseTool most likely will be - * configured in a way that it reflects that situation. If this - * switch is set to false the additional \f$E_\perp\f$ thresholds - * declared above will be used. */ - bool m_usePileUpNoise; - // FIXME: mutable - mutable ToolHandle<ICalorimeterNoiseTool> m_noiseTool; + SG::ReadCondHandleKey<CaloNoise> m_noiseCDOKey{this,"CaloNoiseKey","totalNoise","SG Key of CaloNoise data object"}; - // FIXME: Conditions dependencies required by CaloNoiseTool. - // These can be removed once we change to using - // the conditions algorithm instead of CaloNoiseTool. - SG::ReadCondHandleKey<LArOnOffIdMapping> m_cablingKey{this,"CablingKey","LArOnOffIdMap","SG Key of LArOnOffIdMapping object"}; - - /** - * @brief constant noise value in case the CaloNoiseTool is not used - * - * this value should only be used for testing purposes. It will be - * used if the CaloNoiseTool is switched off as the electronics - * noise for each cell. */ - float m_noiseSigma; + //SG::ReadCondHandleKey<LArOnOffIdMapping> m_cablingKey{this,"CablingKey","LArOnOffIdMap","SG Key of LArOnOffIdMapping object"}; /** * @brief type of neighbor relations to use. diff --git a/Calorimeter/CaloRec/src/CaloTopoTowerAlg.cxx b/Calorimeter/CaloRec/src/CaloTopoTowerAlg.cxx index 55afed800e3f0aa001438dafcbf846ce34bd6061..8addf7d51b5acaec408ffa36303bd8f2d576df0c 100644 --- a/Calorimeter/CaloRec/src/CaloTopoTowerAlg.cxx +++ b/Calorimeter/CaloRec/src/CaloTopoTowerAlg.cxx @@ -25,7 +25,6 @@ #include "CaloEvent/CaloTowerContainer.h" #include "CaloEvent/CaloCell2ClusterMap.h" #include "CaloEvent/CaloCellContainer.h" -#include "CaloInterface/ICalorimeterNoiseTool.h" #include "CaloTopoTowerAlg.h" #include "CxxUtils/make_unique.h" #include <string> @@ -39,7 +38,6 @@ CaloTopoTowerAlg::CaloTopoTowerAlg(const std::string& name,ISvcLocator* pSvcLoca m_cellContainerKey("AllCalo"), m_towerContainerKey("CmbTower"), m_newTowerContainerKey("TopoTower"), - m_noiseTool("CaloNoiseToolDefault"), m_caloSelection(false) { @@ -53,11 +51,6 @@ CaloTopoTowerAlg::CaloTopoTowerAlg(const std::string& name,ISvcLocator* pSvcLoca declareProperty("MinimumCellEnergy", m_minimumCellEnergy = -1000000000.0); declareProperty("MinimumClusterEnergy", m_minimumClusterEnergy = -1000000000.0); - // Noise Tool stuff - declareProperty("CaloNoiseTool", m_noiseTool ,"Tool Handle for noise tool"); - declareProperty("DefaultNoiseSigma", m_noiseSigma = 10.0); - declareProperty("UseCaloNoiseTool", m_useNoiseTool = true); - declareProperty("UsePileUpNoise", m_usePileUpNoise = true); declareProperty("CellEnergySignificance", m_cellESignificanceThreshold = -1); // Calo from which to use cells @@ -90,29 +83,13 @@ StatusCode CaloTopoTowerAlg::initialize() // services ATH_MSG_INFO( "Initializing CaloTopoTowerAlg" ); - CHECK(m_cellToClusterMapKey.initialize()); - CHECK(m_cellContainerKey.initialize()); - CHECK(m_towerContainerKey.initialize()); - CHECK(m_newTowerContainerKey.initialize()); + ATH_CHECK(m_cellToClusterMapKey.initialize()); + ATH_CHECK(m_cellContainerKey.initialize()); + ATH_CHECK(m_towerContainerKey.initialize()); + ATH_CHECK(m_newTowerContainerKey.initialize()); + ATH_CHECK(m_noiseCDOKey.initialize()); - - // retrieve noise tool from the tool svc - if (m_useNoiseTool) { - ATH_CHECK( m_noiseTool.retrieve() ); - ATH_MSG_INFO( "Noise Tool retrieved" ); - } - else { - m_noiseTool.disable(); - } - - // Report some information regarding the noise tool - if ( m_useNoiseTool && m_usePileUpNoise) { - ATH_MSG_DEBUG( "Pile-Up Noise from Noise Tool " - << " is selected! The noise sigma will be the" - << " quadratic sum of the electronics noise and the pile up!" ); - } - m_caloIndices.clear(); for ( unsigned int iCalos=0; iCalos< m_includedCalos.size(); iCalos++ ) { @@ -194,6 +171,11 @@ StatusCode CaloTopoTowerAlg::execute (const EventContext& ctx) const } ATH_MSG_DEBUG( "Successfully retrieved CaloCell2ClusterMap <"<< cellToClusterMap.name() << ">" ); + /// Get CaloNoise CDO + SG::ReadCondHandle<CaloNoise> noiseHdl{m_noiseCDOKey,ctx}; + const CaloNoise* noise=*noiseHdl; + + ///+++ consistency: pick up CaloClusterContainer pointer from map CaloCell2ClusterMap::const_iterator fClusMap(cellToClusterMap->begin()); CaloCell2ClusterMap::const_iterator lClusMap(cellToClusterMap->end()); @@ -290,11 +272,7 @@ StatusCode CaloTopoTowerAlg::execute (const EventContext& ctx) const float noiseSigma = 1.0; if (m_cellESignificanceThreshold>=0.) { // Noise tool to calculate cell energy significance - if ( m_useNoiseTool ) { - if ( m_usePileUpNoise ) noiseSigma = m_noiseTool->getNoise(cell,ICalorimeterNoiseTool::TOTALNOISE); - else noiseSigma = m_noiseTool->getNoise(cell,ICalorimeterNoiseTool::ELECTRONICNOISE); - } - else noiseSigma = m_noiseSigma; + noiseSigma=noise->getNoise(cell->ID(),cell->gain()); if ( noiseSigma > 0. ) signedRatio = signedE/noiseSigma; } diff --git a/Calorimeter/CaloRec/src/CaloTopoTowerAlg.h b/Calorimeter/CaloRec/src/CaloTopoTowerAlg.h index fb65ce621da926b93d8ef05d3c634aa6a2807041..dfd76bb282c0526b25b0c1e555ea95c36b612e81 100644 --- a/Calorimeter/CaloRec/src/CaloTopoTowerAlg.h +++ b/Calorimeter/CaloRec/src/CaloTopoTowerAlg.h @@ -41,8 +41,9 @@ #include "CaloEvent/CaloClusterContainer.h" #include "CaloEvent/CaloCell2ClusterMap.h" -class ICalorimeterNoiseTool; -class StoreGateSvc; +#include "CaloConditions/CaloNoise.h" +#include "StoreGate/ReadCondHandleKey.h" + class CaloTopoTowerAlg : public AthReentrantAlgorithm { @@ -75,12 +76,10 @@ private: double m_minimumClusterEnergy; bool m_useCellWeights; - // Noise tool stuff - bool m_useNoiseTool; - bool m_usePileUpNoise; - // FIXME: mutable - mutable ToolHandle<ICalorimeterNoiseTool> m_noiseTool; - float m_noiseSigma; + /** @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"}; + float m_cellESignificanceThreshold; // Type definitions diff --git a/Calorimeter/CaloTools/python/CaloNoiseCondAlg.py b/Calorimeter/CaloTools/python/CaloNoiseCondAlg.py index 9f0022877272da883835cd887ace1528e517f0eb..3a4fc9a9ef7e862113be9d1261ee8b1b2d2691ce 100644 --- a/Calorimeter/CaloTools/python/CaloNoiseCondAlg.py +++ b/Calorimeter/CaloTools/python/CaloNoiseCondAlg.py @@ -95,7 +95,7 @@ def _CaloNoiseCondAlgData(noiseAlgName,noisetype): if jobproperties.CaloCellFlags.doLArHVCorr(): mlog.info("Run2 & doLArHVCorr=True: Will rescale noise automatically for HV trips") theCaloNoiseAlg.useHVCorr=True - #... schedule HV corr cond alg + from LArConditionsCommon import LArHVDB pass pass else: #COMP200 case: diff --git a/Calorimeter/CaloTools/src/CaloNoiseCondAlg.cxx b/Calorimeter/CaloTools/src/CaloNoiseCondAlg.cxx index cdd06309ff818112ca70f6607abce2b7e029467e..d03b4a54de775910500cd12a9c4b0f7d197362ac 100644 --- a/Calorimeter/CaloTools/src/CaloNoiseCondAlg.cxx +++ b/Calorimeter/CaloTools/src/CaloNoiseCondAlg.cxx @@ -51,14 +51,14 @@ StatusCode CaloNoiseCondAlg::initialize() { const std::string& noiseKey=m_outputKey.key(); if(noiseKey=="electronicNoise") { ATH_MSG_INFO("Will compute electronic noise"); - m_noisetype=ELEC; + m_noiseType=CaloNoise::ELEC; } else if (noiseKey=="pileupNoise") { ATH_MSG_INFO("Will compute pileup noise"); - m_noisetype=PILEUP; + m_noiseType=CaloNoise::PILEUP; } else if (noiseKey=="totalNoise") { - m_noisetype=TOTAL; + m_noiseType=CaloNoise::TOTAL; ATH_MSG_INFO("Will compute total (electronic + pileup) noise"); } else { @@ -131,16 +131,23 @@ StatusCode CaloNoiseCondAlg::execute() { return StatusCode::SUCCESS; } + //Start with a range covering 0 - inf, then narrow down + const EventIDBase start{0,EventIDBase::UNDEFEVT,0,0,0,0}; + const EventIDBase stop{EventIDBase::UNDEFNUM-1, EventIDBase::UNDEFEVT-1, EventIDBase::UNDEFNUM-1, EventIDBase::UNDEFNUM-1, EventIDBase::UNDEFNUM-1,0}; + // Run Event time time_ns LB BCID + EventIDRange rangeOut{start, stop}; + EventIDRange rangeIn; + + SG::ReadCondHandle<LArOnOffIdMapping> cablingHdl{m_cablingKey}; const LArOnOffIdMapping* cabling{*cablingHdl}; - - //To determine the output range, start with cabling: - EventIDRange rangeIn,rangeOut; - if (!cablingHdl.range(rangeOut)){ + if (!cablingHdl.range(rangeIn)){ ATH_MSG_ERROR("Failed to retrieve validity range of LArCabling CDO with key " << m_larNoiseKey.key()); return StatusCode::FAILURE; } - + //std::cout << "rangeIn lar cabling " << rangeIn << std::endl; + rangeOut=EventIDRange::intersect(rangeOut,rangeIn); + //std::cout << "rangeOut lar cabling " << rangeOut << std::endl; //Obtain AttrListsCollections for all possible folders (LAr,Tile,Calo) std::vector<const CondAttrListCollection*> attrListNoise; @@ -239,7 +246,8 @@ StatusCode CaloNoiseCondAlg::execute() { const size_t maxCells=m_caloCellID->calo_cell_hash_max(); //Create the CaloNoise CDO: std::unique_ptr<CaloNoise> caloNoiseObj=std::make_unique<CaloNoise>(m_maxLArCells,3, - m_maxTileCells,4,m_caloCellID); + m_maxTileCells,4, + m_caloCellID,m_noiseType); //Counters for crosschecks std::array<unsigned,4> cellsPerGain{0,0,0,0}; @@ -275,14 +283,14 @@ StatusCode CaloNoiseCondAlg::execute() { const float b=blob->getData(i,igain,1); ++(cellsPerGain[igain]); const size_t hash = (sys==TILE) ? i : i+offset; - switch (m_noisetype){ - case ELEC: + switch (m_noiseType){ + case CaloNoise::ELEC: noise[igain][hash]=a; break; - case PILEUP: + case CaloNoise::PILEUP: noise[igain][hash]=b*std::sqrt(lumi); break; - case TOTAL: + case CaloNoise::TOTAL: noise[igain][hash]=std::sqrt(a*a + b*b*lumi); break; default: @@ -292,8 +300,9 @@ StatusCode CaloNoiseCondAlg::execute() { }//end loop over gains - // Cache data to calculate effective sigma for tile double-gaussian noise - if (sys==TILE && m_noisetype!=PILEUP) { + // Cache data to calculate effective sigma for tile double-gaussian noise + // Matters for Electronic and total noise + if (sys==TILE && m_noiseType!=CaloNoise::PILEUP) { caloNoiseObj->setTileBlob(blob.release(),lumi); } diff --git a/Calorimeter/CaloTools/src/CaloNoiseCondAlg.h b/Calorimeter/CaloTools/src/CaloNoiseCondAlg.h index 81e4d59dba3dc3c751db676f471c4098951a8916..5b5e5352a104e2439b978db4fd8630413aa2e8c1 100644 --- a/Calorimeter/CaloTools/src/CaloNoiseCondAlg.h +++ b/Calorimeter/CaloTools/src/CaloNoiseCondAlg.h @@ -68,14 +68,7 @@ class CaloNoiseCondAlg: public AthAlgorithm { std::size_t m_maxTileCells=0; void buildHashRanges(); - - enum NOISETYPE{ELEC=0, - PILEUP, - TOTAL}; - - - - NOISETYPE m_noisetype=TOTAL; + CaloNoise::NOISETYPE m_noiseType=CaloNoise::TOTAL; }; diff --git a/Calorimeter/CaloUtils/CaloUtils/CaloLCDeadMaterialTool.h b/Calorimeter/CaloUtils/CaloUtils/CaloLCDeadMaterialTool.h index 039721ac393ae725aa43b11359dcd9f3af97e986..1f13bea4f17790b49cd51ef4772126b5f34d1130 100644 --- a/Calorimeter/CaloUtils/CaloUtils/CaloLCDeadMaterialTool.h +++ b/Calorimeter/CaloUtils/CaloUtils/CaloLCDeadMaterialTool.h @@ -25,9 +25,9 @@ #include "CaloConditions/CaloLocalHadCoeff.h" #include "StoreGate/DataHandle.h" #include "GaudiKernel/ToolHandle.h" -#include "AthenaKernel/IOVSvcDefs.h" #include "CaloGeoHelpers/CaloSampling.h" #include "StoreGate/ReadCondHandleKey.h" +#include "GaudiKernel/EventContext.h" #include <map> #include <vector> @@ -61,7 +61,7 @@ class CaloLCDeadMaterialTool : public AthAlgTool, virtual public IClusterCellWei virtual ~CaloLCDeadMaterialTool() override; - virtual StatusCode weight(xAOD::CaloCluster* theCluster) const override; + virtual StatusCode weight(xAOD::CaloCluster* theCluster, const EventContext& ctx) const override; virtual StatusCode initialize() override; CaloLCDeadMaterialTool(const std::string& type, diff --git a/Calorimeter/CaloUtils/CaloUtils/CaloLCOutOfClusterTool.h b/Calorimeter/CaloUtils/CaloUtils/CaloLCOutOfClusterTool.h index f49e0d3ab234e5a4808b661d678d1f2f92cd06f3..3311d6c693f057ed10fce78c5e8d60ce6868ec77 100644 --- a/Calorimeter/CaloUtils/CaloUtils/CaloLCOutOfClusterTool.h +++ b/Calorimeter/CaloUtils/CaloUtils/CaloLCOutOfClusterTool.h @@ -22,6 +22,7 @@ #include "CaloConditions/CaloLocalHadCoeff.h" #include "StoreGate/ReadCondHandleKey.h" #include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/EventContext.h" class CaloLCOutOfClusterTool : public AthAlgTool, virtual public IClusterCellWeightTool { @@ -29,7 +30,7 @@ class CaloLCOutOfClusterTool : public AthAlgTool, virtual public IClusterCellWei virtual ~CaloLCOutOfClusterTool(); - virtual StatusCode weight(xAOD::CaloCluster* theCluster) const override; + virtual StatusCode weight(xAOD::CaloCluster* theCluster, const EventContext& ctx) const override; virtual StatusCode initialize() override; CaloLCOutOfClusterTool(const std::string& type, diff --git a/Calorimeter/CaloUtils/CaloUtils/CaloLCWeightTool.h b/Calorimeter/CaloUtils/CaloUtils/CaloLCWeightTool.h index 37d4113848791e54f3cb40f41beaed465b5eb9e8..e55b7c9427f4209e8da3d7d7291d1fae6b028363 100644 --- a/Calorimeter/CaloUtils/CaloUtils/CaloLCWeightTool.h +++ b/Calorimeter/CaloUtils/CaloUtils/CaloLCWeightTool.h @@ -25,6 +25,8 @@ #include "AthenaBaseComps/AthAlgTool.h" #include "AthenaKernel/IOVSvcDefs.h" #include "StoreGate/ReadCondHandleKey.h" +#include "CaloConditions/CaloNoise.h" +#include "GaudiKernel/EventContext.h" class CaloCell_ID; class CaloDetDescrManager; @@ -38,7 +40,7 @@ class CaloLCWeightTool : public AthAlgTool, virtual public IClusterCellWeightToo virtual ~CaloLCWeightTool(); - virtual StatusCode weight(xAOD::CaloCluster* theCluster) const override; + virtual StatusCode weight(xAOD::CaloCluster* theCluster, const EventContext& ctx) const override; virtual StatusCode initialize() override; CaloLCWeightTool(const std::string& type, @@ -95,7 +97,7 @@ class CaloLCWeightTool : public AthAlgTool, virtual public IClusterCellWeightToo const CaloCell_ID* m_calo_id; const CaloDetDescrManager* m_calo_dd_man; - mutable ToolHandle<ICalorimeterNoiseTool> m_noiseTool; + SG::ReadCondHandleKey<CaloNoise> m_noiseCDOKey{this,"CaloNoiseKey","electronicNoise","SG Key of CaloNoise data object"}; }; #endif diff --git a/Calorimeter/CaloUtils/src/CaloLCDeadMaterialTool.cxx b/Calorimeter/CaloUtils/src/CaloLCDeadMaterialTool.cxx index e2b5833a43ee5cc02772d3f01469a02c5b85740d..0351d5e3d06660001f9984a489bfdcc2d95e8573 100644 --- a/Calorimeter/CaloUtils/src/CaloLCDeadMaterialTool.cxx +++ b/Calorimeter/CaloUtils/src/CaloLCDeadMaterialTool.cxx @@ -138,7 +138,7 @@ StatusCode CaloLCDeadMaterialTool::initialize() /* **************************************************************************** - DeadMaterialCorrectionTool2::execute **************************************************************************** */ -StatusCode CaloLCDeadMaterialTool::weight(CaloCluster* theCluster) const +StatusCode CaloLCDeadMaterialTool::weight(CaloCluster* theCluster, const EventContext& ctx) const { CaloLCCoeffHelper hp; CaloLocalHadCoeff::LocalHadCoeff parint; @@ -204,7 +204,7 @@ StatusCode CaloLCDeadMaterialTool::weight(CaloCluster* theCluster) const } const CaloLocalHadCoeff* data(0); - SG::ReadCondHandle<CaloLocalHadCoeff> rch(m_key); + SG::ReadCondHandle<CaloLocalHadCoeff> rch(m_key,ctx); data = *rch; if(data==0) { ATH_MSG_ERROR("Unable to access conditions object"); diff --git a/Calorimeter/CaloUtils/src/CaloLCOutOfClusterTool.cxx b/Calorimeter/CaloUtils/src/CaloLCOutOfClusterTool.cxx index 95753e59b77c87a6a3aaa07623f3046845145acb..ba5816aca4000d1b85693167f24ef19d74c7909f 100644 --- a/Calorimeter/CaloUtils/src/CaloLCOutOfClusterTool.cxx +++ b/Calorimeter/CaloUtils/src/CaloLCOutOfClusterTool.cxx @@ -132,7 +132,7 @@ StatusCode CaloLCOutOfClusterTool::initialize() return StatusCode::SUCCESS; } -StatusCode CaloLCOutOfClusterTool::weight(CaloCluster *theCluster) const +StatusCode CaloLCOutOfClusterTool::weight(CaloCluster *theCluster, const EventContext& ctx) const { double eWeightedOrig = theCluster->e(); double eWeighted = theCluster->e(); @@ -198,7 +198,7 @@ StatusCode CaloLCOutOfClusterTool::weight(CaloCluster *theCluster) const double log10cluse = log10(eEM); - SG::ReadCondHandle<CaloLocalHadCoeff> h (m_key); + SG::ReadCondHandle<CaloLocalHadCoeff> h (m_key,ctx); const CaloLocalHadCoeff* data = *h; if (!data) { ATH_MSG_ERROR("Unable to access conditions object"); diff --git a/Calorimeter/CaloUtils/src/CaloLCWeightTool.cxx b/Calorimeter/CaloUtils/src/CaloLCWeightTool.cxx index 00414661d88ecc5fa39394d46c1b767c733c6477..4254a3230295e33c41585b6571fcec0f61559790 100644 --- a/Calorimeter/CaloUtils/src/CaloLCWeightTool.cxx +++ b/Calorimeter/CaloUtils/src/CaloLCWeightTool.cxx @@ -28,11 +28,6 @@ #include "CaloDetDescr/CaloDetDescrManager.h" #include "CaloIdentifier/CaloCell_ID.h" -#include "CaloInterface/ICalorimeterNoiseTool.h" -//#include "GaudiKernel/ISvcLocator.h" -//#include "GaudiKernel/ListItem.h" -//#include "StoreGate/StoreGateSvc.h" - #include "xAODCaloEvent/CaloClusterKineHelper.h" CaloLCWeightTool::CaloLCWeightTool(const std::string& type, @@ -44,8 +39,7 @@ CaloLCWeightTool::CaloLCWeightTool(const std::string& type, m_useHadProbability(false), m_interpolate(false), m_calo_id(nullptr), - m_calo_dd_man(nullptr), - m_noiseTool("CaloNoiseTool/CaloNoiseToolDefault") + m_calo_dd_man(nullptr) { declareInterface<IClusterCellWeightTool>(this); @@ -54,7 +48,6 @@ CaloLCWeightTool::CaloLCWeightTool(const std::string& type, declareProperty("SignalOverNoiseCut",m_signalOverNoiseCut); // Use EM_PROBABILITY Moment to apply relative weights declareProperty("UseHadProbability",m_useHadProbability); - declareProperty("CaloNoiseTool", m_noiseTool); // Use Interpolation or not declareProperty("Interpolate",m_interpolate); m_interpolateDimensionNames.resize(3); @@ -91,26 +84,24 @@ StatusCode CaloLCWeightTool::initialize() ATH_CHECK( detStore()->retrieve (m_calo_dd_man, "CaloMgr") ); m_calo_id = m_calo_dd_man->getCaloCell_ID(); - //---- retrieve the noisetool ---------------- - - if(m_noiseTool.retrieve().isFailure()){ - ATH_MSG_INFO( "Unable to find tool for CaloNoiseTool"); - } else { - ATH_MSG_INFO( "Noise Tool retrieved" ); - } - m_sampnames.reserve(CaloSampling::Unknown); for (int iSamp=0;iSamp<CaloSampling::Unknown;iSamp++) { m_sampnames.push_back(CaloSamplingHelper::getSamplingName((CaloSampling::CaloSample)iSamp)); } + ATH_CHECK(m_noiseCDOKey.initialize()); + return StatusCode::SUCCESS; } -StatusCode CaloLCWeightTool::weight(xAOD::CaloCluster *theCluster) const +StatusCode CaloLCWeightTool::weight(xAOD::CaloCluster *theCluster, const EventContext& ctx) const { const CaloLocalHadCoeff* data(0); SG::ReadCondHandle<CaloLocalHadCoeff> rch(m_key); + + SG::ReadCondHandle<CaloNoise> noiseHdl{m_noiseCDOKey,ctx}; + const CaloNoise* noiseCDO=*noiseHdl; + data = *rch; if(data==0) { ATH_MSG_ERROR("Unable to access conditions object"); @@ -160,7 +151,7 @@ StatusCode CaloLCWeightTool::weight(xAOD::CaloCluster *theCluster) const Identifier myId = itrCell->ID(); CaloCell_ID::CaloSample theSample = CaloCell_ID::CaloSample(m_calo_id->calo_sample(myId)); if ( isAmpMap[theSample] >= 0 ) { - double sigma = m_noiseTool->getNoise(*itrCell,ICalorimeterNoiseTool::ELECTRONICNOISE); + double sigma = noiseCDO->getNoise(itrCell->ID(),itrCell->gain()); double energy = fabs(itrCell->e()); double ratio = 0; if ( std::isfinite(sigma) && sigma > 0 ) diff --git a/Reconstruction/eflowRec/python/PFLocalHadCal.py b/Reconstruction/eflowRec/python/PFLocalHadCal.py index b5e6c2d34c288c17dff8a47260e679a0d5f62329..2c6d61f8d8a309ae713221aa02dbbfe0b66a337b 100644 --- a/Reconstruction/eflowRec/python/PFLocalHadCal.py +++ b/Reconstruction/eflowRec/python/PFLocalHadCal.py @@ -66,36 +66,13 @@ class PFLocalHadCal: print traceback.format_exc() return False - - try: - from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault - theCaloNoiseTool = CaloNoiseToolDefault() - except: - mlog.error("could not import CaloTools.CaloNoiseToolDefault") - print traceback.format_exc() - return False - - - try: + from CaloTools.CaloNoiseCondAlg import CaloNoiseCondAlg + #For LCWeightsTool needs electronic noise + CaloNoiseCondAlg(noisetype="electronicNoise") from AthenaCommon.AppMgr import ServiceMgr as svcMgr - except: - mlog.error("coud not import svcMgr") - print traceback.format_ec() - return False - - if (False == hasattr(svcMgr.ToolSvc, "CaloNoiseToolDefault") ): - try: - from AthenaCommon.AppMgr import ToolSvc - except: - mlog.error("could not import ToolSvc") - print traceback.format_ec() - return False - - ToolSvc += theCaloNoiseTool LCWeight.CorrectionKey = "H1ClusterCellWeights" LCWeight.SignalOverNoiseCut = 2.0 - LCWeight.CaloNoiseTool = theCaloNoiseTool LCWeight.UseHadProbability = True return LCWeight diff --git a/Reconstruction/eflowRec/share/PFlowMTConfig.py b/Reconstruction/eflowRec/share/PFlowMTConfig.py index 950f5b5fe6da32ba884ad0d16e0111485b4efdc2..3570418c6ef582d90b65b7e70aa4a01df91de9d0 100644 --- a/Reconstruction/eflowRec/share/PFlowMTConfig.py +++ b/Reconstruction/eflowRec/share/PFlowMTConfig.py @@ -16,6 +16,9 @@ TrackSelectionTool = InDet__InDetTrackSelectionTool() from AthenaCommon.AppMgr import ToolSvc ToolSvc += TrackSelectionTool +from CaloTools.CaloNoiseCondAlg import CaloNoiseCondAlg +CaloNoiseCondAlg() + TrackSelectionTool.CutLevel = "TightPrimary" TrackSelectionTool.minPt = 500.0 @@ -103,16 +106,9 @@ PFClusterMomentsMaker = CaloClusterMomentsMaker("PFClusterMomentsMaker") from CaloRec.CaloTopoClusterFlags import jobproperties -from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault -theCaloNoiseTool = CaloNoiseToolDefault() -from AthenaCommon.AppMgr import ToolSvc -ToolSvc += theCaloNoiseTool - PFClusterMomentsMaker.MaxAxisAngle = 20*deg PFClusterMomentsMaker.WeightingOfNegClusters = jobproperties.CaloTopoClusterFlags.doTreatEnergyCutAsAbsolute() PFClusterMomentsMaker.MinBadLArQuality = 4000 -PFClusterMomentsMaker.CaloNoiseTool = theCaloNoiseTool -PFClusterMomentsMaker.UsePileUpNoise = True PFClusterMomentsMaker.TwoGaussianNoise = jobproperties.CaloTopoClusterFlags.doTwoGaussianNoise() PFClusterMomentsMaker.OutputLevel = INFO PFClusterMomentsMaker.MomentsNames = [ diff --git a/Reconstruction/tauRec/share/Pi0ClusterMaker_jobOptions.py b/Reconstruction/tauRec/share/Pi0ClusterMaker_jobOptions.py index e2876a1ab9074385172cf6e8e1b49d70132ee835..1b97e0974cb774656b7d1b4bb63eb8719a95d337 100644 --- a/Reconstruction/tauRec/share/Pi0ClusterMaker_jobOptions.py +++ b/Reconstruction/tauRec/share/Pi0ClusterMaker_jobOptions.py @@ -29,10 +29,10 @@ from AthenaCommon.AlgSequence import AlgSequence from AthenaCommon.GlobalFlags import globalflags from RecExConfig.RecFlags import rec -from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault -theCaloNoiseTool = CaloNoiseToolDefault() -from AthenaCommon.AppMgr import ToolSvc -ToolSvc += theCaloNoiseTool +from CaloTools.CaloNoiseCondAlg import CaloNoiseCondAlg +CaloNoiseCondAlg() +#For LCWeightsTool needs electronic noise +CaloNoiseCondAlg(noisetype="electronicNoise") # configure cell weight calibration if jobproperties.CaloTopoClusterFlags.doCellWeightCalib(): @@ -66,7 +66,6 @@ if jobproperties.CaloTopoClusterFlags.doTopoClusterLocalCalib(): # H1Weight = H1ClusterCellWeightTool("H1Weight") # H1Weight.CorrectionKey = "H1ClusterCellWeights" # H1Weight.SignalOverNoiseCut = 2.0 - # H1Weight.CaloNoiseTool = theCaloNoiseTool # # OOCC = OutOfClusterCorrectionTool("OOCC") # OOCC.CorrectionKey = "OOCCorrection" @@ -86,7 +85,6 @@ if jobproperties.CaloTopoClusterFlags.doTopoClusterLocalCalib(): LCWeight = CaloLCWeightTool("LCWeight") LCWeight.CorrectionKey = "H1ClusterCellWeights" LCWeight.SignalOverNoiseCut = 2.0 - LCWeight.CaloNoiseTool = theCaloNoiseTool LCWeight.UseHadProbability = True LCOut = CaloLCOutOfClusterTool("LCOut") @@ -101,7 +99,6 @@ if jobproperties.CaloTopoClusterFlags.doTopoClusterLocalCalib(): #DMTool = DeadMaterialCorrectionTool2("DMTool") #DMTool.HadDMCoeffKey = "HadDMCoeff2" - #DMTool.SignalOverNoiseCut = 1.0 #DMTool.ClusterRecoStatus = 0 #DMTool.WeightModeDM = 2 #DMTool.CaloNoiseTool = theCaloNoiseTool @@ -154,8 +151,6 @@ if jobproperties.CaloTopoClusterFlags.doTopoClusterLocalCalib(): TopoMomentsForTaus = CaloClusterMomentsMaker ("TauPi0TopoMoments") TopoMomentsForTaus.WeightingOfNegClusters = jobproperties.CaloTopoClusterFlags.doTreatEnergyCutAsAbsolute() TopoMomentsForTaus.MaxAxisAngle = 20*deg -TopoMomentsForTaus.CaloNoiseTool = theCaloNoiseTool -TopoMomentsForTaus.UsePileUpNoise = True TopoMomentsForTaus.TwoGaussianNoise = jobproperties.CaloTopoClusterFlags.doTwoGaussianNoise() TopoMomentsForTaus.MinBadLArQuality = 4000 TopoMomentsForTaus.MomentsNames = ["FIRST_PHI" @@ -228,9 +223,6 @@ TopoClusterForTaus.SeedSamplingNames = [ "PreSamplerB", "EMB1", "EMB2", # Do we want to use EMB3? "PreSamplerE", "EME1", "EME2" # Do we want to use EME3? ] -TopoClusterForTaus.CaloNoiseTool = theCaloNoiseTool -TopoClusterForTaus.UseCaloNoiseTool = True -TopoClusterForTaus.UsePileUpNoise = True TopoClusterForTaus.NeighborOption = "super3D" TopoClusterForTaus.RestrictHECIWandFCalNeighbors = False TopoClusterForTaus.RestrictPSNeighbors = True diff --git a/TileCalorimeter/TileMonitoring/share/TileMonTopoCluster_jobOptions.py b/TileCalorimeter/TileMonitoring/share/TileMonTopoCluster_jobOptions.py index 7c62296a5894645b4106285db0566a5a9557660e..ccaac7458aef2f5adf5116d39456764aeca9a416 100644 --- a/TileCalorimeter/TileMonitoring/share/TileMonTopoCluster_jobOptions.py +++ b/TileCalorimeter/TileMonitoring/share/TileMonTopoCluster_jobOptions.py @@ -30,9 +30,11 @@ from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault theCaloNoiseTool = CaloNoiseToolDefault() from CaloRec.CaloTopoClusterFlags import jobproperties +from CaloTools.CaloNoiseCondAlg import CaloNoiseCondAlg +CaloNoiseCondAlg() + from AthenaCommon.AppMgr import ToolSvc ToolSvc += theCaloNoiseTool -print theCaloNoiseTool doTopoClusterLocalCalib=False @@ -104,10 +106,7 @@ TileTopoMaker.CalorimeterNames=["TILE"] TileTopoMaker.SeedSamplingNames = ["TileBar0", "TileBar1", "TileBar2", "TileExt0", "TileExt1", "TileExt2", "TileGap1", "TileGap2", "TileGap3"] -TileTopoMaker.CaloNoiseTool=theCaloNoiseTool #TileTopoMaker.NoiseSigma= 1.68 / 1023 / 64 * 800 * 1.414214 * GeV -TileTopoMaker.UseCaloNoiseTool=True -TileTopoMaker.UsePileUpNoise=True TileTopoMaker.NeighborOption = "super3D" TileTopoMaker.RestrictHECIWandFCalNeighbors = False TileTopoMaker.CellThresholdOnEorAbsEinSigma = 0.0 diff --git a/Trigger/TrigAlgorithms/TrigCaloRec/python/TrigCaloRecConfig.py b/Trigger/TrigAlgorithms/TrigCaloRec/python/TrigCaloRecConfig.py index d23d7ee71d95888eb5d4ec713326372bd26c953b..37f8e716cd1ecab668163af7ae96e980c14a41cd 100755 --- a/Trigger/TrigAlgorithms/TrigCaloRec/python/TrigCaloRecConfig.py +++ b/Trigger/TrigAlgorithms/TrigCaloRec/python/TrigCaloRecConfig.py @@ -171,6 +171,9 @@ class TrigCaloCellMaker_eGamma (TrigCaloCellMakerBase): from AthenaCommon.AppMgr import ToolSvc ToolSvc+=theCaloNoiseTool + from CaloTools.CaloNoiseCondAlg import CaloNoiseCondAlg + CaloNoiseCondAlg() + roilaremcellcontmaker = RoILArEMCellContMaker() roilaremcellcontmaker.CaloNoiseTool = theCaloNoiseTool roilarhadcellcontmaker = RoILArHadCellContMaker() @@ -669,13 +672,15 @@ class TrigCaloClusterMaker_topo (TrigCaloClusterMakerBase): print jobproperties.CaloTopoClusterFlags.doTopoClusterLocalCalib() # tools used by tools - from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault - theCaloNoiseTool=CaloNoiseToolDefault() #flag='tool', name='myCaloNoiseToolDefault') - from AthenaCommon.AppMgr import ToolSvc - ToolSvc+=theCaloNoiseTool + #from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault + #theCaloNoiseTool=CaloNoiseToolDefault() #flag='tool', name='myCaloNoiseToolDefault') + #from AthenaCommon.AppMgr import ToolSvc + #ToolSvc+=theCaloNoiseTool if doLC: - + from CaloTools.CaloNoiseCondAlg import CaloNoiseCondAlg + #For LCWeightsTool needs electronic noise + CaloNoiseCondAlg(noisetype="electronicNoise") TrigLCClassify = CaloLCClassificationTool("TrigLCClassify") TrigLCClassify.ClassificationKey = "EMFracClassify" TrigLCClassify.UseSpread = False @@ -685,7 +690,6 @@ class TrigCaloClusterMaker_topo (TrigCaloClusterMakerBase): TrigLCWeight = CaloLCWeightTool("TrigLCWeight") TrigLCWeight.CorrectionKey = "H1ClusterCellWeights" TrigLCWeight.SignalOverNoiseCut = 2.0 - TrigLCWeight.CaloNoiseTool = theCaloNoiseTool TrigLCWeight.UseHadProbability = True TrigLCOut = CaloLCOutOfClusterTool("TrigLCOut") @@ -703,7 +707,6 @@ class TrigCaloClusterMaker_topo (TrigCaloClusterMakerBase): #TrigLCDeadMaterial.SignalOverNoiseCut = 1.0 TrigLCDeadMaterial.ClusterRecoStatus = 0 TrigLCDeadMaterial.WeightModeDM = 2 - #TrigLCDeadMaterial.CaloNoiseTool = theCaloNoiseTool TrigLCDeadMaterial.UseHadProbability = True # correction tools using tools @@ -743,9 +746,7 @@ class TrigCaloClusterMaker_topo (TrigCaloClusterMakerBase): # correction tools not using tools TrigTopoMoments = CaloClusterMomentsMaker ("TrigTopoMoments") TrigTopoMoments.MaxAxisAngle = 20*deg - TrigTopoMoments.CaloNoiseTool = theCaloNoiseTool TrigTopoMoments.TwoGaussianNoise = jobproperties.CaloTopoClusterFlags.doTwoGaussianNoise() - TrigTopoMoments.UsePileUpNoise = True TrigTopoMoments.MinBadLArQuality = 4000 TrigTopoMoments.MomentsNames = ["FIRST_PHI" ,"FIRST_ETA" @@ -808,9 +809,6 @@ class TrigCaloClusterMaker_topo (TrigCaloClusterMakerBase): "TileGap1", "TileGap2", "TileGap3", "FCAL0", "FCAL1", "FCAL2"] - TrigTopoMaker.CaloNoiseTool=theCaloNoiseTool - TrigTopoMaker.UseCaloNoiseTool=True - TrigTopoMaker.UsePileUpNoise=True TrigTopoMaker.NeighborOption = "super3D" TrigTopoMaker.RestrictHECIWandFCalNeighbors = False TrigTopoMaker.CellThresholdOnEorAbsEinSigma = 0.0 @@ -974,14 +972,6 @@ class TrigCaloClusterMaker_EMtopo (TrigCaloClusterMakerBase): emtopocluster.SeedSamplingNames = [ "PreSamplerB", "EMB1", "EMB2", "PreSamplerE", "EME1", "EME2" ] - from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault - theCaloNoiseTool=CaloNoiseToolDefault() - from AthenaCommon.AppMgr import ToolSvc - ToolSvc+=theCaloNoiseTool - emtopocluster.CaloNoiseTool=theCaloNoiseTool - - emtopocluster.UseCaloNoiseTool=True - emtopocluster.UsePileUpNoise=False emtopocluster.NeighborOption = "all3D" emtopocluster.CellThresholdOnEorAbsEinSigma = 0.0 @@ -1029,9 +1019,7 @@ class TrigCaloClusterMaker_EMtopo (TrigCaloClusterMakerBase): emtopomoments.OutputLevel = INFO emtopomoments.MaxAxisAngle = 20*deg - emtopomoments.CaloNoiseTool = theCaloNoiseTool emtopomoments.TwoGaussianNoise = jobproperties.CaloTopoClusterFlags.doTwoGaussianNoise() - emtopomoments.UsePileUpNoise = True emtopomoments.MinBadLArQuality = 4000 emtopomoments.MomentsNames = ["FIRST_PHI" ,"FIRST_ETA" @@ -1356,6 +1344,7 @@ class TrigCaloClusterMakerMT_topo (TrigCaloClusterMakerMTBase): from CaloClusterCorrection.CaloClusterCorrectionConf import CaloClusterLocalCalib from CaloClusterCorrection.CaloClusterBadChannelListCorr import CaloClusterBadChannelListCorr from CaloRec.CaloRecConf import CaloTopoClusterMaker, CaloTopoClusterSplitter, CaloClusterMomentsMaker, CaloClusterMaker, CaloCell2ClusterMapper + from CaloTools.CaloNoiseCondAlg import CaloNoiseCondAlg from CaloRec.CaloTopoClusterFlags import jobproperties from AthenaCommon.SystemOfUnits import deg from AthenaCommon.AlgSequence import AlgSequence @@ -1367,13 +1356,10 @@ class TrigCaloClusterMakerMT_topo (TrigCaloClusterMakerMTBase): print jobproperties.CaloTopoClusterFlags.doTopoClusterLocalCalib() # tools used by tools - from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault - theCaloNoiseTool=CaloNoiseToolDefault() #flag='tool', name='myCaloNoiseToolDefault') - from AthenaCommon.AppMgr import ToolSvc - ToolSvc+=theCaloNoiseTool if doLC: - + #For LCWeightsTool needs electronic noise + CaloNoiseCondAlg(noisetype="electronicNoise") TrigLCClassify = CaloLCClassificationTool("TrigLCClassify") TrigLCClassify.ClassificationKey = "EMFracClassify" TrigLCClassify.UseSpread = False @@ -1383,7 +1369,6 @@ class TrigCaloClusterMakerMT_topo (TrigCaloClusterMakerMTBase): TrigLCWeight = CaloLCWeightTool("TrigLCWeight") TrigLCWeight.CorrectionKey = "H1ClusterCellWeights" TrigLCWeight.SignalOverNoiseCut = 2.0 - TrigLCWeight.CaloNoiseTool = theCaloNoiseTool TrigLCWeight.UseHadProbability = True TrigLCOut = CaloLCOutOfClusterTool("TrigLCOut") @@ -1401,7 +1386,6 @@ class TrigCaloClusterMakerMT_topo (TrigCaloClusterMakerMTBase): #TrigLCDeadMaterial.SignalOverNoiseCut = 1.0 TrigLCDeadMaterial.ClusterRecoStatus = 0 TrigLCDeadMaterial.WeightModeDM = 2 - #TrigLCDeadMaterial.CaloNoiseTool = theCaloNoiseTool TrigLCDeadMaterial.UseHadProbability = True # correction tools using tools @@ -1441,9 +1425,7 @@ class TrigCaloClusterMakerMT_topo (TrigCaloClusterMakerMTBase): # correction tools not using tools TrigTopoMoments = CaloClusterMomentsMaker ("TrigTopoMoments") TrigTopoMoments.MaxAxisAngle = 20*deg - TrigTopoMoments.CaloNoiseTool = theCaloNoiseTool TrigTopoMoments.TwoGaussianNoise = jobproperties.CaloTopoClusterFlags.doTwoGaussianNoise() - TrigTopoMoments.UsePileUpNoise = True TrigTopoMoments.MinBadLArQuality = 4000 TrigTopoMoments.MomentsNames = ["FIRST_PHI" ,"FIRST_ETA" @@ -1489,6 +1471,7 @@ class TrigCaloClusterMakerMT_topo (TrigCaloClusterMakerMTBase): # ] # maker tools + CaloNoiseCondAlg() TrigTopoMaker = CaloTopoClusterMaker("TrigTopoMaker") TrigTopoMaker.CellsName = cells @@ -1506,9 +1489,6 @@ class TrigCaloClusterMakerMT_topo (TrigCaloClusterMakerMTBase): "TileGap1", "TileGap2", "TileGap3", "FCAL0", "FCAL1", "FCAL2"] - TrigTopoMaker.CaloNoiseTool=theCaloNoiseTool - TrigTopoMaker.UseCaloNoiseTool=True - TrigTopoMaker.UsePileUpNoise=True TrigTopoMaker.NeighborOption = "super3D" TrigTopoMaker.RestrictHECIWandFCalNeighbors = False TrigTopoMaker.CellThresholdOnEorAbsEinSigma = 0.0 @@ -1641,14 +1621,6 @@ class TrigCaloClusterMakerMT_EMtopo (TrigCaloClusterMakerMTBase): emtopocluster.SeedSamplingNames = [ "PreSamplerB", "EMB1", "EMB2", "PreSamplerE", "EME1", "EME2" ] - from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault - theCaloNoiseTool=CaloNoiseToolDefault() - from AthenaCommon.AppMgr import ToolSvc - ToolSvc+=theCaloNoiseTool - emtopocluster.CaloNoiseTool=theCaloNoiseTool - - emtopocluster.UseCaloNoiseTool=True - emtopocluster.UsePileUpNoise=False emtopocluster.NeighborOption = "all3D" emtopocluster.CellThresholdOnEorAbsEinSigma = 0.0 @@ -1696,9 +1668,7 @@ class TrigCaloClusterMakerMT_EMtopo (TrigCaloClusterMakerMTBase): emtopomoments.OutputLevel = INFO emtopomoments.MaxAxisAngle = 20*deg - emtopomoments.CaloNoiseTool = theCaloNoiseTool emtopomoments.TwoGaussianNoise = jobproperties.CaloTopoClusterFlags.doTwoGaussianNoise() - emtopomoments.UsePileUpNoise = True emtopomoments.MinBadLArQuality = 4000 emtopomoments.MomentsNames = ["FIRST_PHI" ,"FIRST_ETA"