CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
ESIntegrityClient Class Reference

#include <ESIntegrityClient.h>

Inheritance diagram for ESIntegrityClient:
ESClient

Public Member Functions

void endLumiAnalyze (DQMStore::IGetter &) override
 Analyze. More...
 
 ESIntegrityClient (const edm::ParameterSet &ps)
 Constructor. More...
 
 ~ESIntegrityClient () override
 Destructor. More...
 
- Public Member Functions inherited from ESClient
virtual void endJobAnalyze (DQMStore::IGetter &)
 
 ESClient (edm::ParameterSet const &)
 
template<typename T >
TgetHisto (MonitorElement *, bool=false, T *=0) const
 
void setup (DQMStore::IBooker &)
 
virtual ~ESClient ()
 

Private Member Functions

void book (DQMStore::IBooker &) override
 

Private Attributes

int fed_ [2][2][40][40]
 
int fedStatus_ [56]
 
int fiber_ [2][2][40][40]
 
int fiberStatus_ [56][36]
 
TH1F * hBXDiff_
 
TH1F * hFED_
 
TH2F * hFiberBadStatus_
 
TH2F * hFiberOff_
 
TH1F * hKBC_
 
TH1F * hKEC_
 
TH2F * hKF1_
 
TH2F * hKF2_
 
TH1F * hL1ADiff_
 
TH1F * hOrbitNumberDiff_
 
TH1F * hSLinkCRCErr_
 
int kchip_ [2][2][40][40]
 
MonitorElementmeFED_ [2][2]
 
MonitorElementmeKCHIP_ [2][2]
 
int slinkCRCStatus_ [56]
 
int syncStatus_ [56]
 

Additional Inherited Members

- Protected Attributes inherited from ESClient
bool cloneME_
 
bool debug_
 
bool initialized_
 
std::string prefixME_
 
bool verbose_
 

Detailed Description

Definition at line 9 of file ESIntegrityClient.h.

Constructor & Destructor Documentation

ESIntegrityClient::ESIntegrityClient ( const edm::ParameterSet ps)

Constructor.

Definition at line 13 of file ESIntegrityClient.cc.

References gather_cfg::cout, fed_, fedStatus_, fiber_, fiberStatus_, FrontierConditions_GlobalTag_cff::file, edm::FileInPath::fullPath(), edm::ParameterSet::getUntrackedParameter(), mps_fire::i, gen::k, kchip_, funct::m, meFED_, meKCHIP_, slinkCRCStatus_, AlCaHLTBitMon_QueryRunRegistry::string, syncStatus_, and z.

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 }
MonitorElement * meFED_[2][2]
T getUntrackedParameter(std::string const &, T const &) const
int kchip_[2][2][40][40]
int fed_[2][2][40][40]
ESClient(edm::ParameterSet const &)
Definition: ESClient.cc:5
MonitorElement * meKCHIP_[2][2]
int k[5][pyjets_maxn]
int fiberStatus_[56][36]
std::string fullPath() const
Definition: FileInPath.cc:163
int fiber_[2][2][40][40]
ESIntegrityClient::~ESIntegrityClient ( )
override

Destructor.

Definition at line 73 of file ESIntegrityClient.cc.

73 {}

Member Function Documentation

void ESIntegrityClient::book ( DQMStore::IBooker _ibooker)
overrideprivatevirtual

Reimplemented from ESClient.

Definition at line 75 of file ESIntegrityClient.cc.

References DQMStore::IBooker::book2D(), trackerHits::histo, mps_fire::i, meFED_, meKCHIP_, ESClient::prefixME_, MonitorElement::setAxisTitle(), and DQMStore::IBooker::setCurrentFolder().

75  {
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 }
MonitorElement * meFED_[2][2]
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
std::string prefixME_
Definition: ESClient.h:30
MonitorElement * meKCHIP_[2][2]
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:109
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void ESIntegrityClient::endLumiAnalyze ( DQMStore::IGetter _igetter)
overridevirtual

Analyze.

Reimplemented from ESClient.

Definition at line 95 of file ESIntegrityClient.cc.

References ESClient::cloneME_, fed_, fedStatus_, fiber_, fiberStatus_, DQMStore::IGetter::get(), ESClient::getHisto(), hBXDiff_, hFED_, hFiberBadStatus_, hFiberOff_, hKBC_, hKEC_, hKF1_, hKF2_, hL1ADiff_, hOrbitNumberDiff_, hSLinkCRCErr_, mps_fire::i, createfilelist::int, kchip_, meFED_, meKCHIP_, ESClient::prefixME_, MonitorElement::setBinContent(), slinkCRCStatus_, and syncStatus_.

