CMS 3D CMS Logo

ESIntegrityClient.cc
Go to the documentation of this file.
2 
5 
6 #include <fstream>
7 #include <iomanip>
8 #include <iostream>
9 #include <memory>
10 
11 using namespace std;
12 
14  : ESClient(ps),
15  hFED_(nullptr),
16  hFiberOff_(nullptr),
17  hFiberBadStatus_(nullptr),
18  hKF1_(nullptr),
19  hKF2_(nullptr),
20  hKBC_(nullptr),
21  hKEC_(nullptr),
22  hL1ADiff_(nullptr),
23  hBXDiff_(nullptr),
24  hOrbitNumberDiff_(nullptr),
25  hSLinkCRCErr_(nullptr) {
26  // read in look-up table
27  for (int i = 0; i < 2; ++i)
28  for (int j = 0; j < 2; ++j)
29  for (int k = 0; k < 40; ++k)
30  for (int m = 0; m < 40; ++m) {
31  fed_[i][j][k][m] = -1;
32  kchip_[i][j][k][m] = -1;
33  fiber_[i][j][k][m] = -1;
34  }
35 
36  for (int i = 0; i < 56; ++i) {
37  fedStatus_[i] = -1;
38  syncStatus_[i] = -1;
39  slinkCRCStatus_[i] = -1;
40  for (int j = 0; j < 36; ++j)
41  fiberStatus_[i][j] = -1;
42  }
43 
44  for (int i = 0; i < 2; ++i)
45  for (int j = 0; j < 2; ++j) {
46  meFED_[i][j] = nullptr;
47  meKCHIP_[i][j] = nullptr;
48  }
49 
50  std::string lutPath(ps.getUntrackedParameter<edm::FileInPath>("LookupTable").fullPath());
51 
52  int nLines, z, iz, ip, ix, iy, fed, kchip, pace, bundle, fiber, optorx;
53  ifstream file(lutPath);
54 
55  if (file.is_open()) {
56  file >> nLines;
57 
58  for (int i = 0; i < nLines; ++i) {
59  file >> iz >> ip >> ix >> iy >> fed >> kchip >> pace >> bundle >> fiber >> optorx;
60 
61  z = (iz == -1) ? 2 : iz;
62  fed_[z - 1][ip - 1][ix - 1][iy - 1] = fed;
63  kchip_[z - 1][ip - 1][ix - 1][iy - 1] = kchip;
64  fiber_[z - 1][ip - 1][ix - 1][iy - 1] = (fiber - 1) + (optorx - 1) * 12;
65  }
66 
67  file.close();
68  } else {
69  cout << "ESIntegrityClient : Look up table file can not be found in " << lutPath << endl;
70  }
71 }
72 
74 
76  char histo[200];
77 
78  _ibooker.setCurrentFolder(prefixME_ + "/ESIntegrityClient");
79 
80  for (int i = 0; i < 2; ++i)
81  for (int j = 0; j < 2; ++j) {
82  int iz = (i == 0) ? 1 : -1;
83  snprintf(histo, 200, "ES Integrity Summary 1 Z %d P %d", iz, j + 1);
84  meFED_[i][j] = _ibooker.book2D(histo, histo, 40, 0.5, 40.5, 40, 0.5, 40.5);
85  meFED_[i][j]->setAxisTitle("Si X", 1);
86  meFED_[i][j]->setAxisTitle("Si Y", 2);
87 
88  snprintf(histo, 200, "ES Integrity Summary 2 Z %d P %d", iz, j + 1);
89  meKCHIP_[i][j] = _ibooker.book2D(histo, histo, 40, 0.5, 40.5, 40, 0.5, 40.5);
90  meKCHIP_[i][j]->setAxisTitle("Si X", 1);
91  meKCHIP_[i][j]->setAxisTitle("Si Y", 2);
92  }
93 }
94 
96  double nDI_FedErr[56];
97  for (int i = 0; i < 56; ++i)
98  nDI_FedErr[i] = 0;
99 
100  MonitorElement *me = nullptr;
101 
102  me = _igetter.get(prefixME_ + "/ESIntegrityTask/ES FEDs used for data taking");
104 
105  me = _igetter.get(prefixME_ + "/ESIntegrityTask/ES Fiber Off");
107 
108  me = _igetter.get(prefixME_ + "/ESIntegrityTask/ES Fiber Bad Status");
110 
111  me = _igetter.get(prefixME_ + "/ESIntegrityTask/ES SLink CRC Errors");
113 
114  int xval = 0;
115  int nevFEDs = 0;
116  if (hFED_) {
117  for (int i = 1; i <= 56; ++i)
118  if (nevFEDs < hFED_->GetBinContent(i))
119  nevFEDs = (int)hFED_->GetBinContent(i);
120  }
121 
122  // FED integrity
123  for (int i = 1; i <= 56; ++i) {
124  if (hFED_) {
125  if (hFED_->GetBinContent(i) > 0)
126  fedStatus_[i - 1] = 1;
127  }
128  if (hSLinkCRCErr_) {
129  if (hSLinkCRCErr_->GetBinContent(i) > 0)
130  slinkCRCStatus_[i - 1] = 1;
131  }
132  for (int j = 0; j < 36; ++j) {
133  if (hFiberBadStatus_) {
134  if (hFiberBadStatus_->GetBinContent(i, j + 1) > 0)
135  fiberStatus_[i - 1][j] = 2; // bad
136  else
137  fiberStatus_[i - 1][j] = 1; // good
138  }
139  if (hFiberOff_)
140  if (hFiberOff_->GetBinContent(i, j + 1) > 0) {
141  fiberStatus_[i - 1][j] = 0; // off
142  }
143  }
144  }
145 
146  // obtain MEs from ESRawDataTask
147  me = _igetter.get(prefixME_ + "/ESRawDataTask/ES L1A DCC errors");
149 
150  me = _igetter.get(prefixME_ + "/ESRawDataTask/ES BX DCC errors");
152 
153  me = _igetter.get(prefixME_ + "/ESRawDataTask/ES Orbit Number DCC errors");
155 
156  for (int i = 1; i <= 56; ++i) {
157  if (hL1ADiff_ && hBXDiff_) {
158  if (hL1ADiff_->GetBinContent(i) > 0 || hBXDiff_->GetBinContent(i) > 0) {
159  syncStatus_[i - 1] = 1;
160  if (hL1ADiff_->GetBinContent(i) > nDI_FedErr[i - 1])
161  nDI_FedErr[i - 1] = hL1ADiff_->GetBinContent(i);
162  if (hBXDiff_->GetBinContent(i) > nDI_FedErr[i - 1])
163  nDI_FedErr[i - 1] = hBXDiff_->GetBinContent(i);
164  }
165  }
166  // if (hOrbitNumberDiff_->GetBinContent(i) > 0) syncStatus_[i-1] = 1;
167  }
168 
169  // KCHIP integrity
170  me = _igetter.get(prefixME_ + "/ESIntegrityTask/ES KChip Flag 1 Error codes");
172 
173  me = _igetter.get(prefixME_ + "/ESIntegrityTask/ES KChip Flag 2 Error codes");
175 
176  me = _igetter.get(prefixME_ + "/ESIntegrityTask/ES KChip BC mismatch with OptoRX");
178 
179  me = _igetter.get(prefixME_ + "/ESIntegrityTask/ES KChip EC mismatch with OptoRX");
181 
182  Int_t kchip_xval[1550];
183  for (int i = 0; i < 1550; ++i) {
184  xval = 3;
185  Int_t kErr = 0;
186  for (int j = 1; j < 16; ++j) {
187  if (hKF1_) {
188  if (hKF1_->GetBinContent(i, j + 1) > 0) {
189  xval = 2;
190  kErr++;
191  }
192  }
193  if (hKF2_) {
194  if (hKF2_->GetBinContent(i, j + 1) > 0) {
195  xval = 4;
196  kErr++;
197  }
198  }
199  }
200  if (hKBC_) {
201  if (hKBC_->GetBinContent(i) > 0) {
202  xval = 5;
203  kErr++;
204  }
205  }
206  if (hKEC_) {
207  if (hKEC_->GetBinContent(i) > 0) {
208  xval = 6;
209  kErr++;
210  }
211  }
212  if (kErr > 1)
213  xval = 7;
214  kchip_xval[i] = xval;
215  }
216 
217  // detailed KCHIP summary (i.e. summary 2)
218  for (int iz = 0; iz < 2; ++iz)
219  for (int ip = 0; ip < 2; ++ip)
220  for (int ix = 0; ix < 40; ++ix)
221  for (int iy = 0; iy < 40; ++iy) {
222  if (fed_[iz][ip][ix][iy] == -1)
223  continue;
224  if (fedStatus_[fed_[iz][ip][ix][iy] - 520] == -1 ||
225  fiberStatus_[fed_[iz][ip][ix][iy] - 520][fiber_[iz][ip][ix][iy]] == 0)
226  kchip_xval[kchip_[iz][ip][ix][iy] - 1] = 0;
227  if ((kchip_[iz][ip][ix][iy] - 2) >= 0)
228  meKCHIP_[iz][ip]->setBinContent(ix + 1, iy + 1, kchip_xval[kchip_[iz][ip][ix][iy] - 2]);
229  }
230 
231  // FED, Fiber, KCHIP summary (i.e. summary 1)
232  Int_t nErr = 0;
233  for (int iz = 0; iz < 2; ++iz)
234  for (int ip = 0; ip < 2; ++ip)
235  for (int ix = 0; ix < 40; ++ix)
236  for (int iy = 0; iy < 40; ++iy) {
237  if (fed_[iz][ip][ix][iy] == -1)
238  continue;
239  nErr = 0;
240 
241  if (fedStatus_[fed_[iz][ip][ix][iy] - 520] == 1) {
242  if (hFED_) {
243  if (hFED_->GetBinContent(fed_[iz][ip][ix][iy] - 520 + 1) == nevFEDs)
244  xval = 3;
245  else {
246  xval = 4; // FED problem
247  nErr++;
248  }
249  }
250 
251  if (fiberStatus_[fed_[iz][ip][ix][iy] - 520][fiber_[iz][ip][ix][iy]] == 2) {
252  xval = 2; // fiber problem
253  nErr++;
254  }
255  if (fiberStatus_[fed_[iz][ip][ix][iy] - 520][fiber_[iz][ip][ix][iy]] == 0) {
256  xval = 0; // fiber off
257  }
258  if (kchip_xval[kchip_[iz][ip][ix][iy] - 1] != 3 && kchip_xval[kchip_[iz][ip][ix][iy] - 1] != 0) {
259  xval = 5; // kchip problem
260  nErr++;
261  }
262  if (syncStatus_[fed_[iz][ip][ix][iy] - 520] == 1) {
263  xval = 6;
264  nErr++;
265  }
266  if (slinkCRCStatus_[fed_[iz][ip][ix][iy] - 520] == 1) {
267  xval = 8;
268  nErr++;
269  }
270  if (nErr > 1)
271  xval = 7;
272  } else if (fedStatus_[fed_[iz][ip][ix][iy] - 520] == -1) {
273  xval = 0;
274  }
275 
276  meFED_[iz][ip]->setBinContent(ix + 1, iy + 1, xval);
277  }
278 }
ESIntegrityClient::~ESIntegrityClient
~ESIntegrityClient() override
Destructor.
Definition: ESIntegrityClient.cc:73
mps_fire.i
i
Definition: mps_fire.py:355
ESIntegrityClient::meFED_
MonitorElement * meFED_[2][2]
Definition: ESIntegrityClient.h:31
ESIntegrityClient::kchip_
int kchip_[2][2][40][40]
Definition: ESIntegrityClient.h:24
gather_cfg.cout
cout
Definition: gather_cfg.py:144
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
timingPdfMaker.histo
histo
Definition: timingPdfMaker.py:279
ESIntegrityClient::fed_
int fed_[2][2][40][40]
Definition: ESIntegrityClient.h:23
ESIntegrityClient.h
ESIntegrityClient::hKBC_
TH1F * hKBC_
Definition: ESIntegrityClient.h:39
dqm::legacy::MonitorElement
Definition: MonitorElement.h:461
ESIntegrityClient::hSLinkCRCErr_
TH1F * hSLinkCRCErr_
Definition: ESIntegrityClient.h:44
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
submitDQMOfflineCAF.nLines
nLines
Definition: submitDQMOfflineCAF.py:676
FileInPath.h
ESIntegrityClient::hL1ADiff_
TH1F * hL1ADiff_
Definition: ESIntegrityClient.h:41
edm::FileInPath
Definition: FileInPath.h:64
ESClient::prefixME_
std::string prefixME_
Definition: ESClient.h:32
ESIntegrityClient::hOrbitNumberDiff_
TH1F * hOrbitNumberDiff_
Definition: ESIntegrityClient.h:43
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
DDAxes::z
dqmdumpme.k
k
Definition: dqmdumpme.py:60
ESIntegrityClient::meKCHIP_
MonitorElement * meKCHIP_[2][2]
Definition: ESIntegrityClient.h:32
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ESClient::getHisto
T * getHisto(MonitorElement *, bool=false, T *=0) const
Definition: ESClient.h:39
edm::ParameterSet
Definition: ParameterSet.h:36
ESIntegrityClient::hKF2_
TH2F * hKF2_
Definition: ESIntegrityClient.h:38
ESIntegrityClient::endLumiAnalyze
void endLumiAnalyze(DQMStore::IGetter &) override
Analyze.
Definition: ESIntegrityClient.cc:95
ESIntegrityClient::fedStatus_
int fedStatus_[56]
Definition: ESIntegrityClient.h:26
ESIntegrityClient::hBXDiff_
TH1F * hBXDiff_
Definition: ESIntegrityClient.h:42
ESIntegrityClient::hFiberBadStatus_
TH2F * hFiberBadStatus_
Definition: ESIntegrityClient.h:36
createfilelist.int
int
Definition: createfilelist.py:10
FrontierConditions_GlobalTag_cff.file
file
Definition: FrontierConditions_GlobalTag_cff.py:13
ESIntegrityClient::hKEC_
TH1F * hKEC_
Definition: ESIntegrityClient.h:40
ESIntegrityClient::slinkCRCStatus_
int slinkCRCStatus_[56]
Definition: ESIntegrityClient.h:29
ESIntegrityClient::fiberStatus_
int fiberStatus_[56][36]
Definition: ESIntegrityClient.h:27
ESIntegrityClient::hFED_
TH1F * hFED_
Definition: ESIntegrityClient.h:34
ESIntegrityClient::syncStatus_
int syncStatus_[56]
Definition: ESIntegrityClient.h:28
ESClient
Definition: ESClient.h:12
dqm::impl::MonitorElement::setBinContent
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
Definition: MonitorElement.cc:691
ESIntegrityClient::hFiberOff_
TH2F * hFiberOff_
Definition: ESIntegrityClient.h:35
ESIntegrityClient::ESIntegrityClient
ESIntegrityClient(const edm::ParameterSet &ps)
Constructor.
Definition: ESIntegrityClient.cc:13
std
Definition: JetResolutionObject.h:76
ESIntegrityClient::hKF1_
TH2F * hKF1_
Definition: ESIntegrityClient.h:37
dqm::implementation::IGetter
Definition: DQMStore.h:484
dqm::implementation::IBooker::book2D
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:177
dqm::implementation::IGetter::get
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:651
ESIntegrityClient::fiber_
int fiber_[2][2][40][40]
Definition: ESIntegrityClient.h:25
dqm::implementation::IBooker
Definition: DQMStore.h:43
ESIntegrityClient::book
void book(DQMStore::IBooker &) override
Definition: ESIntegrityClient.cc:75
ESClient::cloneME_
bool cloneME_
Definition: ESClient.h:33
ParameterSet.h
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
hlt_dqm_clientPB-live_cfg.me
me
Definition: hlt_dqm_clientPB-live_cfg.py:56
dqm::impl::MonitorElement::setAxisTitle
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
Definition: MonitorElement.cc:800
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:163