From d479f58a8f00e7e331c50745f2fe56b3c2f3f7ad Mon Sep 17 00:00:00 2001 From: Masato Aoki <masato.aoki@cern.ch> Date: Tue, 30 Mar 2021 06:03:29 +0000 Subject: [PATCH] Add more histograms to TGC offline DQ --- .../python/TgcRawDataMonitorAlgorithm.py | 88 +- .../src/TgcRawDataMonitorAlgorithm.cxx | 1600 +++++++++-------- 2 files changed, 910 insertions(+), 778 deletions(-) diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/python/TgcRawDataMonitorAlgorithm.py b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/python/TgcRawDataMonitorAlgorithm.py index c62b6b33079..9d28a5c9875 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/python/TgcRawDataMonitorAlgorithm.py +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/python/TgcRawDataMonitorAlgorithm.py @@ -1,5 +1,5 @@ # -# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration # ''' @@ -87,6 +87,19 @@ def TgcRawDataMonitoringConfig(inputFlags): title='MuonRoI Thr vs BW3Coin;MuonRoI Thresholds;MuonRoI BW3Coin',cutmask='roi_tgc',path=trigPath, xbins=20,xmin=-0.5,xmax=19.5,ybins=2,ymin=-0.5,ymax=1.5) + myGroup.defineHistogram('roi_bw3coinveto;MuonRoI_BW3CoinVeto',title='MuonRoI BW3CoinVeto Flag;BW3CoinVeto Flag;Number of events', + cutmask='roi_tgc',path=trigPath,xbins=2,xmin=-0.5,xmax=1.5) + myGroup.defineHistogram('muon_l1passBW3CoinVeto,muon_eta4gev,muon_phi4gev;MuonRoI_Eff_EtaVsPhi_BW3CoinVeto',title='MuonRoI_Eff_EtaVsPhi_BW3CoinVeto;Offline muon eta; Offline muon phi', + cutmask='muon_l1passThr1',type='TEfficiency',path=trigPath,xbins=100,xmin=-2.5,xmax=2.5,ybins=48,ymin=-math.pi,ymax=math.pi) + myGroup.defineHistogram('muon_l1passBW3CoinVeto,muon_pt_tgc;MuonRoI_Eff_Pt_TGC_BW3CoinVeto',title='MuonRoI_Eff_Pt_TGC_BW3CoinVeto;Offline muon pT [GeV];Efficiency', + cutmask='muon_l1passThr1',type='TEfficiency',path=trigPath,xbins=50,xmin=0,xmax=50) + myGroup.defineHistogram('roi_eta,roi_phi;MuonRoI_EtaVsPhi_BW3CoinVeto',type='TH2F', + title='MuonRoI Eta vs Phi BW3CoinVeto;MuonRoI Eta;MuonRoI Phi',cutmask='roi_bw3coinveto',path=trigPath, + xbins=100,xmin=-2.5,xmax=2.5,ybins=48,ymin=-math.pi,ymax=math.pi) + myGroup.defineHistogram('roi_thr,roi_bw3coinveto;MuonRoI_ThrVsBW3CoinVeto',type='TH2F', + title='MuonRoI Thr vs BW3CoinVeto;MuonRoI Thresholds;MuonRoI BW3CoinVeto',cutmask='roi_tgc',path=trigPath, + xbins=20,xmin=-0.5,xmax=19.5,ybins=2,ymin=-0.5,ymax=1.5) + myGroup.defineHistogram('roi_inncoin;MuonRoI_InnerCoin',title='MuonRoI InnerCoin Flag;InnerCoin Flag;Number of events', cutmask='roi_tgc',path=trigPath,xbins=2,xmin=-0.5,xmax=1.5) myGroup.defineHistogram('muon_l1passInnerCoin,muon_eta4gev,muon_phi4gev;MuonRoI_Eff_EtaVsPhi_InnerCoin',title='MuonRoI_Eff_EtaVsPhi_InnerCoin;Offline muon eta; Offline muon phi', @@ -115,6 +128,10 @@ def TgcRawDataMonitoringConfig(inputFlags): myGroup.defineHistogram('roi_goodmf;MuonRoI_GoodMF',title='MuonRoI GoodMF Flag;GoodMF Flag;Number of events', cutmask='roi_tgc',path=trigPath,xbins=2,xmin=-0.5,xmax=1.5) + myGroup.defineHistogram('muon_l1passGoodMF,muon_eta4gev,muon_phi4gev;MuonRoI_Eff_EtaVsPhi_GoodMF',title='MuonRoI_Eff_EtaVsPhi_GoodMF;Offline muon eta; Offline muon phi', + cutmask='muon_l1passThr1',type='TEfficiency',path=trigPath,xbins=100,xmin=-2.5,xmax=2.5,ybins=48,ymin=-math.pi,ymax=math.pi) + myGroup.defineHistogram('muon_l1passGoodMF,muon_pt_tgc;MuonRoI_Eff_Pt_TGC_GoodMF',title='MuonRoI_Eff_Pt_TGC_GoodMF;Offline muon pT [GeV];Efficiency', + cutmask='muon_l1passThr1',type='TEfficiency',path=trigPath,xbins=50,xmin=0,xmax=50) myGroup.defineHistogram('roi_eta,roi_phi;MuonRoI_EtaVsPhi_GoodMF',type='TH2F', title='MuonRoI Eta vs Phi GoodMF;MuonRoI Eta;MuonRoI Phi',cutmask='roi_goodmf',path=trigPath, xbins=100,xmin=-2.5,xmax=2.5,ybins=48,ymin=-math.pi,ymax=math.pi) @@ -124,6 +141,10 @@ def TgcRawDataMonitoringConfig(inputFlags): myGroup.defineHistogram('roi_badmf;MuonRoI_BadMF',title='MuonRoI BadMF Flag;BadMF Flag;Number of events', cutmask='roi_tgc',path=trigPath,xbins=2,xmin=-0.5,xmax=1.5) + myGroup.defineHistogram('muon_l1passBadMF,muon_eta4gev,muon_phi4gev;MuonRoI_Eff_EtaVsPhi_BadMF',title='MuonRoI_Eff_EtaVsPhi_BadMF;Offline muon eta; Offline muon phi', + cutmask='muon_l1passThr1',type='TEfficiency',path=trigPath,xbins=100,xmin=-2.5,xmax=2.5,ybins=48,ymin=-math.pi,ymax=math.pi) + myGroup.defineHistogram('muon_l1passBadMF,muon_pt_tgc;MuonRoI_Eff_Pt_TGC_BadMF',title='MuonRoI_Eff_Pt_TGC_BadMF;Offline muon pT [GeV];Efficiency', + cutmask='muon_l1passThr1',type='TEfficiency',path=trigPath,xbins=50,xmin=0,xmax=50) myGroup.defineHistogram('roi_eta,roi_phi;MuonRoI_EtaVsPhi_BadMF',type='TH2F', title='MuonRoI Eta vs Phi BadMF;MuonRoI Eta;MuonRoI Phi',cutmask='roi_badmf',path=trigPath, xbins=100,xmin=-2.5,xmax=2.5,ybins=48,ymin=-math.pi,ymax=math.pi) @@ -162,8 +183,43 @@ def TgcRawDataMonitoringConfig(inputFlags): for n in range(1,16): + + myGroup.defineHistogram('roi_eta_wInnCoin;MuonRoI_Eta_wInnCoin_Thr'+str(n),title='MuonRoI Eta wInnCoin Thr'+str(n)+';MuonRoI Eta;Number of events', + cutmask='thrmask'+str(n),path=trigPath,xbins=100,xmin=-2.5,xmax=2.5) + myGroup.defineHistogram('roi_eta_wBW3Coin;MuonRoI_Eta_wBW3Coin_Thr'+str(n),title='MuonRoI Eta wBW3Coin Thr'+str(n)+';MuonRoI Eta;Number of events', + cutmask='thrmask'+str(n),path=trigPath,xbins=100,xmin=-2.5,xmax=2.5) + + myGroup.defineHistogram('roi_eta_wInnCoinVeto;MuonRoI_Eta_wInnCoinVeto_Thr'+str(n),title='MuonRoI Eta wInnCoinVeto Thr'+str(n)+';MuonRoI Eta;Number of events', + cutmask='thrmask'+str(n),path=trigPath,xbins=100,xmin=-2.5,xmax=2.5) + myGroup.defineHistogram('roi_eta_wBW3CoinVeto;MuonRoI_Eta_wBW3CoinVeto_Thr'+str(n),title='MuonRoI Eta wBW3CoinVeto Thr'+str(n)+';MuonRoI Eta;Number of events', + cutmask='thrmask'+str(n),path=trigPath,xbins=100,xmin=-2.5,xmax=2.5) + + myGroup.defineHistogram('roi_phi_wInnCoin;MuonRoI_Phi_wInnCoin_Thr'+str(n),title='MuonRoI Phi wInnCoin Thr'+str(n)+';MuonRoI Phi;Number of events', + cutmask='thrmask'+str(n),path=trigPath,xbins=48,xmin=-math.pi,xmax=math.pi) + myGroup.defineHistogram('roi_phi_wBW3Coin;MuonRoI_Phi_wBW3Coin_Thr'+str(n),title='MuonRoI Phi wBW3Coin Thr'+str(n)+';MuonRoI Phi;Number of events', + cutmask='thrmask'+str(n),path=trigPath,xbins=48,xmin=-math.pi,xmax=math.pi) + + myGroup.defineHistogram('roi_phi_wInnCoinVeto;MuonRoI_Phi_wInnCoinVeto_Thr'+str(n),title='MuonRoI Phi wInnCoinVeto Thr'+str(n)+';MuonRoI Phi;Number of events', + cutmask='thrmask'+str(n),path=trigPath,xbins=48,xmin=-math.pi,xmax=math.pi) + myGroup.defineHistogram('roi_phi_wBW3CoinVeto;MuonRoI_Phi_wBW3CoinVeto_Thr'+str(n),title='MuonRoI Phi wBW3CoinVeto Thr'+str(n)+';MuonRoI Phi;Number of events', + cutmask='thrmask'+str(n),path=trigPath,xbins=48,xmin=-math.pi,xmax=math.pi) + + myGroup.defineHistogram('roi_eta_wInnCoin,roi_phi_wInnCoin;MuonRoI_EtaVsPhi_wInnCoin_Thr'+str(n),title='MuonRoI Eta vs Phi wInnCoin Thr'+str(n)+';MuonRoI Eta;Number of events', + cutmask='thrmask'+str(n),path=trigPath,xbins=100,xmin=-2.5,xmax=2.5,ybins=48,ymin=-math.pi,ymax=math.pi,type='TH2F') + myGroup.defineHistogram('roi_eta_wBW3Coin,roi_phi_wBW3Coin;MuonRoI_EtaVsPhi_wBW3Coin_Thr'+str(n),title='MuonRoI Eta vs Phi wBW3Coin Thr'+str(n)+';MuonRoI Eta;Number of events', + cutmask='thrmask'+str(n),path=trigPath,xbins=100,xmin=-2.5,xmax=2.5,ybins=48,ymin=-math.pi,ymax=math.pi,type='TH2F') + + myGroup.defineHistogram('roi_eta_wInnCoinVeto,roi_phi_wInnCoinVeto;MuonRoI_EtaVsPhi_wInnCoinVeto_Thr'+str(n),title='MuonRoI Eta vs Phi wInnCoinVeto Thr'+str(n)+';MuonRoI Eta;Number of events', + cutmask='thrmask'+str(n),path=trigPath,xbins=100,xmin=-2.5,xmax=2.5,ybins=48,ymin=-math.pi,ymax=math.pi,type='TH2F') + myGroup.defineHistogram('roi_eta_wBW3CoinVeto,roi_phi_wBW3CoinVeto;MuonRoI_EtaVsPhi_wBW3CoinVeto_Thr'+str(n),title='MuonRoI Eta vs Phi wBW3CoinVeto Thr'+str(n)+';MuonRoI Eta;Number of events', + cutmask='thrmask'+str(n),path=trigPath,xbins=100,xmin=-2.5,xmax=2.5,ybins=48,ymin=-math.pi,ymax=math.pi,type='TH2F') + myGroup.defineHistogram('roi_eta;MuonRoI_Eta_Thr'+str(n),title='MuonRoI Eta Thr'+str(n)+';MuonRoI Eta;Number of events', cutmask='thrmask'+str(n),path=trigPath,xbins=100,xmin=-2.5,xmax=2.5) + myGroup.defineHistogram('roi_eta_rpc;MuonRoI_Eta_RPC_Thr'+str(n),title='MuonRoI Eta RPC Thr'+str(n)+';MuonRoI Eta;Number of events', + cutmask='thrmask'+str(n),path=trigPath,xbins=100,xmin=-2.5,xmax=2.5) + myGroup.defineHistogram('roi_eta_tgc;MuonRoI_Eta_TGC_Thr'+str(n),title='MuonRoI Eta TGC Thr'+str(n)+';MuonRoI Eta;Number of events', + cutmask='thrmask'+str(n),path=trigPath,xbins=100,xmin=-2.5,xmax=2.5) myGroup.defineHistogram('roi_phi_rpc;MuonRoI_Phi_RPC_Thr'+str(n),title='MuonRoI Phi RPC Thr'+str(n)+';MuonRoI Phi;Number of events', cutmask='thrmask'+str(n),path=trigPath,xbins=32,xmin=-math.pi,xmax=math.pi) myGroup.defineHistogram('roi_phi_tgc;MuonRoI_Phi_TGC_Thr'+str(n),title='MuonRoI Phi TGC Thr'+str(n)+';MuonRoI Phi;Number of events', @@ -171,6 +227,36 @@ def TgcRawDataMonitoringConfig(inputFlags): myGroup.defineHistogram('roi_eta,roi_phi;MuonRoI_EtaVsPhi_Thr'+str(n),type='TH2F', title='MuonRoI Eta vs Phi Thr'+str(n)+';MuonRoI Eta;MuonRoI Phi',cutmask='thrmask'+str(n),path=trigPath, xbins=100,xmin=-2.5,xmax=2.5,ybins=48,ymin=-math.pi,ymax=math.pi) + + myGroup.defineHistogram('roi_inncoin,roi_eta_tgc;MuonRoI_Eff_Eta_wInnCoin_Thr'+str(n),title='MuonRoI Eff Eta wInnCoin Thr'+str(n)+';MuonRoI Eta;Efficiency', + cutmask='thrmask'+str(n),type='TEfficiency',path=trigPath,xbins=100,xmin=-2.5,xmax=2.5) + myGroup.defineHistogram('roi_inncoin,roi_phi_tgc;MuonRoI_Eff_Phi_wInnCoin_Thr'+str(n),title='MuonRoI Eff Phi wInnCoin Thr'+str(n)+';MuonRoI Eta;Efficiency', + cutmask='thrmask'+str(n),type='TEfficiency',path=trigPath,xbins=48,xmin=-math.pi,xmax=math.pi) + myGroup.defineHistogram('roi_inncoin,roi_eta_tgc,roi_phi_tgc;MuonRoI_Eff_EtaVsPhi_wInnCoin_Thr'+str(n),title='MuonRoI Eff Eta vs Phi wInnCoin Thr'+str(n)+';MuonRoI Eta;Efficiency', + cutmask='thrmask'+str(n),type='TEfficiency',path=trigPath,xbins=100,xmin=-2.5,xmax=2.5,ybins=48,ymin=-math.pi,ymax=math.pi) + + myGroup.defineHistogram('roi_innveto,roi_eta_tgc;MuonRoI_Eff_Eta_wInnCoinVeto_Thr'+str(n),title='MuonRoI Eff Eta wInnCoinVeto Thr'+str(n)+';MuonRoI Eta;Efficiency', + cutmask='thrmask'+str(n),type='TEfficiency',path=trigPath,xbins=100,xmin=-2.5,xmax=2.5) + myGroup.defineHistogram('roi_innveto,roi_phi_tgc;MuonRoI_Eff_Phi_wInnCoinVeto_Thr'+str(n),title='MuonRoI Eff Phi wInnCoinVeto Thr'+str(n)+';MuonRoI Eta;Efficiency', + cutmask='thrmask'+str(n),type='TEfficiency',path=trigPath,xbins=48,xmin=-math.pi,xmax=math.pi) + myGroup.defineHistogram('roi_innveto,roi_eta_tgc,roi_phi_tgc;MuonRoI_Eff_EtaVsPhi_wInnCoinVeto_Thr'+str(n),title='MuonRoI Eff Eta vs Phi wInnCoinVeto Thr'+str(n)+';MuonRoI Eta;Efficiency', + cutmask='thrmask'+str(n),type='TEfficiency',path=trigPath,xbins=100,xmin=-2.5,xmax=2.5,ybins=48,ymin=-math.pi,ymax=math.pi) + + myGroup.defineHistogram('roi_bw3coin,roi_eta_tgc;MuonRoI_Eff_Eta_wBW3Coin_Thr'+str(n),title='MuonRoI Eff Eta wBW3Coin Thr'+str(n)+';MuonRoI Eta;Efficiency', + cutmask='thrmask'+str(n),type='TEfficiency',path=trigPath,xbins=100,xmin=-2.5,xmax=2.5) + myGroup.defineHistogram('roi_bw3coin,roi_phi_tgc;MuonRoI_Eff_Phi_wBW3Coin_Thr'+str(n),title='MuonRoI Eff Phi wBW3Coin Thr'+str(n)+';MuonRoI Eta;Efficiency', + cutmask='thrmask'+str(n),type='TEfficiency',path=trigPath,xbins=48,xmin=-math.pi,xmax=math.pi) + myGroup.defineHistogram('roi_bw3coin,roi_eta_tgc,roi_phi_tgc;MuonRoI_Eff_EtaVsPhi_wBW3Coin_Thr'+str(n),title='MuonRoI Eff Eta vs Phi wBW3Coin Thr'+str(n)+';MuonRoI Eta;Efficiency', + cutmask='thrmask'+str(n),type='TEfficiency',path=trigPath,xbins=100,xmin=-2.5,xmax=2.5,ybins=48,ymin=-math.pi,ymax=math.pi) + + myGroup.defineHistogram('roi_bw3coinveto,roi_eta_tgc;MuonRoI_Eff_Eta_wBW3CoinVeto_Thr'+str(n),title='MuonRoI Eff Eta wBW3CoinVeto Thr'+str(n)+';MuonRoI Eta;Efficiency', + cutmask='thrmask'+str(n),type='TEfficiency',path=trigPath,xbins=100,xmin=-2.5,xmax=2.5) + myGroup.defineHistogram('roi_bw3coinveto,roi_phi_tgc;MuonRoI_Eff_Phi_wBW3CoinVeto_Thr'+str(n),title='MuonRoI Eff Phi wBW3CoinVeto Thr'+str(n)+';MuonRoI Eta;Efficiency', + cutmask='thrmask'+str(n),type='TEfficiency',path=trigPath,xbins=48,xmin=-math.pi,xmax=math.pi) + myGroup.defineHistogram('roi_bw3coinveto,roi_eta_tgc,roi_phi_tgc;MuonRoI_Eff_EtaVsPhi_wBW3CoinVeto_Thr'+str(n),title='MuonRoI Eff Eta vs Phi wBW3CoinVeto Thr'+str(n)+';MuonRoI Eta;Efficiency', + cutmask='thrmask'+str(n),type='TEfficiency',path=trigPath,xbins=100,xmin=-2.5,xmax=2.5,ybins=48,ymin=-math.pi,ymax=math.pi) + + myGroup.defineHistogram('muon_l1passThr'+str(n)+',muon_pt_rpc;MuonRoI_Eff_Pt_RPC_Thr'+str(n),title='MuonRoI_Eff_Pt_RPC_Thr'+str(n)+';Offline muon pT [GeV];Efficiency', type='TEfficiency',path=trigPath,xbins=50,xmin=0,xmax=50) myGroup.defineHistogram('muon_l1passThr'+str(n)+',muon_pt_tgc;MuonRoI_Eff_Pt_TGC_Thr'+str(n),title='MuonRoI_Eff_Pt_TGC_Thr'+str(n)+';Offline muon pT [GeV];Efficiency', diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataMonitorAlgorithm.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataMonitorAlgorithm.cxx index d8c61ba6232..750237aa690 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataMonitorAlgorithm.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataMonitorAlgorithm.cxx @@ -1,860 +1,906 @@ /* - Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration - */ + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration +*/ #include "TgcRawDataMonitorAlgorithm.h" #include "TObjArray.h" namespace { - // Cut values on pt bein exploited throughout the monitoring - constexpr float pt_30_cut = 30. * Gaudi::Units::GeV; - constexpr float pt_15_cut = 15. * Gaudi::Units::GeV; - constexpr float pt_10_cut = 10. * Gaudi::Units::GeV; - constexpr float pt_4_cut = 4. * Gaudi::Units::GeV; + // Cut values on pt bein exploited throughout the monitoring + constexpr float pt_30_cut = 30. * Gaudi::Units::GeV; + constexpr float pt_15_cut = 15. * Gaudi::Units::GeV; + constexpr float pt_10_cut = 10. * Gaudi::Units::GeV; + constexpr float pt_4_cut = 4. * Gaudi::Units::GeV; - /// End of the barrel region - constexpr float barrel_end = 1.05; - constexpr float trigger_end = 2.4; + /// End of the barrel region + constexpr float barrel_end = 1.05; + constexpr float trigger_end = 2.4; } TgcRawDataMonitorAlgorithm::TgcRawDataMonitorAlgorithm(const std::string &name, ISvcLocator *pSvcLocator) : - AthMonitorAlgorithm(name, pSvcLocator) { + AthMonitorAlgorithm(name, pSvcLocator) { } StatusCode TgcRawDataMonitorAlgorithm::initialize() { - ATH_CHECK(AthMonitorAlgorithm::initialize()); - ATH_CHECK(m_idHelperSvc.retrieve()); - ATH_CHECK(m_extrapolator.retrieve()); - ATH_CHECK(m_MuonContainerKey.initialize()); - ATH_CHECK(m_MuonRoIContainerKey.initialize(SG::AllowEmpty)); - ATH_CHECK(m_TgcPrepDataContainerKey.initialize()); - ATH_CHECK(m_TgcCoinDataContainerCurrBCKey.initialize()); - ATH_CHECK(m_TgcCoinDataContainerNextBCKey.initialize()); - ATH_CHECK(m_TgcCoinDataContainerPrevBCKey.initialize()); + ATH_CHECK(AthMonitorAlgorithm::initialize()); + ATH_CHECK(m_idHelperSvc.retrieve()); + ATH_CHECK(m_extrapolator.retrieve()); + ATH_CHECK(m_MuonContainerKey.initialize()); + ATH_CHECK(m_MuonRoIContainerKey.initialize(SG::AllowEmpty)); + ATH_CHECK(m_TgcPrepDataContainerKey.initialize()); + ATH_CHECK(m_TgcCoinDataContainerCurrBCKey.initialize()); + ATH_CHECK(m_TgcCoinDataContainerNextBCKey.initialize()); + ATH_CHECK(m_TgcCoinDataContainerPrevBCKey.initialize()); - m_extZposition.push_back(m_M1_Z.value()); - m_extZposition.push_back(m_M2_Z.value()); - m_extZposition.push_back(m_M3_Z.value()); - m_extZposition.push_back(m_EI_Z.value()); - m_extZposition.push_back(m_FI_Z.value()); - m_extZposition.push_back(-m_M1_Z.value()); - m_extZposition.push_back(-m_M2_Z.value()); - m_extZposition.push_back(-m_M3_Z.value()); - m_extZposition.push_back(-m_EI_Z.value()); - m_extZposition.push_back(-m_FI_Z.value()); + m_extZposition.push_back(m_M1_Z.value()); + m_extZposition.push_back(m_M2_Z.value()); + m_extZposition.push_back(m_M3_Z.value()); + m_extZposition.push_back(m_EI_Z.value()); + m_extZposition.push_back(m_FI_Z.value()); + m_extZposition.push_back(-m_M1_Z.value()); + m_extZposition.push_back(-m_M2_Z.value()); + m_extZposition.push_back(-m_M3_Z.value()); + m_extZposition.push_back(-m_EI_Z.value()); + m_extZposition.push_back(-m_FI_Z.value()); - TObjArray *tagList = TString(m_trigTagList.value()).Tokenize(","); - std::set < TString > alllist; - for (int i = 0; i < tagList->GetEntries(); i++) { - TString tagTrig = tagList->At(i)->GetName(); - if (alllist.find(tagTrig) != alllist.end()) continue; - alllist.insert(tagTrig); - TObjArray *arr = tagTrig.Tokenize(";"); - if (arr->GetEntries() == 0) continue; - TagDef def; - def.eventTrig = TString(arr->At(0)->GetName()); - def.tagTrig = def.eventTrig; - if (arr->GetEntries() == 2) def.tagTrig = TString(arr->At(1)->GetName()); - m_trigTagDefs.push_back(def); - } + TObjArray *tagList = TString(m_trigTagList.value()).Tokenize(","); + std::set < TString > alllist; + for (int i = 0; i < tagList->GetEntries(); i++) { + TString tagTrig = tagList->At(i)->GetName(); + if (alllist.find(tagTrig) != alllist.end()) continue; + alllist.insert(tagTrig); + TObjArray *arr = tagTrig.Tokenize(";"); + if (arr->GetEntries() == 0) continue; + TagDef def; + def.eventTrig = TString(arr->At(0)->GetName()); + def.tagTrig = def.eventTrig; + if (arr->GetEntries() == 2) def.tagTrig = TString(arr->At(1)->GetName()); + m_trigTagDefs.push_back(def); + } - return StatusCode::SUCCESS; + return StatusCode::SUCCESS; } StatusCode TgcRawDataMonitorAlgorithm::fillHistograms(const EventContext &ctx) const { MonVariables variables; - - auto bcid = Monitored::Scalar<int>("bcid", GetEventInfo(ctx)->bcid()); - auto pileup = Monitored::Scalar<int>("pileup", lbAverageInteractionsPerCrossing(ctx)); - auto lumiBlock = Monitored::Scalar<int>("lumiBlock", GetEventInfo(ctx)->lumiBlock()); + auto bcid = Monitored::Scalar<int>("bcid", GetEventInfo(ctx)->bcid()); + auto pileup = Monitored::Scalar<int>("pileup", lbAverageInteractionsPerCrossing(ctx)); + auto lumiBlock = Monitored::Scalar<int>("lumiBlock", GetEventInfo(ctx)->lumiBlock()); - variables.push_back(bcid); - variables.push_back(pileup); - variables.push_back(lumiBlock); + variables.push_back(bcid); + variables.push_back(pileup); + variables.push_back(lumiBlock); - if (!m_anaMuonRoI.value()) { - fill(m_packageName, variables); - variables.clear(); - return StatusCode::SUCCESS; - } - - - const xAOD::MuonRoIContainer *rois = nullptr; - if (!m_MuonRoIContainerKey.empty()) { - /* raw LVL1MuonRoIs distributions */ - SG::ReadHandle<xAOD::MuonRoIContainer > handle( m_MuonRoIContainerKey, ctx); - if(!handle.isValid()) { - ATH_MSG_ERROR("evtStore() does not contain muon RoI Collection with name " << m_MuonRoIContainerKey); - return StatusCode::FAILURE; - } - rois = handle.cptr(); - if (!rois) { - ATH_MSG_ERROR("evtStore() does not contain muon RoI Collection with name " << m_MuonRoIContainerKey); - return StatusCode::FAILURE; - } - - MonVariables roi_variables; - auto roi_bcid = Monitored::Scalar<int>("roi_bcid", GetEventInfo(ctx)->bcid()); - roi_variables.push_back(roi_bcid); - auto roi_pileup = Monitored::Scalar<int>("roi_pileup", lbAverageInteractionsPerCrossing(ctx)); - roi_variables.push_back(roi_pileup); - auto roi_lumiBlock = Monitored::Scalar<int>("roi_lumiBlock", GetEventInfo(ctx)->lumiBlock()); - roi_variables.push_back(roi_lumiBlock); - auto roi_eta = Monitored::Collection("roi_eta", *rois, [](const xAOD::MuonRoI *m) { - return m->eta(); - }); - roi_variables.push_back(roi_eta); - auto roi_phi = Monitored::Collection("roi_phi", *rois, [](const xAOD::MuonRoI *m) { - return m->phi(); - }); - roi_variables.push_back(roi_phi); - auto roi_phi_rpc = Monitored::Collection("roi_phi_rpc", *rois, [](const xAOD::MuonRoI *m) { - return (m->getSource() == xAOD::MuonRoI::Barrel) ? m->phi() : -10; - }); - roi_variables.push_back(roi_phi_rpc); - auto roi_phi_tgc = Monitored::Collection("roi_phi_tgc", *rois, [](const xAOD::MuonRoI *m) { - return (m->getSource() != xAOD::MuonRoI::Barrel) ? m->phi() : -10; - }); - roi_variables.push_back(roi_phi_tgc); - auto roi_thr = Monitored::Collection("roi_thr", *rois, [](const xAOD::MuonRoI *m) { - return m->getThrNumber(); - }); - roi_variables.push_back(roi_thr); - auto roi_rpc = Monitored::Collection("roi_rpc", *rois, [](const xAOD::MuonRoI *m) { - return m->getSource() == xAOD::MuonRoI::Barrel; - }); - roi_variables.push_back(roi_rpc); - auto roi_tgc = Monitored::Collection("roi_tgc", *rois, [](const xAOD::MuonRoI *m) { - return m->getSource() != xAOD::MuonRoI::Barrel; - }); - roi_variables.push_back(roi_tgc); - auto roi_barrel = Monitored::Collection("roi_barrel", *rois, [](const xAOD::MuonRoI *m) { - return m->getSource() == xAOD::MuonRoI::Barrel; - }); - roi_variables.push_back(roi_barrel); - auto roi_endcap = Monitored::Collection("roi_endcap", *rois, [](const xAOD::MuonRoI *m) { - return m->getSource() == xAOD::MuonRoI::Endcap; - }); - roi_variables.push_back(roi_endcap); - auto roi_forward = Monitored::Collection("roi_forward", *rois, [](const xAOD::MuonRoI *m) { - return m->getSource() == xAOD::MuonRoI::Forward; - }); - roi_variables.push_back(roi_forward); - auto roi_phi_barrel = Monitored::Collection("roi_phi_barrel", *rois, [](const xAOD::MuonRoI *m) { - return (m->getSource() == xAOD::MuonRoI::Barrel) ? m->phi() : -10; - }); - roi_variables.push_back(roi_phi_barrel); - auto roi_phi_endcap = Monitored::Collection("roi_phi_endcap", *rois, [](const xAOD::MuonRoI *m) { - return (m->getSource() == xAOD::MuonRoI::Endcap) ? m->phi() : -10; - }); - roi_variables.push_back(roi_phi_endcap); - auto roi_phi_forward = Monitored::Collection("roi_phi_forward", *rois, [](const xAOD::MuonRoI *m) { - return (m->getSource() == xAOD::MuonRoI::Forward) ? m->phi() : -10; - }); - roi_variables.push_back(roi_phi_forward); - auto roi_sideA = Monitored::Collection("roi_sideA", *rois, [](const xAOD::MuonRoI *m) { - return m->getHemisphere() == xAOD::MuonRoI::Positive; - }); - roi_variables.push_back(roi_sideA); - auto roi_sideC = Monitored::Collection("roi_sideC", *rois, [](const xAOD::MuonRoI *m) { - return m->getHemisphere() == xAOD::MuonRoI::Negative; - }); - roi_variables.push_back(roi_sideC); - auto thrmask1 = Monitored::Collection("thrmask1", *rois, [](const xAOD::MuonRoI *m) { - return m->getThrNumber() == 1; - }); - roi_variables.push_back(thrmask1); - auto thrmask2 = Monitored::Collection("thrmask2", *rois, [](const xAOD::MuonRoI *m) { - return m->getThrNumber() == 2; - }); - roi_variables.push_back(thrmask2); - auto thrmask3 = Monitored::Collection("thrmask3", *rois, [](const xAOD::MuonRoI *m) { - return m->getThrNumber() == 3; - }); - roi_variables.push_back(thrmask3); - auto thrmask4 = Monitored::Collection("thrmask4", *rois, [](const xAOD::MuonRoI *m) { - return m->getThrNumber() == 4; - }); - roi_variables.push_back(thrmask4); - auto thrmask5 = Monitored::Collection("thrmask5", *rois, [](const xAOD::MuonRoI *m) { - return m->getThrNumber() == 5; - }); - roi_variables.push_back(thrmask5); - auto thrmask6 = Monitored::Collection("thrmask6", *rois, [](const xAOD::MuonRoI *m) { - return m->getThrNumber() == 6; - }); - roi_variables.push_back(thrmask6); - auto thrmask7 = Monitored::Collection("thrmask7", *rois, [](const xAOD::MuonRoI *m) { - return m->getThrNumber() == 7; - }); - roi_variables.push_back(thrmask7); - auto thrmask8 = Monitored::Collection("thrmask8", *rois, [](const xAOD::MuonRoI *m) { - return m->getThrNumber() == 8; - }); - roi_variables.push_back(thrmask8); - auto thrmask9 = Monitored::Collection("thrmask9", *rois, [](const xAOD::MuonRoI *m) { - return m->getThrNumber() == 9; - }); - roi_variables.push_back(thrmask9); - auto thrmask10 = Monitored::Collection("thrmask10", *rois, [](const xAOD::MuonRoI *m) { - return m->getThrNumber() == 10; - }); - roi_variables.push_back(thrmask10); - auto thrmask11 = Monitored::Collection("thrmask11", *rois, [](const xAOD::MuonRoI *m) { - return m->getThrNumber() == 11; - }); - roi_variables.push_back(thrmask11); - auto thrmask12 = Monitored::Collection("thrmask12", *rois, [](const xAOD::MuonRoI *m) { - return m->getThrNumber() == 12; - }); - roi_variables.push_back(thrmask12); - auto thrmask13 = Monitored::Collection("thrmask13", *rois, [](const xAOD::MuonRoI *m) { - return m->getThrNumber() == 13; - }); - roi_variables.push_back(thrmask13); - auto thrmask14 = Monitored::Collection("thrmask14", *rois, [](const xAOD::MuonRoI *m) { - return m->getThrNumber() == 14; - }); - roi_variables.push_back(thrmask14); - auto thrmask15 = Monitored::Collection("thrmask15", *rois, [](const xAOD::MuonRoI *m) { - return m->getThrNumber() == 15; - }); - roi_variables.push_back(thrmask15); - auto roi_charge = Monitored::Collection("roi_charge", *rois, [](const xAOD::MuonRoI* m) { - return (m->getCharge()==xAOD::MuonRoI::Neg)?(-1):((m->getCharge()==xAOD::MuonRoI::Pos)?(+1):(0)); - }); - roi_variables.push_back(roi_charge); - auto roi_bw3coin = Monitored::Collection("roi_bw3coin",*rois,[](const xAOD::MuonRoI* m) { - return m->getBW3Coincidence(); - }); - roi_variables.push_back(roi_bw3coin); - auto roi_inncoin = Monitored::Collection("roi_inncoin",*rois,[](const xAOD::MuonRoI* m) { - return m->getInnerCoincidence(); - }); - roi_variables.push_back(roi_inncoin); - auto roi_innveto = Monitored::Collection("roi_innveto",*rois,[](const xAOD::MuonRoI* m) { - return !m->getInnerCoincidence() && m->getSource()!=xAOD::MuonRoI::Barrel; - }); - roi_variables.push_back(roi_innveto); - auto roi_goodmf = Monitored::Collection("roi_goodmf",*rois,[](const xAOD::MuonRoI* m) { - return m->getGoodMF(); - }); - roi_variables.push_back(roi_goodmf); - auto roi_badmf = Monitored::Collection("roi_badmf",*rois,[](const xAOD::MuonRoI* m){ - return !m->getGoodMF() && m->getSource()!=xAOD::MuonRoI::Barrel; - }); - roi_variables.push_back(roi_badmf); - auto roi_ismorecand = Monitored::Collection("roi_ismorecand",*rois,[](const xAOD::MuonRoI* m){ - return m->isMoreCandInRoI(); - }); - roi_variables.push_back(roi_ismorecand); - auto roi_posCharge = Monitored::Collection("roi_posCharge",*rois,[](const xAOD::MuonRoI* m){ - return m->getCharge()==xAOD::MuonRoI::Pos; - }); - roi_variables.push_back(roi_posCharge); - auto roi_negCharge = Monitored::Collection("roi_negCharge",*rois,[](const xAOD::MuonRoI* m){ - return m->getCharge()==xAOD::MuonRoI::Neg; - }); - roi_variables.push_back(roi_negCharge); - fill(m_packageName, roi_variables); - } - if (!m_anaOfflMuon.value()) { - fill(m_packageName, variables); - return StatusCode::SUCCESS; + if (!m_anaMuonRoI.value()) { + fill(m_packageName, variables); + variables.clear(); + return StatusCode::SUCCESS; + } + + const xAOD::MuonRoIContainer *rois = nullptr; + if (!m_MuonRoIContainerKey.empty()) { + /* raw LVL1MuonRoIs distributions */ + SG::ReadHandle<xAOD::MuonRoIContainer > handle( m_MuonRoIContainerKey, ctx); + if(!handle.isValid()) { + ATH_MSG_ERROR("evtStore() does not contain muon RoI Collection with name " << m_MuonRoIContainerKey); + return StatusCode::FAILURE; } - - SG::ReadHandle < xAOD::MuonContainer > muons(m_MuonContainerKey, ctx); - if (!muons.isValid()) { - ATH_MSG_ERROR("evtStore() does not contain muon Collection with name " << m_MuonContainerKey); - return StatusCode::FAILURE; + rois = handle.cptr(); + if (!rois) { + ATH_MSG_ERROR("evtStore() does not contain muon RoI Collection with name " << m_MuonRoIContainerKey); + return StatusCode::FAILURE; } - std::vector < MyMuon > mymuons; - for (const auto muon : *muons) { - if (muon->muonType() != xAOD::Muon::Combined) continue; - if (muon->author() != xAOD::Muon::MuidCo && muon->author() != xAOD::Muon::STACO) continue; - if (muon->quality() != xAOD::Muon::Tight && muon->quality() != xAOD::Muon::Medium) continue; + MonVariables roi_variables; + auto roi_bcid = Monitored::Scalar<int>("roi_bcid", GetEventInfo(ctx)->bcid()); + roi_variables.push_back(roi_bcid); + auto roi_pileup = Monitored::Scalar<int>("roi_pileup", lbAverageInteractionsPerCrossing(ctx)); + roi_variables.push_back(roi_pileup); + auto roi_lumiBlock = Monitored::Scalar<int>("roi_lumiBlock", GetEventInfo(ctx)->lumiBlock()); + roi_variables.push_back(roi_lumiBlock); + auto roi_eta = Monitored::Collection("roi_eta", *rois, [](const xAOD::MuonRoI *m) { + return m->eta(); + }); + roi_variables.push_back(roi_eta); + auto roi_eta_rpc = Monitored::Collection("roi_eta_rpc", *rois, [](const xAOD::MuonRoI *m) { + return (m->getSource() == xAOD::MuonRoI::Barrel)?(m->eta()):(-10); + }); + roi_variables.push_back(roi_eta_rpc); + auto roi_eta_tgc = Monitored::Collection("roi_eta_tgc", *rois, [](const xAOD::MuonRoI *m) { + return (m->getSource() != xAOD::MuonRoI::Barrel)?(m->eta()):(-10); + }); + roi_variables.push_back(roi_eta_tgc); + auto roi_eta_wInnCoin = Monitored::Collection("roi_eta_wInnCoin", *rois, [](const xAOD::MuonRoI *m) { + return (m->getInnerCoincidence() && m->getSource() != xAOD::MuonRoI::Barrel)?(m->eta()):(-10); + }); + roi_variables.push_back(roi_eta_wInnCoin); + auto roi_eta_wBW3Coin = Monitored::Collection("roi_eta_wBW3Coin", *rois, [](const xAOD::MuonRoI *m) { + return (m->getBW3Coincidence() && m->getSource() != xAOD::MuonRoI::Barrel)?(m->eta()):(-10); + }); + roi_variables.push_back(roi_eta_wBW3Coin); + auto roi_eta_wInnCoinVeto = Monitored::Collection("roi_eta_wInnCoinVeto", *rois, [](const xAOD::MuonRoI *m) { + return (!m->getInnerCoincidence() && m->getSource() != xAOD::MuonRoI::Barrel)?(m->eta()):(-10); + }); + roi_variables.push_back(roi_eta_wInnCoinVeto); + auto roi_eta_wBW3CoinVeto = Monitored::Collection("roi_eta_wBW3CoinVeto", *rois, [](const xAOD::MuonRoI *m) { + return (!m->getBW3Coincidence() && m->getSource() != xAOD::MuonRoI::Barrel)?(m->eta()):(-10); + }); + roi_variables.push_back(roi_eta_wBW3CoinVeto); + auto roi_phi = Monitored::Collection("roi_phi", *rois, [](const xAOD::MuonRoI *m) { + return m->phi(); + }); + roi_variables.push_back(roi_phi); + auto roi_phi_rpc = Monitored::Collection("roi_phi_rpc", *rois, [](const xAOD::MuonRoI *m) { + return (m->getSource() == xAOD::MuonRoI::Barrel) ? m->phi() : -10; + }); + roi_variables.push_back(roi_phi_rpc); + auto roi_phi_tgc = Monitored::Collection("roi_phi_tgc", *rois, [](const xAOD::MuonRoI *m) { + return (m->getSource() != xAOD::MuonRoI::Barrel) ? m->phi() : -10; + }); + roi_variables.push_back(roi_phi_tgc); + auto roi_phi_wInnCoin = Monitored::Collection("roi_phi_wInnCoin", *rois, [](const xAOD::MuonRoI *m) { + return (m->getInnerCoincidence() && m->getSource() != xAOD::MuonRoI::Barrel)?(m->phi()):(-10);; + }); + roi_variables.push_back(roi_phi_wInnCoin); + auto roi_phi_wBW3Coin = Monitored::Collection("roi_phi_wBW3Coin", *rois, [](const xAOD::MuonRoI *m) { + return (m->getBW3Coincidence() && m->getSource() != xAOD::MuonRoI::Barrel)?(m->phi()):(-10);; + }); + roi_variables.push_back(roi_phi_wBW3Coin); + auto roi_phi_wInnCoinVeto = Monitored::Collection("roi_phi_wInnCoinVeto", *rois, [](const xAOD::MuonRoI *m) { + return (!m->getInnerCoincidence() && m->getSource() != xAOD::MuonRoI::Barrel)?(m->phi()):(-10);; + }); + roi_variables.push_back(roi_phi_wInnCoinVeto); + auto roi_phi_wBW3CoinVeto = Monitored::Collection("roi_phi_wBW3CoinVeto", *rois, [](const xAOD::MuonRoI *m) { + return (!m->getBW3Coincidence() && m->getSource() != xAOD::MuonRoI::Barrel)?(m->phi()):(-10);; + }); + roi_variables.push_back(roi_phi_wBW3CoinVeto); + auto roi_thr = Monitored::Collection("roi_thr", *rois, [](const xAOD::MuonRoI *m) { + return m->getThrNumber(); + }); + roi_variables.push_back(roi_thr); + auto roi_rpc = Monitored::Collection("roi_rpc", *rois, [](const xAOD::MuonRoI *m) { + return m->getSource() == xAOD::MuonRoI::Barrel; + }); + roi_variables.push_back(roi_rpc); + auto roi_tgc = Monitored::Collection("roi_tgc", *rois, [](const xAOD::MuonRoI *m) { + return m->getSource() != xAOD::MuonRoI::Barrel; + }); + roi_variables.push_back(roi_tgc); + auto roi_barrel = Monitored::Collection("roi_barrel", *rois, [](const xAOD::MuonRoI *m) { + return m->getSource() == xAOD::MuonRoI::Barrel; + }); + roi_variables.push_back(roi_barrel); + auto roi_endcap = Monitored::Collection("roi_endcap", *rois, [](const xAOD::MuonRoI *m) { + return m->getSource() == xAOD::MuonRoI::Endcap; + }); + roi_variables.push_back(roi_endcap); + auto roi_forward = Monitored::Collection("roi_forward", *rois, [](const xAOD::MuonRoI *m) { + return m->getSource() == xAOD::MuonRoI::Forward; + }); + roi_variables.push_back(roi_forward); + auto roi_phi_barrel = Monitored::Collection("roi_phi_barrel", *rois, [](const xAOD::MuonRoI *m) { + return (m->getSource() == xAOD::MuonRoI::Barrel) ? m->phi() : -10; + }); + roi_variables.push_back(roi_phi_barrel); + auto roi_phi_endcap = Monitored::Collection("roi_phi_endcap", *rois, [](const xAOD::MuonRoI *m) { + return (m->getSource() == xAOD::MuonRoI::Endcap) ? m->phi() : -10; + }); + roi_variables.push_back(roi_phi_endcap); + auto roi_phi_forward = Monitored::Collection("roi_phi_forward", *rois, [](const xAOD::MuonRoI *m) { + return (m->getSource() == xAOD::MuonRoI::Forward) ? m->phi() : -10; + }); + roi_variables.push_back(roi_phi_forward); + auto roi_sideA = Monitored::Collection("roi_sideA", *rois, [](const xAOD::MuonRoI *m) { + return m->getHemisphere() == xAOD::MuonRoI::Positive; + }); + roi_variables.push_back(roi_sideA); + auto roi_sideC = Monitored::Collection("roi_sideC", *rois, [](const xAOD::MuonRoI *m) { + return m->getHemisphere() == xAOD::MuonRoI::Negative; + }); + roi_variables.push_back(roi_sideC); + auto thrmask1 = Monitored::Collection("thrmask1", *rois, [](const xAOD::MuonRoI *m) { + return m->getThrNumber() == 1; + }); + roi_variables.push_back(thrmask1); + auto thrmask2 = Monitored::Collection("thrmask2", *rois, [](const xAOD::MuonRoI *m) { + return m->getThrNumber() == 2; + }); + roi_variables.push_back(thrmask2); + auto thrmask3 = Monitored::Collection("thrmask3", *rois, [](const xAOD::MuonRoI *m) { + return m->getThrNumber() == 3; + }); + roi_variables.push_back(thrmask3); + auto thrmask4 = Monitored::Collection("thrmask4", *rois, [](const xAOD::MuonRoI *m) { + return m->getThrNumber() == 4; + }); + roi_variables.push_back(thrmask4); + auto thrmask5 = Monitored::Collection("thrmask5", *rois, [](const xAOD::MuonRoI *m) { + return m->getThrNumber() == 5; + }); + roi_variables.push_back(thrmask5); + auto thrmask6 = Monitored::Collection("thrmask6", *rois, [](const xAOD::MuonRoI *m) { + return m->getThrNumber() == 6; + }); + roi_variables.push_back(thrmask6); + auto thrmask7 = Monitored::Collection("thrmask7", *rois, [](const xAOD::MuonRoI *m) { + return m->getThrNumber() == 7; + }); + roi_variables.push_back(thrmask7); + auto thrmask8 = Monitored::Collection("thrmask8", *rois, [](const xAOD::MuonRoI *m) { + return m->getThrNumber() == 8; + }); + roi_variables.push_back(thrmask8); + auto thrmask9 = Monitored::Collection("thrmask9", *rois, [](const xAOD::MuonRoI *m) { + return m->getThrNumber() == 9; + }); + roi_variables.push_back(thrmask9); + auto thrmask10 = Monitored::Collection("thrmask10", *rois, [](const xAOD::MuonRoI *m) { + return m->getThrNumber() == 10; + }); + roi_variables.push_back(thrmask10); + auto thrmask11 = Monitored::Collection("thrmask11", *rois, [](const xAOD::MuonRoI *m) { + return m->getThrNumber() == 11; + }); + roi_variables.push_back(thrmask11); + auto thrmask12 = Monitored::Collection("thrmask12", *rois, [](const xAOD::MuonRoI *m) { + return m->getThrNumber() == 12; + }); + roi_variables.push_back(thrmask12); + auto thrmask13 = Monitored::Collection("thrmask13", *rois, [](const xAOD::MuonRoI *m) { + return m->getThrNumber() == 13; + }); + roi_variables.push_back(thrmask13); + auto thrmask14 = Monitored::Collection("thrmask14", *rois, [](const xAOD::MuonRoI *m) { + return m->getThrNumber() == 14; + }); + roi_variables.push_back(thrmask14); + auto thrmask15 = Monitored::Collection("thrmask15", *rois, [](const xAOD::MuonRoI *m) { + return m->getThrNumber() == 15; + }); + roi_variables.push_back(thrmask15); + auto roi_charge = Monitored::Collection("roi_charge", *rois, [](const xAOD::MuonRoI* m) { + return (m->getCharge()==xAOD::MuonRoI::Neg)?(-1):((m->getCharge()==xAOD::MuonRoI::Pos)?(+1):(0)); + }); + roi_variables.push_back(roi_charge); + auto roi_bw3coin = Monitored::Collection("roi_bw3coin",*rois,[](const xAOD::MuonRoI* m) { + return m->getBW3Coincidence(); + }); + roi_variables.push_back(roi_bw3coin); + auto roi_bw3coinveto = Monitored::Collection("roi_bw3coinveto",*rois,[](const xAOD::MuonRoI* m) { + return !m->getBW3Coincidence() && m->getSource()!=xAOD::MuonRoI::Barrel; + }); + roi_variables.push_back(roi_bw3coinveto); + auto roi_inncoin = Monitored::Collection("roi_inncoin",*rois,[](const xAOD::MuonRoI* m) { + return m->getInnerCoincidence(); + }); + roi_variables.push_back(roi_inncoin); + auto roi_innveto = Monitored::Collection("roi_innveto",*rois,[](const xAOD::MuonRoI* m) { + return !m->getInnerCoincidence() && m->getSource()!=xAOD::MuonRoI::Barrel; + }); + roi_variables.push_back(roi_innveto); + auto roi_goodmf = Monitored::Collection("roi_goodmf",*rois,[](const xAOD::MuonRoI* m) { + return m->getGoodMF(); + }); + roi_variables.push_back(roi_goodmf); + auto roi_badmf = Monitored::Collection("roi_badmf",*rois,[](const xAOD::MuonRoI* m){ + return !m->getGoodMF() && m->getSource()!=xAOD::MuonRoI::Barrel; + }); + roi_variables.push_back(roi_badmf); + auto roi_ismorecand = Monitored::Collection("roi_ismorecand",*rois,[](const xAOD::MuonRoI* m){ + return m->isMoreCandInRoI(); + }); + roi_variables.push_back(roi_ismorecand); + auto roi_posCharge = Monitored::Collection("roi_posCharge",*rois,[](const xAOD::MuonRoI* m){ + return m->getCharge()==xAOD::MuonRoI::Pos; + }); + roi_variables.push_back(roi_posCharge); + auto roi_negCharge = Monitored::Collection("roi_negCharge",*rois,[](const xAOD::MuonRoI* m){ + return m->getCharge()==xAOD::MuonRoI::Neg; + }); + roi_variables.push_back(roi_negCharge); + fill(m_packageName, roi_variables); + } + if (!m_anaOfflMuon.value()) { + fill(m_packageName, variables); + return StatusCode::SUCCESS; + } - TLorentzVector muonvec; - muonvec.SetPtEtaPhiM(muon->pt(),muon->eta(),muon->phi(),m_muonMass.value()); - bool isolated = true; - bool probeOK = false; - for(const auto muon2 : *muons){ - // skip the same muon candidate - if( muon == muon2 )continue; - // check muon isolation - TLorentzVector muonvec2; - muonvec2.SetPtEtaPhiM(muon2->pt(),muon2->eta(),muon2->phi(),m_muonMass.value()); - float dr = muonvec2.DeltaR( muonvec ); - if( dr < m_isolationWindow.value() ){ - isolated = false; - } - // check tag-and-probe condition - if( muon2->muonType()!=xAOD::Muon::Combined )continue; - if( muon2->author()!=xAOD::Muon::MuidCo && muon2->author()!=xAOD::Muon::STACO )continue; - if( muon2->quality()!=xAOD::Muon::Tight && muon2->quality()!=xAOD::Muon::Medium )continue; - if( !triggerMatching(muon2,m_trigTagDefs) )continue; - if(!m_TagAndProbeZmumu.value()){ - probeOK=true; - }else{ - if( muon->charge() == muon2->charge() )continue; - double dimuon_mass = (muonvec + muonvec2).M(); - if(std::abs( dimuon_mass - m_zMass.value()) > m_zMassWindow.value() )continue; - probeOK=true; - } - } - if(m_requireIsolated.value() && !isolated)continue; - if(m_TagAndProbe.value() && !probeOK)continue; + SG::ReadHandle < xAOD::MuonContainer > muons(m_MuonContainerKey, ctx); + if (!muons.isValid()) { + ATH_MSG_ERROR("evtStore() does not contain muon Collection with name " << m_MuonContainerKey); + return StatusCode::FAILURE; + } - MyMuon mymuon; - /* fill basic info */ - mymuon.muon = muon; - /* fill extrapolation info (only to TGC) */ - extrapolate( muon, mymuon ); - /* L1Muon RoI matching */ - mymuon.matchedL1Charge=false; - mymuon.passBW3Coin=false; - mymuon.passInnerCoin=false; - mymuon.passGoodMF=false; - mymuon.passIsMoreCandInRoI=false; - float max_dr = 999; - float pt = mymuon.muon->pt(); - if (pt > pt_15_cut) max_dr = m_l1trigMatchWindow1.value(); - else if (pt > pt_10_cut) max_dr = m_l1trigMatchWindow2.value() + m_l1trigMatchWindow3.value() * pt / Gaudi::Units::GeV; - else max_dr = m_l1trigMatchWindow4.value() + m_l1trigMatchWindow5.value() * pt / Gaudi::Units::GeV; - if (!rois) { - ATH_MSG_DEBUG("No RoI matching possible as no container has been retrieved"); - mymuons.push_back(mymuon); - continue; - } - for(const auto roi : *rois){ - TLorentzVector roivec; - roivec.SetPtEtaPhiM(1,roi->eta(),roi->phi(),1); - double dr = roivec.DeltaR( muonvec ); - if( dr < max_dr ){ - mymuon.matchedL1ThrExclusive.insert( roi->getThrNumber() ); - if(muon->charge()<0 && roi->getCharge()==xAOD::MuonRoI::Neg)mymuon.matchedL1Charge|=true; - else if(muon->charge()>0 && roi->getCharge()==xAOD::MuonRoI::Pos)mymuon.matchedL1Charge|=true; - mymuon.passBW3Coin|=roi->getBW3Coincidence(); - mymuon.passInnerCoin|=roi->getInnerCoincidence(); - mymuon.passGoodMF|=roi->getGoodMF(); - mymuon.passIsMoreCandInRoI|=roi->isMoreCandInRoI(); - } + std::vector < MyMuon > mymuons; + for (const auto muon : *muons) { + if (muon->muonType() != xAOD::Muon::Combined) continue; + if (muon->author() != xAOD::Muon::MuidCo && muon->author() != xAOD::Muon::STACO) continue; + if (muon->quality() != xAOD::Muon::Tight && muon->quality() != xAOD::Muon::Medium) continue; + + TLorentzVector muonvec; + muonvec.SetPtEtaPhiM(muon->pt(),muon->eta(),muon->phi(),m_muonMass.value()); + bool isolated = true; + bool probeOK = false; + for(const auto muon2 : *muons){ + // skip the same muon candidate + if( muon == muon2 )continue; + // check muon isolation + TLorentzVector muonvec2; + muonvec2.SetPtEtaPhiM(muon2->pt(),muon2->eta(),muon2->phi(),m_muonMass.value()); + float dr = muonvec2.DeltaR( muonvec ); + if( dr < m_isolationWindow.value() ){ + isolated = false; } - const bool L1ThrsEmpt = mymuon.matchedL1ThrExclusive.empty(); - for (int ithr = 0; ithr < 16 && !L1ThrsEmpt; ++ithr) { - bool pass = false; - for (const auto &thr : mymuon.matchedL1ThrExclusive) { - if (thr >= ithr) { - pass = true; - break; - } - } - if (pass) mymuon.matchedL1ThrInclusive.insert(ithr); + // check tag-and-probe condition + if( muon2->muonType()!=xAOD::Muon::Combined )continue; + if( muon2->author()!=xAOD::Muon::MuidCo && muon2->author()!=xAOD::Muon::STACO )continue; + if( muon2->quality()!=xAOD::Muon::Tight && muon2->quality()!=xAOD::Muon::Medium )continue; + if( !triggerMatching(muon2,m_trigTagDefs) )continue; + if(!m_TagAndProbeZmumu.value()){ + probeOK=true; + }else{ + if( muon->charge() == muon2->charge() )continue; + double dimuon_mass = (muonvec + muonvec2).M(); + if(std::abs( dimuon_mass - m_zMass.value()) > m_zMassWindow.value() )continue; + probeOK=true; } + } + if(m_requireIsolated.value() && !isolated)continue; + if(m_TagAndProbe.value() && !probeOK)continue; - /* store MyMuon */ + MyMuon mymuon; + /* fill basic info */ + mymuon.muon = muon; + /* fill extrapolation info (only to TGC) */ + extrapolate( muon, mymuon ); + /* L1Muon RoI matching */ + mymuon.matchedL1Charge=false; + mymuon.passBW3Coin=false; + mymuon.passInnerCoin=false; + mymuon.passGoodMF=false; + mymuon.passIsMoreCandInRoI=false; + float max_dr = 999; + float pt = mymuon.muon->pt(); + if (pt > pt_15_cut) max_dr = m_l1trigMatchWindow1.value(); + else if (pt > pt_10_cut) max_dr = m_l1trigMatchWindow2.value() + m_l1trigMatchWindow3.value() * pt / Gaudi::Units::GeV; + else max_dr = m_l1trigMatchWindow4.value() + m_l1trigMatchWindow5.value() * pt / Gaudi::Units::GeV; + if (!rois) { + ATH_MSG_DEBUG("No RoI matching possible as no container has been retrieved"); mymuons.push_back(mymuon); + continue; + } + for(const auto roi : *rois){ + TLorentzVector roivec; + roivec.SetPtEtaPhiM(1,roi->eta(),roi->phi(),1); + double dr = roivec.DeltaR( muonvec ); + if( dr < max_dr ){ + mymuon.matchedL1ThrExclusive.insert( roi->getThrNumber() ); + if(muon->charge()<0 && roi->getCharge()==xAOD::MuonRoI::Neg)mymuon.matchedL1Charge|=true; + else if(muon->charge()>0 && roi->getCharge()==xAOD::MuonRoI::Pos)mymuon.matchedL1Charge|=true; + mymuon.passBW3Coin|=roi->getBW3Coincidence(); + mymuon.passInnerCoin|=roi->getInnerCoincidence(); + mymuon.passGoodMF|=roi->getGoodMF(); + mymuon.passIsMoreCandInRoI|=roi->isMoreCandInRoI(); + } + } + const bool L1ThrsEmpt = mymuon.matchedL1ThrExclusive.empty(); + for (int ithr = 0; ithr < 16 && !L1ThrsEmpt; ++ithr) { + bool pass = false; + for (const auto &thr : mymuon.matchedL1ThrExclusive) { + if (thr >= ithr) { + pass = true; + break; + } + } + if (pass) mymuon.matchedL1ThrInclusive.insert(ithr); } - auto muon_eta4gev = Monitored::Collection("muon_eta4gev",mymuons,[](const MyMuon& m){ - return (m.muon->pt()>pt_4_cut)?m.muon->eta():-10; - }); - variables.push_back(muon_eta4gev); - auto muon_phi4gev = Monitored::Collection("muon_phi4gev",mymuons,[](const MyMuon& m){ - return (m.muon->pt()>pt_4_cut)?m.muon->phi():-10; - }); - variables.push_back(muon_phi4gev); - auto muon_eta = Monitored::Collection("muon_eta", mymuons, [](const MyMuon &m) { - return (m.muon->pt() > pt_30_cut) ? m.muon->eta() : -10; + /* store MyMuon */ + mymuons.push_back(mymuon); + } + + auto muon_eta4gev = Monitored::Collection("muon_eta4gev",mymuons,[](const MyMuon& m){ + return (m.muon->pt()>pt_4_cut)?m.muon->eta():-10; }); - variables.push_back(muon_eta); - auto muon_phi = Monitored::Collection("muon_phi", mymuons, [](const MyMuon &m) { - return (m.muon->pt() > pt_30_cut) ? m.muon->phi() : -10; + variables.push_back(muon_eta4gev); + auto muon_phi4gev = Monitored::Collection("muon_phi4gev",mymuons,[](const MyMuon& m){ + return (m.muon->pt()>pt_4_cut)?m.muon->phi():-10; }); - variables.push_back(muon_phi); - auto muon_phi_rpc = Monitored::Collection("muon_phi_rpc", mymuons, [](const MyMuon &m) { - return (std::abs(m.muon->eta()) < barrel_end && m.muon->pt() > pt_30_cut) ? m.muon->phi() : -10; + variables.push_back(muon_phi4gev); + auto muon_eta = Monitored::Collection("muon_eta", mymuons, [](const MyMuon &m) { + return (m.muon->pt() > pt_30_cut) ? m.muon->eta() : -10; }); - variables.push_back(muon_phi_rpc); - auto muon_phi_tgc = Monitored::Collection("muon_phi_tgc", mymuons, [](const MyMuon &m) { - return (std::abs(m.muon->eta()) > barrel_end && std::abs(m.muon->eta()) < trigger_end && m.muon->pt() > pt_30_cut) ? m.muon->phi() : -10; + variables.push_back(muon_eta); + auto muon_phi = Monitored::Collection("muon_phi", mymuons, [](const MyMuon &m) { + return (m.muon->pt() > pt_30_cut) ? m.muon->phi() : -10; }); - variables.push_back(muon_phi_tgc); - auto muon_pt_rpc = Monitored::Collection("muon_pt_rpc", mymuons, [](const MyMuon &m) { - return (std::abs(m.muon->eta()) < barrel_end) ? m.muon->pt() / Gaudi::Units::GeV : -10; + variables.push_back(muon_phi); + auto muon_phi_rpc = Monitored::Collection("muon_phi_rpc", mymuons, [](const MyMuon &m) { + return (std::abs(m.muon->eta()) < barrel_end && m.muon->pt() > pt_30_cut) ? m.muon->phi() : -10; }); - variables.push_back(muon_pt_rpc); - auto muon_pt_tgc = Monitored::Collection("muon_pt_tgc", mymuons, [](const MyMuon &m) { - return (std::abs(m.muon->eta()) > barrel_end && std::abs(m.muon->eta()) < trigger_end) ? m.muon->pt() / Gaudi::Units::GeV : -10; + variables.push_back(muon_phi_rpc); + auto muon_phi_tgc = Monitored::Collection("muon_phi_tgc", mymuons, [](const MyMuon &m) { + return (std::abs(m.muon->eta()) > barrel_end && std::abs(m.muon->eta()) < trigger_end && m.muon->pt() > pt_30_cut) ? m.muon->phi() : -10; }); - variables.push_back(muon_pt_tgc); - auto muon_l1passThr1 = Monitored::Collection("muon_l1passThr1", mymuons, [](const MyMuon &m) { - return m.matchedL1ThrInclusive.find(1) != m.matchedL1ThrInclusive.end(); + variables.push_back(muon_phi_tgc); + auto muon_pt_rpc = Monitored::Collection("muon_pt_rpc", mymuons, [](const MyMuon &m) { + return (std::abs(m.muon->eta()) < barrel_end) ? m.muon->pt() / Gaudi::Units::GeV : -10; }); - variables.push_back(muon_l1passThr1); - auto muon_l1passThr2 = Monitored::Collection("muon_l1passThr2", mymuons, [](const MyMuon &m) { - return m.matchedL1ThrInclusive.find(2) != m.matchedL1ThrInclusive.end(); + variables.push_back(muon_pt_rpc); + auto muon_pt_tgc = Monitored::Collection("muon_pt_tgc", mymuons, [](const MyMuon &m) { + return (std::abs(m.muon->eta()) > barrel_end && std::abs(m.muon->eta()) < trigger_end) ? m.muon->pt() / Gaudi::Units::GeV : -10; }); - variables.push_back(muon_l1passThr2); - auto muon_l1passThr3 = Monitored::Collection("muon_l1passThr3", mymuons, [](const MyMuon &m) { - return m.matchedL1ThrInclusive.find(3) != m.matchedL1ThrInclusive.end(); + variables.push_back(muon_pt_tgc); + auto muon_l1passThr1 = Monitored::Collection("muon_l1passThr1", mymuons, [](const MyMuon &m) { + return m.matchedL1ThrInclusive.find(1) != m.matchedL1ThrInclusive.end(); }); - variables.push_back(muon_l1passThr3); - auto muon_l1passThr4 = Monitored::Collection("muon_l1passThr4", mymuons, [](const MyMuon &m) { - return m.matchedL1ThrInclusive.find(4) != m.matchedL1ThrInclusive.end(); + variables.push_back(muon_l1passThr1); + auto muon_l1passThr2 = Monitored::Collection("muon_l1passThr2", mymuons, [](const MyMuon &m) { + return m.matchedL1ThrInclusive.find(2) != m.matchedL1ThrInclusive.end(); }); - variables.push_back(muon_l1passThr4); - auto muon_l1passThr5 = Monitored::Collection("muon_l1passThr5", mymuons, [](const MyMuon &m) { - return m.matchedL1ThrInclusive.find(5) != m.matchedL1ThrInclusive.end(); + variables.push_back(muon_l1passThr2); + auto muon_l1passThr3 = Monitored::Collection("muon_l1passThr3", mymuons, [](const MyMuon &m) { + return m.matchedL1ThrInclusive.find(3) != m.matchedL1ThrInclusive.end(); }); - variables.push_back(muon_l1passThr5); - auto muon_l1passThr6 = Monitored::Collection("muon_l1passThr6", mymuons, [](const MyMuon &m) { - return m.matchedL1ThrInclusive.find(6) != m.matchedL1ThrInclusive.end(); + variables.push_back(muon_l1passThr3); + auto muon_l1passThr4 = Monitored::Collection("muon_l1passThr4", mymuons, [](const MyMuon &m) { + return m.matchedL1ThrInclusive.find(4) != m.matchedL1ThrInclusive.end(); }); - variables.push_back(muon_l1passThr6); - auto muon_l1passThr7 = Monitored::Collection("muon_l1passThr7", mymuons, [](const MyMuon &m) { - return m.matchedL1ThrInclusive.find(7) != m.matchedL1ThrInclusive.end(); + variables.push_back(muon_l1passThr4); + auto muon_l1passThr5 = Monitored::Collection("muon_l1passThr5", mymuons, [](const MyMuon &m) { + return m.matchedL1ThrInclusive.find(5) != m.matchedL1ThrInclusive.end(); }); - variables.push_back(muon_l1passThr7); - auto muon_l1passThr8 = Monitored::Collection("muon_l1passThr8", mymuons, [](const MyMuon &m) { - return m.matchedL1ThrInclusive.find(8) != m.matchedL1ThrInclusive.end(); + variables.push_back(muon_l1passThr5); + auto muon_l1passThr6 = Monitored::Collection("muon_l1passThr6", mymuons, [](const MyMuon &m) { + return m.matchedL1ThrInclusive.find(6) != m.matchedL1ThrInclusive.end(); }); - variables.push_back(muon_l1passThr8); - auto muon_l1passThr9 = Monitored::Collection("muon_l1passThr9", mymuons, [](const MyMuon &m) { - return m.matchedL1ThrInclusive.find(9) != m.matchedL1ThrInclusive.end(); + variables.push_back(muon_l1passThr6); + auto muon_l1passThr7 = Monitored::Collection("muon_l1passThr7", mymuons, [](const MyMuon &m) { + return m.matchedL1ThrInclusive.find(7) != m.matchedL1ThrInclusive.end(); }); - variables.push_back(muon_l1passThr9); - auto muon_l1passThr10 = Monitored::Collection("muon_l1passThr10", mymuons, [](const MyMuon &m) { - return m.matchedL1ThrInclusive.find(10) != m.matchedL1ThrInclusive.end(); + variables.push_back(muon_l1passThr7); + auto muon_l1passThr8 = Monitored::Collection("muon_l1passThr8", mymuons, [](const MyMuon &m) { + return m.matchedL1ThrInclusive.find(8) != m.matchedL1ThrInclusive.end(); }); - variables.push_back(muon_l1passThr10); - auto muon_l1passThr11 = Monitored::Collection("muon_l1passThr11", mymuons, [](const MyMuon &m) { - return m.matchedL1ThrInclusive.find(11) != m.matchedL1ThrInclusive.end(); + variables.push_back(muon_l1passThr8); + auto muon_l1passThr9 = Monitored::Collection("muon_l1passThr9", mymuons, [](const MyMuon &m) { + return m.matchedL1ThrInclusive.find(9) != m.matchedL1ThrInclusive.end(); }); - variables.push_back(muon_l1passThr11); - auto muon_l1passThr12 = Monitored::Collection("muon_l1passThr12", mymuons, [](const MyMuon &m) { - return m.matchedL1ThrInclusive.find(12) != m.matchedL1ThrInclusive.end(); + variables.push_back(muon_l1passThr9); + auto muon_l1passThr10 = Monitored::Collection("muon_l1passThr10", mymuons, [](const MyMuon &m) { + return m.matchedL1ThrInclusive.find(10) != m.matchedL1ThrInclusive.end(); }); - variables.push_back(muon_l1passThr12); - auto muon_l1passThr13 = Monitored::Collection("muon_l1passThr13", mymuons, [](const MyMuon &m) { - return m.matchedL1ThrInclusive.find(13) != m.matchedL1ThrInclusive.end(); + variables.push_back(muon_l1passThr10); + auto muon_l1passThr11 = Monitored::Collection("muon_l1passThr11", mymuons, [](const MyMuon &m) { + return m.matchedL1ThrInclusive.find(11) != m.matchedL1ThrInclusive.end(); }); - variables.push_back(muon_l1passThr13); - auto muon_l1passThr14 = Monitored::Collection("muon_l1passThr14", mymuons, [](const MyMuon &m) { - return m.matchedL1ThrInclusive.find(14) != m.matchedL1ThrInclusive.end(); + variables.push_back(muon_l1passThr11); + auto muon_l1passThr12 = Monitored::Collection("muon_l1passThr12", mymuons, [](const MyMuon &m) { + return m.matchedL1ThrInclusive.find(12) != m.matchedL1ThrInclusive.end(); }); - variables.push_back(muon_l1passThr14); - auto muon_l1passThr15 = Monitored::Collection("muon_l1passThr15", mymuons, [](const MyMuon &m) { - return m.matchedL1ThrInclusive.find(15) != m.matchedL1ThrInclusive.end(); + variables.push_back(muon_l1passThr12); + auto muon_l1passThr13 = Monitored::Collection("muon_l1passThr13", mymuons, [](const MyMuon &m) { + return m.matchedL1ThrInclusive.find(13) != m.matchedL1ThrInclusive.end(); }); - variables.push_back(muon_l1passThr15); - auto muon_l1passCharge = Monitored::Collection("muon_l1passCharge",mymuons,[](const MyMuon& m){ - return m.matchedL1Charge; - }); - variables.push_back(muon_l1passCharge); - auto muon_l1passBW3Coin = Monitored::Collection("muon_l1passBW3Coin",mymuons,[](const MyMuon& m){ - return m.passBW3Coin; - }); - variables.push_back(muon_l1passBW3Coin); - auto muon_l1passInnerCoin = Monitored::Collection("muon_l1passInnerCoin",mymuons,[](const MyMuon& m){ - return m.passInnerCoin; - }); - variables.push_back(muon_l1passInnerCoin); - auto muon_l1passInnerCoinVeto = Monitored::Collection("muon_l1passInnerCoinVeto",mymuons,[](const MyMuon& m){ - return !m.passInnerCoin; - }); - variables.push_back(muon_l1passInnerCoinVeto); - auto muon_l1passGoodMF = Monitored::Collection("muon_l1passGoodMF",mymuons,[](const MyMuon& m){ - return m.passGoodMF; - }); - variables.push_back(muon_l1passGoodMF); - auto muon_l1passBadMF = Monitored::Collection("muon_l1passBadMF",mymuons,[](const MyMuon& m){ - return !m.passGoodMF; - }); - variables.push_back(muon_l1passBadMF); - auto muon_l1passIsMoreCandInRoI = Monitored::Collection("muon_l1passIsMoreCandInRoI",mymuons,[](const MyMuon& m){ - return m.passIsMoreCandInRoI; - }); - variables.push_back(muon_l1passIsMoreCandInRoI); + variables.push_back(muon_l1passThr13); + auto muon_l1passThr14 = Monitored::Collection("muon_l1passThr14", mymuons, [](const MyMuon &m) { + return m.matchedL1ThrInclusive.find(14) != m.matchedL1ThrInclusive.end(); + }); + variables.push_back(muon_l1passThr14); + auto muon_l1passThr15 = Monitored::Collection("muon_l1passThr15", mymuons, [](const MyMuon &m) { + return m.matchedL1ThrInclusive.find(15) != m.matchedL1ThrInclusive.end(); + }); + variables.push_back(muon_l1passThr15); + auto muon_l1passCharge = Monitored::Collection("muon_l1passCharge",mymuons,[](const MyMuon& m){ + return m.matchedL1Charge; + }); + variables.push_back(muon_l1passCharge); + auto muon_l1passBW3Coin = Monitored::Collection("muon_l1passBW3Coin",mymuons,[](const MyMuon& m){ + return m.passBW3Coin; + }); + variables.push_back(muon_l1passBW3Coin); + auto muon_l1passBW3CoinVeto = Monitored::Collection("muon_l1passBW3CoinVeto",mymuons,[](const MyMuon& m){ + return !m.passBW3Coin; + }); + variables.push_back(muon_l1passBW3CoinVeto); + auto muon_l1passInnerCoin = Monitored::Collection("muon_l1passInnerCoin",mymuons,[](const MyMuon& m){ + return m.passInnerCoin; + }); + variables.push_back(muon_l1passInnerCoin); + auto muon_l1passInnerCoinVeto = Monitored::Collection("muon_l1passInnerCoinVeto",mymuons,[](const MyMuon& m){ + return !m.passInnerCoin; + }); + variables.push_back(muon_l1passInnerCoinVeto); + auto muon_l1passGoodMF = Monitored::Collection("muon_l1passGoodMF",mymuons,[](const MyMuon& m){ + return m.passGoodMF; + }); + variables.push_back(muon_l1passGoodMF); + auto muon_l1passBadMF = Monitored::Collection("muon_l1passBadMF",mymuons,[](const MyMuon& m){ + return !m.passGoodMF; + }); + variables.push_back(muon_l1passBadMF); + auto muon_l1passIsMoreCandInRoI = Monitored::Collection("muon_l1passIsMoreCandInRoI",mymuons,[](const MyMuon& m){ + return m.passIsMoreCandInRoI; + }); + variables.push_back(muon_l1passIsMoreCandInRoI); - if (!m_anaTgcPrd.value()) { - fill(m_packageName, variables); - variables.clear(); - return StatusCode::SUCCESS; - } + if (!m_anaTgcPrd.value()) { + fill(m_packageName, variables); + variables.clear(); + return StatusCode::SUCCESS; + } - SG::ReadHandle < Muon::TgcPrepDataContainer > tgcPrd(m_TgcPrepDataContainerKey, ctx); - if (!tgcPrd.isValid()) { - ATH_MSG_ERROR("evtStore() does not contain TgcPrepDataContainer with name " << m_TgcPrepDataContainerKey); - return StatusCode::FAILURE; - } - const TgcIdHelper &tgcIdHelper = m_idHelperSvc->tgcIdHelper(); - std::vector < TgcHit > tgcHits; - std::set < TString > chamber_list; - std::map<TString, std::vector<TgcHit>> tgcHitsMap; - std::map<TString, std::vector<int>> tgcHitPhiMap; - std::map<TString, std::vector<int>> tgcHitEtaMap; - std::map<TString, std::vector<int>> tgcHitPhiMapGlobal; - std::map<TString, std::vector<int>> tgcHitTiming; - for (auto tgccnt : *tgcPrd) { - for (auto data : *tgccnt) { - TgcHit tgcHit; - int bunch = -10; - if ((data->getBcBitMap() & Muon::TgcPrepData::BCBIT_PREVIOUS) == Muon::TgcPrepData::BCBIT_PREVIOUS) bunch = -1; - if ((data->getBcBitMap() & Muon::TgcPrepData::BCBIT_CURRENT) == Muon::TgcPrepData::BCBIT_CURRENT) bunch = 0; - if ((data->getBcBitMap() & Muon::TgcPrepData::BCBIT_NEXT) == Muon::TgcPrepData::BCBIT_NEXT) bunch = +1; - const MuonGM::TgcReadoutElement *element = data->detectorElement(); - const Identifier id = data->identify(); - const int gasGap = tgcIdHelper.gasGap(id); - const int channel = tgcIdHelper.channel(id); - const bool isStrip = tgcIdHelper.isStrip(id); - const Amg::Vector3D &pos = isStrip ? element->stripPos(gasGap, channel) : element->gangPos(gasGap, channel); - tgcHit.x = pos[0]; - tgcHit.y = pos[1]; - tgcHit.z = pos[2]; - if (isStrip) { - tgcHit.shortWidth = element->stripShortWidth(gasGap, channel); - tgcHit.longWidth = element->stripLongWidth(gasGap, channel); - tgcHit.length = element->stripLength(gasGap, channel); - } else { - tgcHit.shortWidth = element->gangShortWidth(gasGap, channel); - tgcHit.longWidth = element->gangLongWidth(gasGap, channel); - tgcHit.length = element->gangLength(gasGap, channel); - } - tgcHit.isStrip = tgcIdHelper.isStrip(id); - tgcHit.gasGap = tgcIdHelper.gasGap(id); - tgcHit.channel = tgcIdHelper.channel(id); - tgcHit.eta = tgcIdHelper.stationEta(id); - tgcHit.phi = tgcIdHelper.stationPhi(id); - tgcHit.station = tgcIdHelper.stationName(id); - tgcHit.bunch = bunch; + SG::ReadHandle < Muon::TgcPrepDataContainer > tgcPrd(m_TgcPrepDataContainerKey, ctx); + if (!tgcPrd.isValid()) { + ATH_MSG_ERROR("evtStore() does not contain TgcPrepDataContainer with name " << m_TgcPrepDataContainerKey); + return StatusCode::FAILURE; + } + const TgcIdHelper &tgcIdHelper = m_idHelperSvc->tgcIdHelper(); + std::vector < TgcHit > tgcHits; + std::set < TString > chamber_list; + std::map<TString, std::vector<TgcHit>> tgcHitsMap; + std::map<TString, std::vector<int>> tgcHitPhiMap; + std::map<TString, std::vector<int>> tgcHitEtaMap; + std::map<TString, std::vector<int>> tgcHitPhiMapGlobal; + std::map<TString, std::vector<int>> tgcHitTiming; + for (auto tgccnt : *tgcPrd) { + for (auto data : *tgccnt) { + TgcHit tgcHit; + int bunch = -10; + if ((data->getBcBitMap() & Muon::TgcPrepData::BCBIT_PREVIOUS) == Muon::TgcPrepData::BCBIT_PREVIOUS) bunch = -1; + if ((data->getBcBitMap() & Muon::TgcPrepData::BCBIT_CURRENT) == Muon::TgcPrepData::BCBIT_CURRENT) bunch = 0; + if ((data->getBcBitMap() & Muon::TgcPrepData::BCBIT_NEXT) == Muon::TgcPrepData::BCBIT_NEXT) bunch = +1; + const MuonGM::TgcReadoutElement *element = data->detectorElement(); + const Identifier id = data->identify(); + const int gasGap = tgcIdHelper.gasGap(id); + const int channel = tgcIdHelper.channel(id); + const bool isStrip = tgcIdHelper.isStrip(id); + const Amg::Vector3D &pos = isStrip ? element->stripPos(gasGap, channel) : element->gangPos(gasGap, channel); + tgcHit.x = pos[0]; + tgcHit.y = pos[1]; + tgcHit.z = pos[2]; + if (isStrip) { + tgcHit.shortWidth = element->stripShortWidth(gasGap, channel); + tgcHit.longWidth = element->stripLongWidth(gasGap, channel); + tgcHit.length = element->stripLength(gasGap, channel); + } else { + tgcHit.shortWidth = element->gangShortWidth(gasGap, channel); + tgcHit.longWidth = element->gangLongWidth(gasGap, channel); + tgcHit.length = element->gangLength(gasGap, channel); + } + tgcHit.isStrip = tgcIdHelper.isStrip(id); + tgcHit.gasGap = tgcIdHelper.gasGap(id); + tgcHit.channel = tgcIdHelper.channel(id); + tgcHit.eta = tgcIdHelper.stationEta(id); + tgcHit.phi = tgcIdHelper.stationPhi(id); + tgcHit.station = tgcIdHelper.stationName(id); + tgcHit.bunch = bunch; - tgcHit.igasGap = tgcHit.gasGap; - tgcHit.ieta = tgcHit.eta; - tgcHit.iphi = tgcHit.phi; - tgcHit.side = (tgcHit.ieta > 0) ? ("A") : ("C"); - tgcHit.iside = (tgcHit.ieta > 0) ? (0) : (1); - tgcHit.M = 0; - tgcHit.istation = tgcHit.station; - if (tgcHit.istation == 41 || tgcHit.istation == 42) tgcHit.M = 1; - else if (tgcHit.istation == 43 || tgcHit.istation == 44) tgcHit.M = 2; - else if (tgcHit.istation == 45 || tgcHit.istation == 46) tgcHit.M = 3; - else if (tgcHit.istation == 47 || tgcHit.istation == 48) tgcHit.M = 4; // EIFI - if (tgcHit.M == 0) { - ATH_MSG_ERROR("unknown station: " << tgcHit.istation); - } + tgcHit.igasGap = tgcHit.gasGap; + tgcHit.ieta = tgcHit.eta; + tgcHit.iphi = tgcHit.phi; + tgcHit.side = (tgcHit.ieta > 0) ? ("A") : ("C"); + tgcHit.iside = (tgcHit.ieta > 0) ? (0) : (1); + tgcHit.M = 0; + tgcHit.istation = tgcHit.station; + if (tgcHit.istation == 41 || tgcHit.istation == 42) tgcHit.M = 1; + else if (tgcHit.istation == 43 || tgcHit.istation == 44) tgcHit.M = 2; + else if (tgcHit.istation == 45 || tgcHit.istation == 46) tgcHit.M = 3; + else if (tgcHit.istation == 47 || tgcHit.istation == 48) tgcHit.M = 4; // EIFI + if (tgcHit.M == 0) { + ATH_MSG_ERROR("unknown station: " << tgcHit.istation); + } - if (tgcHit.M != 4) { // Big Wheel, (M1,M2,M3) - if (tgcHit.istation % 2 == 0) { // Endcap - int iphi2 = tgcHit.iphi + 1; // 2,3,4,..,49 - if (iphi2 >= 48) iphi2 -= 48; // 0,1,2,3 ..., 47 - tgcHit.sector = int(iphi2 / 4) + 1; // 1,2,3,,,12 - tgcHit.f = iphi2 - (tgcHit.sector - 1) * 4; // 0,1,2,3 - tgcHit.E = (tgcHit.M == 1) ? (5 - TMath::Abs(tgcHit.ieta)) : (6 - TMath::Abs(tgcHit.ieta)); - tgcHit.L = tgcHit.igasGap; - tgcHit.name = Form("%s%02iM%02if%02iE%02iL%02i%s", tgcHit.side.Data(), tgcHit.sector, tgcHit.M, tgcHit.f, tgcHit.E, tgcHit.L, (tgcHit.isStrip > 0) ? ("S") : ("W")); - } else { // Forward - int iphi2 = tgcHit.iphi; // 1,2,3,4,..,25 - if (iphi2 >= 24) iphi2 -= 24; // 0,1,2,3 ...,23 - tgcHit.sector = int(iphi2 / 2) + 1; // 1,2,3,,,12 - tgcHit.f = iphi2 - (tgcHit.sector - 1) * 2; // 0,1 - if (tgcHit.f == 1) tgcHit.f = 2; //0,2 - tgcHit.E = 0; // F - tgcHit.L = tgcHit.igasGap; - tgcHit.name = Form("%s%02iM%02if%02iF00L%02i%s", tgcHit.side.Data(), tgcHit.sector, tgcHit.M, tgcHit.f, tgcHit.L, (tgcHit.isStrip > 0) ? ("S") : ("W")); - } - } else { // Small Wheel (M4) - if (tgcHit.istation == 47) { // FI - tgcHit.sector = 0; - tgcHit.f = tgcHit.iphi; // 1,2,3..24 - tgcHit.E = 0; - tgcHit.L = tgcHit.igasGap; - tgcHit.name = Form("%s00M04f%02iF00L%02i%s", tgcHit.side.Data(), tgcHit.f, tgcHit.L, (tgcHit.isStrip > 0) ? ("S") : ("W")); - } else if (tgcHit.istation == 48) { // EI - int iphi2 = (tgcHit.iphi >= 21) ? (tgcHit.iphi - 21) : (tgcHit.iphi); // 0,1,2,..,20 - if (iphi2 >= 0 && iphi2 <= 2) { - tgcHit.sector = 1; - tgcHit.f = iphi2; - } else if (iphi2 >= 3 && iphi2 <= 5) { - tgcHit.sector = 3; - tgcHit.f = iphi2 - 3; - } else if (iphi2 >= 6 && iphi2 <= 8) { - tgcHit.sector = 5; - tgcHit.f = iphi2 - 6; - } else if (iphi2 >= 9 && iphi2 <= 10) { - tgcHit.sector = 7; - tgcHit.f = iphi2 - 9 + 1; - } else if (iphi2 >= 11 && iphi2 <= 13) { - tgcHit.sector = 9; - tgcHit.f = iphi2 - 11; - } else if (iphi2 >= 14 && iphi2 <= 15) { - tgcHit.sector = 11; - tgcHit.f = iphi2 - 13; - } else if (iphi2 >= 16 && iphi2 <= 18) { - tgcHit.sector = 13; - tgcHit.f = iphi2 - 16; - } else if (iphi2 >= 19 && iphi2 <= 20) { - tgcHit.sector = 15; - tgcHit.f = iphi2 - 19 + 1; - } - tgcHit.E = 1; - tgcHit.L = tgcHit.igasGap; - tgcHit.name = Form("%s%02iM04f%02iE01L%02i%s", tgcHit.side.Data(), tgcHit.sector, tgcHit.f, tgcHit.L, (tgcHit.isStrip > 0) ? ("S") : ("W")); - } else { - ATH_MSG_ERROR("Unknown detector"); - } - } - tgcHits.push_back(tgcHit); - tgcHitsMap[tgcHit.name].push_back(tgcHit); - chamber_list.insert(tgcHit.name); + if (tgcHit.M != 4) { // Big Wheel, (M1,M2,M3) + if (tgcHit.istation % 2 == 0) { // Endcap + int iphi2 = tgcHit.iphi + 1; // 2,3,4,..,49 + if (iphi2 >= 48) iphi2 -= 48; // 0,1,2,3 ..., 47 + tgcHit.sector = int(iphi2 / 4) + 1; // 1,2,3,,,12 + tgcHit.f = iphi2 - (tgcHit.sector - 1) * 4; // 0,1,2,3 + tgcHit.E = (tgcHit.M == 1) ? (5 - TMath::Abs(tgcHit.ieta)) : (6 - TMath::Abs(tgcHit.ieta)); + tgcHit.L = tgcHit.igasGap; + tgcHit.name = Form("%s%02iM%02if%02iE%02iL%02i%s", tgcHit.side.Data(), tgcHit.sector, tgcHit.M, tgcHit.f, tgcHit.E, tgcHit.L, (tgcHit.isStrip > 0) ? ("S") : ("W")); + } else { // Forward + int iphi2 = tgcHit.iphi; // 1,2,3,4,..,25 + if (iphi2 >= 24) iphi2 -= 24; // 0,1,2,3 ...,23 + tgcHit.sector = int(iphi2 / 2) + 1; // 1,2,3,,,12 + tgcHit.f = iphi2 - (tgcHit.sector - 1) * 2; // 0,1 + if (tgcHit.f == 1) tgcHit.f = 2; //0,2 + tgcHit.E = 0; // F + tgcHit.L = tgcHit.igasGap; + tgcHit.name = Form("%s%02iM%02if%02iF00L%02i%s", tgcHit.side.Data(), tgcHit.sector, tgcHit.M, tgcHit.f, tgcHit.L, (tgcHit.isStrip > 0) ? ("S") : ("W")); + } + } else { // Small Wheel (M4) + if (tgcHit.istation == 47) { // FI + tgcHit.sector = 0; + tgcHit.f = tgcHit.iphi; // 1,2,3..24 + tgcHit.E = 0; + tgcHit.L = tgcHit.igasGap; + tgcHit.name = Form("%s00M04f%02iF00L%02i%s", tgcHit.side.Data(), tgcHit.f, tgcHit.L, (tgcHit.isStrip > 0) ? ("S") : ("W")); + } else if (tgcHit.istation == 48) { // EI + int iphi2 = (tgcHit.iphi >= 21) ? (tgcHit.iphi - 21) : (tgcHit.iphi); // 0,1,2,..,20 + if (iphi2 >= 0 && iphi2 <= 2) { + tgcHit.sector = 1; + tgcHit.f = iphi2; + } else if (iphi2 >= 3 && iphi2 <= 5) { + tgcHit.sector = 3; + tgcHit.f = iphi2 - 3; + } else if (iphi2 >= 6 && iphi2 <= 8) { + tgcHit.sector = 5; + tgcHit.f = iphi2 - 6; + } else if (iphi2 >= 9 && iphi2 <= 10) { + tgcHit.sector = 7; + tgcHit.f = iphi2 - 9 + 1; + } else if (iphi2 >= 11 && iphi2 <= 13) { + tgcHit.sector = 9; + tgcHit.f = iphi2 - 11; + } else if (iphi2 >= 14 && iphi2 <= 15) { + tgcHit.sector = 11; + tgcHit.f = iphi2 - 13; + } else if (iphi2 >= 16 && iphi2 <= 18) { + tgcHit.sector = 13; + tgcHit.f = iphi2 - 16; + } else if (iphi2 >= 19 && iphi2 <= 20) { + tgcHit.sector = 15; + tgcHit.f = iphi2 - 19 + 1; + } + tgcHit.E = 1; + tgcHit.L = tgcHit.igasGap; + tgcHit.name = Form("%s%02iM04f%02iE01L%02i%s", tgcHit.side.Data(), tgcHit.sector, tgcHit.f, tgcHit.L, (tgcHit.isStrip > 0) ? ("S") : ("W")); + } else { + ATH_MSG_ERROR("Unknown detector"); + } + } + tgcHits.push_back(tgcHit); + tgcHitsMap[tgcHit.name].push_back(tgcHit); + chamber_list.insert(tgcHit.name); - TString station_name = Form("%sM%02i%s", tgcHit.side.Data(), tgcHit.M, (tgcHit.isStrip > 0) ? ("S") : ("W")); - int phimap_index = 0; - int etamap_index = 0; - int phimap_global_index = 0; // no empty bins compare to the above index - if (tgcHit.M == 1) { - phimap_index = (tgcHit.sector - 1) * 4 + tgcHit.f + 1; - int tmpeta = (tgcHit.E == 0) ? (5) : (tgcHit.E); - etamap_index = (tmpeta - 1) * 3 + tgcHit.L; - int tmpphi = tgcHit.f; - if (tgcHit.E == 0 && tgcHit.f == 2) tmpphi = 1; - if (tgcHit.E > 0) phimap_global_index = (tmpeta - 1) * 144 + (tgcHit.sector - 1) * 12 + tmpphi * 3 + tgcHit.L; - else phimap_global_index = 576 + (tgcHit.sector - 1) * 6 + tmpphi * 3 + tgcHit.L; - } else if (tgcHit.M == 2 || tgcHit.M == 3) { - phimap_index = (tgcHit.sector - 1) * 4 + tgcHit.f + 1; - int tmpeta = (tgcHit.E == 0) ? (6) : (tgcHit.E); - etamap_index = (tmpeta - 1) * 2 + tgcHit.L; - int tmpphi = tgcHit.f; - if (tgcHit.E == 0 && tgcHit.f == 2) tmpphi = 1; - if (tgcHit.E > 0) phimap_global_index = (tmpeta - 1) * 96 + (tgcHit.sector - 1) * 8 + tmpphi * 2 + tgcHit.L; - else phimap_global_index = 480 + (tgcHit.sector - 1) * 4 + tmpphi * 2 + tgcHit.L; - } else if (tgcHit.M == 4) { - phimap_index = tgcHit.iphi; - int tmpeta = (tgcHit.E == 0) ? (2) : (tgcHit.E); - etamap_index = (tmpeta - 1) * 2 + tgcHit.L; - if (tgcHit.E > 0) phimap_global_index = (tgcHit.iphi - 1) * 2 + tgcHit.L; - else phimap_global_index = 42 + (tgcHit.iphi - 1) * 2 + tgcHit.L; - } - tgcHitPhiMap[station_name].push_back(phimap_index); - tgcHitEtaMap[station_name].push_back(etamap_index); - tgcHitPhiMapGlobal[station_name].push_back(phimap_global_index); - tgcHitTiming[station_name].push_back(bunch); + TString station_name = Form("%sM%02i%s", tgcHit.side.Data(), tgcHit.M, (tgcHit.isStrip > 0) ? ("S") : ("W")); + int phimap_index = 0; + int etamap_index = 0; + int phimap_global_index = 0; // no empty bins compare to the above index + if (tgcHit.M == 1) { + phimap_index = (tgcHit.sector - 1) * 4 + tgcHit.f + 1; + int tmpeta = (tgcHit.E == 0) ? (5) : (tgcHit.E); + etamap_index = (tmpeta - 1) * 3 + tgcHit.L; + int tmpphi = tgcHit.f; + if (tgcHit.E == 0 && tgcHit.f == 2) tmpphi = 1; + if (tgcHit.E > 0) phimap_global_index = (tmpeta - 1) * 144 + (tgcHit.sector - 1) * 12 + tmpphi * 3 + tgcHit.L; + else phimap_global_index = 576 + (tgcHit.sector - 1) * 6 + tmpphi * 3 + tgcHit.L; + } else if (tgcHit.M == 2 || tgcHit.M == 3) { + phimap_index = (tgcHit.sector - 1) * 4 + tgcHit.f + 1; + int tmpeta = (tgcHit.E == 0) ? (6) : (tgcHit.E); + etamap_index = (tmpeta - 1) * 2 + tgcHit.L; + int tmpphi = tgcHit.f; + if (tgcHit.E == 0 && tgcHit.f == 2) tmpphi = 1; + if (tgcHit.E > 0) phimap_global_index = (tmpeta - 1) * 96 + (tgcHit.sector - 1) * 8 + tmpphi * 2 + tgcHit.L; + else phimap_global_index = 480 + (tgcHit.sector - 1) * 4 + tmpphi * 2 + tgcHit.L; + } else if (tgcHit.M == 4) { + phimap_index = tgcHit.iphi; + int tmpeta = (tgcHit.E == 0) ? (2) : (tgcHit.E); + etamap_index = (tmpeta - 1) * 2 + tgcHit.L; + if (tgcHit.E > 0) phimap_global_index = (tgcHit.iphi - 1) * 2 + tgcHit.L; + else phimap_global_index = 42 + (tgcHit.iphi - 1) * 2 + tgcHit.L; + } + tgcHitPhiMap[station_name].push_back(phimap_index); + tgcHitEtaMap[station_name].push_back(etamap_index); + tgcHitPhiMapGlobal[station_name].push_back(phimap_global_index); + tgcHitTiming[station_name].push_back(bunch); - } } + } - auto hit_n = Monitored::Scalar<int>("hit_n", tgcHits.size()); - variables.push_back(hit_n); - auto hit_bunch = Monitored::Collection("hit_bunch", tgcHits, [](const TgcHit &m) { - return m.bunch; + auto hit_n = Monitored::Scalar<int>("hit_n", tgcHits.size()); + variables.push_back(hit_n); + auto hit_bunch = Monitored::Collection("hit_bunch", tgcHits, [](const TgcHit &m) { + return m.bunch; }); - variables.push_back(hit_bunch); - auto hit_sideA = Monitored::Collection("hit_sideA", tgcHits, [](const TgcHit &m) { - return m.z > 0; + variables.push_back(hit_bunch); + auto hit_sideA = Monitored::Collection("hit_sideA", tgcHits, [](const TgcHit &m) { + return m.z > 0; }); - variables.push_back(hit_sideA); - auto hit_sideC = Monitored::Collection("hit_sideC", tgcHits, [](const TgcHit &m) { - return m.z < 0; + variables.push_back(hit_sideA); + auto hit_sideC = Monitored::Collection("hit_sideC", tgcHits, [](const TgcHit &m) { + return m.z < 0; }); - variables.push_back(hit_sideC); + variables.push_back(hit_sideC); - for (const auto &chamber_name : chamber_list) { - auto hits_on_a_chamber = Monitored::Collection(Form("hits_on_%s", chamber_name.Data()), tgcHitsMap[chamber_name], [](const TgcHit &m) { - return m.channel; - }); - fill(m_packageName, hits_on_a_chamber); - } + for (const auto &chamber_name : chamber_list) { + auto hits_on_a_chamber = Monitored::Collection(Form("hits_on_%s", chamber_name.Data()), tgcHitsMap[chamber_name], [](const TgcHit &m) { + return m.channel; + }); + fill(m_packageName, hits_on_a_chamber); + } - for (const auto &phimap : tgcHitPhiMap) { - auto x = Monitored::Collection(Form("x_%s", phimap.first.Data()), tgcHitEtaMap[phimap.first], [](const int &m) { - return m; - }); - auto y = Monitored::Collection(Form("y_%s", phimap.first.Data()), phimap.second, [](const int &m) { - return m; - }); - fill(m_packageName, x, y); - } - for (const auto &phimap : tgcHitPhiMapGlobal) { - auto x = Monitored::Scalar<int>(Form("lb_for_%s", phimap.first.Data()), GetEventInfo(ctx)->lumiBlock()); - auto y = Monitored::Collection(Form("%s", phimap.first.Data()), phimap.second, [](const int &m) { - return m; - }); - auto z = Monitored::Collection(Form("timing_for_%s", phimap.first.Data()), tgcHitTiming[phimap.first], [](const int &m) { - return m; - }); - fill(m_packageName, x, y, z); - } + for (const auto &phimap : tgcHitPhiMap) { + auto x = Monitored::Collection(Form("x_%s", phimap.first.Data()), tgcHitEtaMap[phimap.first], [](const int &m) { + return m; + }); + auto y = Monitored::Collection(Form("y_%s", phimap.first.Data()), phimap.second, [](const int &m) { + return m; + }); + fill(m_packageName, x, y); + } + for (const auto &phimap : tgcHitPhiMapGlobal) { + auto x = Monitored::Scalar<int>(Form("lb_for_%s", phimap.first.Data()), GetEventInfo(ctx)->lumiBlock()); + auto y = Monitored::Collection(Form("%s", phimap.first.Data()), phimap.second, [](const int &m) { + return m; + }); + auto z = Monitored::Collection(Form("timing_for_%s", phimap.first.Data()), tgcHitTiming[phimap.first], [](const int &m) { + return m; + }); + fill(m_packageName, x, y, z); + } - SG::ReadHandle < Muon::TgcCoinDataContainer > tgcCoinCurr(m_TgcCoinDataContainerCurrBCKey, ctx); - if (!tgcCoinCurr.isValid()) { - ATH_MSG_ERROR("evtStore() does not contain TgcCoinDataContainer with name " << m_TgcCoinDataContainerCurrBCKey); - return StatusCode::FAILURE; - } - SG::ReadHandle < Muon::TgcCoinDataContainer > tgcCoinNext(m_TgcCoinDataContainerNextBCKey, ctx); - if (!tgcCoinNext.isValid()) { - ATH_MSG_ERROR("evtStore() does not contain TgcCoinDataContainer with name " << m_TgcCoinDataContainerNextBCKey); - return StatusCode::FAILURE; - } - SG::ReadHandle < Muon::TgcCoinDataContainer > tgcCoinPrev(m_TgcCoinDataContainerPrevBCKey, ctx); - if (!tgcCoinPrev.isValid()) { - ATH_MSG_ERROR("evtStore() does not contain TgcCoinDataContainer with name " << m_TgcCoinDataContainerPrevBCKey); - return StatusCode::FAILURE; - } - std::map<int, SG::ReadHandle<Muon::TgcCoinDataContainer> > tgcCoin; - tgcCoin[0] = tgcCoinCurr; - tgcCoin[+1] = tgcCoinNext; - tgcCoin[-1] = tgcCoinPrev; - std::vector < TgcTrig > tgcTrigs_SL; - std::vector < TgcTrig > tgcTrigs_SL_Endcap; - std::vector < TgcTrig > tgcTrigs_SL_Forward; - std::vector < TgcTrig > tgcTrigs_HPT_Wire; - std::vector < TgcTrig > tgcTrigs_HPT_Endcap_Wire; - std::vector < TgcTrig > tgcTrigs_HPT_Forward_Wire; - std::vector < TgcTrig > tgcTrigs_HPT_Strip; - std::vector < TgcTrig > tgcTrigs_HPT_Endcap_Strip; - std::vector < TgcTrig > tgcTrigs_HPT_Forward_Strip; - std::vector < TgcTrig > tgcTrigs_LPT_Wire; - std::vector < TgcTrig > tgcTrigs_LPT_Endcap_Wire; - std::vector < TgcTrig > tgcTrigs_LPT_Forward_Wire; - std::vector < TgcTrig > tgcTrigs_LPT_Strip; - std::vector < TgcTrig > tgcTrigs_LPT_Endcap_Strip; - std::vector < TgcTrig > tgcTrigs_LPT_Forward_Strip; - int n_TgcCoin_detElementIsNull = 0; - int n_TgcCoin_postOutPtrIsNull = 0; - for (auto thisCoin : tgcCoin) { - int bunch = thisCoin.first; - for (auto tgccnt : *(thisCoin.second)) { - for (const auto data : *tgccnt) { + SG::ReadHandle < Muon::TgcCoinDataContainer > tgcCoinCurr(m_TgcCoinDataContainerCurrBCKey, ctx); + if (!tgcCoinCurr.isValid()) { + ATH_MSG_ERROR("evtStore() does not contain TgcCoinDataContainer with name " << m_TgcCoinDataContainerCurrBCKey); + return StatusCode::FAILURE; + } + SG::ReadHandle < Muon::TgcCoinDataContainer > tgcCoinNext(m_TgcCoinDataContainerNextBCKey, ctx); + if (!tgcCoinNext.isValid()) { + ATH_MSG_ERROR("evtStore() does not contain TgcCoinDataContainer with name " << m_TgcCoinDataContainerNextBCKey); + return StatusCode::FAILURE; + } + SG::ReadHandle < Muon::TgcCoinDataContainer > tgcCoinPrev(m_TgcCoinDataContainerPrevBCKey, ctx); + if (!tgcCoinPrev.isValid()) { + ATH_MSG_ERROR("evtStore() does not contain TgcCoinDataContainer with name " << m_TgcCoinDataContainerPrevBCKey); + return StatusCode::FAILURE; + } + std::map<int, SG::ReadHandle<Muon::TgcCoinDataContainer> > tgcCoin; + tgcCoin[0] = tgcCoinCurr; + tgcCoin[+1] = tgcCoinNext; + tgcCoin[-1] = tgcCoinPrev; + std::vector < TgcTrig > tgcTrigs_SL; + std::vector < TgcTrig > tgcTrigs_SL_Endcap; + std::vector < TgcTrig > tgcTrigs_SL_Forward; + std::vector < TgcTrig > tgcTrigs_HPT_Wire; + std::vector < TgcTrig > tgcTrigs_HPT_Endcap_Wire; + std::vector < TgcTrig > tgcTrigs_HPT_Forward_Wire; + std::vector < TgcTrig > tgcTrigs_HPT_Strip; + std::vector < TgcTrig > tgcTrigs_HPT_Endcap_Strip; + std::vector < TgcTrig > tgcTrigs_HPT_Forward_Strip; + std::vector < TgcTrig > tgcTrigs_LPT_Wire; + std::vector < TgcTrig > tgcTrigs_LPT_Endcap_Wire; + std::vector < TgcTrig > tgcTrigs_LPT_Forward_Wire; + std::vector < TgcTrig > tgcTrigs_LPT_Strip; + std::vector < TgcTrig > tgcTrigs_LPT_Endcap_Strip; + std::vector < TgcTrig > tgcTrigs_LPT_Forward_Strip; + int n_TgcCoin_detElementIsNull = 0; + int n_TgcCoin_postOutPtrIsNull = 0; + for (auto thisCoin : tgcCoin) { + int bunch = thisCoin.first; + for (auto tgccnt : *(thisCoin.second)) { + for (const auto data : *tgccnt) { - if ( data->detectorElementOut() == nullptr ) n_TgcCoin_detElementIsNull++; - if ( data->posOutPtr() == nullptr ) n_TgcCoin_postOutPtrIsNull++; - if ( data->detectorElementOut() == nullptr || - data->posOutPtr() == nullptr )continue; // to avoid FPE + if ( data->detectorElementOut() == nullptr ) n_TgcCoin_detElementIsNull++; + if ( data->posOutPtr() == nullptr ) n_TgcCoin_postOutPtrIsNull++; + if ( data->detectorElementOut() == nullptr || + data->posOutPtr() == nullptr )continue; // to avoid FPE - TgcTrig tgcTrig; - tgcTrig.lb = GetEventInfo(ctx)->lumiBlock(); - const int type = data->type(); - const Amg::Vector3D &posIn = data->globalposIn(); - tgcTrig.x_In = posIn[0]; - tgcTrig.y_In = posIn[1]; - tgcTrig.z_In = posIn[2]; - const Amg::Vector3D &posOut = data->globalposOut(); - tgcTrig.x_Out = posOut[0]; - tgcTrig.y_Out = posOut[1]; - tgcTrig.z_Out = posOut[2]; - tgcTrig.eta = posOut.eta(); - tgcTrig.phi = posOut.phi(); - tgcTrig.width_In = data->widthIn(); - tgcTrig.width_Out = data->widthOut(); - if (type == Muon::TgcCoinData::TYPE_SL) { - const Amg::MatrixX &matrix = data->errMat(); - tgcTrig.width_R = matrix(0, 0); - tgcTrig.width_Phi = matrix(1, 1); - } else { - tgcTrig.width_R = 0.; - tgcTrig.width_Phi = 0.; - } - int etaout = 0; - int etain = 0; - const Identifier tcdidout = data->channelIdOut(); - if (tcdidout.is_valid()) { - etaout = std::abs(int(m_idHelperSvc->tgcIdHelper().stationEta(tcdidout))); - } - const Identifier tcdidin = data->channelIdIn(); - if (tcdidin.is_valid()) { - etain = std::abs(int(m_idHelperSvc->tgcIdHelper().stationEta(tcdidin))); - } - tgcTrig.etaout = etaout; - tgcTrig.etain = etain; - tgcTrig.isAside = data->isAside(); - tgcTrig.isForward = data->isForward(); - tgcTrig.isStrip = data->isStrip(); - tgcTrig.isInner = data->isInner(); - tgcTrig.isPositiveDeltaR = data->isPositiveDeltaR(); - tgcTrig.type = type; - tgcTrig.trackletId = data->trackletId(); - tgcTrig.trackletIdStrip = data->trackletIdStrip(); - tgcTrig.sector = (data->isAside())?(data->phi()):(-data->phi()); - tgcTrig.roi = data->roi(); - tgcTrig.pt = data->pt(); - tgcTrig.delta = data->delta(); - tgcTrig.sub = data->sub(); - tgcTrig.veto = data->veto(); - tgcTrig.bunch = bunch; - tgcTrig.inner = data->inner(); - if (type == Muon::TgcCoinData::TYPE_SL && !tgcTrig.isForward) { - tgcTrigs_SL_Endcap.push_back(tgcTrig); - tgcTrigs_SL.push_back(tgcTrig); - }else if (type == Muon::TgcCoinData::TYPE_SL && tgcTrig.isForward) { - tgcTrigs_SL_Forward.push_back(tgcTrig); - tgcTrigs_SL.push_back(tgcTrig); - }else if(type == Muon::TgcCoinData::TYPE_HIPT && !tgcTrig.isForward){ - if(tgcTrig.isStrip){ - tgcTrigs_HPT_Endcap_Strip.push_back(tgcTrig); - tgcTrigs_HPT_Strip.push_back(tgcTrig); - }else{ - tgcTrigs_HPT_Endcap_Wire.push_back(tgcTrig); - tgcTrigs_HPT_Wire.push_back(tgcTrig); - } - }else if(type == Muon::TgcCoinData::TYPE_HIPT && tgcTrig.isForward){ - if(tgcTrig.isStrip){ - tgcTrigs_HPT_Forward_Strip.push_back(tgcTrig); - tgcTrigs_HPT_Strip.push_back(tgcTrig); - }else{ - tgcTrigs_HPT_Forward_Wire.push_back(tgcTrig); - tgcTrigs_HPT_Wire.push_back(tgcTrig); - } - }else if(type == Muon::TgcCoinData::TYPE_TRACKLET && !tgcTrig.isForward){ - if(tgcTrig.isStrip){ - tgcTrigs_LPT_Endcap_Strip.push_back(tgcTrig); - tgcTrigs_LPT_Strip.push_back(tgcTrig); - }else{ - tgcTrigs_LPT_Endcap_Wire.push_back(tgcTrig); - tgcTrigs_LPT_Wire.push_back(tgcTrig); - } - }else if(type == Muon::TgcCoinData::TYPE_TRACKLET && tgcTrig.isForward){ - if(tgcTrig.isStrip){ - tgcTrigs_LPT_Forward_Strip.push_back(tgcTrig); - tgcTrigs_LPT_Strip.push_back(tgcTrig); - }else{ - tgcTrigs_LPT_Forward_Wire.push_back(tgcTrig); - tgcTrigs_LPT_Wire.push_back(tgcTrig); - } - } - } - } + TgcTrig tgcTrig; + tgcTrig.lb = GetEventInfo(ctx)->lumiBlock(); + const int type = data->type(); + const Amg::Vector3D &posIn = data->globalposIn(); + tgcTrig.x_In = posIn[0]; + tgcTrig.y_In = posIn[1]; + tgcTrig.z_In = posIn[2]; + const Amg::Vector3D &posOut = data->globalposOut(); + tgcTrig.x_Out = posOut[0]; + tgcTrig.y_Out = posOut[1]; + tgcTrig.z_Out = posOut[2]; + tgcTrig.eta = posOut.eta(); + tgcTrig.phi = posOut.phi(); + tgcTrig.width_In = data->widthIn(); + tgcTrig.width_Out = data->widthOut(); + if (type == Muon::TgcCoinData::TYPE_SL) { + const Amg::MatrixX &matrix = data->errMat(); + tgcTrig.width_R = matrix(0, 0); + tgcTrig.width_Phi = matrix(1, 1); + } else { + tgcTrig.width_R = 0.; + tgcTrig.width_Phi = 0.; + } + int etaout = 0; + int etain = 0; + const Identifier tcdidout = data->channelIdOut(); + if (tcdidout.is_valid()) { + etaout = std::abs(int(m_idHelperSvc->tgcIdHelper().stationEta(tcdidout))); + } + const Identifier tcdidin = data->channelIdIn(); + if (tcdidin.is_valid()) { + etain = std::abs(int(m_idHelperSvc->tgcIdHelper().stationEta(tcdidin))); + } + tgcTrig.etaout = etaout; + tgcTrig.etain = etain; + tgcTrig.isAside = data->isAside(); + tgcTrig.isForward = data->isForward(); + tgcTrig.isStrip = data->isStrip(); + tgcTrig.isInner = data->isInner(); + tgcTrig.isPositiveDeltaR = data->isPositiveDeltaR(); + tgcTrig.type = type; + tgcTrig.trackletId = data->trackletId(); + tgcTrig.trackletIdStrip = data->trackletIdStrip(); + tgcTrig.sector = (data->isAside())?(data->phi()):(-data->phi()); + tgcTrig.roi = data->roi(); + tgcTrig.pt = data->pt(); + tgcTrig.delta = data->delta(); + tgcTrig.sub = data->sub(); + tgcTrig.veto = data->veto(); + tgcTrig.bunch = bunch; + tgcTrig.inner = data->inner(); + if (type == Muon::TgcCoinData::TYPE_SL && !tgcTrig.isForward) { + tgcTrigs_SL_Endcap.push_back(tgcTrig); + tgcTrigs_SL.push_back(tgcTrig); + }else if (type == Muon::TgcCoinData::TYPE_SL && tgcTrig.isForward) { + tgcTrigs_SL_Forward.push_back(tgcTrig); + tgcTrigs_SL.push_back(tgcTrig); + }else if(type == Muon::TgcCoinData::TYPE_HIPT && !tgcTrig.isForward){ + if(tgcTrig.isStrip){ + tgcTrigs_HPT_Endcap_Strip.push_back(tgcTrig); + tgcTrigs_HPT_Strip.push_back(tgcTrig); + }else{ + tgcTrigs_HPT_Endcap_Wire.push_back(tgcTrig); + tgcTrigs_HPT_Wire.push_back(tgcTrig); + } + }else if(type == Muon::TgcCoinData::TYPE_HIPT && tgcTrig.isForward){ + if(tgcTrig.isStrip){ + tgcTrigs_HPT_Forward_Strip.push_back(tgcTrig); + tgcTrigs_HPT_Strip.push_back(tgcTrig); + }else{ + tgcTrigs_HPT_Forward_Wire.push_back(tgcTrig); + tgcTrigs_HPT_Wire.push_back(tgcTrig); + } + }else if(type == Muon::TgcCoinData::TYPE_TRACKLET && !tgcTrig.isForward){ + if(tgcTrig.isStrip){ + tgcTrigs_LPT_Endcap_Strip.push_back(tgcTrig); + tgcTrigs_LPT_Strip.push_back(tgcTrig); + }else{ + tgcTrigs_LPT_Endcap_Wire.push_back(tgcTrig); + tgcTrigs_LPT_Wire.push_back(tgcTrig); + } + }else if(type == Muon::TgcCoinData::TYPE_TRACKLET && tgcTrig.isForward){ + if(tgcTrig.isStrip){ + tgcTrigs_LPT_Forward_Strip.push_back(tgcTrig); + tgcTrigs_LPT_Strip.push_back(tgcTrig); + }else{ + tgcTrigs_LPT_Forward_Wire.push_back(tgcTrig); + tgcTrigs_LPT_Wire.push_back(tgcTrig); + } + } + } } + } - auto mon_nTgcCoin_detElementIsNull = Monitored::Scalar<int>("nTgcCoinDetElementIsNull", n_TgcCoin_detElementIsNull); - auto mon_nTgcCoin_postOutPtrIsNull = Monitored::Scalar<int>("nTgcCoinPostOutPtrIsNull", n_TgcCoin_postOutPtrIsNull); - variables.push_back(mon_nTgcCoin_detElementIsNull); - variables.push_back(mon_nTgcCoin_postOutPtrIsNull); + auto mon_nTgcCoin_detElementIsNull = Monitored::Scalar<int>("nTgcCoinDetElementIsNull", n_TgcCoin_detElementIsNull); + auto mon_nTgcCoin_postOutPtrIsNull = Monitored::Scalar<int>("nTgcCoinPostOutPtrIsNull", n_TgcCoin_postOutPtrIsNull); + variables.push_back(mon_nTgcCoin_detElementIsNull); + variables.push_back(mon_nTgcCoin_postOutPtrIsNull); - fillTgcCoin(tgcTrigs_SL,"SL"); - fillTgcCoin(tgcTrigs_SL_Endcap,"SL_Endcap"); - fillTgcCoin(tgcTrigs_SL_Forward,"SL_Forward"); + fillTgcCoin(tgcTrigs_SL,"SL"); + fillTgcCoin(tgcTrigs_SL_Endcap,"SL_Endcap"); + fillTgcCoin(tgcTrigs_SL_Forward,"SL_Forward"); - fillTgcCoin(tgcTrigs_HPT_Wire,"HPT_Wire"); - fillTgcCoin(tgcTrigs_HPT_Endcap_Wire,"HPT_Endcap_Wire"); - fillTgcCoin(tgcTrigs_HPT_Forward_Wire,"HPT_Forward_Wire"); + fillTgcCoin(tgcTrigs_HPT_Wire,"HPT_Wire"); + fillTgcCoin(tgcTrigs_HPT_Endcap_Wire,"HPT_Endcap_Wire"); + fillTgcCoin(tgcTrigs_HPT_Forward_Wire,"HPT_Forward_Wire"); - fillTgcCoin(tgcTrigs_HPT_Strip,"HPT_Strip"); - fillTgcCoin(tgcTrigs_HPT_Endcap_Strip,"HPT_Endcap_Strip"); - fillTgcCoin(tgcTrigs_HPT_Forward_Strip,"HPT_Forward_Strip"); + fillTgcCoin(tgcTrigs_HPT_Strip,"HPT_Strip"); + fillTgcCoin(tgcTrigs_HPT_Endcap_Strip,"HPT_Endcap_Strip"); + fillTgcCoin(tgcTrigs_HPT_Forward_Strip,"HPT_Forward_Strip"); - fillTgcCoin(tgcTrigs_LPT_Wire,"LPT_Wire"); - fillTgcCoin(tgcTrigs_LPT_Endcap_Wire,"LPT_Endcap_Wire"); - fillTgcCoin(tgcTrigs_LPT_Forward_Wire,"LPT_Forward_Wire"); + fillTgcCoin(tgcTrigs_LPT_Wire,"LPT_Wire"); + fillTgcCoin(tgcTrigs_LPT_Endcap_Wire,"LPT_Endcap_Wire"); + fillTgcCoin(tgcTrigs_LPT_Forward_Wire,"LPT_Forward_Wire"); - fillTgcCoin(tgcTrigs_LPT_Strip,"LPT_Strip"); - fillTgcCoin(tgcTrigs_LPT_Endcap_Strip,"LPT_Endcap_Strip"); - fillTgcCoin(tgcTrigs_LPT_Forward_Strip,"LPT_Forward_Strip"); + fillTgcCoin(tgcTrigs_LPT_Strip,"LPT_Strip"); + fillTgcCoin(tgcTrigs_LPT_Endcap_Strip,"LPT_Endcap_Strip"); + fillTgcCoin(tgcTrigs_LPT_Forward_Strip,"LPT_Forward_Strip"); - fill(m_packageName, variables); - return StatusCode::SUCCESS; + fill(m_packageName, variables); + return StatusCode::SUCCESS; } void TgcRawDataMonitorAlgorithm::fillTgcCoin(const std::vector<TgcTrig>& tgcTrigs, const std::string type ) const { -- GitLab