00001 #include "DQM/HcalMonitorTasks/interface/HcalDigiMonitor.h"
00002 #include <cmath>
00003
00004
00005
00006
00007 HcalDigiMonitor::HcalDigiMonitor() {
00008 doPerChannel_ = false;
00009 occThresh_ = 1;
00010 ievt_=0;
00011 shape_=NULL;
00012 }
00013
00014
00015 HcalDigiMonitor::~HcalDigiMonitor() {}
00016
00017 void HcalDigiMonitor::reset(){}
00018
00019
00020 static bool bitUpset(int last, int now){
00021 if(last ==-1) return false;
00022 int v = last+1;
00023 if(v==4) v=0;
00024 if(v==now) return false;
00025 return true;
00026 }
00027
00028
00029 void HcalDigiMonitor::setup(const edm::ParameterSet& ps,
00030 DQMStore* dbe)
00031 {
00032
00033 HcalBaseMonitor::setup(ps,dbe);
00034 baseFolder_ = rootFolder_+"DigiMonitor_Hcal";
00035
00036 if (showTiming)
00037 {
00038 cpu_timer.reset(); cpu_timer.start();
00039 }
00040
00041
00042
00043 shapeThresh_ = ps.getUntrackedParameter<int>("DigiMonitor_ShapeThresh", -1);
00044
00045 occThresh_ = ps.getUntrackedParameter<int>("DigiMonitor_ADCsumThresh", 0);
00046
00047 if (fVerbosity>0)
00048 {
00049 cout << "<HcalDigiMonitor> Digi ADC occupancy threshold set to: >" << occThresh_ << endl;
00050 cout <<"<HcalDigiMonitor> Digi shape ADC threshold set to: >" << shapeThresh_ << endl;
00051 }
00052 makeDiagnostics = ps.getUntrackedParameter<bool>("DigiMonitor_MakeDiagnosticPlots",false);
00053
00054 doPerChannel_ = ps.getUntrackedParameter<bool>("DigiMonitor_DigisPerchannel",false);
00055 if (fVerbosity>1)
00056 cout << "<HcalDigiMonitor> Digi phi min/max set to " << phiMin_ << "/" <<phiMax_ << endl;
00057
00058 digi_checkNevents_ = ps.getUntrackedParameter<int>("DigiMonitor_checkNevents",checkNevents_);
00059 if (fVerbosity>1)
00060 cout <<"<HcalDigiMonitor> Perform checks and histogram fills every "<<digi_checkNevents_<<" events"<<endl;
00061
00062
00063 digi_checkoccupancy_ = ps.getUntrackedParameter<bool>("DigiMonitor_problems_checkForMissingDigis",false);
00064 digi_checkcapid_ = ps.getUntrackedParameter<bool>("DigiMonitor_problems_checkCapID",true);
00065 digi_checkdigisize_ = ps.getUntrackedParameter<bool>("DigiMonitor_problems_checkDigiSize",true);
00066 digi_checkadcsum_ = ps.getUntrackedParameter<bool>("DigiMonitor_problems_checkADCsum",true);
00067 digi_checkdverr_ = ps.getUntrackedParameter<bool>("DigiMonitor_problems_checkDVerr",true);
00068 mindigisize_ = ps.getUntrackedParameter<int>("DigiMonitor_minDigiSize",1);
00069 maxdigisize_ = ps.getUntrackedParameter<int>("DigiMonitor_maxDigiSize",20);
00070
00071 hbHists.check=ps.getUntrackedParameter<bool>("checkHB",true);
00072 heHists.check=ps.getUntrackedParameter<bool>("checkHE",true);
00073 hoHists.check=ps.getUntrackedParameter<bool>("checkHO",true);
00074 hfHists.check=ps.getUntrackedParameter<bool>("checkHF",true);
00075
00076 if (fVerbosity>1)
00077 {
00078 cout <<"<HcalDigiMonitor> Checking for the following problems:"<<endl;
00079 if (digi_checkoccupancy_) cout <<"\tChecking that digi present at least once every "<<digi_checkNevents_<<" events;"<<endl;
00080 if (digi_checkcapid_) cout <<"\tChecking that cap ID rotation is correct;"<<endl;
00081 if (digi_checkdigisize_) cout <<"\tChecking that digi size is between ["<<mindigisize_<<" - "<<maxdigisize_<<"];"<<endl;
00082 if (digi_checkadcsum_) cout <<"\tChecking that ADC sum of digi is greater than 0;"<<endl;
00083 if (digi_checkdverr_) cout <<"\tChecking that data valid bit is true and digi error bit is false;"<<endl;
00084 cout <<"\tChecking digis for the following subdetectors:"<<endl;
00085 if (hbHists.check) cout <<"\tHB";
00086 if (heHists.check) cout <<"\tHE";
00087 if (hoHists.check) cout <<"\tHO";
00088 if (hfHists.check) cout <<"\tHF";
00089 cout <<endl;
00090 }
00091
00092 ievt_=0;
00093
00094
00095
00096 for (int i=0;i<87;++i)
00097 {
00098 occupancyEta[i]=0;
00099 if (i<72)
00100 occupancyPhi[i]=0;
00101 for (int j=0;j<72;++j)
00102 {
00103 for (int k=0;k<6;++k)
00104 {
00105 problemdigis[i][j][k]=0;
00106 badcapID[i][j][k]=0;
00107 baddigisize[i][j][k]=0;
00108 badADCsum[i][j][k]=0;
00109 occupancyEtaPhi[i][j][k]=0;
00110 digierrorsdverr[i][j][k]=0;
00111 }
00112 }
00113 }
00114
00115 for (int i=0;i<40;++i)
00116 {
00117 for (int j=0;j<18;++j)
00118 {
00119 occupancyVME[i][j]=0;
00120 errorVME[i][j]=0;
00121 }
00122 }
00123
00124 for (int i=0;i<HcalDCCHeader::SPIGOT_COUNT;++i)
00125 {
00126 for (int j=0;j<36;++j)
00127 {
00128 occupancySpigot[i][j]=0;
00129 errorSpigot[i][j]=0;
00130 }
00131 }
00132
00133
00134 for (int i=0;i<20;++i)
00135 {
00136 for (int j=0;j<4;++j)
00137 digisize[i][j]=0;
00138 }
00139
00140 for (int i=0;i<DIGI_NUM;++i)
00141 {
00142 if (i<DIGI_BQ_FRAC_NBINS)
00143 digiBQfrac[i]=0;
00144 digiBQ[i]=0;
00145 diginum[i]=0;
00146
00147
00148 if (i<4)
00149 {
00150 hbHists.dverr[i]=0;
00151 heHists.dverr[i]=0;
00152 hoHists.dverr[i]=0;
00153 hfHists.dverr[i]=0;
00154 hbHists.capid[i]=0;
00155 heHists.capid[i]=0;
00156 hoHists.capid[i]=0;
00157 hfHists.capid[i]=0;
00158 }
00159 if (i<8)
00160 {
00161 hbHists.capIDdiff[i]=0;
00162 heHists.capIDdiff[i]=0;
00163 hoHists.capIDdiff[i]=0;
00164 hfHists.capIDdiff[i]=0;
00165 }
00166
00167 if (i<10)
00168 {
00169 hbHists.count_shape[i]=0;
00170 heHists.count_shape[i]=0;
00171 hoHists.count_shape[i]=0;
00172 hfHists.count_shape[i]=0;
00173 hbHists.count_shapeThresh[i]=0;
00174 heHists.count_shapeThresh[i]=0;
00175 hoHists.count_shapeThresh[i]=0;
00176 hfHists.count_shapeThresh[i]=0;
00177 }
00178 if (i<50)
00179 {
00180 hbHists.count_presample[i]=0;
00181 heHists.count_presample[i]=0;
00182 hoHists.count_presample[i]=0;
00183 hfHists.count_presample[i]=0;
00184 for (int j=0;j<10;++j)
00185 {
00186 hbHists.tssumplus[i][j]=0;
00187 heHists.tssumplus[i][j]=0;
00188 hoHists.tssumplus[i][j]=0;
00189 hfHists.tssumplus[i][j]=0;
00190 hbHists.tssumminus[i][j]=0;
00191 heHists.tssumminus[i][j]=0;
00192 hoHists.tssumminus[i][j]=0;
00193 hfHists.tssumminus[i][j]=0;
00194 }
00195 }
00196 if (i<200)
00197 {
00198 hbHists.adc[i]=0;
00199 heHists.adc[i]=0;
00200 hoHists.adc[i]=0;
00201 hfHists.adc[i]=0;
00202 hbHists.adcsum[i]=0;
00203 heHists.adcsum[i]=0;
00204 hoHists.adcsum[i]=0;
00205 hfHists.adcsum[i]=0;
00206 }
00207 if (i<DIGI_SUBDET_NUM)
00208 {
00209 hbHists.count_BQ[i]=0;
00210 heHists.count_BQ[i]=0;
00211 hoHists.count_BQ[i]=0;
00212 hfHists.count_BQ[i]=0;
00213 }
00214 if (i<DIGI_BQ_FRAC_NBINS)
00215 {
00216 hbHists.count_BQFrac[i]=0;
00217 heHists.count_BQFrac[i]=0;
00218 hoHists.count_BQFrac[i]=0;
00219 hfHists.count_BQFrac[i]=0;
00220 }
00221 }
00222
00223
00224
00225
00226 if (m_dbe)
00227 {
00228 ostringstream name;
00229 m_dbe->setCurrentFolder(baseFolder_);
00230 meEVT_ = m_dbe->bookInt("Digi Task Event Number");
00231 meEVT_->Fill(ievt_);
00232
00233 MonitorElement* checkN = m_dbe->bookInt("DigiCheckNevents");
00234 checkN->Fill(digi_checkNevents_);
00235 MonitorElement* occT = m_dbe->bookInt("DigiOccThresh");
00236 occT->Fill(occThresh_);
00237 MonitorElement* shapeT = m_dbe->bookInt("DigiShapeThresh");
00238 shapeT->Fill(shapeThresh_);
00239 ProblemDigis = m_dbe->book2D(" ProblemDigis",
00240 " Problem Digi Rate for all HCAL",
00241 etaBins_,etaMin_,etaMax_,
00242 phiBins_,phiMin_,phiMax_);
00243
00244 m_dbe->setCurrentFolder(baseFolder_+"/problem_digis");
00245 setupDepthHists2D(ProblemDigisByDepth," Problem Digi Rate","");
00246 m_dbe->setCurrentFolder(baseFolder_+"/problem_digis/badcapID");
00247 setupDepthHists2D(DigiErrorsBadCapID," Digis with Bad Cap ID Rotation", "");
00248 m_dbe->setCurrentFolder(baseFolder_+"/problem_digis/baddigisize");
00249 setupDepthHists2D(DigiErrorsBadDigiSize," Digis with Bad Size", "");
00250 DigiSize = m_dbe->book2D("Digi Size", "Digi Size",4,0,4,20,-0.5,19.5);
00251 DigiSize->setBinLabel(1,"HB",1);
00252 DigiSize->setBinLabel(2,"HE",1);
00253 DigiSize->setBinLabel(3,"HO",1);
00254 DigiSize->setBinLabel(4,"HF",1);
00255 DigiSize->setAxisTitle("Subdetector",1);
00256 DigiSize->setAxisTitle("Digi Size",2);
00257
00258 m_dbe->setCurrentFolder(baseFolder_+"/problem_digis/badADCsum");
00259 name<<" Digis with ADC sum below threshold ADC counts";
00260 setupDepthHists2D(DigiErrorsBadADCSum," Digis with ADC sum below threshold ADC counts", "");
00261 name.str("");
00262 for (int i=0;i<6;++i)
00263 {
00264 name<<DigiErrorsBadADCSum[i]->getTitle()<<"(ADC sum > "<<occThresh_<<" events)";
00265 DigiErrorsBadADCSum[i]->setTitle(static_cast<const string>(name.str().c_str()));
00266 name.str("");
00267 }
00268 m_dbe->setCurrentFolder(baseFolder_+"/problem_digis/nodigis");
00269 name<<" Digis Missing for a Number of Consecutive Events";
00270
00271 setupDepthHists2D(DigiErrorsNoDigi," Digis Missing for a Number of Consecutive Events", "");
00272 name.str("");
00273 for (int i=0;i<6;++i)
00274 {
00275 name<<DigiErrorsNoDigi[i]->getTitle()<<"("<<digi_checkNevents_<<" events)";
00276 DigiErrorsNoDigi[i]->setTitle(static_cast<const string>(name.str().c_str()));
00277 name.str("");
00278 }
00279 m_dbe->setCurrentFolder(baseFolder_+"/problem_digis/data_invalid_error");
00280 setupDepthHists2D(DigiErrorsDVErr," Digis with Data Invalid or Error Bit Set", "");
00281
00282 m_dbe->setCurrentFolder(baseFolder_+"/digi_occupancy");
00283 setupDepthHists2D(DigiOccupancyByDepth," Digi Eta-Phi Occupancy Map","");
00284 DigiOccupancyPhi= m_dbe->book1D("Digi Phi Occupancy Map",
00285 "Digi Phi Occupancy Map",
00286 phiBins_,phiMin_,phiMax_);
00287 DigiOccupancyPhi->setAxisTitle("i#phi",1);
00288 DigiOccupancyPhi->setAxisTitle("# of Events",2);
00289 DigiOccupancyEta= m_dbe->book1D("Digi Eta Occupancy Map",
00290 "Digi Eta Occupancy Map",
00291 etaBins_,etaMin_,etaMax_);
00292 DigiOccupancyEta->setAxisTitle("i#eta",1);
00293 DigiOccupancyEta->setAxisTitle("# of Events",2);
00294
00295 DigiOccupancyVME = m_dbe->book2D("Digi VME Occupancy Map",
00296 "Digi VME Occupancy Map",
00297 40,-0.25,19.75,18,-0.5,17.5);
00298 DigiOccupancyVME -> setAxisTitle("HTR Slot",1);
00299 DigiOccupancyVME -> setAxisTitle("VME Crate Id",2);
00300
00301 DigiOccupancySpigot = m_dbe->book2D("Digi Spigot Occupancy Map",
00302 "Digi Spigot Occupancy Map",
00303 HcalDCCHeader::SPIGOT_COUNT,-0.5,HcalDCCHeader::SPIGOT_COUNT-0.5,
00304 36,-0.5,35.5);
00305 DigiOccupancySpigot -> setAxisTitle("Spigot",1);
00306 DigiOccupancySpigot -> setAxisTitle("DCC Id",2);
00307
00308 m_dbe->setCurrentFolder(baseFolder_+"/digi_errors");
00309
00310
00311
00312
00313
00314
00315
00316
00317 DigiErrorVME = m_dbe->book2D("Digi VME Error Map",
00318 "Digi VME Error Map",
00319 40,-0.25,19.75,18,-0.5,17.5);
00320 DigiErrorVME -> setAxisTitle("HTR Slot",1);
00321 DigiErrorVME -> setAxisTitle("VME Crate Id",2);
00322
00323 DigiErrorSpigot = m_dbe->book2D("Digi Spigot Error Map",
00324 "Digi Spigot Error Map",
00325 HcalDCCHeader::SPIGOT_COUNT,-0.5,HcalDCCHeader::SPIGOT_COUNT-0.5,
00326 36,-0.5,35.5);
00327 DigiErrorSpigot -> setAxisTitle("Spigot",1);
00328 DigiErrorSpigot -> setAxisTitle("DCC Id",2);
00329
00330 DigiBQ = m_dbe->book1D("# Bad Qual Digis","# Bad Qual Digis",DIGI_NUM,-0.5,DIGI_NUM-0.5);
00331 DigiBQ -> setAxisTitle("# Bad Quality Digis",1);
00332 DigiBQ -> setAxisTitle("# of Events",2);
00333
00334 DigiBQFrac = m_dbe->book1D("Bad Digi Fraction","Bad Digi Fraction",DIGI_BQ_FRAC_NBINS,(0-0.5/(DIGI_BQ_FRAC_NBINS-1)),1+0.5/(DIGI_BQ_FRAC_NBINS-1));
00335 DigiBQFrac -> setAxisTitle("Bad Quality Digi Fraction",1);
00336 DigiBQFrac -> setAxisTitle("# of Events",2);
00337
00338
00339 m_dbe->setCurrentFolder(baseFolder_+"/digi_info");
00340 DigiNum = m_dbe->book1D("# of Digis","# of Digis",DIGI_NUM,-0.5,DIGI_NUM-0.5);
00341 DigiNum -> setAxisTitle("# of Digis",1);
00342 DigiNum -> setAxisTitle("# of Events",2);
00343
00344
00345 m_dbe->setCurrentFolder(baseFolder_+"/digi_info/HB");
00346 hbHists.shape = m_dbe->book1D("HB Digi Shape","HB Digi Shape",10,-0.5,9.5);
00347 hbHists.shapeThresh = m_dbe->book1D("HB Digi Shape - over thresh",
00348 "HB Digi Shape - over thresh",
00349 10,-0.5,9.5);
00350 hbHists.shape->setAxisTitle("Time Slice",1);
00351 hbHists.shapeThresh->setAxisTitle("Time Slice",1);
00352
00353
00354 for (int ts=0;ts<9;++ts)
00355 {
00356 name<<"HB Plus Time Slices "<<ts<<" and "<<ts+1;
00357 hbHists.TS_sum_plus.push_back(m_dbe->book1D(name.str().c_str(),name.str().c_str(),50,-5.5,44.5));
00358 name.str("");
00359 name<<"HB Minus Time Slices "<<ts<<" and "<<ts+1;
00360 hbHists.TS_sum_minus.push_back(m_dbe->book1D(name.str().c_str(),name.str().c_str(),50,-5.5,44.5));
00361 name.str("");
00362 }
00363 hbHists.presample= m_dbe->book1D("HB Digi Presamples","HB Digi Presamples",50,-0.5,49.5);
00364 hbHists.BQ = m_dbe->book1D("HB Bad Quality Digis","HB Bad Quality Digis",DIGI_SUBDET_NUM,-0.5,DIGI_SUBDET_NUM-0.5);
00365 hbHists.BQFrac = m_dbe->book1D("HB Bad Quality Digi Fraction","HB Bad Quality Digi Fraction",DIGI_BQ_FRAC_NBINS,(0-0.5/(DIGI_BQ_FRAC_NBINS-1)),1+0.5/(DIGI_BQ_FRAC_NBINS-1));
00366 hbHists.DigiFirstCapID = m_dbe->book1D("HB Capid 1st Time Slice","HB Capid for 1st Time Slice",7,-3.5,3.5);
00367 hbHists.DigiFirstCapID -> setAxisTitle("CapID (T0) - 1st CapId (T0)",1);
00368 hbHists.DigiFirstCapID -> setAxisTitle("# of Events",2);
00369 hbHists.DVerr = m_dbe->book1D("HB Data Valid Err Bits","HB QIE Data Valid Err Bits",4,-0.5,3.5);
00370 hbHists.DVerr ->setBinLabel(1,"Err=0, DV=0",1);
00371 hbHists.DVerr ->setBinLabel(2,"Err=0, DV=1",1);
00372 hbHists.DVerr ->setBinLabel(3,"Err=1, DV=0",1);
00373 hbHists.DVerr ->setBinLabel(4,"Err=1, DV=1",1);
00374 hbHists.CapID = m_dbe->book1D("HB CapID","HB CapID",4,-0.5,3.5);
00375 hbHists.ADC = m_dbe->book1D("HB ADC count per time slice","HB ADC count per time slice",200,-0.5,199.5);
00376 hbHists.ADCsum = m_dbe->book1D("HB ADC sum", "HB ADC sum",200,-0.5,199.5);
00377
00378 m_dbe->setCurrentFolder(baseFolder_+"/digi_info/HE");
00379 heHists.shape = m_dbe->book1D("HE Digi Shape","HE Digi Shape",10,-0.5,9.5);
00380 heHists.shapeThresh = m_dbe->book1D("HE Digi Shape - over thresh",
00381 "HE Digi Shape - over thresh",
00382 10,-0.5,9.5);
00383 heHists.shape->setAxisTitle("Time Slice",1);
00384 heHists.shapeThresh->setAxisTitle("Time Slice",1);
00385
00386 for (int ts=0;ts<9;++ts)
00387 {
00388 name<<"HE Plus Time Slices "<<ts<<" and "<<ts+1;
00389 heHists.TS_sum_plus.push_back(m_dbe->book1D(name.str().c_str(),name.str().c_str(),50,-5.5,44.5));
00390 name.str("");
00391 name<<"HE Minus Time Slices "<<ts<<" and "<<ts+1;
00392 heHists.TS_sum_minus.push_back(m_dbe->book1D(name.str().c_str(),name.str().c_str(),50,-5.5,44.5));
00393 name.str("");
00394 }
00395
00396 heHists.presample= m_dbe->book1D("HE Digi Presamples","HE Digi Presamples",50,-0.5,49.5);
00397 heHists.BQ = m_dbe->book1D("HE Bad Quality Digis","HE Bad Quality Digis",DIGI_SUBDET_NUM,-0.5,DIGI_SUBDET_NUM-0.5);
00398 heHists.BQFrac = m_dbe->book1D("HE Bad Quality Digi Fraction","HE Bad Quality Digi Fraction",DIGI_BQ_FRAC_NBINS,(0-0.5/(DIGI_BQ_FRAC_NBINS-1)),1+0.5/(DIGI_BQ_FRAC_NBINS-1));
00399 heHists.DigiFirstCapID = m_dbe->book1D("HE Capid 1st Time Slice","HE Capid for 1st Time Slice",7,-3.5,3.5);
00400 heHists.DigiFirstCapID -> setAxisTitle("CapID (T0) - 1st CapId (T0)",1);
00401 heHists.DigiFirstCapID -> setAxisTitle("# of Events",2);
00402 heHists.DVerr = m_dbe->book1D("HE Data Valid Err Bits","HE QIE Data Valid Err Bits",4,-0.5,3.5);
00403 heHists.DVerr ->setBinLabel(1,"Err=0, DV=0",1);
00404 heHists.DVerr ->setBinLabel(2,"Err=0, DV=1",1);
00405 heHists.DVerr ->setBinLabel(3,"Err=1, DV=0",1);
00406 heHists.DVerr ->setBinLabel(4,"Err=1, DV=1",1);
00407 heHists.CapID = m_dbe->book1D("HE CapID","HE CapID",4,-0.5,3.5);
00408 heHists.ADC = m_dbe->book1D("HE ADC count per time slice","HE ADC count per time slice",200,-0.5,199.5);
00409 heHists.ADCsum = m_dbe->book1D("HE ADC sum", "HE ADC sum",200,-0.5,199.5);
00410
00411 m_dbe->setCurrentFolder(baseFolder_+"/digi_info/HO");
00412 hoHists.shape = m_dbe->book1D("HO Digi Shape","HO Digi Shape",10,-0.5,9.5);
00413 hoHists.shapeThresh = m_dbe->book1D("HO Digi Shape - over thresh",
00414 "HO Digi Shape - over thresh",
00415 10,-0.5,9.5);
00416 hoHists.shape->setAxisTitle("Time Slice",1);
00417 hoHists.shapeThresh->setAxisTitle("Time Slice",1);
00418
00419 for (int ts=0;ts<9;++ts)
00420 {
00421 name<<"HO Plus Time Slices "<<ts<<" and "<<ts+1;
00422 hoHists.TS_sum_plus.push_back(m_dbe->book1D(name.str().c_str(),name.str().c_str(),50,-5.5,44.5));
00423 name.str("");
00424 name<<"HO Minus Time Slices "<<ts<<" and "<<ts+1;
00425 hoHists.TS_sum_minus.push_back(m_dbe->book1D(name.str().c_str(),name.str().c_str(),50,-5.5,44.5));
00426 name.str("");
00427 }
00428 hoHists.presample= m_dbe->book1D("HO Digi Presamples","HO Digi Presamples",50,-0.5,49.5);
00429 hoHists.BQ = m_dbe->book1D("HO Bad Quality Digis","HO Bad Quality Digis",DIGI_SUBDET_NUM,-0.5,DIGI_SUBDET_NUM-0.5);
00430 hoHists.BQFrac = m_dbe->book1D("HO Bad Quality Digi Fraction","HO Bad Quality Digi Fraction",DIGI_BQ_FRAC_NBINS,(0-0.5/(DIGI_BQ_FRAC_NBINS-1)),1+0.5/(DIGI_BQ_FRAC_NBINS-1));
00431 hoHists.DigiFirstCapID = m_dbe->book1D("HO Capid 1st Time Slice","HO Capid for 1st Time Slice",7,-3.5,3.5);
00432 hoHists.DigiFirstCapID -> setAxisTitle("CapID (T0) - 1st CapId (T0)",1);
00433 hoHists.DigiFirstCapID -> setAxisTitle("# of Events",2);
00434 hoHists.DVerr = m_dbe->book1D("HO Data Valid Err Bits","HO QIE Data Valid Err Bits",4,-0.5,3.5);
00435 hoHists.DVerr ->setBinLabel(1,"Err=0, DV=0",1);
00436 hoHists.DVerr ->setBinLabel(2,"Err=0, DV=1",1);
00437 hoHists.DVerr ->setBinLabel(3,"Err=1, DV=0",1);
00438 hoHists.DVerr ->setBinLabel(4,"Err=1, DV=1",1);
00439 hoHists.CapID = m_dbe->book1D("HO CapID","HO CapID",4,-0.5,3.5);
00440 hoHists.ADC = m_dbe->book1D("HO ADC count per time slice","HO ADC count per time slice",200,-0.5,199.5);
00441 hoHists.ADCsum = m_dbe->book1D("HO ADC sum", "HO ADC sum",200,-0.5,199.5);
00442
00443 m_dbe->setCurrentFolder(baseFolder_+"/digi_info/HF");
00444 hfHists.shape = m_dbe->book1D("HF Digi Shape","HF Digi Shape",10,-0.5,9.5);
00445 hfHists.shapeThresh = m_dbe->book1D("HF Digi Shape - over thresh",
00446 "HF Digi Shape - over thresh",
00447 10,-0.5,9.5);
00448
00449 for (int ts=0;ts<9;++ts)
00450 {
00451 name<<"HF Plus Time Slices "<<ts<<" and "<<ts+1;
00452 hfHists.TS_sum_plus.push_back(m_dbe->book1D(name.str().c_str(),name.str().c_str(),50,-5.5,44.5));
00453 name.str("");
00454 name<<"HF Minus Time Slices "<<ts<<" and "<<ts+1;
00455 hfHists.TS_sum_minus.push_back(m_dbe->book1D(name.str().c_str(),name.str().c_str(),50,-5.5,44.5));
00456 name.str("");
00457 }
00458 hfHists.shape->setAxisTitle("Time Slice",1);
00459 hfHists.shapeThresh->setAxisTitle("Time Slice",1);
00460 hfHists.presample= m_dbe->book1D("HF Digi Presamples","HF Digi Presamples",50,-0.5,49.5);
00461 hfHists.BQ = m_dbe->book1D("HF Bad Quality Digis","HF Bad Quality Digis",DIGI_SUBDET_NUM,-0.5,DIGI_SUBDET_NUM-0.5);
00462 hfHists.BQFrac = m_dbe->book1D("HF Bad Quality Digi Fraction","HF Bad Quality Digi Fraction",DIGI_BQ_FRAC_NBINS,(0-0.5/(DIGI_BQ_FRAC_NBINS-1)),1+0.5/(DIGI_BQ_FRAC_NBINS-1));
00463 hfHists.DigiFirstCapID = m_dbe->book1D("HF Capid 1st Time Slice","HF Capid for 1st Time Slice",7,-3.5,3.5);
00464 hfHists.DigiFirstCapID -> setAxisTitle("CapID (T0) - 1st CapId (T0)",1);
00465 hfHists.DigiFirstCapID -> setAxisTitle("# of Events",2);
00466 hfHists.DVerr = m_dbe->book1D("HF Data Valid Err Bits","HF QIE Data Valid Err Bits",4,-0.5,3.5);
00467 hfHists.DVerr ->setBinLabel(1,"Err=0, DV=0",1);
00468 hfHists.DVerr ->setBinLabel(2,"Err=0, DV=1",1);
00469 hfHists.DVerr ->setBinLabel(3,"Err=1, DV=0",1);
00470 hfHists.DVerr ->setBinLabel(4,"Err=1, DV=1",1);
00471 hfHists.CapID = m_dbe->book1D("HF CapID","HF CapID",4,-0.5,3.5);
00472 hfHists.ADC = m_dbe->book1D("HF ADC count per time slice","HF ADC count per time slice",200,-0.5,199.5);
00473 hfHists.ADCsum = m_dbe->book1D("HF ADC sum", "HF ADC sum",200,-0.5,199.5);
00474
00475 }
00476 if (showTiming)
00477 {
00478 cpu_timer.stop(); cout <<"TIMER:: HcalDigiMonitor Setup -> "<<cpu_timer.cpuTime()<<endl;
00479 }
00480
00481 }
00482
00483
00484 void HcalDigiMonitor::processEvent(const HBHEDigiCollection& hbhe,
00485 const HODigiCollection& ho,
00486 const HFDigiCollection& hf,
00487 const HcalDbService& cond,
00488 const HcalUnpackerReport& report)
00489 {
00490 if(!m_dbe)
00491 {
00492 if(fVerbosity)
00493 cout <<"HcalDigiMonitor::processEvent DQMStore not instantiated!!!"<<endl;
00494 return;
00495 }
00496
00497
00498 ++ievt_;
00499 meEVT_->Fill(ievt_);
00500
00501 int iEta, iPhi, iDepth;
00502
00503 int err;
00504 bool occ, bitUp;
00505
00506 hbHists.count_bad=0;
00507 hbHists.count_all=0;
00508 heHists.count_bad=0;
00509 heHists.count_all=0;
00510 hoHists.count_bad=0;
00511 hoHists.count_all=0;
00512 hfHists.count_bad=0;
00513 hfHists.count_all=0;
00514
00515 int tssum=0;
00516
00517 if (showTiming)
00518 {
00519 cpu_timer.reset(); cpu_timer.start();
00520 }
00521
00523
00524 int firsthbcap=-1; int firsthecap=-1;
00525 for (HBHEDigiCollection::const_iterator j=hbhe.begin(); j!=hbhe.end(); ++j)
00526 {
00527 const HBHEDataFrame digi = (const HBHEDataFrame)(*j);
00528 iEta = digi.id().ieta();
00529 iPhi = digi.id().iphi();
00530 iDepth = digi.id().depth();
00531
00532 err=0x0;
00533 occ=false;
00534 bitUp=false;
00535
00536 int ADCcount=0;
00537
00538
00539 if ((HcalSubdetector)(digi.id().subdet())==HcalBarrel)
00540 {
00541 if (!hbHists.check) continue;
00542 ++hbHists.count_all;
00543
00544 if (digi.size()<mindigisize_ || digi.size()>maxdigisize_)
00545 {
00546 if (digi_checkdigisize_) err|=0x1;
00547 ++baddigisize[static_cast<int>(iEta+(etaBins_-2)/2)][iPhi-1][iDepth-1];
00548 }
00549
00550 if (digi.size()<20)
00551 ++digisize[static_cast<int>(digi.size())][0];
00552 else
00553 ++digisize[19][0];
00554
00555 ++hbHists.count_presample[digi.presamples()];
00556
00557
00558
00559 if (firsthbcap==-1) firsthbcap = digi.sample(0).capid();
00560 int capdif = digi.sample(0).capid() - firsthbcap;
00561
00562
00563 if (capdif >-4 && capdif<4)
00564 ++hbHists.capIDdiff[capdif+3];
00565 else
00566 {
00567 ++hbHists.capIDdiff[7];
00568 if (fVerbosity > 1)
00569 cout <<"<HcalDigiMonitor> Odd behavior of HB capIDs: capID diff = "<<capdif<<" = "<<digi.sample(0).capid()<< " - "<<firsthbcap<<endl;
00570 }
00571
00572 int last=-1;
00573 for (int i=0;i<digi.size();++i)
00574 {
00575
00576 int thisCapid = digi.sample(i).capid();
00577 if (thisCapid<4) ++hbHists.capid[thisCapid];
00578 if(bitUpset(last,thisCapid)) bitUp=true;
00579 last = thisCapid;
00580
00581
00582 if (digi_checkdverr_)
00583 {
00584 if(digi.sample(i).er()) err=(err|0x2);
00585 if(!digi.sample(i).dv()) err=(err|0x2);
00586 }
00587 if (digi.sample(i).er() || !digi.sample(i).dv())
00588 ++digierrorsdverr[static_cast<int>(iEta+(etaBins_-2)/2)][iPhi-1][iDepth-1];
00589 ++hbHists.dverr[static_cast<int>(2*digi.sample(i).er()+digi.sample(i).dv())];
00590
00591 ADCcount+=digi.sample(i).adc();
00592 if (digi.sample(i).adc()<200) ++hbHists.adc[digi.sample(i).adc()];
00593 hbHists.count_shape[i]+=digi.sample(i).adc();
00594
00595 if (i==digi.size()-1) continue;
00596 tssum= digi.sample(i).adc()+digi.sample(i+1).adc();
00597 if (tssum<45 && tssum>=-5)
00598 {
00599 if (iEta>0)
00600 ++hbHists.tssumplus[tssum+5][i];
00601 else
00602 ++hbHists.tssumminus[tssum+5][i];
00603 }
00604 }
00605 if(ADCcount>occThresh_) occ=true;
00606 if (ADCcount<200)
00607 ++hbHists.adcsum[ADCcount];
00608 if (ADCcount>shapeThresh_)
00609 {
00610 for (int i=0;i<digi.size();++i)
00611 hbHists.count_shapeThresh[i]+=digi.sample(i).adc();
00612 }
00613 if(bitUp)
00614 {
00615 if (digi_checkcapid_) err=(err|0x4);
00616 ++badcapID[static_cast<int>(iEta+(etaBins_-2)/2)][iPhi-1][iDepth-1];
00617 }
00618
00619 ++occupancyEtaPhi[static_cast<int>(iEta+(etaBins_-2)/2)][iPhi-1][iDepth-1];
00620 ++occupancyEta[static_cast<int>(iEta+(etaBins_-2)/2)];
00621 ++occupancyPhi[iPhi-1];
00622
00623
00624 ++occupancyVME[static_cast<int>(2*(digi.elecId().htrSlot()+0.5*digi.elecId().htrTopBottom()))][static_cast<int>(digi.elecId().readoutVMECrateId())];
00625 ++occupancySpigot[static_cast<int>(digi.elecId().spigot())][static_cast<int>(digi.elecId().dccid())];
00626 if (!occ)
00627 {
00628 if (digi_checkadcsum_) err=err|0x8;
00629 ++badADCsum[static_cast<int>(iEta+(etaBins_-2)/2)][iPhi-1][iDepth-1];
00630 }
00631 if (err>0)
00632 {
00633 ++hbHists.count_bad;
00634 ++problemdigis[static_cast<int>(iEta+(etaBins_-2)/2)][iPhi-1][iDepth-1];
00635 ++errorVME[static_cast<int>(2*(digi.elecId().htrSlot()+0.5*digi.elecId().htrTopBottom()))][static_cast<int>(digi.elecId().readoutVMECrateId())];
00636 ++errorSpigot[static_cast<int>(digi.elecId().spigot())][static_cast<int>(digi.elecId().dccid())];
00637 }
00638 }
00639 else
00640 {
00641 if (!heHists.check) continue;
00642 ++heHists.count_all;
00643 if (iDepth<3)
00644 iDepth=iDepth+4;
00645
00646
00647 if (digi.size()<mindigisize_ || digi.size()>maxdigisize_)
00648 {
00649 if (digi_checkdigisize_) err|=0x1;
00650 ++baddigisize[static_cast<int>(iEta+(etaBins_-2)/2)][iPhi-1][iDepth-1];
00651 }
00652
00653 if (digi.size()<20)
00654 ++digisize[static_cast<int>(digi.size())][1];
00655 else
00656 ++digisize[19][1];
00657
00658 ++heHists.count_presample[digi.presamples()];
00659
00660
00661 if (firsthecap==-1) firsthecap = digi.sample(0).capid();
00662 int capdif = digi.sample(0).capid() - firsthecap;
00663
00664
00665 if (capdif >-4 && capdif<4)
00666 ++heHists.capIDdiff[capdif+3];
00667 else
00668 {
00669 ++heHists.capIDdiff[7];
00670 if (fVerbosity > 1)
00671 cout <<"<HcalDigiMonitor> Odd behavior of HB capIDs: capID diff = "<<capdif<<" = "<<digi.sample(0).capid()<< " - "<<firsthbcap<<endl;
00672 }
00673 int last=-1;
00674 for (int i=0;i<digi.size();++i)
00675 {
00676 int thisCapid = digi.sample(i).capid();
00677 if (thisCapid<4) ++heHists.capid[thisCapid];
00678 if(bitUpset(last,thisCapid)) bitUp=true;
00679 last = thisCapid;
00680
00681 if (digi_checkdverr_)
00682 {
00683 if(digi.sample(i).er()) err=(err|0x2);
00684 if(!digi.sample(i).dv()) err=(err|0x2);
00685 }
00686 if (digi.sample(i).er() || !digi.sample(i).dv())
00687 ++digierrorsdverr[static_cast<int>(iEta+(etaBins_-2)/2)][iPhi-1][iDepth-1];
00688 ++heHists.dverr[static_cast<int>(2*digi.sample(i).er()+digi.sample(i).dv())];
00689 ADCcount+=digi.sample(i).adc();
00690 if (digi.sample(i).adc()<200) ++heHists.adc[digi.sample(i).adc()];
00691 heHists.count_shape[i]+=digi.sample(i).adc();
00692
00693 if (i==digi.size()-1) continue;
00694 tssum= digi.sample(i).adc()+digi.sample(i+1).adc();
00695 if (tssum<45 && tssum>=-5)
00696 {
00697 if (iEta>0)
00698 ++heHists.tssumplus[tssum+5][i];
00699 else
00700 ++heHists.tssumminus[tssum+5][i];
00701 }
00702 }
00703 if(ADCcount>occThresh_) occ=true;
00704 if (ADCcount<200)
00705 ++heHists.adcsum[ADCcount];
00706 if (ADCcount>shapeThresh_)
00707 {
00708 for (int i=0;i<digi.size();++i)
00709 heHists.count_shapeThresh[i]+=digi.sample(i).adc();
00710 }
00711 if(bitUp)
00712 {
00713 if (digi_checkcapid_) err=(err|0x4);
00714 ++badcapID[static_cast<int>(iEta+(etaBins_-2)/2)][iPhi-1][iDepth-1];
00715 }
00716
00717 ++occupancyEtaPhi[static_cast<int>(iEta+(etaBins_-2)/2)][iPhi-1][iDepth-1];
00718 ++occupancyEta[static_cast<int>(iEta+(etaBins_-2)/2)];
00719 ++occupancyPhi[iPhi-1];
00720
00721 ++occupancyVME[static_cast<int>(2*(digi.elecId().htrSlot()+0.5*digi.elecId().htrTopBottom()))][static_cast<int>(digi.elecId().readoutVMECrateId())];
00722 ++occupancySpigot[static_cast<int>(digi.elecId().spigot())][static_cast<int>(digi.elecId().dccid())];
00723 if (!occ)
00724 {
00725 if (digi_checkadcsum_) err=err|0x8;
00726 ++badADCsum[static_cast<int>(iEta+(etaBins_-2)/2)][iPhi-1][iDepth-1];
00727 }
00728 if (err>0)
00729 {
00730 ++heHists.count_bad;
00731 ++problemdigis[static_cast<int>(iEta+(etaBins_-2)/2)][iPhi-1][iDepth-1];
00732 ++errorVME[static_cast<int>(2*(digi.elecId().htrSlot()+0.5*digi.elecId().htrTopBottom()))][static_cast<int>(digi.elecId().readoutVMECrateId())];
00733 ++errorSpigot[static_cast<int>(digi.elecId().spigot())][static_cast<int>(digi.elecId().dccid())];
00734 }
00735 }
00736 }
00737
00738
00739 if (hbHists.check && hbHists.count_all>0)
00740 {
00741 ++hbHists.count_BQ[static_cast<int>(hbHists.count_bad)];
00742
00743 ++hbHists.count_BQFrac[static_cast<int>(hbHists.count_bad/hbHists.count_all)*DIGI_BQ_FRAC_NBINS];
00744 }
00745 if (heHists.check && heHists.count_all>0)
00746 {
00747 ++heHists.count_BQ[static_cast<int>(heHists.count_bad)];
00748
00749 ++heHists.count_BQFrac[static_cast<int>(heHists.count_bad/heHists.count_all)*DIGI_BQ_FRAC_NBINS];
00750 }
00751
00752 if (showTiming)
00753 {
00754 cpu_timer.stop(); cout <<"TIMER:: HcalDigiMonitor DIGI HBHE -> "<<cpu_timer.cpuTime()<<endl;
00755 cpu_timer.reset(); cpu_timer.start();
00756 }
00757
00758
00760 if (hoHists.check)
00761 {
00762 int firsthocap=-1;
00763 for (HODigiCollection::const_iterator j=ho.begin(); j!=ho.end(); ++j)
00764 {
00765 const HODataFrame digi = (const HODataFrame)(*j);
00766 iEta = digi.id().ieta();
00767 iPhi = digi.id().iphi();
00768 iDepth = digi.id().depth();
00769
00770 err=0x0;
00771 occ=false;
00772 bitUp=false;
00773
00774 int ADCcount=0;
00775 ++hoHists.count_all;
00776
00777
00778 if (digi.size()<mindigisize_ || digi.size()>maxdigisize_)
00779 {
00780 if (digi_checkdigisize_) err|=0x1;
00781 ++baddigisize[static_cast<int>(iEta+(etaBins_-2)/2)][iPhi-1][iDepth-1];
00782 }
00783
00784 if (digi.size()<20)
00785 ++digisize[static_cast<int>(digi.size())][2];
00786 else
00787 ++digisize[19][2];
00788
00789 ++hoHists.count_presample[digi.presamples()];
00790
00791
00792 if (firsthocap==-1) firsthocap = digi.sample(0).capid();
00793 int capdif = digi.sample(0).capid() - firsthocap;
00794
00795 if (capdif >-4 && capdif<4)
00796 ++hoHists.capIDdiff[capdif+3];
00797 else
00798 {
00799 ++hoHists.capIDdiff[7];
00800 if (fVerbosity > 1)
00801 cout <<"<HcalDigiMonitor> Odd behavior of HB capIDs: capID diff = "<<capdif<<" = "<<digi.sample(0).capid()<< " - "<<firsthbcap<<endl;
00802 }
00803 int last=-1;
00804 for (int i=0;i<digi.size();++i)
00805 {
00806 int thisCapid = digi.sample(i).capid();
00807 if (thisCapid<4) ++hoHists.capid[thisCapid];
00808 if(bitUpset(last,thisCapid)) bitUp=true;
00809 last = thisCapid;
00810
00811 if (digi_checkdverr_)
00812 {
00813 if(digi.sample(i).er()) err=(err|0x2);
00814 if(!digi.sample(i).dv()) err=(err|0x2);
00815 }
00816 if (digi.sample(i).er() || !digi.sample(i).dv())
00817 ++digierrorsdverr[static_cast<int>(iEta+(etaBins_-2)/2)][iPhi-1][iDepth-1];
00818 ++hoHists.dverr[static_cast<int>(2*digi.sample(i).er()+digi.sample(i).dv())];
00819 ADCcount+=digi.sample(i).adc();
00820 if (digi.sample(i).adc()<200) ++hoHists.adc[digi.sample(i).adc()];
00821 hoHists.count_shape[i]+=digi.sample(i).adc();
00822
00823 if (i==digi.size()-1) continue;
00824 tssum= digi.sample(i).adc()+digi.sample(i+1).adc();
00825 if (tssum<45 && tssum>=-5)
00826 {
00827 if (iEta>0)
00828 ++hoHists.tssumplus[tssum+5][i];
00829 else
00830 ++hoHists.tssumminus[tssum+5][i];
00831 }
00832 }
00833 if(ADCcount>occThresh_) occ=true;
00834 if (ADCcount<200)
00835 ++hoHists.adcsum[ADCcount];
00836 if (ADCcount>shapeThresh_)
00837 {
00838 for (int i=0;i<digi.size();++i)
00839 hoHists.count_shapeThresh[i]+=digi.sample(i).adc();
00840 }
00841 if(bitUp)
00842 {
00843 if (digi_checkcapid_) err=(err|0x4);
00844 ++badcapID[static_cast<int>(iEta+(etaBins_-2)/2)][iPhi-1][iDepth-1];
00845 }
00846
00847 ++occupancyEtaPhi[static_cast<int>(iEta+(etaBins_-2)/2)][iPhi-1][iDepth-1];
00848 ++occupancyEta[static_cast<int>(iEta+(etaBins_-2)/2)];
00849 ++occupancyPhi[iPhi-1];
00850
00851 ++occupancyVME[static_cast<int>(2*(digi.elecId().htrSlot()+0.5*digi.elecId().htrTopBottom()))][static_cast<int>(digi.elecId().readoutVMECrateId())];
00852 ++occupancySpigot[static_cast<int>(digi.elecId().spigot())][static_cast<int>(digi.elecId().dccid())];
00853 if (!occ)
00854 {
00855 if (digi_checkadcsum_) err=err|0x8;
00856 ++badADCsum[static_cast<int>(iEta+(etaBins_-2)/2)][iPhi-1][iDepth-1];
00857 }
00858 if (err>0)
00859 {
00860 ++hoHists.count_bad;
00861 ++problemdigis[static_cast<int>(iEta+(etaBins_-2)/2)][iPhi-1][iDepth-1];
00862 ++errorVME[static_cast<int>(2*(digi.elecId().htrSlot()+0.5*digi.elecId().htrTopBottom()))][static_cast<int>(digi.elecId().readoutVMECrateId())];
00863 ++errorSpigot[static_cast<int>(digi.elecId().spigot())][static_cast<int>(digi.elecId().dccid())];
00864 }
00865 }
00866
00867 if (hoHists.count_all>0)
00868 {
00869 ++hoHists.count_BQ[static_cast<int>(hoHists.count_bad)];
00870
00871 ++hoHists.count_BQFrac[static_cast<int>(hoHists.count_bad/hoHists.count_all)*DIGI_BQ_FRAC_NBINS];
00872 }
00873 }
00874
00875 if (showTiming)
00876 {
00877 cpu_timer.stop(); cout <<"TIMER:: HcalDigiMonitor DIGI HO -> "<<cpu_timer.cpuTime()<<endl;
00878 cpu_timer.reset(); cpu_timer.start();
00879 }
00880
00882 if (hfHists.check)
00883 {
00884 int firsthfcap=-1;
00885 for (HFDigiCollection::const_iterator j=hf.begin(); j!=hf.end(); ++j)
00886 {
00887 const HFDataFrame digi = (const HFDataFrame)(*j);
00888 iEta = digi.id().ieta();
00889 iPhi = digi.id().iphi();
00890 iDepth = digi.id().depth();
00891
00892 err=0x0;
00893 occ=false;
00894 bitUp=false;
00895
00896 int ADCcount=0;
00897 ++hfHists.count_all;
00898
00899
00900 if (digi.size()<mindigisize_ || digi.size()>maxdigisize_)
00901 {
00902 if (digi_checkdigisize_) err|=0x1;
00903 ++baddigisize[static_cast<int>(iEta+(etaBins_-2)/2)][iPhi-1][iDepth-1];
00904 }
00905
00906 if (digi.size()<20)
00907 ++digisize[static_cast<int>(digi.size())][3];
00908 else
00909 ++digisize[19][3];
00910
00911 ++hfHists.count_presample[digi.presamples()];
00912
00913
00914 if (firsthfcap==-1) firsthfcap = digi.sample(0).capid();
00915 int capdif = digi.sample(0).capid() - firsthfcap;
00916
00917
00918 if (capdif >-4 && capdif<4)
00919 ++hoHists.capIDdiff[capdif+3];
00920 else
00921 {
00922 ++hoHists.capIDdiff[7];
00923 if (fVerbosity > 1)
00924 cout <<"<HcalDigiMonitor> Odd behavior of HB capIDs: capID diff = "<<capdif<<" = "<<digi.sample(0).capid()<< " - "<<firsthbcap<<endl;
00925 }
00926 int last=-1;
00927 for (int i=0;i<digi.size();++i)
00928 {
00929 int thisCapid = digi.sample(i).capid();
00930 if (thisCapid<4) ++hfHists.capid[thisCapid];
00931 if(bitUpset(last,thisCapid)) bitUp=true;
00932 last = thisCapid;
00933
00934 if (digi_checkdverr_)
00935 {
00936 if(digi.sample(i).er()) err=(err|0x2);
00937 if(!digi.sample(i).dv()) err=(err|0x2);
00938 }
00939 if (digi.sample(i).er() || !digi.sample(i).dv())
00940 ++digierrorsdverr[static_cast<int>(iEta+(etaBins_-2)/2)][iPhi-1][iDepth-1];
00941 ++hfHists.dverr[static_cast<int>(2*digi.sample(i).er()+digi.sample(i).dv())];
00942 ADCcount+=digi.sample(i).adc();
00943 if (digi.sample(i).adc()<200) ++hfHists.adc[digi.sample(i).adc()];
00944 hfHists.count_shape[i]+=digi.sample(i).adc();
00945
00946 if (i==digi.size()-1) continue;
00947 tssum= digi.sample(i).adc()+digi.sample(i+1).adc();
00948 if (tssum<45 && tssum>=-5)
00949 {
00950 if (iEta>0)
00951 ++hfHists.tssumplus[tssum+5][i];
00952 else
00953 ++hfHists.tssumminus[tssum+5][i];
00954 }
00955 }
00956 if(ADCcount>occThresh_) occ=true;
00957 if (ADCcount<200)
00958 ++hfHists.adcsum[ADCcount];
00959 if (ADCcount>shapeThresh_)
00960 {
00961 for (int i=0;i<digi.size();++i)
00962 hfHists.count_shapeThresh[i]+=digi.sample(i).adc();
00963 }
00964 if(bitUp)
00965 {
00966 if (digi_checkcapid_) err=(err|0x4);
00967 ++badcapID[static_cast<int>(iEta+(etaBins_-2)/2)][iPhi-1][iDepth-1];
00968 }
00969
00970 ++occupancyEtaPhi[static_cast<int>(iEta+(etaBins_-2)/2)][iPhi-1][iDepth-1];
00971 ++occupancyEta[static_cast<int>(iEta+(etaBins_-2)/2)];
00972 ++occupancyPhi[iPhi-1];
00973
00974 ++occupancyVME[static_cast<int>(2*(digi.elecId().htrSlot()+0.5*digi.elecId().htrTopBottom()))][static_cast<int>(digi.elecId().readoutVMECrateId())];
00975 ++occupancySpigot[static_cast<int>(digi.elecId().spigot())][static_cast<int>(digi.elecId().dccid())];
00976 if (!occ)
00977 {
00978 if (digi_checkadcsum_) err=err|0x8;
00979 ++badADCsum[static_cast<int>(iEta+(etaBins_-2)/2)][iPhi-1][iDepth-1];
00980 }
00981 if (err>0)
00982 {
00983 ++hfHists.count_bad;
00984 ++problemdigis[static_cast<int>(iEta+(etaBins_-2)/2)][iPhi-1][iDepth-1];
00985 ++errorVME[static_cast<int>(2*(digi.elecId().htrSlot()+0.5*digi.elecId().htrTopBottom()))][static_cast<int>(digi.elecId().readoutVMECrateId())];
00986 ++errorSpigot[static_cast<int>(digi.elecId().spigot())][static_cast<int>(digi.elecId().dccid())];
00987 }
00988 }
00989
00990 if (hfHists.count_all>0)
00991 {
00992 ++hfHists.count_BQ[static_cast<int>(hfHists.count_bad)];
00993
00994 ++hfHists.count_BQFrac[static_cast<int>(hfHists.count_bad/hfHists.count_all)*DIGI_BQ_FRAC_NBINS];
00995 }
00996 }
00997
00998 if (showTiming)
00999 {
01000 cpu_timer.stop(); cout <<"TIMER:: HcalDigiMonitor DIGI HF -> "<<cpu_timer.cpuTime()<<endl;
01001 }
01002
01003
01004 int count_all=hbHists.count_all+heHists.count_all+hoHists.count_all+hfHists.count_all;
01005 int count_bad=hbHists.count_bad+heHists.count_bad+hoHists.count_bad+hfHists.count_bad;
01006
01007 ++digiBQ[count_bad];
01008 ++diginum[count_all];
01009 if (count_all>0)
01010 ++digiBQfrac[static_cast<int>(count_bad/count_all)*DIGI_BQ_FRAC_NBINS];
01011
01012 if (ievt_%digi_checkNevents_==0)
01013 fill_Nevents();
01014
01015 return;
01016 }
01017
01018
01019 void HcalDigiMonitor::fill_Nevents()
01020 {
01021 if (showTiming)
01022 {
01023 cpu_timer.reset(); cpu_timer.start();
01024 }
01025
01026 if (fVerbosity>0)
01027 cout <<"<HcalDigiMonitor> Calling fill_Nevents for event # "<<ievt_<<endl;
01028 int iPhi, iEta, iDepth;
01029 double problemvalue=0;
01030 double problemsum=0;
01031 bool valid=false;
01032
01033
01034
01035 for (int i=0;i<10;++i)
01036 {
01037 for (int j=0;j<50;++j)
01038 {
01039 if (hbHists.tssumplus[j][i]>0) hbHists.TS_sum_plus[i]->setBinContent(j+1, hbHists.tssumplus[j][i]);
01040 if (hbHists.tssumminus[j][i]>0) hbHists.TS_sum_minus[i]->setBinContent(j+1, hbHists.tssumminus[j][i]);
01041 if (heHists.tssumplus[j][i]>0) heHists.TS_sum_plus[i]->setBinContent(j+1, heHists.tssumplus[j][i]);
01042 if (heHists.tssumminus[j][i]>0) heHists.TS_sum_minus[i]->setBinContent(j+1, heHists.tssumminus[j][i]);
01043 if (hoHists.tssumplus[j][i]>0) hoHists.TS_sum_plus[i]->setBinContent(j+1, hoHists.tssumplus[j][i]);
01044 if (hoHists.tssumminus[j][i]>0) hoHists.TS_sum_minus[i]->setBinContent(j+1, hoHists.tssumminus[j][i]);
01045 if (hfHists.tssumplus[j][i]>0) hfHists.TS_sum_plus[i]->setBinContent(j+1, hfHists.tssumplus[j][i]);
01046 if (hfHists.tssumminus[j][i]>0) hfHists.TS_sum_minus[i]->setBinContent(j+1, hfHists.tssumminus[j][i]);
01047 }
01048 }
01049
01050
01051 for (int i=0;i<DIGI_NUM;++i)
01052 {
01053 if (diginum[i]>0) DigiNum->setBinContent(i+1,diginum[i]);
01054 if (digiBQ[i]>0) DigiBQ->setBinContent(i+1,digiBQ[i]);
01055 if (i>=DIGI_SUBDET_NUM) continue;
01056 if (hbHists.count_BQ[i]>0) hbHists.BQ->setBinContent(i+1,hbHists.count_BQ[i]);
01057 if (heHists.count_BQ[i]>0) heHists.BQ->setBinContent(i+1,heHists.count_BQ[i]);
01058 if (hoHists.count_BQ[i]>0) hoHists.BQ->setBinContent(i+1,hoHists.count_BQ[i]);
01059 if (hfHists.count_BQ[i]>0) hfHists.BQ->setBinContent(i+1,hfHists.count_BQ[i]);
01060
01061 }
01062
01063
01064 for (int i=0;i<4;++i)
01065 {
01066 if (hbHists.dverr[i]>0) hbHists.DVerr->setBinContent(i+1,hbHists.dverr[i]);
01067 if (heHists.dverr[i]>0) heHists.DVerr->setBinContent(i+1,heHists.dverr[i]);
01068 if (hoHists.dverr[i]>0) hoHists.DVerr->setBinContent(i+1,hoHists.dverr[i]);
01069 if (hfHists.dverr[i]>0) hfHists.DVerr->setBinContent(i+1,hfHists.dverr[i]);
01070 if (hbHists.capid[i]>0) hbHists.CapID->setBinContent(i+1,hbHists.capid[i]);
01071 if (heHists.capid[i]>0) heHists.CapID->setBinContent(i+1,heHists.capid[i]);
01072 if (hoHists.capid[i]>0) hoHists.CapID->setBinContent(i+1,hoHists.capid[i]);
01073 if (hfHists.capid[i]>0) hfHists.CapID->setBinContent(i+1,hfHists.capid[i]);
01074 }
01075 for (int i=0;i<200;++i)
01076 {
01077 if (hbHists.adc[i]>0) hbHists.ADC->setBinContent(i+1,hbHists.adc[i]);
01078 if (heHists.adc[i]>0) heHists.ADC->setBinContent(i+1,heHists.adc[i]);
01079 if (hoHists.adc[i]>0) hoHists.ADC->setBinContent(i+1,hoHists.adc[i]);
01080 if (hfHists.adc[i]>0) hfHists.ADC->setBinContent(i+1,hfHists.adc[i]);
01081 if (hbHists.adcsum[i]>0) hbHists.ADCsum->setBinContent(i+1,hbHists.adcsum[i]);
01082 if (heHists.adcsum[i]>0) heHists.ADCsum->setBinContent(i+1,heHists.adcsum[i]);
01083 if (hoHists.adcsum[i]>0) hoHists.ADCsum->setBinContent(i+1,hoHists.adcsum[i]);
01084 if (hfHists.adcsum[i]>0) hfHists.ADCsum->setBinContent(i+1,hfHists.adcsum[i]);
01085 }
01086
01087
01088
01089 for (int i=0;i<DIGI_BQ_FRAC_NBINS;++i)
01090 {
01091 if (digiBQfrac[i]>0) DigiBQFrac->setBinContent(i+1,digiBQfrac[i]);
01092 if (hbHists.count_BQFrac[i]>0) hbHists.BQFrac->setBinContent(i+1,hbHists.count_BQFrac[i]);
01093 if (heHists.count_BQFrac[i]>0) heHists.BQFrac->setBinContent(i+1,heHists.count_BQFrac[i]);
01094 if (hoHists.count_BQFrac[i]>0) hoHists.BQFrac->setBinContent(i+1,hoHists.count_BQFrac[i]);
01095 if (hfHists.count_BQFrac[i]>0) hfHists.BQFrac->setBinContent(i+1,hfHists.count_BQFrac[i]);
01096
01097 }
01098
01099
01100 for (int i=0;i<50;++i)
01101 {
01102 if (hbHists.count_presample[i]>0) hbHists.presample->setBinContent(i+1,hbHists.count_presample[i]);
01103 if (heHists.count_presample[i]>0) heHists.presample->setBinContent(i+1,heHists.count_presample[i]);
01104 if (hoHists.count_presample[i]>0) hoHists.presample->setBinContent(i+1,hoHists.count_presample[i]);
01105 if (hfHists.count_presample[i]>0) hfHists.presample->setBinContent(i+1,hfHists.count_presample[i]);
01106 }
01107
01108
01109 for (int i=0;i<10;++i)
01110 {
01111 if (hbHists.count_shape[i]>0) hbHists.shape->setBinContent(i+1,hbHists.count_shape[i]);
01112 if (hbHists.count_shapeThresh[i]>0) hbHists.shapeThresh->setBinContent(i+1,hbHists.count_shapeThresh[i]);
01113 if (heHists.count_shape[i]>0) heHists.shape->setBinContent(i+1,heHists.count_shape[i]);
01114 if (heHists.count_shapeThresh[i]>0) heHists.shapeThresh->setBinContent(i+1,heHists.count_shapeThresh[i]);
01115 if (hoHists.count_shape[i]>0) hoHists.shape->setBinContent(i+1,hoHists.count_shape[i]);
01116 if (hoHists.count_shapeThresh[i]>0) hoHists.shapeThresh->setBinContent(i+1,hoHists.count_shapeThresh[i]);
01117 if (hfHists.count_shape[i]>0) hfHists.shape->setBinContent(i+1,hfHists.count_shape[i]);
01118 if (hfHists.count_shapeThresh[i]>0) hfHists.shapeThresh->setBinContent(i+1,hfHists.count_shapeThresh[i]);
01119 }
01120
01121
01122 for (int i=0;i<8;++i)
01123 {
01124 if (hbHists.capIDdiff[i]>0) hbHists.DigiFirstCapID->setBinContent(i+1,hbHists.capIDdiff[i]);
01125 if (heHists.capIDdiff[i]>0) heHists.DigiFirstCapID->setBinContent(i+1,heHists.capIDdiff[i]);
01126 if (hoHists.capIDdiff[i]>0) hoHists.DigiFirstCapID->setBinContent(i+1,hoHists.capIDdiff[i]);
01127 if (hfHists.capIDdiff[i]>0) hfHists.DigiFirstCapID->setBinContent(i+1,hfHists.capIDdiff[i]);
01128 }
01129
01130
01131
01132 for (int i=0;i<40;++i)
01133 {
01134 for (int j=0;j<18;++j)
01135 {
01136 if (errorVME[i][j]>0) DigiErrorVME->setBinContent(i+1,j+1,errorVME[i][j]);
01137 if (occupancyVME[i][j]>0) DigiOccupancyVME->setBinContent(i+1,j+1,occupancyVME[i][j]);
01138 }
01139 }
01140
01141
01142 for (int i=0;i<HcalDCCHeader::SPIGOT_COUNT;++i)
01143 {
01144 for (int j=0;j<36;++j)
01145 {
01146 if (errorSpigot[i][j]>0) DigiErrorSpigot->setBinContent(i+1,j+1,errorSpigot[i][j]);
01147 if (occupancySpigot[i][j]>0) DigiOccupancySpigot->setBinContent(i+1,j+1,occupancySpigot[i][j]);
01148 }
01149 }
01150
01151
01152 for (int sub=0;sub<4;++sub)
01153 {
01154 for (int dsize=0;dsize<20;++dsize)
01155 {
01156 if (digisize[dsize][sub]>0)
01157 DigiSize->setBinContent(sub+1,dsize+1,digisize[dsize][sub]);
01158 }
01159 }
01160
01161
01162
01163 for (int phi=0;phi<(phiBins_-2);++phi)
01164 {
01165 DigiOccupancyPhi->setBinContent(phi+2,occupancyPhi[phi]);
01166 for (int eta=0;eta<(etaBins_-2);++eta)
01167 {
01168 if (phi==0)
01169 DigiOccupancyEta->setBinContent(eta+2,occupancyEta[eta]);
01170 problemsum=0;
01171 valid=false;
01172
01173 for (int d=0;d<6;++d)
01174 {
01175 iPhi=phi+1;
01176 iEta=eta-int((etaBins_-2)/2);
01177 iDepth=d+1;
01178
01179
01180 if (validDetId(HcalBarrel, iEta, iPhi, iDepth))
01181 {
01182 valid=true;
01183 if (hbHists.check)
01184 {
01185 if (occupancyEtaPhi[eta][phi][d]==0 && digi_checkoccupancy_)
01186 {
01187 problemdigis[eta][phi][d]+=digi_checkNevents_;
01188 }
01189
01190
01191
01192
01193 DigiOccupancyByDepth[d]->setBinContent(eta+2,phi+2,
01194 ((ievt_-digi_checkNevents_)*DigiOccupancyByDepth[d]->getBinContent(eta+2,phi+2)+occupancyEtaPhi[eta][phi][d])/ievt_);
01195
01196 DigiErrorsBadCapID[d]->setBinContent(eta+2, phi+2,
01197 badcapID[eta][phi][d]/ievt_);
01198 DigiErrorsBadDigiSize[d]->setBinContent(eta+2, phi+2,
01199 baddigisize[eta][phi][d]/ievt_);
01200 DigiErrorsBadADCSum[d]->setBinContent(eta+2, phi+2,
01201 badADCsum[eta][phi][d]/ievt_);
01202 DigiErrorsDVErr[d]->setBinContent(eta+2, phi+2,
01203 digierrorsdverr[eta][phi][d]/ievt_);
01204 problemsum+=problemdigis[eta][phi][d];
01205 problemvalue=problemdigis[eta][phi][d]/ievt_;
01206 if (problemvalue>1)
01207 problemvalue=1;
01208 ProblemDigisByDepth[d]->setBinContent(eta+2, phi+2,
01209 problemvalue);
01210 }
01211 }
01212
01213 if (d==2 && validDetId(HcalEndcap, iEta, iPhi, iDepth))
01214 {
01215 valid=true;
01216 if (heHists.check)
01217 {
01218 if (occupancyEtaPhi[eta][phi][d]==0 && digi_checkoccupancy_)
01219 {
01220 problemdigis[eta][phi][d]+=digi_checkNevents_;
01221 }
01222
01223
01224
01225
01226 DigiOccupancyByDepth[d]->setBinContent(eta+2,phi+2,
01227 ((ievt_-digi_checkNevents_)*DigiOccupancyByDepth[d]->getBinContent(eta+2,phi+2)+occupancyEtaPhi[eta][phi][d])/ievt_);
01228
01229 DigiErrorsBadCapID[d]->setBinContent(eta+2, phi+2,
01230 badcapID[eta][phi][d]/ievt_);
01231 DigiErrorsBadDigiSize[d]->setBinContent(eta+2, phi+2,
01232 baddigisize[eta][phi][d]/ievt_);
01233 DigiErrorsBadADCSum[d]->setBinContent(eta+2, phi+2,
01234 badADCsum[eta][phi][d]/ievt_);
01235 DigiErrorsDVErr[d]->setBinContent(eta+2, phi+2,
01236 digierrorsdverr[eta][phi][d]/ievt_);
01237 problemsum+=problemdigis[eta][phi][d];
01238 problemvalue=problemdigis[eta][phi][d]/ievt_;
01239 if (problemvalue>1)
01240 problemvalue=1;
01241 ProblemDigisByDepth[d]->setBinContent(eta+2, phi+2,
01242 problemvalue);
01243 }
01244 }
01245
01246 if (validDetId(HcalOuter,iEta,iPhi,iDepth))
01247 {
01248 valid=true;
01249 if (hoHists.check)
01250 {
01251 if (occupancyEtaPhi[eta][phi][d]==0 && digi_checkoccupancy_)
01252 {
01253 problemdigis[eta][phi][d]+=digi_checkNevents_;
01254 }
01255
01256
01257
01258
01259 DigiOccupancyByDepth[d]->setBinContent(eta+2,phi+2,
01260 ((ievt_-digi_checkNevents_)*DigiOccupancyByDepth[d]->getBinContent(eta+2,phi+2)+occupancyEtaPhi[eta][phi][d])/ievt_);
01261
01262 DigiErrorsBadCapID[d]->setBinContent(eta+2, phi+2,
01263 badcapID[eta][phi][d]/ievt_);
01264 DigiErrorsBadDigiSize[d]->setBinContent(eta+2, phi+2,
01265 baddigisize[eta][phi][d]/ievt_);
01266 DigiErrorsBadADCSum[d]->setBinContent(eta+2, phi+2,
01267 badADCsum[eta][phi][d]/ievt_);
01268 DigiErrorsDVErr[d]->setBinContent(eta+2, phi+2,
01269 digierrorsdverr[eta][phi][d]/ievt_);
01270 problemsum+=problemdigis[eta][phi][d];
01271 problemvalue=problemdigis[eta][phi][d]/ievt_;
01272 if (problemvalue>1)
01273 problemvalue=1;
01274 ProblemDigisByDepth[d]->setBinContent(eta+2, phi+2,
01275 problemvalue);
01276 }
01277 }
01278
01279 if (validDetId(HcalForward,iEta,iPhi,iDepth))
01280 {
01281 valid=true;
01282 if (hfHists.check)
01283 {
01284 if (occupancyEtaPhi[eta][phi][d]==0 && digi_checkoccupancy_)
01285 {
01286 problemdigis[eta][phi][d]+=digi_checkNevents_;
01287 }
01288
01289
01290
01291
01292 DigiOccupancyByDepth[d]->setBinContent(eta+2,phi+2,
01293 ((ievt_-digi_checkNevents_)*DigiOccupancyByDepth[d]->getBinContent(eta+2,phi+2)+occupancyEtaPhi[eta][phi][d])/ievt_);
01294
01295 DigiErrorsBadCapID[d]->setBinContent(eta+2, phi+2,
01296 badcapID[eta][phi][d]/ievt_);
01297 DigiErrorsBadDigiSize[d]->setBinContent(eta+2, phi+2,
01298 baddigisize[eta][phi][d]/ievt_);
01299 DigiErrorsBadADCSum[d]->setBinContent(eta+2, phi+2,
01300 badADCsum[eta][phi][d]/ievt_);
01301 DigiErrorsDVErr[d]->setBinContent(eta+2, phi+2,
01302 digierrorsdverr[eta][phi][d]/ievt_);
01303 problemsum+=problemdigis[eta][phi][d];
01304 problemvalue=problemdigis[eta][phi][d]/ievt_;
01305 if (problemvalue>1)
01306 problemvalue=1;
01307 ProblemDigisByDepth[d]->setBinContent(eta+2, phi+2,
01308 problemvalue);
01309 }
01310 }
01311
01312 if (d>3)
01313 {
01314 if (!heHists.check) continue;
01315 iDepth=d-3;
01316 if (validDetId(HcalEndcap,iEta,iPhi,iDepth))
01317 {
01318 valid=true;
01319 if (occupancyEtaPhi[eta][phi][d]==0 && digi_checkoccupancy_)
01320 {
01321 problemdigis[eta][phi][d]+=digi_checkNevents_;
01322 }
01323
01324
01325
01326
01327 DigiOccupancyByDepth[d]->setBinContent(eta+2,phi+2,
01328 ((ievt_-digi_checkNevents_)*DigiOccupancyByDepth[d]->getBinContent(eta+2,phi+2)+occupancyEtaPhi[eta][phi][d])/ievt_);
01329
01330 DigiErrorsBadCapID[d]->setBinContent(eta+2, phi+2,
01331 badcapID[eta][phi][d]/ievt_);
01332 DigiErrorsBadDigiSize[d]->setBinContent(eta+2, phi+2,
01333 baddigisize[eta][phi][d]/ievt_);
01334 DigiErrorsBadADCSum[d]->setBinContent(eta+2, phi+2,
01335 badADCsum[eta][phi][d]/ievt_);
01336 DigiErrorsDVErr[d]->setBinContent(eta+2, phi+2,
01337 digierrorsdverr[eta][phi][d]/ievt_);
01338 problemsum+=problemdigis[eta][phi][d];
01339 problemvalue=problemdigis[eta][phi][d]/ievt_;
01340 if (problemvalue>1)
01341 problemvalue=1;
01342 ProblemDigisByDepth[d]->setBinContent(eta+2, phi+2,
01343 problemvalue);
01344 }
01345 }
01346
01347 occupancyEtaPhi[eta][phi][d]=0;
01348 }
01349 if (valid==true)
01350 {
01351 problemvalue=min(1.,problemsum/ievt_);
01352 ProblemDigis->setBinContent(eta+2,phi+2,problemvalue);
01353 }
01354 }
01355 }
01356
01357
01358 FillUnphysicalHEHFBins(ProblemDigis);
01359 FillUnphysicalHEHFBins(ProblemDigisByDepth);
01360 FillUnphysicalHEHFBins(DigiErrorsBadCapID);
01361 FillUnphysicalHEHFBins(DigiErrorsDVErr);
01362 FillUnphysicalHEHFBins(DigiErrorsBadDigiSize);
01363 FillUnphysicalHEHFBins(DigiErrorsBadADCSum);
01364 FillUnphysicalHEHFBins(DigiErrorsNoDigi);
01365 FillUnphysicalHEHFBins(DigiOccupancyByDepth);
01366 if (showTiming)
01367 {
01368 cpu_timer.stop(); cout <<"TIMER:: HcalDigiMonitor DIGI fill_Nevents -> "<<cpu_timer.cpuTime()<<endl;
01369 }
01370 return;
01371 }
01372
01373 void HcalDigiMonitor::setSubDetectors(bool hb, bool he, bool ho, bool hf)
01374 {
01375 hbHists.check&=hb;
01376 heHists.check&=he;
01377 hoHists.check&=ho;
01378 hfHists.check&=hf;
01379
01380 return;
01381 }
01382