CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalRawDataClient.cc
Go to the documentation of this file.
4 
8 
13 
14 #include <iostream>
15 
16 /*
17  * \file HcalRawDataClient.cc
18  *
19  * $Date: 2012/07/04 15:43:18 $
20  * $Revision: 1.14 $
21  * \author J. St. John
22  * \brief Hcal Raw Data Client class
23  */
24 
26 {
27  name_=myname;
28 }
29 
31 {
32  name_=myname;
33  enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup",false);
34  debug_ = ps.getUntrackedParameter<int>("debug",0);
35  prefixME_ = ps.getUntrackedParameter<std::string>("subSystemFolder","Hcal/");
36  if (prefixME_.substr(prefixME_.size()-1,prefixME_.size())!="/")
37  prefixME_.append("/");
38  subdir_ = ps.getUntrackedParameter<std::string>("RawDataFolder","RawDataMonitor_Hcal/"); // RawDataMonitor
39  if (subdir_.size()>0 && subdir_.substr(subdir_.size()-1,subdir_.size())!="/")
40  subdir_.append("/");
41  subdir_=prefixME_+subdir_;
42 
43  validHtmlOutput_ = ps.getUntrackedParameter<bool>("RawData_validHtmlOutput",true);
44  cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true);
45  badChannelStatusMask_ = ps.getUntrackedParameter<int>("RawData_BadChannelStatusMask",
46  ps.getUntrackedParameter<int>("BadChannelStatusMask",0));
47 
48  minerrorrate_ = ps.getUntrackedParameter<double>("RawData_minerrorrate",
49  ps.getUntrackedParameter<double>("minerrorrate",0.01));
50  minevents_ = ps.getUntrackedParameter<int>("RawData_minevents",
51  ps.getUntrackedParameter<int>("minevents",1));
52 
53  excludeHORing2_ = ps.getUntrackedParameter<bool>("excludeHOring2_backup",false);
54  Online_ = ps.getUntrackedParameter<bool>("online",false);
55 
56  ProblemCells=0;
58 }
59 
61 // if (LBprocessed_==true) return; // LB already processed
62 // UpdateMEs();
63 // LBprocessed_=true;
64  if (debug_>2) std::cout <<"\tHcalRawDataClient::endLuminosityBlock()"<<std::endl;
66  return;
67 }
68 
69 
71 {
72  if (debug_>2) std::cout <<"\tHcalRawDataClient::analyze()"<<std::endl;
74 }
75 
77 {
78  if (debug_>2) std::cout <<"\t\tHcalRawDataClient::calculateProblems()"<<std::endl;
79  if(!dqmStore_) return;
80  double totalevents=0;
81  int etabins=0, phibins=0, zside=0;
82  double problemvalue=0;
83 
84  //Get number of events to normalize by
85  MonitorElement* me;
86  me = dqmStore_->get(subdir_+"Events_Processed_Task_Histogram");
87  if (me) totalevents=me->getBinContent(1);
88 
89  // Clear away old problems
90  if (ProblemCells!=0)
91  {
93  (ProblemCells->getTH2F())->SetMaximum(1.05);
94  (ProblemCells->getTH2F())->SetMinimum(0.);
95  }
96  for (unsigned int d=0;ProblemCellsByDepth!=0 && d<ProblemCellsByDepth->depth.size();++d)
97  {
98  if (ProblemCellsByDepth->depth[d]!=0)
99  {
100  ProblemCellsByDepth->depth[d]->Reset();
101  (ProblemCellsByDepth->depth[d]->getTH2F())->SetMaximum(1.05);
102  (ProblemCellsByDepth->depth[d]->getTH2F())->SetMinimum(0.);
103  }
104  for (unsigned int eta=0; eta<85;++eta) //spans largest ieta breadth
105  {
106  for (unsigned int phi=0;phi<72;++phi) //spans largest (only!) iphi breadth
107  {
108  problemcount[eta][phi][d]=0.0;
109  }
110  }
111  }
112  enoughevents_=true;
113 
114  // Try to read excludeHOring2 status from file
115 
116  MonitorElement* temp_exclude = dqmStore_->get(subdir_+"ExcludeHOring2");
117 
118  // If value can't be read from file, keep the excludeHOring2_backup status
119  if (temp_exclude != 0)
120  {
121  if (temp_exclude->getIntValue()>0)
122  excludeHORing2_ = true;
123  else
124  excludeHORing2_ = false;
125  }
126 
127 
128 
129  //Get the plots showing raw data errors,
130  //fill problemcount[][][]
132 
133  std::vector<std::string> name = HcalEtaPhiHistNames();
134 
135  // Because we're clearing and re-forming the problem cell histogram here, we don't need to do any cute
136  // setting of the underflow bin to 0, and we can plot results as a raw rate between 0-1.
137 
138  for (unsigned int d=0;ProblemCellsByDepth!=0 && d<ProblemCellsByDepth->depth.size();++d)
139  {
140  if (ProblemCellsByDepth->depth[d]==0) continue;
141 
142  if (totalevents==0 || totalevents<minevents_) continue;
143  etabins=(ProblemCellsByDepth->depth[d]->getTH2F())->GetNbinsX();
144  phibins=(ProblemCellsByDepth->depth[d]->getTH2F())->GetNbinsY();
145  problemvalue=0;
146  for (int eta=0;eta<etabins;++eta)
147  {
148  int ieta=CalcIeta(eta,d+1);
149  if (ieta==-9999) continue;
150  for (int phi=0;phi<phibins;++phi)
151  {
152  problemvalue=0;
153  problemvalue=((uint64_t) problemcount[eta][phi][d] );
154 
155  if (problemvalue==0) continue;
156  problemvalue/=totalevents; // problem value is a rate; should be between 0 and 1
157  problemvalue = std::min(1.,problemvalue);
158 
159  zside=0;
160  if (isHF(eta,d+1)) // shift ieta by 1 for HF
161  ieta<0 ? zside = -1 : zside = 1;
162 
163  if (debug_>0) std::cout <<"problemvalue = "<<problemvalue<<" ieta = "<<zside<<" iphi = "<<phi+1<<" d = "<<d+1<<std::endl;
164  // For problem cells that exceed our allowed rate,
165  // set the values to -1 if the cells are already marked in the status database
166 
167  if (problemvalue>minerrorrate_)
168  {
169  HcalSubdetector subdet=HcalEmpty;
170  if (isHB(eta,d+1))subdet=HcalBarrel;
171  else if (isHE(eta,d+1)) subdet=HcalEndcap;
172  else if (isHF(eta,d+1)) subdet=HcalForward;
173  else if (isHO(eta,d+1)) subdet=HcalOuter;
174  HcalDetId hcalid(subdet, ieta, phi+1, (int)(d+1));
175  if (badstatusmap.find(hcalid)!=badstatusmap.end())
176  problemvalue=999;
177  }
178 
179  ProblemCellsByDepth->depth[d]->setBinContent(eta+1,phi+1,problemvalue);
180  if (ProblemCells!=0) ProblemCells->Fill(ieta+zside,phi+1,problemvalue);
181  } // loop on phi
182  } // loop on eta
183  } // loop on depth
184 
185  if (ProblemCells==0)
186  {
187  if (debug_>0) std::cout <<"<HcalRawDataClient::analyze> ProblemCells histogram does not exist!"<<std::endl;
188  return;
189  }
190 
191  // Normalization of ProblemCell plot, in the case where there are errors in multiple depths
192  etabins=(ProblemCells->getTH2F())->GetNbinsX();
193  phibins=(ProblemCells->getTH2F())->GetNbinsY();
194  for (int eta=0;eta<etabins;++eta)
195  {
196  for (int phi=0;phi<phibins;++phi)
197  {
200  }
201  }
202 
205  return;
206 }
207 
209 {
211  if (debug_>0)
212  {
213  std::cout <<"<HcalRawDataClient::beginJob()> Displaying dqmStore directory structure:"<<std::endl;
215  }
216 }
218 
219 void HcalRawDataClient::stashHDI(int thehash, HcalDetId thehcaldetid) {
220  //Let's not allow indexing off the array...
221  if ((thehash<0)||(thehash>=(NUMDCCS*NUMSPGS*HTRCHANMAX)))return;
222  //...but still do the job requested.
223  hashedHcalDetId_[thehash] = thehcaldetid;
224 }
225 
226 
228 {
229  if (debug_>2) std::cout <<"<HcalRawDataClient::beginRun>"<<std::endl;
231  c->get<HcalDbRecord>().get( pSetup );
232 
233  if (debug_>2) std::cout <<"\t<HcalRawDataClient::beginRun> Get Hcal mapping"<<std::endl;
234  readoutMap_=pSetup->getHcalMapping();
235  DetId detid_;
236  HcalDetId hcaldetid_;
237 
238  // Build a map of readout hardware unit to calorimeter channel
239  std::vector <HcalElectronicsId> AllElIds = readoutMap_->allElectronicsIdPrecision();
240  uint32_t itsdcc =0;
241  uint32_t itsspigot =0;
242  uint32_t itshtrchan=0;
243 
244  if (debug_>2) std::cout <<"\t<HcalRawDataClient::beginRun> Loop over AllEIds"<<std::endl;
245  // by looping over all precision (non-trigger) items.
246  for (std::vector <HcalElectronicsId>::iterator eid = AllElIds.begin();
247  eid != AllElIds.end();
248  eid++) {
249 
250  //Get the HcalDetId from the HcalElectronicsId
251  detid_ = readoutMap_->lookup(*eid);
252  // NULL if illegal; ignore
253  if (!detid_.null()) {
254  if (detid_.det()!=4) continue; //not Hcal
255  if (detid_.subdetId()!=HcalBarrel &&
256  detid_.subdetId()!=HcalEndcap &&
257  detid_.subdetId()!=HcalOuter &&
258  detid_.subdetId()!=HcalForward) continue;
259 
260  itsdcc =(uint32_t) eid->dccid();
261  itsspigot =(uint32_t) eid->spigot();
262  itshtrchan=(uint32_t) eid->htrChanId();
263  hcaldetid_ = HcalDetId(detid_);
264  stashHDI(hashup(itsdcc,itsspigot,itshtrchan),
265  hcaldetid_);
266  } // if (!detid_.null())
267  }
268 
269  if (debug_>2) std::cout <<"\t<HcalRawDataClient::beginRun> Completed loop."<<std::endl;
270 
271  enoughevents_=false;
272  if (!dqmStore_)
273  {
274  if (debug_>0) std::cout <<"<HcalRawDataClient::beginRun> dqmStore does not exist!"<<std::endl;
275  return;
276  }
277 
279  problemnames_.clear();
280  // Put the appropriate name of your problem summary here
281  ProblemCells=dqmStore_->book2D(" ProblemRawData",
282  " Problem Raw Data Rate for all HCAL;ieta;iphi",
283  85,-42.5,42.5,
284  72,0.5,72.5);
285  problemnames_.push_back(ProblemCells->getName());
286  if (debug_>1)
287  std::cout << "Tried to create ProblemCells Monitor Element in directory "<<subdir_<<" \t Failed? "<<(ProblemCells==0)<<std::endl;
288  dqmStore_->setCurrentFolder(subdir_+"problem_rawdata");
290 
291  ProblemCells->getTH2F()->SetMinimum(0);
292  ProblemCells->getTH2F()->SetMaximum(1.05);
293 
294  ProblemCellsByDepth->setup(dqmStore_," Problem Raw Data Rate");
295  for (unsigned int i=0; i<ProblemCellsByDepth->depth.size();++i)
296  problemnames_.push_back(ProblemCellsByDepth->depth[i]->getName());
297 
298  nevts_=0;
299 }
300 
302 
305 
307 {
308  if (!ProblemCells)
309  {
310  if (debug_>1) std::cout <<"<HcalRawDataClient::hasErrors_Temp> ProblemCells histogram does not exist!"<<std::endl;
311  return false;
312  }
313  int problemcount=0;
314  int ieta=-9999;
315 
316  for (int depth=0;depth<4; ++depth)
317  {
318  int etabins = (ProblemCells->getTH2F())->GetNbinsX();
319  int phibins = (ProblemCells->getTH2F())->GetNbinsY();
320  for (int hist_eta=0;hist_eta<etabins;++hist_eta)
321  {
322  for (int hist_phi=0; hist_phi<phibins;++hist_phi)
323  {
324  ieta=CalcIeta(hist_eta,depth+1);
325  if (ieta==-9999) continue;
326  if (ProblemCellsByDepth->depth[depth]==0)
327  continue;
328  if (ProblemCellsByDepth->depth[depth]->getBinContent(hist_eta,hist_phi)>minerrorrate_)
329  ++problemcount;
330  } // for (int hist_phi=1;...)
331  } // for (int hist_eta=1;...)
332  } // for (int depth=0;...)
333 
334  if (problemcount>0) return true;
335  return false;
336 }
337 
338 bool HcalRawDataClient::hasWarnings_Temp(void){return false;}
339 bool HcalRawDataClient::hasOther_Temp(void){return false;}
340 bool HcalRawDataClient::test_enabled(void){return true;}
341 
342 
343 void HcalRawDataClient::updateChannelStatus(std::map<HcalDetId, unsigned int>& myqual)
344 {
345  // This gets called by HcalMonitorClient
346  // see dead or hot cell code for an example
347 
348 } //void HcalRawDataClient::updateChannelStatus
349 
350 
352  MonitorElement* me;
353  std::string s;
354  if (debug_>1) std::cout<<"\t<HcalRawDataClient>: getHardwareSpaceHistos()"<<std::endl;
355  s=subdir_+"Corruption/01 Common Data Format violations";
356  me=dqmStore_->get(s.c_str());
357  meCDFErrorFound_=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, meCDFErrorFound_, debug_);
358  if (!meCDFErrorFound_ & (debug_>0)) std::cout <<"<HcalRawDataClient::analyze> "<<s<<" histogram does not exist!"<<std::endl;
359 
360  s=subdir_+"Corruption/02 DCC Event Format violation";
361  me=dqmStore_->get(s.c_str());
362  meDCCEventFormatError_=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, meDCCEventFormatError_, debug_);
363  if (!meDCCEventFormatError_ & (debug_>0)) std::cout <<"<HcalRawDataClient::analyze> "<<s<<" histogram does not exist!"<<std::endl;
364 
365  s=subdir_+"Corruption/03 OrN Inconsistent - HTR vs DCC";
366  me=dqmStore_->get(s.c_str());
367  meOrNSynch_=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, meOrNSynch_, debug_);
368  if (!meOrNSynch_ & (debug_>0)) std::cout <<"<HcalRawDataClient::analyze> "<<s<<" histogram does not exist!"<<std::endl;
369 
370  s=subdir_+"Corruption/05 BCN Inconsistent - HTR vs DCC";
371  me=dqmStore_->get(s.c_str());
372  meBCNSynch_=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, meBCNSynch_, debug_);
373  if (!meBCNSynch_ & (debug_>0)) std::cout <<"<HcalRawDataClient::analyze> "<<s<<" histogram does not exist!"<<std::endl;
374 
375  s=subdir_+"Corruption/06 EvN Inconsistent - HTR vs DCC";
376  me=dqmStore_->get(s.c_str());
377  meEvtNumberSynch_=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, meEvtNumberSynch_, debug_);
378  if (!meEvtNumberSynch_ & (debug_>0)) std::cout <<"<HcalRawDataClient::analyze> "<<s<<" histogram does not exist!"<<std::endl;
379 
380  s=subdir_+"Corruption/07 LRB Data Corruption Indicators";
381  me=dqmStore_->get(s.c_str());
382  LRBDataCorruptionIndicators_=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, LRBDataCorruptionIndicators_, debug_);
383  if (!LRBDataCorruptionIndicators_ & (debug_>0)) std::cout <<"<HcalRawDataClient::analyze> "<<s<<" histogram does not exist!"<<std::endl;
384 
385  s=subdir_+"Corruption/08 Half-HTR Data Corruption Indicators";
386  me=dqmStore_->get(s.c_str());
388  if (!HalfHTRDataCorruptionIndicators_ & (debug_>0)) std::cout <<"<HcalRawDataClient::analyze> "<<s<<" histogram does not exist!"<<std::endl;
389 
390  s=subdir_+"Corruption/09 Channel Integrity Summarized by Spigot";
391  me=dqmStore_->get(s.c_str());
392  ChannSumm_DataIntegrityCheck_=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, ChannSumm_DataIntegrityCheck_, debug_);
393  if (!ChannSumm_DataIntegrityCheck_ & (debug_>0)) std::cout <<"<HcalRawDataClient::analyze> "<<s<<" histogram does not exist!"<<std::endl;
394  if (ChannSumm_DataIntegrityCheck_)
395  ChannSumm_DataIntegrityCheck_->SetMinimum(0);
396 
397  char chararray[150];
398  for (int i=0; i<NUMDCCS; i++) {
399  sprintf(chararray,"Corruption/Channel Data Integrity/FED %03d Channel Integrity", i+700);
400  s=subdir_+std::string(chararray);
401  me=dqmStore_->get(s.c_str());
402  Chann_DataIntegrityCheck_[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, Chann_DataIntegrityCheck_[i], debug_);
403  if (!Chann_DataIntegrityCheck_[i] & (debug_>0)) std::cout <<"<HcalRawDataClient::analyze> "<<s<<" histogram does not exist!"<<std::endl;
404  if (Chann_DataIntegrityCheck_[i])
405  Chann_DataIntegrityCheck_[i]->SetMinimum(0);
406  }
407 }
409  if (debug_>1) std::cout <<"\t<HcalRawDataClient>::fillProblemCountArray(): getHardwareSpaceHistos()"<<std::endl;
411  float n=0.0;
412  int dcc_=-999;
413 
414  bool CheckmeCDFErrorFound_ = false;
415  bool CheckmeDCCEventFormatError_ = false;
416  bool CheckmeOrNSynch_ = false;
417  bool CheckmeBCNSynch_ = false;
418  bool CheckmeEvtNumberSynch_ = false;
419  bool CheckLRBDataCorruptionIndicators_ = false;
420  bool CheckHalfHTRDataCorruptionIndicators_ = false;
421  bool CheckChannSumm_DataIntegrityCheck_ = false;
422  bool CheckChann_DataIntegrityCheck_[NUMDCCS] = {false};
423 
424  if (meCDFErrorFound_!=0) CheckmeCDFErrorFound_ = true;
425  if (meDCCEventFormatError_!=0) CheckmeDCCEventFormatError_ = true;
426  if (meOrNSynch_!=0) CheckmeOrNSynch_ = true;
427  if (meBCNSynch_!=0) CheckmeBCNSynch_ = true;
428  if (meEvtNumberSynch_!=0) CheckmeEvtNumberSynch_ = true;
429  if (LRBDataCorruptionIndicators_!=0) CheckLRBDataCorruptionIndicators_ = true;
430  if (HalfHTRDataCorruptionIndicators_!=0) CheckHalfHTRDataCorruptionIndicators_ = true;
431  if (ChannSumm_DataIntegrityCheck_!=0) CheckChannSumm_DataIntegrityCheck_ = true;
432 
433  int fed2offset=0;
434  int fed3offset=0;
435  int spg2offset=0;
436  int spg3offset=0;
437  int chn2offset=0;
438 
439  //Project all types of errors in these two plots onto
440  //the x axis to get total errors per FED.
441  TH1D* ProjXmeCDFErrorFound_ = 0;
442  bool CheckProjXmeCDFErrorFound_ = false;
443  if (CheckmeCDFErrorFound_)
444  ProjXmeCDFErrorFound_=meCDFErrorFound_->ProjectionX();
445  if (ProjXmeCDFErrorFound_!=0) CheckProjXmeCDFErrorFound_=true;
446  TH1D* ProjXmeDCCEventFormatError_ = 0;
447  bool CheckProjXmeDCCEventFormatError_ = false;
448  if (CheckmeDCCEventFormatError_)
449  ProjXmeDCCEventFormatError_=meDCCEventFormatError_->ProjectionX();
450  if (ProjXmeDCCEventFormatError_!=0) CheckProjXmeDCCEventFormatError_ = true;
451 
452  for (int dccid=FEDNumbering::MINHCALFEDID; dccid<=FEDNumbering::MAXHCALFEDID; dccid++) {
453  dcc_=dccid-FEDNumbering::MINHCALFEDID; // Numbering FEDS [0:31] is more useful for array indices.
454  if (Chann_DataIntegrityCheck_[dcc_]!=0)
455  CheckChann_DataIntegrityCheck_[dcc_] = true;
456 
457  if (CheckProjXmeCDFErrorFound_) {
458  n = ProjXmeCDFErrorFound_->GetBinContent(1+dcc_);
459  if (n>0.0) mapDCCproblem(dcc_,n);
460  }
461  if (CheckProjXmeDCCEventFormatError_) {
462  n = ProjXmeDCCEventFormatError_->GetBinContent(1+dcc_);
463  if (n>0.0) mapDCCproblem(dcc_,n);
464  }
465 
466  fed3offset = 1 + (4*dcc_); //3 bins, plus one of margin, each DCC (FED)
467  fed2offset = 1 + (3*dcc_); //2 bins, plus one of margin, each DCC (FED)
468  for (int spigot=0; spigot<NUMSPGS; spigot++) {
469 
470  if (CheckmeOrNSynch_) {
471  n = meOrNSynch_->GetBinContent(1+dcc_, 1+spigot);
472  if (n>0.0) mapHTRproblem(dcc_,spigot,n);
473  }
474  if (CheckmeBCNSynch_) {
475  n = meBCNSynch_->GetBinContent(1+dcc_, 1+spigot);
476  if (n>0.0) mapHTRproblem(dcc_,spigot,n);
477  }
478  if (CheckmeEvtNumberSynch_) {
479  n = meEvtNumberSynch_->GetBinContent(1+dcc_, 1+spigot);
480  if (n>0.0) mapHTRproblem(dcc_,spigot,n);
481  }
482  spg3offset = 1 + (4*spigot); //3 bins, plus one of margin, each spigot
483  if (CheckLRBDataCorruptionIndicators_ ){
484  n=0.0; //Sum errors of all ten types
485  n+=LRBDataCorruptionIndicators_->GetBinContent(fed3offset,
486  spg3offset);
487  for (int xbin=1; xbin<=3; xbin++) {
488  for (int ybin=1; ybin<=3; ybin++) {
489  n+=LRBDataCorruptionIndicators_->GetBinContent(fed3offset+xbin,
490  spg3offset+ybin);
491  }
492  }
493  if (n>0.0) mapHTRproblem(dcc_,spigot,n);
494  }
495  if (CheckHalfHTRDataCorruptionIndicators_){
496  n=0.0; //Sum errors of all nine types
497  for (int xbin=1; xbin<=3; xbin++) {
498  for (int ybin=1; ybin<=3; ybin++) {
499  n+=HalfHTRDataCorruptionIndicators_->GetBinContent(fed3offset+xbin,
500  spg3offset+ybin);
501  }
502  }
503  if (n>0.0) mapHTRproblem(dcc_,spigot,n);
504  }
505  spg2offset = 1 + (3*spigot); //2 bins, plus one of margin, each spigot
506  if (CheckChann_DataIntegrityCheck_[dcc_] &&
507  CheckChannSumm_DataIntegrityCheck_ ){
508  //Each spigot may be configured for its own number of TimeSlices, per event.
509  //Keep an array of the values:
510  numTS_[(dcc_*NUMSPGS)+spigot]=-1.0 * ChannSumm_DataIntegrityCheck_->GetBinContent(fed2offset,
511  spg2offset+1);
512  for (int chnnum=0; chnnum<HTRCHANMAX; chnnum++) {
513  chn2offset = 1 + (3*chnnum); //2 bins, plus one of margin, each channel
514  n = 0.0;
515  //Sum errors of all types,
516  //but not !DV, at xbin==1, ybin==2.
517  //Weight less if error can occur every timeslice
518  // or between any two timeslices
519  float tsFactor=numTS_[spigot +(dcc_*NUMSPGS)];
520  float CRweight = 0.0;
521  float Erweight = 0.0;
522  if (tsFactor>0) {
523  CRweight = (1.0 / (tsFactor-1.0));
524  Erweight = (1.0 / (tsFactor ));
525  }
526  int xbin=1; int ybin=1; // Timeslices per event check for error here
527  n += Chann_DataIntegrityCheck_[dcc_]->GetBinContent(chn2offset+xbin,
528  spg2offset+ybin);
529  xbin=2; //move right one bin: CapID Rotation here
530  n += CRweight * Chann_DataIntegrityCheck_[dcc_]->GetBinContent(chn2offset+xbin,
531  spg2offset+ybin);
532  ybin=2; //move up one bin: Er bit here
533  n += Erweight * Chann_DataIntegrityCheck_[dcc_]->GetBinContent(chn2offset+xbin,
534  spg2offset+ybin);
535  if (n>=0.0)
536  mapChannproblem(dcc_,spigot,chnnum,n);
537  } //loop over channels
538  } //check to see if FED had any channel problems
539  } //loop over spigot
540  } //loop over dccid
541 }
542 
543 void HcalRawDataClient::mapDCCproblem(int dcc, float n) {
544  int myeta = 0;
545  int myphi =-1;
546  int mydepth = 0;
547  HcalDetId HDI;
548  //Light up all affected cells.
549  for (int i=hashup(dcc);
550  i<hashup(dcc)+(NUMSPGS*HTRCHANMAX);
551  i++) {
552  HDI = hashedHcalDetId_[i];
553  if (HDI==HcalDetId::Undefined)
554  continue;
555  mydepth = HDI.depth();
556  myphi = HDI.iphi();
557  myeta = CalcEtaBin(HDI.subdet(),
558  HDI.ieta(),
559  mydepth);
560  if (myeta>=0 && myeta<85 &&
561  (myphi-1)>=0 && (myphi-1)<72 &&
562  (mydepth-1)>=0 && (mydepth-1)<4){
563  if (problemcount[myeta][myphi-1][mydepth-1]< n)
564  problemcount[myeta][myphi-1][mydepth-1]=n;
565 
566  //exclude the decommissioned HO ring2, except SiPMs
567  if(mydepth==4 && excludeHORing2_==true)
568  if (abs(HDI.ieta())>=11 && abs(HDI.ieta())<=15 && !isSiPM(HDI.ieta(),HDI.iphi(),mydepth))
569  problemcount[myeta][myphi-1][mydepth-1] = 0.0;
570 
571  if (debug_>0)
572  std::cout<<" mapDCCproblem found error! "<<HDI.subdet()<<"("<<HDI.ieta()<<", "<<HDI.iphi()<<", "<<HDI.depth()<<")"<<std::endl;
573  }
574  }
575 }
576 void HcalRawDataClient::mapHTRproblem(int dcc, int spigot, float n) {
577  int myeta = 0;
578  int myphi =-1;
579  int mydepth = 0;
580  HcalDetId HDI;
581  //Light up all affected cells.
582  for (int i=hashup(dcc,spigot);
583  i<hashup(dcc,spigot)+(HTRCHANMAX); //nice, linear hash....
584  i++) {
585  HDI = hashedHcalDetId_[i];
586  if (HDI==HcalDetId::Undefined) {
587  continue;
588  }
589  mydepth = HDI.depth();
590  myphi = HDI.iphi();
591  myeta = CalcEtaBin(HDI.subdet(),
592  HDI.ieta(),
593  mydepth);
594  if (myeta>=0 && myeta<85 &&
595  (myphi-1)>=0 && (myphi-1)<72 &&
596  (mydepth-1)>=0 && (mydepth-1)<4){
597  if (problemcount[myeta][myphi-1][mydepth-1]< n)
598  problemcount[myeta][myphi-1][mydepth-1]=n;
599 
600  //exlcude the decommissioned HO ring2, except SiPMs
601  if(mydepth==4 && excludeHORing2_==true)
602  if (abs(HDI.ieta())>=11 && abs(HDI.ieta())<=15 && !isSiPM(HDI.ieta(),HDI.iphi(),mydepth))
603  problemcount[myeta][myphi-1][mydepth-1] = 0.0;
604 
605  if (debug_>0)
606  std::cout<<" mapHTRproblem found error! "<<HDI.subdet()<<"("<<HDI.ieta()<<", "<<HDI.iphi()<<", "<<HDI.depth()<<")"<<std::endl;
607  }
608  }
609 } // void HcalRawDataClient::mapHTRproblem(...)
610 
611 void HcalRawDataClient::mapChannproblem(int dcc, int spigot, int htrchan, float n) {
612  int myeta = 0;
613  int myphi =-1;
614  int mydepth = 0;
615  HcalDetId HDI;
616  //Light up the affected cell.
617  int i=hashup(dcc,spigot,htrchan);
618  HDI = HashToHDI(i);
619  if (HDI==HcalDetId::Undefined) {
620  return; // Do nothing at all, instead.
621  }
622  mydepth = HDI.depth();
623  myphi = HDI.iphi();
624  myeta = CalcEtaBin(HDI.subdet(),
625  HDI.ieta(),
626  mydepth);
627 
628  if (myeta>=0 && myeta<85 &&
629  (myphi-1)>=0 && (myphi-1)<72 &&
630  (mydepth-1)>=0 && (mydepth-1)<4){
631  if (problemcount[myeta][myphi-1][mydepth-1]< n) {
632  problemcount[myeta][myphi-1][mydepth-1]=n;
633 
634  //exlcude the decommissioned HO ring2, except SiPMs
635  if(mydepth==4 && excludeHORing2_==true)
636  if (abs(HDI.ieta())>=11 && abs(HDI.ieta())<=15 && !isSiPM(HDI.ieta(),HDI.iphi(),mydepth))
637  problemcount[myeta][myphi-1][mydepth-1] = 0.0;
638 
639  if (debug_>0)
640  std::cout<<" mapChannproblem found error! "<<HDI.subdet()<<"("<<HDI.ieta()<<", "<<HDI.iphi()<<", "<<HDI.depth()<<")"<<std::endl;
641  }
642  }
643 } // void HcalRawDataClient::mapChannproblem(...)
644 
645 
648 // // Get histograms that are used in testing
649 // getHardwareSpaceHistos();
650 //
651 // int fed2offset=0;
652 // int spg2offset=0;
653 // int chn2offset=0;
654 // float tsFactor=1.0;
655 // float val=0.0;
656 //
657 // if (!ChannSumm_DataIntegrityCheck_) return;
658 // //Normalize by the number of events each channel spake. (Handles ZS!)
659 // for (int fednum=0;fednum<NUMDCCS;fednum++) {
660 // fed2offset = 1 + (3*fednum); //2 bins, plus one of margin, each DCC
661 // for (int spgnum=0; spgnum<15; spgnum++) {
662 // spg2offset = 1 + (3*spgnum); //2 bins, plus one of margin, each spigot
663 // numTS_[(fednum*NUMSPGS)+spgnum]=ChannSumm_DataIntegrityCheck_->GetBinContent(fed2offset,
664 // spg2offset+1);
665 //
666 // for (int xbin=1; xbin<=2; xbin++) {
667 // for (int ybin=1; ybin<=2; ybin++) {
668 // val = ChannSumm_DataIntegrityCheck_->GetBinContent(fed2offset+xbin,
669 // spg2offset+ybin);
670 // if ( (val) && (nevts_) ) {
671 // //Lower pair of bins don't scale with just the timesamples per event.
672 // if (ybin==2) tsFactor=numTS_[spgnum +(fednum*NUMSPGS)];
673 // else {
674 // if (xbin==2) tsFactor=numTS_[spgnum +(fednum*NUMSPGS)]-1;
675 // else tsFactor=1.0;
676 // }
677 // if (tsFactor)
678 // ChannSumm_DataIntegrityCheck_->SetBinContent(fed2offset+xbin,
679 // spg2offset+ybin,
680 // val/(nevts_*tsFactor));
681 // val=0.0;
682 // }
683 // }
684 // }
685 // //Clear the numTS, which clutter the final plot.
686 // ChannSumm_DataIntegrityCheck_->SetBinContent(fed2offset ,
687 // spg2offset , 0.0);
688 // ChannSumm_DataIntegrityCheck_->SetBinContent(fed2offset ,
689 // spg2offset+1, 0.0);
690 //
691 // if (!Chann_DataIntegrityCheck_[fednum]) continue;
692 // for (int chnnum=0; chnnum<24; chnnum++) {
693 // chn2offset = 1 + (3*chnnum); //2 bins, plus one of margin, each channel
694 // if (! (Chann_DataIntegrityCheck_[fednum]))
695 // continue;
696 // for (int xbin=1; xbin<=2; xbin++) {
697 // for (int ybin=1; ybin<=2; ybin++) {
698 // val = Chann_DataIntegrityCheck_[fednum]->GetBinContent(chn2offset+xbin,
699 // spg2offset+ybin);
700 // if ( (val) && (nevts_) ) {
701 // //Lower pair of bins don't scale with just the timesamples per event.
702 // if (ybin==2) tsFactor=numTS_[spgnum +(fednum*NUMSPGS)];
703 // else {
704 // if (xbin==2) tsFactor=numTS_[spgnum +(fednum*NUMSPGS)]-1;
705 // else tsFactor=1.0;
706 // }
707 // if (tsFactor)
708 // Chann_DataIntegrityCheck_[fednum]->SetBinContent(chn2offset+xbin,
709 // spg2offset+ybin,
710 // val/(nevts_*tsFactor));
711 // }
712 // }
713 // }
714 // //Remove the channel's event count from sight.
715 // Chann_DataIntegrityCheck_[fednum]->SetBinContent(chn2offset,
716 // spg2offset,0.0);
717 // }
718 // }
719 // }
720 }
721 
723 {}
bool isHO(int etabin, int depth)
TH2F * LRBDataCorruptionIndicators_
static const HcalDetId Undefined
Definition: HcalDetId.h:66
T getUntrackedParameter(std::string const &, T const &) const
const std::string & getName(void) const
get name of ME
int i
Definition: DBlmapReader.cc:9
MonitorElement * ProblemCells
std::string name()
void setBinContent(int binx, double content)
set content of bin (1-D)
std::vector< HcalElectronicsId > allElectronicsIdPrecision() const
TH2F * ChannSumm_DataIntegrityCheck_
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:32
HcalDetId HashToHDI(int thehash)
void normalizeHardwareSpaceHistos(void)
void stashHDI(int thehash, HcalDetId thehcaldetid)
#define HTRCHANMAX
void mapDCCproblem(int dcc, float n)
TH2F * Chann_DataIntegrityCheck_[32]
#define NUMDCCS
void mapChannproblem(int dcc, int spigot, int htrchan, float n)
std::vector< std::string > HcalEtaPhiHistNames()
void setup(DQMStore *&m_dbe, std::string Name, std::string Units="")
#define abs(x)
Definition: mlp_lapack.h:159
const edm::EventSetup * c
#define min(a, b)
Definition: mlp_lapack.h:161
void fillProblemCountArray(void)
bool isHE(int etabin, int depth)
T eta() const
void Fill(long long x)
void getHardwareSpaceHistos(void)
HcalRawDataClient()
Constructors.
void updateChannelStatus(std::map< HcalDetId, unsigned int > &myqual)
int hashup(uint32_t d=0, uint32_t s=0, uint32_t c=1)
bool isSiPM(int ieta, int iphi, int depth)
int depth() const
get the tower depth
Definition: HcalDetId.h:42
std::vector< MonitorElement * > depth
int CalcIeta(int subdet, int eta, int depth)
std::vector< std::string > problemnames_
EtaPhiHists * ProblemCellsByDepth
int ieta() const
get the cell ieta
Definition: HcalDetId.h:38
const HcalElectronicsMap * readoutMap_
HcalSubdetector
Definition: HcalAssistant.h:32
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1468
bool isHB(int etabin, int depth)
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
int iphi() const
get the cell iphi
Definition: HcalDetId.h:40
Definition: DetId.h:20
bool isHF(int etabin, int depth)
unsigned long long uint64_t
Definition: Time.h:15
void calculateProblems(void)
int64_t getIntValue(void) const
uint64_t problemcount[85][72][4]
const T & get() const
Definition: EventSetup.h:55
bool null() const
is this a null id ?
Definition: DetId.h:47
std::string subdir_
std::map< HcalDetId, unsigned int > badstatusmap
void FillUnphysicalHEHFBins(std::vector< TH2F > &hh)
int CalcEtaBin(int subdet, int ieta, int depth)
double getBinContent(int binx) const
get content of bin (1-D)
std::string prefixME_
~HcalRawDataClient()
Destructor.
float numTS_[32 *15]
HcalDetId hashedHcalDetId_[32 *15 *24]
tuple cout
Definition: gather_cfg.py:121
TH2F * HalfHTRDataCorruptionIndicators_
void showDirStructure(void) const
Definition: DQMStore.cc:2761
TH2F * getTH2F(void) const
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:845
Detector det() const
get the detector field from this detid
Definition: DetId.h:37
void Reset(void)
reset ME (ie. contents, errors, etc)
void mapHTRproblem(int dcc, int spigot, float n)
DQMStore * dqmStore_
const DetId lookup(HcalElectronicsId fId) const
lookup the logical detid associated with the given electronics id
void endLuminosityBlock(void)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
#define NUMSPGS
Definition: DDAxes.h:10