diff --git a/Reconstruction/tauRec/python/TauAlgorithmsHolder.py b/Reconstruction/tauRec/python/TauAlgorithmsHolder.py index 4120e3ef299c3ed21615162f67d1e42247180433..d998386d336daf444a0f309d68410475c354cc0f 100644 --- a/Reconstruction/tauRec/python/TauAlgorithmsHolder.py +++ b/Reconstruction/tauRec/python/TauAlgorithmsHolder.py @@ -102,6 +102,7 @@ def getEnergyCalibrationLC(correctEnergy=True, correctAxis=False, postfix=''): doAxisCorrection = correctAxis, doPtResponse = True, countOnlyPileupVertices = True, + Key_vertexInputContainer = _DefaultVertexContainer ) cached_instances[_name] = TauCalibrateLC diff --git a/Reconstruction/tauRec/python/TauRecBuilder.py b/Reconstruction/tauRec/python/TauRecBuilder.py index 8382dbf396264cd2ef2d96eb276bf407baf842c3..d7dc202720992dc27418372fc0cecea15457470d 100644 --- a/Reconstruction/tauRec/python/TauRecBuilder.py +++ b/Reconstruction/tauRec/python/TauRecBuilder.py @@ -110,7 +110,7 @@ class TauRecCoreBuilder ( TauRecConfigured ) : tools.append(taualgs.getTauAxis()) tools.append(taualgs.getTauTrackFinder(removeDuplicateTracks=(not doMVATrackClassification) )) if doMVATrackClassification : tools.append(taualgs.getTauTrackClassifier()) - #tools.append(taualgs.getEnergyCalibrationLC(correctEnergy=True, correctAxis=False, postfix='_onlyEnergy')) + tools.append(taualgs.getEnergyCalibrationLC(correctEnergy=True, correctAxis=False, postfix='_onlyEnergy')) #tools.append(taualgs.getCellVariables()) #tools.append(taualgs.getElectronVetoVars()) # diff --git a/Reconstruction/tauRecTools/Root/TauCalibrateLC.cxx b/Reconstruction/tauRecTools/Root/TauCalibrateLC.cxx index f6544a9ee91bb8b0ee5e63301d6af966a7d73032..15a163b8cd33a4d9bfc6d055def10c7dddbf2c5d 100644 --- a/Reconstruction/tauRecTools/Root/TauCalibrateLC.cxx +++ b/Reconstruction/tauRecTools/Root/TauCalibrateLC.cxx @@ -33,19 +33,15 @@ TauCalibrateLC::TauCalibrateLC(const std::string& name) : m_doAxisCorr(false), m_usePantauAxis(false), m_printMissingContainerINFO(true), - m_isCaloOnly(false), - m_clusterCone(0.2) //not used + m_isCaloOnly(false) { declareProperty("ConfigPath", m_configPath); - declareProperty("tauContainerKey", m_tauContainerKey = "TauJets"); declareProperty("calibrationFile", m_calibrationFile = "EnergyCalibrationLC2012.root"); - declareProperty("vertexContainerKey", m_vertexContainerKey = "PrimaryVertices"); declareProperty("doEnergyCorrection", m_doEnergyCorr); declareProperty("doPtResponse", m_doPtResponse); declareProperty("countOnlyPileupVertices", m_countOnlyPileupVertices=false); declareProperty("doAxisCorrection", m_doAxisCorr); declareProperty("usePantauAxis", m_usePantauAxis); - declareProperty("ClusterCone", m_clusterCone); //not used declareProperty("isCaloOnly", m_isCaloOnly); } @@ -56,6 +52,8 @@ TauCalibrateLC::~TauCalibrateLC() { /********************************************************************/ StatusCode TauCalibrateLC::initialize() { + ATH_CHECK( m_vertexInputContainer.initialize() ); + std::string fullPath = find_file(m_calibrationFile); TFile * file = TFile::Open(fullPath.c_str(), "READ"); @@ -164,9 +162,16 @@ StatusCode TauCalibrateLC::execute(xAOD::TauJet& pTau) if (etaBin>=m_nEtaBins) etaBin = m_nEtaBins-1; // correction from last bin should be applied on all taus outside stored eta range - // get primary vertex container StatusCode sc; + // Get the primary vertex container from StoreGate + SG::ReadHandle<xAOD::VertexContainer> vertexInHandle( m_vertexInputContainer ); + if (!vertexInHandle.isValid()) { + ATH_MSG_ERROR ("Could not retrieve HiveDataObj with key " << vertexInHandle.key()); + return StatusCode::FAILURE; + } const xAOD::VertexContainer * vxContainer = 0; + vxContainer = vertexInHandle.cptr(); + // for tau trigger bool inTrigger = tauEventData()->inTrigger(); @@ -175,14 +180,6 @@ StatusCode TauCalibrateLC::execute(xAOD::TauJet& pTau) // Only retrieve the container if we are not in trigger if (sc.isFailure() || !inTrigger ) { - // try standard - if (evtStore()->retrieve(vxContainer, m_vertexContainerKey).isFailure() || !vxContainer) { - if (m_printMissingContainerINFO) { - ATH_MSG_WARNING(m_vertexContainerKey << " container not found --> skip TauEnergyCalibrationLC (no further info) "); - m_printMissingContainerINFO=false; - } - return StatusCode::SUCCESS; - } // Calculate nVertex xAOD::VertexContainer::const_iterator vx_iter = vxContainer->begin(); @@ -325,12 +322,17 @@ StatusCode TauCalibrateLC::execute(xAOD::TauJet& pTau) //----------------------------------------------------------------------------- StatusCode TauCalibrateLC::finalize() { - for (int i = 0; i<s_nProngBins; i++) - { - delete m_slopeNPVHist[i]; - } - delete m_etaBinHist; - delete m_etaCorrectionHist; + + // these are already out of scope? + // does it matter if they are deleted? This is at the end of the run anyway... + //for (int i = 0; i<s_nProngBins; i++) + //{ + //ATH_MSG_INFO(i); + // delete m_slopeNPVHist[i]; + //} + + //delete m_etaBinHist; + //delete m_etaCorrectionHist; return StatusCode::SUCCESS; } diff --git a/Reconstruction/tauRecTools/tauRecTools/TauCalibrateLC.h b/Reconstruction/tauRecTools/tauRecTools/TauCalibrateLC.h index 88ef69af70128ac1df40437500045ed41fa5775f..a34afa8f787a2dbab3a12042a52740fba714a62e 100644 --- a/Reconstruction/tauRecTools/tauRecTools/TauCalibrateLC.h +++ b/Reconstruction/tauRecTools/tauRecTools/TauCalibrateLC.h @@ -39,8 +39,6 @@ public: private: std::string m_configPath; - std::string m_tauContainerKey; - std::string m_vertexContainerKey; std::string m_calibrationFile; //!< energy calibration file static const int s_nProngBins = 2; @@ -62,7 +60,8 @@ private: bool m_printMissingContainerINFO; bool m_isCaloOnly; //!< switch for CaloOnly corrections - double m_clusterCone; //obsolete + SG::ReadHandleKey<xAOD::VertexContainer> m_vertexInputContainer{this,"Key_vertexInputContainer", "PrimaryVertices", "input vertex container key"}; + }; #endif