95  {
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");
103  hFED_ = getHisto(me, cloneME_, hFED_);
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");
171  hKF1_ = getHisto(me, cloneME_, hKF1_);
172 
173  me = _igetter.get(prefixME_ + "/ESIntegrityTask/ES KChip Flag 2 Error codes");
174  hKF2_ = getHisto(me, cloneME_, hKF2_);
175 
176  me = _igetter.get(prefixME_ + "/ESIntegrityTask/ES KChip BC mismatch with OptoRX");
177  hKBC_ = getHisto(me, cloneME_, hKBC_);
178 
179  me = _igetter.get(prefixME_ + "/ESIntegrityTask/ES KChip EC mismatch with OptoRX");
180  hKEC_ = getHisto(me, cloneME_, hKEC_);
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 }
MonitorElement * meFED_[2][2]
void setBinContent(int binx, double content)
set content of bin (1-D)
bool cloneME_
Definition: ESClient.h:31
int kchip_[2][2][40][40]
int fed_[2][2][40][40]
std::string prefixME_
Definition: ESClient.h:30
MonitorElement * meKCHIP_[2][2]
MonitorElement * get(std::string const &path)
Definition: DQMStore.cc:303
int fiberStatus_[56][36]
T * getHisto(MonitorElement *, bool=false, T *=0) const
Definition: ESClient.h:37
int fiber_[2][2][40][40]

Member Data Documentation

int ESIntegrityClient::fed_[2][2][40][40]
private

Definition at line 23 of file ESIntegrityClient.h.

Referenced by endLumiAnalyze(), and ESIntegrityClient().

int ESIntegrityClient::fedStatus_[56]
private

Definition at line 26 of file ESIntegrityClient.h.

Referenced by endLumiAnalyze(), and ESIntegrityClient().

int ESIntegrityClient::fiber_[2][2][40][40]
private

Definition at line 25 of file ESIntegrityClient.h.

Referenced by endLumiAnalyze(), and ESIntegrityClient().

int ESIntegrityClient::fiberStatus_[56][36]
private

Definition at line 27 of file ESIntegrityClient.h.

Referenced by endLumiAnalyze(), and ESIntegrityClient().

TH1F* ESIntegrityClient::hBXDiff_
private

Definition at line 42 of file ESIntegrityClient.h.

Referenced by endLumiAnalyze().

TH1F* ESIntegrityClient::hFED_
private

Definition at line 34 of file ESIntegrityClient.h.

Referenced by endLumiAnalyze().

TH2F* ESIntegrityClient::hFiberBadStatus_
private

Definition at line 36 of file ESIntegrityClient.h.

Referenced by endLumiAnalyze().

TH2F* ESIntegrityClient::hFiberOff_
private

Definition at line 35 of file ESIntegrityClient.h.

Referenced by endLumiAnalyze().

TH1F* ESIntegrityClient::hKBC_
private

Definition at line 39 of file ESIntegrityClient.h.

Referenced by endLumiAnalyze().

TH1F* ESIntegrityClient::hKEC_
private

Definition at line 40 of file ESIntegrityClient.h.

Referenced by endLumiAnalyze().

TH2F* ESIntegrityClient::hKF1_
private

Definition at line 37 of file ESIntegrityClient.h.

Referenced by endLumiAnalyze().

TH2F* ESIntegrityClient::hKF2_
private

Definition at line 38 of file ESIntegrityClient.h.

Referenced by endLumiAnalyze().

TH1F* ESIntegrityClient::hL1ADiff_
private

Definition at line 41 of file ESIntegrityClient.h.

Referenced by endLumiAnalyze().

TH1F* ESIntegrityClient::hOrbitNumberDiff_
private

Definition at line 43 of file ESIntegrityClient.h.

Referenced by endLumiAnalyze().

TH1F* ESIntegrityClient::hSLinkCRCErr_
private

Definition at line 44 of file ESIntegrityClient.h.

Referenced by endLumiAnalyze().

int ESIntegrityClient::kchip_[2][2][40][40]
private

Definition at line 24 of file ESIntegrityClient.h.

Referenced by endLumiAnalyze(), and ESIntegrityClient().

MonitorElement* ESIntegrityClient::meFED_[2][2]
private

Definition at line 31 of file ESIntegrityClient.h.

Referenced by book(), endLumiAnalyze(), and ESIntegrityClient().

MonitorElement* ESIntegrityClient::meKCHIP_[2][2]
private

Definition at line 32 of file ESIntegrityClient.h.

Referenced by book(), endLumiAnalyze(), and ESIntegrityClient().

int ESIntegrityClient::slinkCRCStatus_[56]
private

Definition at line 29 of file ESIntegrityClient.h.

Referenced by endLumiAnalyze(), and ESIntegrityClient().

int ESIntegrityClient::syncStatus_[56]
private

Definition at line 28 of file ESIntegrityClient.h.

Referenced by endLumiAnalyze(), and ESIntegrityClient().