diff --git a/Trigger/TrigMonitoring/TrigMETMonitoring/python/TrigMETMonitorAlgorithm.py b/Trigger/TrigMonitoring/TrigMETMonitoring/python/TrigMETMonitorAlgorithm.py index d3b06d3e03ea640d35b77db712b0116dad3ff0fe..92ab457b04a0fac7ea98f7f1672bdd1d84931479 100644 --- a/Trigger/TrigMonitoring/TrigMETMonitoring/python/TrigMETMonitorAlgorithm.py +++ b/Trigger/TrigMonitoring/TrigMETMonitoring/python/TrigMETMonitorAlgorithm.py @@ -35,7 +35,7 @@ def TrigMETMonConfig(inputFlags): #The added algorithm must exist as a .h file from TrigMETMonitoring.TrigMETMonitoringConf import TrigMETMonitorAlgorithm - trigMETMonAlg = helper.addAlgorithm(TrigMETMonitorAlgorithm,'TrigMETMonAlg') + expertTrigMETMonAlg = helper.addAlgorithm(TrigMETMonitorAlgorithm,'TrigMETMonAlg') # You can actually make multiple instances of the same algorithm and give # them different configurations @@ -50,10 +50,10 @@ def TrigMETMonConfig(inputFlags): ### STEP 3 ### # Edit properties of a algorithm # some generic property - # trigMETMonAlg.RandomHist = True + # expertTrigMETMonAlg.RandomHist = True # to enable a trigger filter, for example: - #trigMETMonAlg.TriggerChain = 'HLT_mu26_ivarmedium' - trigMETMonAlg.TriggerChain = 'HLT_xe30_cell_L1XE10' + #expertTrigMETMonAlg.TriggerChain = 'HLT_mu26_ivarmedium' + expertTrigMETMonAlg.TriggerChain = 'HLT_xe30_cell_L1XE10' ### STEP 4 ### # Add some tools. N.B. Do not use your own trigger decion tool. Use the @@ -65,20 +65,16 @@ def TrigMETMonConfig(inputFlags): # from CaloTools.CaloNoiseToolConfig import CaloNoiseToolCfg # caloNoiseAcc, caloNoiseTool = CaloNoiseToolCfg(inputFlags) # result.merge(caloNoiseAcc) - # trigMETMonAlg.CaloNoiseTool = caloNoiseTool + # expertTrigMETMonAlg.CaloNoiseTool = caloNoiseTool # # Then, add a tool that doesn't have its own configuration function. In # # this example, no accumulator is returned, so no merge is necessary. # from MyDomainPackage.MyDomainPackageConf import MyDomainTool - # trigMETMonAlg.MyDomainTool = MyDomainTool() + # expertTrigMETMonAlg.MyDomainTool = MyDomainTool() # Add a generic monitoring tool (a "group" in old language). The returned # object here is the standard GenericMonitoringTool. - myGroup = helper.addGroup( - trigMETMonAlg, - 'TrigMETMonitor', - 'HLT/METMon/Expert/' - ) + expertGroup = helper.addGroup(expertTrigMETMonAlg,'TrigMETMonitor','HLT/METMon/Expert/') # Add a GMT for the other example monitor algorithm shifterGroup = helper.addGroup(shifterTrigMETMonAlg,'TrigMETMonitor','HLT/METMon/Shifter/') @@ -86,17 +82,24 @@ def TrigMETMonConfig(inputFlags): ### STEP 5 ### # Configure histograms #NB! The histograms defined here must match the ones in the cxx file exactly - myGroup.defineHistogram('lumiPerBCID',title='Luminosity;L/BCID;Events', - path='ToRuleThemAll',xbins=10,xmin=0.0,xmax=10.0) - myGroup.defineHistogram('lb', title='Luminosity Block;lb;Events', - path='ToFindThem',xbins=1000,xmin=-0.5,xmax=999.5) - #myGroup.defineHistogram('random', title='LB;x;Events', - # path='ToBringThemAll',xbins=30,xmin=0,xmax=1,opt='kLBNHistoryDepth=10') - #myGroup.defineHistogram('pT_passed,pT',type='TEfficiency',title='Test TEfficiency;x;Eff', - # path='AndInTheDarkness',xbins=100,xmin=0.0,xmax=50.0) - - shifterGroup.defineHistogram('run',title='Run Number;run;Events', - path='SomePath',xbins=1000000,xmin=-0.5,xmax=999999.5) + shifterGroup.defineHistogram('L1_Ex',title='L1 Missing E_{x};E_{x} (GeV);Events', + path='L1',xbins=199,xmin=-298.5,xmax=298.5) + shifterGroup.defineHistogram('L1_Ey',title='L1 Missing E_{y};E_{y} (GeV);Events', + path='L1',xbins=199,xmin=-298.5,xmax=298.5) + shifterGroup.defineHistogram('L1_Et',title='L1 Missing E_{T};E_{T} (GeV);Events', + path='L1',xbins=205,xmin=-13.5,xmax=401.5) + shifterGroup.defineHistogram('cell_Ex',title='cell Missing E_{x};E_{x} (GeV);Events', + path='cell',xbins=199,xmin=-298.5,xmax=298.5) + shifterGroup.defineHistogram('cell_Ey',title='cell Missing E_{y};E_{y} (GeV);Events', + path='cell',xbins=199,xmin=-298.5,xmax=298.5) + shifterGroup.defineHistogram('cell_Et',title='cell Missing E_{T};E_{T} (GeV);Events', + path='cell',xbins=205,xmin=-13.5,xmax=401.5) + expertGroup.defineHistogram('mht_Ex',title='mht Missing E_{x};E_{x} (GeV);Events', + path='mht',xbins=199,xmin=-298.5,xmax=298.5) + expertGroup.defineHistogram('mht_Ey',title='mht Missing E_{y};E_{y} (GeV);Events', + path='mht',xbins=199,xmin=-298.5,xmax=298.5) + expertGroup.defineHistogram('mht_Et', title='mht E_{T};E_{T} (GeV);Events', + path='mht',xbins=205,xmin=-13.5,xmax=401.5) ### STEP 6 ### # Finalize. The return value should be a tuple of the ComponentAccumulator diff --git a/Trigger/TrigMonitoring/TrigMETMonitoring/python/TrigMETMonitoringConfig.py b/Trigger/TrigMonitoring/TrigMETMonitoring/python/TrigMETMonitoringConfig.py index 6531fd845578c83ccb3092e028876fda28ee8b5a..ddf43f9f147651c8638563a8d361cb02458d5ebc 100644 --- a/Trigger/TrigMonitoring/TrigMETMonitoring/python/TrigMETMonitoringConfig.py +++ b/Trigger/TrigMonitoring/TrigMETMonitoring/python/TrigMETMonitoringConfig.py @@ -103,29 +103,3 @@ def HLTMETMonitoringTool(): #ToolSvc += HLTMETMon; list = [ HLTMETMon ]; return list - -def TrigMETMonitoringTool(): - from TrigMETMonitoring.TrigMETMonitoringConf import HLTMETMonTool - from TrigHLTMonitoring.HLTMonTriggerList import hltmonList # access to central tool - print "shifter list " - print hltmonList.monitoring_met_shifter - HLTMETMon = HLTMETMonTool(name = 'HLTMETMon', - histoPathBase = "/Trigger/HLT", - MonPathBase = "/HLT/METMon", - comp_names = compNames_all, - bit_names = bitNames_allHLT, - monitoring_met_shifter = hltmonList.monitoring_met_shifter, - monitoring_met_expert = hltmonList.monitoring_met_expert, - monitoring_alg = met_alt_algorithms_shifter, - monitoring_alg_shifter = met_alt_algorithms_shifter, - monitoring_alg_expert = met_alt_algorithms_expert, - muon_base = "HLT_mu26", - muon_pt_thresh = 18, - electron_pt_thresh = 20, - primary_met = ["pufit"], - prescaled_met = [], - ); - from AthenaCommon.AppMgr import ToolSvc - #ToolSvc += HLTMETMon; - list = [ HLTMETMon ]; - return list diff --git a/Trigger/TrigMonitoring/TrigMETMonitoring/share/TrigMETMonitorAlgorithm_jobOptions.py b/Trigger/TrigMonitoring/TrigMETMonitoring/share/TrigMETMonitorAlgorithm_jobOptions.py index cb03990655cc0ea4bae0dee1e8e560b60728db5d..51930780bb65b442388b1b6456144793834a846b 100644 --- a/Trigger/TrigMonitoring/TrigMETMonitoring/share/TrigMETMonitorAlgorithm_jobOptions.py +++ b/Trigger/TrigMonitoring/TrigMETMonitoring/share/TrigMETMonitorAlgorithm_jobOptions.py @@ -24,13 +24,10 @@ from TrigMETMonitoring.TrigMETMonitoringConf import TrigMETMonitorAlgorithm trigMETMonAlg = helper.addAlgorithm(TrigMETMonitorAlgorithm,'TrigMETMonAlg') # Examples of setting a trigger, or of running with debug messages on -#trigMETMonAlg.TriggerChain = 'HLT_mu26_ivarmedium' +#trigMETMonAlg.TriggerChain = 'HLT_xe30_cell_L1XE10' #trigMETMonAlg.OutputLevel = DEBUG -myGroup = helper.addGroup( trigMETMonAlg, - "TrigMETMonitor", - "HLT/METMon/Expert" - ) +myGroup = helper.addGroup( trigMETMonAlg,"TrigMETMonitor","HLT/METMon/Expert") myGroup.defineHistogram("lumiPerBCID;lumiPerBCID", title="Luminosity;L/BCID;Events", path='lumi',xbins=10,xmin=0.0,xmax=10.0) diff --git a/Trigger/TrigMonitoring/TrigMETMonitoring/src/TrigMETMonitorAlgorithm.cxx b/Trigger/TrigMonitoring/TrigMETMonitoring/src/TrigMETMonitorAlgorithm.cxx index 45aac3edbf7cd3f8de2deb07a58b68fc940dc262..400c3ffd362c7a931611e005cf14056dd7c12fed 100644 --- a/Trigger/TrigMonitoring/TrigMETMonitoring/src/TrigMETMonitorAlgorithm.cxx +++ b/Trigger/TrigMonitoring/TrigMETMonitoring/src/TrigMETMonitorAlgorithm.cxx @@ -6,13 +6,24 @@ TrigMETMonitorAlgorithm::TrigMETMonitorAlgorithm( const std::string& name, ISvcLocator* pSvcLocator ) : AthMonitorAlgorithm(name,pSvcLocator) -{} + , m_lvl1_roi_key("LVL1EnergySumRoI") + , m_hlt_cell_met_key("HLT_xAOD__TrigMissingETContainer_TrigEFMissingET") + , m_hlt_mht_met_key("HLT_xAOD__TrigMissingETContainer_TrigEFMissingET_mht") +{ + declareProperty("l1_roi_key", m_lvl1_roi_key); + declareProperty("hlt_cell_key", m_hlt_cell_met_key); + declareProperty("hlt_mht_key", m_hlt_mht_met_key); +} TrigMETMonitorAlgorithm::~TrigMETMonitorAlgorithm() {} StatusCode TrigMETMonitorAlgorithm::initialize() { + ATH_CHECK( m_lvl1_roi_key.initialize() ); + ATH_CHECK( m_hlt_cell_met_key.initialize() ); + ATH_CHECK( m_hlt_mht_met_key.initialize() ); + return AthMonitorAlgorithm::initialize(); } @@ -20,28 +31,69 @@ StatusCode TrigMETMonitorAlgorithm::initialize() { StatusCode TrigMETMonitorAlgorithm::fillHistograms( const EventContext& ctx ) const { using namespace Monitored; - // Declare the quantities which should be monitored - //NB! The variables and histograms defined here must match the ones in the py file exactly! - auto lumiPerBCID = Monitored::Scalar<float>("lumiPerBCID",0.0); - auto lb = Monitored::Scalar<int>("lb",0); - auto run = Monitored::Scalar<int>("run",0); + // access met containers + SG::ReadHandle<xAOD::EnergySumRoI> l1_roi_cont(m_lvl1_roi_key, ctx); + if (! l1_roi_cont.isValid() ) { + ATH_MSG_ERROR("evtStore() does not contain L1 MET Collection with name "<< m_lvl1_roi_key); + return StatusCode::FAILURE; + } + SG::ReadHandle<xAOD::TrigMissingETContainer> hlt_cell_met_cont(m_hlt_cell_met_key, ctx); + if (! hlt_cell_met_cont.isValid() ) { + ATH_MSG_ERROR("evtStore() does not contain HLT MET Collection with name "<< m_hlt_cell_met_key); + return StatusCode::FAILURE; + } + SG::ReadHandle<xAOD::TrigMissingETContainer> hlt_mht_met_cont(m_hlt_mht_met_key, ctx); + if (! hlt_mht_met_cont.isValid() ) { + ATH_MSG_ERROR("evtStore() does not contain HLT MET Collection with name "<< m_hlt_mht_met_key); + return StatusCode::FAILURE; + } + + // define TrigMissingET objet + const xAOD::TrigMissingET *hlt_met = 0; - // Two variables (value and passed) needed for TEfficiency - auto pT = Monitored::Scalar<float>("pT",0.0); - auto pT_passed = Monitored::Scalar<float>("pT_passed",false); + // define variables + auto L1_Ex = Monitored::Scalar<float>("L1_Ex",0.0); + auto L1_Ey = Monitored::Scalar<float>("L1_Ey",0.0); + auto L1_Et = Monitored::Scalar<float>("L1_Et",0.0); + auto cell_Ex = Monitored::Scalar<float>("cell_Ex",0.0); + auto cell_Ey = Monitored::Scalar<float>("cell_Ey",0.0); + auto cell_Et = Monitored::Scalar<float>("cell_Et",0.0); + auto mht_Ex = Monitored::Scalar<float>("mht_Ex",0.0); + auto mht_Ey = Monitored::Scalar<float>("mht_Ey",0.0); + auto mht_Et = Monitored::Scalar<float>("mht_Et",0.0); + + // access L1 MET values + if ( l1_roi_cont.isValid() ) { + if ((l1_roi_cont->energyX())>-9e12 && (l1_roi_cont->energyX())<9e12 && (l1_roi_cont->energyY())>-9e12 && (l1_roi_cont->energyY())<9e12) { + L1_Ex = - (l1_roi_cont->energyX())/1000.; + L1_Ey = - (l1_roi_cont->energyY())/1000.; + L1_Et = sqrt(L1_Ex*L1_Ex + L1_Ey*L1_Ey); + } + } + + // access HLT cell MET values + if (! hlt_cell_met_cont.isValid() ) { + hlt_met = hlt_cell_met_cont->at(0); + cell_Ex = (hlt_met->ex())/1000.; + cell_Ey = (hlt_met->ey())/1000.; + cell_Et = sqrt(cell_Ex*cell_Ex + cell_Ey*cell_Ey); + } + + // access HLT mht MET values + if (! hlt_mht_met_cont.isValid() ) { + hlt_met = hlt_mht_met_cont->at(0); + mht_Ex = (hlt_met->ex())/1000.; + mht_Ey = (hlt_met->ey())/1000.; + mht_Et = sqrt(mht_Ex*mht_Ex + mht_Ey*mht_Ey); + } - //// Set the values of the monitored variables for the event - lumiPerBCID = lbAverageInteractionsPerCrossing(); - lb = GetEventInfo(ctx)->lumiBlock(); - run = GetEventInfo(ctx)->runNumber(); - // Fill. First argument is the tool (GMT) name as defined in the py file, // all others are the variables to be saved. - fill("TrigMETMonitor",lumiPerBCID,lb); + fill("TrigMETMonitor",L1_Ex,L1_Ey,L1_Et,cell_Ex,cell_Ey,cell_Et); // Alternative fill method. Get the group yourself, and pass it to the fill function. auto tool = getGroup("TrigMETMonitor"); - fill(tool,run); + fill(tool,mht_Ex,mht_Ey,mht_Et); return StatusCode::SUCCESS; } diff --git a/Trigger/TrigMonitoring/TrigMETMonitoring/src/TrigMETMonitorAlgorithm.h b/Trigger/TrigMonitoring/TrigMETMonitoring/src/TrigMETMonitorAlgorithm.h index e9098ec5aa9452fada22a777b4989ab217e645a1..cd2c1e06d255892b934f4894566ac3b990587d78 100644 --- a/Trigger/TrigMonitoring/TrigMETMonitoring/src/TrigMETMonitorAlgorithm.h +++ b/Trigger/TrigMonitoring/TrigMETMonitoring/src/TrigMETMonitorAlgorithm.h @@ -8,6 +8,11 @@ #include "AthenaMonitoring/AthMonitorAlgorithm.h" #include "AthenaMonitoring/Monitored.h" +#include "StoreGate/ReadHandleKey.h" +#include "xAODTrigger/EnergySumRoI.h" +#include "xAODTrigMissingET/TrigMissingETContainer.h" +#include "xAODTrigMissingET/TrigMissingETAuxContainer.h" + class TrigMETMonitorAlgorithm : public AthMonitorAlgorithm { public: @@ -15,5 +20,13 @@ class TrigMETMonitorAlgorithm : public AthMonitorAlgorithm { virtual ~TrigMETMonitorAlgorithm(); virtual StatusCode initialize() override; virtual StatusCode fillHistograms( const EventContext& ctx ) const override; + + private: + SG::ReadHandleKey<xAOD::EnergySumRoI> m_lvl1_roi_key; + SG::ReadHandleKey<xAOD::TrigMissingETContainer> m_hlt_cell_met_key; + SG::ReadHandleKey<xAOD::TrigMissingETContainer> m_hlt_mht_met_key; + + + }; #endif