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
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 14 of file ESIntegrityClient.cc.

References gather_cfg::cout, dbtoweb::file, edm::ParameterSet::getUntrackedParameter(), i, j, gen::k, m, and z.

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

Destructor.

Definition at line 76 of file ESIntegrityClient.cc.

76  {
77 }

Member Function Documentation

void ESIntegrityClient::analyze ( void  )
virtual

Analyze.

Implements ESClient.

Definition at line 142 of file ESIntegrityClient.cc.

References trackerHits::histo, i, and j.

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

BeginJob.

Implements ESClient.

Definition at line 79 of file ESIntegrityClient.cc.

References gather_cfg::cout.

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

BeginRun.

Implements ESClient.

Definition at line 89 of file ESIntegrityClient.cc.

References gather_cfg::cout.

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

Cleanup.

Implements ESClient.

Definition at line 136 of file ESIntegrityClient.cc.

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

EndJob.

Implements ESClient.

Definition at line 99 of file ESIntegrityClient.cc.

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

99  {
100 
101  if ( debug_ ) cout << "ESIntegrityClient: endJob, ievt = " << ievt_ << endl;
102 
103  this->cleanup();
104 
105 }
void cleanup(void)
Cleanup.
tuple cout
Definition: gather_cfg.py:41
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 107 of file ESIntegrityClient.cc.

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

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

Get Functions.

Definition at line 55 of file ESIntegrityClient.h.

References ievt_.

55 { return ievt_; }
int ESIntegrityClient::getEvtPerRun ( void  )
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 115 of file ESIntegrityClient.cc.

References trackerHits::histo, i, and j.

115  {
116 
117  char histo[200];
118 
119  dqmStore_->setCurrentFolder( prefixME_ + "/ESIntegrityClient" );
120 
121  for (int i=0 ; i<2; ++i)
122  for (int j=0 ; j<2; ++j) {
123  int iz = (i==0)? 1:-1;
124  sprintf(histo, "ES Integrity Summary 1 Z %d P %d", iz, j+1);
125  meFED_[i][j] = dqmStore_->book2D(histo, histo, 40, 0.5, 40.5, 40, 0.5, 40.5);
126  meFED_[i][j]->setAxisTitle("Si X", 1);
127  meFED_[i][j]->setAxisTitle("Si Y", 2);
128 
129  sprintf(histo, "ES Integrity Summary 2 Z %d P %d", iz, j+1);
130  meKCHIP_[i][j] = dqmStore_->book2D(histo, histo, 40, 0.5, 40.5, 40, 0.5, 40.5);
131  meKCHIP_[i][j]->setAxisTitle("Si X", 1);
132  meKCHIP_[i][j]->setAxisTitle("Si Y", 2);
133  }
134 }
MonitorElement * meFED_[2][2]
int i
Definition: DBlmapReader.cc:9
tuple histo
Definition: trackerHits.py:12
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:647
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:237
void ESIntegrityClient::softReset ( bool  flag)

SoftReset.

Definition at line 337 of file ESIntegrityClient.cc.

337  {
338 
339 }

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.