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 Attributes | Friends
ESIntegrityClient Class Reference

#include <ESIntegrityClient.h>

Inheritance diagram for ESIntegrityClient:
ESClient

Public Member Functions

void analyze (void)
 Analyze. More...
 
void beginJob (DQMStore *dqmStore)
 BeginJob. More...
 
void beginRun (void)
 BeginRun. More...
 
void cleanup (void)
 Cleanup. More...
 
void endJob (void)
 EndJob. More...
 
void endLumiAnalyze (void)
 EndLumiAnalyze. More...
 
void endRun (void)
 EndRun. More...
 
 ESIntegrityClient (const edm::ParameterSet &ps)
 Constructor. More...
 
int getEvtPerJob ()
 Get Functions. More...
 
int getEvtPerRun ()
 
void setup (void)
 Setup. More...
 
void softReset (bool flag)
 SoftReset. More...
 
virtual ~ESIntegrityClient ()
 Destructor. More...
 
- Public Member Functions inherited from ESClient
template<typename T >
TgetHisto (MonitorElement *, bool=false, T *=0) const
 
virtual ~ESClient (void)
 

Private Attributes

bool cloneME_
 
bool debug_
 
DQMStoredqmStore_
 
bool enableCleanup_
 
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 ievt_
 
int jevt_
 
int kchip_ [2][2][40][40]
 
edm::FileInPath lookup_
 
MonitorElementmeFED_ [2][2]
 
MonitorElementmeKCHIP_ [2][2]
 
std::string prefixME_
 
int slinkCRCStatus_ [56]
 
int syncStatus_ [56]
 
bool verbose_
 

Friends

class ESSummaryClient
 

Detailed Description

Definition at line 18 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, mergeVDriftHistosByStation::file, edm::ParameterSet::getUntrackedParameter(), i, j, gen::k, m, and detailsBasic3DVector::z.

13  {
14 
15  cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true);
16  verbose_ = ps.getUntrackedParameter<bool>("verbose", true);
17  debug_ = ps.getUntrackedParameter<bool>("debug", false);
18  prefixME_ = ps.getUntrackedParameter<string>("prefixME", "");
19  enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
20  lookup_ = ps.getUntrackedParameter<FileInPath>("LookupTable", edm::FileInPath("EventFilter/ESDigiToRaw/data/ES_lookup_table.dat"));
21 
22  // read in look-up table
23  for (int i=0; i<2; ++i)
24  for (int j=0; j<2; ++j)
25  for (int k=0; k<40; ++k)
26  for (int m=0; m<40; ++m) {
27  fed_[i][j][k][m] = -1;
28  kchip_[i][j][k][m] = -1;
29  }
30 
31  for (int i=0; i<56; ++i) {
32  fedStatus_[i] = -1;
33  syncStatus_[i] = -1;
34  slinkCRCStatus_[i] = -1;
35  for (int j=0; j<36; ++j)
36  fiberStatus_[i][j] = -1;
37  }
38 
39  int nLines_, z, iz, ip, ix, iy, fed, kchip, pace, bundle, fiber, optorx;
40  ifstream file;
41  file.open(lookup_.fullPath().c_str());
42  if( file.is_open() ) {
43 
44  file >> nLines_;
45 
46  for (int i=0; i<nLines_; ++i) {
47  file>> iz >> ip >> ix >> iy >> fed >> kchip >> pace >> bundle >> fiber >> optorx;
48 
49  z = (iz==-1) ? 2:iz;
50  fed_[z-1][ip-1][ix-1][iy-1] = fed;
51  kchip_[z-1][ip-1][ix-1][iy-1] = kchip;
52  fiber_[z-1][ip-1][ix-1][iy-1] = (fiber-1)+(optorx-1)*12;
53  }
54  }
55  else {
56  cout<<"ESIntegrityClient : Look up table file can not be found in "<<lookup_.fullPath().c_str()<<endl;
57  }
58 
59  hFED_ = 0;
60  hFiberOff_ = 0;
61  hFiberBadStatus_ = 0;
62  hKF1_ = 0;
63  hKF2_ = 0;
64  hKBC_ = 0;
65  hKEC_ = 0;
66  hL1ADiff_ = 0;
67  hBXDiff_ = 0;
69  hSLinkCRCErr_ = 0;
70 
71  ievt_ = 0;
72  jevt_ = 0;
73 }
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]
edm::FileInPath lookup_
float float float z
int j
Definition: DBlmapReader.cc:9
int k[5][pyjets_maxn]
int fiberStatus_[56][36]
tuple cout
Definition: gather_cfg.py:121
int fiber_[2][2][40][40]
ESIntegrityClient::~ESIntegrityClient ( )
virtual

