ATLAS Offline Software
Loading...
Searching...
No Matches
OverviewMonitorAlgorithm.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7OverviewMonitorAlgorithm::OverviewMonitorAlgorithm( const std::string& name, ISvcLocator* pSvcLocator )
8 : AthMonitorAlgorithm(name,pSvcLocator)
9{
10}
11
13
14 ATH_MSG_DEBUG("OverviewMonitorAlgorith::initialize");
15 ATH_MSG_DEBUG("Package Name "<< m_packageName);
16
17 ATH_CHECK(m_ppmErrorLocation.initialize());
21
22
24}
25
26StatusCode OverviewMonitorAlgorithm::fillHistograms( const EventContext& ctx ) const {
27
28 ATH_MSG_DEBUG("OverviewMonitorAlgorithm::fillHistograms");
29
30 std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>> variables;
31
32
33 // Update Global overview plot
34
35 const int ppmCrates = 8;
36 const int cpmCrates = 4;
37
38 Monitored::Scalar<int> globalOverviewX = Monitored::Scalar<int>("globalOverviewX", 0);
39 Monitored::Scalar<int> globalOverviewY = Monitored::Scalar<int>("globalOverviewY", 0);
40
41 int err_per_LB=0;
42
43
44 // PPM data
45 {
46 const auto* errTES = SG::get(m_ppmErrorLocation, ctx);
47 if (!errTES || errTES->size() != size_t(ppmCrates)) {
48 ATH_MSG_INFO("No PPM error vector of expected size");
49 } else {
50 for (int crate = 0; crate < ppmCrates; ++crate) {
51 const int err = (*errTES)[crate];
52 if (err == 0)
53 continue;
54 globalOverviewY=crate;
55 if ((err >> DataStatus) & 0x1) {
56 globalOverviewX=DataStatus;
57 fill(m_packageName,globalOverviewX,globalOverviewY);
58 err_per_LB+=1;
59 }
60 if ((err >> DataError) & 0x1) {
61 globalOverviewX=DataError;
62 fill(m_packageName,globalOverviewX,globalOverviewY);
63 err_per_LB+=1;
64
65 }
66 if ((err >> PPMSubStatus) & 0x1) {
67 globalOverviewX=PPMSubStatus;
68 globalOverviewY=crate;
69 fill(m_packageName,globalOverviewX,globalOverviewY);
70 err_per_LB+=1;
71 }
72 }
73 }
74 }
75
76
77
78 // CPM and CPM CMX Error data
79 if(!m_cpmErrorLocation.empty()) {
80 const auto* errTES = SG::get(m_cpmErrorLocation, ctx);
81
82 if (!errTES || errTES->size() != size_t(cpmCrates)) {
83 ATH_MSG_INFO("No CPM error vector of expected size");
84 } else {
85 for (int crate = 0; crate < cpmCrates; ++crate) {
86 const int err = (*errTES)[crate];
87 if (err == 0)
88 continue;
89 const int cr = crate + ppmCrates;
90
91 if ((err >> CPMStatus) & 0x1){
92 globalOverviewX=SubStatus;
93 globalOverviewY=cr;
94 fill(m_packageName,globalOverviewX,globalOverviewY);
95 err_per_LB+=1;
96 }
97 if (((err >> CPMEMParity) & 0x1) || ((err >> CPMHadParity) & 0x1)) {
98 globalOverviewX=Parity;
99 globalOverviewY=cr;
100 fill(m_packageName,globalOverviewX,globalOverviewY);
101 err_per_LB+=1;
102 }
103 if (((err >> CPMEMLink) & 0x1) || ((err >> CPMHadLink) & 0x1)) {
104 globalOverviewX=LinkDown;
105 globalOverviewY=cr;
106 fill(m_packageName,globalOverviewX,globalOverviewY);
107 err_per_LB+=1;
108 }
109 if ((err >> CMXCPTobParity) & 0x1) {
110 globalOverviewX=GbCMXParity;
111 globalOverviewY=cr;
112 fill(m_packageName,globalOverviewX,globalOverviewY);
113 err_per_LB+=1;
114 }
115 if ((err >> CMXCPSumParity) & 0x1) {
116 globalOverviewX=GbCMXParity;
117 globalOverviewY=cr;
118 fill(m_packageName,globalOverviewX,globalOverviewY);
119 err_per_LB+=1;
120 }
121 if ((err >> CMXCPStatus) & 0x1) {
122 globalOverviewX=CMXSubStatus;
123 globalOverviewY=cr;
124 fill(m_packageName,globalOverviewX,globalOverviewY);
125 err_per_LB+=1;
126 }
127 } // crates
128 }
129 }
130
131 // CPM and CMX Simulation Mismatch data
132 if(!m_cpmMismatchLocation.empty()) {
133 const auto* errTES = SG::get(m_cpmMismatchLocation, ctx);
134
135 if (!errTES || errTES->size() != size_t(cpmCrates)) {
136 ATH_MSG_INFO("No CPM mismatch vector of expected size");
137 } else {
138 for (int crate = 0; crate < cpmCrates; ++crate) {
139 const int err = (*errTES)[crate];
140 if (err == 0)
141 continue;
142 const int cr = crate + ppmCrates;
143 if (((err >> EMTowerMismatch) & 0x1) || ((err >> HadTowerMismatch) & 0x1)) {
144 globalOverviewX=Transmission;
145 globalOverviewY=cr;
146 fill(m_packageName,globalOverviewX,globalOverviewY);
147 err_per_LB+=1;
148 }
149 if (((err >> EMRoIMismatch) & 0x1) || ((err >> TauRoIMismatch) & 0x1)) {
150 globalOverviewX=Simulation;
151 globalOverviewY=cr;
152 fill(m_packageName,globalOverviewX,globalOverviewY);
153 err_per_LB+=1;
154 }
155 if (((err >> LeftCMXTobMismatch) & 0x1) ||
156 ((err >> RightCMXTobMismatch) & 0x1) ||
157 ((err >> RemoteSumMismatch) & 0x1)) {
158 globalOverviewX=CMXTransmission;
159 globalOverviewY=cr;
160 fill(m_packageName,globalOverviewX,globalOverviewY);
161 err_per_LB+=1;
162 }
163 if (((err >> LocalSumMismatch) & 0x1) ||
164 ((err >> TotalSumMismatch) &
165 0x1)) {
166 globalOverviewX=CMXSimulation;
167 globalOverviewY=cr;
168 fill(m_packageName,globalOverviewX,globalOverviewY);
169 err_per_LB+=1;
170 }
171 } // crates
172 }
173 }
174
175
176 // PPM Mismatch data
177 {
178 const auto* errTES = SG::get(m_ppmSimBSMismatchLocation, ctx);
179 if (!errTES || errTES->size() != size_t(ppmCrates)) {
180 ATH_MSG_INFO("No PPM SimBS mismatch vector of expected size");
181 } else {
182 for (int crate = 0; crate < ppmCrates; ++crate) {
183 const int err = (*errTES)[crate];
184 if (err == 0)
185 continue;
186 if (((err >> LUTMismatch) & 0x1)){
187 globalOverviewX=Simulation;
188 globalOverviewY=crate;
189 fill(m_packageName,globalOverviewX,globalOverviewY);
190 err_per_LB+=1;
191 }
192 }
193 }
194 }
195
196
197
198 // errors per lumiblock and events processed
199 auto lb = GetEventInfo(ctx)->lumiBlock();
200
201 auto n_processed = Monitored::Scalar("n_processed",0);
202 auto lb_errors = Monitored::Scalar("lb_errors",lb);
203 auto n_lb_errors = Monitored::Scalar("n_lb_errors",err_per_LB);
204
205 variables.push_back(n_processed);
206 if (err_per_LB>0) {
207 variables.push_back(lb_errors);
208 variables.push_back(n_lb_errors);
209 }
210
211 fill(m_packageName,variables);
212 variables.clear();
213 return StatusCode::SUCCESS;
214}
215
216
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
virtual StatusCode initialize() override
initialize
SG::ReadHandle< xAOD::EventInfo > GetEventInfo(const EventContext &) const
Return a ReadHandle for an EventInfo object (get run/event numbers, etc.)
AthMonitorAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Declare a monitored scalar variable.
virtual StatusCode initialize() override
initialize
OverviewMonitorAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
SG::ReadHandleKey< ErrorVector > m_ppmSimBSMismatchLocation
SG::ReadHandleKey< ErrorVector > m_cpmErrorLocation
virtual StatusCode fillHistograms(const EventContext &ctx) const override
adds event to the monitoring histograms
SG::ReadHandleKey< ErrorVector > m_cpmMismatchLocation
SG::ReadHandleKey< ErrorVector > m_ppmErrorLocation
int lb
Definition globals.cxx:23
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
void fill(H5::Group &out_file, size_t iterations)