CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 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_, mergeVDriftHistosByStation::file, edm::FileInPath::fullPath(), edm::ParameterSet::getUntrackedParameter(), i, j, relval_steps::k, kchip_, visualization-live-secondInstance_cfg::m, meFED_, meKCHIP_, submitDQMOfflineCAF::nLines, slinkCRCStatus_, AlCaHLTBitMon_QueryRunRegistry::string, syncStatus_, and z.

13  :
14  ESClient(ps),
15  hFED_(0),
16  hFiberOff_(0),
18  hKF1_(0),
19  hKF2_(0),
20  hKBC_(0),
21  hKEC_(0),
22  hL1ADiff_(0),
23  hBXDiff_(0),
25  hSLinkCRCErr_(0)
26 {
27  // read in look-up table
28  for (int i=0; i<2; ++i)
29  for (int j=0; j<2; ++j)
30  for (int k=0; k<40; ++k)
31  for (int m=0; m<40; ++m) {
32  fed_[i][j][k][m] = -1;
33  kchip_[i][j][k][m] = -1;
34  fiber_[i][j][k][m] = -1;
35  }
36 
37  for (int i=0; i<56; ++i) {
38  fedStatus_[i] = -1;
39  syncStatus_[i] = -1;
40  slinkCRCStatus_[i] = -1;
41  for (int j=0; j<36; ++j)
42  fiberStatus_[i][j] = -1;
43  }
44 
45  for(int i=0; i<2; ++i)
46  for(int j=0; j<2; ++j){
47  meFED_[i][j] = 0;
48  meKCHIP_[i][j] = 0;
49  }
50 
51  std::string lutPath(ps.getUntrackedParameter<edm::FileInPath>("LookupTable").fullPath());
52 
53  int nLines, z, iz, ip, ix, iy, fed, kchip, pace, bundle, fiber, optorx;
54  ifstream file(lutPath);
55 
56  if( file.is_open() ) {
57 
58  file >> nLines;
59 
60  for (int i=0; i<nLines; ++i) {
61  file>> iz >> ip >> ix >> iy >> fed >> kchip >> pace >> bundle >> fiber >> optorx;
62 
63  z = (iz==-1) ? 2:iz;
64  fed_[z-1][ip-1][ix-1][iy-1] = fed;
65  kchip_[z-1][ip-1][ix-1][iy-1] = kchip;
66  fiber_[z-1][ip-1][ix-1][iy-1] = (fiber-1)+(optorx-1)*12;
67  }
68 
69  file.close();
70  }
71  else {
72  cout<<"ESIntegrityClient : Look up table file can not be found in "<<lutPath<<endl;
73  }
74 }
MonitorElement * meFED_[2][2]
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
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 j
Definition: DBlmapReader.cc:9
int fiberStatus_[56][36]
tuple cout
Definition: gather_cfg.py:121
std::string fullPath() const
Definition: FileInPath.cc:165
int fiber_[2][2][40][40]
ESIntegrityClient::~ESIntegrityClient ( )

Destructor.

Definition at line 76 of file ESIntegrityClient.cc.

76  {
77 }

Member Function Documentation

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

Reimplemented from ESClient.

Definition at line 79 of file ESIntegrityClient.cc.

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

79  {
80 
81  char histo[200];
82 
83  _ibooker.setCurrentFolder( prefixME_ + "/ESIntegrityClient" );
84 
85  for (int i=0 ; i<2; ++i)
86  for (int j=0 ; j<2; ++j) {
87  int iz = (i==0)? 1:-1;
88  snprintf(histo, 200, "ES Integrity Summary 1 Z %d P %d", iz, j+1);
89  meFED_[i][j] = _ibooker.book2D(histo, histo, 40, 0.5, 40.5, 40, 0.5, 40.5);
90  meFED_[i][j]->setAxisTitle("Si X", 1);
91  meFED_[i][j]->setAxisTitle("Si Y", 2);
92 
93  snprintf(histo, 200, "ES Integrity Summary 2 Z %d P %d", iz, j+1);
94  meKCHIP_[i][j] = _ibooker.book2D(histo, histo, 40, 0.5, 40.5, 40, 0.5, 40.5);
95  meKCHIP_[i][j]->setAxisTitle("Si X", 1);
96  meKCHIP_[i][j]->setAxisTitle("Si Y", 2);
97  }
98 }
MonitorElement * meFED_[2][2]
int i
Definition: DBlmapReader.cc:9
std::string prefixME_
Definition: ESClient.h:31
MonitorElement * meKCHIP_[2][2]
int j
Definition: DBlmapReader.cc:9
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
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 100 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_, i, j, kchip_, meFED_, meKCHIP_, ESClient::prefixME_, MonitorElement::setBinContent(), slinkCRCStatus_, and syncStatus_.