Destructor.

Definition at line 75 of file ESIntegrityClient.cc.

75  {
76 }

Member Function Documentation

void ESIntegrityClient::analyze ( void  )
virtual

Analyze.

Implements ESClient.

Definition at line 141 of file ESIntegrityClient.cc.

References getHisto(), i, and j.

141  {
142 
143  double nDI_FedErr[56];
144  for (int i=0; i<56; ++i) nDI_FedErr[i] = 0;
145 
146  MonitorElement* me = 0;
147 
148  me = dqmStore_->get(prefixME_ + "/ESIntegrityTask/ES FEDs used for data taking");
149  hFED_ = getHisto(me, cloneME_, hFED_);
150 
151  me = dqmStore_->get(prefixME_ + "/ESIntegrityTask/ES Fiber Off");
153 
154  me = dqmStore_->get(prefixME_ + "/ESIntegrityTask/ES Fiber Bad Status");
156 
157  me = dqmStore_->get(prefixME_ + "/ESIntegrityTask/ES SLink CRC Errors");
159 
160  int xval = 0;
161  int nevFEDs = 0;
162  if (hFED_) {
163  for (int i=1; i<=56; ++i)
164  if (nevFEDs < hFED_->GetBinContent(i))
165  nevFEDs = (int) hFED_->GetBinContent(i);
166  }
167 
168  // FED integrity
169  for (int i=1; i<=56; ++i) {
170  if (hFED_) {
171  if (hFED_->GetBinContent(i) > 0)
172  fedStatus_[i-1] = 1;
173  }
174  if (hSLinkCRCErr_) {
175  if (hSLinkCRCErr_->GetBinContent(i) > 0)
176  slinkCRCStatus_[i-1] = 1;
177  }
178  for (int j=0; j<36; ++j) {
179  if (hFiberBadStatus_) {
180  if (hFiberBadStatus_->GetBinContent(i, j+1) > 0)
181  fiberStatus_[i-1][j] = 2; // bad
182  else
183  fiberStatus_[i-1][j] = 1; // good
184  }
185  if (hFiberOff_)
186  if (hFiberOff_->GetBinContent(i, j+1) > 0) {
187  fiberStatus_[i-1][j] = 0; // off
188  }
189  }
190  }
191 
192  // obtain MEs from ESRawDataTask
193  me = dqmStore_->get(prefixME_ + "/ESRawDataTask/ES L1A DCC errors");
195 
196  me = dqmStore_->get(prefixME_ + "/ESRawDataTask/ES BX DCC errors");
198 
199  me = dqmStore_->get(prefixME_ + "/ESRawDataTask/ES Orbit Number DCC errors");
201 
202  for (int i=1; i<=56; ++i) {
203  if (hL1ADiff_ && hBXDiff_) {
204  if (hL1ADiff_->GetBinContent(i) > 0 || hBXDiff_->GetBinContent(i) > 0) {
205  syncStatus_[i-1] = 1;
206  if (hL1ADiff_->GetBinContent(i) > nDI_FedErr[i-1]) nDI_FedErr[i-1] = hL1ADiff_->GetBinContent(i);
207  if (hBXDiff_->GetBinContent(i) > nDI_FedErr[i-1]) nDI_FedErr[i-1] = hBXDiff_->GetBinContent(i);
208  }
209  }
210  //if (hOrbitNumberDiff_->GetBinContent(i) > 0) syncStatus_[i-1] = 1;
211  }
212 
213  // KCHIP integrity
214  me = dqmStore_->get(prefixME_ + "/ESIntegrityTask/ES KChip Flag 1 Error codes");
215  hKF1_ = getHisto(me, cloneME_, hKF1_);
216 
217  me = dqmStore_->get(prefixME_ + "/ESIntegrityTask/ES KChip Flag 2 Error codes");
218  hKF2_ = getHisto(me, cloneME_, hKF2_);
219 
220  me = dqmStore_->get(prefixME_ + "/ESIntegrityTask/ES KChip BC mismatch with OptoRX");
221  hKBC_ = getHisto(me, cloneME_, hKBC_);
222 
223  me = dqmStore_->get(prefixME_ + "/ESIntegrityTask/ES KChip EC mismatch with OptoRX");
224  hKEC_ = getHisto(me, cloneME_, hKEC_);
225 
226  Int_t kchip_xval[1550];
227  for (int i=0; i<1550; ++i) {
228 
229  xval = 3;
230  Int_t kErr = 0;
231  for (int j=1; j<16; ++j) {
232  if (hKF1_) {
233  if (hKF1_->GetBinContent(i, j+1)>0) {
234  xval = 2;
235  kErr++;
236  }
237  }
238  if (hKF2_) {
239  if (hKF2_->GetBinContent(i, j+1)>0) {
240  xval = 4;
241  kErr++;
242  }
243  }
244  }
245  if (hKBC_) {
246  if (hKBC_->GetBinContent(i)>0) {
247  xval = 5;
248  kErr++;
249  }
250  }
251  if (hKEC_) {
252  if (hKEC_->GetBinContent(i)>0) {
253  xval = 6;
254  kErr++;
255  }
256  }
257  if (kErr>1) xval = 7;
258  kchip_xval[i] = xval;
259  }
260 
261  // detailed KCHIP summary (i.e. summary 2)
262  for (int iz=0; iz<2; ++iz)
263  for (int ip=0; ip<2; ++ip)
264  for (int ix=0; ix<40; ++ix)
265  for (int iy=0; iy<40; ++iy) {
266  if (fed_[iz][ip][ix][iy] == -1) continue;
267  if (fedStatus_[fed_[iz][ip][ix][iy]-520]==-1 || fiberStatus_[fed_[iz][ip][ix][iy]-520][fiber_[iz][ip][ix][iy]] == 0)
268  kchip_xval[kchip_[iz][ip][ix][iy]-1] = 0;
269  if ((kchip_[iz][ip][ix][iy]-2) >= 0)
270  meKCHIP_[iz][ip]->setBinContent(ix+1, iy+1, kchip_xval[kchip_[iz][ip][ix][iy]-2]);
271  }
272 
273  // FED, Fiber, KCHIP summary (i.e. summary 1)
274  Int_t nErr = 0;
275  for (int iz=0; iz<2; ++iz)
276  for (int ip=0; ip<2; ++ip)
277  for (int ix=0; ix<40; ++ix)
278  for (int iy=0; iy<40; ++iy) {
279 
280  if (fed_[iz][ip][ix][iy] == -1) continue;
281  nErr = 0;
282 
283  if (fedStatus_[fed_[iz][ip][ix][iy]-520] == 1) {
284 
285  if (hFED_) {
286  if (hFED_->GetBinContent(fed_[iz][ip][ix][iy]-520+1) == nevFEDs)
287  xval = 3;
288  else {
289  xval = 4; // FED problem
290  nErr++;
291  }
292  }
293 
294  if (fiberStatus_[fed_[iz][ip][ix][iy]-520][fiber_[iz][ip][ix][iy]] == 2) {
295  xval = 2; // fiber problem
296  nErr++;
297  }
298  if (fiberStatus_[fed_[iz][ip][ix][iy]-520][fiber_[iz][ip][ix][iy]] == 0) {
299  xval = 0; // fiber off
300  }
301  if (kchip_xval[kchip_[iz][ip][ix][iy]-1] != 3 && kchip_xval[kchip_[iz][ip][ix][iy]-1] != 0) {
302  xval = 5; // kchip problem
303  nErr++;
304  }
305  if (syncStatus_[fed_[iz][ip][ix][iy]-520] == 1) {
306  xval = 6;
307  nErr++;
308  }
309  if (slinkCRCStatus_[fed_[iz][ip][ix][iy]-520] == 1) {
310  xval = 8;
311  nErr++;
312  }
313  if (nErr > 1) xval = 7;
314  } else if (fedStatus_[fed_[iz][ip][ix][iy]-520] == -1) {
315  xval = 0;
316  }
317 
318  meFED_[iz][ip]->setBinContent(ix+1, iy+1, xval);
319  }
320 
321 }
MonitorElement * meFED_[2][2]
int i
Definition: DBlmapReader.cc:9
void setBinContent(int binx, double content)
set content of bin (1-D)
int kchip_[2][2][40][40]
int fed_[2][2][40][40]
MonitorElement * meKCHIP_[2][2]
int j
Definition: DBlmapReader.cc:9
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1696
int fiberStatus_[56][36]
T * getHisto(MonitorElement *, bool=false, T *=0) const
Definition: ESClient.h:33
int fiber_[2][2][40][40]
void ESIntegrityClient::beginJob ( DQMStore dqmStore)
virtual

