diff --git a/Hlt/HltGlobalMonitor/doc/release.notes b/Hlt/HltGlobalMonitor/doc/release.notes index 28ff822ba2dd3947e07d6090f7689fc92af54df8..863f773721ced325570f8cc7fb48f1bbbb258dc9 100755 --- a/Hlt/HltGlobalMonitor/doc/release.notes +++ b/Hlt/HltGlobalMonitor/doc/release.notes @@ -5,6 +5,15 @@ !Purpose : LHCb HLT Global Monitoring ! ----------------------------------------------------------------------------- +! 2016-04-21 - Rosen Matev + - ODIN-related improvements in HltGlobalMonitor + - Add histograms for monitoring ODIN event types (before and after HLT). + - Rename exiting ODIN histograms for trigger types. + - Remove weird offset (904262401 == 1998-08-28T00:00:01+00:00) in + m_gpstimesec and made it a double. + - ODIN histograms after Hlt use Stage to check the correct Hlt[12]Global + decision (removed the now unused property HltDecName). + !========================= HltGlobalMonitor v5r4 2015-12-17 ========================= ! 2015-12-06 - Gerhard Raven diff --git a/Hlt/HltGlobalMonitor/src/HltGlobalMonitor.cpp b/Hlt/HltGlobalMonitor/src/HltGlobalMonitor.cpp index 41ab7912a33f4731189b5b870a188592d4ca1c35..0c21c9fd959174a28488c2a7f9ca2872e56cfa18 100755 --- a/Hlt/HltGlobalMonitor/src/HltGlobalMonitor.cpp +++ b/Hlt/HltGlobalMonitor/src/HltGlobalMonitor.cpp @@ -101,7 +101,6 @@ HltGlobalMonitor::HltGlobalMonitor( const string& name, // (half an hour) declareProperty( "TimeInterval", m_timeInterval = 1 ); // binwidth in minutes declareProperty( "DecToGroup", m_decToGroup ); - declareProperty( "HltDecName", m_hltDecision = "Hlt1Global" ); declareProperty( "RawEventLocation", m_rawEventLocation = LHCb::RawEventLocation::Default ); declareProperty("CorrelateCPUWith", @@ -111,6 +110,11 @@ HltGlobalMonitor::HltGlobalMonitor( const string& name, {"Hlt2/Track/Forward", Gaudi::Histo1DDef( "Forward", -0.5, 599.5, 120 )}} ); declareProperty( "VertexLocations", m_vertexLocations ); + + for (int i = 0; i < 16; ++i) { + m_odinEventTypeMasks[i] = 1 << i; + } + m_odinEventTypeMasks[16] = 0xFFFF; } //============================================================================= // Destructor @@ -149,10 +153,10 @@ StatusCode HltGlobalMonitor::initialize() m_lhcNCollidingBunches = 0; - m_odin = book1D( "ODIN trigger type", "ODIN trigger Type ", -0.5, 7.5, 8 ); - m_odinHLT = book1D( string{"ODIN_"} + m_stage, string{"ODIN trigger Type, after "} + m_stage, -0.5, 7.5, 8 ); + m_odinTrgTyp = book1D( "ODIN trigger type", -0.5, 7.5, 8 ); + m_odinTrgTypHLT = book1D( "ODIN trigger type after " + m_stage, -0.5, 7.5, 8 ); - vector<pair<unsigned, string>> odinLabels = { + vector<pair<unsigned, string>> odinTrgTypLabels = { {ODIN::PhysicsTrigger, "Physics"}, {ODIN::BeamGasTrigger, "BeamGas"}, {ODIN::LumiTrigger, "Lumi"}, @@ -161,12 +165,48 @@ StatusCode HltGlobalMonitor::initialize() {ODIN::NonZSupTrigger, "NonZSup"}, {ODIN::TimingTrigger, "Timing"}, {ODIN::CalibrationTrigger, "Calibration"}}; - if ( !setBinLabels( m_odin, odinLabels ) ) { - error() << "failed to set binlables on ODIN hist" << endmsg; + if ( !setBinLabels( m_odinTrgTyp, odinTrgTypLabels ) ) { + error() << "failed to set binlables on ODIN trigger type hist" << endmsg; + } + setBinLabels( m_odinTrgTypHLT, odinTrgTypLabels ); + + + std::string histName; + m_odinEvtTyp = book1D(histName="ODIN event type", -0.5, 16.5, 17); + declareInfo(histName, m_odinEvtTyp, histName); + m_odinEvtTypHLT = book1D(histName="ODIN event type after " + m_stage, -0.5, 16.5, 17); + declareInfo(histName, m_odinEvtTypHLT, histName); + m_odinBXEvtTyp = book2D(histName="ODIN BX vs event type", -0.5, 16.5, 17, -0.5, 3.5, 4); + declareInfo(histName, m_odinBXEvtTyp, histName); + m_odinBXEvtTypHLT = book2D(histName="ODIN BX vs event type after " + m_stage, -0.5, 16.5, 17, -0.5, 3.5, 4); + declareInfo(histName, m_odinBXEvtTypHLT, histName); + + vector<pair<unsigned, string>> odinEvtTypLabels; + odinEvtTypLabels.reserve(17); + for (int i = 0; i < 16; ++i) { + std::ostringstream ss; + ss << static_cast<ODIN::EventTypes>(m_odinEventTypeMasks[i]); + odinEvtTypLabels.emplace_back(i, ss.str()); + } + odinEvtTypLabels.emplace_back(16, "ANY"); + if (!setBinLabels(m_odinEvtTyp, odinEvtTypLabels)) { + error() << "failed to set binlables on ODIN event type hist" << endmsg; + } + setBinLabels(m_odinEvtTypHLT, odinEvtTypLabels); + + vector<pair<unsigned, string>> odinBXTypeLabels = { + {ODIN::NoBeam, "NoBeam"}, + {ODIN::Beam1, "Beam1"}, + {ODIN::Beam2, "Beam2"}, + {ODIN::BeamCrossing, "Crossing"} + }; + if (!setBinLabels(m_odinBXEvtTyp, odinEvtTypLabels, odinBXTypeLabels)) { + error() << "failed to set binlables on ODIN event type hist" << endmsg; } - if ( m_odinHLT ) setBinLabels( m_odinHLT, odinLabels ); + setBinLabels(m_odinBXEvtTypHLT, odinEvtTypLabels, odinBXTypeLabels); - m_gpstimesec = 0; + + m_gpstimesec = 0.; m_startClock = high_resolution_clock::now(); // System::currentTime( System::microSec ); // create a histogram with one bin per Alley // the order and the names for the bins are @@ -482,15 +522,29 @@ void HltGlobalMonitor::monitorODIN( const LHCb::ODIN* odin, if ( !odin ) return; auto gpstime = odin->gpsTime(); if ( msgLevel( MSG::DEBUG ) ) debug() << "gps time" << gpstime << endmsg; - m_gpstimesec = - int( gpstime / 1000000 - 904262401 ); //@TODO: is this still OK with ODIN v6? - counter( "ODIN::Lumi" ) += ( odin->triggerType() == ODIN::LumiTrigger ); - counter( "ODIN::NotLumi" ) += ( odin->triggerType() != ODIN::LumiTrigger ); - fill( m_odin, odin->triggerType(), 1. ); - - // now check HLT decisions for rejected events after Hlt - const auto* report = decReports ? decReports->decReport( m_hltDecision ) : nullptr; - if ( report && report->decision() ) fill( m_odinHLT, odin->triggerType(), 1. ); + m_gpstimesec = gpstime / 1e6; + counter( "ODIN::Lumi" ) += bool( odin->eventType() & ODIN::Lumi ); + // TODO the following counter is not well defined. Do we need it? + counter( "ODIN::NotLumi" ) += !bool( odin->eventType() & ODIN::Lumi ); + fill( m_odinTrgTyp, odin->triggerType(), 1. ); + + const auto* report = decReports ? decReports->decReport( m_stage + "Global" ) : nullptr; + bool passedHlt = report && report->decision(); + if ( passedHlt ) fill( m_odinTrgTypHLT, odin->triggerType(), 1. ); + + auto eventType = odin->eventType(); + auto bxType = odin->bunchCrossingType(); + + for ( std::size_t i = 0; i < m_odinEventTypeMasks.size(); ++i ) { + if ( eventType & m_odinEventTypeMasks[i] ) { + m_odinEvtTyp->fill( i ); + m_odinBXEvtTyp->fill( i, bxType ); + if ( passedHlt ) { + m_odinEvtTypHLT->fill( i ); + m_odinBXEvtTypHLT->fill( i, bxType ); + } + } + } } //============================================================================== diff --git a/Hlt/HltGlobalMonitor/src/HltGlobalMonitor.h b/Hlt/HltGlobalMonitor/src/HltGlobalMonitor.h index 822691bf63c4f63753777fd2f683a485c9789a05..082dc1cf8c1b5339dcb2ef2060ff326f7205e859 100755 --- a/Hlt/HltGlobalMonitor/src/HltGlobalMonitor.h +++ b/Hlt/HltGlobalMonitor/src/HltGlobalMonitor.h @@ -78,11 +78,16 @@ class HltGlobalMonitor : public HltBaseAlg, virtual public IIncidentListener std::string m_stage; std::string m_hltDecReportsLocation; std::string m_ODINLocation; - std::string m_hltDecision; std::string m_rawEventLocation; - AIDA::IHistogram1D* m_odin = nullptr; - AIDA::IHistogram1D* m_odinHLT = nullptr; + std::array<unsigned int, 17> m_odinEventTypeMasks; + + AIDA::IHistogram1D* m_odinTrgTyp = nullptr; + AIDA::IHistogram1D* m_odinTrgTypHLT = nullptr; + AIDA::IHistogram1D* m_odinEvtTyp = nullptr; + AIDA::IHistogram1D* m_odinEvtTypHLT = nullptr; + AIDA::IHistogram2D* m_odinBXEvtTyp = nullptr; + AIDA::IHistogram2D* m_odinBXEvtTypHLT = nullptr; AIDA::IHistogram1D* m_hltAlley = nullptr; @@ -185,6 +190,6 @@ class HltGlobalMonitor : public HltBaseAlg, virtual public IIncidentListener std::chrono::high_resolution_clock::time_point m_startClock; std::chrono::high_resolution_clock::time_point m_startEvent; long m_virtmem = 0; - int m_gpstimesec = 0; + double m_gpstimesec = 0; }; #endif // HLTGLOBALMONITOR_H