00001
00002 #include "DQM/HcalMonitorTasks/interface/HcalRawDataMonitor.h"
00003 #include "EventFilter/HcalRawToDigi/interface/HcalDCCHeader.h"
00004 #include "CalibFormats/HcalObjects/interface/HcalDbService.h"
00005 #include "CalibFormats/HcalObjects/interface/HcalDbRecord.h"
00006 #include "FWCore/Framework/interface/LuminosityBlock.h"
00007
00008
00009 HcalRawDataMonitor::HcalRawDataMonitor(const edm::ParameterSet& ps) {
00010 Online_ = ps.getParameter<bool>("online");
00011 mergeRuns_ = ps.getParameter<bool>("mergeRuns");
00012 enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup");
00013 debug_ = ps.getUntrackedParameter<int>("debug",0);
00014 prefixME_ = ps.getUntrackedParameter<std::string>("subSystemFolder", "Hcal/");
00015 if (prefixME_.substr(prefixME_.size()-1,prefixME_.size())!="/")
00016 prefixME_.append("/");
00017 subdir_ = ps.getUntrackedParameter<std::string>("TaskFolder", "RawDataMonitor_Hcal/");
00018 if (subdir_.size()>0 && subdir_.substr(subdir_.size()-1,subdir_.size())!="/")
00019 subdir_.append("/");
00020 subdir_=prefixME_+subdir_;
00021 AllowedCalibTypes_ = ps.getUntrackedParameter<std::vector<int> > ("AllowedCalibTypes");
00022 skipOutOfOrderLS_ = ps.getUntrackedParameter<bool>("skipOutOfOrderLS",true);
00023 NLumiBlocks_ = ps.getUntrackedParameter<int>("NLumiBlocks",-1);
00024 makeDiagnostics_ = ps.getUntrackedParameter<bool>("makeDiagnostics",false);
00025
00026 FEDRawDataCollection_ = ps.getUntrackedParameter<edm::InputTag>("FEDRawDataCollection");
00027 digiLabel_ = ps.getUntrackedParameter<edm::InputTag>("digiLabel");
00028
00029 excludeHORing2_ = ps.getUntrackedParameter<bool>("excludeHORing2",false);
00030
00031
00032
00033
00034 meChann_DataIntegrityCheck_[0] =meCh_DataIntegrityFED00_;
00035 meChann_DataIntegrityCheck_[1] =meCh_DataIntegrityFED01_;
00036 meChann_DataIntegrityCheck_[2] =meCh_DataIntegrityFED02_;
00037 meChann_DataIntegrityCheck_[3] =meCh_DataIntegrityFED03_;
00038 meChann_DataIntegrityCheck_[4] =meCh_DataIntegrityFED04_;
00039 meChann_DataIntegrityCheck_[5] =meCh_DataIntegrityFED05_;
00040 meChann_DataIntegrityCheck_[6] =meCh_DataIntegrityFED06_;
00041 meChann_DataIntegrityCheck_[7] =meCh_DataIntegrityFED07_;
00042 meChann_DataIntegrityCheck_[8] =meCh_DataIntegrityFED08_;
00043 meChann_DataIntegrityCheck_[9] =meCh_DataIntegrityFED09_;
00044 meChann_DataIntegrityCheck_[10]=meCh_DataIntegrityFED10_;
00045 meChann_DataIntegrityCheck_[11]=meCh_DataIntegrityFED11_;
00046 meChann_DataIntegrityCheck_[12]=meCh_DataIntegrityFED12_;
00047 meChann_DataIntegrityCheck_[13]=meCh_DataIntegrityFED13_;
00048 meChann_DataIntegrityCheck_[14]=meCh_DataIntegrityFED14_;
00049 meChann_DataIntegrityCheck_[15]=meCh_DataIntegrityFED15_;
00050 meChann_DataIntegrityCheck_[16]=meCh_DataIntegrityFED16_;
00051 meChann_DataIntegrityCheck_[17]=meCh_DataIntegrityFED17_;
00052 meChann_DataIntegrityCheck_[18]=meCh_DataIntegrityFED18_;
00053 meChann_DataIntegrityCheck_[19]=meCh_DataIntegrityFED19_;
00054 meChann_DataIntegrityCheck_[20]=meCh_DataIntegrityFED20_;
00055 meChann_DataIntegrityCheck_[21]=meCh_DataIntegrityFED21_;
00056 meChann_DataIntegrityCheck_[22]=meCh_DataIntegrityFED22_;
00057 meChann_DataIntegrityCheck_[23]=meCh_DataIntegrityFED23_;
00058 meChann_DataIntegrityCheck_[24]=meCh_DataIntegrityFED24_;
00059 meChann_DataIntegrityCheck_[25]=meCh_DataIntegrityFED25_;
00060 meChann_DataIntegrityCheck_[26]=meCh_DataIntegrityFED26_;
00061 meChann_DataIntegrityCheck_[27]=meCh_DataIntegrityFED27_;
00062 meChann_DataIntegrityCheck_[28]=meCh_DataIntegrityFED28_;
00063 meChann_DataIntegrityCheck_[29]=meCh_DataIntegrityFED29_;
00064 meChann_DataIntegrityCheck_[30]=meCh_DataIntegrityFED30_;
00065 meChann_DataIntegrityCheck_[31]=meCh_DataIntegrityFED31_;
00066
00067 this->reset();
00068 }
00069
00070
00071 HcalRawDataMonitor::~HcalRawDataMonitor(){}
00072
00073
00074 void HcalRawDataMonitor::reset(void)
00075 {
00076
00077 for (int f=0; f<NUMDCCS; f++) {
00078 for (int s=0; s<15; s++) {
00079 UScount[f][s]=0;}}
00080
00081 for (int x=0; x<THREE_FED; x++)
00082 for (int y=0; y<THREE_SPG; y++)
00083 HalfHTRDataCorruptionIndicators_ [x][y]=0;
00084
00085 for (int x=0; x<THREE_FED; x++)
00086 for (int y=0; y<THREE_SPG; y++)
00087 LRBDataCorruptionIndicators_ [x][y]=0;
00088
00089 for (int x=0; x<TWO___FED; x++)
00090 for (int y=0; y<TWO__SPGT; y++)
00091 ChannSumm_DataIntegrityCheck_[x][y]=0;
00092
00093 for (int x=0; x<TWO___FED; x++)
00094 for (int y=0; y<THREE_SPG; y++)
00095 DataFlowInd_[x][y]=0;
00096
00097 for (int f=0; f<NUMDCCS; f++)
00098 for (int x=0; x< TWO_CHANN; x++)
00099 for (int y=0; y<TWO__SPGT; y++)
00100 Chann_DataIntegrityCheck_ [f][x][y]=0;
00101
00102 for (int i=0; i<(NUMDCCS * NUMSPIGS * HTRCHANMAX); i++)
00103 hashedHcalDetId_[i]=HcalDetId::Undefined;
00104
00105 for (int d=0; d<DEPTHBINS; d++) {
00106 for (int eta=0; eta<ETABINS; eta++) {
00107 for (int phi=0; phi<PHIBINS; phi++){
00108 uniqcounter[eta][phi][d] = 0.0;
00109 problemcount[eta][phi][d] = 0.0;
00110 problemfound[eta][phi][d] = false;
00111 }
00112 }
00113 }
00114
00115
00116 NumBadHB=0;
00117 NumBadHE=0;
00118 NumBadHO=0;
00119 NumBadHF=0;
00120 NumBadHFLUMI=0;
00121 NumBadHO0=0;
00122 NumBadHO12=0;
00123
00124 }
00125
00126
00127 void HcalRawDataMonitor::beginRun(const edm::Run& run, const edm::EventSetup& c){
00128 HcalBaseDQMonitor::beginRun(run,c);
00129 edm::ESHandle<HcalDbService> pSetup;
00130 c.get<HcalDbRecord>().get( pSetup );
00131
00132 readoutMap_=pSetup->getHcalMapping();
00133 DetId detid_;
00134 HcalDetId hcaldetid_;
00135
00136
00137 std::vector <HcalElectronicsId> AllElIds = readoutMap_->allElectronicsIdPrecision();
00138 uint32_t itsdcc =0;
00139 uint32_t itsspigot =0;
00140 uint32_t itshtrchan=0;
00141
00142
00143 for (std::vector <HcalElectronicsId>::iterator eid = AllElIds.begin();
00144 eid != AllElIds.end();
00145 eid++) {
00146
00147
00148 detid_ = readoutMap_->lookup(*eid);
00149
00150 if (!detid_.null()) {
00151 if (detid_.det()!=4) continue;
00152 if (detid_.subdetId()!=HcalBarrel &&
00153 detid_.subdetId()!=HcalEndcap &&
00154 detid_.subdetId()!=HcalOuter &&
00155 detid_.subdetId()!=HcalForward) continue;
00156
00157 itsdcc =(uint32_t) eid->dccid();
00158 itsspigot =(uint32_t) eid->spigot();
00159 itshtrchan=(uint32_t) eid->htrChanId();
00160 hcaldetid_ = HcalDetId(detid_);
00161 stashHDI(hashup(itsdcc,itsspigot,itshtrchan),
00162 hcaldetid_);
00163 }
00164 }
00165 }
00166
00167
00168 void HcalRawDataMonitor::beginLuminosityBlock(const edm::LuminosityBlock& lumiSeg,
00169 const edm::EventSetup& c) {
00170 if (LumiInOrder(lumiSeg.luminosityBlock())==false) return;
00171 HcalBaseDQMonitor::beginLuminosityBlock(lumiSeg,c);
00172
00173 ProblemsCurrentLB->Reset();
00174 return;
00175 }
00176
00177 void HcalRawDataMonitor::setup(void){
00178
00179 HcalBaseDQMonitor::setup();
00180 if (!dbe_) {
00181 if (debug_>1)
00182 std::cout <<"<HcalRawDataMonitor::setup> No DQMStore instance available. Bailing out."<<std::endl;
00183 return;}
00184
00185
00186 if (debug_>1)
00187 std::cout <<"<HcalRawDataMonitor::beginRun> Setting up histograms"<<std::endl;
00188
00189 dbe_->setCurrentFolder(subdir_);
00190 ProblemsVsLB=dbe_->bookProfile("RAW_Problems_HCAL_vs_LS",
00191 "Total HCAL RAW Problems vs lumi section",
00192 NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
00193
00194 ProblemsVsLB_HB=dbe_->bookProfile("Total_RAW_Problems_HB_vs_LS",
00195 "Total HB RAW Problems vs lumi section",
00196 NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,3000);
00197 ProblemsVsLB_HE=dbe_->bookProfile("Total_RAW_Problems_HE_vs_LS",
00198 "Total HE RAW Problems vs lumi section",
00199 NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,3000);
00200 ProblemsVsLB_HO=dbe_->bookProfile("Total_RAW_Problems_HO_vs_LS",
00201 "Total HO RAW Problems vs lumi section",
00202 NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,3000);
00203 ProblemsVsLB_HF=dbe_->bookProfile("Total_RAW_Problems_HF_vs_LS",
00204 "Total HF RAW Problems vs lumi section",
00205 NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,2000);
00206 ProblemsVsLB_HBHEHF=dbe_->bookProfile("Total_RAW_Problems_HBHEHF_vs_LS",
00207 "Total HBHEHF RAW Problems vs lumi section",
00208 NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,2000);
00209
00210 ProblemsVsLB->getTProfile()->SetMarkerStyle(20);
00211 ProblemsVsLB_HB->getTProfile()->SetMarkerStyle(20);
00212 ProblemsVsLB_HE->getTProfile()->SetMarkerStyle(20);
00213 ProblemsVsLB_HO->getTProfile()->SetMarkerStyle(20);
00214 ProblemsVsLB_HF->getTProfile()->SetMarkerStyle(20);
00215 ProblemsVsLB_HBHEHF->getTProfile()->SetMarkerStyle(20);
00216 MonitorElement* excludeHO2=dbe_->bookInt("ExcludeHOring2");
00217
00218 if (excludeHO2) excludeHO2->Fill(excludeHORing2_==true ? 1 : 0);
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232 std::string type;
00233
00234 dbe_->setCurrentFolder(subdir_ + "Corruption");
00235 type = "01 Common Data Format violations";
00236 meCDFErrorFound_ = dbe_->book2D(type,type,32,699.5,731.5,9,0.5,9.5);
00237 meCDFErrorFound_->setAxisTitle("HCAL FED ID", 1);
00238 meCDFErrorFound_->setBinLabel(1, "Hdr1BitUnset", 2);
00239 meCDFErrorFound_->setBinLabel(2, "FmtNumChange", 2);
00240 meCDFErrorFound_->setBinLabel(3, "BOE not '0x5'", 2);
00241 meCDFErrorFound_->setBinLabel(4, "Hdr2Bit Set", 2);
00242 meCDFErrorFound_->setBinLabel(5, "Hdr1 36-55", 2);
00243 meCDFErrorFound_->setBinLabel(6, "BOE not 0", 2);
00244 meCDFErrorFound_->setBinLabel(7, "Trlr1Bit Set", 2);
00245 meCDFErrorFound_->setBinLabel(8, "Size Error", 2);
00246 meCDFErrorFound_->setBinLabel(9, "TrailerBad", 2);
00247
00248 type = "02 DCC Event Format violation";
00249 meDCCEventFormatError_ = dbe_->book2D(type,type,32,699.5,731.5,6,0.5,6.5);
00250 meDCCEventFormatError_->setAxisTitle("HCAL FED ID", 1);
00251 meDCCEventFormatError_->setBinLabel(1, "FmtVers Changed", 2);
00252 meDCCEventFormatError_->setBinLabel(2, "StrayBits Changed", 2);
00253 meDCCEventFormatError_->setBinLabel(3, "HTRStatusPad", 2);
00254 meDCCEventFormatError_->setBinLabel(4, "32bitPadErr", 2);
00255 meDCCEventFormatError_->setBinLabel(5, "Number Mismatch Bit Miscalc", 2);
00256 meDCCEventFormatError_->setBinLabel(6, "Low 8 HTR Status Bits Miscopy", 2);
00257
00258 type = "04 HTR BCN when OrN Diff";
00259 meBCNwhenOrNDiff_ = dbe_->book1D(type,type,3564,-0.5,3563.5);
00260 meBCNwhenOrNDiff_->setAxisTitle("BCN",1);
00261 meBCNwhenOrNDiff_->setAxisTitle("# of Entries",2);
00262
00263 type = "03 OrN NonZero Difference HTR - DCC";
00264 meOrNCheck_ = dbe_->book1D(type,type,65,-32.5,32.5);
00265 meOrNCheck_->setAxisTitle("htr OrN - dcc OrN",1);
00266
00267 type = "03 OrN Inconsistent - HTR vs DCC";
00268 meOrNSynch_= dbe_->book2D(type,type,32,700,732, 15,0,15);
00269 meOrNSynch_->setAxisTitle("FED #",1);
00270 meOrNSynch_->setAxisTitle("Spigot #",2);
00271
00272 type = "05 BCN NonZero Difference HTR - DCC";
00273 meBCNCheck_ = dbe_->book1D(type,type,501,-250.5,250.5);
00274 meBCNCheck_->setAxisTitle("htr BCN - dcc BCN",1);
00275
00276 type = "05 BCN Inconsistent - HTR vs DCC";
00277 meBCNSynch_= dbe_->book2D(type,type,32,700,732, 15,0,15);
00278 meBCNSynch_->setAxisTitle("FED #",1);
00279 meBCNSynch_->setAxisTitle("Slot #",2);
00280
00281 type = "06 EvN NonZero Difference HTR - DCC";
00282 meEvtNCheck_ = dbe_->book1D(type,type,601,-300.5,300.5);
00283 meEvtNCheck_->setAxisTitle("htr Evt # - dcc Evt #",1);
00284
00285 type = "06 EvN Inconsistent - HTR vs DCC";
00286 meEvtNumberSynch_= dbe_->book2D(type,type,32,700,732, 15,0,15);
00287 meEvtNumberSynch_->setAxisTitle("FED #",1);
00288 meEvtNumberSynch_->setAxisTitle("Slot #",2);
00289
00290
00291
00292
00293
00294
00295 type="07 LRB Data Corruption Indicators";
00296 meLRBDataCorruptionIndicators_= dbe_->book2D(type,type,
00297 THREE_FED,0,THREE_FED,
00298 THREE_SPG,0,THREE_SPG);
00299 label_xFEDs (meLRBDataCorruptionIndicators_, 4);
00300 label_ySpigots(meLRBDataCorruptionIndicators_, 4);
00301
00302
00303
00304
00305
00306
00307 type="08 Half-HTR Data Corruption Indicators";
00308 meHalfHTRDataCorruptionIndicators_= dbe_->book2D(type,type,
00309 THREE_FED,0,THREE_FED,
00310 THREE_SPG,0,THREE_SPG);
00311 label_xFEDs (meHalfHTRDataCorruptionIndicators_, 4);
00312 label_ySpigots(meHalfHTRDataCorruptionIndicators_, 4);
00313
00314
00315
00316
00317
00318 type = "09 Channel Integrity Summarized by Spigot";
00319 meChannSumm_DataIntegrityCheck_= dbe_->book2D(type,type,
00320 TWO___FED,0,TWO___FED,
00321 TWO__SPGT,0,TWO__SPGT);
00322 label_xFEDs (meChannSumm_DataIntegrityCheck_, 3);
00323 label_ySpigots(meChannSumm_DataIntegrityCheck_, 3);
00324
00325 dbe_->setCurrentFolder(subdir_ + "Corruption/Channel Data Integrity");
00326 char label[256];
00327 for (int f=0; f<NUMDCCS; f++){
00328 snprintf(label, 256, "FED %03d Channel Integrity", f+700);
00329 meChann_DataIntegrityCheck_[f] = dbe_->book2D(label,label,
00330 TWO_CHANN,0,TWO_CHANN,
00331 TWO__SPGT,0,TWO__SPGT);
00332 label_xChanns (meChann_DataIntegrityCheck_[f], 3);
00333 label_ySpigots(meChann_DataIntegrityCheck_[f], 3);
00334 ;}
00335
00336 dbe_->setCurrentFolder(subdir_ + "Data Flow");
00337 type="DCC Event Counts";
00338 mefedEntries_ = dbe_->book1D(type,type,32,699.5,731.5);
00339
00340 type = "BCN from DCCs";
00341 medccBCN_ = dbe_->book1D(type,type,3564,-0.5,3563.5);
00342 medccBCN_->setAxisTitle("BCN",1);
00343 medccBCN_->setAxisTitle("# of Entries",2);
00344
00345 type = "BCN from HTRs";
00346 meBCN_ = dbe_->book1D(type,type,3564,-0.5,3563.5);
00347 meBCN_->setAxisTitle("BCN",1);
00348 meBCN_->setAxisTitle("# of Entries",2);
00349
00350 type = "DCC Data Block Size Distribution";
00351 meFEDRawDataSizes_=dbe_->book1D(type,type,1200,-0.5,12000.5);
00352 meFEDRawDataSizes_->setAxisTitle("# of bytes",1);
00353 meFEDRawDataSizes_->setAxisTitle("# of Data Blocks",2);
00354
00355 type = "DCC Data Block Size Profile";
00356 meEvFragSize_ = dbe_->bookProfile(type,type,32,699.5,731.5,100,-1000.0,12000.0,"");
00357 type = "DCC Data Block Size Each FED";
00358 meEvFragSize2_ = dbe_->book2D(type,type,64,699.5,731.5, 240,0,12000);
00359
00360
00361
00362
00363
00364
00365
00366
00367 type = "01 Data Flow Indicators";
00368 meDataFlowInd_= dbe_->book2D(type,type,
00369 TWO___FED,0,TWO___FED,
00370 THREE_SPG,0,THREE_SPG);
00371 label_xFEDs (meDataFlowInd_, 3);
00372 label_ySpigots(meDataFlowInd_, 4);
00373
00374 dbe_->setCurrentFolder(subdir_ + "Diagnostics");
00375
00376 type = "DCC Firmware Version";
00377 meDCCVersion_ = dbe_->bookProfile(type,type, 32, 699.5, 731.5, 256, -0.5, 255.5);
00378 meDCCVersion_ ->setAxisTitle("FED ID", 1);
00379
00380 type = "HTR Status Word HBHE";
00381 HTR_StatusWd_HBHE = dbe_->book1D(type,type,16,-0.5,15.5);
00382 labelHTRBits(HTR_StatusWd_HBHE,1);
00383
00384 type = "HTR Status Word HF";
00385 HTR_StatusWd_HF = dbe_->book1D(type,type,16,-0.5,15.5);
00386 labelHTRBits(HTR_StatusWd_HF,1);
00387
00388 type = "HTR Status Word HO";
00389 HTR_StatusWd_HO = dbe_->book1D(type,type,16,-0.5,15.5);
00390 labelHTRBits(HTR_StatusWd_HO,1);
00391
00392 int maxbits = 16;
00393 type = "HTR Status Word by Crate";
00394 meStatusWdCrate_ = dbe_->book2D(type,type,18,-0.5,17.5,maxbits,-0.5,maxbits-0.5);
00395 meStatusWdCrate_ -> setAxisTitle("Crate #",1);
00396 labelHTRBits(meStatusWdCrate_,2);
00397
00398 type = "Unpacking - HcalHTRData check failures";
00399 meInvHTRData_= dbe_->book2D(type,type,16,-0.5,15.5,32,699.5,731.5);
00400 meInvHTRData_->setAxisTitle("Spigot #",1);
00401 meInvHTRData_->setAxisTitle("DCC #",2);
00402
00403 type = "HTR Fiber Orbit Message BCN";
00404 meFibBCN_ = dbe_->book1D(type,type,3564,-0.5,3563.5);
00405 meFibBCN_->setAxisTitle("BCN of Fib Orb Msg",1);
00406
00407 type = "HTR Status Word - Crate 0";
00408 meCrate0HTRStatus_ = dbe_->book2D(type,type,40,-0.25,19.75,maxbits,-0.5,maxbits-0.5);
00409 meCrate0HTRStatus_ ->setAxisTitle("Slot #",1);
00410 labelHTRBits(meCrate0HTRStatus_,2);
00411
00412 type = "HTR Status Word - Crate 1";
00413 meCrate1HTRStatus_ = dbe_->book2D(type,type,40,-0.25,19.75,maxbits,-0.5,maxbits-0.5);
00414 meCrate1HTRStatus_ ->setAxisTitle("Slot #",1);
00415 labelHTRBits(meCrate1HTRStatus_,2);
00416
00417 type = "HTR Status Word - Crate 2";
00418 meCrate2HTRStatus_ = dbe_->book2D(type,type,40,-0.25,19.75,maxbits,-0.5,maxbits-0.5);
00419 meCrate2HTRStatus_ ->setAxisTitle("Slot #",1);
00420 labelHTRBits(meCrate2HTRStatus_,2);
00421
00422 type = "HTR Status Word - Crate 3";
00423 meCrate3HTRStatus_ = dbe_->book2D(type,type,40,-0.25,19.75,maxbits,-0.5,maxbits-0.5);
00424 meCrate3HTRStatus_ ->setAxisTitle("Slot #",1);
00425 labelHTRBits(meCrate3HTRStatus_,2);
00426
00427 type = "HTR Status Word - Crate 4";
00428 meCrate4HTRStatus_ = dbe_->book2D(type,type,40,-0.25,19.75,maxbits,-0.5,maxbits-0.5);
00429 meCrate4HTRStatus_ ->setAxisTitle("Slot #",1);
00430 labelHTRBits(meCrate4HTRStatus_,2);
00431
00432 type = "HTR Status Word - Crate 5";
00433 meCrate5HTRStatus_ = dbe_->book2D(type,type,40,-0.25,19.75,maxbits,-0.5,maxbits-0.5);
00434 meCrate5HTRStatus_ ->setAxisTitle("Slot #",1);
00435 labelHTRBits(meCrate5HTRStatus_,2);
00436
00437 type = "HTR Status Word - Crate 6";
00438 meCrate6HTRStatus_ = dbe_->book2D(type,type,40,-0.25,19.75,maxbits,-0.5,maxbits-0.5);
00439 meCrate6HTRStatus_ ->setAxisTitle("Slot #",1);
00440 labelHTRBits(meCrate6HTRStatus_,2);
00441
00442 type = "HTR Status Word - Crate 7";
00443 meCrate7HTRStatus_ = dbe_->book2D(type,type,40,-0.25,19.75,maxbits,-0.5,maxbits-0.5);
00444 meCrate7HTRStatus_ ->setAxisTitle("Slot #",1);
00445 labelHTRBits(meCrate7HTRStatus_,2);
00446
00447 type = "HTR Status Word - Crate 9";
00448 meCrate9HTRStatus_ = dbe_->book2D(type,type,40,-0.25,19.75,maxbits,-0.5,maxbits-0.5);
00449 meCrate9HTRStatus_ ->setAxisTitle("Slot #",1);
00450 labelHTRBits(meCrate9HTRStatus_,2);
00451
00452 type = "HTR Status Word - Crate 10";
00453 meCrate10HTRStatus_ = dbe_->book2D(type,type,40,-0.25,19.75,maxbits,-0.5,maxbits-0.5);
00454 meCrate10HTRStatus_ ->setAxisTitle("Slot #",1);
00455 labelHTRBits(meCrate10HTRStatus_,2);
00456
00457 type = "HTR Status Word - Crate 11";
00458 meCrate11HTRStatus_ = dbe_->book2D(type,type,40,-0.25,19.75,maxbits,-0.5,maxbits-0.5);
00459 meCrate11HTRStatus_ ->setAxisTitle("Slot #",1);
00460 labelHTRBits(meCrate11HTRStatus_,2);
00461
00462 type = "HTR Status Word - Crate 12";
00463 meCrate12HTRStatus_ = dbe_->book2D(type,type,40,-0.25,19.75,maxbits,-0.5,maxbits-0.5);
00464 meCrate12HTRStatus_ ->setAxisTitle("Slot #",1);
00465 labelHTRBits(meCrate12HTRStatus_,2);
00466
00467 type = "HTR Status Word - Crate 13";
00468 meCrate13HTRStatus_ = dbe_->book2D(type,type,40,-0.25,19.75,maxbits,-0.5,maxbits-0.5);
00469 meCrate13HTRStatus_ ->setAxisTitle("Slot #",1);
00470 labelHTRBits(meCrate13HTRStatus_,2);
00471
00472 type = "HTR Status Word - Crate 14";
00473 meCrate14HTRStatus_ = dbe_->book2D(type,type,40,-0.25,19.75,maxbits,-0.5,maxbits-0.5);
00474 meCrate14HTRStatus_ ->setAxisTitle("Slot #",1);
00475 labelHTRBits(meCrate14HTRStatus_,2);
00476
00477 type = "HTR Status Word - Crate 15";
00478 meCrate15HTRStatus_ = dbe_->book2D(type,type,40,-0.25,19.75,maxbits,-0.5,maxbits-0.5);
00479 meCrate15HTRStatus_ ->setAxisTitle("Slot #",1);
00480 labelHTRBits(meCrate15HTRStatus_,2);
00481
00482 type = "HTR Status Word - Crate 17";
00483 meCrate17HTRStatus_ = dbe_->book2D(type,type,40,-0.25,19.75,maxbits,-0.5,maxbits-0.5);
00484 meCrate17HTRStatus_ ->setAxisTitle("Slot #",1);
00485 labelHTRBits(meCrate17HTRStatus_,2);
00486
00487 type = "HTR UnSuppressed Event Fractions";
00488 meUSFractSpigs_ = dbe_->book1D(type,type,481,0,481);
00489 for(int f=0; f<NUMDCCS; f++) {
00490 snprintf(label, 256, "FED 7%02d", f);
00491 meUSFractSpigs_->setBinLabel(1+(HcalDCCHeader::SPIGOT_COUNT*f), label);
00492 for(int s=1; s<HcalDCCHeader::SPIGOT_COUNT; s++) {
00493 snprintf(label, 256, "sp%02d", s);
00494 meUSFractSpigs_->setBinLabel(1+(HcalDCCHeader::SPIGOT_COUNT*f)+s, label);}}
00495
00496
00497 type = "HTR Firmware Version";
00498
00499
00500 meHTRFWVersion_ = dbe_->book2D(type,type ,18,-0.5,17.5,180,75.5,255.5);
00501 meHTRFWVersion_->setAxisTitle("Crate #",1);
00502 meHTRFWVersion_->setAxisTitle("HTR Firmware Version",2);
00503
00504 type = "HTR Fiber 1 Orbit Message BCNs";
00505 meFib1OrbMsgBCN_= dbe_->book2D(type,type,40,-0.25,19.75,18,-0.5,17.5);
00506 type = "HTR Fiber 2 Orbit Message BCNs";
00507 meFib2OrbMsgBCN_= dbe_->book2D(type,type,40,-0.25,19.75,18,-0.5,17.5);
00508 type = "HTR Fiber 3 Orbit Message BCNs";
00509 meFib3OrbMsgBCN_= dbe_->book2D(type,type,40,-0.25,19.75,18,-0.5,17.5);
00510 type = "HTR Fiber 4 Orbit Message BCNs";
00511 meFib4OrbMsgBCN_= dbe_->book2D(type,type,40,-0.25,19.75,18,-0.5,17.5);
00512 type = "HTR Fiber 5 Orbit Message BCNs";
00513 meFib5OrbMsgBCN_= dbe_->book2D(type,type,40,-0.25,19.75,18,-0.5,17.5);
00514 type = "HTR Fiber 6 Orbit Message BCNs";
00515 meFib6OrbMsgBCN_= dbe_->book2D(type,type,40,-0.25,19.75,18,-0.5,17.5);
00516 type = "HTR Fiber 7 Orbit Message BCNs";
00517 meFib7OrbMsgBCN_= dbe_->book2D(type,type,40,-0.25,19.75,18,-0.5,17.5);
00518 type = "HTR Fiber 8 Orbit Message BCNs";
00519 meFib8OrbMsgBCN_= dbe_->book2D(type,type,40,-0.25,19.75,18,-0.5,17.5);
00520
00521 }
00522
00523
00524 void HcalRawDataMonitor::analyze(const edm::Event& e, const edm::EventSetup& s){
00525 if (!IsAllowedCalibType()) return;
00526 if (LumiInOrder(e.luminosityBlock())==false) return;
00527
00528 HcalBaseDQMonitor::analyze(e,s);
00529
00530
00531 edm::Handle<FEDRawDataCollection> rawraw;
00532 if (!(e.getByLabel(FEDRawDataCollection_,rawraw)))
00533
00534 {
00535 edm::LogWarning("HcalRawDataMonitor")<<" raw data with label "<<FEDRawDataCollection_ <<" not available";
00536 return;
00537 }
00538 edm::Handle<HcalUnpackerReport> report;
00539 if (!(e.getByLabel(digiLabel_,report)))
00540 {
00541 edm::LogWarning("HcalRawDataMonitor")<<" Unpacker Report "<<digiLabel_<<" not available";
00542 return;
00543 }
00544
00545
00546 if (debug_>1) std::cout <<"\t<HcalRawDataMonitor::analyze> Processing good event! event # = "<<ievt_<<std::endl;
00547
00548
00549 processEvent(*rawraw, *report);
00550
00551
00552
00553 for (int d=0; d<DEPTHBINS; d++) {
00554 for (int eta=0; eta<ETABINS; eta++) {
00555 int ieta=CalcIeta(eta,d+1);
00556 if (ieta==-9999) continue;
00557 for (int phi=0; phi<PHIBINS; phi++){
00558 if (problemcount[eta][phi][d]) {
00559
00560 HcalSubdetector subdet=HcalEmpty;
00561 if (isHB(eta,d+1))subdet=HcalBarrel;
00562 else if (isHE(eta,d+1)) subdet=HcalEndcap;
00563 else if (isHF(eta,d+1)) subdet=HcalForward;
00564 else if (isHO(eta,d+1)) subdet=HcalOuter;
00565 if (subdet!=HcalEmpty){
00566 if (subdet==HcalBarrel) {if(uniqcounter[eta][phi][d]<1) NumBadHB+= problemcount[eta][phi][d]; uniqcounter[eta][phi][d]++; }
00567 else if (subdet==HcalEndcap) {if(uniqcounter[eta][phi][d]<1) NumBadHE+= problemcount[eta][phi][d]; uniqcounter[eta][phi][d]++; }
00569 else if (subdet==HcalOuter)
00570 {
00571 if(uniqcounter[eta][phi][d]<1)
00572 NumBadHO += problemcount[eta][phi][d];
00573 uniqcounter[eta][phi][d]++;
00574 if (abs(ieta)<5) NumBadHO0+= problemcount[eta][phi][d];
00575 else NumBadHO12+= problemcount[eta][phi][d];
00576 }
00577 else if (subdet==HcalForward)
00578 {
00579 if(uniqcounter[eta][phi][d]<1)
00580 NumBadHF+= problemcount[eta][phi][d];
00581 uniqcounter[eta][phi][d]++;
00582 if (d==1 && (abs(ieta)==33 || abs(ieta)==34))
00583 NumBadHFLUMI+= problemcount[eta][phi][d];
00584 else if (d==2 && (abs(ieta)==35 || abs(ieta)==36))
00585 NumBadHFLUMI+= problemcount[eta][phi][d];
00586 }
00587 }
00588 problemcount[eta][phi][d]=0;
00589 }
00590 }
00591 }
00592 }
00593 }
00594
00595 void HcalRawDataMonitor::processEvent(const FEDRawDataCollection& rawraw,
00596 const HcalUnpackerReport& report){
00597 if(!dbe_) {
00598 if (debug_>1)
00599 printf("HcalRawDataMonitor::processEvent DQMStore not instantiated!\n");
00600 return;}
00601
00602
00603 meLRBDataCorruptionIndicators_->update();
00604 meHalfHTRDataCorruptionIndicators_->update();
00605 meChannSumm_DataIntegrityCheck_->update();
00606 for (int f=0; f<NUMDCCS; f++)
00607 meChann_DataIntegrityCheck_[f]->update();
00608 meDataFlowInd_->update();
00609
00610
00611 for (int i=FEDNumbering::MINHCALFEDID; i<=FEDNumbering::MAXHCALFEDID; i++) {
00612 const FEDRawData& fed = rawraw.FEDData(i);
00613 if (fed.size()<12) continue;
00614
00615 int value = (int)((const HcalDCCHeader*)(fed.data()))->getCalibType() ;
00616 if(value>7)
00617 {
00618 edm::LogWarning("HcalMonitorModule::CalibTypeFilter") << "Unexpected Calibration type: "<< value << " in FED: "<<i<<" (should be 0-7). I am bailing out...";
00619 return;
00620 }
00621
00622 unpack(fed);
00623 }
00624
00625
00626 for (int x=0; x<ETABINS; x++)
00627 for (int y=0; y<PHIBINS; y++)
00628 for (int z=0; z<DEPTHBINS; z++)
00629 if (problemfound[x][y][z]) {
00630 problemcount[x][y][z]++;
00631 problemfound[x][y][z]=false;
00632 }
00633 return;
00634 }
00635
00636
00637 void HcalRawDataMonitor::unpack(const FEDRawData& raw){
00638
00639
00640 const HcalDCCHeader* dccHeader=(const HcalDCCHeader*)(raw.data());
00641 if(!dccHeader) return;
00642 unsigned char* trailer_ptr = (unsigned char*) (raw.data()+raw.size()-sizeof(uint64_t));
00643 FEDTrailer trailer = FEDTrailer(trailer_ptr);
00644
00645
00646 int dccid=dccHeader->getSourceId();
00647
00648 int dcc_=std::max(0,dccid-700);
00649 dcc_ = std::min(dcc_,31);
00650 if(debug_>1) std::cout << "DCC " << dccid << std::endl;
00651 uint64_t* dccfw= (uint64_t*) (raw.data()+(sizeof(uint64_t)*2));
00652 int dcc_fw = ( ((*dccfw)>>(6*8))&0x00000000000000FF );
00653 meDCCVersion_ -> Fill(dccid,dcc_fw);
00654
00655
00656 uint64_t* lastDataWord = (uint64_t*) ( raw.data()+(raw.size())-(1*sizeof(uint64_t)) );
00657 int EvFragLength = (int) (*lastDataWord>>(4*8)) & 0x0000000000FFFFFF ;
00658 meFEDRawDataSizes_->Fill(EvFragLength*8);
00659 meEvFragSize_ ->Fill(dccid, EvFragLength*8);
00660 meEvFragSize2_ ->Fill(dccid, EvFragLength*8);
00661
00662
00663 unsigned long dccEvtNum = dccHeader->getDCCEventNumber();
00664 int dccBCN = dccHeader->getBunchId();
00665
00666 unsigned int dccOrN = (unsigned int) (dccHeader->getOrbitNumber() & 0x0000001F);
00667 medccBCN_ -> Fill(dccBCN);
00668
00670 bool CDFProbThisDCC = false;
00671
00672 if (!dccHeader->thereIsASecondCDFHeaderWord()
00673
00674
00675 ) {
00676 meCDFErrorFound_->Fill(dccid, 1);
00677 CDFProbThisDCC = true;
00678 }
00679
00680 CDFvers_it = CDFversionNumber_list.find(dccid);
00681 if (CDFvers_it == CDFversionNumber_list.end()) {
00682 CDFversionNumber_list.insert(std::pair<int,short>
00683 (dccid,dccHeader->getCDFversionNumber() ) );
00684 CDFvers_it = CDFversionNumber_list.find(dccid);
00685 }
00686 if (dccHeader->getCDFversionNumber()!= CDFvers_it->second) {
00687 meCDFErrorFound_->Fill(dccid,2);
00688 CDFProbThisDCC = true;
00689 }
00690
00691 if (dccHeader->BOEshouldBe5Always()!=5) {
00692 meCDFErrorFound_->Fill(dccid, 3);
00693 CDFProbThisDCC = true;
00694 }
00695
00696 if (dccHeader->thereIsAThirdCDFHeaderWord()) {
00697 meCDFErrorFound_->Fill(dccid, 4);
00698 CDFProbThisDCC = true;
00699 }
00700
00701 CDFReservedBits_it = CDFReservedBits_list.find(dccid);
00702 if (CDFReservedBits_it == CDFReservedBits_list.end()) {
00703 CDFReservedBits_list.insert(std::pair<int,short>
00704 (dccid,dccHeader->getSlink64ReservedBits() & 0x0000FFFF ) );
00705 CDFReservedBits_it = CDFReservedBits_list.find(dccid);
00706 }
00707 if (((int) dccHeader->getSlink64ReservedBits() & 0x0000FFFF ) != CDFReservedBits_it->second) {
00708 meCDFErrorFound_->Fill(dccid,5);
00709
00710 }
00711
00712 if (dccHeader->BOEshouldBeZeroAlways() !=0) {
00713 meCDFErrorFound_->Fill(dccid, 6);
00714 CDFProbThisDCC = true;
00715 }
00716
00717 if (trailer.moreTrailers()) {
00718 meCDFErrorFound_->Fill(dccid, 7);
00719 CDFProbThisDCC = true;
00720 }
00721
00722
00723 if ((uint64_t) raw.size() != ( (uint64_t) trailer.lenght()*sizeof(uint64_t)) )
00724 {
00725 meCDFErrorFound_->Fill(dccid, 8);
00726 CDFProbThisDCC = true;
00727 }
00728
00729 if (!trailer.check()) {
00730 meCDFErrorFound_->Fill(dccid, 9);
00731 CDFProbThisDCC = true;
00732 }
00733 if (CDFProbThisDCC) {
00734
00735 mapDCCproblem(dcc_);
00736 if (debug_>0) std::cout <<"CDFProbThisDCC"<<std::endl;
00737 }
00738
00739 mefedEntries_->Fill(dccid);
00740
00741 CDFProbThisDCC = false;
00742
00743 char CRC_err;
00744 for(int i=0; i<HcalDCCHeader::SPIGOT_COUNT; i++) {
00745 CRC_err = ((dccHeader->getSpigotSummary(i) >> 10) & 0x00000001);
00746 if (CRC_err) {
00747 mapDCCproblem(dcc_);
00748
00749 if (debug_>0) std::cout <<"HTR Problem: CRC_err"<<std::endl;
00750 }
00751 }
00752
00753
00754 char TTS_state = (char)trailer.ttsBits();
00755
00756 char L1AtimeTTS_state=(char) dccHeader->getAcceptTimeTTS();
00757 if (TTS_state==L1AtimeTTS_state) ;
00758
00760
00761 DCCEvtFormat_it = DCCEvtFormat_list.find(dccid);
00762 if (DCCEvtFormat_it == DCCEvtFormat_list.end()) {
00763 DCCEvtFormat_list.insert(std::pair<int,short>
00764 (dccid,dccHeader->getDCCDataFormatVersion() ) );
00765 DCCEvtFormat_it = DCCEvtFormat_list.find(dccid);
00766 }
00767 if (dccHeader->getDCCDataFormatVersion()!= DCCEvtFormat_it->second) {
00768 meDCCEventFormatError_->Fill(dccid,1);
00769 mapDCCproblem(dcc_);
00770 if (debug_>0)std::cout <<"DCC Error Type 1"<<std::endl;
00771 }
00772
00773 if (false)
00774 {
00775 meDCCEventFormatError_->Fill(dccid,2);
00776 mapDCCproblem(dcc_);
00777 if (debug_>0)std::cout <<"DCC Error Type 2"<<std::endl;
00778 }
00779
00780 int SpigotPad = HcalDCCHeader::SPIGOT_COUNT;
00781 if ( (((uint64_t) dccHeader->getSpigotSummary(SpigotPad) )
00782 | ((uint64_t) dccHeader->getSpigotSummary(SpigotPad+1))
00783 | ((uint64_t) dccHeader->getSpigotSummary(SpigotPad+2))) != 0){
00784 meDCCEventFormatError_->Fill(dccid,3);
00785 mapDCCproblem(dcc_);
00786 if (debug_>0)std::cout <<"DCC Error Type 3"<<std::endl;
00787 }
00788
00789 int nHTR32BitWords=0;
00790
00791 for(int i=0; i<HcalDCCHeader::SPIGOT_COUNT; i++) {
00792 nHTR32BitWords += dccHeader->getSpigotDataLength(i); }
00793
00794 if (( nHTR32BitWords % 2) == 1) {
00795 uint64_t* lastDataWord = (uint64_t*) ( raw.data()+raw.size()-(2*sizeof(uint64_t)) );
00796 if ((*lastDataWord>>32) != 0x00000000){
00797 meDCCEventFormatError_->Fill(dccid, 4);
00798 mapDCCproblem(dcc_);
00799 if (debug_>0)std::cout <<"DCC Error Type 4"<<std::endl;
00800 }
00801 }
00802
00803
00804
00805
00806
00807
00808
00809 const int fed3offset = 1 + (4*dcc_);
00810 const int fed2offset = 1 + (3*dcc_);
00811 if (TTS_state & 0x8)
00812 ;
00813 if (TTS_state & 0x2)
00814 {
00815 mapDCCproblem(dcc_);
00816 if (debug_>0)std::cout <<"TTS_state Error:sync"<<std::endl;
00817 }
00818
00819 int WholeErrorList=0;
00820 for(int spigot=0; spigot<HcalDCCHeader::SPIGOT_COUNT; spigot++) {
00821 if (!( dccHeader->getSpigotEnabled((unsigned int) spigot)) )
00822 continue;
00823
00824 const int spg3offset = 1 + (4*spigot);
00825
00826 if (TTS_state & 0x4)
00827 ++DataFlowInd_[fed2offset+1][spg3offset+1];
00828 if (TTS_state & 0x1)
00829 ++DataFlowInd_[fed2offset+1][spg3offset+2];
00830
00831 WholeErrorList=dccHeader->getLRBErrorBits((unsigned int) spigot);
00832 if (WholeErrorList!=0) {
00833 if ((WholeErrorList>>0)&0x01)
00834 DataFlowInd_[fed2offset-1][spg3offset-1]++;
00835 if (((WholeErrorList>>1)&0x01)!=0) {
00836 LRBDataCorruptionIndicators_[fed3offset+1][spg3offset+2]++;
00837 mapHTRproblem(dcc_,spigot);
00838 }
00839 if (((WholeErrorList>>2)&0x01)!=0) {
00840 LRBDataCorruptionIndicators_[fed3offset+2][spg3offset+2]++;
00841 mapHTRproblem(dcc_,spigot);
00842 }
00843 if (((WholeErrorList>>3)&0x01)!=0) {
00844 LRBDataCorruptionIndicators_[fed3offset+1][spg3offset+1]++;
00845 mapHTRproblem(dcc_,spigot);
00846 }
00847 if (((WholeErrorList>>4)&0x01)!=0) {
00848 LRBDataCorruptionIndicators_[fed3offset+2][spg3offset+1]++;
00849 mapHTRproblem(dcc_,spigot);
00850 }
00851 if (((WholeErrorList>>5)&0x01)!=0) {
00852 LRBDataCorruptionIndicators_[fed3offset+1][spg3offset+0]++;
00853 mapHTRproblem(dcc_,spigot);
00854 }
00855 if (((WholeErrorList>>6)&0x01)!=0) {
00856 LRBDataCorruptionIndicators_[fed3offset+2][spg3offset+0]++;
00857 mapHTRproblem(dcc_,spigot);
00858 }
00859 }
00860 if (!dccHeader->getSpigotPresent((unsigned int) spigot)){
00861 LRBDataCorruptionIndicators_[fed3offset+0][spg3offset+2]++;
00862 mapHTRproblem(dcc_,spigot);
00863 if (debug_>0)std::cout <<"HTR Problem: Spigot Not Present"<<std::endl;
00864 } else {
00865 if ( dccHeader->getSpigotDataTruncated((unsigned int) spigot)) {
00866 LRBDataCorruptionIndicators_[fed3offset-1][spg3offset+0]++;
00867 mapHTRproblem(dcc_,spigot);
00868 if (debug_>0)std::cout <<"HTR Problem: Spigot Data Truncated"<<std::endl;
00869 }
00870 if ( dccHeader->getSpigotCRCError((unsigned int) spigot)) {
00871 LRBDataCorruptionIndicators_[fed3offset+0][spg3offset+0]++;
00872 mapHTRproblem(dcc_,spigot);
00873 }
00874 }
00875 if (dccHeader->getSpigotDataLength(spigot) <(unsigned long)4) {
00876 LRBDataCorruptionIndicators_[fed3offset+0][spg3offset+1]++;
00877 mapHTRproblem(dcc_,spigot);
00878 if (debug_>0)std::cout <<"HTR Problem: Spigot Data Length too small"<<std::endl;
00879 }
00880 }
00881
00882
00883 HcalHTRData htr;
00884 for (int spigot=0; spigot<HcalDCCHeader::SPIGOT_COUNT; spigot++) {
00885 const int spg3offset = 1 + (4*spigot);
00886 const int spg2offset = 1 + (3*spigot);
00887 if (!dccHeader->getSpigotPresent(spigot)) continue;
00888
00889
00890
00891 dccHeader->getSpigotData(spigot,htr, raw.size());
00892 const unsigned short* HTRraw = htr.getRawData();
00893
00894
00895 if (!htr.check()) {
00896 meInvHTRData_ -> Fill(spigot,dccid);
00897 mapHTRproblem(dcc_,spigot);
00898 if (debug_>0)std::cout <<"HTR Problem: HTR check fails"<<std::endl;
00899 }
00900
00901 unsigned short HTRwdcount = htr.getRawLength();
00902 if (HTRwdcount == 0)
00903 {
00904 edm::LogWarning("HcalMonitorModule::RawDataTas") << "Unexpected Raw Length: "<< HTRwdcount <<" I am bailing out...";
00905 continue;
00906 }
00907
00908
00909
00910 int NTP = ((htr.getExtHdr6() >> 8) & 0x00FF);
00911 int NDAQ = (HTRraw[htr.getRawLength() - 4] & 0x7FF);
00912
00913 if ( ! ((HTRwdcount != 8) ||
00914 (HTRwdcount != 12 + NTP + NDAQ) ||
00915 (HTRwdcount != 20 + NTP + NDAQ) )) {
00916 ++HalfHTRDataCorruptionIndicators_[fed3offset+2][spg3offset+0];
00917 mapHTRproblem(dcc_,spigot);
00918 if (debug_>0)std::cout <<"HTR Problem: NTP+NDAQ size consistency check fails"<<std::endl;
00919
00920 continue; }
00921 bool EE = ((dccHeader->getSpigotErrorBits(spigot) >> 2) & 0x01);
00922 if (EE) {
00923 if (HTRwdcount != 8) {
00924 ++HalfHTRDataCorruptionIndicators_[fed3offset+2][spg3offset+1];
00925 if (debug_>0)std::cout <<"HTR Problem: HTRwdcount !=8"<<std::endl;
00926 }
00927 DataFlowInd_[fed2offset+0][spg3offset+0]++;
00928 continue;}
00929 else{
00930 bool CM = (htr.getExtHdr7() >> 14)&0x0001;
00931 int paddingsize = ((NDAQ+NTP)%2);
00932 if (( CM && ( (HTRwdcount-NDAQ-NTP-paddingsize) != 12) )
00933 ||
00934 (!CM && ( (HTRwdcount-NDAQ-NTP-paddingsize) != 20) ) ) {
00935 ++HalfHTRDataCorruptionIndicators_[fed3offset+2][spg3offset+1];
00936 mapHTRproblem(dcc_,spigot);
00937 continue;} }
00938
00939 if (htr.isHistogramEvent()) continue;
00940
00941
00942 unsigned int htrOrN = htr.getOrbitNumber();
00943 unsigned int htrBCN = htr.getBunchNumber();
00944 unsigned int htrEvtN = htr.getL1ANumber();
00945 meBCN_->Fill(htrBCN);
00946
00947 if (( (htrOrN == dccOrN ) &&
00948 (htrBCN == (unsigned int) dccBCN) )
00949 != (dccHeader->getBxMismatchWithDCC(spigot)) ){
00950 meDCCEventFormatError_->Fill(dccid,5);
00951 mapHTRproblem(dcc_,spigot);
00952 if (debug_>0)std::cout <<"Orbit or BCN HTR/DCC mismatch"<<std::endl;
00953 }
00954 if ( (htrEvtN == dccEvtNum) !=
00955 dccHeader->getSpigotValid(spigot) ) {
00956 meDCCEventFormatError_->Fill(dccid,5);
00957 mapHTRproblem(dcc_,spigot);
00958 if (debug_>0)std::cout <<"DCC invalid spigot"<<std::endl;
00959 }
00960 int cratenum = htr.readoutVMECrateId();
00961 float slotnum = htr.htrSlot() + 0.5*htr.htrTopBottom();
00962 if (debug_ > 0) HTRPrint(htr,debug_);
00963 unsigned int htrFWVer = htr.getFirmwareRevision() & 0xFF;
00964 meHTRFWVersion_->Fill(cratenum,htrFWVer);
00965
00967 int EvtNdiff = htrEvtN - dccEvtNum;
00968 if (EvtNdiff!=0) {
00969 meEvtNumberSynch_->Fill(dccid,spigot);
00970 mapHTRproblem(dcc_,spigot);
00971 meEvtNCheck_->Fill(EvtNdiff);
00972 if (debug_ == 1)std::cout << "++++ Evt # out of sync, ref, this HTR: "<< dccEvtNum << " "<<htrEvtN <<std::endl;
00973 }
00974
00976 int BCNdiff = htrBCN-dccBCN;
00977 if ((BCNdiff!=0)
00978
00979
00980 ){
00981 meBCNSynch_->Fill(dccid,spigot);
00982 mapHTRproblem(dcc_,spigot);
00983 meBCNCheck_->Fill(BCNdiff);
00984 if (debug_==1)std::cout << "++++ BCN # out of sync, ref, this HTR: "<< dccBCN << " "<<htrBCN <<std::endl;
00985 }
00986
00988 int OrNdiff = htrOrN-dccOrN;
00989 if (OrNdiff!=0) {
00990 meOrNSynch_->Fill(dccid,spigot);
00991 mapHTRproblem(dcc_,spigot);
00992 meOrNCheck_->Fill(OrNdiff);
00993 meBCNwhenOrNDiff_->Fill(htrBCN);
00994 if (debug_==1)std::cout << "++++ OrN # out of sync, ref, this HTR: "<< dccOrN << " "<<htrOrN <<std::endl;
00995 }
00996
00997 bool htrUnSuppressed=(HTRraw[6]>>15 & 0x0001);
00998 if (htrUnSuppressed) {
00999 UScount[dcc_][spigot]++;
01000 int here=1+(HcalDCCHeader::SPIGOT_COUNT*(dcc_))+spigot;
01001 meUSFractSpigs_->Fill(here,
01002 ((double)UScount[dcc_][spigot]));}
01003
01004 MonitorElement* tmpErr = 0;
01005 HcalDetId HDI = hashedHcalDetId_[hashup(dcc_,spigot)];
01006 if (HDI != HcalDetId::Undefined) {
01007 switch (HDI.subdetId()) {
01008 case (HcalBarrel): {
01009 tmpErr = HTR_StatusWd_HBHE;
01010 } break;
01011 case (HcalEndcap): {
01012 tmpErr = HTR_StatusWd_HBHE;
01013 } break;
01014 case (HcalOuter): {
01015 tmpErr = HTR_StatusWd_HO;
01016 } break;
01017 case (HcalForward): {
01018 tmpErr = HTR_StatusWd_HF;
01019 } break;
01020 default: break;
01021 }
01022 }
01023
01024 int errWord = htr.getErrorsWord() & 0xFFFF;
01025 if ( (((dccHeader->getSpigotSummary( spigot))>>24)&0x00FF)
01026 != (errWord&0x00FF) ){
01027 meDCCEventFormatError_->Fill(dccid,6);
01028 mapHTRproblem(dcc_,spigot);
01029 if (debug_>0)std::cout <<"DCC spigot summary error or HTR error word"<<std::endl;
01030
01031 }
01032 if(tmpErr!=NULL){
01033 for(int i=0; i<16; i++){
01034 int errbit = errWord&(0x01<<i);
01035
01036 if (i==15) errbit = errbit - 0x8000;
01037 if (errbit !=0) {
01038 tmpErr->Fill(i);
01039
01040 switch (i) {
01041 case (14):
01042 HalfHTRDataCorruptionIndicators_[fed3offset+0][spg3offset+2]++;
01043 mapHTRproblem(dcc_,spigot);
01044 if (debug_>0)std::cout <<"HTR Problem: Case 14"<<std::endl;
01045 break;
01046 case (13):
01047 HalfHTRDataCorruptionIndicators_[fed3offset+0][spg3offset+1]++;
01048 mapHTRproblem(dcc_,spigot);
01049 if (debug_>0)std::cout <<"HTR Problem: Case 13"<<std::endl;
01050 break;
01051 case (12):
01052 HalfHTRDataCorruptionIndicators_[fed3offset+0][spg3offset+0]++;
01053 mapHTRproblem(dcc_,spigot);
01054 if (debug_>0)std::cout <<"HTR Problem: Case 12"<<std::endl;
01055 break;
01056 case ( 8):
01057 HalfHTRDataCorruptionIndicators_[fed3offset+1][spg3offset+2]++;
01058 mapHTRproblem(dcc_,spigot);
01059 if (debug_>0)std::cout <<"HTR Problem: Case 8"<<std::endl;
01060 break;
01061 case (15):
01062 HalfHTRDataCorruptionIndicators_[fed3offset+1][spg3offset+1]++;
01063 mapHTRproblem(dcc_,spigot);
01064 break;
01065 case ( 7):
01066 HalfHTRDataCorruptionIndicators_[fed3offset+1][spg3offset+0]++;
01067 mapHTRproblem(dcc_,spigot);
01068 if (debug_>0)std::cout <<"HTR Problem: Case 7"<<std::endl;
01069 break;
01070
01071
01072
01073
01074
01075
01076
01077 case ( 3):
01078 DataFlowInd_[fed2offset+1][spg3offset+0]++; break;
01079 case ( 1):
01080 DataFlowInd_[fed2offset+0][spg3offset+1]++; break;
01081 case ( 0):
01082 DataFlowInd_[fed2offset+0][spg3offset+2]++;
01083 default: break;
01084 }
01085 meStatusWdCrate_->Fill(cratenum,i);
01086 if (cratenum == 0) meCrate0HTRStatus_ -> Fill(slotnum,i);
01087 else if (cratenum == 1) meCrate1HTRStatus_ -> Fill(slotnum,i);
01088 else if (cratenum == 2) meCrate2HTRStatus_ -> Fill(slotnum,i);
01089 else if (cratenum == 3) meCrate3HTRStatus_ -> Fill(slotnum,i);
01090 else if (cratenum == 4) meCrate4HTRStatus_ -> Fill(slotnum,i);
01091 else if (cratenum == 5) meCrate5HTRStatus_ -> Fill(slotnum,i);
01092 else if (cratenum == 6) meCrate6HTRStatus_ -> Fill(slotnum,i);
01093 else if (cratenum == 7) meCrate7HTRStatus_ -> Fill(slotnum,i);
01094 else if (cratenum == 9) meCrate9HTRStatus_ -> Fill(slotnum,i);
01095 else if (cratenum ==10)meCrate10HTRStatus_ -> Fill(slotnum,i);
01096 else if (cratenum ==11)meCrate11HTRStatus_ -> Fill(slotnum,i);
01097 else if (cratenum ==12)meCrate12HTRStatus_ -> Fill(slotnum,i);
01098 else if (cratenum ==13)meCrate13HTRStatus_ -> Fill(slotnum,i);
01099 else if (cratenum ==14)meCrate14HTRStatus_ -> Fill(slotnum,i);
01100 else if (cratenum ==15)meCrate15HTRStatus_ -> Fill(slotnum,i);
01101 else if (cratenum ==17)meCrate17HTRStatus_ -> Fill(slotnum,i);
01102 }
01103 }
01104 }
01105
01106
01107 const short unsigned int* daq_first, *daq_last, *tp_first, *tp_last;
01108 const HcalQIESample* qie_begin, *qie_end, *qie_work;
01109
01110
01111 htr.dataPointers(&daq_first,&daq_last,&tp_first,&tp_last);
01112 qie_begin=(HcalQIESample*)daq_first;
01113 qie_end=(HcalQIESample*)(daq_last+1);
01114
01115
01116
01117
01119 if (htr.getFormatVersion() < 6 ) {
01120
01121 int lastcapid=-1;
01122 int samplecounter=-1;
01123 int htrchan=-1;
01124 int chn2offset=0;
01125 int NTS = htr.getNDD();
01126
01127 ChannSumm_DataIntegrityCheck_ [fed2offset-1][spg2offset+0]=-NTS;
01128
01129 for (qie_work=qie_begin; qie_work!=qie_end; qie_work++) {
01130 if (qie_work->raw()==0xFFFF)
01131 continue;
01132
01133 if (( 1 + ( 3* (qie_work->fiber()-1) ) + qie_work->fiberChan() ) != htrchan) {
01134
01135 htrchan= (3* (qie_work->fiber()-1) ) + qie_work->fiberChan();
01136 chn2offset = (htrchan*3)+1;
01137 --ChannSumm_DataIntegrityCheck_ [fed2offset-1][spg2offset-1];
01138 --Chann_DataIntegrityCheck_[dcc_][chn2offset-1][spg2offset-1];
01139 if (samplecounter !=-1) {
01140
01141 if (((samplecounter != NTS) &&
01142 (samplecounter != 1) )
01143
01144
01145 )
01146 {
01147 ++ChannSumm_DataIntegrityCheck_ [fed2offset+0][spg2offset+0];
01148 ++Chann_DataIntegrityCheck_[dcc_][chn2offset+0][spg2offset+0];
01149 mapChannproblem(dcc_,spigot,htrchan);
01150 if (debug_)std::cout <<"mapChannelProblem: Wrong Digi Size"<<std::endl;
01151 }
01152 }
01153
01154 lastcapid=qie_work->capid();
01155 samplecounter=1;}
01156 else {
01157 int hope = lastcapid +1;
01158 if (hope==4) hope = 0;
01159 if (qie_work->capid() != hope){
01160 ++ChannSumm_DataIntegrityCheck_ [fed2offset+1][spg2offset+0];
01161 ++Chann_DataIntegrityCheck_[dcc_][chn2offset+1][spg2offset+0];
01162 mapChannproblem(dcc_,spigot,htrchan);
01163 if (debug_)std::cout <<"mapChannelProblem: Wrong Cap ID"<<std::endl;
01164 }
01165 lastcapid=qie_work->capid();
01166 samplecounter++;}
01167
01168 if (!(qie_work->dv())){
01169 ++ChannSumm_DataIntegrityCheck_ [fed2offset+0][spg2offset+1];
01170 ++Chann_DataIntegrityCheck_[dcc_][chn2offset+0][spg2offset+1];
01171 }
01172 if (qie_work->er()) {
01173 ++ChannSumm_DataIntegrityCheck_ [fed2offset+1][spg2offset+1];
01174 ++Chann_DataIntegrityCheck_[dcc_][chn2offset+1][spg2offset+1];
01175 mapChannproblem(dcc_,spigot,htrchan);
01176 if (debug_)std::cout <<"mapChannelProblem: FE Error"<<std::endl;
01177 }
01178 }
01179
01180
01181 if ((samplecounter != NTS) &&
01182 (samplecounter != 1) &&
01183 (samplecounter !=-1) ) {
01184 ++ChannSumm_DataIntegrityCheck_ [fed2offset+0][spg2offset+0];
01185 ++Chann_DataIntegrityCheck_[dcc_][chn2offset+0][spg2offset+0];
01186 mapChannproblem(dcc_,spigot,htrchan);
01187 if (debug_)std::cout <<"mapChannelProblem: Wrong Digi Size (last digi)"<<std::endl;
01188 }
01189 } else {
01190 const unsigned short* ptr_header=daq_first;
01191 const unsigned short* ptr_end=daq_last+1;
01192 int flavor, error_flags, capid0, channelid;
01193
01194 int htrchan=-1;
01195 int chn2offset=0;
01196 int NTS = htr.getNDD();
01197 int Nchan = 3;
01198 while (ptr_header!=ptr_end) {
01199 if (*ptr_header==0xFFFF) {
01200 ptr_header++;
01201 continue;
01202 }
01203 error_flags = capid0 = channelid = 0;
01204
01205 bool isheader=HcalHTRData::unpack_per_channel_header(*ptr_header,flavor,error_flags,capid0,channelid);
01206 if (!isheader) {
01207 ptr_header++;
01208 continue;
01209 }
01210
01211 int fiber = 1 + ((channelid & 0x1C) >> 2);
01212 int chan = channelid & 0x3;
01213 htrchan = ((fiber -1) * Nchan) + chan + 1;
01214 chn2offset = ((htrchan-1)*3)+1;
01215
01216 ChannSumm_DataIntegrityCheck_ [fed2offset-1][spg2offset-1] -= NTS;
01217 Chann_DataIntegrityCheck_[dcc_][chn2offset-1][spg2offset-1] -= NTS;
01218 if (error_flags & 2) {
01219 ++ChannSumm_DataIntegrityCheck_ [fed2offset+1][spg2offset+0];
01220 ++Chann_DataIntegrityCheck_[dcc_][chn2offset+1][spg2offset+0];
01221 mapChannproblem(dcc_,spigot,htrchan);
01222 }
01223 if (error_flags & 1) {
01224 ++ChannSumm_DataIntegrityCheck_ [fed2offset+1][spg2offset+1];
01225 ++Chann_DataIntegrityCheck_[dcc_][chn2offset+1][spg2offset+1];
01226 mapChannproblem(dcc_,spigot,htrchan);
01227 }
01228
01229 for (ptr_header++;
01230 ptr_header!=ptr_end && !HcalHTRData::is_channel_header(*ptr_header);
01231 ptr_header++);
01232 }
01233 }
01234 unsigned int fib1BCN = htr.getFib1OrbMsgBCN();
01235 unsigned int fib2BCN = htr.getFib2OrbMsgBCN();
01236 unsigned int fib3BCN = htr.getFib3OrbMsgBCN();
01237 unsigned int fib4BCN = htr.getFib4OrbMsgBCN();
01238 unsigned int fib5BCN = htr.getFib5OrbMsgBCN();
01239 unsigned int fib6BCN = htr.getFib6OrbMsgBCN();
01240 unsigned int fib7BCN = htr.getFib7OrbMsgBCN();
01241 unsigned int fib8BCN = htr.getFib8OrbMsgBCN();
01242 meFibBCN_->Fill(fib1BCN);
01243 meFibBCN_->Fill(fib2BCN);
01244 meFibBCN_->Fill(fib3BCN);
01245 meFibBCN_->Fill(fib4BCN);
01246 meFibBCN_->Fill(fib5BCN);
01247 meFibBCN_->Fill(fib6BCN);
01248 meFibBCN_->Fill(fib7BCN);
01249 meFibBCN_->Fill(fib8BCN);
01250
01251 meFib1OrbMsgBCN_->Fill(slotnum, cratenum, fib1BCN);
01252 meFib2OrbMsgBCN_->Fill(slotnum, cratenum, fib2BCN);
01253 meFib3OrbMsgBCN_->Fill(slotnum, cratenum, fib3BCN);
01254 meFib4OrbMsgBCN_->Fill(slotnum, cratenum, fib4BCN);
01255 meFib5OrbMsgBCN_->Fill(slotnum, cratenum, fib5BCN);
01256 meFib6OrbMsgBCN_->Fill(slotnum, cratenum, fib6BCN);
01257 meFib7OrbMsgBCN_->Fill(slotnum, cratenum, fib7BCN);
01258 meFib8OrbMsgBCN_->Fill(slotnum, cratenum, fib8BCN);
01259
01260 }
01261 return;
01262 }
01263
01264
01265
01266 void HcalRawDataMonitor::endLuminosityBlock(const edm::LuminosityBlock& lumiSeg,
01267 const edm::EventSetup& c){
01268
01269
01270 ProblemsVsLB_HB->Fill(lumiSeg.luminosityBlock(),NumBadHB);
01271 ProblemsVsLB_HE->Fill(lumiSeg.luminosityBlock(),NumBadHE);
01272 ProblemsVsLB_HO->Fill(lumiSeg.luminosityBlock(),NumBadHO);
01273 ProblemsVsLB_HF->Fill(lumiSeg.luminosityBlock(),NumBadHF);
01274 ProblemsVsLB_HBHEHF->Fill(lumiSeg.luminosityBlock(),NumBadHB+NumBadHE+NumBadHF);
01275 ProblemsVsLB->Fill(lumiSeg.luminosityBlock(),NumBadHB+NumBadHE+NumBadHO+NumBadHF);
01276
01277
01278 if (ProblemsCurrentLB)
01279 ProblemsCurrentLB->Reset();
01280 if (ProblemsCurrentLB)
01281 {
01282
01283 ProblemsCurrentLB->setBinContent(0,0, levt_);
01284 ProblemsCurrentLB->setBinContent(1,1, NumBadHB*levt_);
01285 ProblemsCurrentLB->setBinContent(2,1, NumBadHE*levt_);
01286 ProblemsCurrentLB->setBinContent(3,1, NumBadHO*levt_);
01287 ProblemsCurrentLB->setBinContent(4,1, NumBadHF*levt_);
01288 ProblemsCurrentLB->setBinContent(5,1, NumBadHO0*levt_);
01289 ProblemsCurrentLB->setBinContent(6,1, NumBadHO12*levt_);
01290 ProblemsCurrentLB->setBinContent(7,1, NumBadHFLUMI*levt_);
01291
01292 }
01293
01294 for (int d=0; d<DEPTHBINS; d++) {
01295 for (int eta=0; eta<ETABINS; eta++) {
01296 for (int phi=0; phi<PHIBINS; phi++){
01297 uniqcounter[eta][phi][d] = 0.0;
01298 }
01299 }
01300 }
01301
01302 UpdateMEs();
01303 }
01304
01305 void HcalRawDataMonitor::endRun(const edm::Run& run, const edm::EventSetup& c){}
01306
01307
01308 void HcalRawDataMonitor::endJob(void){
01309 if (debug_>0) std::cout <<"HcalRawDataMonitor::endJob()"<<std::endl;
01310 if (enableCleanup_) cleanup();
01311 }
01312
01313
01314 void HcalRawDataMonitor::label_ySpigots(MonitorElement* me_ptr, int ybins) {
01315 char label[32];
01316 for (int spig=0; spig<HcalDCCHeader::SPIGOT_COUNT; spig++) {
01317 snprintf(label, 32, "Spgt %02d", spig);
01318 me_ptr->setBinLabel((2+(spig*ybins)), label, 2);
01319 }
01320 }
01321
01322
01323 void HcalRawDataMonitor::label_xChanns(MonitorElement* me_ptr, int xbins) {
01324 char label[32];
01325 for (int ch=0; ch<HcalHTRData::CHANNELS_PER_SPIGOT; ch++) {
01326 snprintf(label, 32, "Ch %02d", ch+1);
01327 me_ptr->setBinLabel((2+(ch*xbins)), label, 1);
01328 }
01329 }
01330
01331
01332 void HcalRawDataMonitor::label_xFEDs(MonitorElement* me_ptr, int xbins) {
01333 char label[32];
01334 for (int thfed=0; thfed<NUMDCCS; thfed++) {
01335 snprintf(label, 32, "%03d", thfed+700);
01336 me_ptr->setBinLabel((2+(thfed*xbins)), label, 1);
01337 }
01338 }
01339
01340 void HcalRawDataMonitor::labelHTRBits(MonitorElement* mePlot,unsigned int axisType) {
01341
01342 if (axisType !=1 && axisType != 2) return;
01343
01344 mePlot -> setBinLabel(1,"Overflow Warn",axisType);
01345 mePlot -> setBinLabel(2,"Buffer Busy",axisType);
01346 mePlot -> setBinLabel(3,"Empty Event",axisType);
01347 mePlot -> setBinLabel(4,"Rejected L1A",axisType);
01348 mePlot -> setBinLabel(5,"Invalid Stream",axisType);
01349 mePlot -> setBinLabel(6,"Latency Warn",axisType);
01350 mePlot -> setBinLabel(7,"OptDat Err",axisType);
01351 mePlot -> setBinLabel(8,"Clock Err",axisType);
01352 mePlot -> setBinLabel(9,"Bunch Err",axisType);
01353 mePlot -> setBinLabel(10,"b9",axisType);
01354 mePlot -> setBinLabel(11,"b10",axisType);
01355 mePlot -> setBinLabel(12,"b11",axisType);
01356 mePlot -> setBinLabel(13,"Test Mode",axisType);
01357 mePlot -> setBinLabel(14,"Histo Mode",axisType);
01358 mePlot -> setBinLabel(15,"Calib Trig",axisType);
01359 mePlot -> setBinLabel(16,"Bit15 Err",axisType);
01360
01361 return;
01362 }
01363
01364 void HcalRawDataMonitor::stashHDI(int thehash, HcalDetId thehcaldetid) {
01365
01366 if ((thehash<0)||(thehash>(NUMDCCS*NUMSPIGS*HTRCHANMAX)))return;
01367
01368 hashedHcalDetId_[thehash] = thehcaldetid;
01369 }
01370
01371
01372
01373 void HcalRawDataMonitor::HTRPrint(const HcalHTRData& htr,int prtlvl){
01374 if (prtlvl == 1){
01375 int cratenum = htr.readoutVMECrateId();
01376 float slotnum = htr.htrSlot() + 0.5*htr.htrTopBottom();
01377 printf("Crate,Slot,ErrWord,Evt#,BCN: %3i %4.1f %6X %7i %4X \n", cratenum,slotnum,htr.getErrorsWord(),htr.getL1ANumber(),htr.getBunchNumber());
01378
01379 }
01380
01381 else if (prtlvl == 2){
01382 int cratenum = htr.readoutVMECrateId();
01383 float slotnum = htr.htrSlot() + 0.5*htr.htrTopBottom();
01384 printf("Crate, Slot:%3i %4.1f \n", cratenum,slotnum);
01385
01386 }
01387
01388 else if (prtlvl == 3){
01389 int cratenum = htr.readoutVMECrateId();
01390 float slotnum = htr.htrSlot() + 0.5*htr.htrTopBottom();
01391 printf("Crate, Slot:%3i %4.1f", cratenum,slotnum);
01392 printf(" FibOrbMsgBCNs: %4X %4X %4X %4X %4X %4X %4X %4X \n",htr.getFib1OrbMsgBCN(),htr.getFib2OrbMsgBCN(),htr.getFib3OrbMsgBCN(),htr.getFib4OrbMsgBCN(),htr.getFib5OrbMsgBCN(),htr.getFib6OrbMsgBCN(),htr.getFib7OrbMsgBCN(),htr.getFib8OrbMsgBCN());
01393 }
01394
01395 return;
01396 }
01397
01398
01399 void HcalRawDataMonitor::UpdateMEs (void ) {
01400 tevt_=0;
01401 if (meTevtHist_) tevt_= (int)meTevtHist_->getBinContent(1);
01402 NumBadHB=0;
01403 NumBadHE=0;
01404 NumBadHO=0;
01405 NumBadHF=0;
01406 NumBadHFLUMI=0;
01407 NumBadHO0=0;
01408 NumBadHO12=0;
01409
01410
01411 meLRBDataCorruptionIndicators_->setBinContent(0,0,tevt_);
01412 for (int x=0; x<THREE_FED; x++)
01413 for (int y=0; y<THREE_SPG; y++)
01414 if (LRBDataCorruptionIndicators_ [x][y])
01415 meLRBDataCorruptionIndicators_->setBinContent(x+1,y+1,LRBDataCorruptionIndicators_[x][y]);
01416
01417 meHalfHTRDataCorruptionIndicators_->setBinContent(0,0,tevt_);
01418 for (int x=0; x<THREE_FED; x++)
01419 for (int y=0; y<THREE_SPG; y++)
01420 if (HalfHTRDataCorruptionIndicators_ [x][y])
01421 meHalfHTRDataCorruptionIndicators_->setBinContent(x+1,y+1,HalfHTRDataCorruptionIndicators_[x][y]);
01422
01423 meChannSumm_DataIntegrityCheck_->setBinContent(0,0,tevt_);
01424 for (int x=0; x<TWO___FED; x++)
01425 for (int y=0; y<TWO__SPGT; y++)
01426 if (ChannSumm_DataIntegrityCheck_[x][y])
01427 meChannSumm_DataIntegrityCheck_->setBinContent(x+1,y+1,ChannSumm_DataIntegrityCheck_[x][y]);
01428
01429 for (int f=0; f<NUMDCCS; f++){
01430 meChann_DataIntegrityCheck_[f]->setBinContent(0,0,tevt_);
01431 for (int x=0; x<TWO_CHANN; x++)
01432 for (int y=0; y<TWO__SPGT; y++)
01433 if (Chann_DataIntegrityCheck_[f][x][y])
01434 meChann_DataIntegrityCheck_[f]->setBinContent(x+1,y+1,Chann_DataIntegrityCheck_ [f][x][y]);
01435 }
01436
01437 meDataFlowInd_->setBinContent(0,0,tevt_);
01438 for (int x=0; x<TWO___FED; x++)
01439 for (int y=0; y<THREE_SPG; y++)
01440 if (DataFlowInd_[x][y])
01441 meDataFlowInd_->setBinContent(x+1,y+1,DataFlowInd_[x][y]);
01442 }
01443
01444
01445 void HcalRawDataMonitor::whosebad(int subdet) {
01446
01447
01448
01449
01450
01451
01452
01453
01454
01455
01456
01457
01458
01459
01460
01461
01462 }
01463
01464 void HcalRawDataMonitor::mapDCCproblem(int dcc) {
01465 int myeta = 0;
01466 int myphi =-1;
01467 int mydepth = 0;
01468 HcalDetId HDI;
01469
01470 for (int i=hashup(dcc);
01471 i<hashup(dcc)+(NUMSPIGS*HTRCHANMAX);
01472 i++) {
01473 HDI = hashedHcalDetId_[i];
01474 if (HDI==HcalDetId::Undefined)
01475 continue;
01476 mydepth = HDI.depth();
01477 myphi = HDI.iphi();
01478 myeta = CalcEtaBin(HDI.subdet(),
01479 HDI.ieta(),
01480 mydepth);
01481
01482 if (myeta>=0 && myeta<85 &&
01483 (myphi-1)>=0 && (myphi-1)<72 &&
01484 (mydepth-1)>=0 && (mydepth-1)<4){
01485 problemfound[myeta][myphi-1][mydepth-1] = true;
01486
01487
01488 if(mydepth==4 && excludeHORing2_==true)
01489 if (abs(HDI.ieta())>=11 && abs(HDI.ieta())<=15 && !isSiPM(HDI.ieta(),HDI.iphi(),mydepth))
01490 problemfound[myeta][myphi-1][mydepth-1] = false;
01491
01492 if (debug_>0)
01493 std::cout<<" mapDCCproblem found error! "<<HDI.subdet()<<"("<<HDI.ieta()<<", "<<HDI.iphi()<<", "<<HDI.depth()<<")"<<std::endl;
01494 }
01495 }
01496 }
01497 void HcalRawDataMonitor::mapHTRproblem(int dcc, int spigot) {
01498 int myeta = 0;
01499 int myphi =-1;
01500 int mydepth = 0;
01501 HcalDetId HDI;
01502
01503 for (int i=hashup(dcc,spigot);
01504 i<hashup(dcc,spigot)+(HTRCHANMAX);
01505 i++) {
01506 HDI = hashedHcalDetId_[i];
01507 if (HDI==HcalDetId::Undefined) {
01508 continue;
01509 }
01510 mydepth = HDI.depth();
01511 myphi = HDI.iphi();
01512 myeta = CalcEtaBin(HDI.subdet(),
01513 HDI.ieta(),
01514 mydepth);
01515
01516 if (myeta>=0 && myeta<85 &&
01517 (myphi-1)>=0 && (myphi-1)<72 &&
01518 (mydepth-1)>=0 && (mydepth-1)<4){
01519 problemfound[myeta][myphi-1][mydepth-1] = true;
01520
01521
01522 if(mydepth==4 && excludeHORing2_==true)
01523 if (abs(HDI.ieta())>=11 && abs(HDI.ieta())<=15 && !isSiPM(HDI.ieta(),HDI.iphi(),mydepth))
01524 problemfound[myeta][myphi-1][mydepth-1] = false;
01525
01526 if (debug_>0)
01527 std::cout<<" mapDCCproblem found error! "<<HDI.subdet()<<"("<<HDI.ieta()<<", "<<HDI.iphi()<<", "<<HDI.depth()<<")"<<std::endl;
01528 }
01529
01530 }
01531 }
01532
01533 void HcalRawDataMonitor::mapChannproblem(int dcc, int spigot, int htrchan) {
01534 int myeta = 0;
01535 int myphi =-1;
01536 int mydepth = 0;
01537 HcalDetId HDI;
01538
01539 int i=hashup(dcc,spigot,htrchan);
01540 HDI = HashToHDI(i);
01541 if (HDI==HcalDetId::Undefined) {
01542 return;
01543 }
01544 mydepth = HDI.depth();
01545 myphi = HDI.iphi();
01546 myeta = CalcEtaBin(HDI.subdet(),
01547 HDI.ieta(),
01548 mydepth);
01549
01550 if (myeta>=0 && myeta<85 &&
01551 (myphi-1)>=0 && (myphi-1)<72 &&
01552 (mydepth-1)>=0 && (mydepth-1)<4){
01553 problemfound[myeta][myphi-1][mydepth-1] = true;
01554
01555
01556 if(mydepth==4 && excludeHORing2_==true)
01557 if (abs(HDI.ieta())>=11 && abs(HDI.ieta())<=15 && !isSiPM(HDI.ieta(),HDI.iphi(),mydepth))
01558 problemfound[myeta][myphi-1][mydepth-1] = false;
01559
01560 if (debug_>0)
01561 std::cout<<" mapDCCproblem found error! "<<HDI.subdet()<<"("<<HDI.ieta()<<", "<<HDI.iphi()<<", "<<HDI.depth()<<")"<<std::endl;
01562 }
01563 }
01564
01565
01566 DEFINE_FWK_MODULE(HcalRawDataMonitor);