BeginJob.

Implements ESClient.

Definition at line 78 of file ESIntegrityClient.cc.

References gather_cfg::cout.

78  {
79 
80  dqmStore_ = dqmStore;
81 
82  if ( debug_ ) cout << "ESIntegrityClient: beginJob" << endl;
83 
84  ievt_ = 0;
85  jevt_ = 0;
86 }
tuple cout
Definition: gather_cfg.py:121
void ESIntegrityClient::beginRun ( void  )
virtual

BeginRun.

Implements ESClient.

Definition at line 88 of file ESIntegrityClient.cc.

References gather_cfg::cout, and HcalObjRepresent::setup().

88  {
89 
90  if ( debug_ ) cout << "ESIntegrityClient: beginRun" << endl;
91 
92  jevt_ = 0;
93 
94  this->setup();
95 
96 }
void setup(void)
Setup.
tuple cout
Definition: gather_cfg.py:121
void ESIntegrityClient::cleanup ( void  )
virtual

Cleanup.

Implements ESClient.

Definition at line 135 of file ESIntegrityClient.cc.

135  {
136 
137  if ( ! enableCleanup_ ) return;
138 
139 }
void ESIntegrityClient::endJob ( void  )
virtual

EndJob.

Implements ESClient.

Definition at line 98 of file ESIntegrityClient.cc.

