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