diff --git a/Trigger/TrigMonitoring/TrigSteerMonitor/CMakeLists.txt b/Trigger/TrigMonitoring/TrigSteerMonitor/CMakeLists.txt index 55999b19f00b79eea8ee8df5603ee8bb9717fe4f..02e2b05053097a205ba34344f836448113d25164 100644 --- a/Trigger/TrigMonitoring/TrigSteerMonitor/CMakeLists.txt +++ b/Trigger/TrigMonitoring/TrigSteerMonitor/CMakeLists.txt @@ -1,3 +1,4 @@ +# $Id: CMakeLists.txt 780092 2016-10-24 15:34:49Z krasznaa $ ################################################################################ # Package: TrigSteerMonitor ################################################################################ @@ -6,27 +7,27 @@ atlas_subdir( TrigSteerMonitor ) # Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - GaudiKernel - PRIVATE - Control/AthenaKernel - Control/AthenaMonitoring - Event/EventInfo - Trigger/TrigConfiguration/TrigConfInterfaces - Trigger/TrigDataAccess/TrigDataAccessMonitoring - Trigger/TrigMonitoring/TrigMonitorBase - Trigger/TrigSteer/TrigSteering - Control/StoreGate - Event/xAOD/xAODEventInfo - MagneticField/MagFieldInterfaces - LumiBlock/LumiBlockComps - Trigger/TrigConfiguration/TrigConfHLTData - Trigger/TrigConfiguration/TrigConfL1Data - Trigger/TrigEvent/TrigNavigation - Trigger/TrigEvent/TrigSteeringEvent - Trigger/TrigSteer/TrigInterfaces - Trigger/TrigT1/TrigT1Interfaces - Trigger/TrigT1/TrigT1Result ) +atlas_depends_on_subdirs( + PRIVATE + GaudiKernel + Control/AthenaKernel + Control/AthenaMonitoring + Event/EventInfo + Trigger/TrigConfiguration/TrigConfInterfaces + Trigger/TrigDataAccess/TrigDataAccessMonitoring + Trigger/TrigMonitoring/TrigMonitorBase + Trigger/TrigSteer/TrigSteering + Control/StoreGate + Event/xAOD/xAODEventInfo + MagneticField/MagFieldInterfaces + LumiBlock/LumiBlockComps + Trigger/TrigConfiguration/TrigConfHLTData + Trigger/TrigConfiguration/TrigConfL1Data + Trigger/TrigEvent/TrigNavigation + Trigger/TrigEvent/TrigSteeringEvent + Trigger/TrigSteer/TrigInterfaces + Trigger/TrigT1/TrigT1Interfaces + Trigger/TrigT1/TrigT1Result ) # External dependencies: find_package( Boost COMPONENTS filesystem thread system ) @@ -35,13 +36,16 @@ find_package( tdaq-common ) # Component(s) in the package: atlas_add_component( TrigSteerMonitor - src/*.cxx - src/components/*.cxx - INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${TDAQ-COMMON_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} AthenaKernel AthenaMonitoringLib EventInfo GaudiKernel TrigDataAccessMonitoringLib TrigMonitorBaseLib TrigSteeringLib StoreGateLib SGtests MagFieldInterfaces LumiBlockComps TrigConfHLTData TrigConfL1Data TrigNavigationLib TrigSteeringEvent TrigInterfacesLib TrigT1Interfaces TrigT1Result ) + src/*.h src/*.cxx src/components/*.cxx + INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} + ${TDAQ-COMMON_INCLUDE_DIRS} + LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} + ${TDAQ-COMMON_LIBRARIES} AthenaKernel AthenaMonitoringLib EventInfo + GaudiKernel TrigDataAccessMonitoringLib TrigMonitorBaseLib TrigSteeringLib + StoreGateLib MagFieldInterfaces LumiBlockCompsLib TrigConfHLTData + TrigConfL1Data TrigNavigationLib TrigSteeringEvent TrigInterfacesLib + TrigT1Interfaces TrigT1Result ) # Install files from the package: -atlas_install_headers( TrigSteerMonitor ) atlas_install_python_modules( python/*.py ) atlas_install_joboptions( share/*.py ) - diff --git a/Trigger/TrigMonitoring/TrigSteerMonitor/python/TrigSteerMonitorConfig.py b/Trigger/TrigMonitoring/TrigSteerMonitor/python/TrigSteerMonitorConfig.py index 6c86bd6cebf959489beaaad1c539532dd5e3289d..70bd2013886c74c3441a64475f186884d3a97f82 100644 --- a/Trigger/TrigMonitoring/TrigSteerMonitor/python/TrigSteerMonitorConfig.py +++ b/Trigger/TrigMonitoring/TrigSteerMonitor/python/TrigSteerMonitorConfig.py @@ -159,7 +159,7 @@ class TrigMemMonitor(TrigMemMoni): theApp.AuditAlgorithms = True def target(self): - return [ "OnlineDetail" ] + return [ "Online" ] class TrigROBMoniConfig(TrigROBMoni): """ ROB request monitor for online use """ @@ -188,6 +188,7 @@ TrigSteerMonitorToolList = [ TrigChainMoniConfigValidation(), TrigSignatureMoniConfigOnline(), TrigTEMoniConfigOnline(), TrigOpMonitor(), + TrigMemMonitor(), TrigROBMoniConfig(), TrigCorMonitor() ] diff --git a/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigCorMoni.cxx b/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigCorMoni.cxx index 003e052512921611e6bbaeca7fe9a528a7ffa1e2..c3e8edd9b7c4278644da8c4bf8015d0ffabab710 100644 --- a/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigCorMoni.cxx +++ b/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigCorMoni.cxx @@ -193,27 +193,22 @@ StatusCode TrigCorMoni::bookHists() // Make map from HLT chains to CTP ids // unsigned chain_bin = 0; - - for( std::map<std::string, TrigConf::HLTChain *>::const_iterator ich = chains.begin(); - ich != chains.end(); ich++) { - //for(unsigned i = 0; i < chains.size(); ++i) { - //const TrigConf::HLTChain *chain = chains.at(i); - const TrigConf::HLTChain *chain = ich->second; - if(!chain) { + for (const auto& ch : chains) { // std::map<std::string, TrigConf::HLTChain *> + if(!ch.second) { ATH_MSG_WARNING("Null HLTChain pointer"); continue; } - const std::vector<const TrigConf::TriggerItem *> items = FindL1Items(*chain); - Data &data = m_hash2chain[chain->chain_hash_id()]; + const std::vector<const TrigConf::TriggerItem *> items = FindL1Items(*ch.second); + Data &data = m_hash2chain[ch.second->chain_hash_id()]; for(unsigned t = 0; t < items.size(); ++t) { data.ctpids.insert(items.at(t)->ctpId()); } data.bin = ++chain_bin; - m_acceptL1->GetYaxis()->SetBinLabel(data.bin, ich->first.c_str()); + m_acceptL1->GetYaxis()->SetBinLabel(data.bin, ch.first.c_str()); } return StatusCode::SUCCESS; diff --git a/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigMemAuditor.cxx b/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigMemAuditor.cxx index 6f6135b9f710b2c870f1511114024664ff320694..2a576979b49c4388135d2f90d7933d6870171e15 100644 --- a/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigMemAuditor.cxx +++ b/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigMemAuditor.cxx @@ -67,7 +67,7 @@ StatusCode TrigMemAuditor::queryInterface( const InterfaceID& riid, void** ppvIf { if(riid == ITrigMemAuditor::interfaceID()) { - *ppvIf = (ITrigMemAuditor*)this; + *ppvIf = static_cast<ITrigMemAuditor*>(this); addRef(); return StatusCode::SUCCESS; } diff --git a/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigMemMoni.cxx b/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigMemMoni.cxx index 4b9915aa8b09306c6856dfc884ba1249aff01582..4ea4da7d38232cebd61b99d7dd1b173b0a58f832 100644 --- a/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigMemMoni.cxx +++ b/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigMemMoni.cxx @@ -125,7 +125,7 @@ StatusCode TrigMemMoni::initialize() return StatusCode::FAILURE; } - else pTrigMemAudit->regclient((ITrigMemMoni*)this); + else pTrigMemAudit->regclient(static_cast<ITrigMemMoni*>(this)); return StatusCode::SUCCESS; } @@ -289,7 +289,7 @@ StatusCode TrigMemMoni::queryInterface( const InterfaceID& riid, void** ppvIf ) { if(riid == ITrigMemMoni::interfaceID()) { - *ppvIf = (ITrigMemMoni*)this; + *ppvIf = static_cast<ITrigMemMoni*>(this); addRef(); return StatusCode::SUCCESS; } diff --git a/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigOpMoni.cxx b/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigOpMoni.cxx index 41bd2cf2b93f9f5c59a5233f5ac8f088075dc66f..52c2ac148db8de79b98899b119144605f4c1feb5 100644 --- a/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigOpMoni.cxx +++ b/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigOpMoni.cxx @@ -198,7 +198,6 @@ void TrigOpMoni::FillIOVDbHist() // create and fill histogram for IOVDb entries vector<string> KeyList(m_IOVDbSvc->getKeyList()); - vector<string>::iterator KeyListIter; ostringstream TmpStream; string FolderName; string Tag; @@ -216,11 +215,11 @@ void TrigOpMoni::FillIOVDbHist() IOVDbReadTimeHist->SetYTitle("Update time [ms]"); // fill histograms - for(KeyListIter = KeyList.begin(); KeyListIter != KeyList.end(); KeyListIter++) { + for(const string& key : KeyList) { - if(m_IOVDbSvc->getKeyInfo(*KeyListIter, FolderName, Tag, Range, Retrieved, bytesRead, readTime) && Retrieved) { + if(m_IOVDbSvc->getKeyInfo(key, FolderName, Tag, Range, Retrieved, bytesRead, readTime) && Retrieved) { - m_currentIOVs[*KeyListIter] = Range; + m_currentIOVs[key] = Range; IOVTime StartTime(Range.start()); IOVTime StopTime(Range.stop()); @@ -332,23 +331,22 @@ void TrigOpMoni::FillIOVDbChangeHist() float readTime; vector<string> keys(m_IOVDbSvc->getKeyList()); - vector<string>::const_iterator k; // Loop over all keys known to IOVDbSvc - for(k = keys.begin(); k != keys.end(); k++) { - if ( not m_IOVDbSvc->getKeyInfo(*k, folder, tag, iov, retrieved, bytesRead, readTime) ) + for(const string& k : keys) { + if ( not m_IOVDbSvc->getKeyInfo(k, folder, tag, iov, retrieved, bytesRead, readTime) ) continue; if ( not retrieved ) continue; - map<string,IOVRange>::const_iterator curIOV = m_currentIOVs.find(*k); + map<string,IOVRange>::const_iterator curIOV = m_currentIOVs.find(k); if ( curIOV == m_currentIOVs.end() ) { - m_currentIOVs[*k] = iov; + m_currentIOVs[k] = iov; continue; } // Print IOV changes and fill histogram if ( iov != curIOV->second ) { - ATH_MSG_INFO("IOV of " << *k << " changed from " << curIOV->second + ATH_MSG_INFO("IOV of " << k << " changed from " << curIOV->second << " to " << iov << " on event: " << *m_pEvent->event_ID() ); @@ -386,7 +384,7 @@ void TrigOpMoni::FillIOVDbChangeHist() h->second.total_bytes += bytesRead; } - m_currentIOVs[*k] = iov; + m_currentIOVs[k] = iov; } } } diff --git a/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigRateMoni.cxx b/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigRateMoni.cxx index 3f136bfcfa71b32a3c710d2977bd58fd0b26393c..e6e9883138e3c6d1e2fc86e3c8432ae8bb442bb2 100644 --- a/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigRateMoni.cxx +++ b/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigRateMoni.cxx @@ -201,7 +201,7 @@ StatusCode TrigRateMoni::bookHists() { } for (const std::string& gr : chainGroupList) { - if ( gr.find("RATE") == 0 ) // name starts from string RATE + if ( gr.compare(0,4,"RATE") == 0 ) // name starts with string RATE groups.insert(gr); } diff --git a/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigSignatureMoni.cxx b/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigSignatureMoni.cxx index 274b69aab32a805a4e233795cae1434afff87f59..2b8e4e35855dc8fc514598b3fb13ec50ab96e224 100644 --- a/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigSignatureMoni.cxx +++ b/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigSignatureMoni.cxx @@ -3,8 +3,6 @@ */ #include "GaudiKernel/MsgStream.h" -#include "GaudiKernel/AlgTool.h" -#include "GaudiKernel/IJobOptionsSvc.h" #include "GaudiKernel/Property.h" #include "TrigSignatureMoni.h" @@ -22,43 +20,19 @@ #include "EventInfo/EventID.h" #include "EventInfo/TriggerInfo.h" -#include <iostream> -#include <sstream> #include <vector> #include <set> #include <algorithm> #include <TH1I.h> #include <TH2I.h> #include <map> -#include <boost/algorithm/string.hpp> TrigSignatureMoni::TrigSignatureMoni(const std::string & type, const std::string & name, const IInterface* parent) : TrigMonitorToolBase(type, name, parent), - m_trigConfigSvc("TrigConf::TrigConfigSvc/TrigConfigSvc", name), - m_histoPathexpert(""), - m_parentAlg(0), - m_generalBlock(0), - m_streamBlock(0), - m_groupBlock(0), - m_chainBlock(0), - m_streamCorrel(0), - m_chainlengthHist(0), - //m_lumiBlockNumDiffHist(0), - m_stepForEBHist(0), - m_signatureAcceptanceHist(0), - m_eventsPassingStepHist(0), - m_totaleventsPassingStepHist(0), - m_trigLvl("") - //m_highestLBN(0) + m_trigConfigSvc("TrigConf::TrigConfigSvc/TrigConfigSvc", name) { declareProperty("HistoPathexpert", m_histoPathexpert = "/EXPERT/TrigSteering"); - declareProperty("EventsPerLBHack",m_eventsPerLBHack=10000); -} - -StatusCode TrigSignatureMoni::finalize() -{ - return StatusCode::SUCCESS; } // Define helper classes for the signature acceptance histogram (and stream correlation plot) @@ -66,8 +40,6 @@ StatusCode TrigSignatureMoni::finalize() class BinBlock; template class std::vector<BinBlock*>; -// This is needed since static variables get mixed between L2 and EF in athena -// So define one for each level. struct staticVariables { int firstSigHistBin; std::string unknown; @@ -85,37 +57,33 @@ struct staticVariables { unsigned int ptBin; }; -enum bb_triglevel {tl_L2, tl_EF, tl_HLT}; - class BinBlock { public: - virtual ~BinBlock(); - int GetFirstBin() {return m_firstBin;} // first bin of a block - const std::string &GetXLab(int relBin){return m_XLabels[relBin];} - - static int GetFirstSigHistBin(){ return m_sv[m_tl].firstSigHistBin;} // first bin of the signature hist - static int TotalBinCount() {return m_sv[m_tl].totalBins;} - static int OverflowBin() { return m_sv[m_tl].totalBins + 1;} - static const std::string &GetSigXAxisLabel(int bin); + virtual ~BinBlock() {} + int GetFirstBin() const {return m_firstBin;} // first bin of a block + const std::string& GetXLabel(int relBin){return m_XLabels[relBin];} + + static int GetFirstSigHistBin(){ return m_sv.firstSigHistBin;} // first bin of the signature hist + static int TotalBinCount() {return m_sv.totalBins;} + static int OverflowBin() { return m_sv.totalBins + 1;} + static const std::string& GetSigXAxisLabel(int bin); static void FinalizeInitialization(); - // static void PrintBlocks(); - static void PrepareToBook(enum bb_triglevel tl); - static void SetLevel(enum bb_triglevel tl){ m_tl = tl; } - - static const std::vector<std::string> &GetStepNames(){return m_sv[m_tl].stepnames;} - static int GetNStepBins() {return m_sv[m_tl].stepnames.size();} - static unsigned int GetMaxSteps(){return m_sv[m_tl].maxSteps;} // max num of algorithm steps - static unsigned int GetInputBin(){return m_sv[m_tl].inputBin;} - static unsigned int GetRawBin(){return m_sv[m_tl].rawBin;} - static unsigned int GetPSBin(){ return m_sv[m_tl].psBin;} - static unsigned int GetPTBin(){ return m_sv[m_tl].ptBin;} - static unsigned int GetFirstAlgBin(){return m_sv[m_tl].firstStepBin;} - static unsigned int GetRerunBin(){return m_sv[m_tl].rerunBin;} - static unsigned int GetAlgoInBin(){return m_sv[m_tl].algoInBin;} - static unsigned int GetErrorBin(){return m_sv[m_tl].errorBin;} - unsigned int GetNBins() {return m_NBins;} + static void PrepareToBook(); + + static const std::vector<std::string> &GetStepNames(){return m_sv.stepnames;} + static int GetNStepBins() {return m_sv.stepnames.size();} + static unsigned int GetMaxSteps(){return m_sv.maxSteps;} // max num of algorithm steps + static unsigned int GetInputBin(){return m_sv.inputBin;} + static unsigned int GetRawBin(){return m_sv.rawBin;} + static unsigned int GetPSBin(){ return m_sv.psBin;} + static unsigned int GetPTBin(){ return m_sv.ptBin;} + static unsigned int GetFirstAlgBin(){return m_sv.firstStepBin;} + static unsigned int GetRerunBin(){return m_sv.rerunBin;} + static unsigned int GetAlgoInBin(){return m_sv.algoInBin;} + static unsigned int GetErrorBin(){return m_sv.errorBin;} + unsigned int GetNBins() const {return m_NBins;} virtual void PrintBlock() = 0; protected: @@ -123,8 +91,7 @@ protected: BinBlock(BinBlock *, MsgStream *log); - - static void SetMaxSteps(unsigned int max) {m_sv[m_tl].maxSteps = max;} + static void SetMaxSteps(unsigned int max) {m_sv.maxSteps = max;} std::map<int, std::string> m_XLabels; unsigned int m_NBins; @@ -132,40 +99,34 @@ protected: MsgStream *m_log; - static enum bb_triglevel m_tl; // the trigger level - static struct staticVariables m_sv[3]; // one for each trigger level + static struct staticVariables m_sv; private: }; // storage for statics; -enum bb_triglevel BinBlock::m_tl; -struct staticVariables BinBlock::m_sv[3]; +struct staticVariables BinBlock::m_sv; class GeneralBlock : public BinBlock { // General event columns public: - GeneralBlock(MsgStream *log) : BinBlock(this, log) + GeneralBlock(MsgStream *log) + : BinBlock(this, log) { m_XLabels[0] = "total rate"; m_XLabels[1] = "OR of active chains"; - m_allBin =0; - m_orBin = 1; m_NBins = 2; } - ~GeneralBlock(){;} - int GetOrBin(){return GetFirstSigHistBin() + m_firstBin + m_orBin;} - int GetAllEvsBin(){return GetFirstSigHistBin() + m_firstBin + m_allBin;} + int GetOrBin() const {return GetFirstSigHistBin() + m_firstBin + BINS::OR;} + int GetAllEvsBin() const {return GetFirstSigHistBin() + m_firstBin + BINS::ALL;} void PrintBlock() { (*m_log) << MSG::DEBUG << "**** General Block ****" << endmsg; (*m_log) << MSG::DEBUG << "First bin: " << m_firstBin << ", Number of bins: " << m_NBins << endmsg; - (*m_log) << MSG::DEBUG << ", allBin: " << m_allBin << ", orBin: " << m_orBin << endmsg; + (*m_log) << MSG::DEBUG << ", allBin: " << BINS::ALL << ", orBin: " << BINS::OR << endmsg; } private: - - int m_allBin; - int m_orBin; + enum BINS {ALL=0,OR=1}; }; @@ -174,8 +135,7 @@ class GroupBlock: public BinBlock { // columns for groups public: GroupBlock(const std::vector<const HLT::SteeringChain*>& configuredChains, MsgStream *log); - ~GroupBlock(){;} - const std::set<int> &GetBinSet(unsigned int chainCounter); + const std::set<int>& GetBinSet(unsigned int chainCounter) const; void SetMask(unsigned int chainCounter, unsigned int mask, std::map<int, unsigned int> &hitMap); virtual void PrintBlock(); @@ -190,9 +150,8 @@ class ChainBlock: public BinBlock { // columns for chains public: ChainBlock(const std::vector<const HLT::SteeringChain*>& configuredChains, MsgStream *log); - ~ChainBlock(){;} - int GetSigHistValue(unsigned int chainCounter); // to be used by Fill for example - int GetSigHistBin(unsigned int chainCounter); // to be used by SetBinContent for example + int GetSigHistValue(unsigned int chainCounter) const; // to be used by Fill for example + int GetSigHistBin(unsigned int chainCounter) const; // to be used by SetBinContent for example virtual void PrintBlock(); @@ -208,18 +167,17 @@ public: std::set<std::string> &errorStreamNames, std::string trigLvl, MsgStream *log); - ~StreamBlock(){;} - const std::set<int> &GetSigHistValueSet(unsigned int chainCounter); - int GetSigHistValue(std::string streamTag); - int GetCorrelHistBin(std::string streamTag); - int GetCatchAllBin(){return m_catchAll;} + const std::set<int> &GetSigHistValueSet(unsigned int chainCounter) const; + int GetSigHistValue(const std::string& streamTag) const; + int GetCorrelHistBin(const std::string& streamTag) const; + int GetCatchAllBin() const {return m_catchAll;} void SetMask(unsigned int chainCounter, unsigned int mask, std::map<int, unsigned int> &hitMap); virtual void PrintBlock(); private: - void InsertStreams(bool isPhysType, std::string trgLvl, + void InsertStreams(bool isPhysType, const std::string& trgLvl, const TrigConf::HLTChainList* allChains); std::map<std::string, int> m_str_tag_map; // mapping from tag name (name_type) to bin @@ -231,17 +189,15 @@ private: TrigSignatureMoni::~TrigSignatureMoni() { - enum bb_triglevel tl = m_trigLvl == "L2" ? tl_L2 : m_trigLvl == "EF" ? tl_EF : tl_HLT; - BinBlock::PrepareToBook(tl); - + BinBlock::PrepareToBook(); } -void findChainsInStreams(std::map<std::string, TH1I*>& histograms, const std::vector<const HLT::SteeringChain*>& config, const std::string& level) { +void findChainsInStreams(std::map<std::string, TH1I*>& histograms, const std::vector<const HLT::SteeringChain*>& config, const std::string& level) +{ std::map<std::string, std::vector<std::string> > stream_to_chains; - for ( const HLT::SteeringChain* chain : config ) { - for ( const HLT::StreamTag& stream : chain->getStreamTags()) { + for ( const HLT::StreamTag& stream : chain->getStreamTags()) { stream_to_chains[stream.getStream()].push_back(chain->getChainName()); } } @@ -258,16 +214,17 @@ void findChainsInStreams(std::map<std::string, TH1I*>& histograms, const std:: } -void fillChainsInStreams(std::map<std::string, TH1I*>& histograms, const std::vector<const HLT::SteeringChain*>& result) { - for( const HLT::SteeringChain* chain : result ) { - if (chain->chainPassed()){ - for( const HLT::StreamTag& stream : chain->getStreamTags() ){ - if ( ! stream.isPrescaled() ) {//fill - histograms[stream.getStream()]->Fill(chain->getChainName().c_str(), 1.); - } - } +void fillChainsInStreams(std::map<std::string, TH1I*>& histograms, const std::vector<const HLT::SteeringChain*>& result) +{ + for( const HLT::SteeringChain* chain : result ) { + if (chain->chainPassed()){ + for( const HLT::StreamTag& stream : chain->getStreamTags() ){ + if ( ! stream.isPrescaled() ) { + histograms[stream.getStream()]->Fill(chain->getChainName().c_str(), 1.); + } } - } + } + } } @@ -317,9 +274,8 @@ StatusCode TrigSignatureMoni::bookHistograms( bool/* isNewEventsBlock*/, bool /* // Some preliminaries to setting up m_signatureAcceptanceHist... const TrigConf::HLTChainList *chainList = m_trigConfigSvc->chainList(); - enum bb_triglevel tl = (m_trigLvl == "L2")? tl_L2 : ((m_trigLvl == "EF")? tl_EF : tl_HLT); - BinBlock::PrepareToBook(tl); + BinBlock::PrepareToBook(); std::vector<const HLT::SteeringChain*> configuredChains = m_parentAlg->getConfiguredChains(); @@ -347,10 +303,7 @@ StatusCode TrigSignatureMoni::bookHistograms( bool/* isNewEventsBlock*/, bool /* m_eventsPassingStepHist=0; m_totaleventsPassingStepHist=0; m_stepForEBHist=0; - - // HISTOGRAM DEFINITONS - // Step For EventBuilding histogram if(m_trigLvl == "HLT") { m_stepForEBHist = new TH1I("StepForEB", "Step at which EB is called ", 60, -30., 30.); @@ -359,35 +312,14 @@ StatusCode TrigSignatureMoni::bookHistograms( bool/* isNewEventsBlock*/, bool /* } m_stepForEBHist->GetYaxis()->SetTitle("Events"); m_stepForEBHist->GetXaxis()->SetTitle("Step of Event Building"); - - // histogram for: Step separating L2EF - // m_chainstepL2EFHist = new TH1I("ChainL2EFstep","Step at which L2/EF separation is set for chains", - // BinBlock::TotalBinCount(), - // BinBlock::GetFirstSigHistBin()-0.5, - // BinBlock::GetFirstSigHistBin() + BinBlock::TotalBinCount()-0.5); - - // if ( expertHistograms.regHist(m_chainstepL2EFHist).isFailure()){ - // if (m_logLvl <= MSG::WARNING) (*m_log) << MSG::WARNING << "Can't book " - // << m_histoPathexpert+ m_chainstepL2EFHist->GetName() << endmsg; - // } - // m_chainstepL2EFHist->GetYaxis()->SetTitle("L2/EF separation step (first step configured after EB)"); - // m_chainstepL2EFHist->GetXaxis()->SetTitle("chains"); - } - - // Chain length histogram - TString htit; - std::string tmpstring = "Length of Chains in "; - tmpstring += m_trigLvl; - htit = /*Form*/(tmpstring.c_str()); - //tmpstring = "chainLength_"+m_trigLvl; - - m_chainlengthHist = new TH1I("ChainLength",htit.Data(), - BinBlock::TotalBinCount(), - BinBlock::GetFirstSigHistBin()-0.5, - BinBlock::GetFirstSigHistBin() + BinBlock::TotalBinCount()-0.5); + std::string title = "Length of Chains in " + m_trigLvl; + m_chainlengthHist = new TH1I("ChainLength",title.c_str(), + BinBlock::TotalBinCount(), + BinBlock::GetFirstSigHistBin()-0.5, + BinBlock::GetFirstSigHistBin() + BinBlock::TotalBinCount()-0.5); if ( expertHistograms.regHist(m_chainlengthHist).isFailure()){ ATH_MSG_WARNING("Can't book "<< m_histoPathexpert+ m_chainlengthHist->GetName()); @@ -405,8 +337,8 @@ StatusCode TrigSignatureMoni::bookHistograms( bool/* isNewEventsBlock*/, bool /* } for(unsigned int i = 0; i < m_streamBlock->GetNBins(); i++) { - m_streamCorrel->GetXaxis()->SetBinLabel(i+1, m_streamBlock->GetXLab(i).data()); - m_streamCorrel->GetYaxis()->SetBinLabel(i+1, m_streamBlock->GetXLab(i).data()); + m_streamCorrel->GetXaxis()->SetBinLabel(i+1, m_streamBlock->GetXLabel(i).data()); + m_streamCorrel->GetYaxis()->SetBinLabel(i+1, m_streamBlock->GetXLabel(i).data()); } if ( expertHistograms.regHist(m_streamCorrel).isFailure()){ ATH_MSG_WARNING("Can't register "<< m_streamCorrel->GetName() << ", deleting"); @@ -417,9 +349,9 @@ StatusCode TrigSignatureMoni::bookHistograms( bool/* isNewEventsBlock*/, bool /* } // Signature acceptance histogram - std::string tmpstring_title = "Raw acceptance of signatures in "+ m_trigLvl; + title = "Raw acceptance of signatures in "+ m_trigLvl; m_signatureAcceptanceHist = new - TrigLBNHist<TH2I>(TH2I("SignatureAcceptance",tmpstring_title.c_str(), + TrigLBNHist<TH2I>(TH2I("SignatureAcceptance",title.c_str(), BinBlock::TotalBinCount(), BinBlock::GetFirstSigHistBin()-0.5, BinBlock::GetFirstSigHistBin() + BinBlock::TotalBinCount()-0.5, @@ -438,54 +370,6 @@ StatusCode TrigSignatureMoni::bookHistograms( bool/* isNewEventsBlock*/, bool /* ATH_MSG_WARNING("Can't book "<< m_signatureAcceptanceHist->GetName()); } - /* - // Events passing step histogram - tmpstring_title = "Number of events passing a step in "+ m_trigLvl; - - - m_eventsPassingStepHist=new TrigLBNHist<TH1I>(TH1I("EventsPassingStep",tmpstring_title.c_str(), - BinBlock::GetNStepBins()+1, - -0.5, - BinBlock::GetNStepBins() +0.5) - ); - - m_eventsPassingStepHist->GetXaxis()->SetTitle("step"); - m_eventsPassingStepHist->GetYaxis()->SetTitle("Number of successful events"); - - - if ( expertHistograms.regHist((ITrigLBNHist*)m_eventsPassingStepHist).isFailure()) { - if (m_logLvl <= MSG::WARNING)(*m_log) << MSG::WARNING << "Can't book " - << m_eventsPassingStepHist->GetName() << endmsg; - } - - - // Total events passing step histogram - tmpstring_title = "Number of total events passing a step in "+ m_trigLvl; - - m_totaleventsPassingStepHist=new TrigLBNHist<TH1I>(TH1I("TotalEventsPassingStep",tmpstring_title.c_str(), - BinBlock::GetNStepBins()+1, - -0.5, - BinBlock::GetNStepBins()+0.5 ) - ); - - m_totaleventsPassingStepHist->GetXaxis()->SetTitle("step"); - m_totaleventsPassingStepHist->GetYaxis()->SetTitle("Number of total successful events"); - - if ( expertHistograms.regHist((ITrigLBNHist*)m_totaleventsPassingStepHist).isFailure()) { - if (m_logLvl <= MSG::WARNING)(*m_log) << MSG::WARNING << "Can't book " - << m_totaleventsPassingStepHist->GetName() << endmsg; - } - */ - -#ifdef _IF_LUMI_BLOCK_NUMBER_DIFF_HISTO_IS_WANTED_GET_RID_OF_THIS_IFDEF - m_lumiBlockNumDiffHist = new TH1I("LBNDiff", "Diff between current LumiBlockNum and highest seen(if nonzero)", - 20, 1, 21); - - if ( expertHistograms.regHist(m_lumiBlockNumDiffHist).isFailure()){ - ATH_MSG_WARNING("Can't book "<< m_histoPathexpert+ m_lumiBlockNumDiffHist->GetName()); - } -#endif - // chain length histo: fill 1d histogram with the length of each chain for ( const HLT::SteeringChain* chain : configuredChains ) { unsigned int chainCounter = chain->getChainCounter(); @@ -518,10 +402,9 @@ StatusCode TrigSignatureMoni::bookHistograms( bool/* isNewEventsBlock*/, bool /* m_signatureAcceptanceHist->SetBinContent(m_groupBlock->GetFirstBin() + bin+1, step1+1, -1); findChainsInStreams(m_chainsInStream, configuredChains, m_trigLvl); - std::map<std::string,TH1I*>::const_iterator s; - for ( s = m_chainsInStream.begin(); s != m_chainsInStream.end(); ++s ) { - s->second->GetXaxis()->LabelsOption("a"); - if ( expertHistograms.regHist(s->second).isFailure()) { + for ( const auto& s : m_chainsInStream ) { // (string,TH1I*) + s.second->GetXaxis()->LabelsOption("a"); + if ( expertHistograms.regHist(s.second).isFailure()) { ATH_MSG_WARNING("Failed to book stream histogram"); } } @@ -538,44 +421,13 @@ StatusCode TrigSignatureMoni::fillHists() return StatusCode::FAILURE; } - enum bb_triglevel tl =(m_trigLvl == "L2")? tl_L2 : ((m_trigLvl == "EF")? tl_EF : tl_HLT); - - BinBlock::SetLevel(tl); - const EventInfo* constEventInfo(0); StatusCode sc_cei = evtStore()->retrieve(constEventInfo); - //TrigMonGroup expertHistograms( this, m_parentAlg->name(), expert ); - if(sc_cei.isFailure()){ ATH_MSG_WARNING("Can't get EventInfo object (for stream tags & Lumiblock number)"); } -#ifdef _IF_LUMI_BLOCK_NUMBER_DIFF_HISTO_IS_WANTED_GET_RID_OF_THIS_IFDEF - //get lumiBlockNumber - - unsigned int lumiBlockNumber=0; - unsigned int runNumber=0; - - - if ( sc_cei.isSuccess && constEventInfo->event_ID()) { - lumiBlockNumber = constEventInfo->event_ID()->lumi_block(); - runNumber = constEventInfo->event_ID()->run_number(); - }else{ - ATH_MSG_DEBUG("LBN not possible because missing event_ID"); - } - - m_highestLBN = (lumiBlockNumber > m_highestLBN)? lumiBlockNumber : m_highestLBN; - - int diff = ((int) m_highestLBN) - ((int) lumiBlockNumber); - - if( diff > 0) - if(m_lumiBlockNumDiffHist != 0) m_lumiBlockNumDiffHist->Fill(diff); - -#endif - - - const std::vector<const HLT::SteeringChain*>& activeChains = m_parentAlg->getActiveChains(); unsigned int maxsuccessfulSteps=0; bool eventPassedRaw = false; @@ -588,9 +440,7 @@ StatusCode TrigSignatureMoni::fillHists() std::map<int, unsigned int> groupHit; // Hold a bit mask for each group hit //loop chains and fill x-bins for chains - for (std::vector<const HLT::SteeringChain*>::const_iterator chain = activeChains.begin(); - chain != activeChains.end(); ++chain) { - const HLT::SteeringChain *ch = *chain; + for (const HLT::SteeringChain* ch : activeChains) { unsigned int chainCounter = (unsigned int)ch->getChainCounter(); unsigned int bin = m_chainBlock->GetSigHistValue(chainCounter); @@ -727,31 +577,18 @@ StatusCode TrigSignatureMoni::fillHists() if(eventHasError) { m_signatureAcceptanceHist->Fill( m_generalBlock->GetOrBin(), BinBlock::GetErrorBin()); } - for (unsigned int step=0; step <= BinBlock::GetMaxSteps() ;step++) + for (unsigned int step=0; step <= BinBlock::GetMaxSteps() ;step++) { if(step < maxsuccessfulSteps) m_signatureAcceptanceHist->Fill(m_generalBlock->GetOrBin(), BinBlock::GetFirstAlgBin() + step); - + } if(maxsuccessfulSteps > BinBlock::GetMaxSteps()){ - ATH_MSG_ERROR("Something wrong? maxsuccessfulSteps "<<maxsuccessfulSteps<<" > m_sv[m_tl].maxSteps " + ATH_MSG_ERROR("Something wrong? maxsuccessfulSteps "<<maxsuccessfulSteps<<" > m_sv.maxSteps " << BinBlock::GetMaxSteps() <<" ?"); } - /* - // fill the histogram with events passing each step, be careful, the chains have different length! - for (unsigned int step=0; step <= BinBlock::GetMaxSteps() ;step++) { - if(step <= maxsuccessfulSteps){ - m_eventsPassingStepHist->Fill(step,1); - - m_totaleventsPassingStepHist->Fill(step,1); - - }else if(eventPassedRaw) - m_totaleventsPassingStepHist->Fill(step, 1); - } - */ - - + if(sc_cei) { //use EventInfo -> TriggerInfo-> Stream Tag to get streams this event contributes to std::vector<TriggerInfo::StreamTag> streamTags = constEventInfo->trigger_info()->streamTags(); @@ -761,28 +598,27 @@ StatusCode TrigSignatureMoni::fillHists() // fill total out per stream including additional streamTag prescales - for(std::vector<TriggerInfo::StreamTag>::iterator iter=streamTags.begin(); iter != streamTags.end(); iter++){ - std::string streamKey = iter->name()+"_"+iter->type(); + for(const TriggerInfo::StreamTag& st : streamTags) { + std::string streamKey = st.name()+"_"+st.type(); - //streamKey = "nobodys_business"; // FOR TESTING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! int binNo = m_streamBlock->GetSigHistValue(streamKey); if(binNo != m_streamBlock->GetCatchAllBin()) - m_signatureAcceptanceHist->Fill( binNo, BinBlock::GetPTBin()); + m_signatureAcceptanceHist->Fill( binNo, BinBlock::GetPTBin()); } if(m_streamCorrel != 0) { // Fill the correlation histogram, EF only for(std::vector<TriggerInfo::StreamTag>::iterator iter=streamTags.begin(); iter != streamTags.end(); iter++){ - std::string streamKey = iter->name()+"_"+iter->type(); - //streamKey = "nobodys_business"; // FOR TESTING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - int bin1 = m_streamBlock->GetCorrelHistBin(streamKey); - for(std::vector<TriggerInfo::StreamTag>::iterator it2=iter; it2 != streamTags.end(); it2++) { - int bin2 = m_streamBlock->GetCorrelHistBin(it2->name()+"_"+it2->type()); - if(bin1 != m_streamBlock->GetCatchAllBin() && bin1 != m_streamBlock->GetCatchAllBin() ) { - m_streamCorrel->Fill(bin1,bin2); - if(bin1 != bin2) - m_streamCorrel->Fill(bin2,bin1); - } - } + std::string streamKey = iter->name()+"_"+iter->type(); + + int bin1 = m_streamBlock->GetCorrelHistBin(streamKey); + for(std::vector<TriggerInfo::StreamTag>::iterator it2=iter; it2 != streamTags.end(); it2++) { + int bin2 = m_streamBlock->GetCorrelHistBin(it2->name()+"_"+it2->type()); + if(bin1 != m_streamBlock->GetCatchAllBin() && bin1 != m_streamBlock->GetCatchAllBin() ) { + m_streamCorrel->Fill(bin1,bin2); + if(bin1 != bin2) + m_streamCorrel->Fill(bin2,bin1); + } + } } } } @@ -802,124 +638,100 @@ StatusCode TrigSignatureMoni::finalHists() { /** - - Implementation of BinBlock and inheriting classes - - **/ -BinBlock::BinBlock(BinBlock *binBlock, MsgStream *log): m_NBins(0), m_log(log) +BinBlock::BinBlock(BinBlock *binBlock, MsgStream *log): + m_NBins(0), m_log(log) { - m_sv[m_tl].firstSigHistBin = -1; // for historical reasons! - m_sv[m_tl].unknown = "unknown"; - - std::vector<BinBlock*>::const_iterator bbit; - m_sv[m_tl].totalBins = 0; + m_sv.firstSigHistBin = -1; // for historical reasons! + m_sv.unknown = "unknown"; + m_sv.totalBins = 0; - for(bbit = m_sv[m_tl].binBlocks.begin(); bbit != m_sv[m_tl].binBlocks.end(); bbit++) { - m_sv[m_tl].totalBins += (*bbit)->GetNBins(); + for(const BinBlock* bb : m_sv.binBlocks) { + m_sv.totalBins += bb->GetNBins(); } - m_firstBin = m_sv[m_tl].totalBins; + m_firstBin = m_sv.totalBins; - m_sv[m_tl].binBlocks.push_back(binBlock); + m_sv.binBlocks.push_back(binBlock); } -BinBlock::~BinBlock() -{ -} - // This function is badly named. All it does is delete the binBlocks if they exist and clean up. -void BinBlock::PrepareToBook(enum bb_triglevel tl){ - - m_tl = tl; - - std::vector<BinBlock*>::iterator bbit; - for(bbit = m_sv[m_tl].binBlocks.begin(); bbit != m_sv[m_tl].binBlocks.end(); bbit++){ - delete *bbit; +void BinBlock::PrepareToBook() +{ + for(BinBlock* bb : m_sv.binBlocks) { + delete bb; } - m_sv[m_tl].binBlocks.clear(); - m_sv[m_tl].stepnames.clear(); - + m_sv.binBlocks.clear(); + m_sv.stepnames.clear(); } void BinBlock::FinalizeInitialization() { + m_sv.totalBins = 0; - std::vector<BinBlock*>::const_iterator bbit; - m_sv[m_tl].totalBins = 0; - - for(bbit = m_sv[m_tl].binBlocks.begin(); bbit != m_sv[m_tl].binBlocks.end(); bbit++) { - m_sv[m_tl].totalBins += (*bbit)->GetNBins(); + for(const BinBlock* bb : m_sv.binBlocks) { + m_sv.totalBins += bb->GetNBins(); } // set the step name - m_sv[m_tl].stepnames.push_back("errors"); - m_sv[m_tl].stepnames.push_back("input"); - m_sv[m_tl].stepnames.push_back("!PS rate"); - m_sv[m_tl].stepnames.push_back("algoIn"); + m_sv.stepnames.push_back("errors"); + m_sv.stepnames.push_back("input"); + m_sv.stepnames.push_back("!PS rate"); + m_sv.stepnames.push_back("algoIn"); // give numbers to the steps - for (unsigned int i_step = 1; i_step <= m_sv[m_tl].maxSteps; i_step++){ - std::string tmpstr(Form("step %i",i_step)); - m_sv[m_tl].stepnames.push_back(tmpstr); + for (unsigned int i_step = 1; i_step <= m_sv.maxSteps; i_step++){ + m_sv.stepnames.push_back("step "+std::to_string(i_step)); } - m_sv[m_tl].stepnames.push_back("raw rate"); - m_sv[m_tl].stepnames.push_back("total rate"); - m_sv[m_tl].stepnames.push_back("rerun rate"); + m_sv.stepnames.push_back("raw rate"); + m_sv.stepnames.push_back("total rate"); + m_sv.stepnames.push_back("rerun rate"); - m_sv[m_tl].errorBin = 0; - m_sv[m_tl].inputBin = 1; - m_sv[m_tl].psBin = 2; - m_sv[m_tl].algoInBin = 3; - m_sv[m_tl].firstStepBin = 4; - m_sv[m_tl].rawBin = m_sv[m_tl].maxSteps + 4; - m_sv[m_tl].ptBin = m_sv[m_tl].maxSteps + 5; - m_sv[m_tl].rerunBin = m_sv[m_tl].maxSteps + 6; + m_sv.errorBin = 0; + m_sv.inputBin = 1; + m_sv.psBin = 2; + m_sv.algoInBin = 3; + m_sv.firstStepBin = 4; + m_sv.rawBin = m_sv.maxSteps + 4; + m_sv.ptBin = m_sv.maxSteps + 5; + m_sv.rerunBin = m_sv.maxSteps + 6; } -const std::string &BinBlock::GetSigXAxisLabel(int bin) +const std::string& BinBlock::GetSigXAxisLabel(int bin) { - std::vector<BinBlock*>::const_iterator bbit; - - for(bbit = m_sv[m_tl].binBlocks.begin(); bbit != m_sv[m_tl].binBlocks.end(); bbit++) { - int firstBin = (*bbit)->GetFirstBin(); - if(bin >= firstBin && bin < firstBin + int((*bbit)->GetNBins())) { - return (*bbit)->GetXLab(bin - firstBin); + for (BinBlock* bb : m_sv.binBlocks) { + int firstBin = bb->GetFirstBin(); + if(bin >= firstBin && bin < firstBin + int(bb->GetNBins())) { + return bb->GetXLabel(bin - firstBin); } } - return m_sv[m_tl].unknown; + return m_sv.unknown; } -GroupBlock::GroupBlock(const std::vector<const HLT::SteeringChain*>& configuredChains, MsgStream *log) : BinBlock(this, log) +GroupBlock::GroupBlock(const std::vector<const HLT::SteeringChain*>& configuredChains, MsgStream *log) + : BinBlock(this, log) { - std::map<std::string, int> groupBinMap; m_NBins = 0; - std::vector<const HLT::SteeringChain*>::const_iterator cit; - // First populate groupBinMap with the group names // Done this way to ensure that groups are in alphabetical order in histo - for ( const HLT::SteeringChain * chain : configuredChains ) { - for ( std::string group : chain->getConfigChain()->groups() ) + for ( const std::string& group : chain->getConfigChain()->groups() ) groupBinMap[group] = 0; } // Assign bins, set label - // for(std::map<std::string, int>::iterator grit = groupBinMap.begin(); - // grit != groupBinMap.end(); grit++) { - typedef std::pair<std::string, int> groupBin_t; - for ( groupBin_t group_bin : groupBinMap) { + for ( auto group_bin : groupBinMap ) { m_XLabels[m_NBins] = "grp_" + group_bin.first; group_bin.second = GetFirstSigHistBin() + m_firstBin + m_NBins++; } @@ -927,19 +739,20 @@ GroupBlock::GroupBlock(const std::vector<const HLT::SteeringChain*>& configuredC // Now set the bin maps for each chain for ( const HLT::SteeringChain * chain : configuredChains ) { std::set<int> binNums; - for ( std::string group : chain->getConfigChain()->groups() ) + for ( const std::string& group : chain->getConfigChain()->groups() ) binNums.insert(groupBinMap[group]); m_ch_bin_map[ chain->getChainCounter() ] = binNums; } } -const std::set<int> &GroupBlock::GetBinSet(unsigned int chainCounter) +const std::set<int> &GroupBlock::GetBinSet(unsigned int chainCounter) const { - if(m_ch_bin_map.find(chainCounter) == m_ch_bin_map.end()) + const auto it = m_ch_bin_map.find(chainCounter); + if(it == m_ch_bin_map.end()) return m_emptyList; - return m_ch_bin_map[chainCounter]; + return it->second; } void GroupBlock::PrintBlock() @@ -956,50 +769,38 @@ void GroupBlock::PrintBlock() } } -void GroupBlock::SetMask(unsigned int chainCounter, unsigned int mask, std::map<int, unsigned int> &hitMap) { - - const std::set<int> groups = GetBinSet(chainCounter); - - for(std::set<int>::iterator hgit = groups.begin(); hgit != groups.end(); hgit++) { - - if(hitMap.find(*hgit) == hitMap.end()) - hitMap[*hgit] = 0; +void GroupBlock::SetMask(unsigned int chainCounter, unsigned int mask, std::map<int, unsigned int> &hitMap) +{ + const std::set<int>& groups = GetBinSet(chainCounter); - hitMap[*hgit] |= mask; + for(int hg : groups) { + auto it = hitMap.find(hg); + if(it == hitMap.end()) + hitMap[hg] = 0; + else + it->second |= mask; } } -ChainBlock::ChainBlock(const std::vector<const HLT::SteeringChain*>& configuredChains, MsgStream *log) : BinBlock(this, log) +ChainBlock::ChainBlock(const std::vector<const HLT::SteeringChain*>& configuredChains, MsgStream *log) + : BinBlock(this, log) { m_NBins = 0; unsigned int maxSteps = 0; // This is here to produce an alphabetically sorted list of chains (to address Savannah bug 79938 std::map<std::string, unsigned int> chainname; - for (std::vector<const HLT::SteeringChain*>::const_iterator it = configuredChains.begin(); - it != configuredChains.end(); ++it) { - chainname[(*it)->getChainName()]= (*it)->getChainCounter(); + for (const HLT::SteeringChain* ch : configuredChains) { + chainname[ch->getChainName()]= ch->getChainCounter(); - const std::vector<const HLT::Signature*>& signatures = (*it)->getSignatures(); + const std::vector<const HLT::Signature*>& signatures = ch->getSignatures(); // searching for the longest (max. steps) configured chain maxSteps = signatures.size() > maxSteps ? signatures.size() : maxSteps; } - - //std::vector<const HLT::SteeringChain*>::const_iterator cit; - - //for(cit = configuredChains.begin(); cit != configuredChains.end(); cit++) { - for( std::map<std::string, unsigned int>::const_iterator it = chainname.begin(); it != chainname.end(); - it++) { - unsigned int chainCounter = it->second; - - std::string namestring = it->first + "_ChCo_%i"; - m_XLabels[m_NBins] = Form(namestring.c_str(),chainCounter); - m_ch_bin[chainCounter] = GetFirstSigHistBin() + m_firstBin + m_NBins++; - - //const std::vector<const HLT::Signature*>& signatures = (*cit)->getSignatures(); - // searching for the longest (max. steps) configured chain - //maxSteps = signatures.size() > maxSteps ? signatures.size() : maxSteps; + for (const auto& kv : chainname) { // (name,chainCounter) + m_XLabels[m_NBins] = kv.first + "_ChCo_" + std::to_string(kv.second); + m_ch_bin[kv.second] = GetFirstSigHistBin() + m_firstBin + m_NBins++; } BinBlock::SetMaxSteps(maxSteps); } @@ -1018,19 +819,21 @@ void ChainBlock::PrintBlock() } -int ChainBlock::GetSigHistValue(unsigned int chainCounter) +int ChainBlock::GetSigHistValue(unsigned int chainCounter) const { - if(m_ch_bin.find(chainCounter) != m_ch_bin.end()) - return m_ch_bin[chainCounter]; + const auto it = m_ch_bin.find(chainCounter); + if(it != m_ch_bin.end()) + return it->second; return OverflowBin(); } -int ChainBlock::GetSigHistBin(unsigned int chainCounter) +int ChainBlock::GetSigHistBin(unsigned int chainCounter) const { - if(m_ch_bin.find(chainCounter) != m_ch_bin.end()) - return m_ch_bin[chainCounter] - GetFirstSigHistBin(); + const auto it = m_ch_bin.find(chainCounter); + if(it != m_ch_bin.end()) + return it->second - GetFirstSigHistBin(); return OverflowBin(); @@ -1089,14 +892,14 @@ StreamBlock::StreamBlock(const TrigConf::HLTChainList* allChains, } -void StreamBlock::InsertStreams(bool isPhysType, std::string trgLvl, +void StreamBlock::InsertStreams(bool isPhysType, const std::string& trgLvl, const TrigConf::HLTChainList* allChains) { TrigConf::HLTChainList::const_iterator cit; - // MM, 16.8.11 First get the names of the streams into a local set (for ordering). - // Then use it to set up the m_str_tag_map, then set up the chain to stream map + // First get the names of the streams into a local set (for ordering). + // Then use it to set up the m_str_tag_map, then set up the chain to stream map std::set<std::string> streamNames; for(cit = allChains->begin(); cit != allChains->end(); cit++) { @@ -1104,20 +907,18 @@ void StreamBlock::InsertStreams(bool isPhysType, std::string trgLvl, if( (*cit)->level() != trgLvl) continue; - std::vector<TrigConf::HLTStreamTag*>::const_iterator stit; - - for(stit = (*cit)->streams().begin(); stit !=(*cit)->streams().end();stit++ ) { - if( (isPhysType && (*stit)->type() == "physics") || (!isPhysType && (*stit)->type() != "physics")) { - const std::string namkey = (*stit)->stream()+"_"+(*stit)->type(); + for(const TrigConf::HLTStreamTag* st : (*cit)->streams()) { + if( (isPhysType && st->type() == "physics") || (!isPhysType && st->type() != "physics")) { + const std::string namkey = st->stream()+"_"+st->type(); streamNames.insert(namkey); } } } // Set up m_ch_str_map and the labels vector - for(std::set<std::string>::const_iterator snit = streamNames.begin(); snit != streamNames.end(); snit++) { - m_str_tag_map[ *snit ] = m_NBins; - m_XLabels[m_NBins] = "str_" + *snit; + for(const std::string& sn : streamNames) { + m_str_tag_map[ sn ] = m_NBins; + m_XLabels[m_NBins] = "str_" + sn; m_NBins++; } @@ -1127,19 +928,17 @@ void StreamBlock::InsertStreams(bool isPhysType, std::string trgLvl, if( (*cit)->level() != trgLvl) continue; - std::vector<TrigConf::HLTStreamTag*>::const_iterator stit; - - for(stit = (*cit)->streams().begin(); stit !=(*cit)->streams().end();stit++ ){ - if( (isPhysType && (*stit)->type() == "physics") || (!isPhysType && (*stit)->type() != "physics")) { - const std::string namkey = (*stit)->stream()+"_"+(*stit)->type(); - if(m_str_tag_map.find(namkey) == m_str_tag_map.end()) { - m_ch_str_map.insert(std::pair<unsigned int, std::set<int> >((*cit)->chain_counter(), - std::set<int>())); - } - m_ch_str_map[(*cit)->chain_counter()].insert( GetFirstSigHistBin() + - m_firstBin + - m_str_tag_map[namkey] ); - } + for(const TrigConf::HLTStreamTag* st : (*cit)->streams()) { + if( (isPhysType && st->type() == "physics") || (!isPhysType && st->type() != "physics")) { + const std::string namkey = st->stream()+"_"+st->type(); + if(m_str_tag_map.find(namkey) == m_str_tag_map.end()) { + m_ch_str_map.insert(std::pair<unsigned int, std::set<int> >((*cit)->chain_counter(), + std::set<int>())); + } + m_ch_str_map[(*cit)->chain_counter()].insert( GetFirstSigHistBin() + + m_firstBin + + m_str_tag_map[namkey] ); + } } } } @@ -1148,7 +947,7 @@ void StreamBlock::PrintBlock() { if(m_log->level() <= MSG::DEBUG) { (*m_log) << MSG::DEBUG << "**** Stream Block ****" << endmsg - << "First bin: " << m_firstBin << ", Number of bins: " << m_NBins << endmsg; + << "First bin: " << m_firstBin << ", Number of bins: " << m_NBins << endmsg; (*m_log) << MSG::DEBUG << "Stream tag to bin map " << endmsg; std::map<std::string, int>::iterator mstit; for(mstit = m_str_tag_map.begin(); mstit != m_str_tag_map.end(); mstit++) { @@ -1158,48 +957,47 @@ void StreamBlock::PrintBlock() std::map<unsigned int, std::set<int> >::iterator mcsit; for(mcsit = m_ch_str_map.begin(); mcsit != m_ch_str_map.end(); mcsit++) { (*m_log) << MSG::DEBUG << "chain counter " << mcsit->first << ": "; - for(std::set<int>::iterator si = mcsit->second.begin(); si != mcsit->second.end(); si++) - (*m_log) << MSG::DEBUG << *si << ", "; + for(int si : mcsit->second) + (*m_log) << MSG::DEBUG << si << ", "; (*m_log) << MSG::DEBUG << endmsg; } } } -const std::set<int> &StreamBlock::GetSigHistValueSet(unsigned int chainCounter){ - - if(m_ch_str_map.find(chainCounter) != m_ch_str_map.end()) - return m_ch_str_map[chainCounter]; +const std::set<int> &StreamBlock::GetSigHistValueSet(unsigned int chainCounter) const +{ + const auto it = m_ch_str_map.find(chainCounter); + if(it != m_ch_str_map.end()) + return it->second; return m_notFound; } -int StreamBlock::GetSigHistValue(std::string streamTag) { - - if(m_str_tag_map.find(streamTag) != m_str_tag_map.end()) - return GetFirstSigHistBin() + m_firstBin + m_str_tag_map[streamTag]; +int StreamBlock::GetSigHistValue(const std::string& streamTag) const +{ + const auto it = m_str_tag_map.find(streamTag); + if(it != m_str_tag_map.end()) + return GetFirstSigHistBin() + m_firstBin + it->second; return m_catchAll; } -int StreamBlock::GetCorrelHistBin(std::string streamTag) { - if(m_str_tag_map.find(streamTag) != m_str_tag_map.end()) - return m_str_tag_map[streamTag]; +int StreamBlock::GetCorrelHistBin(const std::string& streamTag) const +{ + const auto it = m_str_tag_map.find(streamTag); + if(it != m_str_tag_map.end()) + return it->second; return m_catchAll; } -void StreamBlock::SetMask(unsigned int chainCounter, unsigned int mask, std::map<int, unsigned int> &hitMap) { - - const std::set<int> streams = GetSigHistValueSet(chainCounter); - - for(std::set<int>::iterator hsit = streams.begin(); hsit != streams.end(); hsit++) { - - if(hitMap.find(*hsit) == hitMap.end()) - hitMap[*hsit] = 0; - - hitMap[*hsit] |= mask; +void StreamBlock::SetMask(unsigned int chainCounter, unsigned int mask, std::map<int, unsigned int> &hitMap) +{ + const std::set<int>& streams = GetSigHistValueSet(chainCounter); + for(int hs : streams) { + hitMap[hs] |= mask; // this works because default value of new int entry is 0 } } diff --git a/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigSignatureMoni.h b/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigSignatureMoni.h index 41e8c21d8c0babdfdc5def32f5cf2d0188c3a315..13318ba76e848ce07487caa0da69592dc97dacd3 100644 --- a/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigSignatureMoni.h +++ b/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigSignatureMoni.h @@ -13,19 +13,17 @@ * @author Gordon Fischer Gordon.Fischer@cern.ch * * File and Version Information: - * $Id: TrigSignatureMoni.h 764935 2016-07-28 04:03:37Z ssnyder $ + * $Id: TrigSignatureMoni.h 772074 2016-09-07 09:01:25Z fwinkl $ **********************************************************************************/ #ifndef TRIGSIGNATUREMONI_H #define TRIGSIGNATUREMONI_H -#include "GaudiKernel/ToolHandle.h" #include "GaudiKernel/ServiceHandle.h" #include "TrigMonitorBase/TrigMonitorToolBase.h" #include "TrigMonitorBase/TrigLBNHist.h" #include "TrigConfInterfaces/ITrigConfigSvc.h" -#include <set> #include <string> #include <map> @@ -33,13 +31,8 @@ namespace HLT { class TrigSteer; } - class TH1I; class TH2I; -class EventInfo; -class StoreGateSvc; - -// these are defined in TrigSignatureMoni.cxx class GeneralBlock; class StreamBlock; class GroupBlock; @@ -50,18 +43,14 @@ class TrigSignatureMoni: public TrigMonitorToolBase { public: TrigSignatureMoni(const std::string & type, const std::string & name, - const IInterface* parent); + const IInterface* parent); virtual ~TrigSignatureMoni(); - virtual StatusCode initialize(); - virtual StatusCode finalize(); virtual StatusCode bookHists(); virtual StatusCode bookHistograms( bool isNewEventsBlock, bool isNewLumiBlock, bool isNewRun ); - - virtual StatusCode fillHists(); - // does noting + virtual StatusCode fillHists(); virtual StatusCode finalHists(); private: @@ -69,30 +58,26 @@ class TrigSignatureMoni: public TrigMonitorToolBase { ServiceHandle<TrigConf::ITrigConfigSvc > m_trigConfigSvc; std::string m_histoPathexpert; - const HLT::TrigSteer* m_parentAlg; // should give us pointer to TrigSteer topAlgorithm!!! + const HLT::TrigSteer* m_parentAlg{0}; // should give us pointer to TrigSteer topAlgorithm!!! // These are helpers, for defining and filling hists - GeneralBlock *m_generalBlock; - StreamBlock *m_streamBlock; - GroupBlock *m_groupBlock; - ChainBlock *m_chainBlock; + GeneralBlock *m_generalBlock{0}; + StreamBlock *m_streamBlock{0}; + GroupBlock *m_groupBlock{0}; + ChainBlock *m_chainBlock{0}; // histograms - TH2I* m_streamCorrel; - TH1I* m_chainlengthHist; - //TH1I* m_lumiBlockNumDiffHist; - TH1I* m_stepForEBHist; + TH2I* m_streamCorrel{0}; + TH1I* m_chainlengthHist{0}; + TH1I* m_stepForEBHist{0}; // Lumi Block histo sets - TrigLBNHist<TH2I> *m_signatureAcceptanceHist; - TrigLBNHist<TH1I> *m_eventsPassingStepHist; - TrigLBNHist<TH1I> *m_totaleventsPassingStepHist; + TrigLBNHist<TH2I> *m_signatureAcceptanceHist{0}; + TrigLBNHist<TH1I> *m_eventsPassingStepHist{0}; + TrigLBNHist<TH1I> *m_totaleventsPassingStepHist{0}; std::map<std::string, TH1I*> m_chainsInStream; std::string m_trigLvl; - //unsigned int m_highestLBN; - int m_eventsPerLBHack; - }; diff --git a/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigTEMoni.cxx b/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigTEMoni.cxx index 12503e66608436de2055353ce18c0a825aa1dcda..53a92ea1c38fca441ea73628d5245c504a269f26 100644 --- a/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigTEMoni.cxx +++ b/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigTEMoni.cxx @@ -29,31 +29,9 @@ TrigTEMoni::TrigTEMoni(const std::string & type, const std::string & name, const IInterface* parent) : TrigMonitorToolBase(type, name, parent), - m_lvl1ConfigSvc("TrigConf::LVL1ConfigSvc/LVL1ConfigSvc", name), - m_parentAlg(0), - m_numberOfTEsHist(0), - m_numberOfallTEsHist(0), - - m_numberOflvl1TEsHist(0), - m_numberOfalllvl1TEsHist(0), - - m_numberOfTEsHist2d(0), - m_numberOfallTEsHist2d(0), - - m_numberOflvl1TEsHist2d(0), - m_numberOfalllvl1TEsHist2d(0), - - // m_reserveLumiHistos(0), - // m_bookedLumiHistos(0), - // m_histoPathexpert(""), - m_trigLvl("") - - + m_lvl1ConfigSvc("TrigConf::LVL1ConfigSvc/LVL1ConfigSvc", name) { declareInterface<IMonitorToolBase>(this); - // declareProperty("HistoPath", m_histoPathexpert = "/EXPERT/TrigSteering"); - // declareProperty("ReserveLumiHistos", m_reserveLumiHistos = 1); - // declareProperty("useLBHistos",m_useLBHistos=true); } StatusCode TrigTEMoni::initialize() @@ -77,14 +55,6 @@ StatusCode TrigTEMoni::initialize() } ATH_CHECK(m_lvl1ConfigSvc.retrieve()); - - //need LVL1 Config Svc for LVL1 thresholds - /*sc = service( "TrigConf::LVL1ConfigSvc", m_lvl1ConfigSvc); - if(sc.isFailure()) { - if(m_logLvl <= MSG::FATAL) msg() << MSG::FATAL << " Unable to get pointer to Lvl1ConfigService " << endmsg; - return sc; - } - */ return StatusCode::SUCCESS; } @@ -118,66 +88,34 @@ StatusCode TrigTEMoni::bookHistograms( bool/* isNewEventsBlock*/, bool /*isNewLu m_labels.clear(); m_lvl1labels.clear(); - /* - test new stuff here: get Lvl1 thresholds - */ const TrigConf::ThresholdConfig* thresholdConfig = m_lvl1ConfigSvc->thresholdConfig(); - //std::vector<TrigConf::TriggerThreshold*>* thresholdVector=new std::vector<TrigConf::TriggerThreshold *>; - const std::vector<TrigConf::TriggerThreshold*>& thresholdVector = thresholdConfig->getThresholdVector(); -// std::vector<TrigConf::TriggerThreshold*> thresholdVector; -// const std::vector<TrigConf::TriggerThreshold*>* clusterThresholdConfig = thresholdConfig->getClusterThresholdPointer(); -// const std::vector<TrigConf::TriggerThreshold*>* jetThresholdConfig = thresholdConfig->getJetThresholdPointer(); -// const std::vector<TrigConf::TriggerThreshold*>* fjetThresholdConfig = thresholdConfig->getFJetThresholdPointer(); -// const std::vector<TrigConf::TriggerThreshold*>* totEtConfig = thresholdConfig->getTotEtPointer(); -// const std::vector<TrigConf::TriggerThreshold*>* jetEtConfig = thresholdConfig->getJetEtPointer(); -// const std::vector<TrigConf::TriggerThreshold*>* missEtConfig = thresholdConfig->getMissEtPointer(); -// const std::vector<TrigConf::TriggerThreshold*>* muonThresholdConfig = thresholdConfig->getMuonThresholdPointer(); - -// thresholdVector.insert( thresholdVector.end(),clusterThresholdConfig->begin(),clusterThresholdConfig->end()); -// thresholdVector.insert( thresholdVector.end(),jetThresholdConfig->begin(),jetThresholdConfig->end()); -// thresholdVector.insert( thresholdVector.end(),fjetThresholdConfig->begin(),fjetThresholdConfig->end()); -// thresholdVector.insert( thresholdVector.end(),totEtConfig->begin(),totEtConfig->end()); -// thresholdVector.insert( thresholdVector.end(),jetEtConfig->begin(),jetEtConfig->end()); -// thresholdVector.insert( thresholdVector.end(),missEtConfig->begin(),missEtConfig->end()); -// thresholdVector.insert( thresholdVector.end(),muonThresholdConfig->begin(),muonThresholdConfig->end()); - - //std::vector< unsigned int > m_configuredlvl1TETypes; - - // MM, 16.8.11: first stick the TE type IDs into a map keyed by TE name (for sorting) - // then into m_configuredlvl1TETypes, m=lvl1labels - std::map<std::string, unsigned int> foundLvl1TETypes; - for (std::vector<TrigConf::TriggerThreshold*>::const_iterator lvl1TT = thresholdVector.begin(); - lvl1TT != thresholdVector.end(); ++lvl1TT) { + for (const TrigConf::TriggerThreshold* lvl1TT : thresholdVector) { unsigned int teId = 0; - bool activeHLT = TrigConf::HLTTriggerElement::getId( (*lvl1TT)->name().c_str(), teId); + bool activeHLT = TrigConf::HLTTriggerElement::getId(lvl1TT->name().c_str(), teId); if (activeHLT) { - foundLvl1TETypes[(*lvl1TT)->name()] = teId; + foundLvl1TETypes[lvl1TT->name()] = teId; - } else { - //if(m_logLvl <= MSG::DEBUG) msg() << MSG::DEBUG << " => NO" << endmsg; } - int tn = (*lvl1TT)->thresholdNumber()+1; + int tn = lvl1TT->thresholdNumber()+1; if (tn < 0) { msg() << MSG::WARNING << "this LVL1 threshold bit position (" << tn << ") is smaller 0" - << ", go on w/o this threshold!" <<endmsg; + << ", go on w/o this threshold!" << endmsg; } } - //now build m_configuredlvl1TETypes, m_lvl1labels + //now build m_configuredlvl1TETypes, m_lvl1labels unsigned int bin_number_lvl1=0; - for(std::map<std::string, unsigned int>::const_iterator fit = foundLvl1TETypes.begin(); - fit != foundLvl1TETypes.end(); fit++) { + for (const auto& l1te : foundLvl1TETypes) { // std::map<std::string, unsigned int> bin_number_lvl1++; - m_configuredlvl1TETypes.push_back(fit->second); - m_lvl1labels[fit->second]=bin_number_lvl1; + m_configuredlvl1TETypes.push_back(l1te.second); + m_lvl1labels[l1te.second]=bin_number_lvl1; } - //ende test new stuff - it works /* get input and output HLT Triggerelement types -> store types in m_configuredTETypes and @@ -185,7 +123,7 @@ StatusCode TrigTEMoni::bookHistograms( bool/* isNewEventsBlock*/, bool /*isNewLu */ std::vector<const HLT::SteeringChain*> configuredChains = m_parentAlg->getConfiguredChains(); unsigned int bin_number = 0; - // MM, 31.7.11: first stick the TE type IDs into a map keyed by TE name (for sorting) + // first stick the TE type IDs into a map keyed by TE name (for sorting) // then into m_configuredTETypes, m=labels std::map<std::string, unsigned int> foundTETypes; @@ -218,22 +156,21 @@ StatusCode TrigTEMoni::bookHistograms( bool/* isNewEventsBlock*/, bool /*isNewLu } // chain loop bin_number = 0; - for(std::map<std::string, unsigned int>::const_iterator fit = foundTETypes.begin(); - fit != foundTETypes.end(); fit++) { + for (const auto& te : foundTETypes) { // std::map<std::string, unsigned int> - m_configuredTETypes.push_back( fit->second ); + m_configuredTETypes.push_back( te.second ); - if(fit->first != "") { + if(!te.first.empty()) { bin_number++; - m_labels[ fit->second ] = bin_number; + m_labels[ te.second ] = bin_number; } else { - m_labels[ fit->second ] = 0; // into the underflow bin - ATH_MSG_WARNING("TE with blank label found. TEType: " << fit->second); + m_labels[ te.second ] = 0; // into the underflow bin + ATH_MSG_WARNING("TE with blank label found. TEType: " << te.second); } } - //cross check bin_number = number of TETypes ? - // This can happen now (17.8.11) if blank labels are found (as in the rerundb test) + // cross check bin_number = number of TETypes ? + // This can happen now if blank labels are found (as in the rerundb test) if(bin_number != m_configuredTETypes.size() ){ ATH_MSG_WARNING(" size of triggername, m_configuredTETypes, bin_number " <<m_configuredTETypes.size()<<" "<<bin_number<<" doesnt match "); @@ -246,37 +183,9 @@ StatusCode TrigTEMoni::bookHistograms( bool/* isNewEventsBlock*/, bool /*isNewLu } } - - - /* - now book histos - */ - - /* run summary - */ - - /* - histo for number of TE - */ - /* - std::string title = "TE abundance in "+ m_trigLvl;// + " Run Summary"; - std::string run_title = title + " Run Summary"; - std::string name = "TEnumber_" + m_trigLvl;// + "_runsummary"; - std::string runname = name + "_runsummary"; - - m_numberOfTEsHist_runsummary = new TH1I(run_name.c_str(),run_title.c_str(), bin_number,0.5, bin_number+0.5 ); - if (expertHistograms.regHist(m_numberOfTEsHist_runsummary).isFailure()){ - msg() << MSG::WARNING << "Can't book " - << m_numberOfTEsHist_runsummary->GetName() << endmsg; - } - if ( m_useLBHistos) { - m_numberOfTEsHist = new TrigLBNHist<TH1I>(*m_numberOfTEsHist_runsummary); - m_numberOfTEsHist->SetNameTitle(name.c_str(), title.c_str()); - } - */ - + */ std::string name = "NumberOfActiveTEs"; std::string title = "TE abundance in "+ m_trigLvl; m_numberOfTEsHist = new TH1I(name.c_str(),title.c_str(), bin_number,0.5, bin_number+0.5) ; @@ -286,98 +195,37 @@ StatusCode TrigTEMoni::bookHistograms( bool/* isNewEventsBlock*/, bool /*isNewLu /* histo for number of all TE */ - - /* - title = "all TE abundance in "+ m_trigLvl; - run_title = totle + " Run Summary"; - name = "allTEnumber_" + m_trigLvl; - run_name = name + "_runsummary"; - m_numberOfallTEsHist_runsummary =new TH1I(run_name.c_str(),run_title.c_str(), bin_number,0.5, bin_number+0.5 ); - if (expertHistograms.regHist(m_numberOfallTEsHist_runsummary).isFailure()){ - msg() << MSG::WARNING << "Can't book " - << m_numberOfallTEsHist_runsummary ->GetName() << endmsg; - } - if ( m_useLBHistos ) { - m_numberOfallTEsHist = new TrigLBNHist<TH1I>(*m_numberOfallTEsHist_runsummary); - m_numberOfallTEsHist->SetNameTitle(name.c_str(), title.c_str()); - } - */ name = "NumberOfAllTEs"; title = "All TE abundance in "+ m_trigLvl; m_numberOfallTEsHist =new TH1I(name.c_str(),title.c_str(), bin_number,0.5, bin_number+0.5 ) ; if ( expertHistograms.regHist( m_numberOfallTEsHist ).isFailure()) msg() << MSG::WARNING << "Can't book histogram " << name << endmsg; - /* 2dhisto for number of input TEs */ - /* - title = "number of TE per event in "+ m_trigLvl; - run_title = title + " Run Summary"; - name = "TEnumberevent_" + m_trigLvl; - run_name = name + "_runsummary"; - m_numberOfTEsHist2d_runsummary =new TH2I(run_name.c_str(),run_title.c_str(), bin_number,0.5, bin_number+0.5 , 20,-0.5,19.5 ); - - if (expertHistograms.regHist(m_numberOfTEsHist2d_runsummary).isFailure()){ - msg() << MSG::WARNING << "Can't book " - << m_numberOfTEsHist2d_runsummary ->GetName() << endmsg; - } - if ( m_useLBHistos ) { - m_numberOfTEsHist2d = new TrigLBNHist<TH2I>(*m_numberOfTEsHist2d_runsummary); - m_numberOfTEsHist2d->SetNameTitle(name.c_str(), title.c_str()); - - - } - */ - name = "NumberOfActiveTEsPerEvent"; title = "Number of TE per event in "+ m_trigLvl; m_numberOfTEsHist2d =new TH2I(name.c_str(),title.c_str(), bin_number,0.5, bin_number+0.5 , 20,-0.5,19.5 ) ; if ( expertHistograms.regHist( m_numberOfTEsHist2d ).isFailure()) msg() << MSG::WARNING << "Can't book Trig histogram " << name << endmsg; - - - - /* 2dhisto for number of all input TEs - */ - /* - title = "number of all TE per event in "+ m_trigLvl; - run_title = title + " Run Summary"; - name = "allTEnumberevent_" + m_trigLvl; - run_name = name + "_runsummary"; - m_numberOfallTEsHist2d_runsummary =new TH2I(run_name.c_str(),run_title.c_str(), bin_number,0.5, bin_number+0.5 , 20,-0.5,19.5 ); - - if (expertHistograms.regHist(m_numberOfallTEsHist2d_runsummary).isFailure()){ - msg() << MSG::WARNING << "Can't book " - << m_numberOfallTEsHist2d_runsummary ->GetName() << endmsg; - } - if ( m_useLBHistos ) { - m_numberOfallTEsHist2d = new TrigLBNHist<TH2I>(m_numberOfallTEsHist2d_runsummary); - m_numberOfallTEsHist2d->SetNameTitle(name.c_str(), title.c_str()); - } - */ - + */ name = "NumberOfAllTEsPerEvent"; title = "Number of all TE per event in "+ m_trigLvl; m_numberOfallTEsHist2d = new TH2I(name.c_str(),title.c_str(), bin_number,0.5, bin_number+0.5 , 20,-0.5,19.5 ); if ( expertHistograms.regHist( m_numberOfallTEsHist2d ).isFailure()) msg() << MSG::WARNING << "Can't book Trig histogram " << name << endmsg; - - - - - + if(m_trigLvl != "EF"){ /* histo for number of input TEs from LVL1 */ name = "NumberOfLvl1TEs"; - + title = "LVL1-TEs abundance in (L1 threshods counts)"+ m_trigLvl; if(bin_number_lvl1>0){ @@ -386,40 +234,16 @@ StatusCode TrigTEMoni::bookHistograms( bool/* isNewEventsBlock*/, bool /*isNewLu m_numberOflvl1TEsHist =new TH1I(name.c_str(),title.c_str(), 1,-0.5,0.5 ); } - if ( expertHistograms.regHist( m_numberOflvl1TEsHist ).isFailure()) - msg() << MSG::WARNING << "Can't book Trig histogram " << name << endmsg; - - - - - - /* - histo for number of all input TEs from LVL1 - */ - /* L1 TEs can not be deactivated - title = "all LVL1-TE abundance in "+ m_trigLvl; - - name = "alllvl1TEnumber_" + m_trigLvl; - - if(bin_number_lvl1>0){ - m_numberOfalllvl1TEsHist =new TrigLBNHist<TH1I>(TH1I(name.c_str(),title.c_str(), bin_number_lvl1,0.5, bin_number_lvl1+0.5 )); - }else{ - m_numberOfalllvl1TEsHist =new TrigLBNHist<TH1I>(TH1I(name.c_str(),title.c_str(), 1,-0.5,0.5)); - } - - if ( expertHistograms.regHist( (ITrigLBNHist*)m_numberOfalllvl1TEsHist ).isFailure()) - msg() << MSG::WARNING << "Can't book TrigLBN histogram " << name << endmsg; - */ - - + if ( expertHistograms.regHist( m_numberOflvl1TEsHist ).isFailure()) + msg() << MSG::WARNING << "Can't book Trig histogram " << name << endmsg; /* 2dhisto for number of input TEs from LVL1 */ - name = "NumberOfLvl1TEsPerEvent"; + name = "NumberOfLvl1TEsPerEvent"; title = "LVL1-TEs abundance per event in (threshold multiplicities)"+ m_trigLvl; - + if(bin_number_lvl1>0){ m_numberOflvl1TEsHist2d = new TH2I(name.c_str(), title.c_str(), bin_number_lvl1,0.5, bin_number_lvl1+0.5, 20,-0.5,19.5 ); }else{ @@ -427,33 +251,14 @@ StatusCode TrigTEMoni::bookHistograms( bool/* isNewEventsBlock*/, bool /*isNewLu } if ( expertHistograms.regHist( m_numberOflvl1TEsHist2d ).isFailure()) msg() << MSG::WARNING << "Can't book Trig histogram " << name << endmsg; - - - - - /* - 2dhisto for number of all input TEs from LVL1 - */ - /* - title = "number of all LVL1-TE per event in "+ m_trigLvl; - name = "alllvl1TEnumberevent_" + m_trigLvl; - if(bin_number_lvl1>0){ - m_numberOfalllvl1TEsHist2d =new TrigLBNHist<TH2I>(TH2I(name.c_str(), title.c_str(), bin_number_lvl1,0.5, bin_number_lvl1+0.5, 20,-0.5,19.5 )); - }else{ - m_numberOfalllvl1TEsHist2d =new TrigLBNHist<TH2I>(TH2I(name.c_str(), title.c_str(), 1,-0.5, 0.5, 20,-0.5,19.5 )); - } - - if ( expertHistograms.regHist( (ITrigLBNHist*)m_numberOfalllvl1TEsHist2d ).isFailure()) - msg() << MSG::WARNING << "Can't book TrigLBN histogram " << name << endmsg; - */ + }//"EF" //naming the histogram bins according to TE label int tmpbin=0; - for ( std::vector< unsigned int >::iterator type = m_configuredTETypes.begin(); - type != m_configuredTETypes.end(); ++type) { - TrigConf::HLTTriggerElement::getLabel ((*type),tmpstring); + for ( unsigned int type : m_configuredTETypes ) { + TrigConf::HLTTriggerElement::getLabel (type,tmpstring); tmpbin++; m_numberOfTEsHist->GetXaxis()->SetBinLabel(tmpbin,tmpstring.c_str()); @@ -466,16 +271,12 @@ StatusCode TrigTEMoni::bookHistograms( bool/* isNewEventsBlock*/, bool /*isNewLu if(m_trigLvl!="EF"){// LVL1 TES only for L2 and HLT tmpbin=0; - for ( std::vector< unsigned int >::iterator type = m_configuredlvl1TETypes.begin(); - type != m_configuredlvl1TETypes.end(); ++type) { - TrigConf::HLTTriggerElement::getLabel ((*type),tmpstring); + for ( unsigned int type : m_configuredlvl1TETypes ) { + TrigConf::HLTTriggerElement::getLabel (type,tmpstring); tmpbin++; - m_numberOflvl1TEsHist->GetXaxis()->SetBinLabel(tmpbin,tmpstring.c_str()); - // m_numberOfalllvl1TEsHist->GetXaxis()->SetBinLabel(tmpbin,tmpstring.c_str()); - + m_numberOflvl1TEsHist->GetXaxis()->SetBinLabel(tmpbin,tmpstring.c_str()); m_numberOflvl1TEsHist2d->GetXaxis()->SetBinLabel(tmpbin,tmpstring.c_str()); - // m_numberOfalllvl1TEsHist2d->GetXaxis()->SetBinLabel(tmpbin,tmpstring.c_str()); }//for ...m_configuredlvl1TETypes.begin } @@ -499,45 +300,31 @@ StatusCode TrigTEMoni::fillHists() } - for ( std::vector< unsigned int >::iterator type = m_configuredTETypes.begin(); - type != m_configuredTETypes.end(); ++type) { + for ( unsigned int type : m_configuredTETypes ) { - m_numberOfTEsHist->Fill( m_labels[ (*type) ], - m_parentAlg->getAlgoConfig()->getNavigation()->countAllOfType((*type),true)); + m_numberOfTEsHist->Fill( m_labels[type], + m_parentAlg->getAlgoConfig()->getNavigation()->countAllOfType(type,true)); - m_numberOfallTEsHist->Fill( m_labels[ (*type) ], - m_parentAlg->getAlgoConfig()->getNavigation()->countAllOfType((*type),false)); + m_numberOfallTEsHist->Fill( m_labels[type], + m_parentAlg->getAlgoConfig()->getNavigation()->countAllOfType(type,false)); //2dhistos - m_numberOfTEsHist2d->Fill( m_labels[ (*type) ], - m_parentAlg->getAlgoConfig()->getNavigation()->countAllOfType((*type),true)); + m_numberOfTEsHist2d->Fill( m_labels[type], + m_parentAlg->getAlgoConfig()->getNavigation()->countAllOfType(type,true)); - m_numberOfallTEsHist2d->Fill( m_labels[ (*type) ], - m_parentAlg->getAlgoConfig()->getNavigation()->countAllOfType((*type),false)); + m_numberOfallTEsHist2d->Fill( m_labels[type], + m_parentAlg->getAlgoConfig()->getNavigation()->countAllOfType(type,false)); } if(m_trigLvl != "EF"){ - for ( std::vector< unsigned int >::iterator type = m_configuredlvl1TETypes.begin(); - type != m_configuredlvl1TETypes.end(); ++type) { + for ( unsigned int type : m_configuredlvl1TETypes ) { - //for ( std::vector< unsigned int >::iterator type = m_configuredlvl1TETypes_from_lvl1config.begin(); - // type != m_configuredlvl1TETypes_from_lvl1config.end(); ++type) { - - - - - m_numberOflvl1TEsHist->Fill( m_lvl1labels[ (*type) ], - m_parentAlg->getAlgoConfig()->getNavigation()->countAllOfType((*type),true)); - - // m_numberOfalllvl1TEsHist->Fill( m_lvl1labels[ (*type) ], - // m_parentAlg->getAlgoConfig()->getNavigation()->countAllOfType((*type),false)); - + m_numberOflvl1TEsHist->Fill( m_lvl1labels[type], + m_parentAlg->getAlgoConfig()->getNavigation()->countAllOfType(type,true)); + //2d histos - m_numberOflvl1TEsHist2d->Fill( m_lvl1labels[ (*type) ], - m_parentAlg->getAlgoConfig()->getNavigation()->countAllOfType((*type),true)); + m_numberOflvl1TEsHist2d->Fill( m_lvl1labels[type], + m_parentAlg->getAlgoConfig()->getNavigation()->countAllOfType(type,true)); - // m_numberOfalllvl1TEsHist2d->Fill( m_lvl1labels[ (*type) ], - // m_parentAlg->getAlgoConfig()->getNavigation()->countAllOfType((*type),false)); - } } return StatusCode::SUCCESS; diff --git a/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigTEMoni.h b/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigTEMoni.h index 0d57bcca58553b9603f5c828e5146a19fe10dd5e..a13b0747d9cd0d7949e3ed526868216bed3d8563 100644 --- a/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigTEMoni.h +++ b/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigTEMoni.h @@ -14,7 +14,7 @@ * @author Gordon Fischer Gordon.Fischer@cern.ch * * File and Version Information: - * $Id: TrigTEMoni.h 761301 2016-07-12 11:51:07Z fwinkl $ + * $Id: TrigTEMoni.h 771932 2016-09-06 12:53:25Z fwinkl $ **********************************************************************************/ @@ -53,44 +53,22 @@ class TrigTEMoni: public TrigMonitorToolBase { private: ServiceHandle<TrigConf::ILVL1ConfigSvc> m_lvl1ConfigSvc; //!< handle for the LVL1 configuration service - const HLT::TrigSteer* m_parentAlg; // should give us pointer to TrigSteer topAlgorithm!!! + const HLT::TrigSteer* m_parentAlg{0}; // should give us pointer to TrigSteer topAlgorithm!!! - //std::vector<TH1I*> m_numberOfTEsHist; - TH1I *m_numberOfTEsHist; - // TH1I *m_numberOfTEsHist_runsummary; - TH1I *m_numberOfallTEsHist; - // TH1I *m_numberOfallTEsHist_runsummary; - - TH1I *m_numberOflvl1TEsHist; - // TH1I *m_numberOflvl1TEsHist_runsummary; - TH1I * m_numberOfalllvl1TEsHist; - // TH1I *m_numberOfalllvl1TEsHist_runsummary; - - TH2I *m_numberOfTEsHist2d; - // TH2I *m_numberOfTEsHist2d_runsummary; - TH2I *m_numberOfallTEsHist2d; - // TH2I *m_numberOfallTEsHist2d_runsummary; - - - TH2I *m_numberOflvl1TEsHist2d; - // TH2I *m_numberOflvl1TEsHist2d_runsummary; - TH2I *m_numberOfalllvl1TEsHist2d; - // TH2I *m_numberOfalllvl1TEsHist2d_runsummary; + TH1I *m_numberOfTEsHist{0}; + TH1I *m_numberOfallTEsHist{0}; + TH1I *m_numberOflvl1TEsHist{0}; + TH1I *m_numberOfalllvl1TEsHist{0}; + TH2I *m_numberOfTEsHist2d{0}; + TH2I *m_numberOfallTEsHist2d{0}; + TH2I *m_numberOflvl1TEsHist2d{0}; + TH2I *m_numberOfalllvl1TEsHist2d{0}; - - // unsigned m_reserveLumiHistos; - // unsigned int m_bookedLumiHistos; - // std::string m_histoPathexpert; std::vector< unsigned int > m_configuredTETypes; std::vector< unsigned int > m_configuredlvl1TETypes; - //std::vector< unsigned int > m_configuredlvl1TETypes_from_lvl1config; std::map< unsigned int, unsigned int > m_labels; // TriggerElement ID -> bin std::map<unsigned int,unsigned int> m_lvl1labels;//TriggerElement ID -> bin - //std::map<unsigned int,unsigned int> m_lvl1cclabels;//TriggerElement ID -> bin - - // std::map<int,int > m_lumiBlockIndex; std::string m_trigLvl; - };