diff --git a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/TrigOnlineMonitor/TrigMuCTPiROBMonitor.h b/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/TrigOnlineMonitor/TrigMuCTPiROBMonitor.h deleted file mode 100755 index 14604becbcd86b5308204b9adbf7147744036ef5..0000000000000000000000000000000000000000 --- a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/TrigOnlineMonitor/TrigMuCTPiROBMonitor.h +++ /dev/null @@ -1,174 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "GaudiKernel/Algorithm.h" -#include "GaudiKernel/ServiceHandle.h" -#include "GaudiKernel/SmartIF.h" -#include "GaudiKernel/MsgStream.h" -#include "ByteStreamData/RawEvent.h" -#include "GaudiKernel/HistoProperty.h" -#include "eformat/Status.h" -#include <stdint.h> - -#include "TrigT1Result/MuCTPIRoI.h" - -///////////////////////////////////////////////////////////////////////////// - -namespace ROIB { - class MuCTPIResult; -} -class MuCTPI_RDO; -class StoreGateSvc; -class IROBDataProviderSvc; -class ITrigROBDataProviderSvc; -class TH1F; /// for monitoring purposes -class TH2F; /// for monitoring purposes -class TProfile2D; /// for monitoring purposes - -class TrigMuCTPiROBMonitor:public Algorithm { -public: - TrigMuCTPiROBMonitor(const std::string& name, ISvcLocator* pSvcLocator); - StatusCode initialize(); - StatusCode execute(); - StatusCode finalize(); - StatusCode beginRun(); - StatusCode endRun(); - -private: - /** @brief Pointer to MsgStream.*/ - MsgStream* m_msg; - - /** - * @brief Accessor method for the MsgStream. - * @return handle to the MsgStream. - */ - inline MsgStream& logStream() const { return *m_msg; } - - /** - * @brief Accessor method for the message level variable. - * @return value of the message level for this algorithm. - */ - inline MSG::Level logLevel() const { return (m_msg != 0) ? m_msg->level() : MSG::NIL; } - - typedef ServiceHandle<StoreGateSvc> StoreGateSvc_t; - /// Reference to StoreGateSvc; - StoreGateSvc_t m_storeGateSvc; - - typedef ServiceHandle<IROBDataProviderSvc> IIROBDataProviderSvc_t; - /// Reference to the ROBDataProviderSvc service - IIROBDataProviderSvc_t m_robDataProviderSvc; - /// Reference to a ROBDataProviderSvc which implements also the trigger additions - SmartIF<ITrigROBDataProviderSvc> m_trigROBDataProviderSvc; - - /// Source identifiers for ROB fragments - IntegerProperty m_lvl1CTPROBid ; - IntegerProperty m_lvl1MuCTPiROBid ; - IntegerProperty m_daqCTPROBid ; - IntegerProperty m_daqMuCTPiROBid ; - - /// Number of pt Thresholds - static const uint32_t NUMBER_OF_PT_THRESHOLDS = 6; // Number of pT thresholds - - /// Number of sector IDs - static const uint32_t NUMBER_OF_ENDCAP_UNITS = 48; // Number of endcap sector IDs - static const uint32_t NUMBER_OF_FORWARD_UNITS = 24; // Number of forward sector IDs - static const uint32_t NUMBER_OF_BARREL_UNITS = 32; // Number of barrel sector IDs - IntegerProperty m_Number_Of_Endcap_Units ; - IntegerProperty m_Number_Of_Forward_Units ; - IntegerProperty m_Number_Of_Barrel_Units ; - - /// Switch for setting the debug StreamTag and name for debug stream - BooleanProperty m_setDebugStream; - StringProperty m_debugStreamName; - - /// Switch for ROB checksum test - BooleanProperty m_doROBChecksum; - TH1F* m_hist_failedChecksumForROB; - Histo1DProperty m_histProp_failedChecksumForROB; - TH1F* m_hist_failedChecksumForSD; - Histo1DProperty m_histProp_failedChecksumForSD; - - /// Switch for ROB status bit histograms - BooleanProperty m_doROBStatus; - TH2F* m_hist_genericStatusForROB; - TH2F* m_hist_specificStatusForROB; - std::map<eformat::GenericStatus, std::string> m_map_GenericStatus; - std::vector<std::string> m_vec_SpecificStatus; - - /// vectors with CTP and muCTPi ROB Ids - std::vector<uint32_t> m_ctpRobIds; - std::vector<uint32_t> m_muCTPiRobIds; - - /// pointers to the CTP and muCTPi result objects - ROIB::MuCTPIResult* m_lvl1muCTPIResult; // RoIB muCTPi Result - MuCTPI_RDO* m_daqmuCTPIResult; // DAQ muCTPi Result - - /// trigger muCTPi RoIs from L1 and DAQ ROB - std::vector<ROIB::MuCTPIRoI> m_lvl1muCTPIRoIs; // RoIs from RoIB muCTPi ROB - std::vector<ROIB::MuCTPIRoI> m_daqmuCTPIRoIs; // RoIs from DAQ muCTPi ROB - - std::vector<uint32_t> m_lvl1muCTPIHash_Endcap; // Hash for RoIs from RoIB - std::vector<uint32_t> m_lvl1muCTPIHash_Forward; // Hash for RoIs from RoIB - std::vector<uint32_t> m_lvl1muCTPIHash_Barrel; // Hash for RoIs from RoIB - - std::vector<uint32_t> m_daqmuCTPIHash_Endcap; // Hash for RoIs from DAQ ROB - std::vector<uint32_t> m_daqmuCTPIHash_Forward; // Hash for RoIs from DAQ ROB - std::vector<uint32_t> m_daqmuCTPIHash_Barrel; // Hash for RoIs from DAQ ROB - - /// MuCTPi monitoring histograms - TH1F* m_hist_NumberOfRoIs_RoIB; - TH1F* m_hist_NumberOfRoIs_DAQ; - Histo1DProperty m_histProp_NumberOfRoIs; - - std::vector<TH1F*> m_hist_muCTPiL1_Barrel_SectorID; - std::vector<TH1F*> m_hist_muCTPiDaq_Barrel_SectorID; - Histo1DProperty m_histProp_muCTPi_Barrel_SectorID; - - std::vector<TH1F*> m_hist_muCTPiL1_Endcap_SectorID; - std::vector<TH1F*> m_hist_muCTPiDaq_Endcap_SectorID; - Histo1DProperty m_histProp_muCTPi_Endcap_SectorID; - - std::vector<TH1F*> m_hist_muCTPiL1_Forward_SectorID; - std::vector<TH1F*> m_hist_muCTPiDaq_Forward_SectorID; - Histo1DProperty m_histProp_muCTPi_Forward_SectorID; - - std::vector<TH2F*> m_hist_muCTPiL1_Barrel_SectorID_Pad; - std::vector<TH2F*> m_hist_muCTPiDaq_Barrel_SectorID_Pad; - TProfile2D* m_hist_muCTPiDaq_Barrel_SectorID_Pad_DeltaBCID; - - TH1F* m_hist_differenceRoIs; - Histo1DProperty m_histProp_differenceRoIs; - - TH1F* m_hist_muCTPiL1_Problem_Barrel_Hash; - TH1F* m_hist_muCTPiDaq_Problem_Barrel_Hash; - Histo1DProperty m_histProp_Problem_Barrel_Hash; - - TH1F* m_hist_muCTPiL1_Problem_Endcap_Hash; - TH1F* m_hist_muCTPiDaq_Problem_Endcap_Hash; - Histo1DProperty m_histProp_Problem_Endcap_Hash; - - TH1F* m_hist_muCTPiL1_Problem_Forward_Hash; - TH1F* m_hist_muCTPiDaq_Problem_Forward_Hash; - Histo1DProperty m_histProp_Problem_Forward_Hash; - - BooleanProperty m_doTiming; - TH1F* m_hist_timeMuCTPi; - Histo1DProperty m_histProp_timeMuCTPi; - - /// Helper for checksum test - /// returns true if a ROB checksum failed - bool verifyROBChecksum(MsgStream& log, OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment robFrag); - - /// Helper for status bits test - void verifyROBStatusBits(MsgStream& log, OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment robFrag); - - /// Helper for decoding the muCTPi RoIB and DAQ ROB - void decodeMuCTPi(MsgStream& log, OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment robFrag); - - /// Helper for converting a mirod DAQ data word to a muCTPi RoIB data word - uint32_t mirodToRoIBDataWord( uint32_t data_word ); - - /// Helper to print contents of a muCTPi RoIB data word - void dumpRoIBDataWord(MsgStream& log, uint32_t data_word ); -}; diff --git a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/TrigOnlineMonitor/TrigROBMonitor.h b/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/TrigOnlineMonitor/TrigROBMonitor.h deleted file mode 100755 index ffb7a229fec085b932084f194acae96cdc125329..0000000000000000000000000000000000000000 --- a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/TrigOnlineMonitor/TrigROBMonitor.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "GaudiKernel/Algorithm.h" -#include "GaudiKernel/ServiceHandle.h" -#include "GaudiKernel/SmartIF.h" -#include "GaudiKernel/MsgStream.h" -#include "ByteStreamData/RawEvent.h" -#include "GaudiKernel/HistoProperty.h" -#include "eformat/Status.h" -#include <stdint.h> - -///////////////////////////////////////////////////////////////////////////// - -class StoreGateSvc; -class IROBDataProviderSvc; -class ITrigROBDataProviderSvc; -class TH1F; /// for monitoring purposes -class TH2F; /// for monitoring purposes -class TProfile;/// for monitoring purposes - -class TrigROBMonitor:public Algorithm { -public: - TrigROBMonitor(const std::string& name, ISvcLocator* pSvcLocator); - StatusCode initialize(); - StatusCode execute(); - StatusCode finalize(); - StatusCode beginRun(); - StatusCode endRun(); - -private: - /** @brief Pointer to MsgStream.*/ - MsgStream* m_msg; - - /** - * @brief Accessor method for the MsgStream. - * @return handle to the MsgStream. - */ - inline MsgStream& logStream() const { return *m_msg; } - - /** - * @brief Accessor method for the message level variable. - * @return value of the message level for this algorithm. - */ - inline MSG::Level logLevel() const { return (m_msg != 0) ? m_msg->level() : MSG::NIL; } - - typedef ServiceHandle<StoreGateSvc> StoreGateSvc_t; - /// Reference to StoreGateSvc; - StoreGateSvc_t m_storeGateSvc; - - typedef ServiceHandle<IROBDataProviderSvc> IIROBDataProviderSvc_t; - /// Reference to the ROBDataProviderSvc service - IIROBDataProviderSvc_t m_robDataProviderSvc; - /// Reference to a ROBDataProviderSvc which implements also the trigger additions - SmartIF<ITrigROBDataProviderSvc> m_trigROBDataProviderSvc; - - /// Switch for setting the debug StreamTag and name for debug stream - BooleanProperty m_setDebugStream; - StringProperty m_debugStreamName; - - /// Switch for ROB checksum test - BooleanProperty m_doROBChecksum; - TH1F* m_hist_failedChecksumForROB; - Histo1DProperty m_histProp_failedChecksumForROB; - TH1F* m_hist_failedChecksumForSD; - Histo1DProperty m_histProp_failedChecksumForSD; - - /// Switch for ROB status bit histograms - BooleanProperty m_doROBStatus; - TH2F* m_hist_genericStatusForROB; - TH2F* m_hist_specificStatusForROB; - std::map<eformat::GenericStatus, std::string> m_map_GenericStatus; - std::vector<std::string> m_vec_SpecificStatus; - - /// Switch for ROB data volume histograms - BooleanProperty m_doROBDataVolume; - TH1F* m_hist_totalDataVolumeROB; - Histo1DProperty m_histProp_totalDataVolumeROB; - TProfile* m_hist_dataVolumeFractionForSD; - - /// Helper for checksum test - /// returns true if a ROB checksum failed - bool verifyROBChecksum(MsgStream& log, OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment robFrag); - - /// Helper for status bits test - void verifyROBStatusBits(MsgStream& log, OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment robFrag); -}; diff --git a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/cmt/requirements b/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/cmt/requirements deleted file mode 100644 index 164645b717ec2cdc321a959fda85599935d9fec2..0000000000000000000000000000000000000000 --- a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/cmt/requirements +++ /dev/null @@ -1,31 +0,0 @@ -package TrigOnlineMonitor - -author W. Wiedenmann <Werner.Wiedenmann@cern.ch> - -use AtlasPolicy AtlasPolicy-* -use DataCollection DataCollection-* External -use GaudiInterface GaudiInterface-* External -use ByteStreamData ByteStreamData-* Event -use TrigT1Result TrigT1Result-* Trigger/TrigT1 - -private -use AthenaBaseComps AthenaBaseComps-* Control -use AtlasROOT AtlasROOT-* External -use AthenaKernel AthenaKernel-* Control -use TrigROBDataProviderSvc TrigROBDataProviderSvc-* Trigger/TrigDataAccess -use EventInfo EventInfo-* Event -use ByteStreamCnvSvcBase ByteStreamCnvSvcBase-* Event -use StoreGate StoreGate-* Control -use TrigMonitorBase TrigMonitorBase-* Trigger/TrigMonitoring -use L1TopoRDO L1TopoRDO-* Trigger/TrigT1/L1Topo -use TrigSteering TrigSteering-* Trigger/TrigSteer - -library TrigOnlineMonitor *.cxx -s=components *.cxx -apply_pattern component_library - -apply_pattern declare_joboptions files="*.py" - -# REMOVE BEFORE COMMIT!!! -#private -#macro cppdebugflags '$(cppdebugflags_s)' -#macro_remove componentshr_linkopts "-Wl,-s" diff --git a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/share/TrigL1TopoROBMonitor.py b/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/share/TrigL1TopoROBMonitor.py deleted file mode 100644 index 2a349c56adec45f9595865f88854de190e709cca..0000000000000000000000000000000000000000 --- a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/share/TrigL1TopoROBMonitor.py +++ /dev/null @@ -1,29 +0,0 @@ -#************************************************************** -# -# TrigL1TopoROBMonitor.py -# -#============================================================== -from AthenaCommon.Constants import * -from AthenaCommon import CfgMgr -L1TopoROBMonitor = CfgMgr.TrigL1TopoROBMonitor("L1TopoROBMonitor") - -#-------------------------------------------------------------- -# Add the algorithm to the topSequence -# (in L2 it should be running after steering, so that the ROB -# cache is already filled) -#-------------------------------------------------------------- -from AthenaCommon.AlgSequence import AlgSequence -topSequence = AlgSequence() -topSequence += L1TopoROBMonitor -#L1TopoROBMonitor.OutputLevel=1 - -#-------------------------------------------------------------- -# Private Application Configuration options -#-------------------------------------------------------------- -# -# -#============================================================== -# -# End of TrigROBMonitor.py -# -#************************************************************** diff --git a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/share/TrigMuCTPiROBMonitor.py b/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/share/TrigMuCTPiROBMonitor.py deleted file mode 100755 index 835aac0940093f038880c16adafcfe53ffb4c700..0000000000000000000000000000000000000000 --- a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/share/TrigMuCTPiROBMonitor.py +++ /dev/null @@ -1,79 +0,0 @@ -#************************************************************** -# -# TrigMuCTPiROBMonitor.py -# -#============================================================== -from AthenaCommon.Constants import * -from AthenaCommon import CfgMgr -MuCTPiROBMonitor = CfgMgr.TrigMuCTPiROBMonitor("MuCTPiROBMonitor") - -#-------------------------------------------------------------- -# Add the algorithm to the topSequence -# (in L2 it should be running after steering, so that the ROB -# cache is already filled) -#-------------------------------------------------------------- -from AthenaCommon.AlgSequence import AlgSequence -topSequence = AlgSequence() -topSequence += MuCTPiROBMonitor - -#-------------------------------------------------------------- -# Private Application Configuration options -#-------------------------------------------------------------- -# -# --- do ROB checksum test -# -#MuCTPiROBMonitor.TestROBChecksum = True -# -# --- Histogram definitions for ROB checksum test -# -#MuCTPiROBMonitor.HistFailedChecksumForROB = ('FailedChecksumForROB', 0, 50, 50) -#MuCTPiROBMonitor.HistFailedChecksumForSD = ('FailedChecksumForSubDetector', 0, 60, 60) -# -# --- put events with checksum failures on debug stream -# -#MuCTPiROBMonitor.SetDebugStream = True -# -# --- debug stream name for events with checksum failures -# -#MuCTPiROBMonitor.DebugStreamName = 'MuCTPiROBErrorStream' -# -# --- plot generic/specific status bits for ROB fragments -# -#MuCTPiROBMonitor.TestROBStatus = True -# -# ---- ROB Id for CTP/muCTPi ROB from L1 in Level-2 -# -#MuCTPiROBMonitor.Lvl1CTPROBid = 0x770001 -#MuCTPiROBMonitor.Lvl1MuCTPiROBid = 0x760001 -# -# ---- ROB Id for CTP/muCTPi ROB from L1 in DAQ -# -#MuCTPiROBMonitor.DaqCTPROBid = 0x770000 -#MuCTPiROBMonitor.DaqMuCTPiROBid = 0x760000 -# -# --- Number of Sectors/Units per side for Barrel/Endcap/Forward -# -#MuCTPiROBMonitor.NumberOfBarrelUnits = 32 -#MuCTPiROBMonitor.NumberOfEndcapUnits = 48 -#MuCTPiROBMonitor.NumberOfForwardUnits = 24 -# -# --- Histogram definitions for muCTPi monitor -# -#MuCTPiROBMonitor.HistNumberOfRoIs = ('Number_of_RoIs', 0, 50, 50) -#MuCTPiROBMonitor.HistSectorID_Barrel_muCTPi = ('muCTPi_SectorID_Barrel', 0, 32, 32) -#MuCTPiROBMonitor.HistSectorID_Endcap_muCTPi = ('muCTPi_SectorID_Endcap', 0, 48, 48) -#MuCTPiROBMonitor.HistSectorID_Forward_muCTPi = ('muCTPi_SectorID_Forward', 0, 24, 24) -#MuCTPiROBMonitor.HistDifferenceRoIs_RoIB_DAQ_muCTPi = ('muCTPi_differenceRoIs_RoIB_DAQ', -5, 5, 11) -#MuCTPiROBMonitor.HistBarrelHashforProblemRoIs = ('muCTPi_Barrel_Hash_for_RoIs_only_in' ,0, 100, 100) -#MuCTPiROBMonitor.HistEndcapHashforProblemRoIs = ('muCTPi_Endcap_Hash_for_RoIs_only_in' ,0, 100, 100) -#MuCTPiROBMonitor.HistForwardHashforProblemRoIs = ('muCTPi_Forward_Hash_for_RoIs_only_in',0, 100, 100) -# -# --- do timing for muCTPi monitoring algorithm -# -#MuCTPiROBMonitor.DoTiming = True -#MuCTPiROBMonitor.HistTimeMuCTPiMonitor = ('Time_MuCTPi_Monitor' ,0.,5.,50) -#============================================================== -# -# End of TrigMuCTPiROBMonitor.py -# -#************************************************************** diff --git a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/share/TrigROBMonitor.py b/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/share/TrigROBMonitor.py deleted file mode 100755 index 2284ba90ab9486aeb9d839a0552981fef56e8d28..0000000000000000000000000000000000000000 --- a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/share/TrigROBMonitor.py +++ /dev/null @@ -1,56 +0,0 @@ -#************************************************************** -# -# TrigROBMonitor.py -# -#============================================================== -from AthenaCommon.Constants import * -from AthenaCommon import CfgMgr -ROBMonitor = CfgMgr.TrigROBMonitor("ROBMonitor") - -#-------------------------------------------------------------- -# Add the algorithm to the topSequence -# (in L2 it should be running after steering, so that the ROB -# cache is already filled) -#-------------------------------------------------------------- -from AthenaCommon.AlgSequence import AlgSequence -topSequence = AlgSequence() -topSequence += ROBMonitor - -#-------------------------------------------------------------- -# Private Application Configuration options -#-------------------------------------------------------------- -# -# --- do ROB checksum test -# -#ROBMonitor.TestROBChecksum = True -# -# --- Histogram definitions for ROB checksum test -# -#ROBMonitor.HistFailedChecksumForROB = ('FailedChecksumForROB', 0, 50, 50) -#ROBMonitor.HistFailedChecksumForSD = ('FailedChecksumForSubDetector', 0, 60, 60) -# -# --- put events with checksum failures on debug stream -# -#ROBMonitor.SetDebugStream = True -# -# --- debug stream name for events with checksum failures -# -#ROBMonitor.DebugStreamName = 'RobErrorStream' -# -# --- plot generic/specific status bits for ROB fragments -# -#ROBMonitor.TestROBStatus = True -# -# --- plot ROB data volume -# -#ROBMonitor.PlotROBDataVolume = True -# -# --- Histogram definitions for ROB data volume -# -#ROBMonitor.HistTotalDataVolumeROB = ('totalDataVolumeForROBs', 0., 5000., 50) -# -#============================================================== -# -# End of TrigROBMonitor.py -# -#************************************************************** diff --git a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/TrigL1TopoROBMonitor.cxx b/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/TrigL1TopoROBMonitor.cxx deleted file mode 100644 index a4d614cca8dc74dae2547a31590ea774ae7bcee8..0000000000000000000000000000000000000000 --- a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/TrigL1TopoROBMonitor.cxx +++ /dev/null @@ -1,431 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "TrigL1TopoROBMonitor.h" -#include "L1TopoRDO/L1TopoRDOCollection.h" -#include "L1TopoRDO/Helpers.h" -#include "L1TopoRDO/Header.h" -#include "L1TopoRDO/Fibre.h" -#include "L1TopoRDO/Status.h" -#include "L1TopoRDO/L1TopoTOB.h" -#include "L1TopoRDO/BlockTypes.h" -#include "TrigT1Result/RoIBResult.h" - -#include "GaudiKernel/ThreadGaudi.h" -#include "AthenaKernel/Timeout.h" -#include "ByteStreamCnvSvcBase/IROBDataProviderSvc.h" -//#include "TrigROBDataProviderSvc/ITrigROBDataProviderSvc.h" -#include "GaudiKernel/ITHistSvc.h" -#include <TH1F.h> -//#include <TH2F.h> -//#include <TProfile.h> - -#include "TrigMonitorBase/TrigLockedHist.h" -#include "eformat/eformat.h" -//#include "eformat/index.h" - -#include "TrigSteering/Scaler.h" -#include "TrigSteering/PeriodicScaler.h" - -#include <algorithm> -#include <vector> -#include <iomanip> -#include <sstream> - - -// To be moved to L1TopoRDO Helpers.cxx -namespace L1Topo{ - const std::string formatVecHex8(const std::vector<uint32_t>& vec) - { - std::ostringstream s; - s << "[ "; - for (auto elem: vec){ - s << std::hex << std::showbase << std::setfill('0') << std::setw(8) - << elem << " " << std::dec << std::noshowbase; - } - s << "]"; - return s.str(); - } -} - - -TrigL1TopoROBMonitor::TrigL1TopoROBMonitor(const std::string& name, ISvcLocator* pSvcLocator) : - AthAlgorithm(name, pSvcLocator), - m_robDataProviderSvc( "ROBDataProviderSvc", name ), - m_histPropNoBins(Gaudi::Histo1DDef("",0,1,1)), //! generic for labelled bins set at fill time - m_histSIDsViaConverters(0), - m_histSIDsDirectFromROBs(0), - m_histCTPSignalPartFromROIConv(0), - m_histOverflowBitsFromROIConv(0), - m_histTriggerBitsFromROIConv(0), - m_histPayloadCRCFromDAQConv(0), - m_histFibreStatusFlagsFromDAQConv(0), - //m_histFibreSizesFromDAQConv(0), - m_histTOBCountsFromROIROB(0), - m_histTOBCountsFromDAQROB(0) -{ - m_scaler = new HLT::PeriodicScaler(); - // 0x00910000 was used for tests; the others are the planned source IDs - declareProperty("L1TopoDAQROBIDs", m_vDAQROBIDs = {0x00910000, 0x00910001, 0x00910011}, "L1TOPO DAQ ROB IDs"); - declareProperty("L1TopoROIROBIDs", m_vROIROBIDs = {0x00910080, 0x00910090},"L1Topo ROI ROB IDs"); - declareProperty("PrescaleDAQROBAccess", m_prescaleForDAQROBAccess = 2, "Prescale factor for requests for DAQ ROBs: can be used to avoid overloading ROS. Zero means disabled, 1 means always, N means sample only 1 in N events"); - declareProperty("doRawMon", m_doRawMon = true, "enable L1Topp monitoring direct from ROB fragments"); - declareProperty("doCnvMon", m_doCnvMon = true, "enable L1Topo monitoring via converters"); -} - - -StatusCode TrigL1TopoROBMonitor::initialize(){ - ATH_MSG_INFO ("initialize"); - CHECK( m_robDataProviderSvc.retrieve() ); - ATH_MSG_DEBUG ("Properties:" ); - ATH_MSG_DEBUG ( m_doRawMon ); - ATH_MSG_DEBUG ( m_doCnvMon ); - ATH_MSG_DEBUG ( m_vDAQROBIDs ); - ATH_MSG_DEBUG ( m_vROIROBIDs ); - ATH_MSG_DEBUG ( m_prescaleForDAQROBAccess ); - return StatusCode::SUCCESS; -} - -StatusCode TrigL1TopoROBMonitor::execute() { - - ATH_MSG_DEBUG ("execute"); - - //-------------------------------------------------------------------------- - // check that there is still time left - //-------------------------------------------------------------------------- - if (Athena::Timeout::instance().reached()) { - ATH_MSG_INFO( " Time out reached in entry to execute." ); - return StatusCode::SUCCESS; - } - - bool prescalForDAQROBAccess=false; - if (m_prescaleForDAQROBAccess>0){ - prescalForDAQROBAccess = m_scaler->decision(m_prescaleForDAQROBAccess); - } - ATH_MSG_DEBUG( "Prescale for DAQ ROB access: " << std::boolalpha << prescalForDAQROBAccess << std::noboolalpha ); - - - if (m_doRawMon){ - CHECK( doRawMon(prescalForDAQROBAccess) ); - } - - if (m_doCnvMon){ - CHECK( doCnvMon(prescalForDAQROBAccess) ); - } - - return StatusCode::SUCCESS; -} - -StatusCode TrigL1TopoROBMonitor::finalize() { - ATH_MSG_INFO ("finalize"); - delete m_scaler; - m_scaler=0; - return StatusCode::SUCCESS; -} - -StatusCode TrigL1TopoROBMonitor::bookAndRegisterHist(ServiceHandle<ITHistSvc>& rootHistSvc, TH1F*& hist, const Histo1DProperty& prop, std::string extraName, std::string extraTitle){ - auto p = prop.value(); - return bookAndRegisterHist(rootHistSvc, hist, p.title()+extraName, p.title()+extraTitle, p.bins(), p.lowEdge(), p.highEdge()); -} - -StatusCode TrigL1TopoROBMonitor::bookAndRegisterHist(ServiceHandle<ITHistSvc>& rootHistSvc, TH1F*& hist, std::string hName, std::string hTitle, int bins, float lowEdge, float highEdge){ - - // *-- booking path - std::string path = std::string("/EXPERT/")+getGaudiThreadGenericName(name())+"/"; - ATH_MSG_VERBOSE( "Booking monitoring histogram " << hName ); - hist = new TH1F(hName.c_str(), hTitle.c_str(), bins, lowEdge, highEdge); - if (hist) { - if ( rootHistSvc->regHist(path + hist->GetName(), hist).isFailure() ){ - ATH_MSG_WARNING( "Can not register monitoring histogram" << hist->GetName() ); - return StatusCode::RECOVERABLE; - } - } - else{ - ATH_MSG_WARNING( "Failed to create new monitoring histogram" << hName ); - return StatusCode::RECOVERABLE; - } - return StatusCode::SUCCESS; -} - -StatusCode TrigL1TopoROBMonitor::beginRun() { - - ATH_MSG_INFO ("beginRun"); - ServiceHandle<ITHistSvc> rootHistSvc("THistSvc", name()); - CHECK( rootHistSvc.retrieve() ); - - m_scaler->reset(); - - CHECK( bookAndRegisterHist(rootHistSvc, m_histSIDsViaConverters, m_histPropNoBins, "L1Topo ROB source IDs received via converters", " via converters;ROB ID") ); - CHECK( bookAndRegisterHist(rootHistSvc, m_histSIDsDirectFromROBs, m_histPropNoBins, "L1Topo ROB source IDs received direct from ROBs", " direct from ROBs;ROB ID") ); - CHECK( bookAndRegisterHist(rootHistSvc, m_histCTPSignalPartFromROIConv, m_histPropNoBins, "L1Topo CTP signal part ROI via converter", "4-bit CTP signal part via converter;CTP signal part") ); - CHECK( bookAndRegisterHist(rootHistSvc, m_histOverflowBitsFromROIConv, "L1Topo CTP signal overflow bits from ROI via converter", "L1Topo CTP signal overflow bits from ROI via converter;overflow bits", 128, 0, 128) ); - CHECK( bookAndRegisterHist(rootHistSvc, m_histTriggerBitsFromROIConv, "L1Topo CTP signal trigger bits from ROI via converter", "L1Topo CTP signal trigger bits from ROI via converter;overflow bits", 128, 0, 128) ); - CHECK( bookAndRegisterHist(rootHistSvc, m_histPayloadCRCFromDAQConv, m_histPropNoBins, "L1Topo payload CRC from DAQ via converter", "non zero payload CRCs via converter;Payload CRC") ); - CHECK( bookAndRegisterHist(rootHistSvc, m_histFibreStatusFlagsFromDAQConv, "L1Topo Fibre status flags from DAQ via converter", "L1Topo Fibre status flags from DAQ via converter; fibre status flags", 70, 0, 70) ); - CHECK( bookAndRegisterHist(rootHistSvc, m_histTOBCountsFromROIROB, "L1Topo TOB types from ROI direct from ROBs", "4-bit TOB type via ROI ROB;TOB type", 16, 0, 16) ); - CHECK( bookAndRegisterHist(rootHistSvc, m_histTOBCountsFromDAQROB, "L1Topo TOB types from DAQ direct from ROBs", "4-bit TOB type via DAQ ROB;TOB type", 16, 0, 16) ); - std::vector<std::string> labels = {"EM","TAU","MU","0x3","JETc1","JETc2","ENERGY","0x7","L1TOPO","0x9","0xa","0xb","HEADER","FIBRE","STATUS","0xf"}; - - for (unsigned int i=0; i<16; ++i){ - //ATH_MSG_VERBOSE ("bin " << i+1 << " " << labels.at(i)); - m_histTOBCountsFromROIROB->GetXaxis()->SetBinLabel(i+1,labels.at(i).c_str()); - m_histTOBCountsFromDAQROB->GetXaxis()->SetBinLabel(i+1,labels.at(i).c_str()); - } - - // release histogramming service - rootHistSvc.release().ignore(); - - return StatusCode::SUCCESS; -} - -StatusCode TrigL1TopoROBMonitor::endRun() { - - ATH_MSG_INFO ("endRun"); - - return StatusCode::SUCCESS; -} - -StatusCode TrigL1TopoROBMonitor::doRawMon(bool prescalForDAQROBAccess) { - ATH_MSG_DEBUG( "doRawMon" ); - - CHECK( monitorROBs(m_vROIROBIDs.value(),true) ); //isROIROB=true - - if (prescalForDAQROBAccess){ - CHECK( monitorROBs(m_vDAQROBIDs.value(),false) ); //isROIROB=false - } - return StatusCode::SUCCESS; -} - -StatusCode TrigL1TopoROBMonitor::monitorROBs(const std::vector<uint32_t>& vROBIDs, bool isROIROB){ - - // Iterate over the ROB fragments and histogram their source IDs - ATH_MSG_VERBOSE( "ROB IDs of type " << (isROIROB?"ROI":"DAQ") << " requested: " << L1Topo::formatVecHex8(vROBIDs)); - - // Fetch the ROB fragments - std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> vRobFrags; - vRobFrags.reserve(vROBIDs.size()); - m_robDataProviderSvc->getROBData(vROBIDs,vRobFrags); - if (vRobFrags.empty()) { - ATH_MSG_WARNING( "None of these ROBs found" ); - } - - // loop over ROB fragments - for (auto & rob : vRobFrags){ - - ATH_MSG_DEBUG( "RawMon: found ROB ID " << L1Topo::formatHex8(rob->source_id()) ); - scoped_lock_histogram lock; - m_histSIDsDirectFromROBs->Fill(L1Topo::formatHex8(rob->source_id()).c_str(), 1.); - m_histSIDsDirectFromROBs->LabelsDeflate("X"); - - // Go through the data words in the ROB and histogram the word types - // (TOB type etc.). - OFFLINE_FRAGMENTS_NAMESPACE::PointerType it_data = rob->rod_data(); - const uint32_t ndata = rob->rod_ndata(); - ATH_MSG_VERBOSE( "L1Topo data words:"); - - // loop over data words - for ( unsigned int i = 0; i < ndata; ++i, ++it_data ) { - ATH_MSG_VERBOSE( L1Topo::formatHex8(*it_data) ); - auto blockType = L1Topo::blockType(static_cast<uint32_t>(*it_data)); - if (isROIROB){ - m_histTOBCountsFromROIROB->Fill(static_cast<float>(blockType),1.); - } - else { - m_histTOBCountsFromDAQROB->Fill(static_cast<float>(blockType),1.); - } - } // loop over data words - - }// loop over rob fragments - - return StatusCode::SUCCESS; -} - -StatusCode TrigL1TopoROBMonitor::doCnvMon(bool prescalForDAQROBAccess) { - - ATH_MSG_DEBUG( "doCnvMon" ); - - // Retrieve and print the L1Topo RDOs from the ROI RODs - std::vector<L1Topo::L1TopoTOB> roiTobs; - const ROIB::RoIBResult* roibresult = 0; - CHECK (evtStore()->retrieve(roibresult) ); - const std::vector< ROIB::L1TopoResult > l1TopoResults = roibresult->l1TopoResult(); - ATH_MSG_DEBUG( "Number of L1Topo ROI RODs found: " << l1TopoResults.size() ); - for (auto & r : l1TopoResults){ - //ATH_MSG_VERBOSE( r.dump() ); - auto rdo=r.rdo(); - ATH_MSG_DEBUG( "Found ROI RDO with source ID " << L1Topo::formatHex8(rdo.getSourceID()) ); - scoped_lock_histogram lock; - m_histSIDsViaConverters->Fill((L1Topo::formatHex8(rdo.getSourceID())).c_str(), 1.); - m_histSIDsViaConverters->LabelsDeflate("X"); - auto errors = rdo.getErrors(); - if (! errors.empty()){ - ATH_MSG_WARNING( "Converter errors reported: " << errors ); - } - const std::vector<uint32_t> cDataWords = rdo.getDataWords(); - if ( cDataWords.size() == 0 ) { - ATH_MSG_WARNING ( "L1TopoRDO ROI is empty" ); - } - for (auto word : cDataWords){ - switch (L1Topo::blockType(word)){ - case L1Topo::BlockTypes::L1TOPO_TOB: - { - auto tob = L1Topo::L1TopoTOB(word); - ATH_MSG_DEBUG( tob ); - roiTobs.push_back(tob); - auto index = L1Topo::triggerBitIndex(rdo.getSourceID(),tob); - scoped_lock_histogram lock; - m_histCTPSignalPartFromROIConv->Fill(L1Topo::formatHex4(tob.ctp_signal()).c_str(), 1.); - m_histCTPSignalPartFromROIConv->LabelsDeflate("X"); - for (unsigned int i=0; i<8; ++i){ - m_histTriggerBitsFromROIConv->Fill (index+i,(tob.trigger_bits() >>i)&1); - m_histOverflowBitsFromROIConv->Fill(index+i,(tob.overflow_bits()>>i)&1); - } - // histogram trigger and overflow bits - break; - } - default: - { - ATH_MSG_WARNING( "unexpected TOB type in ROI: " << L1Topo::formatHex8(word) ); - break; - } - } - } - } - - // Only check DAQ ROBs if prescaler said yes - if (prescalForDAQROBAccess){ - - std::vector<L1Topo::L1TopoTOB> daqTobsBC0; - - // Retrieve the L1Topo RDOs from the DAQ RODs - const DataHandle<L1TopoRDOCollection> rdos = 0; - StatusCode sc = StatusCode::SUCCESS; - sc = evtStore()->retrieve(rdos); - if (sc.isFailure() or 0 == rdos) { - ATH_MSG_WARNING ( "Could not retrieve L1Topo DAQ RDO collection from StoreGate" ); - } - else { - // loop over and print RDOs - for (auto & rdo : *rdos){ - ATH_MSG_VERBOSE( *rdo ); - ATH_MSG_DEBUG( "CnvMon: Found DAQ RDO with source ID " << L1Topo::formatHex8(rdo->getSourceID()) ); - scoped_lock_histogram lock; - m_histSIDsViaConverters->Fill((L1Topo::formatHex8(rdo->getSourceID())).c_str(), 1.); - m_histSIDsViaConverters->LabelsDeflate("X"); - auto errors = rdo->getErrors(); - if (! errors.empty()){ - ATH_MSG_WARNING( "Converter errors reported: " << errors ); - } - const std::vector<uint32_t> cDataWords = rdo->getDataWords(); - - if ( cDataWords.size() == 0 ) { - ATH_MSG_WARNING ( "L1TopoRDO DAQ is empty" ); - } - // initialise colletions filled for each block - std::vector<L1Topo::L1TopoTOB> daqTobs; - std::vector<uint32_t> vFibreSizes; - std::vector<uint32_t> vFibreStatus; - // initialise header: beware, this can make a valid-looking header and be misinterpreted; set version 15, BCN -7, which is unlikely: - L1Topo::Header header(0xf,0,0,0,0,1,0x7); - bool firstWord=true; - for (auto word : cDataWords){ - switch (L1Topo::blockType(word)){ - case L1Topo::BlockTypes::HEADER: - { - // New block detected, so send the one just completed for monitoring - if (! firstWord){ - CHECK( monitorBlock(rdo->getSourceID(),header,vFibreSizes,vFibreStatus,daqTobs) ); - } - header = L1Topo::Header(word); - // reset containers - vFibreSizes.clear(); - vFibreStatus.clear(); - daqTobs.clear(); - break; - } - case L1Topo::BlockTypes::FIBRE: - { - auto fibreBlock = L1Topo::Fibre(word); - unsigned int nFibres = fibreBlock.count().size(); - for (auto fsize: fibreBlock.count()){ - vFibreSizes.push_back(fsize); - } - for (auto fstatus: fibreBlock.status()){ - vFibreStatus.push_back(fstatus); - } - break; - } - case L1Topo::BlockTypes::STATUS: - { - auto status = L1Topo::Status(word); - ATH_MSG_WARNING( "fibre overflow: " << status.overflow() << " fibre crc: " << status.crc() ); - } - case L1Topo::BlockTypes::L1TOPO_TOB: - { - auto tob = L1Topo::L1TopoTOB(word); - daqTobs.push_back(tob); - if (header.bcn_offset()==0){ - daqTobsBC0.push_back(tob); - } - break; - } - default: - { - // perhaps count other TOB types? - break; - } - } - firstWord=false; - } // for word - // monitor last block - - CHECK( monitorBlock(rdo->getSourceID(),header,vFibreSizes,vFibreStatus,daqTobs) ); - } - } - - // Compare ROI and DAQ L1Topo TOBS - - // need to sort them first - - /* - if (daqTobsBC0==roiTobs){ - ATH_MSG_DEBUG( "DAQ L1Topo TOBs from BC0 are the same as ROI L1Topo TOBs" ); - } - else { - ATH_MSG_WARNING( "DAQ L1Topo TOBs from BC0 are NOT the same as ROI L1Topo TOBs" ); - } - //compareL1TopoTOBs(daqTobsBC0,roiTobs); - */ - - } - else { - ATH_MSG_DEBUG( "DAQ ROB access via converter skipped due to prescale" ); - } - - return StatusCode::SUCCESS; - -} - - StatusCode TrigL1TopoROBMonitor::monitorBlock(uint32_t sourceID, L1Topo::Header& header, std::vector<uint32_t>& /* vFibreSizes */, std::vector<uint32_t>& vFibreStatus, std::vector<L1Topo::L1TopoTOB>& /* daqTobs */) { - ATH_MSG_DEBUG( "monitorBlock" ); - ATH_MSG_DEBUG( header ); - if (header.payload_crc()!=0){ - ATH_MSG_WARNING( "header payload CRC not zero: " << L1Topo::formatHex8(header.payload_crc()) ); - scoped_lock_histogram lock; - m_histPayloadCRCFromDAQConv->Fill( (L1Topo::formatHex8(header.payload_crc())).c_str(), 1. ); - m_histPayloadCRCFromDAQConv->LabelsDeflate("X"); - } - if (vFibreStatus.size()!=header.active_fibres()){ - ATH_MSG_WARNING( "Mismatch between number of fibres declared in header " << header.active_fibres() << " and number found " << vFibreStatus.size() ); - } - for (unsigned int i=0; i<vFibreStatus.size(); ++i){ - if (vFibreStatus.at(i)!=0){ - ATH_MSG_WARNING( "Fibre status set for fibre " << i << " of ROB " << L1Topo::formatHex8(sourceID) << " header " << header ); - } - scoped_lock_histogram lock; - m_histFibreStatusFlagsFromDAQConv->Fill(i,vFibreStatus.at(i)); - } - return StatusCode::SUCCESS; -} - diff --git a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/TrigL1TopoROBMonitor.h b/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/TrigL1TopoROBMonitor.h deleted file mode 100644 index 249ef75a189417b0ae2301b64c967d54a39f3bcd..0000000000000000000000000000000000000000 --- a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/TrigL1TopoROBMonitor.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef TRIGONLINEMONITOR_TRIGL1TOPOROBMONITOR_H -#define TRIGONLINEMONITOR_TRIGL1TOPOROBMONITOR_H 1 - -#include "AthenaBaseComps/AthAlgorithm.h" -#include "GaudiKernel/HistoProperty.h" -#include <vector> - -class ITHistSvc; -class IROBDataProviderSvc; -class ITrigROBDataProviderSvc; -class TH1F; /// for monitoring purposes -class TH2F; /// for monitoring purposes -class TProfile;/// for monitoring purposes - -namespace L1Topo { - class Header; - class L1TopoTOB; -} - -namespace HLT { - class IScaler; -} - -class TrigL1TopoROBMonitor:public AthAlgorithm { - public: - TrigL1TopoROBMonitor(const std::string& name, ISvcLocator* pSvcLocator); - StatusCode initialize(); - StatusCode execute(); - StatusCode finalize(); - StatusCode beginRun(); - StatusCode endRun(); - private: - StatusCode doCnvMon(bool); - StatusCode doRawMon(bool); - StatusCode monitorROBs(const std::vector<uint32_t>&, bool); - StatusCode monitorBlock(uint32_t sourceID, L1Topo::Header& header, std::vector<uint32_t>& vFibreSizes, std::vector<uint32_t>& vFibreStatus, std::vector<L1Topo::L1TopoTOB>& daqTobs); - StatusCode bookAndRegisterHist(ServiceHandle<ITHistSvc>&, TH1F*& , const Histo1DProperty& prop, std::string extraName, std::string extraTitle); - StatusCode bookAndRegisterHist(ServiceHandle<ITHistSvc>&, TH1F*& , std::string hName, std::string hTitle, int bins, float lowEdge, float highEdge); - ServiceHandle<IROBDataProviderSvc> m_robDataProviderSvc; - BooleanProperty m_doRawMon; - BooleanProperty m_doCnvMon; - UnsignedIntegerArrayProperty m_vDAQROBIDs; - UnsignedIntegerArrayProperty m_vROIROBIDs; - UnsignedIntegerProperty m_prescaleForDAQROBAccess; - HLT::IScaler* m_scaler; //! prescale decision tool - Histo1DProperty m_histPropNoBins; - TH1F* m_histSIDsViaConverters;// - TH1F* m_histSIDsDirectFromROBs;// - TH1F* m_histCTPSignalPartFromROIConv;// - TH1F* m_histOverflowBitsFromROIConv; - TH1F* m_histTriggerBitsFromROIConv; - TH1F* m_histPayloadCRCFromDAQConv;// - TH1F* m_histFibreStatusFlagsFromDAQConv; - //TH2F* m_histFibreSizesFromDAQConv; - TH1F* m_histTOBCountsFromROIROB;// - TH1F* m_histTOBCountsFromDAQROB;// -}; - -#endif // TRIGONLINEMONITOR diff --git a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/TrigMuCTPiROBMonitor.cxx b/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/TrigMuCTPiROBMonitor.cxx deleted file mode 100755 index 02679fc8129b557a3d25ced0dd28bb1e8ccf0416..0000000000000000000000000000000000000000 --- a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/TrigMuCTPiROBMonitor.cxx +++ /dev/null @@ -1,1302 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "TrigOnlineMonitor/TrigMuCTPiROBMonitor.h" -#include "TrigT1Result/RoIBResult.h" -#include "TrigT1Result/MuCTPI_RDO.h" -#include "TrigT1Result/MuCTPI_MultiplicityWord_Decoder.h" -#include "TrigT1Result/MuCTPI_DataWord_Decoder.h" -#include "GaudiKernel/AlgFactory.h" -#include "GaudiKernel/ThreadGaudi.h" -#include "GaudiKernel/ITHistSvc.h" -#include "AthenaKernel/Timeout.h" -#include "StoreGate/StoreGateSvc.h" -#include "ByteStreamCnvSvcBase/IROBDataProviderSvc.h" -#include "TrigROBDataProviderSvc/ITrigROBDataProviderSvc.h" -#include "TrigMonitorBase/TrigLockedHist.h" -#include "EventInfo/TriggerInfo.h" -#include "EventInfo/EventInfo.h" -#include "EventInfo/EventID.h" -#include "EventInfo/EventType.h" -#include "eformat/eformat.h" -#include "eformat/index.h" - -#include <algorithm> -#include <iostream> -#ifndef HAVE_NEW_IOSTREAMS -#include <strstream> /*gnu-specific*/ -typedef strstream __sstream; -#else -#include <sstream> -typedef std::ostringstream __sstream; -#endif -#include <iomanip> -#include <cassert> -#include <bitset> -#include <TH1F.h> -#include <TH2F.h> -#include <TProfile2D.h> - -///////////////////////////////////////////////////////////////////////////// - -TrigMuCTPiROBMonitor::TrigMuCTPiROBMonitor(const std::string& name, ISvcLocator* pSvcLocator) : - Algorithm(name, pSvcLocator), - m_msg(0), - m_storeGateSvc( "StoreGateSvc", name ), - m_robDataProviderSvc( "ROBDataProviderSvc", name ), - m_hist_failedChecksumForROB(0), - m_histProp_failedChecksumForROB(Gaudi::Histo1DDef("FailedChecksumForROB" ,0,1,1)), - m_hist_failedChecksumForSD(0), - m_histProp_failedChecksumForSD(Gaudi::Histo1DDef("FailedChecksumForSubDetector" ,0,2,2)), - m_hist_genericStatusForROB(0), - m_hist_specificStatusForROB(0), - m_lvl1muCTPIResult(0), - m_daqmuCTPIResult(0), - m_hist_NumberOfRoIs_RoIB(0), - m_hist_NumberOfRoIs_DAQ(0), - m_histProp_NumberOfRoIs(Gaudi::Histo1DDef("Number_of_RoIs" ,0.,50.,50)), - m_histProp_muCTPi_Barrel_SectorID( Gaudi::Histo1DDef("muCTPi_SectorID_Barrel" ,0,NUMBER_OF_BARREL_UNITS, NUMBER_OF_BARREL_UNITS)), - m_histProp_muCTPi_Endcap_SectorID( Gaudi::Histo1DDef("muCTPi_SectorID_Endcap" ,0,NUMBER_OF_ENDCAP_UNITS, NUMBER_OF_ENDCAP_UNITS)), - m_histProp_muCTPi_Forward_SectorID(Gaudi::Histo1DDef("muCTPi_SectorID_Forward" ,0,NUMBER_OF_FORWARD_UNITS, NUMBER_OF_FORWARD_UNITS)), - m_hist_muCTPiDaq_Barrel_SectorID_Pad_DeltaBCID(0), - m_hist_differenceRoIs(0), - m_histProp_differenceRoIs(Gaudi::Histo1DDef("muCTPi_differenceRoIs_RoIB_DAQ" ,-50.,50.,100)), - m_hist_muCTPiL1_Problem_Barrel_Hash(0), - m_hist_muCTPiDaq_Problem_Barrel_Hash(0), - m_histProp_Problem_Barrel_Hash(Gaudi::Histo1DDef("muCTPi_Barrel_Hash_for_RoIs_only_in" ,0,1,1)), - m_hist_muCTPiL1_Problem_Endcap_Hash(0), - m_hist_muCTPiDaq_Problem_Endcap_Hash(0), - m_histProp_Problem_Endcap_Hash(Gaudi::Histo1DDef("muCTPi_Endcap_Hash_for_RoIs_only_in" ,0,1,1)), - m_hist_muCTPiL1_Problem_Forward_Hash(0), - m_hist_muCTPiDaq_Problem_Forward_Hash(0), - m_histProp_Problem_Forward_Hash(Gaudi::Histo1DDef("muCTPi_Forward_Hash_for_RoIs_only_in" ,0,1,1)), - m_hist_timeMuCTPi(0), - m_histProp_timeMuCTPi(Gaudi::Histo1DDef("Time_MuCTPi_Monitor" ,0.,2.,50)) -{ - // Declare the properties - declareProperty("Lvl1CTPROBid", m_lvl1CTPROBid=0x770001); - declareProperty("Lvl1MuCTPiROBid", m_lvl1MuCTPiROBid=0x760001); - declareProperty("DaqCTPROBid", m_daqCTPROBid=0x770000); - declareProperty("DaqMuCTPiROBid", m_daqMuCTPiROBid=0x760000); - declareProperty("SetDebugStream", m_setDebugStream=false); - declareProperty("DebugStreamName", m_debugStreamName="MuCTPiROBErrorStream"); - declareProperty("NumberOfBarrelUnits", m_Number_Of_Barrel_Units=NUMBER_OF_BARREL_UNITS); - declareProperty("NumberOfEndcapUnits", m_Number_Of_Endcap_Units=NUMBER_OF_ENDCAP_UNITS); - declareProperty("NumberOfForwardUnits", m_Number_Of_Forward_Units=NUMBER_OF_FORWARD_UNITS); - declareProperty("TestROBChecksum", m_doROBChecksum=true); - declareProperty("HistFailedChecksumForROB", m_histProp_failedChecksumForROB,"ROBs with inconsistent checksum"); - declareProperty("HistFailedChecksumForSD", m_histProp_failedChecksumForSD, "SDs with inconsistent checksum"); - declareProperty("TestROBStatus", m_doROBStatus=true); - declareProperty("HistNumberOfRoIs", m_histProp_NumberOfRoIs, "Number of MuCTPi RoIs"); - declareProperty("HistSectorID_Barrel_muCTPi", m_histProp_muCTPi_Barrel_SectorID, "SectorID for Barrel RoIs"); - declareProperty("HistSectorID_Endcap_muCTPi", m_histProp_muCTPi_Endcap_SectorID, "SectorID for Endcap RoIs"); - declareProperty("HistSectorID_Forward_muCTPi", m_histProp_muCTPi_Forward_SectorID,"SectorID for Forward RoIs"); - declareProperty("HistDifferenceRoIs_RoIB_DAQ_muCTPi", m_histProp_differenceRoIs,"Difference in number of Rois for RoIB-DAQ"); - declareProperty("HistBarrelHashforProblemRoIs", m_histProp_Problem_Barrel_Hash, "Hash for problematic Barrel RoIs"); - declareProperty("HistEndcapHashforProblemRoIs", m_histProp_Problem_Endcap_Hash, "Hash for problematic Endcap RoIs"); - declareProperty("HistForwardHashforProblemRoIs", m_histProp_Problem_Forward_Hash, "Hash for problematic Forward RoIs"); - declareProperty("DoTiming", m_doTiming=true); - declareProperty("HistTimeMuCTPiMonitor", m_histProp_timeMuCTPi, "Timing for muCTPi monitoring algorithm"); - - // fill map with generic status codes - m_map_GenericStatus[eformat::UNCLASSIFIED] = "UNCLASSIFIED"; - m_map_GenericStatus[eformat::BCID_CHECK_FAIL] = "BCID_CHECK_FAIL"; - m_map_GenericStatus[eformat::LVL1ID_CHECK_FAIL] = "LVL1ID_CHECK_FAIL"; - m_map_GenericStatus[eformat::TIMEOUT] = "TIMEOUT"; - m_map_GenericStatus[eformat::DATA_CORRUPTION] = "DATA_CORRUPTION"; - m_map_GenericStatus[eformat::INTERNAL_OVERFLOW] = "INTERNAL_OVERFLOW"; - - // fill vector with specific status codes - m_vec_SpecificStatus.reserve(16); - m_vec_SpecificStatus.push_back("TRIGGER_TYPE_SYNC_ERROR"); - m_vec_SpecificStatus.push_back("FRAGMENT_SIZE_ERROR"); - m_vec_SpecificStatus.push_back("DATABLOCK_ERROR"); - m_vec_SpecificStatus.push_back("CTRL_WORD_ERROR"); - m_vec_SpecificStatus.push_back("MISSING_BOF"); - m_vec_SpecificStatus.push_back("MISSING_EOF"); - m_vec_SpecificStatus.push_back("INVALID_HEADER_MARKER"); - m_vec_SpecificStatus.push_back("FORMAT_ERROR"); - m_vec_SpecificStatus.push_back("DUPLICATE_EVENT"); - m_vec_SpecificStatus.push_back("SEQUENCE_ERROR"); - m_vec_SpecificStatus.push_back("TRANSMISSION_ERROR"); - m_vec_SpecificStatus.push_back("TRUNCATION"); - m_vec_SpecificStatus.push_back("SHORT_FRAGMENT"); - m_vec_SpecificStatus.push_back("FRAGMENT_LOST"); - m_vec_SpecificStatus.push_back("FRAGMENT_PENDING"); - m_vec_SpecificStatus.push_back("ROL_DISABLED"); - - // muCTPi Sector ID plots - for (int hemisphere=0; hemisphere <= 1; ++hemisphere) { - m_hist_muCTPiL1_Barrel_SectorID.push_back(0); - m_hist_muCTPiL1_Endcap_SectorID.push_back(0); - m_hist_muCTPiL1_Forward_SectorID.push_back(0); - - m_hist_muCTPiDaq_Barrel_SectorID.push_back(0); - m_hist_muCTPiDaq_Endcap_SectorID.push_back(0); - m_hist_muCTPiDaq_Forward_SectorID.push_back(0); - } // end loop over hemispheres - - // muCTPi Sector ID vs pad plots - for (unsigned int threshold=0; threshold <= NUMBER_OF_PT_THRESHOLDS; ++threshold) { - m_hist_muCTPiL1_Barrel_SectorID_Pad.push_back(0); - m_hist_muCTPiDaq_Barrel_SectorID_Pad.push_back(0); - } // end loop over thresholds -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -StatusCode TrigMuCTPiROBMonitor::initialize(){ - - // Get the messaging service - MsgStream log(msgSvc(), name()); - log << MSG::INFO << "initialize()" << endreq; - - // Print out the property values - log << MSG::INFO << " ROB ID: Lvl1 CTP = " << m_lvl1CTPROBid - << std::setw(6) << " (=0x" << MSG::hex << m_lvl1CTPROBid.value() << MSG::dec << ")" << endreq; - log << MSG::INFO << " ROB ID: Lvl1 muCTPi = " << m_lvl1MuCTPiROBid - << std::setw(6) << " (=0x" << MSG::hex << m_lvl1MuCTPiROBid.value() << MSG::dec << ")" << endreq; - log << MSG::INFO << " ROB ID: DAQ CTP = " << m_daqCTPROBid - << std::setw(6) << " (=0x" << MSG::hex << m_daqCTPROBid.value() << MSG::dec << ")" << endreq; - log << MSG::INFO << " ROB ID: DAQ muCTPi = " << m_daqMuCTPiROBid - << std::setw(6) << " (=0x" << MSG::hex << m_daqMuCTPiROBid.value() << MSG::dec << ")" << endreq; - log << MSG::INFO << " Put events with ROB errors on DEBUG stream = " << m_setDebugStream << endreq; - log << MSG::INFO << " Name of used DEBUG stream = " << m_debugStreamName << endreq; - log << MSG::INFO << " Do ROB checksum test = " << m_doROBChecksum << endreq; - log << MSG::INFO << " Hist:FailedChecksumForROB = " << m_histProp_failedChecksumForROB << endreq; - log << MSG::INFO << " Hist:FailedChecksumForSD = " << m_histProp_failedChecksumForSD << endreq; - log << MSG::INFO << " Do ROB status test = " << m_doROBStatus << endreq; - log << MSG::INFO << " Hist:NumberOfRoIs = " << m_histProp_NumberOfRoIs << endreq; - log << MSG::INFO << " Number Of Barrel Sector Units = " << m_Number_Of_Barrel_Units << endreq; - log << MSG::INFO << " Number Of Endcap Sector Units = " << m_Number_Of_Endcap_Units << endreq; - log << MSG::INFO << " Number Of Forward Sector Units = " << m_Number_Of_Forward_Units << endreq; - log << MSG::INFO << " Hist:SectorID_Barrel_muCTPi = " << m_histProp_muCTPi_Barrel_SectorID << endreq; - log << MSG::INFO << " Hist:SectorID_Endcap_muCTPi = " << m_histProp_muCTPi_Endcap_SectorID << endreq; - log << MSG::INFO << " Hist:SectorID_Forward_muCTPi = " << m_histProp_muCTPi_Forward_SectorID << endreq; - log << MSG::INFO << " Hist:DifferenceRoIs_RoIB-DAQ_muCTPi = " << m_histProp_differenceRoIs << endreq; - log << MSG::INFO << " Hist:BarrelHashforProblemRoIs = " << m_histProp_Problem_Barrel_Hash << endreq; - log << MSG::INFO << " Hist:EndcapHashforProblemRoIs = " << m_histProp_Problem_Endcap_Hash << endreq; - log << MSG::INFO << " Hist:ForwardHashforProblemRoIs = " << m_histProp_Problem_Forward_Hash << endreq; - log << MSG::INFO << " Do muCTPi Monitoring Timing = " << m_doTiming << endreq; - log << MSG::INFO << " Hist:TimeMuCTPiMonitor = " << m_histProp_timeMuCTPi << endreq; - - // Locate the StoreGateSvc - StatusCode sc = m_storeGateSvc.retrieve(); - if (!sc.isSuccess()) { - log << MSG::ERROR << "Could not find StoreGateSvc" << endreq; - return sc; - } - - // Locate the ROBDataProviderSvc - sc = m_robDataProviderSvc.retrieve(); - if (!sc.isSuccess()) { - log << MSG::ERROR << "Could not find ROBDataProviderSvc" << endreq; - return sc; - } else { - // Setup the L2 ROB Data Provider Service when configured -#ifdef ATLAS_GAUDI_V21 - m_trigROBDataProviderSvc = SmartIF<ITrigROBDataProviderSvc>( &*m_robDataProviderSvc ); -#else - m_trigROBDataProviderSvc = SmartIF<ITrigROBDataProviderSvc>( IID_ITrigROBDataProviderSvc, &*m_robDataProviderSvc ); -#endif - if (m_trigROBDataProviderSvc.isValid()) { - log << MSG::DEBUG << "A ROBDataProviderSvc implementing the Level-2 interface ITrigROBDataProviderSvc was found." - << endreq; - } else { - log << MSG::DEBUG << "No ROBDataProviderSvc implementing the Level-2 interface ITrigROBDataProviderSvc was found." - << endreq; - } - } - - // Build the vectors with ROB Ids to retrieve - if (m_trigROBDataProviderSvc.isValid()) { // L2 (retrieve only RoIB version) - m_ctpRobIds.push_back(m_lvl1CTPROBid.value()); - m_muCTPiRobIds.push_back(m_lvl1MuCTPiROBid.value()); - } else { // EF (retrieve RoIB+DAQ version) - m_ctpRobIds.push_back(m_lvl1CTPROBid.value()); - m_ctpRobIds.push_back(m_daqCTPROBid.value()); - - m_muCTPiRobIds.push_back(m_lvl1MuCTPiROBid.value()); - m_muCTPiRobIds.push_back(m_daqMuCTPiROBid.value()); - } - - return StatusCode::SUCCESS; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -StatusCode TrigMuCTPiROBMonitor::execute() { - - struct timeval time_start; - struct timeval time_stop; - if ( m_doTiming.value() ) { - gettimeofday(&time_start, 0); - } - - if (outputLevel() <= MSG::DEBUG) logStream() << MSG::DEBUG << "execute()" << endreq; - - //-------------------------------------------------------------------------- - // check that there is still time left - //-------------------------------------------------------------------------- - if (Athena::Timeout::instance().reached()) { - logStream() << MSG::INFO << " Time out reached in entry to execute." << endreq; - return StatusCode::SUCCESS; - } - - //-------------------------------------------------------------------------- - // Loop over all ROB fragments held in the ROBDataProviderSvc and do the checks - //-------------------------------------------------------------------------- - bool event_with_checksum_failure(false); - - // clean up old decoded results - if (m_lvl1muCTPIResult) { // delete an old L1 muCTPi result if it exists - delete m_lvl1muCTPIResult; - m_lvl1muCTPIResult=0; - } - - if (m_daqmuCTPIResult) { // delete an old DAQ muCTPi result if it exists - delete m_daqmuCTPIResult; - m_daqmuCTPIResult=0; - } - - m_lvl1muCTPIRoIs.clear(); - m_daqmuCTPIRoIs.clear(); - m_lvl1muCTPIHash_Endcap.clear(); - m_lvl1muCTPIHash_Forward.clear(); - m_lvl1muCTPIHash_Barrel.clear(); - m_daqmuCTPIHash_Endcap.clear(); - m_daqmuCTPIHash_Forward.clear(); - m_daqmuCTPIHash_Barrel.clear(); - - // get the muCTPi ROBs - std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> muCTPiRobFragmentVec; - muCTPiRobFragmentVec.reserve(m_muCTPiRobIds.size()); - m_robDataProviderSvc->getROBData(m_muCTPiRobIds,muCTPiRobFragmentVec); - if (muCTPiRobFragmentVec.size()==0) { - if (outputLevel() <= MSG::DEBUG) logStream() << MSG::DEBUG << " No muCTPi ROB found." << endreq; - if ( m_doTiming.value() ) { - gettimeofday(&time_stop, 0); - int secs = 0 ; - if (time_stop.tv_sec >= time_start.tv_sec) - secs = time_stop.tv_sec - time_start.tv_sec; - - int usecs = time_stop.tv_usec - time_start.tv_usec; - float mtime = static_cast<float>(secs)*1000 + static_cast<float>(usecs)/1000; - - //* timing histogram - if (m_hist_timeMuCTPi) m_hist_timeMuCTPi->Fill(mtime,1.); - } - return StatusCode::SUCCESS; - } - - // loop over retrieved ROBs and do checks - for (std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>::iterator it = muCTPiRobFragmentVec.begin(); - it != muCTPiRobFragmentVec.end();++it) { - // verify checksum - if (verifyROBChecksum(logStream(), **it )) event_with_checksum_failure=true ; - - // verify status bits - verifyROBStatusBits(logStream(), **it ); - - // decode the muCTPi ROB - decodeMuCTPi(logStream(), **it ); - } - - // compare the the RoIB and DAQ RoIs when running in EF - if (!m_trigROBDataProviderSvc.isValid()) { // not running in L2 - - // Total number of RoIs is different - if (m_lvl1muCTPIRoIs.size() != m_daqmuCTPIRoIs.size()) { - if (outputLevel() <= MSG::DEBUG) logStream() << MSG::DEBUG - << " ---> RoI Number mismatch:" - << " number of RoIB RoIs = " << m_lvl1muCTPIRoIs.size() - << " number of DAQ RoIs = " << m_daqmuCTPIRoIs.size() - << endreq; - float diff_roi = float(m_lvl1muCTPIRoIs.size())- float(m_daqmuCTPIRoIs.size()); - if (m_hist_differenceRoIs) m_hist_differenceRoIs->Fill(diff_roi, 1.); - } - - // Comparison of Barrel RoIs - if ((m_lvl1muCTPIHash_Barrel.size() != 0) && (m_daqmuCTPIHash_Barrel.size() != 0)) { - sort(m_lvl1muCTPIHash_Barrel.begin(),m_lvl1muCTPIHash_Barrel.end()); - sort(m_daqmuCTPIHash_Barrel.begin(), m_daqmuCTPIHash_Barrel.end() ); - - if ( !equal(m_daqmuCTPIHash_Barrel.begin(), m_daqmuCTPIHash_Barrel.end(), m_lvl1muCTPIHash_Barrel.begin()) ) { - if (outputLevel() <= MSG::DEBUG) logStream() << MSG::DEBUG - << " ---> RoI mismatch for BARREL: Hash = RoI-ID*1000 + Sector_ID + hemisphere*" - << m_Number_Of_Barrel_Units.value() << "\n" - << " Hash for RoIB RoIs = " << m_lvl1muCTPIHash_Barrel << "\n" - << " Hash for DAQ RoIs = " << m_daqmuCTPIHash_Barrel - << endreq; - std::vector<uint32_t> only_in_RoIB(m_lvl1muCTPIHash_Barrel.size()), - only_in_DAQ(m_daqmuCTPIHash_Barrel.size()); - std::vector<uint32_t>::iterator only_in_RoIB_it, only_in_DAQ_it; - only_in_RoIB_it = set_difference( m_lvl1muCTPIHash_Barrel.begin(), m_lvl1muCTPIHash_Barrel.end(), - m_daqmuCTPIHash_Barrel.begin() , m_daqmuCTPIHash_Barrel.end() , - only_in_RoIB.begin()); - for (std::vector<uint32_t>::iterator it=only_in_RoIB.begin(); it != only_in_RoIB_it; ++it) { - std::ostringstream ost; - ost << *it; - if (m_hist_muCTPiL1_Problem_Barrel_Hash) { - scoped_lock_histogram lock; - m_hist_muCTPiL1_Problem_Barrel_Hash->Fill((ost.str()).c_str(), 1.); - m_hist_muCTPiL1_Problem_Barrel_Hash->LabelsDeflate("X"); - } - } - - only_in_DAQ_it = set_difference( m_daqmuCTPIHash_Barrel.begin() , m_daqmuCTPIHash_Barrel.end() , - m_lvl1muCTPIHash_Barrel.begin(), m_lvl1muCTPIHash_Barrel.end(), - only_in_DAQ.begin()); - for (std::vector<uint32_t>::iterator it=only_in_DAQ.begin(); it != only_in_DAQ_it; ++it) { - std::ostringstream ost; - ost << *it; - if (m_hist_muCTPiDaq_Problem_Barrel_Hash) { - scoped_lock_histogram lock; - m_hist_muCTPiDaq_Problem_Barrel_Hash->Fill((ost.str()).c_str(), 1.); - m_hist_muCTPiDaq_Problem_Barrel_Hash->LabelsDeflate("X"); - } - } - - if (outputLevel() <= MSG::DEBUG) logStream() << MSG::DEBUG - << " ---> RoI mismatch for BARREL: Hash = RoI-ID*1000 + Sector_ID + hemisphere*" - << m_Number_Of_Barrel_Units.value() << "\n" - << " Hash for RoIs which are only in the RoIB list = " << only_in_RoIB << "\n" - << " Hash for RoIs which are only in the DAQ list = " << only_in_DAQ - << endreq; - } - } - - // Comparison of Endcap RoIs - if ((m_lvl1muCTPIHash_Endcap.size() != 0) && (m_daqmuCTPIHash_Endcap.size() != 0)) { - sort(m_lvl1muCTPIHash_Endcap.begin(),m_lvl1muCTPIHash_Endcap.end()); - sort(m_daqmuCTPIHash_Endcap.begin(), m_daqmuCTPIHash_Endcap.end() ); - - if ( !equal(m_daqmuCTPIHash_Endcap.begin(), m_daqmuCTPIHash_Endcap.end(), m_lvl1muCTPIHash_Endcap.begin()) ) { - if (outputLevel() <= MSG::DEBUG) logStream() << MSG::DEBUG - << " ---> RoI mismatch for ENDCAP: Hash = RoI-ID*1000 + Sector_ID + hemisphere*" - << m_Number_Of_Endcap_Units.value() << "\n" - << " Hash for RoIB RoIs = " << m_lvl1muCTPIHash_Endcap << "\n" - << " Hash for DAQ RoIs = " << m_daqmuCTPIHash_Endcap - << endreq; - std::vector<uint32_t> only_in_RoIB(m_lvl1muCTPIHash_Endcap.size()), - only_in_DAQ(m_daqmuCTPIHash_Endcap.size()); - std::vector<uint32_t>::iterator only_in_RoIB_it, only_in_DAQ_it; - only_in_RoIB_it = set_difference( m_lvl1muCTPIHash_Endcap.begin(), m_lvl1muCTPIHash_Endcap.end(), - m_daqmuCTPIHash_Endcap.begin() , m_daqmuCTPIHash_Endcap.end() , - only_in_RoIB.begin()); - for (std::vector<uint32_t>::iterator it=only_in_RoIB.begin(); it != only_in_RoIB_it; ++it) { - std::ostringstream ost; - ost << *it; - if (m_hist_muCTPiL1_Problem_Endcap_Hash) { - scoped_lock_histogram lock; - m_hist_muCTPiL1_Problem_Endcap_Hash->Fill((ost.str()).c_str(), 1.); - m_hist_muCTPiL1_Problem_Endcap_Hash->LabelsDeflate("X"); - } - } - - only_in_DAQ_it = set_difference( m_daqmuCTPIHash_Endcap.begin() , m_daqmuCTPIHash_Endcap.end() , - m_lvl1muCTPIHash_Endcap.begin(), m_lvl1muCTPIHash_Endcap.end(), - only_in_DAQ.begin()); - for (std::vector<uint32_t>::iterator it=only_in_DAQ.begin(); it != only_in_DAQ_it; ++it) { - std::ostringstream ost; - ost << *it; - if (m_hist_muCTPiDaq_Problem_Endcap_Hash) { - scoped_lock_histogram lock; - m_hist_muCTPiDaq_Problem_Endcap_Hash->Fill((ost.str()).c_str(), 1.); - m_hist_muCTPiDaq_Problem_Endcap_Hash->LabelsDeflate("X"); - } - } - - if (outputLevel() <= MSG::DEBUG) logStream() << MSG::DEBUG - << " ---> RoI mismatch for ENDCAP: Hash = RoI-ID*1000 + Sector_ID + hemisphere*" - << m_Number_Of_Endcap_Units.value() << "\n" - << " Hash for RoIs which are only in the RoIB list = " << only_in_RoIB << "\n" - << " Hash for RoIs which are only in the DAQ list = " << only_in_DAQ - << endreq; - } - } - - // Comparison of Forward RoIs - if ((m_lvl1muCTPIHash_Forward.size() != 0) && (m_daqmuCTPIHash_Forward.size() != 0)) { - sort(m_lvl1muCTPIHash_Forward.begin(),m_lvl1muCTPIHash_Forward.end()); - sort(m_daqmuCTPIHash_Forward.begin(), m_daqmuCTPIHash_Forward.end() ); - - if ( !equal(m_daqmuCTPIHash_Forward.begin(), m_daqmuCTPIHash_Forward.end(), m_lvl1muCTPIHash_Forward.begin()) ) { - if (outputLevel() <= MSG::DEBUG) logStream() << MSG::DEBUG - << " ---> RoI mismatch for FORWARD: Hash = RoI-ID*1000 + Sector_ID + hemisphere*" - << m_Number_Of_Forward_Units.value() << "\n" - << " Hash for RoIB RoIs = " << m_lvl1muCTPIHash_Forward << "\n" - << " Hash for DAQ RoIs = " << m_daqmuCTPIHash_Forward - << endreq; - std::vector<uint32_t> only_in_RoIB(m_lvl1muCTPIHash_Forward.size()), - only_in_DAQ(m_daqmuCTPIHash_Forward.size()); - std::vector<uint32_t>::iterator only_in_RoIB_it, only_in_DAQ_it; - only_in_RoIB_it = set_difference( m_lvl1muCTPIHash_Forward.begin(), m_lvl1muCTPIHash_Forward.end(), - m_daqmuCTPIHash_Forward.begin() , m_daqmuCTPIHash_Forward.end() , - only_in_RoIB.begin()); - for (std::vector<uint32_t>::iterator it=only_in_RoIB.begin(); it != only_in_RoIB_it; ++it) { - std::ostringstream ost; - ost << *it; - if (m_hist_muCTPiL1_Problem_Forward_Hash) { - scoped_lock_histogram lock; - m_hist_muCTPiL1_Problem_Forward_Hash->Fill((ost.str()).c_str(), 1.); - m_hist_muCTPiL1_Problem_Forward_Hash->LabelsDeflate("X"); - } - } - - only_in_DAQ_it = set_difference( m_daqmuCTPIHash_Forward.begin() , m_daqmuCTPIHash_Forward.end() , - m_lvl1muCTPIHash_Forward.begin(), m_lvl1muCTPIHash_Forward.end(), - only_in_DAQ.begin()); - for (std::vector<uint32_t>::iterator it=only_in_DAQ.begin(); it != only_in_DAQ_it; ++it) { - std::ostringstream ost; - ost << *it; - if (m_hist_muCTPiDaq_Problem_Forward_Hash) { - scoped_lock_histogram lock; - m_hist_muCTPiDaq_Problem_Forward_Hash->Fill((ost.str()).c_str(), 1.); - m_hist_muCTPiDaq_Problem_Forward_Hash->LabelsDeflate("X"); - } - } - - if (outputLevel() <= MSG::DEBUG) logStream() << MSG::DEBUG - << " ---> RoI mismatch for FORWARD: Hash = RoI-ID*1000 + Sector_ID + hemisphere*" - << m_Number_Of_Forward_Units.value() << "\n" - << " Hash for RoIs which are only in the RoIB list = " << only_in_RoIB << "\n" - << " Hash for RoIs which are only in the DAQ list = " << only_in_DAQ - << endreq; - } - } - } // end test for L2 - - - // if the event shows errors, set the DEBUG stream tag when requested - if ((m_setDebugStream.value()) && (event_with_checksum_failure)) { - // get EventInfo - const EventInfo* p_EventInfo(0); - StatusCode sc = m_storeGateSvc->retrieve(p_EventInfo); - if(sc.isFailure()){ - logStream() << MSG::ERROR << "Can't get EventInfo object for updating the StreamTag" << endreq; - if ( m_doTiming.value() ) { - gettimeofday(&time_stop, 0); - int secs = 0 ; - if (time_stop.tv_sec >= time_start.tv_sec) - secs = time_stop.tv_sec - time_start.tv_sec; - - int usecs = time_stop.tv_usec - time_start.tv_usec; - float mtime = static_cast<float>(secs)*1000 + static_cast<float>(usecs)/1000; - - //* timing histogram - if (m_hist_timeMuCTPi) m_hist_timeMuCTPi->Fill(mtime,1.); - } - return sc; - } - - // set the stream tag - typedef std::vector< TriggerInfo::StreamTag > StreamTagVector_t; - if (p_EventInfo) { - StreamTagVector_t vecStreamTags = p_EventInfo->trigger_info()->streamTags(); - vecStreamTags.push_back( TriggerInfo::StreamTag(m_debugStreamName,"debug",false) ); - p_EventInfo->trigger_info()->setStreamTags(vecStreamTags); - } - } - - if ( m_doTiming.value() ) { - gettimeofday(&time_stop, 0); - int secs = 0 ; - if (time_stop.tv_sec >= time_start.tv_sec) secs = time_stop.tv_sec-time_start.tv_sec; - - int usecs = time_stop.tv_usec - time_start.tv_usec; - float mtime = static_cast<float>(secs)*1000 + static_cast<float>(usecs)/1000; - - if (outputLevel() <= MSG::DEBUG) logStream() << MSG::DEBUG << " ---> Time used [ms] = " << mtime << endreq; - - //* timing histogram - if (m_hist_timeMuCTPi) m_hist_timeMuCTPi->Fill(mtime,1.); - } - - return StatusCode::SUCCESS; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -StatusCode TrigMuCTPiROBMonitor::finalize() { - - // Get the messaging service - MsgStream log(msgSvc(), name()); - log << MSG::INFO << "finalize()" << endreq; - - // delete decoded objects - if (m_lvl1muCTPIResult) { - delete m_lvl1muCTPIResult; - m_lvl1muCTPIResult=0; - } - if (m_daqmuCTPIResult) { - delete m_daqmuCTPIResult; - m_daqmuCTPIResult=0; - } - -#ifdef ATLAS_GAUDI_V21 - m_trigROBDataProviderSvc.reset(); -#endif - - return StatusCode::SUCCESS; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -StatusCode TrigMuCTPiROBMonitor::beginRun() { - - // Get a message stream instance - m_msg = new MsgStream( msgSvc(), name() ); - - logStream() << MSG::INFO << "beginRun()" << endreq; - - // Define histograms only when checks are requested - if ((not m_doROBChecksum.value()) && (not m_doROBStatus.value())) return StatusCode::SUCCESS; - - // find histogramming service - ServiceHandle<ITHistSvc> rootHistSvc("THistSvc", name()); - if ((rootHistSvc.retrieve()).isFailure()) { - logStream() << MSG::ERROR << "Unable to locate THistSvc" << endreq; - rootHistSvc.release().ignore(); - return StatusCode::FAILURE; - } - - // *-- booking path - std::string path = std::string("/EXPERT/")+getGaudiThreadGenericName(name())+"/"; - - // *-- number of bins for sub detector plots (55 SubDet max.) - uint32_t n_bins_partEBSubDet = m_histProp_failedChecksumForSD.value().bins(); - - // Specific source identifiers - eformat::helper::SourceIdentifier srcID_muCTPi( eformat::TDAQ_MUON_CTP_INTERFACE ,0); - eformat::helper::SourceIdentifier srcID_CTP( eformat::TDAQ_CTP ,0); - - if ( m_doROBChecksum.value() ) { - // *-- ROBs with failed checksum - m_hist_failedChecksumForROB = new TH1F (m_histProp_failedChecksumForROB.value().title().c_str(), - (m_histProp_failedChecksumForROB.value().title()+";ROB id").c_str(), - m_histProp_failedChecksumForROB.value().bins(), - m_histProp_failedChecksumForROB.value().lowEdge(), - m_histProp_failedChecksumForROB.value().highEdge()); - if (m_hist_failedChecksumForROB) { - m_hist_failedChecksumForROB->SetBit(TH1::kCanRebin); - if( rootHistSvc->regHist(path + m_hist_failedChecksumForROB->GetName(), m_hist_failedChecksumForROB).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_failedChecksumForROB->GetName() << endreq; - } - } - - // *-- Sub detectors with ROBs with failed checksum - m_hist_failedChecksumForSD = new TH1F (m_histProp_failedChecksumForSD.value().title().c_str(), - (m_histProp_failedChecksumForSD.value().title()+";SD id").c_str(), - m_histProp_failedChecksumForSD.value().bins(), - m_histProp_failedChecksumForSD.value().lowEdge(), - m_histProp_failedChecksumForSD.value().highEdge()); - if (m_hist_failedChecksumForSD) { - uint32_t n_tmp_bin = 1; - m_hist_failedChecksumForSD->GetXaxis()->SetBinLabel( n_tmp_bin, srcID_muCTPi.human_detector().c_str() ); - n_tmp_bin++; - m_hist_failedChecksumForSD->GetXaxis()->SetBinLabel( n_tmp_bin, srcID_CTP.human_detector().c_str() ); - - if( rootHistSvc->regHist(path + m_hist_failedChecksumForSD->GetName(), m_hist_failedChecksumForSD).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_failedChecksumForSD->GetName() << endreq; - } - } - } - - if ( m_doROBStatus.value() ) { - // *-- Generic Status for ROBs per sub detector - m_hist_genericStatusForROB = new TH2F ("GenericStatusForROBsFromSubDetectors", - "GenericStatusForROBsFromSubDetectors;SD id;", - n_bins_partEBSubDet,0.,(float) n_bins_partEBSubDet, - m_map_GenericStatus.size(),0., (float) m_map_GenericStatus.size()); - if (m_hist_genericStatusForROB) { - uint32_t n_tmp_bin = 1; - m_hist_genericStatusForROB->GetXaxis()->SetBinLabel( n_tmp_bin, srcID_muCTPi.human_detector().c_str() ); - n_tmp_bin++; - m_hist_genericStatusForROB->GetXaxis()->SetBinLabel( n_tmp_bin, srcID_CTP.human_detector().c_str() ); - - n_tmp_bin = 1; - for (std::map<eformat::GenericStatus, std::string>::const_iterator it = m_map_GenericStatus.begin();it != m_map_GenericStatus.end();++it) { - m_hist_genericStatusForROB->GetYaxis()->SetBinLabel( n_tmp_bin, (*it).second.c_str() ); - n_tmp_bin++; - } - - if( rootHistSvc->regHist(path + m_hist_genericStatusForROB->GetName(), m_hist_genericStatusForROB).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_genericStatusForROB->GetName() << endreq; - } - } - - // *-- Specific Status Bits for ROBs per sub detector - m_hist_specificStatusForROB = new TH2F ("SpecificStatusBitsForROBsFromSubDetectors", - "SpecificStatusBitsForROBsFromSubDetectors;SD id;", - n_bins_partEBSubDet,0.,(float) n_bins_partEBSubDet, - m_vec_SpecificStatus.size(),0., (float) m_vec_SpecificStatus.size()); - if (m_hist_specificStatusForROB) { - uint32_t n_tmp_bin = 1; - m_hist_specificStatusForROB->GetXaxis()->SetBinLabel( n_tmp_bin, srcID_muCTPi.human_detector().c_str() ); - n_tmp_bin++; - m_hist_specificStatusForROB->GetXaxis()->SetBinLabel( n_tmp_bin, srcID_CTP.human_detector().c_str() ); - - n_tmp_bin = 1; - for (std::vector<std::string>::const_iterator it = m_vec_SpecificStatus.begin();it != m_vec_SpecificStatus.end();++it) { - m_hist_specificStatusForROB->GetYaxis()->SetBinLabel( n_tmp_bin, (*it).c_str() ); - n_tmp_bin++; - } - - if( rootHistSvc->regHist(path + m_hist_specificStatusForROB->GetName(), m_hist_specificStatusForROB).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_specificStatusForROB->GetName() << endreq; - } - } - } - - if ( m_doTiming.value() ) { - // *-- Timing histogram for monitoring algorithm - m_hist_timeMuCTPi = new TH1F (m_histProp_timeMuCTPi.value().title().c_str(), - (m_histProp_timeMuCTPi.value().title()+";ms").c_str(), - m_histProp_timeMuCTPi.value().bins(), - m_histProp_timeMuCTPi.value().lowEdge(), - m_histProp_timeMuCTPi.value().highEdge()); - if (m_hist_timeMuCTPi) { - // m_hist_timeMuCTPi->SetBit(TH1::kCanRebin); - if( rootHistSvc->regHist(path + m_hist_timeMuCTPi->GetName(), m_hist_timeMuCTPi).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_timeMuCTPi->GetName() << endreq; - } - } - } - - // muCTPi plots, loop over the hemisperes - std::vector<std::string> strHemisphere; - strHemisphere.push_back("Hemisphere_0(C)"); - strHemisphere.push_back("Hemisphere_1(A)"); - - std::vector<std::string> strThreshold; - strThreshold.push_back("All"); - strThreshold.push_back("PT1"); - strThreshold.push_back("PT2"); - strThreshold.push_back("PT3"); - strThreshold.push_back("PT4"); - strThreshold.push_back("PT5"); - strThreshold.push_back("PT6"); - - std::string histTitle; - // *-- Number of muCTPi RoIs - // *-- RoIB - histTitle = m_histProp_NumberOfRoIs.value().title()+std::string("_RoIB"); - m_hist_NumberOfRoIs_RoIB = new TH1F ( histTitle.c_str(), - (histTitle+";Number of RoIs").c_str(), - m_histProp_NumberOfRoIs.value().bins(), - m_histProp_NumberOfRoIs.value().lowEdge(), - m_histProp_NumberOfRoIs.value().highEdge()); - if (m_hist_NumberOfRoIs_RoIB) { - if( rootHistSvc->regHist(path + m_hist_NumberOfRoIs_RoIB->GetName(), m_hist_NumberOfRoIs_RoIB).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_NumberOfRoIs_RoIB->GetName() << endreq; - } - } - - // *-- Sector_ID vs. Pad_Id for Barrel RoIs from L1 - for (unsigned int threshold=0; threshold <= NUMBER_OF_PT_THRESHOLDS; ++threshold) { - histTitle = std::string("Sector_ID_vs_Pad_ID_Barrel_L1_Threshold_")+strThreshold[threshold]; - m_hist_muCTPiL1_Barrel_SectorID_Pad[threshold] = new TH2F ( histTitle.c_str(), - (histTitle+";(pad_ID+1)*(2*hemispere-1);SD id;").c_str(), - 17,-8,8, - m_Number_Of_Barrel_Units.value(), 0, m_Number_Of_Barrel_Units.value()); - if (m_hist_muCTPiL1_Barrel_SectorID_Pad[threshold]) { - if( rootHistSvc->regHist(path + m_hist_muCTPiL1_Barrel_SectorID_Pad[threshold]->GetName(), m_hist_muCTPiL1_Barrel_SectorID_Pad[threshold]).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_muCTPiL1_Barrel_SectorID_Pad[threshold]->GetName() << endreq; - } - } - } // end loop over threshold - - for (int hemisphere=0; hemisphere < 2; ++hemisphere) { - // *-- muCTPi ROB: sector ID --- - // *-- L1 Endcap - histTitle = m_histProp_muCTPi_Endcap_SectorID.value().title()+std::string("_L1_")+strHemisphere[hemisphere]; - m_hist_muCTPiL1_Endcap_SectorID[hemisphere] = new TH1F ( histTitle.c_str(), - (histTitle+";Sector Id").c_str(), - m_histProp_muCTPi_Endcap_SectorID.value().bins(), - m_histProp_muCTPi_Endcap_SectorID.value().lowEdge(), - m_histProp_muCTPi_Endcap_SectorID.value().highEdge()); - if (m_hist_muCTPiL1_Endcap_SectorID[hemisphere]) { - //m_hist_muCTPiL1_Endcap_SectorID[hemisphere]->SetBit(TH1::kCanRebin); - if( rootHistSvc->regHist(path + m_hist_muCTPiL1_Endcap_SectorID[hemisphere]->GetName(), m_hist_muCTPiL1_Endcap_SectorID[hemisphere]).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_muCTPiL1_Endcap_SectorID[hemisphere]->GetName() << endreq; - } - } - // *-- L1 Forward - histTitle = m_histProp_muCTPi_Forward_SectorID.value().title()+std::string("_L1_")+strHemisphere[hemisphere]; - m_hist_muCTPiL1_Forward_SectorID[hemisphere] = new TH1F ( histTitle.c_str(), - (histTitle+";Sector Id").c_str(), - m_histProp_muCTPi_Forward_SectorID.value().bins(), - m_histProp_muCTPi_Forward_SectorID.value().lowEdge(), - m_histProp_muCTPi_Forward_SectorID.value().highEdge()); - if (m_hist_muCTPiL1_Forward_SectorID[hemisphere]) { - //m_hist_muCTPiL1_Forward_SectorID[hemisphere]->SetBit(TH1::kCanRebin); - if( rootHistSvc->regHist(path + m_hist_muCTPiL1_Forward_SectorID[hemisphere]->GetName(), m_hist_muCTPiL1_Forward_SectorID[hemisphere]).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_muCTPiL1_Forward_SectorID[hemisphere]->GetName() << endreq; - } - } - // *-- L1 Barrel - histTitle = m_histProp_muCTPi_Barrel_SectorID.value().title()+std::string("_L1_")+strHemisphere[hemisphere]; - m_hist_muCTPiL1_Barrel_SectorID[hemisphere] = new TH1F ( histTitle.c_str(), - (histTitle+";Sector Id").c_str(), - m_histProp_muCTPi_Barrel_SectorID.value().bins(), - m_histProp_muCTPi_Barrel_SectorID.value().lowEdge(), - m_histProp_muCTPi_Barrel_SectorID.value().highEdge()); - if (m_hist_muCTPiL1_Barrel_SectorID[hemisphere]) { - //m_hist_muCTPiL1_Barrel_SectorID[hemisphere]->SetBit(TH1::kCanRebin); - if( rootHistSvc->regHist(path + m_hist_muCTPiL1_Barrel_SectorID[hemisphere]->GetName(), m_hist_muCTPiL1_Barrel_SectorID[hemisphere]).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_muCTPiL1_Barrel_SectorID[hemisphere]->GetName() << endreq; - } - } - - if (!m_trigROBDataProviderSvc.isValid()) { // Define DAQ histograms only when not running in L2 - // *-- DAQ Endcap - histTitle = m_histProp_muCTPi_Endcap_SectorID.value().title()+std::string("_DAQ_")+strHemisphere[hemisphere]; - m_hist_muCTPiDaq_Endcap_SectorID[hemisphere] = new TH1F ( histTitle.c_str(), - (histTitle+";Sector Id").c_str(), - m_histProp_muCTPi_Endcap_SectorID.value().bins(), - m_histProp_muCTPi_Endcap_SectorID.value().lowEdge(), - m_histProp_muCTPi_Endcap_SectorID.value().highEdge()); - if (m_hist_muCTPiDaq_Endcap_SectorID[hemisphere]) { - //m_hist_muCTPiDaq_Endcap_SectorID[hemisphere]->SetBit(TH1::kCanRebin); - if( rootHistSvc->regHist(path + m_hist_muCTPiDaq_Endcap_SectorID[hemisphere]->GetName(), m_hist_muCTPiDaq_Endcap_SectorID[hemisphere]).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_muCTPiDaq_Endcap_SectorID[hemisphere]->GetName() << endreq; - } - } - // *-- DAQ Forward - histTitle = m_histProp_muCTPi_Forward_SectorID.value().title()+std::string("_DAQ_")+strHemisphere[hemisphere]; - m_hist_muCTPiDaq_Forward_SectorID[hemisphere] = new TH1F ( histTitle.c_str(), - (histTitle+";Sector Id").c_str(), - m_histProp_muCTPi_Forward_SectorID.value().bins(), - m_histProp_muCTPi_Forward_SectorID.value().lowEdge(), - m_histProp_muCTPi_Forward_SectorID.value().highEdge()); - if (m_hist_muCTPiDaq_Forward_SectorID[hemisphere]) { - //m_hist_muCTPiDaq_Forward_SectorID[hemisphere]->SetBit(TH1::kCanRebin); - if( rootHistSvc->regHist(path + m_hist_muCTPiDaq_Forward_SectorID[hemisphere]->GetName(), m_hist_muCTPiDaq_Forward_SectorID[hemisphere]).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_muCTPiDaq_Forward_SectorID[hemisphere]->GetName() << endreq; - } - } - // *-- DAQ Barrel - histTitle = m_histProp_muCTPi_Barrel_SectorID.value().title()+std::string("_DAQ_")+strHemisphere[hemisphere]; - m_hist_muCTPiDaq_Barrel_SectorID[hemisphere] = new TH1F ( histTitle.c_str(), - (histTitle+";Sector Id").c_str(), - m_histProp_muCTPi_Barrel_SectorID.value().bins(), - m_histProp_muCTPi_Barrel_SectorID.value().lowEdge(), - m_histProp_muCTPi_Barrel_SectorID.value().highEdge()); - if (m_hist_muCTPiDaq_Barrel_SectorID[hemisphere]) { - //m_hist_muCTPiDaq_Barrel_SectorID[hemisphere]->SetBit(TH1::kCanRebin); - if( rootHistSvc->regHist(path + m_hist_muCTPiDaq_Barrel_SectorID[hemisphere]->GetName(), m_hist_muCTPiDaq_Barrel_SectorID[hemisphere]).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_muCTPiDaq_Barrel_SectorID[hemisphere]->GetName() << endreq; - } - } - } // end check for L2 - } // end loop over hemispheres - - if (!m_trigROBDataProviderSvc.isValid()) { // Define RoIB-DAQ comparison histograms only when not running in L2 - // *-- Number of muCTPi RoIs - // *-- DAQ - histTitle = m_histProp_NumberOfRoIs.value().title()+std::string("_DAQ"); - m_hist_NumberOfRoIs_DAQ = new TH1F ( histTitle.c_str(), - (histTitle+";Number of RoIs").c_str(), - m_histProp_NumberOfRoIs.value().bins(), - m_histProp_NumberOfRoIs.value().lowEdge(), - m_histProp_NumberOfRoIs.value().highEdge()); - if (m_hist_NumberOfRoIs_DAQ) { - if( rootHistSvc->regHist(path + m_hist_NumberOfRoIs_DAQ->GetName(), m_hist_NumberOfRoIs_DAQ).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_NumberOfRoIs_DAQ->GetName() << endreq; - } - } - - // *-- Sector_ID vs. Pad_Id for Barrel RoIs from DAQ - for (unsigned int threshold=0; threshold <= NUMBER_OF_PT_THRESHOLDS; ++threshold) { - histTitle = std::string("Sector_ID_vs_Pad_ID_Barrel_DAQ_Threshold_")+strThreshold[threshold]; - m_hist_muCTPiDaq_Barrel_SectorID_Pad[threshold] = new TH2F ( histTitle.c_str(), - (histTitle+";(pad_ID+1)*(2*hemispere-1);SD id;").c_str(), - 17,-8,8, - m_Number_Of_Barrel_Units.value(), 0, m_Number_Of_Barrel_Units.value()); - if (m_hist_muCTPiDaq_Barrel_SectorID_Pad[threshold]) { - if( rootHistSvc->regHist(path + m_hist_muCTPiDaq_Barrel_SectorID_Pad[threshold]->GetName(), m_hist_muCTPiDaq_Barrel_SectorID_Pad[threshold]).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_muCTPiDaq_Barrel_SectorID_Pad[threshold]->GetName() << endreq; - } - } - } // end loop over threshold - - // *-- Profile: Difference of BCID to event BCID as function of Sector_ID vs. Pad_Id for Barrel RoIs from DAQ - histTitle = std::string("Difference_BCID_for_Sector_ID_vs_Pad_ID_Barrel_DAQ_ROB"); - m_hist_muCTPiDaq_Barrel_SectorID_Pad_DeltaBCID = new TProfile2D(histTitle.c_str(), - (histTitle+";(pad_ID+1)*(2*hemispere-1);SD id;").c_str(), - 17,-8,8, - m_Number_Of_Barrel_Units.value(), 0, m_Number_Of_Barrel_Units.value(), -10., 10.); - if (m_hist_muCTPiDaq_Barrel_SectorID_Pad_DeltaBCID) { - if( rootHistSvc->regHist(path + m_hist_muCTPiDaq_Barrel_SectorID_Pad_DeltaBCID->GetName(), m_hist_muCTPiDaq_Barrel_SectorID_Pad_DeltaBCID).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_muCTPiDaq_Barrel_SectorID_Pad_DeltaBCID->GetName() << endreq; - } - } - - // *-- Difference # of RoIs in RoIB - DAQ ROB - m_hist_differenceRoIs = new TH1F (m_histProp_differenceRoIs.value().title().c_str(), - (m_histProp_differenceRoIs.value().title()+";Difference (RoIB-DAQ) RoIs").c_str(), - m_histProp_differenceRoIs.value().bins(), - m_histProp_differenceRoIs.value().lowEdge(), - m_histProp_differenceRoIs.value().highEdge()); - if (m_hist_differenceRoIs) { - if( rootHistSvc->regHist(path + m_hist_differenceRoIs->GetName(), m_hist_differenceRoIs).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_differenceRoIs->GetName() << endreq; - } - } - - // *-- Barrel: Hash for RoIs which are only in RoIB ROB - histTitle = m_histProp_Problem_Barrel_Hash.value().title()+std::string("_RoIB_ROB"); - m_hist_muCTPiL1_Problem_Barrel_Hash = new TH1F (histTitle.c_str(), - (histTitle+";RoI_ID*1000 + Sector_ID + hemisphere*32").c_str(), - m_histProp_Problem_Barrel_Hash.value().bins(), - m_histProp_Problem_Barrel_Hash.value().lowEdge(), - m_histProp_Problem_Barrel_Hash.value().highEdge()); - if (m_hist_muCTPiL1_Problem_Barrel_Hash) { - m_hist_muCTPiL1_Problem_Barrel_Hash->SetBit(TH1::kCanRebin); - if( rootHistSvc->regHist(path + m_hist_muCTPiL1_Problem_Barrel_Hash->GetName(), m_hist_muCTPiL1_Problem_Barrel_Hash).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_muCTPiL1_Problem_Barrel_Hash->GetName() << endreq; - } - } - - // *-- Barrel: Hash for RoIs which are only in DAQ ROB - histTitle = m_histProp_Problem_Barrel_Hash.value().title()+std::string("_DAQ_ROB"); - m_hist_muCTPiDaq_Problem_Barrel_Hash = new TH1F (histTitle.c_str(), - (histTitle+";RoI_ID*1000 + Sector_ID + hemisphere*32").c_str(), - m_histProp_Problem_Barrel_Hash.value().bins(), - m_histProp_Problem_Barrel_Hash.value().lowEdge(), - m_histProp_Problem_Barrel_Hash.value().highEdge()); - if (m_hist_muCTPiDaq_Problem_Barrel_Hash) { - m_hist_muCTPiDaq_Problem_Barrel_Hash->SetBit(TH1::kCanRebin); - if( rootHistSvc->regHist(path + m_hist_muCTPiDaq_Problem_Barrel_Hash->GetName(), m_hist_muCTPiDaq_Problem_Barrel_Hash).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_muCTPiDaq_Problem_Barrel_Hash->GetName() << endreq; - } - } - - // *-- Endcap: Hash for RoIs which are only in RoIB ROB - histTitle = m_histProp_Problem_Endcap_Hash.value().title()+std::string("_RoIB_ROB"); - m_hist_muCTPiL1_Problem_Endcap_Hash = new TH1F (histTitle.c_str(), - (histTitle+";RoI_ID*1000 + Sector_ID + hemisphere*48").c_str(), - m_histProp_Problem_Endcap_Hash.value().bins(), - m_histProp_Problem_Endcap_Hash.value().lowEdge(), - m_histProp_Problem_Endcap_Hash.value().highEdge()); - if (m_hist_muCTPiL1_Problem_Endcap_Hash) { - m_hist_muCTPiL1_Problem_Endcap_Hash->SetBit(TH1::kCanRebin); - if( rootHistSvc->regHist(path + m_hist_muCTPiL1_Problem_Endcap_Hash->GetName(), m_hist_muCTPiL1_Problem_Endcap_Hash).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_muCTPiL1_Problem_Endcap_Hash->GetName() << endreq; - } - } - - // *-- Endcap: Hash for RoIs which are only in DAQ ROB - histTitle = m_histProp_Problem_Endcap_Hash.value().title()+std::string("_DAQ_ROB"); - m_hist_muCTPiDaq_Problem_Endcap_Hash = new TH1F (histTitle.c_str(), - (histTitle+";RoI_ID*1000 + Sector_ID + hemisphere*48").c_str(), - m_histProp_Problem_Endcap_Hash.value().bins(), - m_histProp_Problem_Endcap_Hash.value().lowEdge(), - m_histProp_Problem_Endcap_Hash.value().highEdge()); - if (m_hist_muCTPiDaq_Problem_Endcap_Hash) { - m_hist_muCTPiDaq_Problem_Endcap_Hash->SetBit(TH1::kCanRebin); - if( rootHistSvc->regHist(path + m_hist_muCTPiDaq_Problem_Endcap_Hash->GetName(), m_hist_muCTPiDaq_Problem_Endcap_Hash).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_muCTPiDaq_Problem_Endcap_Hash->GetName() << endreq; - } - } - - // *-- Forward: Hash for RoIs which are only in RoIB ROB - histTitle = m_histProp_Problem_Forward_Hash.value().title()+std::string("_RoIB_ROB"); - m_hist_muCTPiL1_Problem_Forward_Hash = new TH1F (histTitle.c_str(), - (histTitle+";RoI_ID*1000 + Sector_ID + hemisphere*24").c_str(), - m_histProp_Problem_Forward_Hash.value().bins(), - m_histProp_Problem_Forward_Hash.value().lowEdge(), - m_histProp_Problem_Forward_Hash.value().highEdge()); - if (m_hist_muCTPiL1_Problem_Forward_Hash) { - m_hist_muCTPiL1_Problem_Forward_Hash->SetBit(TH1::kCanRebin); - if( rootHistSvc->regHist(path + m_hist_muCTPiL1_Problem_Forward_Hash->GetName(), m_hist_muCTPiL1_Problem_Forward_Hash).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_muCTPiL1_Problem_Forward_Hash->GetName() << endreq; - } - } - - // *-- Forward: Hash for RoIs which are only in DAQ ROB - histTitle = m_histProp_Problem_Forward_Hash.value().title()+std::string("_DAQ_ROB"); - m_hist_muCTPiDaq_Problem_Forward_Hash = new TH1F (histTitle.c_str(), - (histTitle+";RoI_ID*1000 + Sector_ID + hemisphere*24").c_str(), - m_histProp_Problem_Forward_Hash.value().bins(), - m_histProp_Problem_Forward_Hash.value().lowEdge(), - m_histProp_Problem_Forward_Hash.value().highEdge()); - if (m_hist_muCTPiDaq_Problem_Forward_Hash) { - m_hist_muCTPiDaq_Problem_Forward_Hash->SetBit(TH1::kCanRebin); - if( rootHistSvc->regHist(path + m_hist_muCTPiDaq_Problem_Forward_Hash->GetName(), m_hist_muCTPiDaq_Problem_Forward_Hash).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_muCTPiDaq_Problem_Forward_Hash->GetName() << endreq; - } - } - } // end check for L2 - - - // release histogramming service - rootHistSvc.release().ignore(); - - return StatusCode::SUCCESS; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -StatusCode TrigMuCTPiROBMonitor::endRun() { - - logStream() << MSG::INFO << "endRun()" << endreq; - - // delete message stream - if ( m_msg ) delete m_msg; - - return StatusCode::SUCCESS; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -bool TrigMuCTPiROBMonitor::verifyROBChecksum(MsgStream& log, OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment robFrag) { - - bool failed_checksum(false); - OFFLINE_FRAGMENTS_NAMESPACE::PointerType it(0); - uint32_t current_value(0); - - // print check for received ROB - if (log.level() <= MSG::VERBOSE) { - robFrag.payload(it); - current_value = eformat::helper::checksum(robFrag.checksum_type(), it, robFrag.payload_size_word()); - - log << MSG::VERBOSE - << " ROB id = 0x" << std::setw(6) << MSG::hex << robFrag.source_id() << MSG::dec - << " checksum: type = " << std::setw(2) << robFrag.checksum_type() - << " value = " << std::setw(12) << robFrag.checksum_value() - << " value (recalculated) = " << std::setw(12) << current_value - << " check = " << std::setw(2) << robFrag.checksum() - << endreq; - } - - // checksum test failed - if ( not robFrag.checksum() ) { - failed_checksum = true; - - // recalculate checksum value - robFrag.payload(it); - current_value = eformat::helper::checksum(robFrag.checksum_type(), it, robFrag.payload_size_word()); - - // print warning - log << MSG::WARNING - << " ROB checksum verification failed." - << " ROB id = 0x" << std::setw(6) << MSG::hex << robFrag.source_id() << MSG::dec - << " checksum type = " << std::setw(2) << robFrag.checksum_type() - << " value = " << std::setw(12) << robFrag.checksum_value() - << " value (recalculated) = " << std::setw(12) << current_value - << " check = " << std::setw(2) << robFrag.checksum() - << endreq; - - // fill the histograms - std::ostringstream ost; - ost << "0x" << std::hex << robFrag.source_id(); - if (m_hist_failedChecksumForROB) { - scoped_lock_histogram lock; - m_hist_failedChecksumForROB->Fill((ost.str()).c_str(), 1.); - m_hist_failedChecksumForROB->LabelsDeflate("X"); - } - - if (m_hist_failedChecksumForSD) { - scoped_lock_histogram lock; - m_hist_failedChecksumForSD->Fill(eformat::helper::SourceIdentifier(robFrag.source_id()).human_detector().c_str(),1.); - m_hist_failedChecksumForSD->LabelsDeflate("X"); - } - } - - return failed_checksum; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -void TrigMuCTPiROBMonitor::verifyROBStatusBits(MsgStream& log, OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment robFrag) { - - // print check for received ROB - if (log.level() <= MSG::VERBOSE) { - log << MSG::VERBOSE - << " verifyROBStatusBits: ROB id = 0x" << std::setw(6) << MSG::hex << robFrag.source_id() << MSG::dec - << endreq; - } - - // fill monitoring histogram for ROB generic status - if ( ( m_hist_genericStatusForROB ) && ( robFrag.nstatus() != 0 ) ) { - const uint32_t* it_status; - robFrag.status(it_status); - if ((*it_status) != 0) m_hist_genericStatusForROB->Fill(eformat::helper::SourceIdentifier(robFrag.source_id()).human_detector().c_str(), - m_map_GenericStatus[eformat::helper::Status(*it_status).generic()].c_str(),1.); - } - - // fill monitoring histogram for ROB specific status - if ( ( m_hist_specificStatusForROB ) && ( robFrag.nstatus() != 0 ) ) { - const uint32_t* it_status; - robFrag.status(it_status); - if ((*it_status) != 0) { - std::bitset<16> specificBits(eformat::helper::Status(*it_status).specific()); - for (unsigned int index=0; index < 16; ++index) { - if (specificBits[index]) m_hist_specificStatusForROB->Fill(eformat::helper::SourceIdentifier(robFrag.source_id()).human_detector().c_str(), - m_vec_SpecificStatus[index].c_str(),1.); - } - } - } -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -void TrigMuCTPiROBMonitor::decodeMuCTPi(MsgStream& log, OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment robFrag) { - // save input stream flags - std::ios_base::fmtflags log_flags_save = (log.stream()).flags(); - char log_fill_char_save = (log.stream()).fill(); - - // print check for received ROB - if (log.level() <= MSG::DEBUG) { - log << MSG::DEBUG - << " decodeMuCTPi: ROB id = 0x" << std::setw(6) << MSG::hex << robFrag.source_id() << MSG::dec - << endreq; - } - - uint32_t formatVersion = robFrag.rod_version(); - uint32_t evtNum = robFrag.rod_lvl1_id(); - uint32_t robFragSize = robFrag.fragment_size_word(); - uint32_t rodFragSize = robFrag.rod_fragment_size_word(); - uint32_t robId = robFrag.source_id(); - uint32_t rodId = robFrag.rod_source_id(); - const uint32_t bcId = robFrag.rod_bc_id(); - - const uint32_t* status; - robFrag.rod_status( status ); - uint32_t nstatus = robFrag.rod_nstatus(); - - uint32_t errorStat( 0 ); - if( nstatus > 0 ) errorStat = static_cast< uint32_t >( *status ); - - if (log.level() <= MSG::DEBUG) log << MSG::DEBUG << "ROB ID 0x" << MSG::hex << robId << " ROD ID 0x" - << rodId << MSG::dec << " ROB fragment size " - << robFragSize << " ROD fragment size " << rodFragSize << endreq; - - /* RoIB MuCTPI ROB */ - if (rodId == (uint32_t)m_lvl1MuCTPiROBid.value()) { - if (log.level() <= MSG::DEBUG) { - log << MSG::DEBUG << " Found RoIB MuCTPI ROB." << endreq; - log << MSG::DEBUG << " Dumping RoI Words:" << endreq; - } - - /* Create header */ - ROIB::Header muCTPIHead( rodId, evtNum, formatVersion); - /* Create content body */ - const uint32_t* data; - robFrag.rod_data( data ); - uint32_t ndata = robFrag.rod_ndata(); - m_lvl1muCTPIRoIs.reserve(ndata); - m_lvl1muCTPIHash_Endcap.reserve(ndata); - m_lvl1muCTPIHash_Forward.reserve(ndata); - m_lvl1muCTPIHash_Barrel.reserve(ndata); - - for( uint32_t i = 0; i < ndata; ++i, ++data ) { - if (log.level() <= MSG::DEBUG) { - log << MSG::DEBUG << " 0x" << MSG::hex << std::setw( 8 ) - << static_cast< uint32_t >( *data ) << endreq; - } - ROIB::MuCTPIRoI thisRoI( static_cast< uint32_t >( *data ) ); - m_lvl1muCTPIRoIs.push_back( thisRoI ); - } - /* Create trailer */ - ROIB::Trailer muCTPITrail( m_lvl1muCTPIRoIs.size(), errorStat ); - /* Create MuCTPIResult object */ - m_lvl1muCTPIResult = new ROIB::MuCTPIResult( muCTPIHead, muCTPITrail, m_lvl1muCTPIRoIs ); - /* Dump object if requested */ - if (log.level() <= MSG::DEBUG) { - log << MSG::DEBUG << m_lvl1muCTPIResult->dump() << endreq; - m_lvl1muCTPIResult->dumpData(log); - } - - // fill histograms and compute RoI hashes - float num_roib_rois = m_lvl1muCTPIRoIs.size(); - if (m_hist_NumberOfRoIs_RoIB) m_hist_NumberOfRoIs_RoIB->Fill(num_roib_rois, 1.); - - unsigned int hemi; - uint32_t hash; - float sector_id_f, pad_id_f; - for (std::vector< ROIB::MuCTPIRoI >::iterator it = m_lvl1muCTPIRoIs.begin(); it != m_lvl1muCTPIRoIs.end(); ++it) { - hemi = ( (*it).getSectorAddress() & MuCTPI_RDO::SECTOR_HEMISPHERE_MASK); - sector_id_f = (*it).getSectorID(); - if( (*it).getSectorLocation() == MuCTPI_RDO::ENDCAP ) { - if (m_hist_muCTPiL1_Endcap_SectorID[hemi]) m_hist_muCTPiL1_Endcap_SectorID[hemi]->Fill( sector_id_f, 1.); - hash = ((*it).getSectorID() + hemi * m_Number_Of_Endcap_Units.value()) + 1000*(*it).getRoiNumber() ; - m_lvl1muCTPIHash_Endcap.push_back(hash); - } - else if( (*it).getSectorLocation() == MuCTPI_RDO::FORWARD ) { - if (m_hist_muCTPiL1_Forward_SectorID[hemi]) m_hist_muCTPiL1_Forward_SectorID[hemi]->Fill( sector_id_f, 1.); - hash = ((*it).getSectorID() + hemi * m_Number_Of_Forward_Units.value()) + 1000*(*it).getRoiNumber() ; - m_lvl1muCTPIHash_Forward.push_back(hash); - } - else if( (*it).getSectorLocation() == MuCTPI_RDO::BARREL ) { - if (m_hist_muCTPiL1_Barrel_SectorID[hemi]) m_hist_muCTPiL1_Barrel_SectorID[hemi]->Fill( sector_id_f, 1.); - int pad_id = (((*it).getRoiNumber()/4)+1)*(2*(int) hemi-1); - pad_id_f = pad_id; - if (m_hist_muCTPiL1_Barrel_SectorID_Pad[0]) m_hist_muCTPiL1_Barrel_SectorID_Pad[0]->Fill( pad_id_f, sector_id_f, 1.); - if (m_hist_muCTPiL1_Barrel_SectorID_Pad[(*it).pt()]) - m_hist_muCTPiL1_Barrel_SectorID_Pad[(*it).pt()]->Fill( pad_id_f, sector_id_f, 1.); - hash = ((*it).getSectorID() + hemi * m_Number_Of_Barrel_Units.value()) + 1000*(*it).getRoiNumber() ; - m_lvl1muCTPIHash_Barrel.push_back(hash); - } - } // end loop over RoIs - - /* DAQ MuCTPI ROB */ - } else if (rodId == (uint32_t)m_daqMuCTPiROBid.value()) { - if (log.level() <= MSG::DEBUG) { - log << MSG::DEBUG << " Found DAQ MuCTPI ROB." << endreq; - log << MSG::DEBUG << " ROD Header BCID " << bcId << endreq; - log << MSG::DEBUG << " Dumping RoI Words:" << endreq; - } - - OFFLINE_FRAGMENTS_NAMESPACE::PointerType it_data; - robFrag.rod_data( it_data ); - const uint32_t ndata = robFrag.rod_ndata(); - if (log.level() <= MSG::DEBUG) - log << MSG::DEBUG << " number of data words: " << ndata << endreq; - - // candidate multiplicity - std::vector< uint32_t > candidateMultiplicity; - // data words - std::vector< uint32_t > dataWord; - for( uint32_t i = 0; i < ndata; ++i, ++it_data ) { - if( *it_data >> MuCTPI_RDO::MULT_WORD_FLAG_SHIFT ) { - candidateMultiplicity.push_back( static_cast< uint32_t >( *it_data ) ); - if (log.level() <= MSG::DEBUG) - log << MSG::DEBUG << " 0x" << MSG::hex << std::setw( 8 ) << std::setfill( '0' ) - << ( *it_data ) << " (candidate multiplicity)" << std::setfill( log_fill_char_save ) << endreq; - } else { - dataWord.push_back( static_cast< uint32_t >( *it_data ) ); - if (log.level() <= MSG::DEBUG) - log << MSG::DEBUG << " 0x" << MSG::hex << std::setw( 8 ) << std::setfill( '0' ) - << ( *it_data ) << " (candidate word)" - << " (--> RoI word = 0x" << MSG::hex << std::setw( 8 ) << std::setfill( '0' ) - << mirodToRoIBDataWord( *it_data ) << ")" - << std::setfill( log_fill_char_save ) << endreq; - } - } - - // create MuCTPI RDO - m_daqmuCTPIResult = new MuCTPI_RDO( candidateMultiplicity, dataWord ); - - // print contents - if (log.level() <= MSG::DEBUG) { - MuCTPI_MultiplicityWord_Decoder(m_daqmuCTPIResult->candidateMultiplicity()).dumpData(log); - for(std::vector< uint32_t >::const_iterator it = m_daqmuCTPIResult->dataWord().begin(); - it != m_daqmuCTPIResult->dataWord().end(); ++it) { - MuCTPI_DataWord_Decoder(*it).dumpData(log); - dumpRoIBDataWord(log, mirodToRoIBDataWord(*it)); - } - } - - // now select out the RoI candidates for the BCID which triggered the event and save them in - // a special list indexed by RoI ID - uint16_t roiEventBCID = MuCTPI_MultiplicityWord_Decoder(m_daqmuCTPIResult->candidateMultiplicity()).getBCID(); - uint16_t roiEventNCan = MuCTPI_MultiplicityWord_Decoder(m_daqmuCTPIResult->candidateMultiplicity()).getNCandidates(); - - m_daqmuCTPIRoIs.reserve( roiEventNCan ); - m_daqmuCTPIHash_Endcap.reserve( roiEventNCan ); - m_daqmuCTPIHash_Forward.reserve( roiEventNCan ); - m_daqmuCTPIHash_Barrel.reserve( roiEventNCan ); - - unsigned int hemi; - uint32_t hash; - float sector_id_f, pad_id_f, delta_bcid_f; - for(std::vector< uint32_t >::const_iterator it = m_daqmuCTPIResult->dataWord().begin(); - it != m_daqmuCTPIResult->dataWord().end(); ++it) { - MuCTPI_DataWord_Decoder daqRoI(*it); - - // fill profile for BCID difference - if ( (m_hist_muCTPiDaq_Barrel_SectorID_Pad_DeltaBCID) && (daqRoI.getSectorLocation() == MuCTPI_RDO::BARREL) ) { - int sector_id = int(daqRoI.getSectorID()) - m_Number_Of_Barrel_Units.value() * int(daqRoI.getHemisphere()); - sector_id_f = sector_id; - delta_bcid_f = float(roiEventBCID) - float(daqRoI.getBCID()); - int pad_id =((daqRoI.getRoiNumber()/4)+1)*(2*(int) daqRoI.getHemisphere()-1); - pad_id_f = pad_id; - m_hist_muCTPiDaq_Barrel_SectorID_Pad_DeltaBCID->Fill( pad_id_f, sector_id_f, delta_bcid_f, 1.); - } - - if (roiEventBCID == daqRoI.getBCID()) { // RoI matches event BCID - // create a L1 RoI - ROIB::MuCTPIRoI roI( mirodToRoIBDataWord(*it) ); - m_daqmuCTPIRoIs.push_back(roI); - - // fill histograms and compute RoI hashes - hemi = (roI.getSectorAddress() & MuCTPI_RDO::SECTOR_HEMISPHERE_MASK); - sector_id_f = roI.getSectorID(); - if( roI.getSectorLocation() == MuCTPI_RDO::ENDCAP ) { - if (m_hist_muCTPiDaq_Endcap_SectorID[hemi]) m_hist_muCTPiDaq_Endcap_SectorID[hemi]->Fill( sector_id_f, 1.); - hash = (roI.getSectorID() + hemi * m_Number_Of_Endcap_Units.value()) + 1000*roI.getRoiNumber() ; - m_daqmuCTPIHash_Endcap.push_back(hash); - } - else if( roI.getSectorLocation() == MuCTPI_RDO::FORWARD ) { - if (m_hist_muCTPiDaq_Forward_SectorID[hemi]) m_hist_muCTPiDaq_Forward_SectorID[hemi]->Fill( sector_id_f, 1.); - hash = (roI.getSectorID() + hemi * m_Number_Of_Forward_Units.value()) + 1000*roI.getRoiNumber() ; - m_daqmuCTPIHash_Forward.push_back(hash); - } - else if( roI.getSectorLocation() == MuCTPI_RDO::BARREL ) { - int pad_id =((daqRoI.getRoiNumber()/4)+1)*(2*(int) daqRoI.getHemisphere()-1); - pad_id_f = pad_id; - if (m_hist_muCTPiDaq_Barrel_SectorID[hemi]) m_hist_muCTPiDaq_Barrel_SectorID[hemi]->Fill( sector_id_f, 1.); - if (m_hist_muCTPiDaq_Barrel_SectorID_Pad[0]) m_hist_muCTPiDaq_Barrel_SectorID_Pad[0]->Fill( pad_id_f, sector_id_f, 1.); - if (m_hist_muCTPiDaq_Barrel_SectorID_Pad[roI.pt()]) - m_hist_muCTPiDaq_Barrel_SectorID_Pad[roI.pt()]->Fill( pad_id_f, sector_id_f, 1.); - hash = (roI.getSectorID() + hemi * m_Number_Of_Barrel_Units.value()) + 1000*roI.getRoiNumber() ; - m_daqmuCTPIHash_Barrel.push_back(hash); - } - } - } // end loop over data words - - float num_daq_rois = m_daqmuCTPIRoIs.size(); - if (m_hist_NumberOfRoIs_DAQ) m_hist_NumberOfRoIs_DAQ->Fill(num_daq_rois ,1.); - - /* No MuCTPI ROB */ - } else { - if (log.level() <= MSG::DEBUG) { - log << MSG::DEBUG << " No MuCTPI ROB found." << endreq; - } - } - - // reset log stream flags to original values - log.flags(log_flags_save); -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -uint32_t TrigMuCTPiROBMonitor::mirodToRoIBDataWord( uint32_t data_word ) { - return ( ( ( data_word & 0x8000000 ) >> 4 ) | ( ( data_word & 0x3fe0000 ) >> 3 ) | - ( data_word & 0x3fff ) ); -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -void TrigMuCTPiROBMonitor::dumpRoIBDataWord( MsgStream& log, uint32_t data_word ) { - - if (log.level() <= MSG::DEBUG) { - ROIB::MuCTPIRoI roI(data_word); - - std::string loc = "UNDEFINED"; - if( roI.getSectorLocation() == MuCTPI_RDO::ENDCAP ) - loc = "ENDCAP"; - else if( roI.getSectorLocation() == MuCTPI_RDO::FORWARD ) - loc = "FORWARD"; - else if( roI.getSectorLocation() == MuCTPI_RDO::BARREL ) - loc = "BARREL"; - - log << MSG::DEBUG << "RoIB word : 0x" - << MSG::hex << roI.roIWord() << MSG::dec << endreq; - log << MSG::DEBUG << "Threshold : pt" << roI.pt() << endreq; - log << MSG::DEBUG << "Sector location : " << loc << endreq; - std::string sectorOffset(""); - if ((roI.getSectorAddress() & MuCTPI_RDO::SECTOR_HEMISPHERE_MASK) && - (roI.getSectorLocation() == MuCTPI_RDO::BARREL)) sectorOffset = " + 32 for Hemisphere = 1 "; - log << MSG::DEBUG << "Sector ID : " << roI.getSectorID() << sectorOffset << endreq; - log << MSG::DEBUG << "Sector addr : 0x" << MSG::hex - << roI.getSectorAddress() << MSG::dec << endreq; - log << MSG::DEBUG << "Sector overflow : " << roI.getSectorOverflow() << endreq; - log << MSG::DEBUG << "RoI overflow : " << roI.getRoiOverflow() << endreq; - log << MSG::DEBUG << "RoI number : " << roI.getRoiNumber() << endreq; - log << MSG::DEBUG << "IsHighestPt : " << roI.getCandidateIsHighestPt() << endreq; - log << MSG::DEBUG << "Overlap : " << roI.getOverlapBits() << endreq; - log << MSG::DEBUG << "Hemisphere : " << (roI.getSectorAddress() & MuCTPI_RDO::SECTOR_HEMISPHERE_MASK) << endreq; - log << MSG::DEBUG << "=================================================" << endreq; - } - return; -} diff --git a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/TrigROBMonitor.cxx b/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/TrigROBMonitor.cxx deleted file mode 100755 index d7fc5c532fac91a26e93d864f4eea784c795c60b..0000000000000000000000000000000000000000 --- a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/TrigROBMonitor.cxx +++ /dev/null @@ -1,525 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "TrigOnlineMonitor/TrigROBMonitor.h" -#include "GaudiKernel/AlgFactory.h" -#include "GaudiKernel/ThreadGaudi.h" -#include "GaudiKernel/ITHistSvc.h" -#include "AthenaKernel/Timeout.h" -#include "StoreGate/StoreGateSvc.h" -#include "ByteStreamCnvSvcBase/IROBDataProviderSvc.h" -#include "TrigROBDataProviderSvc/ITrigROBDataProviderSvc.h" -#include "TrigMonitorBase/TrigLockedHist.h" -#include "EventInfo/TriggerInfo.h" -#include "EventInfo/EventInfo.h" -#include "EventInfo/EventID.h" -#include "EventInfo/EventType.h" -#include "eformat/eformat.h" -#include "eformat/index.h" -#include <iostream> -#ifndef HAVE_NEW_IOSTREAMS -#include <strstream> /*gnu-specific*/ -typedef strstream __sstream; -#else -#include <sstream> -typedef std::ostringstream __sstream; -#endif -#include <iomanip> -#include <cassert> -#include <bitset> -#include <TH1F.h> -#include <TH2F.h> -#include <TProfile.h> - -///////////////////////////////////////////////////////////////////////////// - -TrigROBMonitor::TrigROBMonitor(const std::string& name, ISvcLocator* pSvcLocator) : - Algorithm(name, pSvcLocator), - m_msg(0), - m_storeGateSvc( "StoreGateSvc", name ), - m_robDataProviderSvc( "ROBDataProviderSvc", name ), - m_hist_failedChecksumForROB(0), - m_histProp_failedChecksumForROB(Gaudi::Histo1DDef("FailedChecksumForROB" ,0,1,1)), - m_hist_failedChecksumForSD(0), - m_histProp_failedChecksumForSD(Gaudi::Histo1DDef("FailedChecksumForSubDetector" ,0,60,60)), - m_hist_genericStatusForROB(0), - m_hist_specificStatusForROB(0), - m_hist_totalDataVolumeROB(0), - m_histProp_totalDataVolumeROB(Gaudi::Histo1DDef("totalDataVolumeForROBs" ,0.,5000.,50)), - m_hist_dataVolumeFractionForSD(0) -{ - // Declare the properties - declareProperty("SetDebugStream", m_setDebugStream=false); - declareProperty("DebugStreamName", m_debugStreamName="RobErrorStream"); - declareProperty("TestROBChecksum", m_doROBChecksum=true); - declareProperty("HistFailedChecksumForROB", m_histProp_failedChecksumForROB,"ROBs with inconsistent checksum"); - declareProperty("HistFailedChecksumForSD", m_histProp_failedChecksumForSD, "SDs with inconsistent checksum"); - declareProperty("TestROBStatus", m_doROBStatus=true); - declareProperty("PlotROBDataVolume", m_doROBDataVolume=true); - declareProperty("HistTotalDataVolumeROB", m_histProp_totalDataVolumeROB, "Total data volume in ROBs"); - - // fill map with generic status codes - m_map_GenericStatus[eformat::UNCLASSIFIED] = "UNCLASSIFIED"; - m_map_GenericStatus[eformat::BCID_CHECK_FAIL] = "BCID_CHECK_FAIL"; - m_map_GenericStatus[eformat::LVL1ID_CHECK_FAIL] = "LVL1ID_CHECK_FAIL"; - m_map_GenericStatus[eformat::TIMEOUT] = "TIMEOUT"; - m_map_GenericStatus[eformat::DATA_CORRUPTION] = "DATA_CORRUPTION"; - m_map_GenericStatus[eformat::INTERNAL_OVERFLOW] = "INTERNAL_OVERFLOW"; - - // fill vector with specific status codes - m_vec_SpecificStatus.reserve(16); - m_vec_SpecificStatus.push_back("TRIGGER_TYPE_SYNC_ERROR"); - m_vec_SpecificStatus.push_back("FRAGMENT_SIZE_ERROR"); - m_vec_SpecificStatus.push_back("DATABLOCK_ERROR"); - m_vec_SpecificStatus.push_back("CTRL_WORD_ERROR"); - m_vec_SpecificStatus.push_back("MISSING_BOF"); - m_vec_SpecificStatus.push_back("MISSING_EOF"); - m_vec_SpecificStatus.push_back("INVALID_HEADER_MARKER"); - m_vec_SpecificStatus.push_back("FORMAT_ERROR"); - m_vec_SpecificStatus.push_back("DUPLICATE_EVENT"); - m_vec_SpecificStatus.push_back("SEQUENCE_ERROR"); - m_vec_SpecificStatus.push_back("TRANSMISSION_ERROR"); - m_vec_SpecificStatus.push_back("TRUNCATION"); - m_vec_SpecificStatus.push_back("SHORT_FRAGMENT"); - m_vec_SpecificStatus.push_back("FRAGMENT_LOST"); - m_vec_SpecificStatus.push_back("FRAGMENT_PENDING"); - m_vec_SpecificStatus.push_back("ROL_DISABLED"); -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -StatusCode TrigROBMonitor::initialize(){ - - // Get the messaging service - MsgStream log(msgSvc(), name()); - log << MSG::INFO << "initialize()" << endreq; - - // Print out the property values - log << MSG::INFO << " Put events with ROB errors on DEBUG stream = " << m_setDebugStream << endreq; - log << MSG::INFO << " Name of used DEBUG stream = " << m_debugStreamName << endreq; - log << MSG::INFO << " Do ROB checksum test = " << m_doROBChecksum << endreq; - log << MSG::INFO << " Hist:FailedChecksumForROB = " << m_histProp_failedChecksumForROB << endreq; - log << MSG::INFO << " Hist:FailedChecksumForSD = " << m_histProp_failedChecksumForSD << endreq; - log << MSG::INFO << " Do ROB status test = " << m_doROBStatus << endreq ; - log << MSG::INFO << " Plot ROB data volumes = " << m_doROBDataVolume << endreq ; - log << MSG::INFO << " Hist:TotalDataVolumeROB = " << m_histProp_totalDataVolumeROB << endreq; - - // Locate the StoreGateSvc - StatusCode sc = m_storeGateSvc.retrieve(); - if (!sc.isSuccess()) { - log << MSG::ERROR << "Could not find StoreGateSvc" << endreq; - return sc; - } - - // Locate the ROBDataProviderSvc - sc = m_robDataProviderSvc.retrieve(); - if (!sc.isSuccess()) { - log << MSG::ERROR << "Could not find ROBDataProviderSvc" << endreq; - return sc; - } else { - // Setup the L2 ROB Data Provider Service when configured -#ifdef ATLAS_GAUDI_V21 - m_trigROBDataProviderSvc = SmartIF<ITrigROBDataProviderSvc>( &*m_robDataProviderSvc ); -#else - m_trigROBDataProviderSvc = SmartIF<ITrigROBDataProviderSvc>( IID_ITrigROBDataProviderSvc, &*m_robDataProviderSvc ); -#endif - if (m_trigROBDataProviderSvc.isValid()) { - log << MSG::DEBUG << "A ROBDataProviderSvc implementing the Level-2 interface ITrigROBDataProviderSvc was found." - << endreq; - } else { - log << MSG::DEBUG << "No ROBDataProviderSvc implementing the Level-2 interface ITrigROBDataProviderSvc was found." - << endreq; - } - } - - return StatusCode::SUCCESS; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -StatusCode TrigROBMonitor::execute() { - - if (outputLevel() <= MSG::DEBUG) logStream() << MSG::DEBUG << "execute()" << endreq; - - //-------------------------------------------------------------------------- - // check that there is still time left - //-------------------------------------------------------------------------- - if (Athena::Timeout::instance().reached()) { - logStream() << MSG::INFO << " Time out reached in entry to execute." << endreq; - return StatusCode::SUCCESS; - } - - //-------------------------------------------------------------------------- - // Loop over all ROB fragments held in the ROBDataProviderSvc and do the checks - //-------------------------------------------------------------------------- - bool event_with_checksum_failure(false); - int total_ROB_Data_Volume(0); - std::map< eformat::SubDetector, uint32_t > rob_Data_Volume_SD; - - // In L2 access directly the cache - if (m_trigROBDataProviderSvc.isValid()) { - if (outputLevel() <= MSG::DEBUG) logStream() << MSG::DEBUG - << " ===> Lvl2ROBDataProviderSvc is used : # ROB fragments = " - << m_trigROBDataProviderSvc->sizeROBCache() - << endreq; - for (std::map<uint32_t, OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment>::iterator it = m_trigROBDataProviderSvc->beginROBCache(); - it != m_trigROBDataProviderSvc->endROBCache(); ++it) { - // check for time out - if (Athena::Timeout::instance().reached()) { - logStream() << MSG::INFO << " Time out reached in loop over ROB fragments." << endreq; - return StatusCode::SUCCESS; - } - // verify checksum - if (verifyROBChecksum(logStream(), (*it).second )) event_with_checksum_failure=true ; - - // verify status bits - verifyROBStatusBits(logStream(), (*it).second ); - - // get ROB fragment sizes - total_ROB_Data_Volume += (*it).second.fragment_size_word(); - rob_Data_Volume_SD[ eformat::helper::SourceIdentifier( (*it).first ).subdetector_id() ] += (*it).second.fragment_size_word(); - } - // In EF access the full event fragment and extract the ROBs - } else if (m_robDataProviderSvc->getEvent() != 0) { - // get total fragment size - total_ROB_Data_Volume = (m_robDataProviderSvc->getEvent())->fragment_size_word(); - rob_Data_Volume_SD[ eformat::helper::SourceIdentifier((m_robDataProviderSvc->getEvent())->source_id()).subdetector_id() ] - = (m_robDataProviderSvc->getEvent())->fragment_size_word(); - - // build an index of all ROB fragments in the event - std::map<uint32_t, const uint32_t*> fullEventIndex; - eformat::helper::build_toc( *(m_robDataProviderSvc->getEvent()), fullEventIndex); - if (outputLevel() <= MSG::DEBUG) logStream() << MSG::DEBUG - << " ===> Standard ROBDataProviderSvc is used : # ROB fragments = " - << fullEventIndex.size() - << endreq; - for (std::map<uint32_t, const uint32_t*>::iterator it = fullEventIndex.begin(); - it != fullEventIndex.end(); ++it) { - // check for time out - if (Athena::Timeout::instance().reached()) { - logStream() << MSG::INFO << " Time out reached in loop over ROB fragments." << endreq; - return StatusCode::SUCCESS; - } - // verify checksum - if (verifyROBChecksum(logStream(), (*it).second )) event_with_checksum_failure=true ; - - // verify status bits - verifyROBStatusBits(logStream(), (*it).second ); - - // get ROB fragment sizes - OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment tmpROB( (*it).second ); - rob_Data_Volume_SD[ eformat::helper::SourceIdentifier( (*it).first ).subdetector_id() ] += tmpROB.fragment_size_word(); - } - } else { - logStream() << MSG::WARNING - << " No check on ROB fragments was performed, since neither the ROB cache in L2 could be accessed nor the full event could be found." - << endreq; - } - - // if the event shows errors, set the DEBUG stream tag when requested - if ((m_setDebugStream.value()) && (event_with_checksum_failure)) { - // get EventInfo - const EventInfo* p_EventInfo(0); - StatusCode sc = m_storeGateSvc->retrieve(p_EventInfo); - if(sc.isFailure()){ - logStream() << MSG::ERROR << "Can't get EventInfo object for updating the StreamTag" << endreq; - return sc; - } - - // set the stream tag - typedef std::vector< TriggerInfo::StreamTag > StreamTagVector_t; - if (p_EventInfo) { - StreamTagVector_t vecStreamTags = p_EventInfo->trigger_info()->streamTags(); - vecStreamTags.push_back( TriggerInfo::StreamTag(m_debugStreamName,"debug",false) ); - p_EventInfo->trigger_info()->setStreamTags(vecStreamTags); - } - } - - // fill data volume plots - if (m_hist_totalDataVolumeROB) { - m_hist_totalDataVolumeROB->Fill(total_ROB_Data_Volume/256,1); // convert #words to kByte - } - - if (m_hist_dataVolumeFractionForSD) { - for (std::map< eformat::SubDetector, uint32_t >::const_iterator it = rob_Data_Volume_SD.begin(); it != rob_Data_Volume_SD.end(); ++it) { - if(total_ROB_Data_Volume) - { - float ratio = ((float)(*it).second)/((float)total_ROB_Data_Volume) ; - m_hist_dataVolumeFractionForSD->Fill(eformat::helper::SourceIdentifier( (*it).first,0 ).human_detector().c_str(), ratio ,1.); - } - } - } - - return StatusCode::SUCCESS; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -StatusCode TrigROBMonitor::finalize() { - - // Get the messaging service - MsgStream log(msgSvc(), name()); - log << MSG::INFO << "finalize()" << endreq; - -#ifdef ATLAS_GAUDI_V21 - m_trigROBDataProviderSvc.reset(); -#endif - - return StatusCode::SUCCESS; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -StatusCode TrigROBMonitor::beginRun() { - - // Get a message stream instance - m_msg = new MsgStream( msgSvc(), name() ); - - logStream() << MSG::INFO << "beginRun()" << endreq; - - // Define histograms only when checks are requested - if ((not m_doROBChecksum.value()) && (not m_doROBStatus.value()) && - (not m_doROBDataVolume.value())) return StatusCode::SUCCESS; - - // find histogramming service - ServiceHandle<ITHistSvc> rootHistSvc("THistSvc", name()); - if ((rootHistSvc.retrieve()).isFailure()) { - logStream() << MSG::ERROR << "Unable to locate THistSvc" << endreq; - rootHistSvc.release().ignore(); - return StatusCode::FAILURE; - } - - // *-- booking path - std::string path = std::string("/EXPERT/")+getGaudiThreadGenericName(name())+"/"; - - // *-- number of bins for sub detector plots (55 SubDet max.) - uint32_t n_bins_partEBSubDet = 55 ; - - if ( m_doROBChecksum.value() ) { - // *-- ROBs with failed checksum - m_hist_failedChecksumForROB = new TH1F (m_histProp_failedChecksumForROB.value().title().c_str(), - (m_histProp_failedChecksumForROB.value().title()+";ROB id").c_str(), - m_histProp_failedChecksumForROB.value().bins(), - m_histProp_failedChecksumForROB.value().lowEdge(), - m_histProp_failedChecksumForROB.value().highEdge()); - if (m_hist_failedChecksumForROB) { - m_hist_failedChecksumForROB->SetBit(TH1::kCanRebin); - if( rootHistSvc->regHist(path + m_hist_failedChecksumForROB->GetName(), m_hist_failedChecksumForROB).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_failedChecksumForROB->GetName() << endreq; - } - } - - // *-- Sub detectors with ROBs with failed checksum - m_hist_failedChecksumForSD = new TH1F (m_histProp_failedChecksumForSD.value().title().c_str(), - (m_histProp_failedChecksumForSD.value().title()+";SD id").c_str(), - m_histProp_failedChecksumForSD.value().bins(), - m_histProp_failedChecksumForSD.value().lowEdge(), - m_histProp_failedChecksumForSD.value().highEdge()); - if (m_hist_failedChecksumForSD) { - uint32_t n_tmp_bin = 1; - for (uint16_t i=0; i<256; i++) { - eformat::helper::SourceIdentifier tmpsrc( (eformat::SubDetector) i,0); - if ((tmpsrc.human_detector() != "UNKNOWN") && (n_tmp_bin <= (uint32_t) m_histProp_failedChecksumForSD.value().bins())) { - m_hist_failedChecksumForSD->GetXaxis()->SetBinLabel( n_tmp_bin, tmpsrc.human_detector().c_str() ); - n_tmp_bin++; - } - } - - if( rootHistSvc->regHist(path + m_hist_failedChecksumForSD->GetName(), m_hist_failedChecksumForSD).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_failedChecksumForSD->GetName() << endreq; - } - } - } - - if ( m_doROBStatus.value() ) { - // *-- Generic Status for ROBs per sub detector - m_hist_genericStatusForROB = new TH2F ("GenericStatusForROBsFromSubDetectors", - "GenericStatusForROBsFromSubDetectors;;", - n_bins_partEBSubDet,0.,(float) n_bins_partEBSubDet, - m_map_GenericStatus.size(),0., (float) m_map_GenericStatus.size()); - if (m_hist_genericStatusForROB) { - uint32_t n_tmp_bin = 1; - for (uint16_t i=0; i<256; i++) { - eformat::helper::SourceIdentifier tmpsrc( (eformat::SubDetector) i,0); - if ((tmpsrc.human_detector() != "UNKNOWN") && (n_tmp_bin <= n_bins_partEBSubDet)) { - m_hist_genericStatusForROB->GetXaxis()->SetBinLabel( n_tmp_bin, tmpsrc.human_detector().c_str() ); - n_tmp_bin++; - } - } - - n_tmp_bin = 1; - for (std::map<eformat::GenericStatus, std::string>::const_iterator it = m_map_GenericStatus.begin();it != m_map_GenericStatus.end();++it) { - m_hist_genericStatusForROB->GetYaxis()->SetBinLabel( n_tmp_bin, (*it).second.c_str() ); - n_tmp_bin++; - } - - if( rootHistSvc->regHist(path + m_hist_genericStatusForROB->GetName(), m_hist_genericStatusForROB).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_genericStatusForROB->GetName() << endreq; - } - } - - // *-- Specific Status Bits for ROBs per sub detector - m_hist_specificStatusForROB = new TH2F ("SpecificStatusBitsForROBsFromSubDetectors", - "SpecificStatusBitsForROBsFromSubDetectors;;", - n_bins_partEBSubDet,0.,(float) n_bins_partEBSubDet, - m_vec_SpecificStatus.size(),0., (float) m_vec_SpecificStatus.size()); - if (m_hist_specificStatusForROB) { - uint32_t n_tmp_bin = 1; - for (uint16_t i=0; i<256; i++) { - eformat::helper::SourceIdentifier tmpsrc( (eformat::SubDetector) i,0); - if ((tmpsrc.human_detector() != "UNKNOWN") && (n_tmp_bin <= n_bins_partEBSubDet)) { - m_hist_specificStatusForROB->GetXaxis()->SetBinLabel( n_tmp_bin, tmpsrc.human_detector().c_str() ); - n_tmp_bin++; - } - } - - n_tmp_bin = 1; - for (std::vector<std::string>::const_iterator it = m_vec_SpecificStatus.begin();it != m_vec_SpecificStatus.end();++it) { - m_hist_specificStatusForROB->GetYaxis()->SetBinLabel( n_tmp_bin, (*it).c_str() ); - n_tmp_bin++; - } - - if( rootHistSvc->regHist(path + m_hist_specificStatusForROB->GetName(), m_hist_specificStatusForROB).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_specificStatusForROB->GetName() << endreq; - } - } - } - - if ( m_doROBDataVolume.value() ) { - // *-- Total data volume retrieved in ROBs - m_hist_totalDataVolumeROB = new TH1F (m_histProp_totalDataVolumeROB.value().title().c_str(), - (m_histProp_totalDataVolumeROB.value().title()+";kBytes").c_str(), - m_histProp_totalDataVolumeROB.value().bins(), - m_histProp_totalDataVolumeROB.value().lowEdge(), - m_histProp_totalDataVolumeROB.value().highEdge()); - if (m_hist_totalDataVolumeROB) { - m_hist_totalDataVolumeROB->SetBit(TH1::kCanRebin); - if( rootHistSvc->regHist(path + m_hist_totalDataVolumeROB->GetName(), m_hist_totalDataVolumeROB).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_totalDataVolumeROB->GetName() << endreq; - } - } - - // *-- Data volume fraction per sub detector - m_hist_dataVolumeFractionForSD = new TProfile("DataVolumeFractionForSD", - "Fraction of data volume per SD;;Fraction of total Volume", - n_bins_partEBSubDet,0.,(float) n_bins_partEBSubDet,0.,1.); - if (m_hist_dataVolumeFractionForSD) { - uint32_t n_tmp_bin = 1; - for (uint16_t i=0; i<256; i++) { - eformat::helper::SourceIdentifier tmpsrc( (eformat::SubDetector) i,0); - if ((tmpsrc.human_detector() != "UNKNOWN") && (n_tmp_bin <= n_bins_partEBSubDet)) { - m_hist_dataVolumeFractionForSD->GetXaxis()->SetBinLabel( n_tmp_bin, tmpsrc.human_detector().c_str() ); - n_tmp_bin++; - } - } - - if( rootHistSvc->regHist(path + m_hist_dataVolumeFractionForSD->GetName(), m_hist_dataVolumeFractionForSD).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_dataVolumeFractionForSD->GetName() << endreq; - } - } - } // end m_doROBDataVolume.value() - - // release histogramming service - rootHistSvc.release().ignore(); - - return StatusCode::SUCCESS; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -StatusCode TrigROBMonitor::endRun() { - - logStream() << MSG::INFO << "endRun()" << endreq; - - // delete message stream - if ( m_msg ) delete m_msg; - - return StatusCode::SUCCESS; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -bool TrigROBMonitor::verifyROBChecksum(MsgStream& log, OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment robFrag) { - - bool failed_checksum(false); - OFFLINE_FRAGMENTS_NAMESPACE::PointerType it(0); - uint32_t current_value(0); - - // print check for received ROB - if (log.level() <= MSG::VERBOSE) { - robFrag.payload(it); - current_value = eformat::helper::checksum(robFrag.checksum_type(), it, robFrag.payload_size_word()); - - log << MSG::VERBOSE - << " ROB id = 0x" << std::setw(6) << MSG::hex << robFrag.source_id() << MSG::dec - << " checksum: type = " << std::setw(2) << robFrag.checksum_type() - << " value = " << std::setw(12) << robFrag.checksum_value() - << " value (recalculated) = " << std::setw(12) << current_value - << " check = " << std::setw(2) << robFrag.checksum() - << endreq; - } - - // checksum test failed - if ( not robFrag.checksum() ) { - failed_checksum = true; - - // recalculate checksum value - robFrag.payload(it); - current_value = eformat::helper::checksum(robFrag.checksum_type(), it, robFrag.payload_size_word()); - - // print warning - log << MSG::WARNING - << " ROB checksum verification failed." - << " ROB id = 0x" << std::setw(6) << MSG::hex << robFrag.source_id() << MSG::dec - << " checksum type = " << std::setw(2) << robFrag.checksum_type() - << " value = " << std::setw(12) << robFrag.checksum_value() - << " value (recalculated) = " << std::setw(12) << current_value - << " check = " << std::setw(2) << robFrag.checksum() - << endreq; - - // fill the histograms - std::ostringstream ost; - ost << "0x" << std::hex << robFrag.source_id(); - if (m_hist_failedChecksumForROB) { - scoped_lock_histogram lock; - m_hist_failedChecksumForROB->Fill((ost.str()).c_str(), 1.); - m_hist_failedChecksumForROB->LabelsDeflate("X"); - } - - if (m_hist_failedChecksumForSD) m_hist_failedChecksumForSD->Fill(eformat::helper::SourceIdentifier(robFrag.source_id()).human_detector().c_str(),1.); - } - - return failed_checksum; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -void TrigROBMonitor::verifyROBStatusBits(MsgStream& log, OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment robFrag) { - - // print check for received ROB - if (log.level() <= MSG::VERBOSE) { - log << MSG::VERBOSE - << " verifyROBStatusBits: ROB id = 0x" << std::setw(6) << MSG::hex << robFrag.source_id() << MSG::dec - << endreq; - } - - // fill monitoring histogram for ROB generic status - if ( ( m_hist_genericStatusForROB ) && ( robFrag.nstatus() != 0 ) ) { - const uint32_t* it_status; - robFrag.status(it_status); - if ((*it_status) != 0) m_hist_genericStatusForROB->Fill(eformat::helper::SourceIdentifier(robFrag.source_id()).human_detector().c_str(), - m_map_GenericStatus[eformat::helper::Status(*it_status).generic()].c_str(),1.); - } - - // fill monitoring histogram for ROB specific status - if ( ( m_hist_specificStatusForROB ) && ( robFrag.nstatus() != 0 ) ) { - const uint32_t* it_status; - robFrag.status(it_status); - if ((*it_status) != 0) { - std::bitset<16> specificBits(eformat::helper::Status(*it_status).specific()); - for (unsigned int index=0; index < 16; ++index) { - if (specificBits[index]) m_hist_specificStatusForROB->Fill(eformat::helper::SourceIdentifier(robFrag.source_id()).human_detector().c_str(), - m_vec_SpecificStatus[index].c_str(),1.); - } - } - } -} diff --git a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/components/TrigOnlineMonitor_entries.cxx b/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/components/TrigOnlineMonitor_entries.cxx deleted file mode 100644 index 45c2a3429d14eb1bddd537c2157b06341607c215..0000000000000000000000000000000000000000 --- a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/components/TrigOnlineMonitor_entries.cxx +++ /dev/null @@ -1,14 +0,0 @@ -#include "GaudiKernel/DeclareFactoryEntries.h" -#include "TrigOnlineMonitor/TrigROBMonitor.h" -#include "TrigOnlineMonitor/TrigMuCTPiROBMonitor.h" -#include "src/TrigL1TopoROBMonitor.h" - -DECLARE_ALGORITHM_FACTORY( TrigROBMonitor ) -DECLARE_ALGORITHM_FACTORY( TrigMuCTPiROBMonitor ) -DECLARE_ALGORITHM_FACTORY( TrigL1TopoROBMonitor ) - -DECLARE_FACTORY_ENTRIES(TrigOnlineMonitor) { - DECLARE_ALGORITHM( TrigROBMonitor ) - DECLARE_ALGORITHM( TrigMuCTPiROBMonitor ) - DECLARE_ALGORITHM( TrigL1TopoROBMonitor ) -} diff --git a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/components/TrigOnlineMonitor_load.cxx b/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/components/TrigOnlineMonitor_load.cxx deleted file mode 100644 index 1ba3f653356808e0ce14c9332a092b86c2604b8c..0000000000000000000000000000000000000000 --- a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/components/TrigOnlineMonitor_load.cxx +++ /dev/null @@ -1,3 +0,0 @@ -#include "GaudiKernel/LoadFactoryEntries.h" - -LOAD_FACTORY_ENTRIES(TrigOnlineMonitor)