References edm::cleanup(), and gather_cfg::cout.

98  {
99 
100  if ( debug_ ) cout << "ESIntegrityClient: endJob, ievt = " << ievt_ << endl;
101 
102  this->cleanup();
103 
104 }
void cleanup(void)
Cleanup.
tuple cout
Definition: gather_cfg.py:121
void ESIntegrityClient::endLumiAnalyze ( void  )
inlinevirtual

EndLumiAnalyze.

Implements ESClient.

Definition at line 59 of file ESIntegrityClient.h.

59 {}
void ESIntegrityClient::endRun ( void  )
virtual

EndRun.

Implements ESClient.

Definition at line 106 of file ESIntegrityClient.cc.

References edm::cleanup(), and gather_cfg::cout.

106  {
107 
108  if ( debug_ ) cout << "ESIntegrityClient: endRun, jevt = " << jevt_ << endl;
109 
110  this->cleanup();
111 
112 }
void cleanup(void)
Cleanup.
tuple cout
Definition: gather_cfg.py:121
int ESIntegrityClient::getEvtPerJob ( )
inline

Get Functions.

Definition at line 55 of file ESIntegrityClient.h.

References ievt_.

55 { return ievt_; }
int ESIntegrityClient::getEvtPerRun ( )
inline

Definition at line 56 of file ESIntegrityClient.h.

References jevt_.

56 { return jevt_; }
void ESIntegrityClient::setup ( void  )
virtual

Setup.

Implements ESClient.

Definition at line 114 of file ESIntegrityClient.cc.

References timingPdfMaker::histo, i, and j.