100  {
101 
102  double nDI_FedErr[56];
103  for (int i=0; i<56; ++i) nDI_FedErr[i] = 0;
104 
105  MonitorElement* me = 0;
106 
107  me = _igetter.get(prefixME_ + "/ESIntegrityTask/ES FEDs used for data taking");
108  hFED_ = getHisto(me, cloneME_, hFED_);
109 
110  me = _igetter.get(prefixME_ + "/ESIntegrityTask/ES Fiber Off");
112 
113  me = _igetter.get(prefixME_ + "/ESIntegrityTask/ES Fiber Bad Status");
115 
116  me = _igetter.get(prefixME_ + "/ESIntegrityTask/ES SLink CRC Errors");
118 
119  int xval = 0;
120  int nevFEDs = 0;
121  if (hFED_) {
122  for (int i=1; i<=56; ++i)
123  if (nevFEDs < hFED_->GetBinContent(i))
124  nevFEDs = (int) hFED_->GetBinContent(i);
125  }
126 
127  // FED integrity
128  for (int i=1; i<=56; ++i) {
129  if (hFED_) {
130  if (hFED_->GetBinContent(i) > 0)
131  fedStatus_[i-1] = 1;
132  }
133  if (hSLinkCRCErr_) {
134  if (hSLinkCRCErr_->GetBinContent(i) > 0)
135  slinkCRCStatus_[i-1] = 1;
136  }
137  for (int j=0; j<36; ++j) {
138  if (hFiberBadStatus_) {
139  if (hFiberBadStatus_->GetBinContent(i, j+1) > 0)
140  fiberStatus_[i-1][j] = 2; // bad
141  else
142  fiberStatus_[i-1][j] = 1; // good
143  }
144  if (hFiberOff_)
145  if (hFiberOff_->GetBinContent(i, j+1) > 0) {
146  fiberStatus_[i-1][j] = 0; // off
147  }
148  }
149  }
150 
151  // obtain MEs from ESRawDataTask
152  me = _igetter.get(prefixME_ + "/ESRawDataTask/ES L1A DCC errors");
154 
155  me = _igetter.get(prefixME_ + "/ESRawDataTask/ES BX DCC errors");
157 
158  me = _igetter.get(prefixME_ + "/ESRawDataTask/ES Orbit Number DCC errors");
160 
161  for (int i=1; i<=56; ++i) {
162  if (hL1ADiff_ && hBXDiff_) {
163  if (hL1ADiff_->GetBinContent(i) > 0 || hBXDiff_->GetBinContent(i) > 0) {
164  syncStatus_[i-1] = 1;
165  if (hL1ADiff_->GetBinContent(i) > nDI_FedErr[i-1]) nDI_FedErr[i-1] = hL1ADiff_->GetBinContent(i);
166  if (hBXDiff_->GetBinContent(i) > nDI_FedErr[i-1]) nDI_FedErr[i-1] = hBXDiff_->GetBinContent(i);
167  }
168  }
169  //if (hOrbitNumberDiff_->GetBinContent(i) > 0) syncStatus_[i-1] = 1;
170  }
171 
172  // KCHIP integrity
173  me = _igetter.get(prefixME_ + "/ESIntegrityTask/ES KChip Flag 1 Error codes");
174  hKF1_ = getHisto(me, cloneME_, hKF1_);
175 
176  me = _igetter.get(prefixME_ + "/ESIntegrityTask/ES KChip Flag 2 Error codes");
177  hKF2_ = getHisto(me, cloneME_, hKF2_);
178 
179  me = _igetter.get(prefixME_ + "/ESIntegrityTask/ES KChip BC mismatch with OptoRX");
180  hKBC_ = getHisto(me, cloneME_, hKBC_);
181 
182  me = _igetter.get(prefixME_ + "/ESIntegrityTask/ES KChip EC mismatch with OptoRX");
183  hKEC_ = getHisto(me, cloneME_, hKEC_);
184 
185  Int_t kchip_xval[1550];
186  for (int i=0; i<1550; ++i) {
187 
188  xval = 3;
189  Int_t kErr = 0;
190  for (int j=1; j<16; ++j) {
191  if (hKF1_) {
192  if (hKF1_->GetBinContent(i, j+1)>0) {
193  xval = 2;
194  kErr++;
195  }
196  }
197  if (hKF2_) {
198  if (hKF2_->GetBinContent(i, j+1)>0) {
199  xval = 4;
200  kErr++;
201  }
202  }
203  }
204  if (hKBC_) {
205  if (hKBC_->GetBinContent(i)>0) {
206  xval = 5;
207  kErr++;
208  }
209  }
210  if (hKEC_) {
211  if (hKEC_->GetBinContent(i)>0) {
212  xval = 6;
213  kErr++;
214  }
215  }
216  if (kErr>1) xval = 7;
217  kchip_xval[i] = xval;
218  }
219 
220  // detailed KCHIP summary (i.e. summary 2)
221  for (int iz=0; iz<2; ++iz)
222  for (int ip=0; ip<2; ++ip)
223  for (int ix=0; ix<40; ++ix)
224  for (int iy=0; iy<40; ++iy) {
225  if (fed_[iz][ip][ix][iy] == -1) continue;
226  if (fedStatus_[fed_[iz][ip][ix][iy]-520]==-1 || fiberStatus_[fed_[iz][ip][ix][iy]-520][fiber_[iz][ip][ix][iy]] == 0)
227  kchip_xval[kchip_[iz][ip][ix][iy]-1] = 0;
228  if ((kchip_[iz][ip][ix][iy]-2) >= 0)
229  meKCHIP_[iz][ip]->setBinContent(ix+1, iy+1, kchip_xval[kchip_[iz][ip][ix][iy]-2]);
230  }
231 
232  // FED, Fiber, KCHIP summary (i.e. summary 1)
233  Int_t nErr = 0;
234  for (int iz=0; iz<2; ++iz)
235  for (int ip=0; ip<2; ++ip)
236  for (int ix=0; ix<40; ++ix)
237  for (int iy=0; iy<40; ++iy) {
238 
239  if (fed_[iz][ip][ix][iy] == -1) continue;
240  nErr = 0;
241 
242  if (fedStatus_[fed_[iz][ip][ix][iy]-520] == 1) {
243 
244  if (hFED_) {
245  if (hFED_->GetBinContent(fed_[iz][ip][ix][iy]-520+1) == nevFEDs)
246  xval = 3;
247  else {
248  xval = 4; // FED problem
249  nErr++;
250  }
251  }
252 
253  if (fiberStatus_[fed_[iz][ip][ix][iy]-520][fiber_[iz][ip][ix][iy]] == 2) {
254  xval = 2; // fiber problem
255  nErr++;
256  }
257  if (fiberStatus_[fed_[iz][ip][ix][iy]-520][fiber_[iz][ip][ix][iy]] == 0) {
258  xval = 0; // fiber off
259  }
260  if (kchip_xval[kchip_[iz][ip][ix][iy]-1] != 3 && kchip_xval[kchip_[iz][ip][ix][iy]-1] != 0) {
261  xval = 5; // kchip problem
262  nErr++;
263  }
264  if (syncStatus_[fed_[iz][ip][ix][iy]-520] == 1) {
265  xval = 6;
266  nErr++;
267  }
268  if (slinkCRCStatus_[fed_[iz][ip][ix][iy]-520] == 1) {
269  xval = 8;
270  nErr++;
271  }
272  if (nErr > 1) xval = 7;
273  } else if (fedStatus_[fed_[iz][ip][ix][iy]-520] == -1) {
274  xval = 0;
275  }
276 
277  meFED_[iz][ip]->setBinContent(ix+1, iy+1, xval);
278  }
279 
280 }
MonitorElement * meFED_[2][2]
int i
Definition: DBlmapReader.cc:9
void setBinContent(int binx, double content)
set content of bin (1-D)
bool cloneME_
Definition: ESClient.h:32
int kchip_[2][2][40][40]
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:302
int fed_[2][2][40][40]
std::string prefixME_
Definition: ESClient.h:31
MonitorElement * meKCHIP_[2][2]
int j
Definition: DBlmapReader.cc:9
int fiberStatus_[56][36]
T * getHisto(MonitorElement *, bool=false, T *=0) const
Definition: ESClient.h:40
int fiber_[2][2][40][40]

