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