00001 #include "DQM/HcalMonitorTasks/interface/HcalDigiMonitor.h"
00002 #include "EventFilter/HcalRawToDigi/interface/HcalDCCHeader.h"
00003 #include <cmath>
00004
00005 #include "FWCore/Common/interface/TriggerNames.h"
00006 #include "FWCore/Framework/interface/LuminosityBlock.h"
00007 #include "DataFormats/Common/interface/TriggerResults.h"
00008 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h"
00009 #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
00010 #include "Geometry/HcalTowerAlgo/src/HcalHardcodeGeometryData.h"
00011 #include "CondFormats/HcalObjects/interface/HcalChannelQuality.h"
00012
00013
00014 HcalDigiMonitor::HcalDigiMonitor(const edm::ParameterSet& ps)
00015 {
00016 Online_ = ps.getUntrackedParameter<bool>("online",false);
00017 mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns",false);
00018 enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup",false);
00019 debug_ = ps.getUntrackedParameter<int>("debug",0);
00020 prefixME_ = ps.getUntrackedParameter<std::string>("subSystemFolder","Hcal/");
00021 if (prefixME_.substr(prefixME_.size()-1,prefixME_.size())!="/")
00022 prefixME_.append("/");
00023 subdir_ = ps.getUntrackedParameter<std::string>("TaskFolder","DigiMonitor_Hcal");
00024 if (subdir_.size()>0 && subdir_.substr(subdir_.size()-1,subdir_.size())!="/")
00025 subdir_.append("/");
00026 subdir_=prefixME_+subdir_;
00027 AllowedCalibTypes_ = ps.getUntrackedParameter<std::vector<int> > ("AllowedCalibTypes");
00028 skipOutOfOrderLS_ = ps.getUntrackedParameter<bool>("skipOutOfOrderLS",true);
00029 NLumiBlocks_ = ps.getUntrackedParameter<int>("NLumiBlocks",4000);
00030 makeDiagnostics_ = ps.getUntrackedParameter<bool>("makeDiagnostics",false);
00031 digiLabel_ = ps.getUntrackedParameter<edm::InputTag>("digiLabel");
00032 FEDRawDataCollection_ = ps.getUntrackedParameter<edm::InputTag>("FEDRawDataCollection");
00033 hfRechitLabel_ = ps.getUntrackedParameter<edm::InputTag>("hfRechitLabel");
00034 shapeThresh_ = ps.getUntrackedParameter<int>("shapeThresh",20);
00035
00036 shapeThreshHB_ = ps.getUntrackedParameter<int>("shapeThreshHB",shapeThresh_);
00037 shapeThreshHE_ = ps.getUntrackedParameter<int>("shapeThreshHE",shapeThresh_);
00038 shapeThreshHF_ = ps.getUntrackedParameter<int>("shapeThreshHF",shapeThresh_);
00039 shapeThreshHO_ = ps.getUntrackedParameter<int>("shapeThreshHO",shapeThresh_);
00040
00041 hltresultsLabel_ = ps.getUntrackedParameter<edm::InputTag>("HLTResultsLabel");
00042 MinBiasHLTBits_ = ps.getUntrackedParameter<std::vector<std::string> >("MinBiasHLTBits");
00043 excludeHORing2_ = ps.getUntrackedParameter<bool>("excludeHORing2",false);
00044 excludeHO1P02_ = ps.getUntrackedParameter<bool>("excludeHO1P02",false);
00045 excludeBadQPLLs_ = ps.getUntrackedParameter<bool>("excludeBadQPLL",false);
00046
00047 if (debug_>0)
00048 std::cout <<"<HcalDigiMonitor> Digi shape ADC threshold set to: >" << shapeThresh_ <<" counts above nominal pedestal (3*10)"<< std::endl;
00049
00050
00051 digi_checkoccupancy_ = ps.getUntrackedParameter<bool>("checkForMissingDigis",false);
00052 digi_checkcapid_ = ps.getUntrackedParameter<bool>("checkCapID",true);
00053 digi_checkdigisize_ = ps.getUntrackedParameter<bool>("checkDigiSize",true);
00054 digi_checkadcsum_ = ps.getUntrackedParameter<bool>("checkADCsum",true);
00055 digi_checkdverr_ = ps.getUntrackedParameter<bool>("checkDVerr",true);
00056 mindigisizeHBHE_ = ps.getUntrackedParameter<int>("minDigiSizeHBHE",1);
00057 maxdigisizeHBHE_ = ps.getUntrackedParameter<int>("maxDigiSizeHBHE",10);
00058 mindigisizeHO_ = ps.getUntrackedParameter<int>("minDigiSizeHO",1);
00059 maxdigisizeHO_ = ps.getUntrackedParameter<int>("maxDigiSizeHO",10);
00060 mindigisizeHF_ = ps.getUntrackedParameter<int>("minDigiSizeHF",1);
00061 maxdigisizeHF_ = ps.getUntrackedParameter<int>("maxDigiSizeHF",10);
00062
00063
00064 badChannelStatusMask_ = ps.getUntrackedParameter<int>("BadChannelStatusMask",
00065 ps.getUntrackedParameter<int>("BadChannelStatusMask",
00066 (1<<HcalChannelStatus::HcalCellDead)));
00067 if (debug_>1)
00068 {
00069 std::cout <<"<HcalDigiMonitor> Checking for the following problems:"<<std::endl;
00070 if (digi_checkcapid_) std::cout <<"\tChecking that cap ID rotation is correct;"<<std::endl;
00071 if (digi_checkdigisize_)
00072 {
00073 std::cout <<"\tChecking that HBHE digi size is between ["<<mindigisizeHBHE_<<" - "<<maxdigisizeHBHE_<<"];"<<std::endl;
00074 std::cout <<"\tChecking that HO digi size is between ["<<mindigisizeHO_<<" - "<<maxdigisizeHO_<<"];"<<std::endl;
00075 std::cout <<"\tChecking that HF digi size is between ["<<mindigisizeHF_<<" - "<<maxdigisizeHF_<<"];"<<std::endl;
00076 }
00077 if (digi_checkadcsum_) std::cout <<"\tChecking that ADC sum of digi is greater than 0;"<<std::endl;
00078 if (digi_checkdverr_) std::cout <<"\tChecking that data valid bit is true and digi error bit is false;\n"<<std::endl;
00079 }
00080
00081 shutOffOrbitTest_ = ps.getUntrackedParameter<bool>("shutOffOrbitTest",false);
00082 DigiMonitor_ExpectedOrbitMessageTime_=ps.getUntrackedParameter<int>("ExpectedOrbitMessageTime",3559);
00083
00084 HFtiming_totaltime2D=0;
00085 HFtiming_occupancy2D=0;
00086 HFtiming_etaProfile=0;
00087 HFP_shape=0;
00088 HFM_shape=0;
00089 setupDone_=false;
00090 }
00091
00092
00093 HcalDigiMonitor::~HcalDigiMonitor() {}
00094
00095
00096 static bool bitUpset(int last, int now){
00097 if(last ==-1) return false;
00098 int v = last+1;
00099 if(v==4) v=0;
00100 if(v==now) return false;
00101 return true;
00102 }
00103
00104 void HcalDigiMonitor::cleanup()
00105 {
00106
00107 if (debug_>0) std::cout <<"HcalDigiMonitor::cleanup()"<<std::endl;
00108 if (!enableCleanup_) return;
00109 if (dbe_)
00110 {
00111
00112 dbe_->setCurrentFolder(subdir_);
00113 dbe_->removeContents();
00114 dbe_->setCurrentFolder(subdir_+"digi_parameters"); dbe_->removeContents();
00115 dbe_->setCurrentFolder(subdir_+"bad_digis/bad_digi_occupancy"); dbe_->removeContents();
00116 dbe_->setCurrentFolder(subdir_+"bad_digis/1D_digi_plots"); dbe_->removeContents();
00117 dbe_->setCurrentFolder(subdir_+"bad_digis/badcapID"); dbe_->removeContents();
00118 dbe_->setCurrentFolder(subdir_+"bad_digis/data_invalid_error"); dbe_->removeContents();
00119 dbe_->setCurrentFolder(subdir_+"bad_digis/bad_reportUnpackerErrors"); dbe_->removeContents();
00120 dbe_->setCurrentFolder(subdir_+"bad_digis/baddigisize"); dbe_->removeContents();
00121 dbe_->setCurrentFolder(subdir_+"digi_info"); dbe_->removeContents();
00122 dbe_->setCurrentFolder(subdir_+"bad_digis/badfibBCNoff"); dbe_->removeContents();
00123 dbe_->setCurrentFolder(subdir_+"good_digis/1D_digi_plots"); dbe_->removeContents();
00124 dbe_->setCurrentFolder(subdir_+"good_digis/digi_occupancy"); dbe_->removeContents();
00125 dbe_->setCurrentFolder(subdir_+"bad_digis/bad_digi_occupancy"); dbe_->removeContents();
00126 dbe_->setCurrentFolder(subdir_+"bad_digis"); dbe_->removeContents();
00127 dbe_->setCurrentFolder(subdir_+"good_digis/"); dbe_->removeContents();
00128 dbe_->setCurrentFolder(subdir_+"digi_info/HB"); dbe_->removeContents();
00129 dbe_->setCurrentFolder(subdir_+"digi_info/HE"); dbe_->removeContents();
00130 dbe_->setCurrentFolder(subdir_+"digi_info/HO"); dbe_->removeContents();
00131 dbe_->setCurrentFolder(subdir_+"digi_info/HF"); dbe_->removeContents();
00132 dbe_->setCurrentFolder(subdir_+"LSvalues");
00133 dbe_->removeContents();
00134 }
00135
00136 }
00137
00138
00139 void HcalDigiMonitor::endRun(const edm::Run& run, const edm::EventSetup& c)
00140 {
00141
00142 }
00143
00144 void HcalDigiMonitor::endJob()
00145 {
00146 if (debug_>0) std::cout <<"HcalDigiMonitor::endJob()"<<std::endl;
00147 if (enableCleanup_) cleanup();
00148 }
00149
00150
00151 void HcalDigiMonitor::setup()
00152 {
00153 if (setupDone_)
00154 return;
00155 setupDone_=true;
00156
00157 HcalBaseDQMonitor::setup();
00158 if (!dbe_) return;
00159
00160
00161 if (debug_>1)
00162 std::cout <<"<HcalDigiMonitor::beginRun> Setting up histograms"<<std::endl;
00163
00164 std::ostringstream name;
00165 dbe_->setCurrentFolder(subdir_);
00166
00167 dbe_->setCurrentFolder(subdir_+"digi_parameters");
00168 MonitorElement* ExpectedOrbit = dbe_->bookInt("ExpectedOrbitMessageTime");
00169 ExpectedOrbit->Fill(DigiMonitor_ExpectedOrbitMessageTime_);
00170
00171 MonitorElement* shapeT = dbe_->bookInt("DigiShapeThresh");
00172 shapeT->Fill(shapeThresh_);
00173 MonitorElement* shapeTHB = dbe_->bookInt("DigiShapeThreshHB");
00174 shapeTHB->Fill(shapeThreshHB_);
00175 MonitorElement* shapeTHE = dbe_->bookInt("DigiShapeThreshHE");
00176 shapeTHE->Fill(shapeThreshHE_);
00177 MonitorElement* shapeTHO = dbe_->bookInt("DigiShapeThreshHO");
00178 shapeTHO->Fill(shapeThreshHO_);
00179 MonitorElement* shapeTHF = dbe_->bookInt("DigiShapeThreshHF");
00180 shapeTHF->Fill(shapeThreshHF_);
00181
00182 dbe_->setCurrentFolder(subdir_+"bad_digis/bad_digi_occupancy");
00183 SetupEtaPhiHists(DigiErrorsByDepth,"Bad Digi Map","");
00184 dbe_->setCurrentFolder(subdir_+"bad_digis/1D_digi_plots");
00185 ProblemsVsLB=dbe_->bookProfile("BadDigisVsLB","Number Bad Digis vs Luminosity block;Lumi block;# of Bad digis",
00186 NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
00187 ProblemsVsLB_HB=dbe_->bookProfile("HB Bad Quality Digis vs LB","HB Bad Quality Digis vs Luminosity Block",
00188 NLumiBlocks_,0.5,NLumiBlocks_+0.5,
00189 100,0,10000);
00190 ProblemsVsLB_HE=dbe_->bookProfile("HE Bad Quality Digis vs LB","HE Bad Quality Digis vs Luminosity Block",
00191 NLumiBlocks_,0.5,NLumiBlocks_+0.5,
00192 100,0,10000);
00193 ProblemsVsLB_HO=dbe_->bookProfile("HO Bad Quality Digis vs LB","HO Bad Quality Digis vs Luminosity Block",
00194 NLumiBlocks_,0.5,NLumiBlocks_+0.5,
00195 100,0,10000);
00196 ProblemsVsLB_HF=dbe_->bookProfile("HF Bad Quality Digis vs LB","HF Bad Quality Digis vs Luminosity Block",
00197 NLumiBlocks_,0.5,NLumiBlocks_+0.5,
00198 100,0,10000);
00199 ProblemsVsLB_HBHEHF=dbe_->bookProfile("HBHEHF Bad Quality Digis vs LB","HBHEHF Bad Quality Digis vs Luminosity Block",
00200 NLumiBlocks_,0.5,NLumiBlocks_+0.5,
00201 100,0,10000);
00202
00203 ProblemDigisInLastNLB_HBHEHF_alarm=dbe_->book1D("ProblemDigisInLastNLB_HBHEHF_alarm",
00204 "Total Number of ProblemDigis HBHEHF in last 10 LS. Last bin contains OverFlow",
00205 100,0,100);
00206
00207
00208 if (makeDiagnostics_)
00209 {
00210
00211 dbe_->setCurrentFolder(subdir_+"diagnostics/bad_digis/badcapID");
00212 SetupEtaPhiHists(DigiErrorsBadCapID," Digis with Bad Cap ID Rotation", "");
00213 dbe_->setCurrentFolder(subdir_+"diagnostics/bad_digis/data_invalid_error");
00214 SetupEtaPhiHists(DigiErrorsDVErr," Digis with Data Invalid or Error Bit Set", "");
00215 }
00216
00217 if (Online_)
00218 {
00219
00220 dbe_->setCurrentFolder(subdir_+"HFTimingStudy");
00221 HFtiming_etaProfile=dbe_->bookProfile("HFTiming_etaProfile","HFTiming Eta Profile;ieta;average time (time slice)",83,-41.5,41.5,200,0,10);
00222 HFP_shape=dbe_->book1D("HFP_signal_shape","HFP signal shape",10,-0.5,9.5);
00223 HFM_shape=dbe_->book1D("HFM_signal_shape","HFM signal shape",10,-0.5,9.5);
00224 dbe_->setCurrentFolder(subdir_+"HFTimingStudy/sumplots");
00225 HFtiming_totaltime2D=dbe_->book2D("HFTiming_Total_Time","HFTiming Total Time",83,-41.5,41.5,72,0.5,72.5);
00226 HFtiming_occupancy2D=dbe_->book2D("HFTiming_Occupancy","HFTiming Occupancy",83,-41.5,41.5,72,0.5,72.5);
00227 }
00228
00229 dbe_->setCurrentFolder(subdir_+"bad_digis/bad_reportUnpackerErrors");
00230 SetupEtaPhiHists(DigiErrorsUnpacker," Bad Unpacker Digis", "");
00231
00232 dbe_->setCurrentFolder(subdir_+"bad_digis/baddigisize");
00233 SetupEtaPhiHists(DigiErrorsBadDigiSize," Digis with Bad Size", "");
00234
00235 dbe_->setCurrentFolder(subdir_+"digi_info");
00236
00237 h_valid_digis=dbe_->book1D("ValidEvents","Events with minimum number of valid digis",2,-0.5,1.5);
00238 h_valid_digis->setBinLabel(1,"Valid");
00239 h_valid_digis->setBinLabel(2,"Invalid");
00240
00241 h_invalid_orbitnumMod103=dbe_->book1D("InvalidDigiEvents_ORN","Orbit Number (mod 103) for Events with Many Unpacker Errors",103,-0.5,102.5);
00242 h_invalid_bcn=dbe_->book1D("InvalidDigiEvents_BCN","Bunch Crossing Number fo Events with Many Unpacker Errors",3464,-0.5,3563.5);
00243
00244 DigiSize = dbe_->book2D("Digi Size", "Digi Size",4,0,4,20,-0.5,19.5);
00245 DigiSize->setBinLabel(1,"HB",1);
00246 DigiSize->setBinLabel(2,"HE",1);
00247 DigiSize->setBinLabel(3,"HO",1);
00248 DigiSize->setBinLabel(4,"HF",1);
00249 DigiSize->setAxisTitle("Subdetector",1);
00250 DigiSize->setAxisTitle("Digi Size",2);
00251
00252 DigiExpectedSize = dbe_->book2D("Digi Expected Size", "Digi Expected Size",3,0,3,20,-0.5,19.5);
00253 DigiExpectedSize->setBinLabel(1,"HBHE",1);
00254 DigiExpectedSize->setBinLabel(2,"HO",1);
00255 DigiExpectedSize->setBinLabel(3,"HF",1);
00256 DigiExpectedSize->setAxisTitle("Subdetector",1);
00257 DigiExpectedSize->setAxisTitle("Digi Expected Size from HTR",2);
00258
00259 dbe_->setCurrentFolder(subdir_+"bad_digis/badfibBCNoff");
00260 SetupEtaPhiHists(DigiErrorsBadFibBCNOff," Digis with non-zero Fiber Orbit Msg Idle BCN Offsets", "");
00261
00262 dbe_->setCurrentFolder(subdir_+"good_digis/1D_digi_plots");
00263 HBocc_vs_LB=dbe_->bookProfile("HBoccVsLB","HB digi occupancy vs Luminosity Block;Lumi block;# of Good digis",
00264 NLumiBlocks_,0.5,NLumiBlocks_+0.5,
00265 0,2600);
00266 HEocc_vs_LB=dbe_->bookProfile("HEoccVsLB","HE digi occupancy vs Luminosity Block;Lumi block;# of Good digis",
00267 NLumiBlocks_,0.5,NLumiBlocks_+0.5,
00268 0,2600);
00269 HOocc_vs_LB=dbe_->bookProfile("HOoccVsLB","HO digi occupancy vs Luminosity Block;Lumi block;# of Good digis",
00270 NLumiBlocks_,0.5,NLumiBlocks_+0.5,
00271 0,2200);
00272 HFocc_vs_LB=dbe_->bookProfile("HFoccVsLB","HF digi occupancy vs Luminosity Block;Lumi block;# of Good digis",
00273 NLumiBlocks_,0.5,NLumiBlocks_+0.5,
00274 0,1800);
00275
00276 dbe_->setCurrentFolder(subdir_+"good_digis/digi_occupancy");
00277 SetupEtaPhiHists(DigiOccupancyByDepth," Digi Eta-Phi Occupancy Map","");
00278 DigiOccupancyPhi= dbe_->book1D("Digi Phi Occupancy Map",
00279 "Digi Phi Occupancy Map;i#phi;# of Events",
00280 72,0.5,72.5);
00281 DigiOccupancyEta= dbe_->book1D("Digi Eta Occupancy Map",
00282 "Digi Eta Occupancy Map;i#eta;# of Events",
00283 83,-41.5,41.5);
00284 DigiOccupancyVME = dbe_->book2D("Digi VME Occupancy Map",
00285 "Digi VME Occupancy Map;HTR Slot;VME Crate Id",
00286 40,-0.25,19.75,18,-0.5,17.5);
00287
00288 DigiOccupancySpigot = dbe_->book2D("Digi Spigot Occupancy Map",
00289 "Digi Spigot Occupancy Map;Spigot;DCC Id",
00290 HcalDCCHeader::SPIGOT_COUNT,-0.5,HcalDCCHeader::SPIGOT_COUNT-0.5,
00291 36,-0.5,35.5);
00292
00293 dbe_->setCurrentFolder(subdir_+"bad_digis/bad_digi_occupancy");
00294 DigiErrorVME = dbe_->book2D("Digi VME Error Map",
00295 "Digi VME Error Map;HTR Slot;VME Crate Id",
00296 40,-0.25,19.75,18,-0.5,17.5);
00297
00298 DigiErrorSpigot = dbe_->book2D("Digi Spigot Error Map",
00299 "Digi Spigot Error Map;Spigot;DCC Id",
00300 HcalDCCHeader::SPIGOT_COUNT,-0.5,HcalDCCHeader::SPIGOT_COUNT-0.5,
00301 36,-0.5,35.5);
00302
00303 dbe_->setCurrentFolder(subdir_+"bad_digis");
00304 int nbins = sizeof(bins_cellcount_new)/sizeof(float)-1;
00305
00306 DigiBQ = dbe_->book1D("NumBadQualDigis","Number Bad Qual Digis within Digi Collection",nbins, bins_cellcount_new);
00307
00308 nbins=sizeof(bins_fraccount_new)/sizeof(float)-1;
00309
00310 DigiBQFrac = dbe_->book1D("Bad Digi Fraction","Bad Digi Fraction;Bad Quality Digi Fraction for digis in collection; # of Events",
00311 nbins, bins_fraccount_new);
00312
00313 nbins = sizeof(bins_cellcount_new)/sizeof(float)-1;
00314 DigiUnpackerErrorCount = dbe_->book1D("Unpacker Error Count", "Number of Bad Digis from Unpacker; Bad Unpacker Digis; # of Events",nbins, bins_cellcount_new);
00315
00316 nbins=sizeof(bins_fraccount_new)/sizeof(float)-1;
00317 DigiUnpackerErrorFrac = dbe_->book1D("Unpacker Bad Digi Fraction",
00318 "Bad Digis From Unpacker/ (Bad Digis From Unpacker + Good Digis); Bad Unpacker Fraction; # of Events",
00319 nbins,bins_fraccount_new);
00320
00321 dbe_->setCurrentFolder(subdir_+"good_digis/");
00322 DigiNum = dbe_->book1D("NumGoodDigis","Number of Digis;# of Good Digis;# of Events",DIGI_NUM+1,-0.5,DIGI_NUM+1-0.5);
00323
00324 setupSubdetHists(hbHists,"HB");
00325 setupSubdetHists(heHists,"HE");
00326 setupSubdetHists(hoHists,"HO");
00327 setupSubdetHists(hfHists,"HF");
00328
00329 this->reset();
00330 return;
00331 }
00332
00333 void HcalDigiMonitor::beginRun(const edm::Run& run, const edm::EventSetup& c)
00334 {
00335 HcalBaseDQMonitor::beginRun(run,c);
00336 if (mergeRuns_ && tevt_>0) return;
00337
00338 if (debug_>1) std::cout <<"\t<HcalDigiMonitor::setup> Getting conditions from DB!"<<std::endl;
00339 c.get<HcalDbRecord>().get(conditions_);
00340
00341
00342 edm::ESHandle<HcalChannelQuality> p;
00343 c.get<HcalChannelQualityRcd>().get(p);
00344 HcalChannelQuality *chanquality= new HcalChannelQuality(*p.product());
00345 std::vector<DetId> mydetids = chanquality->getAllChannels();
00346 PedestalsByCapId_.clear();
00347
00348 for (std::vector<DetId>::const_iterator chan = mydetids.begin();chan!=mydetids.end();++chan)
00349 {
00350 if (chan->det()!=DetId::Hcal) continue;
00351 std::vector <double> peds;
00352 peds.clear();
00353 HcalCalibrations calibs=conditions_->getHcalCalibrations(*chan);
00354 const HcalQIECoder* channelCoder = conditions_->getHcalCoder(*chan);
00355 const HcalQIEShape* shape = conditions_->getHcalShape(channelCoder);
00356
00357 for (int capid=0;capid<4;++capid)
00358 {
00359
00360 double temp_ADC=channelCoder->adc(*shape,(float)calibs.pedestal(capid),capid);
00361 peds.push_back(temp_ADC);
00362
00363 }
00364
00365 PedestalsByCapId_[*chan]=peds;
00366 }
00367
00368 if (tevt_==0) this->setup();
00369 if (mergeRuns_==false) this->reset();
00370 delete chanquality;
00371
00372
00373 KnownBadCells_.clear();
00374 if (badChannelStatusMask_>0)
00375 {
00376 edm::ESHandle<HcalChannelQuality> p;
00377 c.get<HcalChannelQualityRcd>().get(p);
00378 HcalChannelQuality* chanquality= new HcalChannelQuality(*p.product());
00379 std::vector<DetId> mydetids = chanquality->getAllChannels();
00380 for (std::vector<DetId>::const_iterator i = mydetids.begin();
00381 i!=mydetids.end();
00382 ++i)
00383 {
00384 if (i->det()!=DetId::Hcal) continue;
00385 HcalDetId id=HcalDetId(*i);
00386 int status=(chanquality->getValues(id))->getValue();
00387 if ((status & badChannelStatusMask_))
00388 {
00389 KnownBadCells_[id.rawId()]=status;
00390 }
00391 }
00392 delete chanquality;
00393 }
00394
00395 }
00396
00397
00398 void HcalDigiMonitor::setupSubdetHists(DigiHists& hist, std::string subdet)
00399 {
00400 if (!dbe_) return;
00401 std::stringstream name;
00402 int nChan=0;
00403 if (subdet=="HB" || subdet=="HE") nChan=2592;
00404 else if (subdet == "HO") nChan=2160;
00405 else if (subdet == "HF") nChan=1728;
00406
00407 dbe_->setCurrentFolder(subdir_+"digi_info/"+subdet);
00408 hist.shape = dbe_->book1D(subdet+" Digi Shape",subdet+" Digi Shape;Time Slice",10,-0.5,9.5);
00409 hist.shapeThresh = dbe_->book1D(subdet+" Digi Shape - over thresh",
00410 subdet+" Digi Shape - over thresh passing trigger and HF HT cuts;Time slice",
00411 10,-0.5,9.5);
00412 hist.ThreshCount = dbe_->book1D(subdet+" Total Digis Over Threshold",
00413 subdet+" Total Digis Over Threshold",
00414 1,-0.5,0.5);
00415
00416 for (int ts=0;ts<9;++ts)
00417 {
00418 name<<subdet<<" Plus Time Slices "<<ts<<" and "<<ts+1;
00419 hist.TS_sum_plus.push_back(dbe_->book1D(name.str().c_str(),name.str().c_str(),50, 0., 50.));
00420 name.str("");
00421 name<<subdet<<" Minus Time Slices "<<ts<<" and "<<ts+1;
00422 hist.TS_sum_minus.push_back(dbe_->book1D(name.str().c_str(),name.str().c_str(),50, 0., 50.));
00423 name.str("");
00424 }
00425 hist.presample= dbe_->book1D(subdet+" Digi Presamples",subdet+" Digi Presamples",50,-0.5,49.5);
00426 hist.BQ = dbe_->book1D(subdet+" Bad Quality Digis",subdet+" Bad Quality Digis",nChan+1,-0.5,nChan+0.5);
00427
00428 hist.BQFrac = dbe_->book1D(subdet+" Bad Quality Digi Fraction",subdet+" Bad Quality Digi Fraction",DIGI_BQ_FRAC_NBINS,(0-0.5/(DIGI_BQ_FRAC_NBINS-1)),1+0.5/(DIGI_BQ_FRAC_NBINS-1));
00429 hist.DigiFirstCapID = dbe_->book1D(subdet+" Capid 1st Time Slice",subdet+" Capid for 1st Time Slice;CapId (T0)- 1st CapId (T0);# of Events",7,-3.5,3.5);
00430
00431 hist.DVerr = dbe_->book1D(subdet+" Data Valid Err Bits",subdet+" QIE Data Valid Err Bits",4,-0.5,3.5);
00432 hist.DVerr ->setBinLabel(1,"Err=0, DV=0",1);
00433 hist.DVerr ->setBinLabel(2,"Err=0, DV=1",1);
00434 hist.DVerr ->setBinLabel(3,"Err=1, DV=0",1);
00435 hist.DVerr ->setBinLabel(4,"Err=1, DV=1",1);
00436 hist.CapID = dbe_->book1D(subdet+" CapID",subdet+" CapID",4,-0.5,3.5);
00437 hist.ADC = dbe_->book1D(subdet+" ADC count per time slice",subdet+" ADC count per time slice",200,-0.5,199.5);
00438 hist.ADCsum = dbe_->book1D(subdet+" ADC sum", subdet+" ADC sum",200,-0.5,199.5);
00439 hist.fibBCNOff = dbe_->book1D(subdet+" Fiber Orbit Message Idle BCN Offset", subdet+" Fiber Orbit Message Idle BCN Offset;Offset from Expected",
00440 15, -7.5, 7.5);
00441 }
00442
00443 void HcalDigiMonitor::analyze(edm::Event const&e, edm::EventSetup const&s)
00444 {
00445 if (!IsAllowedCalibType()) return;
00446 if (LumiInOrder(e.luminosityBlock())==false) return;
00447
00448
00449 passedMinBiasHLT_=false;
00450
00452
00453 edm::Handle<DcsStatusCollection> dcsStatus;
00454 e.getByLabel("scalersRawToDigi", dcsStatus);
00455
00456 if (dcsStatus.isValid() && dcsStatus->size() != 0)
00457 {
00458 if ((*dcsStatus)[0].ready(DcsStatus::HBHEa) &&
00459 (*dcsStatus)[0].ready(DcsStatus::HBHEb) &&
00460 (*dcsStatus)[0].ready(DcsStatus::HBHEc))
00461 {
00462 hbhedcsON = true;
00463 if (debug_) std::cout << "hbhe on" << std::endl;
00464 }
00465 else hbhedcsON = false;
00466
00467 if ((*dcsStatus)[0].ready(DcsStatus::HF))
00468 {
00469 hfdcsON = true;
00470 if (debug_) std::cout << "hf on" << std::endl;
00471 }
00472 else hfdcsON = false;
00473 }
00475
00476 edm::Handle<edm::TriggerResults> hltRes;
00477 if (!(e.getByLabel(hltresultsLabel_,hltRes)))
00478 {
00479 if (debug_>0) edm::LogWarning("HcalDigiMonitor")<<" Could not get HLT results with tag "<<hltresultsLabel_<<std::endl;
00480 }
00481 else
00482 {
00483 const edm::TriggerNames & triggerNames = e.triggerNames(*hltRes);
00484 const unsigned int nTrig(triggerNames.size());
00485 for (unsigned int i=0;i<nTrig;++i){
00486
00487 for (unsigned int k=0;k<MinBiasHLTBits_.size();++k)
00488 {
00489
00490 if (triggerNames.triggerName(i).find(MinBiasHLTBits_[k])!=std::string::npos && hltRes->accept(i))
00491 {
00492 passedMinBiasHLT_=true;
00493 break;
00494 }
00495 }
00496 }
00497 }
00498
00499
00500 HT_HFP_=0;
00501 HT_HFM_=0;
00502
00503 edm::Handle<HFRecHitCollection> hf_rechit;
00504 if (e.getByLabel(hfRechitLabel_,hf_rechit))
00505 {
00506
00507 for (HFRecHitCollection::const_iterator HF=hf_rechit->begin();HF!=hf_rechit->end();++HF)
00508 {
00509 float en=HF->energy();
00510 int ieta=HF->id().ieta();
00511
00512 double fEta=fabs(0.5*(theHFEtaBounds[abs(ieta)-28]+theHFEtaBounds[abs(ieta)-29]));
00513 ieta>0 ? HT_HFP_+=en/cosh(fEta) : HT_HFM_+=en/cosh(fEta);
00514 }
00515 }
00516 else
00517 {
00518
00519 HT_HFP_=999;
00520 HT_HFM_=999;
00521 }
00522
00523
00524 edm::Handle<HBHEDigiCollection> hbhe_digi;
00525 edm::Handle<HODigiCollection> ho_digi;
00526 edm::Handle<HFDigiCollection> hf_digi;
00527
00528 if (!(e.getByLabel(digiLabel_,hbhe_digi)))
00529 {
00530 edm::LogWarning("HcalDigiMonitor")<< digiLabel_<<" hbhe_digi not available";
00531 return;
00532 }
00533
00534 if (!(e.getByLabel(digiLabel_,hf_digi)))
00535 {
00536 edm::LogWarning("HcalDigiMonitor")<< digiLabel_<<" hf_digi not available";
00537 return;
00538 }
00539 if (!(e.getByLabel(digiLabel_,ho_digi)))
00540 {
00541 edm::LogWarning("HcalDigiMonitor")<< digiLabel_<<" ho_digi not available";
00542 return;
00543 }
00544 edm::Handle<HcalUnpackerReport> report;
00545 if (!(e.getByLabel(digiLabel_,report)))
00546 {
00547 edm::LogWarning("HcalDigiMonitor")<< digiLabel_<<" unpacker report not available";
00548 return;
00549 }
00550
00551 edm::Handle<FEDRawDataCollection> rawraw;
00552 if (!(e.getByLabel(FEDRawDataCollection_,rawraw)))
00553 {
00554 edm::LogWarning("HcalRawDataMonitor")<<" raw data with label "<<FEDRawDataCollection_<<" not available";
00555 return;
00556 }
00557
00558
00559
00560
00561 for (int i=FEDNumbering::MINHCALFEDID; i<=FEDNumbering::MAXHCALFEDID; i++) {
00562 const FEDRawData& fed = rawraw->FEDData(i);
00563 if (fed.size()<12) continue;
00564
00565 const HcalDCCHeader* dccHeader=(const HcalDCCHeader*)(fed.data());
00566 if(!dccHeader) return;
00567
00568 HcalHTRData htr;
00569 for (int spigot=0; spigot<HcalDCCHeader::SPIGOT_COUNT; spigot++) {
00570 if (!dccHeader->getSpigotPresent(spigot)) continue;
00571
00572
00573
00574 dccHeader->getSpigotData(spigot, htr, fed.size());
00575
00576 int NTS = htr.getNDD();
00577 int dccid=dccHeader->getSourceId();
00578
00579 if(dccid==720 && (spigot==12 || spigot==13)) continue;
00580 if(dccid==722 && (spigot==12 || spigot==13)) continue;
00581
00582 int subdet = -1;
00583
00584 if(dccid >= 700 && dccid<=717) { subdet = 0; mindigisizeHBHE_ = NTS; maxdigisizeHBHE_ = NTS; }
00585 if(dccid >= 718 && dccid<=723) { subdet = 2; mindigisizeHF_ = NTS; maxdigisizeHF_ = NTS; }
00586 if(dccid >= 724 && dccid<=731) { subdet = 1; mindigisizeHO_ = NTS; maxdigisizeHO_ = NTS; }
00587
00588 DigiExpectedSize->Fill(subdet,int(NTS),1);
00589 }
00590 }
00591
00592
00593 if (debug_>1) std::cout <<"\t<HcalDigiMonitor::analyze> Processing good event! event # = "<<ievt_<<std::endl;
00594
00595 HcalBaseDQMonitor::analyze(e,s);
00596
00597
00598 processEvent(*hbhe_digi, *ho_digi, *hf_digi, *conditions_,
00599 *report, e.orbitNumber(),e.bunchCrossing());
00600
00601 }
00602
00603 void HcalDigiMonitor::processEvent(const HBHEDigiCollection& hbhe,
00604 const HODigiCollection& ho,
00605 const HFDigiCollection& hf,
00606 const HcalDbService& cond,
00607 const HcalUnpackerReport& report,
00608 int orN, int bcN)
00609 {
00610 if(!dbe_)
00611 {
00612 if(debug_)
00613 std::cout <<"HcalDigiMonitor::processEvent DQMStore not instantiated!!!"<<std::endl;
00614 return;
00615 }
00616
00617
00618
00619 DigiUnpackerErrorCount->Fill(report.badQualityDigis());
00620
00621 unsigned int allgooddigis= hbhe.size()+ho.size()+hf.size();
00622
00623
00624
00625
00626 if(bcN>=3446 && bcN<=3564)
00627 if( (report.badQualityDigis()>100 && hbhe.size()==0) || (report.badQualityDigis()>1000) )
00628 return;
00629
00630
00631
00632 if ((allgooddigis==0) ||
00633 (1.*report.badQualityDigis()>100*allgooddigis))
00634 {
00635 h_valid_digis->Fill(1);
00636 if (bcN>-1)
00637 h_invalid_bcn->Fill(bcN);
00638 if (orN>-1)
00639 h_invalid_orbitnumMod103->Fill(orN%103);
00640
00641 return;
00642 }
00643
00644 h_valid_digis->Fill(0);
00645
00646
00647
00648
00649
00650
00651
00652
00653
00654
00655
00656
00657
00658
00659
00660
00661 typedef std::vector<DetId> DetIdVector;
00662
00663 for ( DetIdVector::const_iterator baddigi_iter=report.bad_quality_begin();
00664 baddigi_iter != report.bad_quality_end();
00665 ++baddigi_iter)
00666 {
00667 HcalDetId id(baddigi_iter->rawId());
00668 int rDepth = id.depth();
00669 int rPhi = id.iphi();
00670 int rEta = id.ieta();
00671 int binEta = CalcEtaBin(id.subdet(), rEta, rDepth);
00672
00673 if (binEta < 85 && binEta >= 0
00674 && (rPhi-1) >= 0 && (rPhi-1)<72
00675 && (rDepth-1) >= 0 && (rDepth-1)<4)
00676 if(uniqcounter2[binEta][rPhi-1][rDepth-1]<1)
00677 {
00678 if (id.subdet()==HcalBarrel) ++hbHists.count_bad;
00679 else if (id.subdet()==HcalEndcap) ++heHists.count_bad;
00680 else if (id.subdet()==HcalForward)
00681 {
00682 ++hfHists.count_bad;
00683 if (rDepth==1 && (abs(rEta)==33 || abs(rEta)==34)) ++HFlumibad;
00684 else if (rDepth==2 && (abs(rEta)==35 || abs(rEta)==36)) ++HFlumibad;
00685 }
00686 else if (id.subdet()==HcalOuter)
00687 {
00688
00689 if (excludeHORing2_==true && rDepth==4)
00690 if (abs(rEta)>=11 && abs(rEta)<=15 && !isSiPM(rEta,rPhi,rDepth)) continue;
00691
00692 if (excludeHO1P02_==true)
00693 if( (rEta>4 && rEta<10) && (rPhi<=10 || rPhi>70) ) continue;
00694
00695 if (KnownBadCells_.find(id)!=KnownBadCells_.end()) continue;
00696
00697 ++hoHists.count_bad;
00698 if (abs(rEta)<5) ++HO0bad;
00699 else ++HO12bad;
00700 }
00701 else
00702 continue;
00703
00704
00705 ++badunpackerreport[binEta][rPhi-1][rDepth-1];
00706 ++baddigis[binEta][rPhi-1][rDepth-1];
00707
00708
00709 bool HEM15A = true ? (id.subdet()==HcalEndcap && (rPhi>56 && rPhi<59 && rEta<0)) : false;
00710 bool HEM15B = true ? (id.subdet()==HcalEndcap && (rPhi>54 && rPhi<57 && rEta<0)) : false;
00711 bool HBP14A = true ? (id.subdet()==HcalBarrel && (rPhi>50 && rPhi<53 && rEta>0)) : false;
00712
00713 if(excludeBadQPLLs_ && rDepth==1)
00714 if( HEM15A || HEM15B || HBP14A )
00715 ++knownbadQPLLs;
00716
00717 uniqcounter2[binEta][rPhi-1][rDepth-1]++;
00718 }
00719 }
00721
00722 int firsthbcap=-1;
00723 int firsthecap=-1;
00724 int firsthocap=-1;
00725 int firsthfcap=-1;
00726
00727 for (HBHEDigiCollection::const_iterator j=hbhe.begin(); j!=hbhe.end(); ++j)
00728 {
00729 const HBHEDataFrame digi = (const HBHEDataFrame)(*j);
00730
00731 if (digi.id().subdet()==HcalBarrel)
00732 {
00733 if (!HBpresent_) continue;
00734 if (KnownBadCells_.find(digi.id())!=KnownBadCells_.end()) continue;
00735
00736 process_Digi(digi, hbHists, firsthbcap);
00737
00738 }
00739 else if (digi.id().subdet()==HcalEndcap)
00740 {
00741 if (!HEpresent_) continue;
00742 process_Digi(digi, heHists,firsthecap);
00743 }
00744 }
00745
00746
00747 HBocc_vs_LB->Fill(currentLS,hbHists.count_good);
00748 HEocc_vs_LB->Fill(currentLS,heHists.count_good);
00749
00750
00751 if (HBpresent_ && (hbHists.count_good>0 || hbHists.count_bad>0))
00752 {
00753 int counter=hbHists.count_bad;
00754 if (counter<DIGI_SUBDET_NUM)
00755 ++hbHists.count_BQ[counter];
00756 float counter2 = (1.*hbHists.count_bad)/(hbHists.count_bad+hbHists.count_good)*(DIGI_BQ_FRAC_NBINS-1);
00757 if (counter2<DIGI_SUBDET_NUM) ++hbHists.count_BQFrac[(int)counter2];
00758 }
00759
00760 if (HEpresent_ && (heHists.count_good>0 || heHists.count_bad>0))
00761 {
00762 int counter=heHists.count_bad;
00763 if (counter<DIGI_SUBDET_NUM)
00764 ++heHists.count_BQ[counter];
00765 float counter2 = (1.*heHists.count_bad)/(heHists.count_bad+heHists.count_good)*(DIGI_BQ_FRAC_NBINS-1);
00766 if (counter2<DIGI_SUBDET_NUM) ++heHists.count_BQFrac[int(counter2)];
00767 }
00768
00770 if (HOpresent_)
00771 {
00772 for (HODigiCollection::const_iterator j=ho.begin(); j!=ho.end(); ++j)
00773 {
00774 const HODataFrame digi = (const HODataFrame)(*j);
00775
00776 if (excludeHORing2_==true && digi.id().depth()==4)
00777 if (abs(digi.id().ieta())>=11 && abs(digi.id().ieta())<=15 &&
00778 !isSiPM(digi.id().ieta(),digi.id().iphi(),digi.id().depth())) continue;
00779
00780 if (excludeHO1P02_==true)
00781 if( (digi.id().ieta()>4 && digi.id().ieta()<10)
00782 && (digi.id().iphi()<=10 || digi.id().iphi()>70) ) continue;
00783
00784 if (KnownBadCells_.find(digi.id())!=KnownBadCells_.end()) continue;
00785
00786 process_Digi(digi, hoHists, firsthocap);
00787 }
00788
00789 if (hoHists.count_bad>0 || hoHists.count_good>0)
00790 {
00791 int counter=hoHists.count_bad;
00792 if (counter<DIGI_SUBDET_NUM)
00793 ++hoHists.count_BQ[counter];
00794
00795 float counter2 = (1.*hoHists.count_bad)/(hoHists.count_bad+hoHists.count_good)*(DIGI_BQ_FRAC_NBINS-1);
00796 if (counter2<DIGI_SUBDET_NUM) ++hoHists.count_BQFrac[int(counter2)];
00797 }
00798 HOocc_vs_LB->Fill(currentLS,hoHists.count_good);
00799 }
00800
00802 if (HFpresent_)
00803 {
00804 for (HFDigiCollection::const_iterator j=hf.begin(); j!=hf.end(); ++j)
00805 {
00806 const HFDataFrame digi = (const HFDataFrame)(*j);
00807 process_Digi(digi, hfHists, firsthfcap);
00808 }
00809
00810 if (hfHists.count_bad>0 || hfHists.count_good>0)
00811 {
00812 int counter=hfHists.count_bad;
00813 if (counter<DIGI_SUBDET_NUM)
00814 ++hfHists.count_BQ[counter];
00815 float counter2 = (1.*hfHists.count_bad)/(hfHists.count_bad+hfHists.count_good)*(DIGI_BQ_FRAC_NBINS-1);
00816 if (counter2<DIGI_SUBDET_NUM) ++hfHists.count_BQFrac[int(counter2)];
00817 }
00818 HFocc_vs_LB->Fill(currentLS,hfHists.count_good);
00819 }
00820
00821
00822 int count_good=hbHists.count_good+heHists.count_good+hoHists.count_good+hfHists.count_good;
00823 int count_bad=hbHists.count_bad+heHists.count_bad+hoHists.count_bad+hfHists.count_bad;
00824
00825 if (count_good<DIGI_NUM)
00826 ++diginum[count_good];
00827
00828
00829 DigiUnpackerErrorFrac->Fill(1.*report.badQualityDigis()/(report.badQualityDigis()+count_good));
00830 DigiBQ->Fill(count_bad);
00831 if (count_bad>0 || count_good>0)
00832 DigiBQFrac->Fill(1.*count_bad/(count_bad+count_good));
00833
00834
00835 UpdateHists(hbHists);
00836 UpdateHists(heHists);
00837 UpdateHists(hoHists);
00838 UpdateHists(hfHists);
00839
00840
00841 DigiNum->update();
00842 DigiErrorVME->update();
00843 DigiErrorSpigot->update();
00844 DigiBQ->update();
00845 DigiBQFrac->update();
00846 DigiUnpackerErrorCount->update();
00847 DigiUnpackerErrorFrac->update();
00848
00849
00850 for (unsigned int zz=0;zz<DigiErrorOccupancyByDepth.depth.size();++zz)
00851 DigiErrorOccupancyByDepth.depth[zz]->update();
00852 for (unsigned int zz=0;zz<DigiErrorsByDepth.depth.size();++zz)
00853 DigiErrorsByDepth.depth[zz]->update();
00854 for (unsigned int zz=0;zz<DigiErrorsBadCapID.depth.size();++zz)
00855 DigiErrorsBadCapID.depth[zz]->update();
00856 for (unsigned int zz=0;zz<DigiErrorsDVErr.depth.size();++zz)
00857 DigiErrorsDVErr.depth[zz]->update();
00858 for (unsigned int zz=0;zz<DigiErrorsBadDigiSize.depth.size();++zz)
00859 DigiErrorsBadDigiSize.depth[zz]->update();
00860 for (unsigned int zz=0;zz<DigiErrorsBadADCSum.depth.size();++zz)
00861 DigiErrorsBadADCSum.depth[zz]->update();
00862 for (unsigned int zz=0;zz<DigiErrorsUnpacker.depth.size();++zz)
00863 DigiErrorsUnpacker.depth[zz]->update();
00864 for (unsigned int zz=0;zz<DigiErrorsBadFibBCNOff.depth.size();++zz)
00865 DigiErrorsBadFibBCNOff.depth[zz]->update();
00866
00867 DigiOccupancyEta->update();
00868 DigiOccupancyPhi->update();
00869 DigiOccupancyVME->update();
00870 DigiOccupancySpigot->update();
00871 DigiSize->update();
00872 DigiExpectedSize->update();
00873
00874
00875
00876
00877
00878
00879
00880
00881
00882
00883
00884
00885
00886
00887
00888
00889
00890
00891
00892
00893
00894
00895 return;
00896 }
00897
00898
00899
00900 template <class DIGI>
00901 int HcalDigiMonitor::process_Digi(DIGI& digi, DigiHists& h, int& firstcap)
00902 {
00903 int err=0x0;
00904 bool bitUp = false;
00905 int ADCcount=0;
00906
00907 int shapeThresh=0;
00908
00909 int mindigisize=1;
00910 int maxdigisize=10;
00911
00912 if (digi.id().subdet()==HcalBarrel)
00913 {
00914 shapeThresh=shapeThreshHB_;
00915 mindigisize=mindigisizeHBHE_;
00916 maxdigisize=maxdigisizeHBHE_;
00917 }
00918 else if (digi.id().subdet()==HcalEndcap)
00919 {
00920 shapeThresh=shapeThreshHE_;
00921 mindigisize=mindigisizeHBHE_;
00922 maxdigisize=maxdigisizeHBHE_;
00923 }
00924 else if (digi.id().subdet()==HcalOuter)
00925 {
00926 shapeThresh=shapeThreshHO_;
00927 mindigisize=mindigisizeHO_;
00928 maxdigisize=maxdigisizeHO_;
00929 }
00930 else if (digi.id().subdet()==HcalForward)
00931 {
00932 shapeThresh=shapeThreshHF_;
00933 mindigisize=mindigisizeHF_;
00934 maxdigisize=maxdigisizeHF_;
00935 }
00936 int iEta = digi.id().ieta();
00937 int iPhi = digi.id().iphi();
00938 int iDepth = digi.id().depth();
00939 int calcEta = CalcEtaBin(digi.id().subdet(),iEta,iDepth);
00940
00941
00942 if (digi.size()<mindigisize || digi.size()>maxdigisize)
00943 {
00944 if (digi_checkdigisize_) err|=0x1;
00945 ++baddigisize[calcEta][iPhi-1][iDepth-1];
00946 }
00947
00948 if (digi.size()<20)
00949 ++digisize[static_cast<int>(digi.size())][digi.id().subdet()-1];
00950 else
00951 ++digisize[19][digi.id().subdet()-1];
00952
00953
00954 ++h.count_presample[digi.presamples()];
00955
00956
00957 if (firstcap==-1) firstcap = digi.sample(0).capid();
00958 int capdif = digi.sample(0).capid() - firstcap;
00959
00960
00961 if (capdif >-4 && capdif<4)
00962 ++h.capIDdiff[capdif+3];
00963 else
00964 ++h.capIDdiff[7];
00965
00966 int last=-1;
00967
00968 int offset = digi.fiberIdleOffset();
00969
00970
00971
00972
00973 if (offset != -1000 && DigiMonitor_ExpectedOrbitMessageTime_>-1)
00974 {
00975
00976 ++h.fibbcnoff[offset + 7];
00977 if (offset != 0)
00978 {
00979 ++badFibBCNOff[calcEta][iPhi-1][iDepth-1];
00980 if (shutOffOrbitTest_ == false) err |= 0xF;
00981 }
00982 }
00983
00984 int tssum=0;
00985
00986 bool digi_error=false;
00987
00988 const int DigiSize=digi.size();
00989 for (int i=0;i<10;++i) pedSubtractedADC_[i]=0;
00990 const int pedSubADCsize=sizeof(pedSubtractedADC_)/sizeof(double);
00991
00992 std::map<HcalDetId, std::vector<double> >::iterator foundID = PedestalsByCapId_.find(digi.id());
00993 for (int i=0;i<DigiSize;++i)
00994 {
00995 int thisCapid = digi.sample(i).capid();
00996 if (thisCapid>=0 && thisCapid<4) ++h.capid[thisCapid];
00997
00998 if (makeDiagnostics_)
00999 {
01000 if(bitUpset(last,thisCapid)) bitUp=true;
01001 last = thisCapid;
01002
01003 if (digi_checkdverr_)
01004 {
01005 if(digi.sample(i).er()) err=(err|0x2);
01006 if(!digi.sample(i).dv()) err=(err|0x2);
01007 }
01008 if ((digi_error==false) && (digi.sample(i).er() || !digi.sample(i).dv()))
01009 {
01010 ++digierrorsdverr[calcEta][iPhi-1][iDepth-1];
01011 digi_error=true;
01012 }
01013 ++h.dverr[static_cast<int>(2*digi.sample(i).er()+digi.sample(i).dv())];
01014 }
01015
01016 h.count_shape[i]+=digi.sample(i).adc();
01017
01018
01019 if (i==digi.size()-1) continue;
01020 tssum= digi.sample(i).adc()+digi.sample(i+1).adc();
01021 if (tssum<50 && tssum>=0)
01022 {
01023 if (iEta>0)
01024 ++h.tssumplus[tssum][i];
01025 else
01026 ++h.tssumminus[tssum][i];
01027 }
01028
01029 if (digi.sample(i).adc()<0) ++h.adc[0];
01030 else if (digi.sample(i).adc()<200) ++h.adc[digi.sample(i).adc()];
01031 else ++h.adc[199];
01032
01033 if (i>=pedSubADCsize) continue;
01034
01035 if (foundID!=PedestalsByCapId_.end())
01036 {
01037 pedSubtractedADC_[i]=digi.sample(i).adc()-(foundID->second)[thisCapid];
01038 ADCcount+=(int)(digi.sample(i).adc()-(foundID->second)[thisCapid]);
01039 }
01040 else
01041 {
01042 pedSubtractedADC_[i]=digi.sample(i).adc()-3;
01043 ADCcount+=digi.sample(i).adc()-3;
01044 }
01045 }
01046
01047
01048 if(bitUp)
01049 {
01050 if (digi_checkcapid_) err=(err|0x4);
01051 ++badcapID[calcEta][iPhi-1][iDepth-1];
01052 }
01053
01054
01055
01056 if (err>0)
01057 {
01058 if(uniqcounter[calcEta][iPhi-1][iDepth-1]<1)
01059 {
01060 ++h.count_bad;
01061 ++baddigis[calcEta][iPhi-1][iDepth-1];
01062 ++errorVME[static_cast<int>(2*(digi.elecId().htrSlot()+0.5*digi.elecId().htrTopBottom()))][static_cast<int>(digi.elecId().readoutVMECrateId())];
01063 ++errorSpigot[static_cast<int>(digi.elecId().spigot())][static_cast<int>(digi.elecId().dccid())];
01064 }
01065 uniqcounter[calcEta][iPhi-1][iDepth-1]++;
01066
01067 return err;
01068 }
01069
01070 if (ADCcount<0) ADCcount=0;
01071 if (ADCcount<199)
01072 ++h.adcsum[ADCcount];
01073 else
01074 ++h.adcsum[199];
01075
01076
01077
01078 if (ADCcount>shapeThresh && passedMinBiasHLT_ && HT_HFP_>1 && HT_HFM_>1)
01079 {
01080 h.ThreshCount->Fill(0,1);
01081 if (digi.id().subdet()!=HcalOuter || isSiPM(iEta,iPhi, iDepth)==false)
01082 {
01083 for (int i=0;i<pedSubADCsize;++i)
01084 h.count_shapeThresh[i]+=pedSubtractedADC_[i];
01085 }
01086 }
01087
01088
01089 ++h.count_good;
01090 ++occupancyEtaPhi[calcEta][iPhi-1][iDepth-1];
01091 ++occupancyEta[iEta+41];
01092 ++occupancyPhi[iPhi-1];
01093
01094 ++occupancyVME[static_cast<int>(2*(digi.elecId().htrSlot()+0.5*digi.elecId().htrTopBottom()))][static_cast<int>(digi.elecId().readoutVMECrateId())];
01095 ++occupancySpigot[static_cast<int>(digi.elecId().spigot())][static_cast<int>(digi.elecId().dccid())];
01096
01097
01098 if (digi.id().subdet()==HcalForward
01099 && Online_
01100 && currenttype_==0
01101 && passedMinBiasHLT_
01102 )
01103 {
01104 int maxtime=-1;
01105 double maxenergy=-1, fullenergy=0;
01106 int digisize=digi.size();
01107 for (int ff=0;ff<digisize;++ff)
01108 {
01109 fullenergy+=digi.sample(ff).nominal_fC()-2.5;
01110 if (digi.sample(ff).nominal_fC()-2.5>maxenergy)
01111 {
01112 maxenergy=digi.sample(ff).nominal_fC()-2.5;
01113 maxtime=ff;
01114 }
01115 }
01116
01117 if (maxtime>=2 && maxtime<=5 && maxenergy>20 && maxenergy<100)
01118 {
01119 for (int ff=0;ff<digisize;++ff){
01120 if(fullenergy>0){
01121 if(digi.id().ieta()>0)HFP_shape->Fill(ff,(digi.sample(ff).nominal_fC()-2.5)/fullenergy);
01122 if(digi.id().ieta()<0)HFM_shape->Fill(ff,(digi.sample(ff).nominal_fC()-2.5)/fullenergy);
01123 }
01124 }
01125
01126 double time_den=0, time_num=0;
01127
01128 int startslice=std::max(0,maxtime-1);
01129 int endslice=std::min(digisize-1,maxtime+1);
01130 for (int ss=startslice;ss<=endslice;++ss)
01131 {
01132
01133 time_num+=ss*(digi.sample(ss).nominal_fC()-2.5);
01134 time_den+=digi.sample(ss).nominal_fC()-2.5;
01135 }
01136
01137 int myiphi=iPhi;
01138 if (iDepth==2) ++myiphi;
01139 if (HFtiming_etaProfile!=0 && time_den!=0)
01140 HFtiming_etaProfile->Fill(iEta,time_num/time_den);
01141 if (HFtiming_totaltime2D!=0 && time_den!=0)
01142 HFtiming_totaltime2D->Fill(iEta,myiphi,time_num/time_den);
01143 if (HFtiming_occupancy2D!=0 && time_den!=0)
01144 HFtiming_occupancy2D->Fill(iEta,myiphi,1);
01145 }
01146 }
01147
01148 return err;
01149 }
01150
01151 void HcalDigiMonitor::beginLuminosityBlock(const edm::LuminosityBlock& lumiSeg,
01152 const edm::EventSetup& c)
01153 {
01154 HcalBaseDQMonitor::beginLuminosityBlock(lumiSeg,c);
01155 ProblemsCurrentLB->Reset();
01156 }
01157
01158 void HcalDigiMonitor::endLuminosityBlock(const edm::LuminosityBlock& lumiSeg,
01159 const edm::EventSetup& c)
01160 {
01161 if (LumiInOrder(lumiSeg.luminosityBlock())==false) return;
01162
01163
01164 if (ProblemsCurrentLB)
01165 ProblemsCurrentLB->Reset();
01166
01167 ProblemDigisInLastNLB_HBHEHF_alarm->Reset();
01168
01169
01170 if(hbhedcsON == true && hfdcsON == true && HBpresent_ == 1 && HEpresent_ == 1 && HFpresent_ == 1)
01171 ++alarmer_counter_;
01172 else
01173 alarmer_counter_ = 0;
01174
01175 fill_Nevents();
01176
01177 zeroCounters();
01178
01179 return;
01180 }
01181
01182 void HcalDigiMonitor::fill_Nevents()
01183 {
01184 if (debug_>0)
01185 std::cout <<"<HcalDigiMonitor> Calling fill_Nevents for event "<<tevt_<< " (processed events = "<<ievt_<<")"<<std::endl;
01186 int iPhi, iEta, iDepth;
01187
01188
01189
01190 ProblemsVsLB->Fill(currentLS,hbHists.count_bad+heHists.count_bad+hoHists.count_bad+hfHists.count_bad);
01191 ProblemsVsLB_HB->Fill(currentLS,hbHists.count_bad);
01192 ProblemsVsLB_HE->Fill(currentLS,heHists.count_bad);
01193 ProblemsVsLB_HO->Fill(currentLS,hoHists.count_bad);
01194 ProblemsVsLB_HF->Fill(currentLS,hfHists.count_bad);
01195 ProblemsVsLB_HBHEHF->Fill(currentLS,hbHists.count_bad+heHists.count_bad+hfHists.count_bad);
01196
01197 if( hbHists.count_bad+heHists.count_bad+hfHists.count_bad-knownbadQPLLs< 50 )
01198 alarmer_counter_ = 0;
01199
01200 if( alarmer_counter_ >= 5 )
01201 ProblemDigisInLastNLB_HBHEHF_alarm->Fill( std::min(int(hbHists.count_bad+heHists.count_bad+hfHists.count_bad), 99) );
01202
01203
01204 if (ProblemsCurrentLB)
01205 {
01206 ProblemsCurrentLB->Fill(-1,-1,1);
01207 ProblemsCurrentLB->Fill(0,0,hbHists.count_bad);
01208 ProblemsCurrentLB->Fill(1,0,heHists.count_bad);
01209 ProblemsCurrentLB->Fill(2,0,hoHists.count_bad);
01210 ProblemsCurrentLB->Fill(3,0,hfHists.count_bad);
01211 ProblemsCurrentLB->Fill(4,0,HO0bad);
01212 ProblemsCurrentLB->Fill(5,0,HO12bad);
01213 ProblemsCurrentLB->Fill(6,0,HFlumibad);
01214 }
01215
01216
01217 for (int i=0;i<10;++i)
01218 {
01219 for (int j=0;j<50;++j)
01220 {
01221 if (hbHists.tssumplus[j][i]>0) hbHists.TS_sum_plus[i]->Fill(j, hbHists.tssumplus[j][i]);
01222 if (hbHists.tssumminus[j][i]>0) hbHists.TS_sum_minus[i]->Fill(j, hbHists.tssumminus[j][i]);
01223 if (heHists.tssumplus[j][i]>0) heHists.TS_sum_plus[i]->Fill(j, heHists.tssumplus[j][i]);
01224 if (heHists.tssumminus[j][i]>0) heHists.TS_sum_minus[i]->Fill(j, heHists.tssumminus[j][i]);
01225 if (hoHists.tssumplus[j][i]>0) hoHists.TS_sum_plus[i]->Fill(j, hoHists.tssumplus[j][i]);
01226 if (hoHists.tssumminus[j][i]>0) hoHists.TS_sum_minus[i]->Fill(j, hoHists.tssumminus[j][i]);
01227 if (hfHists.tssumplus[j][i]>0) hfHists.TS_sum_plus[i]->Fill(j, hfHists.tssumplus[j][i]);
01228 if (hfHists.tssumminus[j][i]>0) hfHists.TS_sum_minus[i]->Fill(j, hfHists.tssumminus[j][i]);
01229 }
01230 }
01231
01232 for (int i=0;i<DIGI_NUM;++i)
01233 {
01234 if (diginum[i]>0) DigiNum->Fill(i, diginum[i]);
01235 if (i>=DIGI_SUBDET_NUM) continue;
01236
01237 if (hbHists.count_BQ[i]>0) hbHists.BQ->Fill(i, hbHists.count_BQ[i]);
01238 if (heHists.count_BQ[i]>0) heHists.BQ->Fill(i, heHists.count_BQ[i]);
01239 if (hoHists.count_BQ[i]>0) hoHists.BQ->Fill(i, hoHists.count_BQ[i]);
01240 if (hfHists.count_BQ[i]>0) hfHists.BQ->Fill(i, hfHists.count_BQ[i]);
01241 }
01242
01243
01244
01245 for (int i=0;i<4;++i)
01246 {
01247 if (hbHists.dverr[i]>0) hbHists.DVerr->Fill(i, hbHists.dverr[i]);
01248 if (heHists.dverr[i]>0) heHists.DVerr->Fill(i, heHists.dverr[i]);
01249 if (hoHists.dverr[i]>0) hoHists.DVerr->Fill(i, hoHists.dverr[i]);
01250 if (hfHists.dverr[i]>0) hfHists.DVerr->Fill(i, hfHists.dverr[i]);
01251
01252 if (hbHists.capid[i]>0) hbHists.CapID->Fill(i, hbHists.capid[i]);
01253 if (heHists.capid[i]>0) heHists.CapID->Fill(i, heHists.capid[i]);
01254 if (hoHists.capid[i]>0) hoHists.CapID->Fill(i, hoHists.capid[i]);
01255 if (hfHists.capid[i]>0) hfHists.CapID->Fill(i, hfHists.capid[i]);
01256 }
01257
01258 for (int i=0;i<200;++i)
01259 {
01260 if (hbHists.adc[i]>0) hbHists.ADC->Fill(i, hbHists.adc[i]);
01261
01262 if (heHists.adc[i]>0) heHists.ADC->Fill(i, heHists.adc[i]);
01263 if (hoHists.adc[i]>0) hoHists.ADC->Fill(i, hoHists.adc[i]);
01264 if (hfHists.adc[i]>0) hfHists.ADC->Fill(i, hfHists.adc[i]);
01265
01266 if (hbHists.adcsum[i]>0) hbHists.ADCsum->Fill(i, hbHists.adcsum[i]);
01267 if (heHists.adcsum[i]>0) heHists.ADCsum->Fill(i, heHists.adcsum[i]);
01268 if (hoHists.adcsum[i]>0) hoHists.ADCsum->Fill(i, hoHists.adcsum[i]);
01269 if (hfHists.adcsum[i]>0) hfHists.ADCsum->Fill(i, hfHists.adcsum[i]);
01270 }
01271
01272 for (int i = 0; i < 15; ++i)
01273 {
01274 if (hbHists.fibbcnoff[i]>0) hbHists.fibBCNOff->Fill(i-7,
01275 hbHists.fibbcnoff[i]);
01276 if (heHists.fibbcnoff[i]>0) heHists.fibBCNOff->Fill(i-7,
01277 heHists.fibbcnoff[i]);
01278 if (hfHists.fibbcnoff[i]>0) hfHists.fibBCNOff->Fill(i-7,
01279 hfHists.fibbcnoff[i]);
01280 if (hoHists.fibbcnoff[i]>0) hoHists.fibBCNOff->Fill(i-7,
01281 hoHists.fibbcnoff[i]);
01282 }
01283
01284
01285 for (int i=0;i<DIGI_BQ_FRAC_NBINS;++i)
01286 {
01287 if (DIGI_BQ_FRAC_NBINS==1) break;
01288 if (hbHists.count_BQFrac[i]>0) hbHists.BQFrac->Fill(1.*i/(DIGI_BQ_FRAC_NBINS-1), hbHists.count_BQFrac[i]);
01289 if (heHists.count_BQFrac[i]>0) heHists.BQFrac->Fill(1.*i/(DIGI_BQ_FRAC_NBINS-1), heHists.count_BQFrac[i]);
01290 if (hoHists.count_BQFrac[i]>0)
01291 {
01292 hoHists.BQFrac->Fill(1.*i/(DIGI_BQ_FRAC_NBINS), hoHists.count_BQFrac[i]);
01293 }
01294 if (hfHists.count_BQFrac[i]>0) hfHists.BQFrac->Fill(1.*i/(DIGI_BQ_FRAC_NBINS-1), hfHists.count_BQFrac[i]);
01295 }
01296
01297
01298 for (int i=0;i<50;++i)
01299 {
01300 if (hbHists.count_presample[i]>0) hbHists.presample->Fill(i, hbHists.count_presample[i]);
01301 if (heHists.count_presample[i]>0) heHists.presample->Fill(i, heHists.count_presample[i]);
01302 if (hoHists.count_presample[i]>0) hoHists.presample->Fill(i, hoHists.count_presample[i]);
01303 if (hfHists.count_presample[i]>0) hfHists.presample->Fill(i, hfHists.count_presample[i]);
01304 }
01305
01306
01307 for (int i=0;i<10;++i)
01308 {
01309 if (hbHists.count_shape[i]>0) hbHists.shape->Fill(i, hbHists.count_shape[i]);
01310 if (hbHists.count_shapeThresh[i]>0) hbHists.shapeThresh->Fill(i, hbHists.count_shapeThresh[i]);
01311 if (heHists.count_shape[i]>0) heHists.shape->Fill(i, heHists.count_shape[i]);
01312 if (heHists.count_shapeThresh[i]>0) heHists.shapeThresh->Fill(i, heHists.count_shapeThresh[i]);
01313 if (hoHists.count_shape[i]>0) hoHists.shape->Fill(i, hoHists.count_shape[i]);
01314 if (hoHists.count_shapeThresh[i]>0) hoHists.shapeThresh->Fill(i, hoHists.count_shapeThresh[i]);
01315 if (hfHists.count_shape[i]>0) hfHists.shape->Fill(i, hfHists.count_shape[i]);
01316 if (hfHists.count_shapeThresh[i]>0) hfHists.shapeThresh->Fill(i, hfHists.count_shapeThresh[i]);
01317 }
01318
01319
01320 for (int i=0;i<8;++i)
01321 {
01322 if (hbHists.capIDdiff[i]>0) hbHists.DigiFirstCapID->Fill(i, hbHists.capIDdiff[i]);
01323 if (heHists.capIDdiff[i]>0) heHists.DigiFirstCapID->Fill(i, heHists.capIDdiff[i]);
01324 if (hoHists.capIDdiff[i]>0) hoHists.DigiFirstCapID->Fill(i, hoHists.capIDdiff[i]);
01325 if (hfHists.capIDdiff[i]>0) hfHists.DigiFirstCapID->Fill(i, hfHists.capIDdiff[i]);
01326 }
01327
01328
01329 for (int i=0;i<40;++i)
01330 {
01331 for (int j=0;j<18;++j)
01332 {
01333 if (errorVME[i][j]>0) DigiErrorVME->Fill(i, j,errorVME[i][j]);
01334 if (occupancyVME[i][j]>0) DigiOccupancyVME->Fill(i, j,occupancyVME[i][j]);
01335 }
01336 }
01337
01338
01339 for (int i=0;i<HcalDCCHeader::SPIGOT_COUNT;++i)
01340 {
01341 for (int j=0;j<36;++j)
01342 {
01343 if (errorSpigot[i][j]>0) DigiErrorSpigot->Fill(i, j,errorSpigot[i][j]);
01344 if (occupancySpigot[i][j]>0) DigiOccupancySpigot->Fill(i, j,occupancySpigot[i][j]);
01345 }
01346 }
01347
01348
01349 for (int sub=0;sub<4;++sub)
01350 {
01351 for (int dsize=0;dsize<20;++dsize)
01352 {
01353 if (digisize[dsize][sub]>0)
01354 DigiSize->Fill(sub,dsize,digisize[dsize][sub]);
01355 }
01356 }
01357
01358
01359 for (int d=0;d<4;++d)
01360 {
01361 iDepth=d+1;
01362 DigiErrorsByDepth.depth[d]->setBinContent(0,0,ievt_);
01363 DigiOccupancyByDepth.depth[d]->setBinContent(0,0,ievt_);
01364 DigiErrorsBadDigiSize.depth[d]->setBinContent(0,0,ievt_);
01365 DigiErrorsUnpacker.depth[d]->setBinContent(0,0,ievt_);
01366 DigiErrorsBadFibBCNOff.depth[d]->setBinContent(0,0,ievt_);
01367
01368 for (int phi=0;phi<72;++phi)
01369 {
01370 iPhi=phi+1;
01371 DigiOccupancyPhi->Fill(iPhi,occupancyPhi[phi]);
01372 for (int eta=0;eta<83;++eta)
01373 {
01374
01375 iEta=eta-41;
01376 if (phi==0)
01377 DigiOccupancyEta->Fill(iEta,occupancyEta[eta]);
01378
01379
01380
01381 if (validDetId(HcalBarrel, iEta, iPhi, iDepth))
01382 {
01383
01384 if (HBpresent_)
01385 {
01386 int calcEta = CalcEtaBin(HcalBarrel,iEta,iDepth);
01387
01388 DigiOccupancyByDepth.depth[d]->Fill(iEta, iPhi,
01389 occupancyEtaPhi[calcEta][phi][d]);
01390
01391 if (makeDiagnostics_)
01392 {
01393 DigiErrorsBadCapID.depth[d]->Fill(iEta, iPhi,
01394 badcapID[calcEta][phi][d]);
01395 DigiErrorsDVErr.depth[d]->Fill(iEta, iPhi,
01396 digierrorsdverr[calcEta][phi][d]);
01397 }
01398 DigiErrorsBadDigiSize.depth[d]->Fill(iEta, iPhi,
01399 baddigisize[calcEta][phi][d]);
01400 DigiErrorsBadFibBCNOff.depth[d]->Fill(iEta, iPhi,
01401 badFibBCNOff[calcEta][phi][d]);
01402 DigiErrorsUnpacker.depth[d]->Fill(iEta, iPhi,
01403 badunpackerreport[calcEta][phi][d]);
01404 DigiErrorsByDepth.depth[d]->Fill(iEta, iPhi,
01405 baddigis[calcEta][phi][d]);
01406
01407
01408 }
01409 }
01410
01411 if (validDetId(HcalEndcap, iEta, iPhi, iDepth))
01412 {
01413
01414 if (HEpresent_)
01415 {
01416 int calcEta = CalcEtaBin(HcalEndcap,iEta,iDepth);
01417
01418 DigiOccupancyByDepth.depth[d]->Fill(iEta, iPhi,
01419 occupancyEtaPhi[calcEta][phi][d]);
01420
01421 if (makeDiagnostics_)
01422 {
01423 DigiErrorsBadCapID.depth[d]->Fill(iEta, iPhi,
01424 badcapID[calcEta][phi][d]);
01425 DigiErrorsDVErr.depth[d]->Fill(iEta, iPhi,
01426 digierrorsdverr[calcEta][phi][d]);
01427 }
01428 DigiErrorsBadDigiSize.depth[d]->Fill(iEta, iPhi,
01429 baddigisize[calcEta][phi][d]);
01430 DigiErrorsBadFibBCNOff.depth[d]->Fill(iEta, iPhi,
01431 badFibBCNOff[calcEta][phi][d]);
01432 DigiErrorsUnpacker.depth[d]->Fill(iEta, iPhi,
01433 badunpackerreport[calcEta][phi][d]);
01434 DigiErrorsByDepth.depth[d]->Fill(iEta, iPhi,
01435 baddigis[calcEta][phi][d]);
01436 }
01437 }
01438
01439 if (validDetId(HcalOuter,iEta,iPhi,iDepth))
01440 {
01441
01442 if (HOpresent_)
01443 {
01444 int calcEta = CalcEtaBin(HcalOuter,iEta,iDepth);
01445 DigiOccupancyByDepth.depth[d]->Fill(iEta, iPhi,
01446 occupancyEtaPhi[calcEta][phi][d]);
01447 if (makeDiagnostics_)
01448 {
01449 DigiErrorsBadCapID.depth[d]->Fill(iEta, iPhi,
01450 badcapID[calcEta][phi][d]);
01451 DigiErrorsDVErr.depth[d]->Fill(iEta, iPhi,
01452 digierrorsdverr[calcEta][phi][d]);
01453 }
01454 DigiErrorsBadDigiSize.depth[d]->Fill(iEta, iPhi,
01455 baddigisize[calcEta][phi][d]);
01456 DigiErrorsBadFibBCNOff.depth[d]->Fill(iEta, iPhi,
01457 badFibBCNOff[calcEta][phi][d]);
01458 DigiErrorsUnpacker.depth[d]->Fill(iEta, iPhi,
01459 badunpackerreport[calcEta][phi][d]);
01460
01461 DigiErrorsByDepth.depth[d]->Fill(iEta,iPhi,
01462 baddigis[calcEta][phi][d]);
01463 }
01464 }
01465
01466 if (validDetId(HcalForward,iEta,iPhi,iDepth))
01467 {
01468
01469 if (HFpresent_)
01470 {
01471 int calcEta = CalcEtaBin(HcalForward,iEta,iDepth);
01472 int zside = iEta/abs(iEta);
01473 DigiOccupancyByDepth.depth[d]->Fill(iEta+zside, iPhi,
01474 occupancyEtaPhi[calcEta][phi][d]);
01475
01476 if (makeDiagnostics_)
01477 {
01478 DigiErrorsBadCapID.depth[d]->Fill(iEta+zside, iPhi,
01479 badcapID[calcEta][phi][d]);
01480 DigiErrorsDVErr.depth[d]->Fill(iEta+zside, iPhi,
01481 digierrorsdverr[calcEta][phi][d]);
01482 }
01483 DigiErrorsBadDigiSize.depth[d]->Fill(iEta+zside, iPhi,
01484 baddigisize[calcEta][phi][d]);
01485 DigiErrorsBadFibBCNOff.depth[d]->Fill(iEta+zside, iPhi,
01486 badFibBCNOff[calcEta][phi][d]);
01487 DigiErrorsUnpacker.depth[d]->Fill(iEta+zside, iPhi,
01488 badunpackerreport[calcEta][phi][d]);
01489 DigiErrorsByDepth.depth[d]->Fill(iEta+zside, iPhi,
01490 baddigis[calcEta][phi][d]);
01491
01492 }
01493 }
01494 }
01495 }
01496 }
01497
01498
01499 FillUnphysicalHEHFBins(DigiErrorsByDepth);
01500 if (makeDiagnostics_)
01501 {
01502 FillUnphysicalHEHFBins(DigiErrorsBadCapID);
01503 FillUnphysicalHEHFBins(DigiErrorsDVErr);
01504 }
01505 FillUnphysicalHEHFBins(DigiErrorsBadDigiSize);
01506 FillUnphysicalHEHFBins(DigiOccupancyByDepth);
01507 FillUnphysicalHEHFBins(DigiErrorsBadFibBCNOff);
01508 FillUnphysicalHEHFBins(DigiErrorsUnpacker);
01509
01510
01511
01512 return;
01513 }
01514
01515
01516 void HcalDigiMonitor::zeroCounters()
01517 {
01518
01519
01520
01521
01522 for (int d=0; d<DEPTHBINS; d++) {
01523 for (int eta=0; eta<ETABINS; eta++) {
01524 for (int phi=0; phi<PHIBINS; phi++){
01525 uniqcounter[eta][phi][d] = 0.0;
01526 uniqcounter2[eta][phi][d] = 0.0;
01527 }
01528 }
01529 }
01530
01531 hbHists.count_bad=0;
01532 hbHists.count_good=0;
01533 heHists.count_bad=0;
01534 heHists.count_good=0;
01535 hoHists.count_bad=0;
01536 hoHists.count_good=0;
01537 hfHists.count_bad=0;
01538 hfHists.count_good=0;
01539
01540 knownbadQPLLs = 0;
01541
01542 HO0bad=0;
01543 HO12bad=0;
01544 HFlumibad=0;
01545
01546 for (int i=0;i<85;++i)
01547 {
01548 occupancyEta[i]=0;
01549 if (i<72)
01550 occupancyPhi[i]=0;
01551 for (int j=0;j<72;++j)
01552 {
01553 for (int k=0;k<4;++k)
01554 {
01555 baddigis[i][j][k]=0;
01556 badcapID[i][j][k]=0;
01557 baddigisize[i][j][k]=0;
01558 occupancyEtaPhi[i][j][k]=0;
01559 digierrorsdverr[i][j][k]=0;
01560 badFibBCNOff[i][j][k]=0;
01561 badunpackerreport[i][j][k]=0;
01562 }
01563 }
01564 }
01565
01566 for (int i=0;i<40;++i)
01567 {
01568 for (int j=0;j<18;++j)
01569 {
01570 occupancyVME[i][j]=0;
01571 errorVME[i][j]=0;
01572 }
01573 }
01574
01575 for (int i=0;i<HcalDCCHeader::SPIGOT_COUNT;++i)
01576 {
01577 for (int j=0;j<36;++j)
01578 {
01579 occupancySpigot[i][j]=0;
01580 errorSpigot[i][j]=0;
01581 }
01582 }
01583
01584
01585 for (int i=0;i<20;++i)
01586 {
01587 for (int j=0;j<4;++j)
01588 digisize[i][j]=0;
01589 }
01590
01591 for (int i=0;i<DIGI_NUM;++i)
01592 {
01593 diginum[i]=0;
01594
01595
01596 if (i<4)
01597 {
01598 hbHists.dverr[i]=0;
01599 heHists.dverr[i]=0;
01600 hoHists.dverr[i]=0;
01601 hfHists.dverr[i]=0;
01602 hbHists.capid[i]=0;
01603 heHists.capid[i]=0;
01604 hoHists.capid[i]=0;
01605 hfHists.capid[i]=0;
01606 }
01607 if (i<8)
01608 {
01609 hbHists.capIDdiff[i]=0;
01610 heHists.capIDdiff[i]=0;
01611 hoHists.capIDdiff[i]=0;
01612 hfHists.capIDdiff[i]=0;
01613 }
01614
01615 if (i<10)
01616 {
01617 hbHists.count_shape[i]=0;
01618 heHists.count_shape[i]=0;
01619 hoHists.count_shape[i]=0;
01620 hfHists.count_shape[i]=0;
01621
01622 hbHists.count_shapeThresh[i]=0;
01623 heHists.count_shapeThresh[i]=0;
01624 hoHists.count_shapeThresh[i]=0;
01625 hfHists.count_shapeThresh[i]=0;
01626 }
01627 if (i<50)
01628 {
01629 hbHists.count_presample[i]=0;
01630 heHists.count_presample[i]=0;
01631 hoHists.count_presample[i]=0;
01632 hfHists.count_presample[i]=0;
01633 for (int j=0;j<10;++j)
01634 {
01635 hbHists.tssumplus[i][j]=0;
01636 heHists.tssumplus[i][j]=0;
01637 hoHists.tssumplus[i][j]=0;
01638 hfHists.tssumplus[i][j]=0;
01639 hbHists.tssumminus[i][j]=0;
01640 heHists.tssumminus[i][j]=0;
01641 hoHists.tssumminus[i][j]=0;
01642 hfHists.tssumminus[i][j]=0;
01643 }
01644 }
01645
01646 if (i<15)
01647 {
01648 hbHists.fibbcnoff[i]=0;
01649 heHists.fibbcnoff[i]=0;
01650 hoHists.fibbcnoff[i]=0;
01651 hfHists.fibbcnoff[i]=0;
01652 }
01653
01654 if (i<200)
01655 {
01656 hbHists.adc[i]=0;
01657 heHists.adc[i]=0;
01658 hoHists.adc[i]=0;
01659 hfHists.adc[i]=0;
01660 hbHists.adcsum[i]=0;
01661 heHists.adcsum[i]=0;
01662 hoHists.adcsum[i]=0;
01663 hfHists.adcsum[i]=0;
01664 }
01665 if (i<DIGI_SUBDET_NUM)
01666 {
01667 hbHists.count_BQ[i]=0;
01668 heHists.count_BQ[i]=0;
01669 hoHists.count_BQ[i]=0;
01670 hfHists.count_BQ[i]=0;
01671 }
01672 if (i<DIGI_BQ_FRAC_NBINS)
01673 {
01674 hbHists.count_BQFrac[i]=0;
01675 heHists.count_BQFrac[i]=0;
01676 hoHists.count_BQFrac[i]=0;
01677 hfHists.count_BQFrac[i]=0;
01678 }
01679 }
01680
01681
01682 return;
01683 }
01684
01685 void HcalDigiMonitor::UpdateHists(DigiHists& h)
01686 {
01687
01688 h.shape->update();
01689 h.shapeThresh->update();
01690 h.presample->update();
01691 h.BQ->update();
01692 h.BQFrac->update();
01693 h.DigiFirstCapID->update();
01694 h.DVerr->update();
01695 h.CapID->update();
01696 h.ADC->update();
01697 h.ADCsum->update();
01698 h.fibBCNOff->update();
01699
01700 for (unsigned int i=0;i<h.TS_sum_plus.size();++i)
01701 h.TS_sum_plus[i]->update();
01702 for (unsigned int i=0;i<h.TS_sum_minus.size();++i)
01703 h.TS_sum_minus[i]->update();
01704 }
01705
01706
01707 void HcalDigiMonitor::reset()
01708 {
01709
01710 zeroCounters();
01711
01712
01713
01714 ProblemDigisInLastNLB_HBHEHF_alarm->Reset();
01715 alarmer_counter_ = 0;
01716 knownbadQPLLs = 0;
01717
01718 hbhedcsON = true; hfdcsON = true;
01719
01720 DigiErrorsByDepth.Reset();
01721 DigiErrorsBadCapID.Reset();
01722 DigiErrorsDVErr.Reset();
01723 DigiErrorsBadDigiSize.Reset();
01724 DigiErrorsBadADCSum.Reset();
01725 DigiErrorsUnpacker.Reset();
01726 DigiErrorsBadFibBCNOff.Reset();
01727 DigiOccupancyByDepth.Reset();
01728 DigiErrorOccupancyByDepth.Reset();
01729
01730 DigiOccupancyEta->Reset();
01731 DigiOccupancyPhi->Reset();
01732 DigiOccupancyVME->Reset();
01733 DigiOccupancySpigot->Reset();
01734 DigiErrorVME->Reset();
01735 DigiErrorSpigot->Reset();
01736
01737 DigiBQ->Reset();
01738 DigiBQFrac->Reset();
01739 DigiUnpackerErrorCount->Reset();
01740 DigiUnpackerErrorFrac->Reset();
01741
01742 DigiNum->Reset();
01743
01744 hbHists.shape->Reset();
01745 hbHists.shapeThresh->Reset();
01746 hbHists.presample->Reset();
01747 hbHists.BQ->Reset();
01748 hbHists.BQFrac->Reset();
01749 hbHists.DigiFirstCapID->Reset();
01750 hbHists.DVerr->Reset();
01751 hbHists.CapID->Reset();
01752 hbHists.ADC->Reset();
01753 hbHists.ADCsum->Reset();
01754 hbHists.fibBCNOff->Reset();
01755 for (unsigned int i=0;i<hbHists.TS_sum_plus.size();++i)
01756 hbHists.TS_sum_plus[i]->Reset();
01757 for (unsigned int i=0;i<hbHists.TS_sum_minus.size();++i)
01758 hbHists.TS_sum_minus[i]->Reset();
01759
01760 heHists.shape->Reset();
01761 heHists.shapeThresh->Reset();
01762 heHists.presample->Reset();
01763 heHists.BQ->Reset();
01764 heHists.BQFrac->Reset();
01765 heHists.DigiFirstCapID->Reset();
01766 heHists.DVerr->Reset();
01767 heHists.CapID->Reset();
01768 heHists.ADC->Reset();
01769 heHists.ADCsum->Reset();
01770 heHists.fibBCNOff->Reset();
01771 for (unsigned int i=0;i<heHists.TS_sum_plus.size();++i)
01772 heHists.TS_sum_plus[i]->Reset();
01773 for (unsigned int i=0;i<heHists.TS_sum_minus.size();++i)
01774 heHists.TS_sum_minus[i]->Reset();
01775
01776 hoHists.shape->Reset();
01777 hoHists.shapeThresh->Reset();
01778 hoHists.presample->Reset();
01779 hoHists.BQ->Reset();
01780 hoHists.BQFrac->Reset();
01781 hoHists.DigiFirstCapID->Reset();
01782 hoHists.DVerr->Reset();
01783 hoHists.CapID->Reset();
01784 hoHists.ADC->Reset();
01785 hoHists.ADCsum->Reset();
01786 hoHists.fibBCNOff->Reset();
01787 for (unsigned int i=0;i<hoHists.TS_sum_plus.size();++i)
01788 hoHists.TS_sum_plus[i]->Reset();
01789 for (unsigned int i=0;i<hoHists.TS_sum_minus.size();++i)
01790 hoHists.TS_sum_minus[i]->Reset();
01791
01792 hfHists.shape->Reset();
01793 hfHists.shapeThresh->Reset();
01794 hfHists.presample->Reset();
01795 hfHists.BQ->Reset();
01796 hfHists.BQFrac->Reset();
01797 hfHists.DigiFirstCapID->Reset();
01798 hfHists.DVerr->Reset();
01799 hfHists.CapID->Reset();
01800 hfHists.ADC->Reset();
01801 hfHists.ADCsum->Reset();
01802 hfHists.fibBCNOff->Reset();
01803 for (unsigned int i=0;i<hfHists.TS_sum_plus.size();++i)
01804 hfHists.TS_sum_plus[i]->Reset();
01805 for (unsigned int i=0;i<hfHists.TS_sum_minus.size();++i)
01806 hfHists.TS_sum_minus[i]->Reset();
01807
01808 return;
01809 }
01810 DEFINE_FWK_MODULE(HcalDigiMonitor);
01811