Member Data Documentation

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

Definition at line 24 of file ESIntegrityClient.h.

Referenced by endLumiAnalyze(), and ESIntegrityClient().

int ESIntegrityClient::fedStatus_[56]
private

Definition at line 27 of file ESIntegrityClient.h.

Referenced by endLumiAnalyze(), and ESIntegrityClient().

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

Definition at line 26 of file ESIntegrityClient.h.

Referenced by endLumiAnalyze(), and ESIntegrityClient().

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

Definition at line 28 of file ESIntegrityClient.h.

Referenced by endLumiAnalyze(), and ESIntegrityClient().

TH1F* ESIntegrityClient::hBXDiff_
private

Definition at line 43 of file ESIntegrityClient.h.

Referenced by endLumiAnalyze().

TH1F* ESIntegrityClient::hFED_
private

Definition at line 35 of file ESIntegrityClient.h.

Referenced by endLumiAnalyze().

TH2F* ESIntegrityClient::hFiberBadStatus_
private

Definition at line 37 of file ESIntegrityClient.h.

Referenced by endLumiAnalyze().

TH2F* ESIntegrityClient::hFiberOff_
private

Definition at line 36 of file ESIntegrityClient.h.

Referenced by endLumiAnalyze().

TH1F* ESIntegrityClient::hKBC_
private