114  {
115 
116  char histo[200];
117 
118  dqmStore_->setCurrentFolder( prefixME_ + "/ESIntegrityClient" );
119 
120  for (int i=0 ; i<2; ++i)
121  for (int j=0 ; j<2; ++j) {
122  int iz = (i==0)? 1:-1;
123  snprintf(histo, 200, "ES Integrity Summary 1 Z %d P %d", iz, j+1);
124  meFED_[i][j] = dqmStore_->book2D(histo, histo, 40, 0.5, 40.5, 40, 0.5, 40.5);
125  meFED_[i][j]->setAxisTitle("Si X", 1);
126  meFED_[i][j]->setAxisTitle("Si Y", 2);
127 
128  snprintf(histo, 200, "ES Integrity Summary 2 Z %d P %d", iz, j+1);
129  meKCHIP_[i][j] = dqmStore_->book2D(histo, histo, 40, 0.5, 40.5, 40, 0.5, 40.5);
130  meKCHIP_[i][j]->setAxisTitle("Si X", 1);
131  meKCHIP_[i][j]->setAxisTitle("Si Y", 2);
132  }
133 }
MonitorElement * meFED_[2][2]
int i
Definition: DBlmapReader.cc:9
MonitorElement * meKCHIP_[2][2]
int j
Definition: DBlmapReader.cc:9
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:1070
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:655
void ESIntegrityClient::softReset ( bool  flag)

SoftReset.

Definition at line 323 of file ESIntegrityClient.cc.

323  {
324 
325 }

Friends And Related Function Documentation

friend class ESSummaryClient
friend

Definition at line 20 of file ESIntegrityClient.h.

Member Data Documentation

bool ESIntegrityClient::cloneME_
private

Definition at line 73 of file ESIntegrityClient.h.

bool ESIntegrityClient::debug_
private

Definition at line 75 of file ESIntegrityClient.h.

DQMStore* ESIntegrityClient::dqmStore_
private

Definition at line 82 of file ESIntegrityClient.h.

bool ESIntegrityClient::enableCleanup_
private

Definition at line 76 of file ESIntegrityClient.h.

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

Definition at line 65 of file ESIntegrityClient.h.

int ESIntegrityClient::fedStatus_[56]
private

Definition at line 68 of file ESIntegrityClient.h.

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

Definition at line 67 of file ESIntegrityClient.h.

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

Definition at line 69 of file ESIntegrityClient.h.

TH1F* ESIntegrityClient::hBXDiff_
private

Definition at line 95 of file ESIntegrityClient.h.

TH1F* ESIntegrityClient::hFED_
private

Definition at line 87 of file ESIntegrityClient.h.

TH2F* ESIntegrityClient::hFiberBadStatus_
private

Definition at line 89 of file ESIntegrityClient.h.

TH2F* ESIntegrityClient::hFiberOff_
private

Definition at line 88 of file ESIntegrityClient.h.

TH1F* ESIntegrityClient::hKBC_
private

Definition at line 92 of file ESIntegrityClient.h.

TH1F* ESIntegrityClient::hKEC_
private

Definition at line 93 of file ESIntegrityClient.h.

TH2F* ESIntegrityClient::hKF1_
private

Definition at line 90 of file ESIntegrityClient.h.

TH2F* ESIntegrityClient::hKF2_
private

Definition at line 91 of file ESIntegrityClient.h.

TH1F* ESIntegrityClient::hL1ADiff_
private

Definition at line 94 of file ESIntegrityClient.h.

TH1F* ESIntegrityClient::hOrbitNumberDiff_
private

Definition at line 96 of file ESIntegrityClient.h.

TH1F* ESIntegrityClient::hSLinkCRCErr_
private

Definition at line 97 of file ESIntegrityClient.h.

int ESIntegrityClient::ievt_
private

Definition at line 63 of file ESIntegrityClient.h.

Referenced by getEvtPerJob().

int ESIntegrityClient::jevt_
private

Definition at line 64 of file ESIntegrityClient.h.

Referenced by getEvtPerRun().

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

Definition at line 66 of file ESIntegrityClient.h.

edm::FileInPath ESIntegrityClient::lookup_
private

Definition at line 80 of file ESIntegrityClient.h.

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

Definition at line 84 of file ESIntegrityClient.h.

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

Definition at line 85 of file ESIntegrityClient.h.

std::string ESIntegrityClient::prefixME_
private

Definition at line 78 of file ESIntegrityClient.h.

int ESIntegrityClient::slinkCRCStatus_[56]
private

Definition at line 71 of file ESIntegrityClient.h.

int ESIntegrityClient::syncStatus_[56]
private

Definition at line 70 of file ESIntegrityClient.h.

bool ESIntegrityClient::verbose_
private

Definition at line 74 of file ESIntegrityClient.h.