diff --git a/Trigger/TrigMonitoring/TrigMETMonitoring/python/TrigMETMonitorAlgorithm.py b/Trigger/TrigMonitoring/TrigMETMonitoring/python/TrigMETMonitorAlgorithm.py index dbdc5793f3dc716b5442beba08444680d64e76ca..097e471147a8be9a9a6c7841aad3b84fb6d24ae8 100644 --- a/Trigger/TrigMonitoring/TrigMETMonitoring/python/TrigMETMonitorAlgorithm.py +++ b/Trigger/TrigMonitoring/TrigMETMonitoring/python/TrigMETMonitorAlgorithm.py @@ -29,7 +29,7 @@ def TrigMETMonConfig(inputFlags): #The added algorithm must exist as a .h file from TrigMETMonitoring.TrigMETMonitoringConf import TrigMETMonitorAlgorithm - expertTrigMETMonAlg = helper.addAlgorithm(TrigMETMonitorAlgorithm,'TrigMETMonAlg') + expertTrigMETMonAlg = helper.addAlgorithm(TrigMETMonitorAlgorithm,'expertTrigMETMonAlg') # You can actually make multiple instances of the same algorithm and give # them different configurations @@ -46,8 +46,22 @@ def TrigMETMonConfig(inputFlags): # some generic property # expertTrigMETMonAlg.RandomHist = True # to enable a trigger filter, for example: - #expertTrigMETMonAlg.TriggerChain = 'HLT_mu26_ivarmedium' - expertTrigMETMonAlg.TriggerChain = 'HLT_xe30_cell_L1XE10' + # expertTrigMETMonAlg.TriggerChain = 'HLT_xe30_cell_L1XE10' + # shifterTrigMETMonAlg.TriggerChain = 'HLT_xe30_cell_L1XE10' + # without filters, all events are processed. + + ### use the follwoing if you run on Run2 AOD + #expertTrigMETMonAlg.TriggerChain = 'HLT_xe110_pufit_xe65_L1XE50' + #expertTrigMETMonAlg.hlt_cell_key = 'HLT_xAOD__TrigMissingETContainer_TrigEFMissingET' + #expertTrigMETMonAlg.hlt_mt_key = 'HLT_xAOD__TrigMissingETContainer_TrigEFMissingET_mht' + #expertTrigMETMonAlg.hlt_tc_key = 'HLT_xAOD__TrigMissingETContainer_TrigEFMissingET_topocl' + #expertTrigMETMonAlg.hlt_tcpufit_key = 'HLT_xAOD__TrigMissingETContainer_TrigEFMissingET_topocl_PUC' + #shifterTrigMETMonAlg.hlt_cell_key = 'HLT_xAOD__TrigMissingETContainer_TrigEFMissingET' + #shifterTrigMETMonAlg.hlt_mt_key = 'HLT_xAOD__TrigMissingETContainer_TrigEFMissingET_mht' + #shifterTrigMETMonAlg.hlt_tc_key = 'HLT_xAOD__TrigMissingETContainer_TrigEFMissingET_topocl' + #shifterTrigMETMonAlg.hlt_tcpufit_key = 'HLT_xAOD__TrigMissingETContainer_TrigEFMissingET_topocl_PUC' + + ### STEP 4 ### # Add some tools. N.B. Do not use your own trigger decion tool. Use the @@ -77,23 +91,35 @@ def TrigMETMonConfig(inputFlags): # Configure histograms #NB! The histograms defined here must match the ones in the cxx file exactly shifterGroup.defineHistogram('L1_Ex',title='L1 Missing E_{x};E_{x} (GeV);Events', - path='L1',xbins=199,xmin=-298.5,xmax=298.5) + 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) + 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) + 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) + 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) + 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) + path='cell',xbins=205,xmin=-13.5,xmax=401.5) + shifterGroup.defineHistogram('tcpufit_Ex',title='tcpufit Missing E_{x};E_{x} (GeV);Events', + path='tcpufit',xbins=199,xmin=-298.5,xmax=298.5) + shifterGroup.defineHistogram('tcpufit_Ey',title='tcpufit Missing E_{y};E_{y} (GeV);Events', + path='tcpufit',xbins=199,xmin=-298.5,xmax=298.5) + shifterGroup.defineHistogram('tcpufit_Et',title='tcpufit Missing E_{T};E_{T} (GeV);Events', + path='tcpufit',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) + 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) + 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) + path='mht',xbins=205,xmin=-13.5,xmax=401.5) + expertGroup.defineHistogram('tc_Ex',title='tc Missing E_{x};E_{x} (GeV);Events', + path='tc',xbins=199,xmin=-298.5,xmax=298.5) + expertGroup.defineHistogram('tc_Ey',title='tc Missing E_{y};E_{y} (GeV);Events', + path='tc',xbins=199,xmin=-298.5,xmax=298.5) + expertGroup.defineHistogram('tc_Et', title='tc E_{T};E_{T} (GeV);Events', + path='tc',xbins=205,xmin=-13.5,xmax=401.5) ### STEP 6 ### # Finalize. The return value should be a tuple of the ComponentAccumulator @@ -116,8 +142,9 @@ if __name__=='__main__': from AthenaConfiguration.AllConfigFlags import ConfigFlags nightly = '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CommonInputs/' file = 'data16_13TeV.00311321.physics_Main.recon.AOD.r9264/AOD.11038520._000001.pool.root.1' - ConfigFlags.Input.Files = [nightly+file] - ConfigFlags.Input.isMC = False + #ConfigFlags.Input.Files = [nightly+file] + ConfigFlags.Input.Files = ['/hep300/data/khamano/data18_athenaMT/fromElin/AOD_old.pool.root'] + ConfigFlags.Input.isMC = True ConfigFlags.Output.HISTFileName = 'TrigMETMonitorOutput.root' ConfigFlags.lock() diff --git a/Trigger/TrigMonitoring/TrigMETMonitoring/share/TrigMETMonitorAlgorithm_jobOptions.py b/Trigger/TrigMonitoring/TrigMETMonitoring/share/TrigMETMonitorAlgorithm_jobOptions.py index ed28e0abffcb7923bd881364624e57e669a7a354..7edeb674fcbaa9dec73c33c164bc8e236859e9dc 100644 --- a/Trigger/TrigMonitoring/TrigMETMonitoring/share/TrigMETMonitorAlgorithm_jobOptions.py +++ b/Trigger/TrigMonitoring/TrigMETMonitoring/share/TrigMETMonitorAlgorithm_jobOptions.py @@ -11,10 +11,10 @@ # The following class will make a sequence, configure algorithms, and link # them to GenericMonitoringTools -#from AthenaMonitoring import AthMonitorCfgHelperOld -#helper = AthMonitorCfgHelperOld(DQMonFlags, "TrigMETMonitor") -from AthenaMonitoring import AthMonitorCfgHelper -helper = AthMonitorCfgHelper(DQMonFlags, "TrigMETMonitor") +from AthenaMonitoring import AthMonitorCfgHelperOld +helper = AthMonitorCfgHelperOld(DQMonFlags, "TrigMETMonitor") +#from AthenaMonitoring import AthMonitorCfgHelper +#helper = AthMonitorCfgHelper(DQMonFlags, "TrigMETMonitor") ### STEP 2 ### # Adding an algorithm to the helper. Here, we will use the example diff --git a/Trigger/TrigMonitoring/TrigMETMonitoring/src/TrigMETMonitorAlgorithm.cxx b/Trigger/TrigMonitoring/TrigMETMonitoring/src/TrigMETMonitorAlgorithm.cxx index 29d70753a95d10adb7a8903a5ac81ea0b2301cd3..26dabaade009a3f6bd03f170621017e2f991fed4 100644 --- a/Trigger/TrigMonitoring/TrigMETMonitoring/src/TrigMETMonitorAlgorithm.cxx +++ b/Trigger/TrigMonitoring/TrigMETMonitoring/src/TrigMETMonitorAlgorithm.cxx @@ -7,12 +7,17 @@ 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") + , m_hlt_cell_met_key("HLT_MET_cell") + , m_hlt_mht_met_key("HLT_MET_mht") + , m_hlt_tc_met_key("HLT_MET_tc") + , m_hlt_tcpufit_met_key("HLT_MET_tcPufit") + , m_trigDecTool("Trig::TrigDecisionTool/TrigDecisionTool") { 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); + declareProperty("hlt_tc_key", m_hlt_tc_met_key); + declareProperty("hlt_tcpufit_key", m_hlt_tcpufit_met_key); } @@ -23,6 +28,10 @@ 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() ); + ATH_CHECK( m_hlt_tc_met_key.initialize() ); + ATH_CHECK( m_hlt_tcpufit_met_key.initialize() ); + + ATH_CHECK( m_trigDecTool.retrieve() ); return AthMonitorAlgorithm::initialize(); } @@ -33,22 +42,36 @@ StatusCode TrigMETMonitorAlgorithm::fillHistograms( const EventContext& ctx ) co // 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; + if (! l1_roi_cont.isValid() ) { + ATH_MSG_WARNING("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; + if (hlt_cell_met_cont->size()==0 || ! hlt_cell_met_cont.isValid() ) { + ATH_MSG_WARNING("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; + if (hlt_mht_met_cont->size()==0 || ! hlt_mht_met_cont.isValid() ) { + ATH_MSG_WARNING("evtStore() does not contain HLT MET Collection with name "<< m_hlt_mht_met_key); + //return StatusCode::FAILURE; + } + + SG::ReadHandle<xAOD::TrigMissingETContainer> hlt_tc_met_cont(m_hlt_tc_met_key, ctx); + if (hlt_tc_met_cont->size()==0 || ! hlt_tc_met_cont.isValid() ) { + ATH_MSG_WARNING("evtStore() does not contain HLT MET Collection with name "<< m_hlt_tc_met_key); + //return StatusCode::FAILURE; + } + + SG::ReadHandle<xAOD::TrigMissingETContainer> hlt_tcpufit_met_cont(m_hlt_tcpufit_met_key, ctx); + if (hlt_tcpufit_met_cont->size()==0 || ! hlt_tcpufit_met_cont.isValid() ) { + ATH_MSG_WARNING("evtStore() does not contain HLT MET Collection with name "<< m_hlt_tcpufit_met_key); + //return StatusCode::FAILURE; } - // define TrigMissingET objet + // define TrigMissingET object const xAOD::TrigMissingET *hlt_met = 0; // define variables @@ -61,9 +84,15 @@ StatusCode TrigMETMonitorAlgorithm::fillHistograms( const EventContext& ctx ) co 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); + auto tc_Ex = Monitored::Scalar<float>("tc_Ex",0.0); + auto tc_Ey = Monitored::Scalar<float>("tc_Ey",0.0); + auto tc_Et = Monitored::Scalar<float>("tc_Et",0.0); + auto tcpufit_Ex = Monitored::Scalar<float>("tcpufit_Ex",0.0); + auto tcpufit_Ey = Monitored::Scalar<float>("tcpufit_Ey",0.0); + auto tcpufit_Et = Monitored::Scalar<float>("tcpufit_Et",0.0); // access L1 MET values - // The follosing code was commented till we can get a proper input AOD file + // The following code was commented till we can get a proper input AOD file /* 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) { @@ -75,7 +104,7 @@ StatusCode TrigMETMonitorAlgorithm::fillHistograms( const EventContext& ctx ) co */ // access HLT cell MET values - if (! hlt_cell_met_cont.isValid() ) { + if ( hlt_cell_met_cont->size() > 0 && 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.; @@ -83,20 +112,74 @@ StatusCode TrigMETMonitorAlgorithm::fillHistograms( const EventContext& ctx ) co } // access HLT mht MET values - if (! hlt_mht_met_cont.isValid() ) { + if ( hlt_mht_met_cont->size() > 0 && 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); } + // access HLT tclcw MET values + if ( hlt_tc_met_cont->size() > 0 && hlt_tc_met_cont.isValid() ) { + hlt_met = hlt_tc_met_cont->at(0); + tc_Ex = (hlt_met->ex())/1000.; + tc_Ey = (hlt_met->ey())/1000.; + tc_Et = sqrt(tc_Ex*tc_Ex + tc_Ey*tc_Ey); + } + + // access HLT tcPufit MET values + if ( hlt_tcpufit_met_cont->size() > 0 && hlt_tcpufit_met_cont.isValid() ) { + hlt_met = hlt_tcpufit_met_cont->at(0); + tcpufit_Ex = (hlt_met->ex())/1000.; + tcpufit_Ey = (hlt_met->ey())/1000.; + tcpufit_Et = sqrt(tcpufit_Ex*tcpufit_Ex + tcpufit_Ey*tcpufit_Ey); + } + + + // TDT test + if (m_trigDecTool->isPassed("HLT_xe30_cell_L1XE10")) { + ATH_MSG_DEBUG("passed HLT_xe30_cell_L1XE10"); + } else { + ATH_MSG_DEBUG("not passed HLT_xe30_cell_L1XE10"); + } + if (m_trigDecTool->isPassed("HLT_xe30_cell_xe30_tcpufit_L1XE10")) { + ATH_MSG_DEBUG("passed HLT_xe30_cell_xe30_tcpufit_L1XE10"); + } else { + ATH_MSG_DEBUG("not passed HLT_xe30_cell_xe30_tcpufit_L1XE10"); + } + if (m_trigDecTool->isPassed("HLT_xe30_tcpufit_L1XE10")) { + ATH_MSG_DEBUG("passed HLT_xe30_tcpufit_L1XE10"); + } else { + ATH_MSG_DEBUG("not passed HLT_xe30_tcpufit_L1XE10"); + } + if (m_trigDecTool->isPassed(m_triggerChainString)) { + ATH_MSG_DEBUG("passed " << m_triggerChainString); + } else { + ATH_MSG_DEBUG("not passed " << m_triggerChainString); + } + + // check active triggers + // This does not work for now + /* + auto chaingroup = m_trigDecTool->getChainGroup("HLT_xe.*"); + for(auto &trig : chainGroup->getListOfTriggers()) { + auto cg = m_trigDecTool->getChainGroup(trig); + std::string thisTrig = trig; + ATH_MSG_DEBUG (thisTrig << " chain prescale = " << cg->getPrescale()); + } + */ + + // Fill. First argument is the tool (GMT) name as defined in the py file, // all others are the variables to be saved. - fill("TrigMETMonitor",L1_Ex,L1_Ey,L1_Et,cell_Ex,cell_Ey,cell_Et); + fill("TrigMETMonitor",L1_Ex,L1_Ey,L1_Et); // Alternative fill method. Get the group yourself, and pass it to the fill function. auto tool = getGroup("TrigMETMonitor"); + fill(tool,cell_Ex,cell_Ey,cell_Et); fill(tool,mht_Ex,mht_Ey,mht_Et); + fill(tool,tc_Ex,tc_Ey,tc_Et); + fill(tool,tcpufit_Ex,tcpufit_Ey,tcpufit_Et); return StatusCode::SUCCESS; } diff --git a/Trigger/TrigMonitoring/TrigMETMonitoring/src/TrigMETMonitorAlgorithm.h b/Trigger/TrigMonitoring/TrigMETMonitoring/src/TrigMETMonitorAlgorithm.h index cd2c1e06d255892b934f4894566ac3b990587d78..1e03660c7cf8fc071219b72ab6f3e8d58e986a1b 100644 --- a/Trigger/TrigMonitoring/TrigMETMonitoring/src/TrigMETMonitorAlgorithm.h +++ b/Trigger/TrigMonitoring/TrigMETMonitoring/src/TrigMETMonitorAlgorithm.h @@ -13,6 +13,8 @@ #include "xAODTrigMissingET/TrigMissingETContainer.h" #include "xAODTrigMissingET/TrigMissingETAuxContainer.h" +//#include "TrigDecisionTool/TrigDecisionTool.h" +#include "TrigDecisionInterface/ITrigDecisionTool.h" class TrigMETMonitorAlgorithm : public AthMonitorAlgorithm { public: @@ -23,10 +25,15 @@ class TrigMETMonitorAlgorithm : public AthMonitorAlgorithm { 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; + SG::ReadHandleKey<xAOD::TrigMissingETContainer> m_hlt_tc_met_key; + SG::ReadHandleKey<xAOD::TrigMissingETContainer> m_hlt_tcpufit_met_key; - + ToolHandle<Trig::ITrigDecisionTool> m_trigDecTool; + //ToolHandle<Trig::ITrigDecisionTool> m_trigDecTool{this, "TrigDecisionTool",""}; + }; #endif