Definition at line 40 of file ESIntegrityClient.h.

Referenced by endLumiAnalyze().

TH1F* ESIntegrityClient::hKEC_
private

Definition at line 41 of file ESIntegrityClient.h.

Referenced by endLumiAnalyze().

TH2F* ESIntegrityClient::hKF1_
private

Definition at line 38 of file ESIntegrityClient.h.

Referenced by endLumiAnalyze().

TH2F* ESIntegrityClient::hKF2_
private

Definition at line 39 of file ESIntegrityClient.h.

Referenced by endLumiAnalyze().

TH1F* ESIntegrityClient::hL1ADiff_
private

Definition at line 42 of file ESIntegrityClient.h.

Referenced by endLumiAnalyze().

TH1F* ESIntegrityClient::hOrbitNumberDiff_
private

Definition at line 44 of file ESIntegrityClient.h.

Referenced by endLumiAnalyze().

TH1F* ESIntegrityClient::hSLinkCRCErr_
private

Definition at line 45 of file ESIntegrityClient.h.

Referenced by endLumiAnalyze().

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

Definition at line 25 of file ESIntegrityClient.h.

Referenced by endLumiAnalyze(), and ESIntegrityClient().

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

Definition at line 32 of file ESIntegrityClient.h.

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

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

Definition at line 33 of file ESIntegrityClient.h.

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

int ESIntegrityClient::slinkCRCStatus_[56]
private

Definition at line 30 of file ESIntegrityClient.h.

Referenced by endLumiAnalyze(), and ESIntegrityClient().

int ESIntegrityClient::syncStatus_[56]
private

Definition at line 29 of file ESIntegrityClient.h.

Referenced by endLumiAnalyze(), and ESIntegrityClient().