00001 #include "DQM/HcalMonitorClient/interface/HcalRawDataClient.h"
00002 #include "DQM/HcalMonitorClient/interface/HcalClientUtils.h"
00003 #include "DQM/HcalMonitorClient/interface/HcalHistoUtils.h"
00004
00005 #include "CondFormats/HcalObjects/interface/HcalChannelStatus.h"
00006 #include "CondFormats/HcalObjects/interface/HcalChannelQuality.h"
00007 #include "CondFormats/HcalObjects/interface/HcalCondObjectContainer.h"
00008
00009 #include "FWCore/Framework/interface/ESHandle.h"
00010 #include "CalibFormats/HcalObjects/interface/HcalDbService.h"
00011 #include "CalibFormats/HcalObjects/interface/HcalDbRecord.h"
00012 #include "DataFormats/FEDRawData/interface/FEDNumbering.h"
00013
00014 #include <iostream>
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 HcalRawDataClient::HcalRawDataClient(std::string myname)
00026 {
00027 name_=myname;
00028 }
00029
00030 HcalRawDataClient::HcalRawDataClient(std::string myname, const edm::ParameterSet& ps)
00031 {
00032 name_=myname;
00033 enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup",false);
00034 debug_ = ps.getUntrackedParameter<int>("debug",0);
00035 prefixME_ = ps.getUntrackedParameter<std::string>("subSystemFolder","Hcal/");
00036 if (prefixME_.substr(prefixME_.size()-1,prefixME_.size())!="/")
00037 prefixME_.append("/");
00038 subdir_ = ps.getUntrackedParameter<std::string>("RawDataFolder","RawDataMonitor_Hcal/");
00039 if (subdir_.size()>0 && subdir_.substr(subdir_.size()-1,subdir_.size())!="/")
00040 subdir_.append("/");
00041 subdir_=prefixME_+subdir_;
00042
00043 validHtmlOutput_ = ps.getUntrackedParameter<bool>("RawData_validHtmlOutput",true);
00044 cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true);
00045 badChannelStatusMask_ = ps.getUntrackedParameter<int>("RawData_BadChannelStatusMask",
00046 ps.getUntrackedParameter<int>("BadChannelStatusMask",0));
00047
00048 minerrorrate_ = ps.getUntrackedParameter<double>("RawData_minerrorrate",
00049 ps.getUntrackedParameter<double>("minerrorrate",0.01));
00050 minevents_ = ps.getUntrackedParameter<int>("RawData_minevents",
00051 ps.getUntrackedParameter<int>("minevents",1));
00052 ProblemCells=0;
00053 ProblemCellsByDepth=0;
00054 }
00055
00056 void HcalRawDataClient::endLuminosityBlock() {
00057
00058
00059
00060 if (debug_>2) std::cout <<"\tHcalRawDataClient::endLuminosityBlock()"<<std::endl;
00061 calculateProblems();
00062 return;
00063 }
00064
00065
00066 void HcalRawDataClient::analyze()
00067 {
00068 if (debug_>2) std::cout <<"\tHcalRawDataClient::analyze()"<<std::endl;
00069 calculateProblems();
00070 }
00071
00072 void HcalRawDataClient::calculateProblems()
00073 {
00074 if (debug_>2) std::cout <<"\t\tHcalRawDataClient::calculateProblems()"<<std::endl;
00075 if(!dqmStore_) return;
00076 double totalevents=0;
00077 int etabins=0, phibins=0, zside=0;
00078 double problemvalue=0;
00079
00080
00081 MonitorElement* me;
00082 me = dqmStore_->get(subdir_+"Events_Processed_Task_Histogram");
00083 if (me) totalevents=me->getBinContent(1);
00084
00085
00086 if (ProblemCells!=0)
00087 {
00088 ProblemCells->Reset();
00089 (ProblemCells->getTH2F())->SetMaximum(1.05);
00090 (ProblemCells->getTH2F())->SetMinimum(0.);
00091 }
00092 for (unsigned int d=0;ProblemCellsByDepth!=0 && d<ProblemCellsByDepth->depth.size();++d)
00093 {
00094 if (ProblemCellsByDepth->depth[d]!=0)
00095 {
00096 ProblemCellsByDepth->depth[d]->Reset();
00097 (ProblemCellsByDepth->depth[d]->getTH2F())->SetMaximum(1.05);
00098 (ProblemCellsByDepth->depth[d]->getTH2F())->SetMinimum(0.);
00099 }
00100 for (unsigned int eta=0; eta<85;++eta)
00101 {
00102 for (unsigned int phi=0;phi<72;++phi)
00103 {
00104 problemcount[eta][phi][d]=0.0;
00105 }
00106 }
00107 }
00108 enoughevents_=true;
00109
00110
00111 fillProblemCountArray();
00112
00113 std::vector<std::string> name = HcalEtaPhiHistNames();
00114
00115
00116
00117
00118 for (unsigned int d=0;ProblemCellsByDepth!=0 && d<ProblemCellsByDepth->depth.size();++d)
00119 {
00120 if (ProblemCellsByDepth->depth[d]==0) continue;
00121
00122 if (totalevents==0 || totalevents<minevents_) continue;
00123 etabins=(ProblemCellsByDepth->depth[d]->getTH2F())->GetNbinsX();
00124 phibins=(ProblemCellsByDepth->depth[d]->getTH2F())->GetNbinsY();
00125 problemvalue=0;
00126 for (int eta=0;eta<etabins;++eta)
00127 {
00128 int ieta=CalcIeta(eta,d+1);
00129 if (ieta==-9999) continue;
00130 for (int phi=0;phi<phibins;++phi)
00131 {
00132 problemvalue=0;
00133 problemvalue=((uint64_t) problemcount[eta][phi][d] );
00134 if (problemvalue==0) continue;
00135 problemvalue/=totalevents;
00136 problemvalue = std::min(1.,problemvalue);
00137
00138 zside=0;
00139 if (isHF(eta,d+1))
00140 ieta<0 ? zside = -1 : zside = 1;
00141
00142 if (debug_>0) std::cout <<"problemvalue = "<<problemvalue<<" ieta = "<<zside<<" iphi = "<<phi+1<<" d = "<<d+1<<std::endl;
00143
00144
00145 if (problemvalue>minerrorrate_)
00146 {
00147 HcalSubdetector subdet=HcalEmpty;
00148 if (isHB(eta,d+1))subdet=HcalBarrel;
00149 else if (isHE(eta,d+1)) subdet=HcalEndcap;
00150 else if (isHF(eta,d+1)) subdet=HcalForward;
00151 else if (isHO(eta,d+1)) subdet=HcalOuter;
00152 HcalDetId hcalid(subdet, ieta, phi+1, (int)(d+1));
00153 if (badstatusmap.find(hcalid)!=badstatusmap.end())
00154 problemvalue=999;
00155 }
00156
00157 ProblemCellsByDepth->depth[d]->setBinContent(eta+1,phi+1,problemvalue);
00158 if (ProblemCells!=0) ProblemCells->Fill(ieta+zside,phi+1,problemvalue);
00159 }
00160 }
00161 }
00162
00163 if (ProblemCells==0)
00164 {
00165 if (debug_>0) std::cout <<"<HcalRawDataClient::analyze> ProblemCells histogram does not exist!"<<std::endl;
00166 return;
00167 }
00168
00169
00170 etabins=(ProblemCells->getTH2F())->GetNbinsX();
00171 phibins=(ProblemCells->getTH2F())->GetNbinsY();
00172 for (int eta=0;eta<etabins;++eta)
00173 {
00174 for (int phi=0;phi<phibins;++phi)
00175 {
00176 if (ProblemCells->getBinContent(eta+1,phi+1)>1. && ProblemCells->getBinContent(eta+1,phi+1)<999)
00177 ProblemCells->setBinContent(eta+1,phi+1,1.);
00178 }
00179 }
00180
00181 FillUnphysicalHEHFBins(*ProblemCellsByDepth);
00182 FillUnphysicalHEHFBins(ProblemCells);
00183 return;
00184 }
00185
00186 void HcalRawDataClient::beginJob()
00187 {
00188 dqmStore_ = edm::Service<DQMStore>().operator->();
00189 if (debug_>0)
00190 {
00191 std::cout <<"<HcalRawDataClient::beginJob()> Displaying dqmStore directory structure:"<<std::endl;
00192 dqmStore_->showDirStructure();
00193 }
00194 }
00195 void HcalRawDataClient::endJob(){}
00196
00197 void HcalRawDataClient::stashHDI(int thehash, HcalDetId thehcaldetid) {
00198
00199 if ((thehash<0)||(thehash>(NUMDCCS*NUMSPGS*HTRCHANMAX)))return;
00200
00201 hashedHcalDetId_[thehash] = thehcaldetid;
00202 }
00203
00204
00205 void HcalRawDataClient::beginRun(void)
00206 {
00207 if (debug_>2) std::cout <<"<HcalRawDataClient::beginRun>"<<std::endl;
00208 edm::ESHandle<HcalDbService> pSetup;
00209 c->get<HcalDbRecord>().get( pSetup );
00210
00211 if (debug_>2) std::cout <<"\t<HcalRawDataClient::beginRun> Get Hcal mapping"<<std::endl;
00212 readoutMap_=pSetup->getHcalMapping();
00213 DetId detid_;
00214 HcalDetId hcaldetid_;
00215
00216
00217 std::vector <HcalElectronicsId> AllElIds = readoutMap_->allElectronicsIdPrecision();
00218 uint32_t itsdcc =0;
00219 uint32_t itsspigot =0;
00220 uint32_t itshtrchan=0;
00221
00222 if (debug_>2) std::cout <<"\t<HcalRawDataClient::beginRun> Loop over AllEIds"<<std::endl;
00223
00224 for (std::vector <HcalElectronicsId>::iterator eid = AllElIds.begin();
00225 eid != AllElIds.end();
00226 eid++) {
00227
00228
00229 detid_ = readoutMap_->lookup(*eid);
00230
00231 if (!detid_.null()) {
00232 if (detid_.det()!=4) continue;
00233 if (detid_.subdetId()!=HcalBarrel &&
00234 detid_.subdetId()!=HcalEndcap &&
00235 detid_.subdetId()!=HcalOuter &&
00236 detid_.subdetId()!=HcalForward) continue;
00237
00238 itsdcc =(uint32_t) eid->dccid();
00239 itsspigot =(uint32_t) eid->spigot();
00240 itshtrchan=(uint32_t) eid->htrChanId();
00241 hcaldetid_ = HcalDetId(detid_);
00242 stashHDI(hashup(itsdcc,itsspigot,itshtrchan),
00243 hcaldetid_);
00244 }
00245 }
00246
00247 if (debug_>2) std::cout <<"\t<HcalRawDataClient::beginRun> Completed loop."<<std::endl;
00248
00249 enoughevents_=false;
00250 if (!dqmStore_)
00251 {
00252 if (debug_>0) std::cout <<"<HcalRawDataClient::beginRun> dqmStore does not exist!"<<std::endl;
00253 return;
00254 }
00255
00256 dqmStore_->setCurrentFolder(subdir_);
00257 problemnames_.clear();
00258
00259 ProblemCells=dqmStore_->book2D(" ProblemRawData",
00260 " Problem Raw Data Rate for all HCAL;ieta;iphi",
00261 85,-42.5,42.5,
00262 72,0.5,72.5);
00263 problemnames_.push_back(ProblemCells->getName());
00264 if (debug_>1)
00265 std::cout << "Tried to create ProblemCells Monitor Element in directory "<<subdir_<<" \t Failed? "<<(ProblemCells==0)<<std::endl;
00266 dqmStore_->setCurrentFolder(subdir_+"problem_rawdata");
00267 ProblemCellsByDepth = new EtaPhiHists();
00268
00269 ProblemCells->getTH2F()->SetMinimum(0);
00270 ProblemCells->getTH2F()->SetMaximum(1.05);
00271
00272 ProblemCellsByDepth->setup(dqmStore_," Problem Raw Data Rate");
00273 for (unsigned int i=0; i<ProblemCellsByDepth->depth.size();++i)
00274 problemnames_.push_back(ProblemCellsByDepth->depth[i]->getName());
00275
00276 nevts_=0;
00277 }
00278
00279 void HcalRawDataClient::endRun(void){analyze();}
00280
00281 void HcalRawDataClient::setup(void){}
00282 void HcalRawDataClient::cleanup(void){}
00283
00284 bool HcalRawDataClient::hasErrors_Temp(void)
00285 {
00286 if (!ProblemCells)
00287 {
00288 if (debug_>1) std::cout <<"<HcalRawDataClient::hasErrors_Temp> ProblemCells histogram does not exist!"<<std::endl;
00289 return false;
00290 }
00291 int problemcount=0;
00292 int ieta=-9999;
00293
00294 for (int depth=0;depth<4; ++depth)
00295 {
00296 int etabins = (ProblemCells->getTH2F())->GetNbinsX();
00297 int phibins = (ProblemCells->getTH2F())->GetNbinsY();
00298 for (int hist_eta=0;hist_eta<etabins;++hist_eta)
00299 {
00300 for (int hist_phi=0; hist_phi<phibins;++hist_phi)
00301 {
00302 ieta=CalcIeta(hist_eta,depth+1);
00303 if (ieta==-9999) continue;
00304 if (ProblemCellsByDepth->depth[depth]==0)
00305 continue;
00306 if (ProblemCellsByDepth->depth[depth]->getBinContent(hist_eta,hist_phi)>minerrorrate_)
00307 ++problemcount;
00308 }
00309 }
00310 }
00311
00312 if (problemcount>0) return true;
00313 return false;
00314 }
00315
00316 bool HcalRawDataClient::hasWarnings_Temp(void){return false;}
00317 bool HcalRawDataClient::hasOther_Temp(void){return false;}
00318 bool HcalRawDataClient::test_enabled(void){return true;}
00319
00320
00321 void HcalRawDataClient::updateChannelStatus(std::map<HcalDetId, unsigned int>& myqual)
00322 {
00323
00324
00325
00326 }
00327
00328
00329 void HcalRawDataClient::getHardwareSpaceHistos(void){
00330 MonitorElement* me;
00331 std::string s;
00332 if (debug_>1) std::cout<<"\t<HcalRawDataClient>: getHardwareSpaceHistos()"<<std::endl;
00333 s=subdir_+"Corruption/01 Common Data Format violations";
00334 me=dqmStore_->get(s.c_str());
00335 meCDFErrorFound_=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, meCDFErrorFound_, debug_);
00336 if (!meCDFErrorFound_ & (debug_>0)) std::cout <<"<HcalRawDataClient::analyze> "<<s<<" histogram does not exist!"<<std::endl;
00337
00338 s=subdir_+"Corruption/02 DCC Event Format violation";
00339 me=dqmStore_->get(s.c_str());
00340 meDCCEventFormatError_=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, meDCCEventFormatError_, debug_);
00341 if (!meDCCEventFormatError_ & (debug_>0)) std::cout <<"<HcalRawDataClient::analyze> "<<s<<" histogram does not exist!"<<std::endl;
00342
00343 s=subdir_+"Corruption/03 OrN Inconsistent - HTR vs DCC";
00344 me=dqmStore_->get(s.c_str());
00345 meOrNSynch_=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, meOrNSynch_, debug_);
00346 if (!meOrNSynch_ & (debug_>0)) std::cout <<"<HcalRawDataClient::analyze> "<<s<<" histogram does not exist!"<<std::endl;
00347
00348 s=subdir_+"Corruption/05 BCN Inconsistent - HTR vs DCC";
00349 me=dqmStore_->get(s.c_str());
00350 meBCNSynch_=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, meBCNSynch_, debug_);
00351 if (!meBCNSynch_ & (debug_>0)) std::cout <<"<HcalRawDataClient::analyze> "<<s<<" histogram does not exist!"<<std::endl;
00352
00353 s=subdir_+"Corruption/06 EvN Inconsistent - HTR vs DCC";
00354 me=dqmStore_->get(s.c_str());
00355 meEvtNumberSynch_=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, meEvtNumberSynch_, debug_);
00356 if (!meEvtNumberSynch_ & (debug_>0)) std::cout <<"<HcalRawDataClient::analyze> "<<s<<" histogram does not exist!"<<std::endl;
00357
00358 s=subdir_+"Corruption/07 LRB Data Corruption Indicators";
00359 me=dqmStore_->get(s.c_str());
00360 LRBDataCorruptionIndicators_=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, LRBDataCorruptionIndicators_, debug_);
00361 if (!LRBDataCorruptionIndicators_ & (debug_>0)) std::cout <<"<HcalRawDataClient::analyze> "<<s<<" histogram does not exist!"<<std::endl;
00362
00363 s=subdir_+"Corruption/08 Half-HTR Data Corruption Indicators";
00364 me=dqmStore_->get(s.c_str());
00365 HalfHTRDataCorruptionIndicators_=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, HalfHTRDataCorruptionIndicators_, debug_);
00366 if (!HalfHTRDataCorruptionIndicators_ & (debug_>0)) std::cout <<"<HcalRawDataClient::analyze> "<<s<<" histogram does not exist!"<<std::endl;
00367
00368 s=subdir_+"Corruption/09 Channel Integrity Summarized by Spigot";
00369 me=dqmStore_->get(s.c_str());
00370 ChannSumm_DataIntegrityCheck_=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, ChannSumm_DataIntegrityCheck_, debug_);
00371 if (!ChannSumm_DataIntegrityCheck_ & (debug_>0)) std::cout <<"<HcalRawDataClient::analyze> "<<s<<" histogram does not exist!"<<std::endl;
00372 if (ChannSumm_DataIntegrityCheck_)
00373 ChannSumm_DataIntegrityCheck_->SetMinimum(0);
00374
00375 char chararray[150];
00376 for (int i=0; i<NUMDCCS; i++) {
00377 sprintf(chararray,"Corruption/Channel Data Integrity/FED %03d Channel Integrity", i+700);
00378 s=subdir_+std::string(chararray);
00379 me=dqmStore_->get(s.c_str());
00380 Chann_DataIntegrityCheck_[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, Chann_DataIntegrityCheck_[i], debug_);
00381 if (!Chann_DataIntegrityCheck_[i] & (debug_>0)) std::cout <<"<HcalRawDataClient::analyze> "<<s<<" histogram does not exist!"<<std::endl;
00382 if (Chann_DataIntegrityCheck_[i])
00383 Chann_DataIntegrityCheck_[i]->SetMinimum(0);
00384 }
00385 }
00386 void HcalRawDataClient::fillProblemCountArray(void){
00387 if (debug_>1) std::cout <<"\t<HcalRawDataClient>::fillProblemCountArray(): getHardwareSpaceHistos()"<<std::endl;
00388 getHardwareSpaceHistos();
00389 float n=0.0;
00390 int dcc_=-999;
00391
00392 bool CheckmeCDFErrorFound_ = false;
00393 bool CheckmeDCCEventFormatError_ = false;
00394 bool CheckmeOrNSynch_ = false;
00395 bool CheckmeBCNSynch_ = false;
00396 bool CheckmeEvtNumberSynch_ = false;
00397 bool CheckLRBDataCorruptionIndicators_ = false;
00398 bool CheckHalfHTRDataCorruptionIndicators_ = false;
00399 bool CheckChannSumm_DataIntegrityCheck_ = false;
00400 bool CheckChann_DataIntegrityCheck_[NUMDCCS] ;
00401
00402 if (meCDFErrorFound_!=0) CheckmeCDFErrorFound_ = true;
00403 if (meDCCEventFormatError_!=0) CheckmeDCCEventFormatError_ = true;
00404 if (meOrNSynch_!=0) CheckmeOrNSynch_ = true;
00405 if (meBCNSynch_!=0) CheckmeBCNSynch_ = true;
00406 if (meEvtNumberSynch_!=0) CheckmeEvtNumberSynch_ = true;
00407 if (LRBDataCorruptionIndicators_!=0) CheckLRBDataCorruptionIndicators_ = true;
00408 if (HalfHTRDataCorruptionIndicators_!=0) CheckHalfHTRDataCorruptionIndicators_ = true;
00409 if (ChannSumm_DataIntegrityCheck_!=0) CheckChannSumm_DataIntegrityCheck_ = true;
00410
00411 int fed2offset=0;
00412 int fed3offset=0;
00413 int spg2offset=0;
00414 int spg3offset=0;
00415 int chn2offset=0;
00416
00417
00418
00419 TH1D* ProjXmeCDFErrorFound_ = 0;
00420 bool CheckProjXmeCDFErrorFound_ = false;
00421 if (CheckmeCDFErrorFound_)
00422 ProjXmeCDFErrorFound_=meCDFErrorFound_->ProjectionX();
00423 if (ProjXmeCDFErrorFound_!=0) CheckProjXmeCDFErrorFound_=true;
00424 TH1D* ProjXmeDCCEventFormatError_ = 0;
00425 bool CheckProjXmeDCCEventFormatError_ = false;
00426 if (CheckmeDCCEventFormatError_)
00427 ProjXmeDCCEventFormatError_=meDCCEventFormatError_->ProjectionX();
00428 if (ProjXmeDCCEventFormatError_!=0) CheckProjXmeDCCEventFormatError_ = true;
00429
00430 for (int dccid=FEDNumbering::MINHCALFEDID; dccid<=FEDNumbering::MAXHCALFEDID; dccid++) {
00431 dcc_=dccid-FEDNumbering::MINHCALFEDID;
00432 if (Chann_DataIntegrityCheck_[dcc_]!=0)
00433 CheckChann_DataIntegrityCheck_[dcc_] = true;
00434
00435 if (CheckProjXmeCDFErrorFound_) {
00436 n = ProjXmeCDFErrorFound_->GetBinContent(1+dcc_);
00437 if (n>0.0) mapDCCproblem(dcc_,n);
00438 }
00439 if (CheckProjXmeDCCEventFormatError_) {
00440 n = ProjXmeDCCEventFormatError_->GetBinContent(1+dcc_);
00441 if (n>0.0) mapDCCproblem(dcc_,n);
00442 }
00443
00444 fed3offset = 1 + (4*dcc_);
00445 fed2offset = 1 + (3*dcc_);
00446 for (int spigot=0; spigot<NUMSPGS; spigot++) {
00447
00448 if (CheckmeOrNSynch_) {
00449 n = meOrNSynch_->GetBinContent(1+dcc_, 1+spigot);
00450 if (n>0.0) mapHTRproblem(dcc_,spigot,n);
00451 }
00452 if (CheckmeBCNSynch_) {
00453 n = meBCNSynch_->GetBinContent(1+dcc_, 1+spigot);
00454 if (n>0.0) mapHTRproblem(dcc_,spigot,n);
00455 }
00456 if (CheckmeEvtNumberSynch_) {
00457 n = meEvtNumberSynch_->GetBinContent(1+dcc_, 1+spigot);
00458 if (n>0.0) mapHTRproblem(dcc_,spigot,n);
00459 }
00460 spg3offset = 1 + (4*spigot);
00461 if (CheckLRBDataCorruptionIndicators_ ){
00462 n=0.0;
00463 n+=LRBDataCorruptionIndicators_->GetBinContent(fed3offset,
00464 spg3offset);
00465 for (int xbin=1; xbin<=3; xbin++) {
00466 for (int ybin=1; ybin<=3; ybin++) {
00467 n+=LRBDataCorruptionIndicators_->GetBinContent(fed3offset+xbin,
00468 spg3offset+ybin);
00469 }
00470 }
00471 if (n>0.0) mapHTRproblem(dcc_,spigot,n);
00472 }
00473 if (CheckHalfHTRDataCorruptionIndicators_){
00474 n=0.0;
00475 for (int xbin=1; xbin<=3; xbin++) {
00476 for (int ybin=1; ybin<=3; ybin++) {
00477 n+=HalfHTRDataCorruptionIndicators_->GetBinContent(fed3offset+xbin,
00478 spg3offset+ybin);
00479 }
00480 }
00481 if (n>0.0) mapHTRproblem(dcc_,spigot,n);
00482 }
00483 spg2offset = 1 + (3*spigot);
00484 if (CheckChann_DataIntegrityCheck_[dcc_] &&
00485 CheckChannSumm_DataIntegrityCheck_ ){
00486
00487
00488 numTS_[(dcc_*NUMSPGS)+spigot]=-1.0 * ChannSumm_DataIntegrityCheck_->GetBinContent(fed2offset,
00489 spg2offset+1);
00490 for (int chnnum=0; chnnum<HTRCHANMAX; chnnum++) {
00491 chn2offset = 1 + (3*chnnum);
00492 n = 0.0;
00493
00494
00495
00496
00497 float tsFactor=numTS_[spigot +(dcc_*NUMSPGS)];
00498 float CRweight = 0.0;
00499 float Erweight = 0.0;
00500 if (tsFactor>0) {
00501 CRweight = (1.0 / (tsFactor-1.0));
00502 Erweight = (1.0 / (tsFactor ));
00503 }
00504 int xbin=1; int ybin=1;
00505 n += Chann_DataIntegrityCheck_[dcc_]->GetBinContent(chn2offset+xbin,
00506 spg2offset+ybin);
00507 xbin=2;
00508 n += CRweight * Chann_DataIntegrityCheck_[dcc_]->GetBinContent(chn2offset+xbin,
00509 spg2offset+ybin);
00510 ybin=2;
00511 n += Erweight * Chann_DataIntegrityCheck_[dcc_]->GetBinContent(chn2offset+xbin,
00512 spg2offset+ybin);
00513 if (n>=0.0)
00514 mapChannproblem(dcc_,spigot,chnnum,n);
00515 }
00516 }
00517 }
00518 }
00519 }
00520
00521 void HcalRawDataClient::mapDCCproblem(int dcc, float n) {
00522 int myeta = 0;
00523 int myphi =-1;
00524 int mydepth = 0;
00525 HcalDetId HDI;
00526
00527 for (int i=hashup(dcc);
00528 i<hashup(dcc)+(NUMSPGS*HTRCHANMAX);
00529 i++) {
00530 HDI = hashedHcalDetId_[i];
00531 if (HDI==HcalDetId::Undefined)
00532 continue;
00533 mydepth = HDI.depth();
00534 myphi = HDI.iphi();
00535 myeta = CalcEtaBin(HDI.subdet(),
00536 HDI.ieta(),
00537 mydepth);
00538 if (myeta>=0 && myeta<85 &&
00539 (myphi-1)>=0 && (myphi-1)<72 &&
00540 (mydepth-1)>=0 && (mydepth-1)<4){
00541 if (problemcount[myeta][myphi-1][mydepth-1]< n)
00542 problemcount[myeta][myphi-1][mydepth-1]=n;
00543 if (debug_>0)
00544 std::cout<<" mapDCCproblem found error! "<<HDI.subdet()<<"("<<HDI.ieta()<<", "<<HDI.iphi()<<", "<<HDI.depth()<<")"<<std::endl;
00545 }
00546 }
00547 }
00548 void HcalRawDataClient::mapHTRproblem(int dcc, int spigot, float n) {
00549 int myeta = 0;
00550 int myphi =-1;
00551 int mydepth = 0;
00552 HcalDetId HDI;
00553
00554 for (int i=hashup(dcc,spigot);
00555 i<hashup(dcc,spigot)+(HTRCHANMAX);
00556 i++) {
00557 HDI = hashedHcalDetId_[i];
00558 if (HDI==HcalDetId::Undefined) {
00559 continue;
00560 }
00561 mydepth = HDI.depth();
00562 myphi = HDI.iphi();
00563 myeta = CalcEtaBin(HDI.subdet(),
00564 HDI.ieta(),
00565 mydepth);
00566 if (myeta>=0 && myeta<85 &&
00567 (myphi-1)>=0 && (myphi-1)<72 &&
00568 (mydepth-1)>=0 && (mydepth-1)<4){
00569 if (problemcount[myeta][myphi-1][mydepth-1]< n)
00570 problemcount[myeta][myphi-1][mydepth-1]=n;
00571 if (debug_>0)
00572 std::cout<<" mapHTRproblem found error! "<<HDI.subdet()<<"("<<HDI.ieta()<<", "<<HDI.iphi()<<", "<<HDI.depth()<<")"<<std::endl;
00573 }
00574 }
00575 }
00576
00577 void HcalRawDataClient::mapChannproblem(int dcc, int spigot, int htrchan, float n) {
00578 int myeta = 0;
00579 int myphi =-1;
00580 int mydepth = 0;
00581 HcalDetId HDI;
00582
00583 int i=hashup(dcc,spigot,htrchan);
00584 HDI = HashToHDI(i);
00585 if (HDI==HcalDetId::Undefined) {
00586 return;
00587 }
00588 mydepth = HDI.depth();
00589 myphi = HDI.iphi();
00590 myeta = CalcEtaBin(HDI.subdet(),
00591 HDI.ieta(),
00592 mydepth);
00593 if (myeta>=0 && myeta<85 &&
00594 (myphi-1)>=0 && (myphi-1)<72 &&
00595 (mydepth-1)>=0 && (mydepth-1)<4){
00596 if (problemcount[myeta][myphi-1][mydepth-1]< n) {
00597 problemcount[myeta][myphi-1][mydepth-1]=n;
00598 if (debug_>0)
00599 std::cout<<" mapChannproblem found error! "<<HDI.subdet()<<"("<<HDI.ieta()<<", "<<HDI.iphi()<<", "<<HDI.depth()<<")"<<std::endl;
00600 }
00601 }
00602 }
00603
00604
00605 void HcalRawDataClient::normalizeHardwareSpaceHistos(void){
00607
00608
00609
00610
00611
00612
00613
00614
00615
00616
00617
00618
00619
00620
00621
00622
00623
00624
00625
00626
00627
00628
00629
00630
00631
00632
00633
00634
00635
00636
00637
00638
00639
00640
00641
00642
00643
00644
00645
00646
00647
00648
00649
00650
00651
00652
00653
00654
00655
00656
00657
00658
00659
00660
00661
00662
00663
00664
00665
00666
00667
00668
00669
00670
00671
00672
00673
00674
00675
00676
00677
00678
00679 }