ATLAS Offline Software
L1TopoOnlineMonitor.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef L1TOPOONLINEMONITORING_L1TopoOnlineMonitor_h
6 #define L1TOPOONLINEMONITORING_L1TopoOnlineMonitor_h
7 
8 // Trigger includes
12 #include "TrigT1Result/CTP_RDO.h"
13 #include "TrigConfData/L1Menu.h"
14 
15 
16 // Athena includes
21 
22 #include "GaudiKernel/LockedHandle.h"
23 
24 // System includes
25 #include <bitset>
26 #include <optional>
27 
38 public:
39  L1TopoOnlineMonitor(const std::string& name, ISvcLocator* svcLoc);
40 
41  // ------------------------- AthReentrantAlgorithm methods -------------------
42  virtual StatusCode initialize() override;
43  virtual StatusCode start() override;
44  virtual StatusCode fillHistograms( const EventContext& ctx ) const override;
45 
46 private:
47  // ------------------------- Private types and constants ---------------------
49  static constexpr size_t s_nTopoCTPOutputs{128};
50 
52  struct DecisionBits {
53  std::optional<std::bitset<s_nTopoCTPOutputs>> triggerBits;
54  std::optional<std::bitset<s_nTopoCTPOutputs>> overflowBits;
55  std::optional<std::bitset<s_nTopoCTPOutputs>> triggerBitsSim;
56  std::optional<std::bitset<s_nTopoCTPOutputs>> overflowBitsSim;
57  std::optional<std::bitset<s_nTopoCTPOutputs>> ambiguityBitsSim;
58  std::optional<std::bitset<s_nTopoCTPOutputs>> triggerBitsCtp;
60  static std::bitset<s_nTopoCTPOutputs>& createBits(std::optional<std::bitset<s_nTopoCTPOutputs>>& opt) {
61  opt = std::bitset<s_nTopoCTPOutputs>{};
62  return opt.value();
63  }
64  };
65 
66  std::unique_ptr<float[]> m_rateHdwNotSim;
67  std::unique_ptr<float[]> m_rateSimNotHdw;
68  std::unique_ptr<float[]> m_rateHdwAndSim;
69  std::unique_ptr<float[]> m_rateHdwSim;
70  std::unique_ptr<float[]> m_countHdwNotSim;
71  std::unique_ptr<float[]> m_countSimNotHdw;
72  std::unique_ptr<float[]> m_countHdwSim;
73  std::unique_ptr<float[]> m_countHdw;
74  std::unique_ptr<float[]> m_countSim;
75  std::unique_ptr<float[]> m_countAny;
76  std::unique_ptr<float[]> m_overflow_rateHdwNotSim;
77  std::unique_ptr<float[]> m_overflow_rateSimNotHdw;
78  std::unique_ptr<float[]> m_overflow_rateHdwAndSim;
79  std::unique_ptr<float[]> m_overflow_rateHdwSim;
80  std::unique_ptr<float[]> m_overflow_countHdwNotSim;
81  std::unique_ptr<float[]> m_overflow_countSimNotHdw;
82  std::unique_ptr<float[]> m_overflow_countHdwSim;
83  std::unique_ptr<float[]> m_overflow_countHdw;
84  std::unique_ptr<float[]> m_overflow_countSim;
85  std::unique_ptr<float[]> m_overflow_countAny;
86 
87  std::vector<unsigned> m_ctpIds;
88 
89  std::vector<std::vector<std::pair<unsigned,unsigned>>> m_startbit;
90 
91  //RateVars m_rateVars{};
92  // ------------------------- Properties and handles --------------------------
93  ToolHandle<GenericMonitoringTool> m_monTool {
94  this, "MonTool", "" ,
95  "Monitoring tool to create online histograms"};
97  this, "ErrorFlagsKey", "L1TopoErrorFlags",
98  "Key of the output TrigCompositeContainer with L1Topo error flags"};
99  Gaudi::Property<bool> m_doSimMon {
100  this, "doSimMon", true, "Enable L1Topo simulation decision monitoring"};
101  Gaudi::Property<bool> m_doHwMonCTP {
102  this, "doHwMonCTP", true, "Enable L1Topo HW readout from CTP"};
103  Gaudi::Property<bool> m_doHwMon {
104  this, "doHwMon", true, "Enable L1Topo HW readout from RAW"};
105  Gaudi::Property<bool> m_doHwErrorMon {
106  this, "doHwErrorMon", false, "Enable L1Topo HW Error monitoring"};
107  Gaudi::Property<bool> m_doComp {
108  this, "doComp", true, "Enable L1Topo HW/Sim comparison"};
109  Gaudi::Property<bool> m_doMultComp {
110  this, "doMultComp", false, "Enable L1Topo Multiplicity HW/Sim comparison"};
111  Gaudi::Property<bool> m_forceCTPasHdw {
112  this, "forceCTPasHdw", false, "Force to CTP monitoring as primary in Sim/Hdw comparison"};
113 
114  ServiceHandle<StoreGateSvc> m_detStore { this, "DetectorStore", "StoreGateSvc/DetectorStore", "Detector store to get the menu" };
115 
116 
118  this, "L1_TopoKey", "L1_TopoSimResults", "l1topo EDM"};
119 
121  this, "L1_TopoRawDataKey", "L1_Phase1L1TopoRAWData", "l1topo Raw Data"};
122 
123 
125  this, "CTPRDOLocation", LVL1CTP::DEFAULT_RDOOutputLocation,
126  "Key of the CTP RDO object"};
127 
128  // ------------------------- Private methods ---------------------------------
129 
131  StatusCode doSimMon(DecisionBits& decisionBits, std::vector<std::vector<unsigned>> &multWeights, const EventContext& ctx) const;
132 
134  StatusCode doHwMonCTP(DecisionBits& decisionBits, const EventContext& ctx) const;
135 
137  StatusCode doHwMon(DecisionBits& decisionBits, std::vector<std::vector<unsigned>> &multWeights, const EventContext& ctx) const;
138 
140  StatusCode doComp(DecisionBits& decisionBits) const;
141 
143  StatusCode doMultComp(std::vector<std::vector<unsigned>> &multWeightsSim, std::vector<std::vector<unsigned>> &multWeightsHdw) const;
144 
146  std::vector<unsigned> getCtpIds(const TrigConf::L1Menu& l1menu);
147 
148  std::vector<std::vector<std::pair<unsigned,unsigned>>> getStartBits(const TrigConf::L1Menu& l1menu);
149 
150  // Define and set all error flags to false (Now only TrivialFlag set to true)
151  void resetFlags(xAOD::TrigComposite& errorFlags) const;
152 
153 };
154 
155 #endif // L1TOPOONLINEMONITORING_L1TopoOnlineMonitor_h
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
L1TopoOnlineMonitor::m_l1topoKey
SG::ReadHandleKey< xAOD::L1TopoSimResultsContainer > m_l1topoKey
Definition: L1TopoOnlineMonitor.h:117
L1TopoOnlineMonitor::doHwMonCTP
StatusCode doHwMonCTP(DecisionBits &decisionBits, const EventContext &ctx) const
Monitor the Hw bits from CTP.
Definition: L1TopoOnlineMonitor.cxx:275
L1TopoOnlineMonitor::m_overflow_rateHdwNotSim
std::unique_ptr< float[]> m_overflow_rateHdwNotSim
Definition: L1TopoOnlineMonitor.h:76
L1TopoOnlineMonitor::DecisionBits::overflowBits
std::optional< std::bitset< s_nTopoCTPOutputs > > overflowBits
Definition: L1TopoOnlineMonitor.h:54
L1TopoOnlineMonitor::m_countSimNotHdw
std::unique_ptr< float[]> m_countSimNotHdw
Definition: L1TopoOnlineMonitor.h:71
L1TopoOnlineMonitor::DecisionBits::createBits
static std::bitset< s_nTopoCTPOutputs > & createBits(std::optional< std::bitset< s_nTopoCTPOutputs >> &opt)
Helper method to create a new bitset and get a reference to it.
Definition: L1TopoOnlineMonitor.h:60
L1TopoOnlineMonitor::m_doHwMonCTP
Gaudi::Property< bool > m_doHwMonCTP
Definition: L1TopoOnlineMonitor.h:101
L1TopoOnlineMonitor::getStartBits
std::vector< std::vector< std::pair< unsigned, unsigned > > > getStartBits(const TrigConf::L1Menu &l1menu)
Definition: L1TopoOnlineMonitor.cxx:631
L1TopoOnlineMonitor::start
virtual StatusCode start() override
Definition: L1TopoOnlineMonitor.cxx:100
make_coralServer_rep.opt
opt
Definition: make_coralServer_rep.py:19
L1TopoOnlineMonitor::resetFlags
void resetFlags(xAOD::TrigComposite &errorFlags) const
Definition: L1TopoOnlineMonitor.cxx:687
L1TopoOnlineMonitor::m_doHwErrorMon
Gaudi::Property< bool > m_doHwErrorMon
Definition: L1TopoOnlineMonitor.h:105
L1TopoOnlineMonitor::m_overflow_countHdwNotSim
std::unique_ptr< float[]> m_overflow_countHdwNotSim
Definition: L1TopoOnlineMonitor.h:80
L1TopoOnlineMonitor::m_doSimMon
Gaudi::Property< bool > m_doSimMon
Definition: L1TopoOnlineMonitor.h:99
L1TopoOnlineMonitor::m_startbit
std::vector< std::vector< std::pair< unsigned, unsigned > > > m_startbit
Definition: L1TopoOnlineMonitor.h:89
TrigConf::L1Menu
L1 menu configuration.
Definition: L1Menu.h:28
SG::ReadHandleKey
Property holding a SG store/key/clid from which a ReadHandle is made.
Definition: StoreGate/StoreGate/ReadHandleKey.h:39
L1TopoOnlineMonitor::m_overflow_countHdwSim
std::unique_ptr< float[]> m_overflow_countHdwSim
Definition: L1TopoOnlineMonitor.h:82
L1TopoOnlineMonitor::m_countSim
std::unique_ptr< float[]> m_countSim
Definition: L1TopoOnlineMonitor.h:74
TrigT1StoreGateKeys.h
L1TopoOnlineMonitor::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition: L1TopoOnlineMonitor.h:93
L1TopoOnlineMonitor::m_overflow_countHdw
std::unique_ptr< float[]> m_overflow_countHdw
Definition: L1TopoOnlineMonitor.h:83
L1TopoOnlineMonitor::initialize
virtual StatusCode initialize() override
initialize
Definition: L1TopoOnlineMonitor.cxx:45
AthMonitorAlgorithm
Base class for Athena Monitoring Algorithms.
Definition: AthMonitorAlgorithm.h:36
L1TopoOnlineMonitor::DecisionBits::triggerBits
std::optional< std::bitset< s_nTopoCTPOutputs > > triggerBits
Definition: L1TopoOnlineMonitor.h:53
L1TopoOnlineMonitor::m_rateHdwSim
std::unique_ptr< float[]> m_rateHdwSim
Definition: L1TopoOnlineMonitor.h:69
L1TopoRawDataContainer.h
L1TopoOnlineMonitor
Algorithm to monitor L1Topo transmission and simulation errors for the (Run-3) L1Topo boards.
Definition: L1TopoOnlineMonitor.h:37
L1TopoOnlineMonitor::m_rateHdwAndSim
std::unique_ptr< float[]> m_rateHdwAndSim
Definition: L1TopoOnlineMonitor.h:68
SG::WriteHandleKey
Property holding a SG store/key/clid from which a WriteHandle is made.
Definition: StoreGate/StoreGate/WriteHandleKey.h:40
L1TopoOnlineMonitor::m_countAny
std::unique_ptr< float[]> m_countAny
Definition: L1TopoOnlineMonitor.h:75
L1TopoOnlineMonitor::m_ctpIds
std::vector< unsigned > m_ctpIds
Definition: L1TopoOnlineMonitor.h:87
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
L1TopoOnlineMonitor::m_rateSimNotHdw
std::unique_ptr< float[]> m_rateSimNotHdw
Definition: L1TopoOnlineMonitor.h:67
AthMonitorAlgorithm.h
L1TopoOnlineMonitor::s_nTopoCTPOutputs
static constexpr size_t s_nTopoCTPOutputs
Number of CTP outputs, used for histogram ranges and loops.
Definition: L1TopoOnlineMonitor.h:49
L1TopoOnlineMonitor::m_overflow_rateSimNotHdw
std::unique_ptr< float[]> m_overflow_rateSimNotHdw
Definition: L1TopoOnlineMonitor.h:77
L1TopoOnlineMonitor::DecisionBits::triggerBitsSim
std::optional< std::bitset< s_nTopoCTPOutputs > > triggerBitsSim
Definition: L1TopoOnlineMonitor.h:55
L1TopoOnlineMonitor::doHwMon
StatusCode doHwMon(DecisionBits &decisionBits, std::vector< std::vector< unsigned >> &multWeights, const EventContext &ctx) const
Monitor the Hw bits from RAW data.
Definition: L1TopoOnlineMonitor.cxx:316
L1TopoOnlineMonitor::m_doMultComp
Gaudi::Property< bool > m_doMultComp
Definition: L1TopoOnlineMonitor.h:109
L1TopoOnlineMonitor::m_rateHdwNotSim
std::unique_ptr< float[]> m_rateHdwNotSim
Definition: L1TopoOnlineMonitor.h:66
L1TopoOnlineMonitor::doSimMon
StatusCode doSimMon(DecisionBits &decisionBits, std::vector< std::vector< unsigned >> &multWeights, const EventContext &ctx) const
Monitor the simulated bits.
Definition: L1TopoOnlineMonitor.cxx:181
L1TopoOnlineMonitor::m_countHdwNotSim
std::unique_ptr< float[]> m_countHdwNotSim
Definition: L1TopoOnlineMonitor.h:70
L1TopoOnlineMonitor::m_detStore
ServiceHandle< StoreGateSvc > m_detStore
Definition: L1TopoOnlineMonitor.h:114
xAOD::TrigComposite_v1
Class used to describe composite objects in the HLT.
Definition: TrigComposite_v1.h:52
Monitored.h
Header file to be included by clients of the Monitored infrastructure.
WriteHandleKey.h
Property holding a SG store/key/clid from which a WriteHandle is made.
L1TopoOnlineMonitor::m_overflow_countSim
std::unique_ptr< float[]> m_overflow_countSim
Definition: L1TopoOnlineMonitor.h:84
L1TopoOnlineMonitor::m_overflow_countSimNotHdw
std::unique_ptr< float[]> m_overflow_countSimNotHdw
Definition: L1TopoOnlineMonitor.h:81
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
L1TopoOnlineMonitor::fillHistograms
virtual StatusCode fillHistograms(const EventContext &ctx) const override
adds event to the monitoring histograms
Definition: L1TopoOnlineMonitor.cxx:113
L1TopoOnlineMonitor::m_overflow_rateHdwAndSim
std::unique_ptr< float[]> m_overflow_rateHdwAndSim
Definition: L1TopoOnlineMonitor.h:78
L1TopoOnlineMonitor::DecisionBits::ambiguityBitsSim
std::optional< std::bitset< s_nTopoCTPOutputs > > ambiguityBitsSim
Definition: L1TopoOnlineMonitor.h:57
L1TopoOnlineMonitor::m_forceCTPasHdw
Gaudi::Property< bool > m_forceCTPasHdw
Definition: L1TopoOnlineMonitor.h:111
L1TopoOnlineMonitor::DecisionBits
Helper structure holding decision bitsets, passed between the monitoring methods.
Definition: L1TopoOnlineMonitor.h:52
L1TopoOnlineMonitor::m_doComp
Gaudi::Property< bool > m_doComp
Definition: L1TopoOnlineMonitor.h:107
CTP_RDO.h
L1TopoOnlineMonitor::DecisionBits::overflowBitsSim
std::optional< std::bitset< s_nTopoCTPOutputs > > overflowBitsSim
Definition: L1TopoOnlineMonitor.h:56
L1TopoOnlineMonitor::doMultComp
StatusCode doMultComp(std::vector< std::vector< unsigned >> &multWeightsSim, std::vector< std::vector< unsigned >> &multWeightsHdw) const
Compare hardware and simulation for the multiplicity algorithms.
Definition: L1TopoOnlineMonitor.cxx:607
L1TopoOnlineMonitor::m_overflow_countAny
std::unique_ptr< float[]> m_overflow_countAny
Definition: L1TopoOnlineMonitor.h:85
python.XMLReader.l1menu
l1menu
Definition: XMLReader.py:73
L1TopoOnlineMonitor::L1TopoOnlineMonitor
L1TopoOnlineMonitor(const std::string &name, ISvcLocator *svcLoc)
Definition: L1TopoOnlineMonitor.cxx:37
L1TopoOnlineMonitor::DecisionBits::triggerBitsCtp
std::optional< std::bitset< s_nTopoCTPOutputs > > triggerBitsCtp
Definition: L1TopoOnlineMonitor.h:58
L1TopoOnlineMonitor::getCtpIds
std::vector< unsigned > getCtpIds(const TrigConf::L1Menu &l1menu)
Get CTP ids from menu.
Definition: L1TopoOnlineMonitor.cxx:649
L1Menu.h
L1TopoOnlineMonitor::m_ctpRdoKey
SG::ReadHandleKey< CTP_RDO > m_ctpRdoKey
Definition: L1TopoOnlineMonitor.h:124
L1TopoOnlineMonitor::m_l1topoRawDataKey
SG::ReadHandleKey< xAOD::L1TopoRawDataContainer > m_l1topoRawDataKey
Definition: L1TopoOnlineMonitor.h:120
L1TopoOnlineMonitor::doComp
StatusCode doComp(DecisionBits &decisionBits) const
Compare hardware and simulation.
Definition: L1TopoOnlineMonitor.cxx:474
L1TopoOnlineMonitor::m_countHdw
std::unique_ptr< float[]> m_countHdw
Definition: L1TopoOnlineMonitor.h:73
L1TopoOnlineMonitor::m_doHwMon
Gaudi::Property< bool > m_doHwMon
Definition: L1TopoOnlineMonitor.h:103
L1TopoSimResultsContainer.h
L1TopoOnlineMonitor::m_countHdwSim
std::unique_ptr< float[]> m_countHdwSim
Definition: L1TopoOnlineMonitor.h:72
L1TopoOnlineMonitor::m_overflow_rateHdwSim
std::unique_ptr< float[]> m_overflow_rateHdwSim
Definition: L1TopoOnlineMonitor.h:79
ServiceHandle< StoreGateSvc >
L1TopoOnlineMonitor::m_errorFlagsKey
SG::WriteHandleKey< xAOD::TrigCompositeContainer > m_errorFlagsKey
Definition: L1TopoOnlineMonitor.h:96