Skip to content
Snippets Groups Projects
Commit b105ae3a authored by Graeme Stewart's avatar Graeme Stewart
Browse files

HLT/Trigger/TrigMonitoring/TrigOnlineMonitor deleted from 20.1.4

parent ca033ed2
No related branches found
No related tags found
No related merge requests found
Showing
with 0 additions and 2795 deletions
/*
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 );
};
/*
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);
};
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"
#**************************************************************
#
# 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
#
#**************************************************************
#**************************************************************
#
# 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
#
#**************************************************************
#**************************************************************
#
# 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
#
#**************************************************************
/*
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();
declareProperty("L1TopoDAQROBIDs", m_vDAQROBIDs = {0x00910000, 0x00910010, 0x00910020}, "L1TOPO DAQ ROB IDs");
declareProperty("L1TopoROIROBIDs", m_vROIROBIDs = {0x00910081, 0x00910082, 0x00910091, 0x00910092, 0x009100a1, 0x009100a2}, "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() );
break;
}
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;
}
/*
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
This diff is collapsed.
#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 )
}
#include "GaudiKernel/LoadFactoryEntries.h"
LOAD_FACTORY_ENTRIES(TrigOnlineMonitor)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment