diff --git a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/CaloTrkMuIdTools/CaloMuonLikelihoodTool.h b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/CaloTrkMuIdTools/CaloMuonLikelihoodTool.h index 4f9aea8c4c24d6ebdc3a463ddc6e082b9977faa8..12baf5ecddd9a2908ef8a22a60de6ba51b8cd50f 100644 --- a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/CaloTrkMuIdTools/CaloMuonLikelihoodTool.h +++ b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/CaloTrkMuIdTools/CaloMuonLikelihoodTool.h @@ -13,6 +13,7 @@ #include "GaudiKernel/ToolHandle.h" #include "GaudiKernel/ServiceHandle.h" #include "StoreGate/StoreGateSvc.h" +#include "CaloEvent/CaloClusterContainer.h" #include <string> @@ -35,7 +36,7 @@ public: virtual StatusCode initialize(); virtual StatusCode finalize(); - double getLHR(const Trk::TrackParameters* trkpar, const double dR_CUT=0.3) const; + double getLHR(const Trk::TrackParameters* trkpar, const xAOD::CaloClusterContainer* ClusCollection=nullptr, const double dR_CUT=0.3) const; double getLHR(const xAOD::CaloClusterContainer* ClusCollection, const double eta_trk, const double p_trk, const double eta_trkAtCalo, const double phi_trkAtCalo, const double dR_CUT=0.3) const; private: diff --git a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/CaloTrkMuIdTools/TrackDepositInCaloTool.h b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/CaloTrkMuIdTools/TrackDepositInCaloTool.h index f16a2f674e5396e64fce82fda6541f924281b2f4..baf00c10f1a38ce93dcea457eb1d36821027f1c4 100755 --- a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/CaloTrkMuIdTools/TrackDepositInCaloTool.h +++ b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/CaloTrkMuIdTools/TrackDepositInCaloTool.h @@ -16,6 +16,9 @@ #include "GaudiKernel/ToolHandle.h" #include "GaudiKernel/ITHistSvc.h" +// --- Athena --- +#include "CaloEvent/CaloCellContainer.h" + // --- STL --- #include <utility> #include <vector> @@ -62,7 +65,7 @@ class TrackDepositInCaloTool: public AthAlgTool, virtual public ITrackDepositInC @param deltaR Unused parameter. Kept for backward compatibility. @param inCell Unused parameter. Kept for backward compatibility. */ - std::vector<DepositInCalo> getDeposits(const Trk::TrackParameters* par) const; + std::vector<DepositInCalo> getDeposits(const Trk::TrackParameters* par, const CaloCellContainer* caloCellCont = nullptr) const; std::vector<DepositInCalo> deposits(const Trk::TrackParameters *par, const double deltaR=0.3, const bool inCell= true) const; /** diff --git a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/cmt/requirements b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/cmt/requirements index 644e7926eb4755c7a4c077034999f68dee39e0ba..499f9f47324b21b33b8a5ce987b2bdb9e52d0c45 100755 --- a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/cmt/requirements +++ b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/cmt/requirements @@ -13,6 +13,7 @@ use ICaloTrkMuIdTools ICaloTrkMuIdTools-* Reconstruction/MuonI use CaloInterface CaloInterface-* Calorimeter use CaloTrackingGeometry CaloTrackingGeometry-* Calorimeter +use CaloEvent CaloEvent-* Calorimeter private use AtlasCLHEP AtlasCLHEP-* External @@ -24,7 +25,6 @@ use TrkEventPrimitives TrkEventPrimitives-* Tracking/TrkEvent use TrkSurfaces TrkSurfaces-* Tracking/TrkDetDescr use CaloIdentifier CaloIdentifier-* Calorimeter -use CaloEvent CaloEvent-* Calorimeter use xAODCaloEvent xAODCaloEvent-* Event/xAOD use CaloDetDescr CaloDetDescr-* Calorimeter use TileDetDescr TileDetDescr-* TileCalorimeter diff --git a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/share/CaloTrkMuIdTools_jobOptions.py b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/share/CaloTrkMuIdTools_jobOptions.py index 271a49aa8e735aa520b6608158cc6afd8657affd..3b8cb7c152b0b2183bb6bd120ea2b1386c206f1d 100755 --- a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/share/CaloTrkMuIdTools_jobOptions.py +++ b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/share/CaloTrkMuIdTools_jobOptions.py @@ -3,6 +3,10 @@ ############################################################################### include.block("CaloTrkMuIdTools/CaloTrkMuIdTools_jobOptions.py") + +###logfile +from AthenaCommon.Logging import log + ############################################################################### ## Helper function for defining THistSvc inputs ############################################################################### @@ -58,15 +62,18 @@ from AthenaCommon.AppMgr import ServiceMgr if not hasattr(ServiceMgr, 'THistSvc'): ServiceMgr += CfgMgr.THistSvc() -ServiceMgr.THistSvc.Input += defineCaloLhrPdf("CaloMuonLikelihood.PDF.A0.root"); ### PDFs for barrel region low pT -ServiceMgr.THistSvc.Input += defineCaloLhrPdf("CaloMuonLikelihood.PDF.A1.root"); ### PDFs for barrel region medium pT -ServiceMgr.THistSvc.Input += defineCaloLhrPdf("CaloMuonLikelihood.PDF.A2.root"); ### PDFs for barrel region high pT -ServiceMgr.THistSvc.Input += defineCaloLhrPdf("CaloMuonLikelihood.PDF.B0.root"); ### PDFs for transition region low pT -ServiceMgr.THistSvc.Input += defineCaloLhrPdf("CaloMuonLikelihood.PDF.B1.root"); ### PDFs for transition region medium pT -ServiceMgr.THistSvc.Input += defineCaloLhrPdf("CaloMuonLikelihood.PDF.B2.root"); ### PDFs for transition region high pT -ServiceMgr.THistSvc.Input += defineCaloLhrPdf("CaloMuonLikelihood.PDF.C0.root"); ### PDFs for endcap region low pT -ServiceMgr.THistSvc.Input += defineCaloLhrPdf("CaloMuonLikelihood.PDF.C1.root"); ### PDFs for endcap region medium pT -ServiceMgr.THistSvc.Input += defineCaloLhrPdf("CaloMuonLikelihood.PDF.C2.root"); ### PDFs for endcap region high pT +from AthenaCommon.AthenaCommonFlags import athenaCommonFlags +if athenaCommonFlags.isOnline == False: + log.error('THistSvc.Input = %s. Reading ntuples CaloTrkMuIdTools.' % ServiceMgr.THistSvc.Input) + ServiceMgr.THistSvc.Input += defineCaloLhrPdf("CaloMuonLikelihood.PDF.A0.root"); ### PDFs for barrel region low pT + ServiceMgr.THistSvc.Input += defineCaloLhrPdf("CaloMuonLikelihood.PDF.A1.root"); ### PDFs for barrel region medium pT + ServiceMgr.THistSvc.Input += defineCaloLhrPdf("CaloMuonLikelihood.PDF.A2.root"); ### PDFs for barrel region high pT + ServiceMgr.THistSvc.Input += defineCaloLhrPdf("CaloMuonLikelihood.PDF.B0.root"); ### PDFs for transition region low pT + ServiceMgr.THistSvc.Input += defineCaloLhrPdf("CaloMuonLikelihood.PDF.B1.root"); ### PDFs for transition region medium pT + ServiceMgr.THistSvc.Input += defineCaloLhrPdf("CaloMuonLikelihood.PDF.B2.root"); ### PDFs for transition region high pT + ServiceMgr.THistSvc.Input += defineCaloLhrPdf("CaloMuonLikelihood.PDF.C0.root"); ### PDFs for endcap region low pT + ServiceMgr.THistSvc.Input += defineCaloLhrPdf("CaloMuonLikelihood.PDF.C1.root"); ### PDFs for endcap region medium pT + ServiceMgr.THistSvc.Input += defineCaloLhrPdf("CaloMuonLikelihood.PDF.C2.root"); ### PDFs for endcap region high pT ### Configure TrackEnergyInCaloTool ### from CaloTrkMuIdTools.CaloTrkMuIdToolsConf import TrackEnergyInCaloTool as ConfiguredTrackEnergyInCaloTool diff --git a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/src/CaloMuonLikelihoodTool.cxx b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/src/CaloMuonLikelihoodTool.cxx index 4c11a3b878b5ae54003bc5127a2d8454ce9942a3..14dee254bbc46c7d803340505ff377a0ed439328 100644 --- a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/src/CaloMuonLikelihoodTool.cxx +++ b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/src/CaloMuonLikelihoodTool.cxx @@ -282,7 +282,7 @@ StatusCode CaloMuonLikelihoodTool::retrieveHistograms() { /////////////////////////////////////////////////////////////////////////////// // CaloMuonLikelihoodTool::getLHR /////////////////////////////////////////////////////////////////////////////// -double CaloMuonLikelihoodTool::getLHR( const Trk::TrackParameters* trkpar, const double dR_CUT ) const { +double CaloMuonLikelihoodTool::getLHR( const Trk::TrackParameters* trkpar, const xAOD::CaloClusterContainer* ClusContainer, const double dR_CUT ) const { ATH_MSG_DEBUG("in CaloMuonLikelihoodTool::getLHR()"); Trk::ParticleHypothesis particleHypo = Trk::muon; @@ -317,13 +317,16 @@ double CaloMuonLikelihoodTool::getLHR( const Trk::TrackParameters* trkpar, const } - const xAOD::CaloClusterContainer* m_clusCont; - if ( evtStore()->retrieve(m_clusCont, m_caloClusterContainerName).isFailure() ) { - ATH_MSG_WARNING("Could not retrieve CaloClusterContainer with key <" << m_caloClusterContainerName << " >"); - return 0; + const xAOD::CaloClusterContainer* clusCont = ClusContainer; + if(clusCont == nullptr) { + if ( evtStore()->retrieve(clusCont, m_caloClusterContainerName).isFailure() ) { + ATH_MSG_WARNING("Could not retrieve CaloClusterContainer with key <" << m_caloClusterContainerName << " >"); + return 0; + } } + if(clusCont == nullptr) return 0; - double LR = getLHR( m_clusCont, eta_trk, p_trk, eta_trkAtCalo, phi_trkAtCalo, dR_CUT); + double LR = getLHR( clusCont, eta_trk, p_trk, eta_trkAtCalo, phi_trkAtCalo, dR_CUT); return LR; } diff --git a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/src/TrackDepositInCaloTool.cxx b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/src/TrackDepositInCaloTool.cxx index 86eaee0095d7c29487053eab253e3575384e7b3b..52129f3f5b37e48e8c364c7fe41defebd93e0f17 100755 --- a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/src/TrackDepositInCaloTool.cxx +++ b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/src/TrackDepositInCaloTool.cxx @@ -116,7 +116,7 @@ StatusCode TrackDepositInCaloTool::finalize() { /////////////////////////////////////////////////////////////////////////////// // getDeposits /////////////////////////////////////////////////////////////////////////////// -std::vector<DepositInCalo> TrackDepositInCaloTool::getDeposits(const Trk::TrackParameters* par) const { +std::vector<DepositInCalo> TrackDepositInCaloTool::getDeposits(const Trk::TrackParameters* par, const CaloCellContainer* caloCellCont) const { ATH_MSG_DEBUG("In TrackDepositInCaloTool::getDeposits()"); std::vector<DepositInCalo> result; @@ -126,13 +126,18 @@ std::vector<DepositInCalo> TrackDepositInCaloTool::getDeposits(const Trk::TrackP return result; } // --- Get the CaloCellContainer from storegate every event --- - if ( evtStore()->retrieve(m_cellContainer, m_cellContainerName).isFailure() ) { - ATH_MSG_WARNING("Could not retrieve CaloCellContainer, key <" << m_cellContainerName << ">"); - return result; + if(caloCellCont == nullptr) { + if ( evtStore()->retrieve(m_cellContainer, m_cellContainerName).isFailure() ) { + ATH_MSG_WARNING("Could not retrieve CaloCellContainer, key <" << m_cellContainerName << ">"); + return result; + } + if (!m_cellContainer) { + ATH_MSG_WARNING("Cell container retrieved, but pointer is 0."); + return result; + } } - if (!m_cellContainer) { - ATH_MSG_WARNING("Cell container retrieved, but pointer is 0."); - return result; + else { + m_cellContainer = caloCellCont; } const Trk::ParticleHypothesis muonHypo = Trk::muon;