diff --git a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/CMakeLists.txt b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/CMakeLists.txt index b16f7df06698e6a5e44155f65f7d2c2a2b755b99..87a3e18decd3fc3c6a1979a3727adb44dd8662b3 100644 --- a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/CMakeLists.txt +++ b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/CMakeLists.txt @@ -18,6 +18,7 @@ atlas_depends_on_subdirs( PUBLIC Reconstruction/RecoTools/RecoToolInterfaces Tracking/TrkExtrapolation/TrkExInterfaces PRIVATE + Control/AthenaKernel Calorimeter/CaloDetDescr Calorimeter/CaloGeoHelpers Calorimeter/CaloIdentifier @@ -44,5 +45,5 @@ atlas_add_component( CaloTrkMuIdTools # Install files from the package: atlas_install_headers( CaloTrkMuIdTools ) atlas_install_joboptions( share/*.py ) -atlas_install_runtime( share/CaloMuonLikelihood.PDF.A0.root share/CaloMuonLikelihood.PDF.A1.root share/CaloMuonLikelihood.PDF.A2.root share/CaloMuonLikelihood.PDF.B0.root share/CaloMuonLikelihood.PDF.B1.root share/CaloMuonLikelihood.PDF.B2.root share/CaloMuonLikelihood.PDF.C0.root share/CaloMuonLikelihood.PDF.C1.root share/CaloMuonLikelihood.PDF.C2.root ) +atlas_install_runtime( share/CaloMuonLikelihood.PDF.A0.root share/CaloMuonLikelihood.PDF.A1.root share/CaloMuonLikelihood.PDF.A2.root share/CaloMuonLikelihood.PDF.B0.root share/CaloMuonLikelihood.PDF.B1.root share/CaloMuonLikelihood.PDF.B2.root share/CaloMuonLikelihood.PDF.C0.root share/CaloMuonLikelihood.PDF.C1.root share/CaloMuonLikelihood.PDF.C2.root share/CaloTag.LooseCut.root share/CaloTag.TightCut.root) diff --git a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/CaloTrkMuIdTools/CaloMuonLikelihoodTool.h b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/CaloTrkMuIdTools/CaloMuonLikelihoodTool.h index 12baf5ecddd9a2908ef8a22a60de6ba51b8cd50f..6da8c4dacca8f9b5984c58c64ed537d017f59a5a 100644 --- a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/CaloTrkMuIdTools/CaloMuonLikelihoodTool.h +++ b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/CaloTrkMuIdTools/CaloMuonLikelihoodTool.h @@ -46,7 +46,7 @@ private: const TH1F* m_TH1F_bkg[9][11]; std::string m_TH1F_key[9][11]; int m_numKeys[9]; - mutable int cnt_warn; + mutable int m_cnt_warn; std::vector<std::string> m_fileNames; std::string m_caloClusterContainerName; diff --git a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/CaloTrkMuIdTools/CaloMuonTag.h b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/CaloTrkMuIdTools/CaloMuonTag.h index dd5fa066b088cabb4e733edda26ac8591dc2a577..9e3b0a230be8f80e1c75b3097b200bb46167bd49 100755 --- a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/CaloTrkMuIdTools/CaloMuonTag.h +++ b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/CaloTrkMuIdTools/CaloMuonTag.h @@ -10,101 +10,68 @@ #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/MsgStream.h" #include "GaudiKernel/ToolHandle.h" +#include "GaudiKernel/ITHistSvc.h" +#include "GaudiKernel/ToolHandle.h" +class TFile; +class TH2F; class CaloMuonTag : public AthAlgTool, virtual public ICaloMuonTag { - /** @class CaloMuonTag - - Muon Tagger in the ATLAS calorimeter. - - This tagger is used in the CaloTrkMuId framework. After some basic preselection CaloTrkMuIdAlg - feeds a track to the TrackDepositInCaloTool. TrackDepositInCaloTool gathers the deposits that are found near that - track. This tool can tag a muon track from its deposits. - - Applies energy deposition veto cuts in all samplings and noise cuts in the last three layers of the hadronic calorimeter - (Tile and HEC). The following scale factors are applied to correct for the pathlength traversed in the calorimeter cells. - - \f$E_{\rm th} = \frac{E^{\mathrm{barrel}}_{0}}{\sin^2 \theta}\f$ for \f$|\eta|<1.7\f$ - \f$E_{\rm th} = \frac{E^{\rm end-cap}_{0}}{\ (1 - \sin \theta )^2}\f$ for \f$|\eta|>1.7\f$ - - There are three tags, determined by the acceptance: - - 0 not a muon, - - 1 muon in Last Calo Layer, - - 2 muon in Last-1 Calo Layer, - - 3 muon in Last-2 Calo Layer, - - @author Gustavo.Ordonez.Sanz <Gustavo.Ordonez.Sanz@cern.ch> - Marcel Raas <marcelra@cern.ch> (contact person) - */ - typedef std::pair<double, double> Range_t; - - public: - CaloMuonTag(const std::string& type, const std::string& name, const IInterface* pInterface); - virtual ~CaloMuonTag(); - - virtual StatusCode initialize(); - virtual StatusCode finalize(); - - int caloMuonTag(const std::vector<DepositInCalo>& deposits, double eta, double pt) const; //!< Returns the Tag + /** @class CaloMuonTag + + Muon Tagger in the ATLAS calorimeter. + + This tagger is used in the CaloTrkMuId framework. After some basic preselection CaloTrkMuIdAlg + feeds a track to the TrackDepositInCaloTool. TrackDepositInCaloTool gathers the deposits that are found near that + track. This tool can tag a muon track from its deposits. + + Applies energy deposition veto cuts in all samplings and noise cuts in the last three layers of the hadronic calorimeter + (Tile and HEC). The following scale factors are applied to correct for the pathlength traversed in the calorimeter cells. + + \f$E_{\rm th} = \frac{E^{\mathrm{barrel}}_{0}}{\sin^2 \theta}\f$ for \f$|\eta|<1.7\f$ + \f$E_{\rm th} = \frac{E^{\rm end-cap}_{0}}{\ (1 - \sin \theta )^2}\f$ for \f$|\eta|>1.7\f$ + + There are three tags, determined by the acceptance: + + 0 not a muon, + + 1 muon in Last Calo Layer, + + 2 muon in Last-1 Calo Layer, + + 3 muon in Last-2 Calo Layer, + + @author Gustavo.Ordonez.Sanz <Gustavo.Ordonez.Sanz@cern.ch> + Marcel Raas <marcelra@cern.ch> (contact person) + */ + +public: + + CaloMuonTag(const std::string& type, const std::string& name, const IInterface* pInterface); + virtual ~CaloMuonTag(); + virtual StatusCode initialize(); + virtual StatusCode finalize(); + int caloMuonTag(const std::vector<DepositInCalo>& deposits, double eta, double pt) const; //!< Returns the Tag private: - - double interpolate(Range_t cuts, double pt) const; - double m_ptMin; - double m_ptMax; - - Range_t m_emb1Veto; - Range_t m_emb2Veto; - Range_t m_emb3Veto; - - Range_t m_eme1Veto; - Range_t m_eme2Veto; - Range_t m_eme3Veto; - - Range_t m_tileBar0Sig; - Range_t m_tileBar1Sig; - Range_t m_tileBar2Sig; - - Range_t m_tileExt0Sig; - Range_t m_tileExt1Sig; - Range_t m_tileExt2Sig; - - Range_t m_tileBar0Veto; - Range_t m_tileBar1Veto; - Range_t m_tileBar2Veto; - - Range_t m_tileExt0Veto; - Range_t m_tileExt1Veto; - Range_t m_tileExt2Veto; - - Range_t m_tileBar0DiffLow; - Range_t m_tileBar1DiffLow; - Range_t m_tileBar2DiffLow; - - Range_t m_tileExt0DiffLow; - Range_t m_tileExt1DiffLow; - Range_t m_tileExt2DiffLow; - - Range_t m_hec0Veto; - Range_t m_hec1Veto; - Range_t m_hec2Veto; - Range_t m_hec3Veto; - - Range_t m_hec0Sig; - Range_t m_hec1Sig; - Range_t m_hec2Sig; - Range_t m_hec3Sig; - - mutable int m_numTagged; - mutable int m_numRejected; - -}; + double interpolate(std::string cutName, double pt) const; + int getPtBinLow(double pt) const; + int getCutBin(std::string cutName) const; + + TH2F* m_hist; + std::string m_fileNames; + ServiceHandle<ITHistSvc> m_histSvc; + + std::vector < std::string > m_vecCutNames; + std::vector < int > m_vecPtBins; + int m_numCuts; + int m_numPtBins; + + mutable int m_numTagged; + mutable int m_numRejected; + +}; - #endif diff --git a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/CaloTrkMuIdTools/TrackDepositInCaloTool.h b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/CaloTrkMuIdTools/TrackDepositInCaloTool.h index f805997be5fcabd58809e249951c4d0e6a7c013a..619e271f5a53ad4a06be1626388a4c1e83046cc1 100755 --- a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/CaloTrkMuIdTools/TrackDepositInCaloTool.h +++ b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/CaloTrkMuIdTools/TrackDepositInCaloTool.h @@ -189,27 +189,27 @@ class TrackDepositInCaloTool: public AthAlgTool, virtual public ITrackDepositInC //mutable int m_stacks; //!< Counts the number of stacks (diagnoses indefinite recursion). // Histograms - TH1F* hDepositLayer12; - TH1F* hDepositLayer13; - TH1F* hDepositLayer14; + TH1F* m_hDepositLayer12; + TH1F* m_hDepositLayer13; + TH1F* m_hDepositLayer14; - TH2F* hParELossEta; - TH2F* hParELossSample; + TH2F* m_hParELossEta; + TH2F* m_hParELossSample; /////////////////////////////// - TH1F* hDeltaEtaLastPar; - TH1F* hDeltaRadiusLastPar; - TH1F* hDepositsInCore; - TH1F* hDepositsInCone; - TH2F* hDistDepositsTile; - TH2F* hDistDepositsHEC; + TH1F* m_hDeltaEtaLastPar; + TH1F* m_hDeltaRadiusLastPar; + TH1F* m_hDepositsInCore; + TH1F* m_hDepositsInCone; + TH2F* m_hDistDepositsTile; + TH2F* m_hDistDepositsHEC; - TH2F* hEMB1vsdPhi; - TH2F* hEMB2vsdPhi; - TH2F* hEMB3vsdPhi; - TH2F* hEMB1vsdEta; - TH2F* hEMB2vsdEta; - TH2F* hEMB3vsdEta; + TH2F* m_hEMB1vsdPhi; + TH2F* m_hEMB2vsdPhi; + TH2F* m_hEMB3vsdPhi; + TH2F* m_hEMB1vsdEta; + TH2F* m_hEMB2vsdEta; + TH2F* m_hEMB3vsdEta; }; diff --git a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/cmt/requirements b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/cmt/requirements index d3fad32a5f558b2ca1ac95a03d7b12c4e323a114..1c70fc858c074c26a1395ed950c5dfbd55cc30d2 100755 --- a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/cmt/requirements +++ b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/cmt/requirements @@ -18,6 +18,7 @@ use CaloEvent CaloEvent-* Calorimeter use xAODTracking xAODTracking-* Event/xAOD private +use AthenaKernel AthenaKernel-* Control use CaloGeoHelpers CaloGeoHelpers-* Calorimeter use AtlasCLHEP AtlasCLHEP-* External use CaloUtils CaloUtils-* Calorimeter @@ -40,7 +41,7 @@ apply_pattern component_library library CaloTrkMuIdTools *.cxx components/*.cxx apply_pattern declare_joboptions files="*.py" -apply_pattern declare_runtime files="CaloMuonLikelihood.PDF.A0.root CaloMuonLikelihood.PDF.A1.root CaloMuonLikelihood.PDF.A2.root CaloMuonLikelihood.PDF.B0.root CaloMuonLikelihood.PDF.B1.root CaloMuonLikelihood.PDF.B2.root CaloMuonLikelihood.PDF.C0.root CaloMuonLikelihood.PDF.C1.root CaloMuonLikelihood.PDF.C2.root" +apply_pattern declare_runtime files="CaloMuonLikelihood.PDF.A0.root CaloMuonLikelihood.PDF.A1.root CaloMuonLikelihood.PDF.A2.root CaloMuonLikelihood.PDF.B0.root CaloMuonLikelihood.PDF.B1.root CaloMuonLikelihood.PDF.B2.root CaloMuonLikelihood.PDF.C0.root CaloMuonLikelihood.PDF.C1.root CaloMuonLikelihood.PDF.C2.root CaloTag.TightCut.root CaloTag.LooseCut.root" #private #macro cppdebugflags '$(cppdebugflags_s)' diff --git a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/share/CaloMuonTag_Comm_jobOptions.py b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/share/CaloMuonTag_Comm_jobOptions.py deleted file mode 100644 index 45b2f1c98f322d1428b565048cfc5a895393765c..0000000000000000000000000000000000000000 --- a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/share/CaloMuonTag_Comm_jobOptions.py +++ /dev/null @@ -1,37 +0,0 @@ -include.block("CaloTag_Comm_jobOptions.py") - -CaloMuonTagLoose.ptMin = 15000 -CaloMuonTagLoose.ptMax = 35000 -CaloMuonTagLoose.emb1Veto = ( 400, 800 ) -CaloMuonTagLoose.emb2Veto = ( 700, 1400 ) -CaloMuonTagLoose.emb3Veto = ( 500, 600 ) -CaloMuonTagLoose.eme1Veto = ( 1100, 1300 ) -CaloMuonTagLoose.eme2Veto = ( 2200, 2100 ) -CaloMuonTagLoose.eme3Veto = ( 1100, 1100 ) -CaloMuonTagLoose.tileBar0Sig = ( 0, -400 ) -CaloMuonTagLoose.tileBar1Sig = ( 100, -1500 ) -CaloMuonTagLoose.tileBar2Sig = ( 0, -400 ) -CaloMuonTagLoose.tileExt0Sig = ( -50, -500 ) -CaloMuonTagLoose.tileExt1Sig = ( 200, -600 ) -CaloMuonTagLoose.tileExt2Sig = ( 150, -1200 ) -CaloMuonTagLoose.tileBar0Veto = ( 3500, 8000 ) -CaloMuonTagLoose.tileBar1Veto = ( 3500, 8000 ) -CaloMuonTagLoose.tileBar2Veto = ( 3500, 8000 ) -CaloMuonTagLoose.tileExt0Veto = ( 3000, 7000 ) -CaloMuonTagLoose.tileExt1Veto = ( 3500, 9000 ) -CaloMuonTagLoose.tileExt2Veto = ( 3500, 9000 ) -CaloMuonTagLoose.tileBar0DiffLow = (-400, -1100 ) -CaloMuonTagLoose.tileBar1DiffLow = (-650, -1300 ) -CaloMuonTagLoose.tileBar2DiffLow = (-400, -1100 ) -CaloMuonTagLoose.tileExt0DiffLow = (-600, -1100 ) -CaloMuonTagLoose.tileExt1DiffLow = (-600, -1500 ) -CaloMuonTagLoose.tileExt2DiffLow = (-600, -1600 ) -CaloMuonTagLoose.hec0Veto = (2500, 9000 ) -CaloMuonTagLoose.hec1Veto = (3000, 9000 ) -CaloMuonTagLoose.hec2Veto = (3000, 9000 ) -CaloMuonTagLoose.hec3Veto = (3000, 9000 ) -CaloMuonTagLoose.hec0Sig = (-50, -1100 ) -CaloMuonTagLoose.hec1Sig = (-50, -1100 ) -CaloMuonTagLoose.hec2Sig = (0, -1100 ) -CaloMuonTagLoose.hec3Sig = (150, -1100 ) - diff --git a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/share/CaloTag.LooseCut.root b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/share/CaloTag.LooseCut.root new file mode 100644 index 0000000000000000000000000000000000000000..24de2461431a694e227c562feea16693ba285e90 Binary files /dev/null and b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/share/CaloTag.LooseCut.root differ diff --git a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/share/CaloTag.TightCut.root b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/share/CaloTag.TightCut.root new file mode 100644 index 0000000000000000000000000000000000000000..4f0ac1d351ec50cfc053962ea51e0ec9d6688837 Binary files /dev/null and b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/share/CaloTag.TightCut.root differ diff --git a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/share/CaloTrkMuIdTools_jobOptions.py b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/share/CaloTrkMuIdTools_jobOptions.py index 3b8cb7c152b0b2183bb6bd120ea2b1386c206f1d..d3d65efa748f5298f2ffb0545f5952a17136e16d 100755 --- a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/share/CaloTrkMuIdTools_jobOptions.py +++ b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/share/CaloTrkMuIdTools_jobOptions.py @@ -12,6 +12,7 @@ from AthenaCommon.Logging import log ############################################################################### # Finds the root file @rootFileName and creates a one-item list for THistSvc.Input ############################################################################### + def defineCaloLhrPdf(rootFileName, streamName=""): import os from AthenaCommon.Utils.unixtools import FindFile @@ -25,7 +26,12 @@ def defineCaloLhrPdf(rootFileName, streamName=""): else: raise ValueError("in CaloTrkMuIdTools_jobOptions.py: defineCaloLhrPdf(...): rootFileName: " + rootFileName + " is not an expected value (should be CaloMuonLikelihood.PDF.xx.root).") return [streamName + " DATAFILE='" + str(rootFile) + "' TYP='ROOT' OPT='READ'"] - + +def defineCaloTagCut(rootFileName, streamName="CaloTag"): + import os + from AthenaCommon.Utils.unixtools import FindFile + rootFile = FindFile(filename=rootFileName, pathlist=os.environ['DATAPATH'].split(os.pathsep), access=os.R_OK) + return [streamName + " DATAFILE='" + str(rootFile) + "' TYP='ROOT' OPT='READ'"] ############################################################################### ## jobOptions ############################################################################### @@ -74,6 +80,8 @@ if athenaCommonFlags.isOnline == False: 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 + ServiceMgr.THistSvc.Input += defineCaloTagCut("CaloTag.LooseCut.root","CaloTagLoose"); ### Cut definition for CaloTag (Loose) + ServiceMgr.THistSvc.Input += defineCaloTagCut("CaloTag.TightCut.root","CaloTagTight"); ### Cut definition for CaloTag (Tight) ### Configure TrackEnergyInCaloTool ### from CaloTrkMuIdTools.CaloTrkMuIdToolsConf import TrackEnergyInCaloTool as ConfiguredTrackEnergyInCaloTool @@ -89,9 +97,6 @@ ToolSvc += TrackDepositInCaloTool from CaloTrkMuIdTools.CaloTrkMuIdToolsConf import CaloMuonTag as ConfiguredCaloMuonTag CaloMuonTagLoose = ConfiguredCaloMuonTag(name = "CaloMuonTagLoose") ToolSvc += CaloMuonTagLoose - -### Sets loose cuts for CaloMuonTagLoose ### -include("CaloTrkMuIdTools/CaloMuonTag_Comm_jobOptions.py") print CaloMuonTagLoose ### Configure CaloMuonTag (tight is default) ### diff --git a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/src/CaloMuonLikelihoodTool.cxx b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/src/CaloMuonLikelihoodTool.cxx index 14dee254bbc46c7d803340505ff377a0ed439328..d4bcde350eac064379db3a2ae216c4c49962aa2d 100644 --- a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/src/CaloMuonLikelihoodTool.cxx +++ b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/src/CaloMuonLikelihoodTool.cxx @@ -5,7 +5,6 @@ #include "CaloTrkMuIdTools/CaloMuonLikelihoodTool.h" #include "xAODCaloEvent/CaloCluster.h" -#include "CLHEP/Units/SystemOfUnits.h" #include "GaudiKernel/ISvcLocator.h" #include "GaudiKernel/IToolSvc.h" #include "GaudiKernel/ListItem.h" @@ -13,6 +12,7 @@ #include "GaudiKernel/Algorithm.h" #include "PathResolver/PathResolver.h" #include "CaloIdentifier/CaloCell_ID.h" +#include "AthenaKernel/Units.h" ///////////for re_obtain// //#include "GaudiKernel/ITHistSvc.h" @@ -27,6 +27,9 @@ #include <map> +namespace Units = Athena::Units; + + /////////////////////////////////////////////////////////////////////////////// // CaloMuonLikelihoodTool constructor /////////////////////////////////////////////////////////////////////////////// @@ -95,7 +98,7 @@ StatusCode sc; ITHistSvc *tHistSvc; sc = service("THistSvc", tHistSvc); if ( sc.isFailure() ) { - report << MSG::ERROR << "Unable to retrieve pointer to THistSvc" << endreq; + report << MSG::ERROR << "Unable to retrieve pointer to THistSvc" << endmsg; return sc; } @@ -273,7 +276,7 @@ StatusCode CaloMuonLikelihoodTool::retrieveHistograms() { } - cnt_warn = 0; + m_cnt_warn = 0; return StatusCode::SUCCESS; } @@ -460,14 +463,14 @@ double CaloMuonLikelihoodTool::getLHR(const xAOD::CaloClusterContainer* ClusColl << "\n ehec3: " << s[20] << "\n efcal0: " << s[21] << "\n efcal1: " << s[22] - << "\n efcal2: " << s[23] << endreq; + << "\n efcal2: " << s[23] << endmsg; } - // CLHEP::MeV to CLHEP::GeV - for(int i=0;i<24;++i) s[i] /= CLHEP::GeV; - etot_em /= CLHEP::GeV; - etot_hd /= CLHEP::GeV; - etot /= CLHEP::GeV; + // CLHEP::MeV to Units::GeV + for(int i=0;i<24;++i) s[i] /= Units::GeV; + etot_em /= Units::GeV; + etot_hd /= Units::GeV; + etot /= Units::GeV; double tmp_mx(-999), tmp_mxH(-999), tmp_mxE(-999); for (int i=0; i<24; ++i) { @@ -495,7 +498,7 @@ double CaloMuonLikelihoodTool::getLHR(const xAOD::CaloClusterContainer* ClusColl // p_trk in MeV if (p_trk) - EoverEtrk = etot/(p_trk/CLHEP::GeV); + EoverEtrk = etot/(p_trk/Units::GeV); if(etot_em>0) { eemb3_wrtGroup = s[3]/etot_em; @@ -537,7 +540,7 @@ double CaloMuonLikelihoodTool::getLHR(const xAOD::CaloClusterContainer* ClusColl if(fabs(eta_trk)<1.4) { - if(p_trk/CLHEP::GeV<11.) { + if(p_trk/Units::GeV<11.) { m_h_EoverEtrk_11B->Fill(EoverEtrk, 1.); m_h_eemb1_wrtTotal_11B->Fill(eemb1_wrtTotal, 1.); m_h_eemb2_wrtTotal_11B->Fill(eemb2_wrtTotal, 1.); @@ -549,52 +552,52 @@ double CaloMuonLikelihoodTool::getLHR(const xAOD::CaloClusterContainer* ClusColl m_h_mxEM_11B->Fill(mxEM, 1.); m_h_mxFr_11B->Fill(mxFr, 1.); m_h_mxHad_11B->Fill(mxHad, 1.); - report << MSG::DEBUG << "EoverEtrk_11B ="<< EoverEtrk << endreq; - report << MSG::DEBUG << "p_trk/GeV_11B ="<< p_trk/CLHEP::GeV << endreq; - report << MSG::DEBUG << "eta_trk_11B ="<< eta_trk << endreq; + report << MSG::DEBUG << "EoverEtrk_11B ="<< EoverEtrk << endmsg; + report << MSG::DEBUG << "p_trk/GeV_11B ="<< p_trk/Units::GeV << endmsg; + report << MSG::DEBUG << "eta_trk_11B ="<< eta_trk << endmsg; } - else if(p_trk/CLHEP::GeV<51.) { + else if(p_trk/Units::GeV<51.) { m_h_EoverEtrk_51B->Fill(EoverEtrk, 1.); - report << MSG::DEBUG << "EoverEtrk_51B ="<< EoverEtrk << endreq; - report << MSG::DEBUG << "p_trk/GeV_51B ="<< p_trk/CLHEP::GeV << endreq; - report << MSG::DEBUG << "eta_trk_51B ="<< eta_trk << endreq; + report << MSG::DEBUG << "EoverEtrk_51B ="<< EoverEtrk << endmsg; + report << MSG::DEBUG << "p_trk/GeV_51B ="<< p_trk/Units::GeV << endmsg; + report << MSG::DEBUG << "eta_trk_51B ="<< eta_trk << endmsg; } else { m_h_EoverEtrk_101B->Fill(EoverEtrk, 1.); - report << MSG::DEBUG << "EoverEtrk_101B ="<< EoverEtrk << endreq; - report << MSG::DEBUG << "p_trk/GeV_101B ="<< p_trk/CLHEP::GeV << endreq; - report << MSG::DEBUG << "eta_trk_101B ="<< eta_trk << endreq; + report << MSG::DEBUG << "EoverEtrk_101B ="<< EoverEtrk << endmsg; + report << MSG::DEBUG << "p_trk/GeV_101B ="<< p_trk/Units::GeV << endmsg; + report << MSG::DEBUG << "eta_trk_101B ="<< eta_trk << endmsg; } } else if(fabs(eta_trk)>=1.4&&fabs(eta_trk)<=1.6) { - if(p_trk/CLHEP::GeV<11.){ + if(p_trk/Units::GeV<11.){ m_h_EoverEtrk_11C->Fill(EoverEtrk, 1.); m_h_eeme1_wrtTotal_11C->Fill(eeme1_wrtTotal, 1.); m_h_eeme2_wrtTotal_11C->Fill(eeme2_wrtTotal, 1.); m_h_emFr_11C->Fill(emFr, 1.); m_h_mxEM_11C->Fill(mxEM, 1.); m_h_mxHad_11C->Fill(mxHad, 1.); - report << MSG::DEBUG << "EoverEtrk_11C ="<< EoverEtrk << endreq; - report << MSG::DEBUG << "p_trk/GeV_11C ="<< p_trk/CLHEP::GeV << endreq; - report << MSG::DEBUG << "eta_trk_11C ="<< eta_trk << endreq; + report << MSG::DEBUG << "EoverEtrk_11C ="<< EoverEtrk << endmsg; + report << MSG::DEBUG << "p_trk/GeV_11C ="<< p_trk/Units::GeV << endmsg; + report << MSG::DEBUG << "eta_trk_11C ="<< eta_trk << endmsg; } - else if(p_trk/CLHEP::GeV<51.){ + else if(p_trk/Units::GeV<51.){ m_h_EoverEtrk_51C->Fill(EoverEtrk, 1.); - report << MSG::DEBUG << "EoverEtrk_51C ="<< EoverEtrk << endreq; - report << MSG::DEBUG << "p_trk/GeV_51C ="<< p_trk/CLHEP::GeV << endreq; - report << MSG::DEBUG << "eta_trk_51C ="<< eta_trk << endreq; + report << MSG::DEBUG << "EoverEtrk_51C ="<< EoverEtrk << endmsg; + report << MSG::DEBUG << "p_trk/GeV_51C ="<< p_trk/Units::GeV << endmsg; + report << MSG::DEBUG << "eta_trk_51C ="<< eta_trk << endmsg; } else { m_h_EoverEtrk_101C->Fill(EoverEtrk, 1.); - report << MSG::DEBUG << "EoverEtrk_101C ="<< EoverEtrk << endreq; - report << MSG::DEBUG << "p_trk/GeV_101C ="<< p_trk/CLHEP::GeV << endreq; - report << MSG::DEBUG << "eta_trk_101C ="<< eta_trk << endreq; + report << MSG::DEBUG << "EoverEtrk_101C ="<< EoverEtrk << endmsg; + report << MSG::DEBUG << "p_trk/GeV_101C ="<< p_trk/Units::GeV << endmsg; + report << MSG::DEBUG << "eta_trk_101C ="<< eta_trk << endmsg; } } else if(fabs(eta_trk)>1.6&&fabs(eta_trk)<2.5) { - if(p_trk/CLHEP::GeV<11.){ + if(p_trk/Units::GeV<11.){ m_h_EoverEtrk_11E->Fill(EoverEtrk, 1.); m_h_eeme1_wrtGroup_11E->Fill(eeme1_wrtGroup, 1.); m_h_eeme2_wrtTotal_11E->Fill(eeme2_wrtTotal, 1.); @@ -604,15 +607,15 @@ double CaloMuonLikelihoodTool::getLHR(const xAOD::CaloClusterContainer* ClusColl m_h_mxEM_11E->Fill(mxEM, 1.); m_h_mxFr_11E->Fill(mxFr, 1.); m_h_mxHad_11E->Fill(mxHad, 1.); - report << MSG::DEBUG << "EoverEtrk_11E ="<< EoverEtrk << endreq; - report << MSG::DEBUG << "p_trk/GeV_11E ="<< p_trk/CLHEP::GeV << endreq; - report << MSG::DEBUG << "eta_trk_11E ="<< eta_trk << endreq; + report << MSG::DEBUG << "EoverEtrk_11E ="<< EoverEtrk << endmsg; + report << MSG::DEBUG << "p_trk/GeV_11E ="<< p_trk/Units::GeV << endmsg; + report << MSG::DEBUG << "eta_trk_11E ="<< eta_trk << endmsg; } - else if(p_trk/CLHEP::GeV<51.){ + else if(p_trk/Units::GeV<51.){ m_h_EoverEtrk_51E->Fill(EoverEtrk, 1.); - report << MSG::DEBUG << "EoverEtrk_51E ="<< EoverEtrk << endreq; - report << MSG::DEBUG << "p_trk/GeV_51E ="<< p_trk/CLHEP::GeV << endreq; - report << MSG::DEBUG << "eta_trk_51E ="<< eta_trk << endreq; + report << MSG::DEBUG << "EoverEtrk_51E ="<< EoverEtrk << endmsg; + report << MSG::DEBUG << "p_trk/GeV_51E ="<< p_trk/Units::GeV << endmsg; + report << MSG::DEBUG << "eta_trk_51E ="<< eta_trk << endmsg; } else { m_h_EoverEtrk_101E->Fill(EoverEtrk, 1.); @@ -624,9 +627,9 @@ double CaloMuonLikelihoodTool::getLHR(const xAOD::CaloClusterContainer* ClusColl m_h_mxEM_101E->Fill(mxEM, 1.); m_h_mxFr_101E->Fill(mxFr, 1.); m_h_mxHad_101E->Fill(mxHad, 1.); - report << MSG::DEBUG << "EoverEtrk_101E ="<< EoverEtrk << endreq; - report << MSG::DEBUG << "p_trk/GeV_101E ="<< p_trk/CLHEP::GeV << endreq; - report << MSG::DEBUG << "eta_trk_101E ="<< eta_trk << endreq; + report << MSG::DEBUG << "EoverEtrk_101E ="<< EoverEtrk << endmsg; + report << MSG::DEBUG << "p_trk/GeV_101E ="<< p_trk/Units::GeV << endmsg; + report << MSG::DEBUG << "eta_trk_101E ="<< eta_trk << endmsg; } } ///////////////////filling end////////nesli end///////////////// @@ -638,18 +641,18 @@ double CaloMuonLikelihoodTool::getLHR(const xAOD::CaloClusterContainer* ClusColl int iFile = -1; if(fabs(eta_trk)<1.4) { - if(p_trk/CLHEP::GeV<11.) iFile = 0; - else if(p_trk/CLHEP::GeV<51.) iFile = 1; + if(p_trk/Units::GeV<11.) iFile = 0; + else if(p_trk/Units::GeV<51.) iFile = 1; else iFile = 2; } else if(fabs(eta_trk)>=1.4&&fabs(eta_trk)<=1.6) { - if(p_trk/CLHEP::GeV<11.) iFile = 3; - else if(p_trk/CLHEP::GeV<51.) iFile = 4; + if(p_trk/Units::GeV<11.) iFile = 3; + else if(p_trk/Units::GeV<51.) iFile = 4; else iFile = 5; } else if(fabs(eta_trk)>1.6&&fabs(eta_trk)<2.5) { - if(p_trk/CLHEP::GeV<11.) iFile = 6; - else if(p_trk/CLHEP::GeV<51.) iFile = 7; + if(p_trk/Units::GeV<11.) iFile = 6; + else if(p_trk/Units::GeV<51.) iFile = 7; else iFile = 8; } @@ -683,7 +686,7 @@ double CaloMuonLikelihoodTool::getLHR(const xAOD::CaloClusterContainer* ClusColl if(SbinContent) ProbS *= SbinContent; //else - // report << MSG::DEBUG << " BinContent in m_TH1F_sig is 0 and will not be used! "<<ProbS<<endreq; + // report << MSG::DEBUG << " BinContent in m_TH1F_sig is 0 and will not be used! "<<ProbS<<endmsg; /// nesli /// modified 11.03.08//////// else { ProbS *= 0.0000001; @@ -709,7 +712,7 @@ double CaloMuonLikelihoodTool::getLHR(const xAOD::CaloClusterContainer* ClusColl if(BbinContent) ProbB *= BbinContent; //else - // report << MSG::VERBOSE << " BinContent in m_TH1F_bkg is 0 and will not be used! "<<ProbS<<endreq; + // report << MSG::VERBOSE << " BinContent in m_TH1F_bkg is 0 and will not be used! "<<ProbS<<endmsg; /// nesli///modified 07.03.08////// else { ProbB *= 0.0000001; @@ -723,9 +726,9 @@ double CaloMuonLikelihoodTool::getLHR(const xAOD::CaloClusterContainer* ClusColl ATH_MSG_DEBUG(" Temp ProbB: " << ProbB); } else { - if(cnt_warn<10) { + if(m_cnt_warn<10) { ATH_MSG_WARNING("Histogram variable <" << m_TH1F_key[iFile][i] << "> in file <" << m_fileNames[iFile] << "> is not found in the calculated variable list"); - cnt_warn++; + m_cnt_warn++; } } } diff --git a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/src/CaloMuonTag.cxx b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/src/CaloMuonTag.cxx index 0c82a51d0e0ce863882c29961674f6eae0fe24fa..92ab56a28755dc6c388145a2d91849e91baeea9f 100755 --- a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/src/CaloMuonTag.cxx +++ b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/src/CaloMuonTag.cxx @@ -3,58 +3,31 @@ */ #include "CaloTrkMuIdTools/CaloMuonTag.h" - +#include "GaudiKernel/ISvcLocator.h" +#include "GaudiKernel/IToolSvc.h" +#include "GaudiKernel/ListItem.h" +#include "GaudiKernel/AlgTool.h" +#include "GaudiKernel/Algorithm.h" #include "StoreGate/StoreGateSvc.h" +#include "TFile.h" +#include "TH2F.h" /////////////////////////////////////////////////////////////////////////////// // Constructor /////////////////////////////////////////////////////////////////////////////// -CaloMuonTag::CaloMuonTag( const std::string& type, const std::string& name, const IInterface* pInterface): - AthAlgTool(type, name, pInterface), - m_numTagged(0), - m_numRejected(0) +CaloMuonTag::CaloMuonTag(const std::string& type, const std::string& name, const IInterface* pInterface) : +AthAlgTool(type, name, pInterface), +m_hist(0), +m_histSvc("THistSvc/THistSvc", name), +m_numCuts(0), +m_numPtBins(0), +m_numTagged(0), +m_numRejected(0) { - declareInterface<ICaloMuonTag>(this); - - declareProperty("ptMin", m_ptMin = 15000 ); - declareProperty("ptMax", m_ptMax = 35000 ); - - declareProperty("emb1Veto", m_emb1Veto = Range_t( 200, 600 ) ); - declareProperty("emb2Veto", m_emb2Veto = Range_t( 500, 1000 ) ); - declareProperty("emb3Veto", m_emb3Veto = Range_t( 300, 400 ) ); - declareProperty("eme1Veto", m_eme1Veto = Range_t( 900, 900 ) ); - declareProperty("eme2Veto", m_eme2Veto = Range_t( 1900, 1900 ) ); - declareProperty("eme3Veto", m_eme3Veto = Range_t( 900, 900 ) ); - declareProperty("tileBar0Sig", m_tileBar0Sig = Range_t( 80, -200 ) ); - declareProperty("tileBar1Sig", m_tileBar1Sig = Range_t( 500, -1000 ) ); - declareProperty("tileBar2Sig", m_tileBar2Sig = Range_t( 80, -200 ) ); - declareProperty("tileExt0Sig", m_tileExt0Sig = Range_t( 0, -300 ) ); - declareProperty("tileExt1Sig", m_tileExt1Sig = Range_t( 500, -400 ) ); - declareProperty("tileExt2Sig", m_tileExt2Sig = Range_t( 250, -1000 ) ); - declareProperty("tileBar0Veto", m_tileBar0Veto = Range_t( 2500, 7000 ) ); - declareProperty("tileBar1Veto", m_tileBar1Veto = Range_t( 2500, 7000 ) ); - declareProperty("tileBar2Veto", m_tileBar2Veto = Range_t( 2500, 7000 ) ); - declareProperty("tileExt0Veto", m_tileExt0Veto = Range_t( 2000, 6000 ) ); - declareProperty("tileExt1Veto", m_tileExt1Veto = Range_t( 2500, 8000 ) ); - declareProperty("tileExt2Veto", m_tileExt2Veto = Range_t( 2500, 8000 ) ); - declareProperty("tileBar0DiffLow", m_tileBar0DiffLow = Range_t(-300, -1000 ) ); - declareProperty("tileBar1DiffLow", m_tileBar1DiffLow = Range_t(-550, -1200 ) ); - declareProperty("tileBar2DiffLow", m_tileBar2DiffLow = Range_t(-300, -1000 ) ); - declareProperty("tileExt0DiffLow", m_tileExt0DiffLow = Range_t(-500, -1000 ) ); - declareProperty("tileExt1DiffLow", m_tileExt1DiffLow = Range_t(-500, -1200 ) ); - declareProperty("tileExt2DiffLow", m_tileExt2DiffLow = Range_t(-500, -1500 ) ); - declareProperty("hec0Veto", m_hec0Veto = Range_t(1500, 8000 ) ); - declareProperty("hec1Veto", m_hec1Veto = Range_t(2000, 8000 ) ); - declareProperty("hec2Veto", m_hec2Veto = Range_t(2000, 8000 ) ); - declareProperty("hec3Veto", m_hec3Veto = Range_t(2000, 8000 ) ); - declareProperty("hec0Sig", m_hec0Sig = Range_t(0, -1000 ) ); - declareProperty("hec1Sig", m_hec1Sig = Range_t(0, -1000 ) ); - declareProperty("hec2Sig", m_hec2Sig = Range_t(100, -1000 ) ); - declareProperty("hec3Sig", m_hec3Sig = Range_t(250, -1000 ) ); - + declareInterface<ICaloMuonTag>(this); + declareProperty("RootFileNames", m_fileNames = "/CaloTagTight/"); } - /////////////////////////////////////////////////////////////////////////////// // Destructor /////////////////////////////////////////////////////////////////////////////// @@ -65,51 +38,43 @@ CaloMuonTag::~CaloMuonTag(){} /////////////////////////////////////////////////////////////////////////////// StatusCode CaloMuonTag::initialize() { -/* if (AlgTool::initialize().isFailure()) { - msg(MSG::ERROR) << "AlgTool couldn't be initialized!" << endreq; - return StatusCode::FAILURE; - } */ - - if (msgLvl(MSG::VERBOSE)) { - msg(MSG::VERBOSE) << "Initializing CaloMuonTag " << name() << " with configuration (cutName:lowPtCut,highPtCut):" - << "\nemb1Veto : " << m_emb1Veto.first << ", " << m_emb1Veto.second - << "\nemb2Veto : " << m_emb2Veto.first << ", " << m_emb2Veto.second - << "\nemb3Veto : " << m_emb3Veto.first << ", " << m_emb3Veto.second - << "\neme1Veto : " << m_eme1Veto.first << ", " << m_eme1Veto.second - << "\neme2Veto : " << m_eme2Veto.first << ", " << m_eme2Veto.second - << "\neme3Veto : " << m_eme3Veto.first << ", " << m_eme3Veto.second - << "\ntileBar0Sig : " << m_tileBar0Sig.first << ", " << m_tileBar0Sig.second - << "\ntileBar1Sig : " << m_tileBar1Sig.first << ", " << m_tileBar1Sig.second - << "\ntileBar2Sig : " << m_tileBar2Sig.first << ", " << m_tileBar2Sig.second - << "\ntileExt0Sig : " << m_tileExt0Sig.first << ", " << m_tileExt0Sig.second - << "\ntileExt1Sig : " << m_tileExt1Sig.first << ", " << m_tileExt1Sig.second - << "\ntileExt2Sig : " << m_tileExt2Sig.first << ", " << m_tileExt2Sig.second - << "\ntileBar0Veto : " << m_tileBar0Veto.first << ", " << m_tileBar0Veto.second - << "\ntileBar1Veto : " << m_tileBar1Veto.first << ", " << m_tileBar1Veto.second - << "\ntileBar2Veto : " << m_tileBar2Veto.first << ", " << m_tileBar2Veto.second - << "\ntileExt0Veto : " << m_tileExt0Veto.first << ", " << m_tileExt0Veto.second - << "\ntileExt1Veto : " << m_tileExt1Veto.first << ", " << m_tileExt1Veto.second - << "\ntileExt2Veto : " << m_tileExt2Veto.first << ", " << m_tileExt2Veto.second - << "\ntileBar0DiffLow : " << m_tileBar0DiffLow.first << ", " << m_tileBar0DiffLow.second - << "\ntileBar1DiffLow : " << m_tileBar1DiffLow.first << ", " << m_tileBar1DiffLow.second - << "\ntileBar2DiffLow : " << m_tileBar2DiffLow.first << ", " << m_tileBar2DiffLow.second - << "\ntileExt0DiffLow : " << m_tileExt0DiffLow.first << ", " << m_tileExt0DiffLow.second - << "\ntileExt1DiffLow : " << m_tileExt1DiffLow.first << ", " << m_tileExt1DiffLow.second - << "\ntileExt2DiffLow : " << m_tileExt2DiffLow.first << ", " << m_tileExt2DiffLow.second - << "\nhec0Veto : " << m_hec0Veto.first << ", " << m_hec0Veto.second - << "\nhec1Veto : " << m_hec1Veto.first << ", " << m_hec1Veto.second - << "\nhec2Veto : " << m_hec2Veto.first << ", " << m_hec2Veto.second - << "\nhec3Veto : " << m_hec3Veto.first << ", " << m_hec3Veto.second - << "\nhec0Sig : " << m_hec0Sig.first << ", " << m_hec0Sig.second - << "\nhec1Sig : " << m_hec1Sig.first << ", " << m_hec1Sig.second - << "\nhec2Sig : " << m_hec2Sig.first << ", " << m_hec2Sig.second - << "\nhec3Sig : " << m_hec3Sig.first << ", " << m_hec3Sig.second - << "\nLow pT threshold = " << m_ptMin - << "\nHigh pT threshold = " << m_ptMax << endreq; - } + /* if (AlgTool::initialize().isFailure()) { + msg(MSG::ERROR) << "AlgTool couldn't be initialized!" << endmsg; + return StatusCode::FAILURE; + } */ - ATH_MSG_DEBUG("initialize() successful in " << name()); - return StatusCode::SUCCESS; + // Retrieve histogram + const std::string& fileName = m_fileNames; + TList histList; + if (m_histSvc->getTHists(fileName, histList).isFailure()) { + ATH_MSG_FATAL("Could not retrieve histogram stream" << fileName); + return StatusCode::FAILURE; + } + m_hist = dynamic_cast<TH2F*>(histList.At(0)); + if (!m_hist) { + ATH_MSG_FATAL("Could not retrieve histograms"); + return StatusCode::FAILURE; + } + // Read cut names from histogram + m_numCuts = m_hist->GetYaxis()->GetNbins(); + if (m_numCuts == 0) { + ATH_MSG_FATAL("Histogram number of cuts invalid"); + return StatusCode::FAILURE; + } + for (int i = 0; i <= m_numCuts; i++){ + m_vecCutNames.push_back(m_hist->GetYaxis()->GetBinLabel(i)); + } + // Read pt bins from histogram + m_numPtBins = m_hist->GetXaxis()->GetNbins(); + if (m_numPtBins == 0) { + ATH_MSG_FATAL("Histogram number of pt bins invalid"); + return StatusCode::FAILURE; + } + for (int i = 0; i <= m_numPtBins; i++){ + m_vecPtBins.push_back(atoi(m_hist->GetXaxis()->GetBinLabel(i))); + } + ATH_MSG_DEBUG("initialize() successful in " << name()); + return StatusCode::SUCCESS; } /////////////////////////////////////////////////////////////////////////////// @@ -117,200 +82,216 @@ StatusCode CaloMuonTag::initialize() /////////////////////////////////////////////////////////////////////////////// StatusCode CaloMuonTag::finalize() { - ATH_MSG_INFO("Number of tracks tagged : " << m_numTagged); - ATH_MSG_INFO("Number of tracks rejected : " << m_numRejected); - - ATH_MSG_DEBUG("finalize() successful in " << name()); - return StatusCode::SUCCESS; + ATH_MSG_INFO("Number of tracks tagged : " << m_numTagged); + ATH_MSG_INFO("Number of tracks rejected : " << m_numRejected); + ATH_MSG_DEBUG("finalize() successful in " << name()); + return StatusCode::SUCCESS; } /////////////////////////////////////////////////////////////////////////////// // caloMuonTag /////////////////////////////////////////////////////////////////////////////// -int CaloMuonTag::caloMuonTag(const std::vector<DepositInCalo>& deposits, double /*eta*/, double pt) const +int CaloMuonTag::caloMuonTag(const std::vector<DepositInCalo>& deposits, double /*eta*/, double pt) const { - std::vector<DepositInCalo>::const_iterator it = deposits.begin(); - int numVetoesTriggered = 0; - int tag = 4; - for (;it!=deposits.end(); it++) { - CaloCell_ID::CaloSample sample = it->subCaloId(); - double dep = it->energyDeposited(); - double eLoss = it->muonEnergyLoss(); - double diff = dep - eLoss; -// -// don't use the difference between measured and expected energy per layer -// - diff = 0.; - - if (sample==CaloCell_ID::EMB1) { - if (dep>interpolate(m_emb1Veto, pt)) { - numVetoesTriggered++; - } - } - if (sample==CaloCell_ID::EMB2) { - if (dep>interpolate(m_emb2Veto, pt)) { - numVetoesTriggered++; - } - } - if (sample==CaloCell_ID::EMB3) { - if (dep>interpolate(m_emb3Veto, pt)) { - numVetoesTriggered++; - } - } - - if (sample==CaloCell_ID::EME1) { - if (dep>interpolate(m_eme1Veto, pt)) { - numVetoesTriggered++; - } - } - if (sample==CaloCell_ID::EME2) { - if (dep>interpolate(m_eme2Veto, pt)) { - numVetoesTriggered++; - } - } - if (sample==CaloCell_ID::EME3) { - if (dep>interpolate(m_eme3Veto, pt)) { - numVetoesTriggered++; - } - } + std::vector<DepositInCalo>::const_iterator it = deposits.begin(); + int numVetoesTriggered = 0; + int tag = 4; + for (; it != deposits.end(); it++) { + CaloCell_ID::CaloSample sample = it->subCaloId(); + double dep = it->energyDeposited(); + double eLoss = it->muonEnergyLoss(); + double diff = dep - eLoss; - if (sample==CaloCell_ID::TileBar0) { - if (tag>3) tag = 3; - if (dep<interpolate(m_tileBar0Sig, pt)) { - numVetoesTriggered++; - } - if (dep>interpolate(m_tileBar0Veto, pt)) { - numVetoesTriggered++; - } - if (diff<interpolate(m_tileBar0DiffLow, pt)) { - numVetoesTriggered++; - } - } - if (sample==CaloCell_ID::TileBar1) { - if (tag>2) tag = 2; - if (dep<interpolate(m_tileBar1Sig, pt)) { - numVetoesTriggered++; - } - if (dep>interpolate(m_tileBar1Veto, pt)) { - numVetoesTriggered++; - } - if (diff<interpolate(m_tileBar1DiffLow, pt)) { - numVetoesTriggered++; - } - } - if (sample==CaloCell_ID::TileBar2) { - if (tag>1) tag = 1; - if (dep<interpolate(m_tileBar2Sig, pt)) { - numVetoesTriggered++; - } - if (dep>interpolate(m_tileBar2Veto, pt)) { - numVetoesTriggered++; - } - if (diff<interpolate(m_tileBar2DiffLow, pt)) { - numVetoesTriggered++; - } - } + if (sample == CaloCell_ID::EMB1) { + if (dep > interpolate("emb1Veto", pt)) { + numVetoesTriggered++; + } + } + if (sample == CaloCell_ID::EMB2) { + if (dep > interpolate("emb2Veto", pt)) { + numVetoesTriggered++; + } + } + if (sample == CaloCell_ID::EMB3) { + if (dep > interpolate("emb3Veto", pt)) { + numVetoesTriggered++; + } + } + if (sample == CaloCell_ID::EME1) { + if (dep > interpolate("eme1Veto", pt)) { + numVetoesTriggered++; + } + } + if (sample == CaloCell_ID::EME2) { + if (dep > interpolate("eme2Veto", pt)) { + numVetoesTriggered++; + } + } + if (sample == CaloCell_ID::EME3) { + if (dep > interpolate("eme3Veto", pt)) { + numVetoesTriggered++; + } + } + if (sample == CaloCell_ID::TileBar0) { + if (tag > 3) tag = 3; + if (dep < interpolate("tileBar0Sig", pt)) { + numVetoesTriggered++; + } + if (dep > interpolate("tileBar0Veto", pt)) { + numVetoesTriggered++; + } + if (diff < interpolate("tileBar0DiffLow", pt)) { + numVetoesTriggered++; + } + } + if (sample == CaloCell_ID::TileBar1) { + if (tag > 2) tag = 2; + if (dep < interpolate("tileBar1Sig", pt)) { + numVetoesTriggered++; + } + if (dep > interpolate("tileBar1Veto", pt)) { + numVetoesTriggered++; + } + if (diff < interpolate("tileBar1DiffLow", pt)) { + numVetoesTriggered++; + } + } + if (sample == CaloCell_ID::TileBar2) { + if (tag > 1) tag = 1; + if (dep < interpolate("tileBar2Sig", pt)) { + numVetoesTriggered++; + } + if (dep > interpolate("tileBar2Veto", pt)) { + numVetoesTriggered++; + } + if (diff < interpolate("tileBar2DiffLow", pt)) { + numVetoesTriggered++; + } + } + if (sample == CaloCell_ID::TileExt0) { + if (tag > 3) tag = 3; + if (dep < interpolate("tileExt0Sig", pt)) { + numVetoesTriggered++; + } + if (diff < interpolate("tileExt0DiffLow", pt)) { + numVetoesTriggered++; + } + if (dep > interpolate("tileExt0Veto", pt)) { + numVetoesTriggered++; + } + } + if (sample == CaloCell_ID::TileExt1) { + if (tag > 2) tag = 2; + if (dep < interpolate("tileExt1Sig", pt)) { + numVetoesTriggered++; + } + if (diff < interpolate("tileExt1DiffLow", pt)) { + numVetoesTriggered++; + } + if (dep > interpolate("tileExt1Veto", pt)) { + numVetoesTriggered++; + } + } + if (sample == CaloCell_ID::TileExt2) { + if (tag > 1) tag = 1; + if (dep < interpolate("tileExt2Sig", pt)) { + numVetoesTriggered++; + } + if (diff < interpolate("tileExt2DiffLow", pt)) { + numVetoesTriggered++; + } + if (dep > interpolate("tileExt2Veto", pt)) { + numVetoesTriggered++; + } + } + if (sample == CaloCell_ID::HEC0) { + if (dep > interpolate("hec0Veto", pt)) { + numVetoesTriggered++; + } + if (dep < interpolate("hec0Sig", pt)) { + numVetoesTriggered++; + } + } + if (sample == CaloCell_ID::HEC1) { + if (tag > 3) tag = 3; + if (dep > interpolate("hec1Veto", pt)) { + numVetoesTriggered++; + } + if (dep < interpolate("hec1Sig", pt)) { + numVetoesTriggered++; + } + } + if (sample == CaloCell_ID::HEC2) { + if (tag > 2) tag = 2; + if (dep > interpolate("hec2Veto", pt)) { + numVetoesTriggered++; + } + if (dep < interpolate("hec2Sig", pt)) { + numVetoesTriggered++; + } + } + if (sample == CaloCell_ID::HEC3) { + if (tag > 1) tag = 1; + if (dep > interpolate("hec3Veto", pt)) { + numVetoesTriggered++; + } + if (dep < interpolate("hec3Sig", pt)) { + numVetoesTriggered++; + } + } + if (numVetoesTriggered >= 1) { + m_numRejected++; + return 0; + } + } + if (tag < 3) m_numTagged++; + else if (tag == 4) return 0; + return tag; +} - if (sample==CaloCell_ID::TileExt0) { - if (tag>3) tag = 3; - if (dep<interpolate(m_tileExt0Sig, pt)) { - numVetoesTriggered++; - } - if (diff<interpolate(m_tileExt0DiffLow, pt)) { - numVetoesTriggered++; - } - if (dep>interpolate(m_tileExt0Veto, pt)) { - numVetoesTriggered++; - } - } - if (sample==CaloCell_ID::TileExt1) { - if (tag>2) tag = 2; - if (dep<interpolate(m_tileExt1Sig, pt)) { - numVetoesTriggered++; - } - if (diff<interpolate(m_tileExt1DiffLow, pt)) { - numVetoesTriggered++; - } - if (dep>interpolate(m_tileExt1Veto, pt)) { - numVetoesTriggered++; - } - } - if (sample==CaloCell_ID::TileExt2) { - if (tag>1) tag = 1; - if (dep<interpolate(m_tileExt2Sig, pt)) { - numVetoesTriggered++; - } - if (diff<interpolate(m_tileExt2DiffLow, pt)) { - numVetoesTriggered++; - } - if (dep>interpolate(m_tileExt2Veto, pt)) { - numVetoesTriggered++; - } - } +/////////////////////////////////////////////////////////////////////////////// +// interpolate +/////////////////////////////////////////////////////////////////////////////// +double CaloMuonTag::interpolate(std::string cutName, double pt) const { + double ptLow = 0, ptUp = 0, cutLow = 0, cutUp = 0, cutReturn = 0; + // MeV-->GeV + pt = pt / 1000; + int ptBin = getPtBinLow(pt); + int cutBin = getCutBin(cutName); + if (ptBin == 0 || ptBin > m_numPtBins || cutBin == 0 || cutBin > m_numCuts) + ATH_MSG_WARNING("Bin out of bound"); - if (sample==CaloCell_ID::HEC0) { - if (dep>interpolate(m_hec0Veto, pt)) { - numVetoesTriggered++; - } - if (dep<interpolate(m_hec0Sig, pt)) { - numVetoesTriggered++; - } - } - if (sample==CaloCell_ID::HEC1) { - if (tag>3) tag = 3; - if (dep>interpolate(m_hec1Veto, pt)) { - numVetoesTriggered++; - } - if (dep<interpolate(m_hec1Sig, pt)) { - numVetoesTriggered++; - } - } - if (sample==CaloCell_ID::HEC2) { - if (tag>2) tag = 2; - if (dep>interpolate(m_hec2Veto, pt)) { - numVetoesTriggered++; - } - if (dep<interpolate(m_hec2Sig, pt)) { - numVetoesTriggered++; - } - } - if (sample==CaloCell_ID::HEC3) { - if (tag>1) tag = 1; - if (dep>interpolate(m_hec3Veto, pt)) { - numVetoesTriggered++; - } - if (dep<interpolate(m_hec3Sig, pt)) { - numVetoesTriggered++; - } - } + // Get lowest pt bin + if (ptBin < 1) cutReturn = m_hist->GetBinContent(1, cutBin); + // Get highest pt bin + else if (ptBin == m_numPtBins) cutReturn = m_hist->GetBinContent(m_numPtBins, cutBin); + // Interpolate between bins + else { + ptUp = m_vecPtBins[ptBin + 1]; + ptLow = m_vecPtBins[ptBin]; + cutUp = m_hist->GetBinContent(ptBin + 1, cutBin); + cutLow = m_hist->GetBinContent(ptBin, cutBin); + cutReturn = cutLow + (cutUp - cutLow) * (pt - ptLow) / (ptUp - ptLow); + } - if (numVetoesTriggered>=1) { - m_numRejected++; - return 0; - } + return cutReturn; +} - } - - if (tag<3) { - m_numTagged++; - } - else if (tag==4){ - return 0; - } - - return tag; +int CaloMuonTag::getPtBinLow(double pt) const { + // Return the bin of lower pt + for (int i = 0; i <= m_numPtBins; i++){ + if (pt < m_vecPtBins[i]) return (i - 1); + } + return m_numPtBins; } -/////////////////////////////////////////////////////////////////////////////// -// interpolate -/////////////////////////////////////////////////////////////////////////////// -double CaloMuonTag::interpolate(Range_t cuts, double pt) const { - if (pt<m_ptMin) { - return cuts.first; - } - if (pt>m_ptMax) { - return cuts.second; - } - return cuts.first + (cuts.second-cuts.first)*(pt - m_ptMin)/(m_ptMax-m_ptMin); +int CaloMuonTag::getCutBin(std::string cutName) const { + for (int i = 0; i <= m_numCuts; i++){ + if (cutName == m_vecCutNames[i]) return i; + } + return 0; } + + + diff --git a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/src/TrackDepositInCaloTool.cxx b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/src/TrackDepositInCaloTool.cxx index ee38acfd3ef20fc311324373b8d43a7ef1b4b6e4..b3b3fecbe4129f1291fa363e402a05f749b48733 100755 --- a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/src/TrackDepositInCaloTool.cxx +++ b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/src/TrackDepositInCaloTool.cxx @@ -271,10 +271,14 @@ std::vector<DepositInCalo> TrackDepositInCaloTool::getDeposits(const xAOD::Track const Trk::CaloExtension& caloExtension = association->caloExtension(); +#if 0 + // This test can never be true for standard-compliant code + // and is elided by compilers. if(!(&caloExtension)) { ATH_MSG_WARNING( " No caloExtension found "); return result; } +#endif if(!caloExtension.caloEntryLayerIntersection()) { ATH_MSG_WARNING( " No caloEntryLayerIntersection found "); @@ -871,8 +875,8 @@ std::vector<DepositInCalo> TrackDepositInCaloTool::deposits(const Trk::TrackPara ATH_MSG_INFO("Sample: " << sample << "\tEnergyDeposit: " << energyDeposit << "\tEnergyLoss: " << energyLoss); if (m_doHist) { - hParELossEta->Fill(energyLoss, itP->eta() ); - hParELossSample->Fill(energyLoss, sample ); + m_hParELossEta->Fill(energyLoss, itP->eta() ); + m_hParELossSample->Fill(energyLoss, sample ); } itP++; @@ -1048,8 +1052,8 @@ StatusCode TrackDepositInCaloTool::getTraversedLayers(const Trk::TrackParameters double deltaR_solLast = fabs( parAtSolenoid->position().perp() - par->position().perp() ); double deltaEta_solLast = fabs( parAtSolenoid->position().eta() - par->position().eta() ); if (m_doHist) { - hDeltaEtaLastPar->Fill(deltaEta_solLast); - hDeltaRadiusLastPar->Fill(deltaR_solLast); + m_hDeltaEtaLastPar->Fill(deltaEta_solLast); + m_hDeltaRadiusLastPar->Fill(deltaR_solLast); } const Amg::Vector3D positionAtSolenoid = parAtSolenoid->position(); @@ -1306,44 +1310,44 @@ StatusCode TrackDepositInCaloTool::bookHistos() { ATH_MSG_DEBUG("Booking the ROOT Histos"); StatusCode sc; - hDepositLayer12 = new TH1F("hDepositLayer12", "hDepositLayer12", 40, 0, 4000); - hDepositLayer13 = new TH1F("hDepositLayer13", "hDepositLayer13", 40, 0, 4000); - hDepositLayer14 = new TH1F("hDepositLayer14", "hDepositLayer14", 40, 0, 4000); - hParELossEta = new TH2F("hParELossEta", "Parametrized eLoss vs eta", 40, 0, 4000, 30, -3, 3); - hParELossSample = new TH2F("hParELossSample", "Parametrized eLoss vs sample", 40, 0, 4000, 21, 0, 21); - hDeltaEtaLastPar = new TH1F("hDeltaEtaLastPar", "hDeltaEtaLastPar", 50, -2, 2); - hDeltaRadiusLastPar = new TH1F("hDeltaRadiusLastPar", "hDeltaRadiusLastPar", 50, 0, 5000); - hDepositsInCore = new TH1F("hDepositsInCore", "hDepositsInCore", 50, 0, 5000); - hDepositsInCone = new TH1F("hDepositsInCone", "hDepositsInCone", 50, 0, 5000); - hDistDepositsTile = new TH2F("hDistDepositsTile", "hDistDepositsTile", 30, 0.0, 0.3, 30, 0, 4000); - hDistDepositsHEC = new TH2F("hDistDepositsHEC", "hDistDepositsHEC", 30, 0.0, 0.3, 30, 0, 4000); + m_hDepositLayer12 = new TH1F("hDepositLayer12", "hDepositLayer12", 40, 0, 4000); + m_hDepositLayer13 = new TH1F("hDepositLayer13", "hDepositLayer13", 40, 0, 4000); + m_hDepositLayer14 = new TH1F("hDepositLayer14", "hDepositLayer14", 40, 0, 4000); + m_hParELossEta = new TH2F("hParELossEta", "Parametrized eLoss vs eta", 40, 0, 4000, 30, -3, 3); + m_hParELossSample = new TH2F("hParELossSample", "Parametrized eLoss vs sample", 40, 0, 4000, 21, 0, 21); + m_hDeltaEtaLastPar = new TH1F("hDeltaEtaLastPar", "hDeltaEtaLastPar", 50, -2, 2); + m_hDeltaRadiusLastPar = new TH1F("hDeltaRadiusLastPar", "hDeltaRadiusLastPar", 50, 0, 5000); + m_hDepositsInCore = new TH1F("hDepositsInCore", "hDepositsInCore", 50, 0, 5000); + m_hDepositsInCone = new TH1F("hDepositsInCone", "hDepositsInCone", 50, 0, 5000); + m_hDistDepositsTile = new TH2F("hDistDepositsTile", "hDistDepositsTile", 30, 0.0, 0.3, 30, 0, 4000); + m_hDistDepositsHEC = new TH2F("hDistDepositsHEC", "hDistDepositsHEC", 30, 0.0, 0.3, 30, 0, 4000); - hEMB1vsdPhi = new TH2F("hEMB1vsdPhi", "hEMB1vsdPhi", 50, -3.14, 3.14, 50, 0, 500); - hEMB2vsdPhi = new TH2F("hEMB2vsdPhi", "hEMB2vsdPhi", 50, -3.14, 3.14, 50, 0, 500); - hEMB3vsdPhi = new TH2F("hEMB3vsdPhi", "hEMB3vsdPhi", 50, -3.14, 3.14, 50, 0, 500); - hEMB1vsdEta = new TH2F("hEMB1vsdEta", "hEMB1vsdEta", 50, -3.14, 3.14, 50, 0, 500); - hEMB2vsdEta = new TH2F("hEMB2vsdEta", "hEMB2vsdEta", 50, -3.14, 3.14, 50, 0, 500); - hEMB3vsdEta = new TH2F("hEMB3vsdEta", "hEMB3vsdEta", 50, -3.14, 3.14, 50, 0, 500); + m_hEMB1vsdPhi = new TH2F("hEMB1vsdPhi", "hEMB1vsdPhi", 50, -3.14, 3.14, 50, 0, 500); + m_hEMB2vsdPhi = new TH2F("hEMB2vsdPhi", "hEMB2vsdPhi", 50, -3.14, 3.14, 50, 0, 500); + m_hEMB3vsdPhi = new TH2F("hEMB3vsdPhi", "hEMB3vsdPhi", 50, -3.14, 3.14, 50, 0, 500); + m_hEMB1vsdEta = new TH2F("hEMB1vsdEta", "hEMB1vsdEta", 50, -3.14, 3.14, 50, 0, 500); + m_hEMB2vsdEta = new TH2F("hEMB2vsdEta", "hEMB2vsdEta", 50, -3.14, 3.14, 50, 0, 500); + m_hEMB3vsdEta = new TH2F("hEMB3vsdEta", "hEMB3vsdEta", 50, -3.14, 3.14, 50, 0, 500); if (m_histSvc) { - sc = m_histSvc->regHist("/AANT/CaloTrkMuId/hDepositLayer12", hDepositLayer12); - sc = m_histSvc->regHist("/AANT/CaloTrkMuId/hDepositLayer13", hDepositLayer13); - sc = m_histSvc->regHist("/AANT/CaloTrkMuId/hDepositLayer14", hDepositLayer14); - sc = m_histSvc->regHist("/AANT/CaloTrkMuId/hParELossSample", hParELossSample); - sc = m_histSvc->regHist("/AANT/CaloTrkMuId/hParELossEta", hParELossEta); - sc = m_histSvc->regHist("/AANT/DetStore/hDeltaEtaLastPar", hDeltaEtaLastPar); - sc = m_histSvc->regHist("/AANT/DetStore/hDeltaRadiusLastPar", hDeltaRadiusLastPar); - sc = m_histSvc->regHist("/AANT/DetStore/hDepositsInCore", hDepositsInCore); - sc = m_histSvc->regHist("/AANT/DetStore/hDepositsInCone", hDepositsInCone); - sc = m_histSvc->regHist("/AANT/DetStore/hDistDepositsTile", hDistDepositsTile); - sc = m_histSvc->regHist("/AANT/DetStore/hDistDepositsHEC", hDistDepositsHEC); + sc = m_histSvc->regHist("/AANT/CaloTrkMuId/hDepositLayer12", m_hDepositLayer12); + sc = m_histSvc->regHist("/AANT/CaloTrkMuId/hDepositLayer13", m_hDepositLayer13); + sc = m_histSvc->regHist("/AANT/CaloTrkMuId/hDepositLayer14", m_hDepositLayer14); + sc = m_histSvc->regHist("/AANT/CaloTrkMuId/hParELossSample", m_hParELossSample); + sc = m_histSvc->regHist("/AANT/CaloTrkMuId/hParELossEta", m_hParELossEta); + sc = m_histSvc->regHist("/AANT/DetStore/hDeltaEtaLastPar", m_hDeltaEtaLastPar); + sc = m_histSvc->regHist("/AANT/DetStore/hDeltaRadiusLastPar", m_hDeltaRadiusLastPar); + sc = m_histSvc->regHist("/AANT/DetStore/hDepositsInCore", m_hDepositsInCore); + sc = m_histSvc->regHist("/AANT/DetStore/hDepositsInCone", m_hDepositsInCone); + sc = m_histSvc->regHist("/AANT/DetStore/hDistDepositsTile", m_hDistDepositsTile); + sc = m_histSvc->regHist("/AANT/DetStore/hDistDepositsHEC", m_hDistDepositsHEC); - sc = m_histSvc->regHist("/AANT/DetStore/hEMB1vsdPhi", hEMB1vsdPhi); - sc = m_histSvc->regHist("/AANT/DetStore/hEMB2vsdPhi", hEMB2vsdPhi); - sc = m_histSvc->regHist("/AANT/DetStore/hEMB3vsdPhi", hEMB3vsdPhi); - sc = m_histSvc->regHist("/AANT/DetStore/hEMB1vsdEta", hEMB1vsdEta); - sc = m_histSvc->regHist("/AANT/DetStore/hEMB2vsdEta", hEMB2vsdEta); - sc = m_histSvc->regHist("/AANT/DetStore/hEMB3vsdEta", hEMB3vsdEta); + sc = m_histSvc->regHist("/AANT/DetStore/hEMB1vsdPhi", m_hEMB1vsdPhi); + sc = m_histSvc->regHist("/AANT/DetStore/hEMB2vsdPhi", m_hEMB2vsdPhi); + sc = m_histSvc->regHist("/AANT/DetStore/hEMB3vsdPhi", m_hEMB3vsdPhi); + sc = m_histSvc->regHist("/AANT/DetStore/hEMB1vsdEta", m_hEMB1vsdEta); + sc = m_histSvc->regHist("/AANT/DetStore/hEMB2vsdEta", m_hEMB2vsdEta); + sc = m_histSvc->regHist("/AANT/DetStore/hEMB3vsdEta", m_hEMB3vsdEta); } else { return StatusCode::FAILURE;