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, mergeVDriftHistosByStation::file, edm::ParameterSet::getUntrackedParameter(), i, j, gen::k, m, and detailsBasic3DVector::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]
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 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 i, j, and MonitorElement::setBinContent().

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

BeginRun.

Implements ESClient.

Definition at line 89 of file ESIntegrityClient.cc.

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

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:121
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: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 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:121
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 timingPdfMaker::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  snprintf(histo, 200, "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  snprintf(histo, 200, "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
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:850
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:434
void ESIntegrityClient::softReset ( bool  flag)

SoftReset.

Definition at line 324 of file ESIntegrityClient.cc.

324  {
325 
326 }

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.