ATLAS Offline Software
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 
7 OverviewMonitorAlgorithm::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 
21 
22 
24 }
25 
26 StatusCode 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
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 
212  variables.clear();
213  return StatusCode::SUCCESS;
214 }
215 
216 
OverviewMonitorAlgorithm::CMXCPSumParity
@ CMXCPSumParity
Definition: OverviewMonitorAlgorithm.h:51
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
OverviewMonitorAlgorithm::Parity
@ Parity
Definition: OverviewMonitorAlgorithm.h:126
OverviewMonitorAlgorithm::m_ppmSimBSMismatchLocation
SG::ReadHandleKey< ErrorVector > m_ppmSimBSMismatchLocation
Definition: OverviewMonitorAlgorithm.h:35
OverviewMonitorAlgorithm::HadTowerMismatch
@ HadTowerMismatch
Definition: OverviewMonitorAlgorithm.h:90
OverviewMonitorAlgorithm::initialize
virtual StatusCode initialize() override
initialize
Definition: OverviewMonitorAlgorithm.cxx:12
checkCoolLatestUpdate.variables
variables
Definition: checkCoolLatestUpdate.py:13
OverviewMonitorAlgorithm::RemoteSumMismatch
@ RemoteSumMismatch
Definition: OverviewMonitorAlgorithm.h:96
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
OverviewMonitorAlgorithm::m_packageName
StringProperty m_packageName
Definition: OverviewMonitorAlgorithm.h:23
OverviewMonitorAlgorithm::RightCMXTobMismatch
@ RightCMXTobMismatch
Definition: OverviewMonitorAlgorithm.h:94
OverviewMonitorAlgorithm::m_ppmErrorLocation
SG::ReadHandleKey< ErrorVector > m_ppmErrorLocation
Definition: OverviewMonitorAlgorithm.h:26
OverviewMonitorAlgorithm::CPMEMParity
@ CPMEMParity
Definition: OverviewMonitorAlgorithm.h:45
SG::VarHandleKey::empty
bool empty() const
Test if the key is blank.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:150
OverviewMonitorAlgorithm::CMXTransmission
@ CMXTransmission
Definition: OverviewMonitorAlgorithm.h:132
OverviewMonitorAlgorithm::m_cpmErrorLocation
SG::ReadHandleKey< ErrorVector > m_cpmErrorLocation
Definition: OverviewMonitorAlgorithm.h:28
OverviewMonitorAlgorithm::LUTMismatch
@ LUTMismatch
Definition: OverviewMonitorAlgorithm.h:86
AthMonitorAlgorithm
Base class for Athena Monitoring Algorithms.
Definition: AthMonitorAlgorithm.h:36
OverviewMonitorAlgorithm::EMRoIMismatch
@ EMRoIMismatch
Definition: OverviewMonitorAlgorithm.h:91
OverviewMonitorAlgorithm::EMTowerMismatch
@ EMTowerMismatch
Definition: OverviewMonitorAlgorithm.h:89
python.BunchSpacingUtils.lb
lb
Definition: BunchSpacingUtils.py:88
OverviewMonitorAlgorithm::PPMSubStatus
@ PPMSubStatus
Definition: OverviewMonitorAlgorithm.h:42
dqt_zlumi_pandas.err
err
Definition: dqt_zlumi_pandas.py:182
OverviewMonitorAlgorithm::fillHistograms
virtual StatusCode fillHistograms(const EventContext &ctx) const override
adds event to the monitoring histograms
Definition: OverviewMonitorAlgorithm.cxx:26
OverviewMonitorAlgorithm::OverviewMonitorAlgorithm
OverviewMonitorAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Definition: OverviewMonitorAlgorithm.cxx:7
OverviewMonitorAlgorithm::LocalSumMismatch
@ LocalSumMismatch
Definition: OverviewMonitorAlgorithm.h:95
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
OverviewMonitorAlgorithm.h
OverviewMonitorAlgorithm::Simulation
@ Simulation
Definition: OverviewMonitorAlgorithm.h:129
OverviewMonitorAlgorithm::CMXCPStatus
@ CMXCPStatus
Definition: OverviewMonitorAlgorithm.h:52
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
OverviewMonitorAlgorithm::DataStatus
@ DataStatus
Definition: OverviewMonitorAlgorithm.h:42
AthMonitorAlgorithm::fill
void fill(const ToolHandle< GenericMonitoringTool > &groupHandle, std::vector< std::reference_wrapper< Monitored::IMonitoredVariable >> &&variables) const
Fills a vector of variables to a group by reference.
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
AthMonitorAlgorithm::GetEventInfo
SG::ReadHandle< xAOD::EventInfo > GetEventInfo(const EventContext &) const
Return a ReadHandle for an EventInfo object (get run/event numbers, etc.)
Definition: AthMonitorAlgorithm.cxx:107
OverviewMonitorAlgorithm::CMXSubStatus
@ CMXSubStatus
Definition: OverviewMonitorAlgorithm.h:130
OverviewMonitorAlgorithm::CPMHadLink
@ CPMHadLink
Definition: OverviewMonitorAlgorithm.h:48
OverviewMonitorAlgorithm::LinkDown
@ LinkDown
Definition: OverviewMonitorAlgorithm.h:127
OverviewMonitorAlgorithm::CMXSimulation
@ CMXSimulation
Definition: OverviewMonitorAlgorithm.h:133
OverviewMonitorAlgorithm::DataError
@ DataError
Definition: OverviewMonitorAlgorithm.h:42
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
OverviewMonitorAlgorithm::Transmission
@ Transmission
Definition: OverviewMonitorAlgorithm.h:128
AthMonitorAlgorithm::initialize
virtual StatusCode initialize() override
initialize
Definition: AthMonitorAlgorithm.cxx:18
OverviewMonitorAlgorithm::CPMStatus
@ CPMStatus
Definition: OverviewMonitorAlgorithm.h:49
OverviewMonitorAlgorithm::m_cpmMismatchLocation
SG::ReadHandleKey< ErrorVector > m_cpmMismatchLocation
Definition: OverviewMonitorAlgorithm.h:33
OverviewMonitorAlgorithm::CMXCPTobParity
@ CMXCPTobParity
Definition: OverviewMonitorAlgorithm.h:50
OverviewMonitorAlgorithm::TauRoIMismatch
@ TauRoIMismatch
Definition: OverviewMonitorAlgorithm.h:92
OverviewMonitorAlgorithm::CPMHadParity
@ CPMHadParity
Definition: OverviewMonitorAlgorithm.h:47
Monitored::Scalar
Declare a monitored scalar variable.
Definition: MonitoredScalar.h:34
SG::get
const T * get(const ReadHandleKey< T > &key)
Convenience function to retrieve an object given a ReadHandleKey.
SG::AllowEmpty
@ AllowEmpty
Definition: StoreGate/StoreGate/VarHandleKey.h:30
OverviewMonitorAlgorithm::SubStatus
@ SubStatus
Definition: OverviewMonitorAlgorithm.h:125
OverviewMonitorAlgorithm::CPMEMLink
@ CPMEMLink
Definition: OverviewMonitorAlgorithm.h:46
OverviewMonitorAlgorithm::TotalSumMismatch
@ TotalSumMismatch
Definition: OverviewMonitorAlgorithm.h:97
OverviewMonitorAlgorithm::LeftCMXTobMismatch
@ LeftCMXTobMismatch
Definition: OverviewMonitorAlgorithm.h:93
OverviewMonitorAlgorithm::GbCMXParity
@ GbCMXParity
Definition: OverviewMonitorAlgorithm.h:131