00001 #include "DQM/HcalMonitorTasks/interface/HcalTrigPrimMonitor.h"
00002 #include "FWCore/Framework/interface/LuminosityBlock.h"
00003
00004 HcalTrigPrimMonitor::HcalTrigPrimMonitor (const edm::ParameterSet& ps) :
00005 dataLabel_(ps.getParameter<edm::InputTag>("dataLabel")),
00006 emulLabel_(ps.getParameter<edm::InputTag>("emulLabel")),
00007 ZSBadTPThreshold_(ps.getParameter< std::vector<int> >("ZSBadTPThreshold")),
00008 ZSAlarmThreshold_(ps.getParameter< std::vector<int> >("ZSAlarmThreshold"))
00009 {
00010 Online_ = ps.getUntrackedParameter<bool>("online",false);
00011 mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns",false);
00012 enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup",false);
00013 debug_ = ps.getUntrackedParameter<int>("debug",false);
00014 prefixME_ = ps.getUntrackedParameter<std::string>("subSystemFolder","Hcal/");
00015 if (prefixME_.substr(prefixME_.size()-1,prefixME_.size())!="/")
00016 prefixME_.append("/");
00017 subdir_ = ps.getUntrackedParameter<std::string>("TaskFolder","TrigPrimMonitor_Hcal");
00018 if (subdir_.size()>0 && subdir_.substr(subdir_.size()-1,subdir_.size())!="/")
00019 subdir_.append("/");
00020 subdir_=prefixME_+subdir_;
00021 AllowedCalibTypes_ = ps.getUntrackedParameter<std::vector<int> > ("AllowedCalibTypes");
00022 skipOutOfOrderLS_ = ps.getUntrackedParameter<bool>("skipOutOfOrderLS",true);
00023 NLumiBlocks_ = ps.getUntrackedParameter<int>("NLumiBlocks",4000);
00024 makeDiagnostics_ = ps.getUntrackedParameter<bool>("makeDiagnostics",false);
00025
00026 }
00027
00028
00029 HcalTrigPrimMonitor::~HcalTrigPrimMonitor () {
00030 }
00031
00032
00033 void
00034 HcalTrigPrimMonitor::reset () {
00035 }
00036
00037
00038 void
00039 HcalTrigPrimMonitor::setup() {
00040 HcalBaseDQMonitor::setup();
00041
00042 if (dbe_ == 0)
00043 return;
00044
00045 dbe_->setCurrentFolder(subdir_ + "TP Occupancy");
00046 TPOccupancyEta_ = dbe_->book1D("TPOccupancyVsEta", "TPOccupancyVsEta", 65, -32.5, 32.5);
00047 TPOccupancyPhi_ = dbe_->book1D("TPOccupancyVsPhi", "TPOccupancyVsPhi", 72, 0.5, 72.5);
00048 TPOccupancyPhiHFP_ = dbe_->book1D("TPOccupancyHFPVsPhi", "TPOccupancyHFPVsPhi", 72, 0.5, 72.5);
00049 TPOccupancyPhiHFM_ = dbe_->book1D("TPOccupancyHFMVsPhi", "TPOccupancyHFMVsPhi", 72, 0.5, 72.5);
00050 TPOccupancy_ = create_map(subdir_ + "TP Occupancy", "TPOccupancy");
00051
00052 for (int isZS = 0; isZS <= 1; ++isZS) {
00053
00054 std::string folder(subdir_);
00055 std::string zsname="_ZS";
00056 if (isZS == 0)
00057 {
00058 folder += "noZS/";
00059 zsname="_noZS";
00060 }
00061
00062 std::string problem_folder(folder);
00063 problem_folder += "Problem TPs/";
00064
00065 good_tps[isZS] = create_map(folder, "Good TPs"+zsname);
00066 bad_tps[isZS] = create_map(folder, "Bad TPs"+zsname);
00067
00068 errorflag[isZS] = create_errorflag(folder, "Error Flag"+zsname);
00069 problem_map[isZS][kMismatchedEt] = create_map(problem_folder, "Mismatched Et"+zsname);
00070 problem_map[isZS][kMismatchedFG] = create_map(problem_folder, "Mismatched FG"+zsname);
00071 problem_map[isZS][kMissingData] = create_map(problem_folder, "Missing Data"+zsname);
00072 problem_map[isZS][kMissingEmul] = create_map(problem_folder, "Missing Emul"+zsname);
00073
00074 for (int isHF = 0; isHF <= 1; ++isHF) {
00075 std::string subdet = (isHF == 0 ? "HBHE " : "HF ");
00076 tp_corr[isZS][isHF] = create_tp_correlation(folder, subdet + "TP Correlation"+zsname);
00077 fg_corr[isZS][isHF] = create_fg_correlation(folder, subdet + "FG Correlation"+zsname);
00078
00079 problem_et[isZS][isHF][kMismatchedFG]
00080 = create_et_histogram(problem_folder + "TP Values/", subdet + "Mismatched FG"+zsname);
00081
00082 problem_et[isZS][isHF][kMissingData]
00083 = create_et_histogram(problem_folder + "TP Values/", subdet + "Missing Data"+zsname);
00084
00085 problem_et[isZS][isHF][kMissingEmul]
00086 = create_et_histogram(problem_folder + "TP Values/", subdet + "Missing Emul"+zsname);
00087 }
00088 }
00089
00090
00091 for (int isZS = 0; isZS <= 1; ++isZS) {
00092
00093 std::string folder(subdir_);
00094 std::string zsname="_ZS";
00095 if (isZS == 0)
00096 {
00097 folder += "noZS/";
00098 zsname="_noZS";
00099 }
00100
00101 std::string problem_folder(folder);
00102 problem_folder += "Problem OOT TPs/";
00103
00104 good_tps_oot[isZS] = create_map(folder, "Good OOT TPs"+zsname);
00105 bad_tps_oot[isZS] = create_map(folder, "Bad OOT TPs"+zsname);
00106
00107 errorflag_oot[isZS] = create_errorflag(folder, "Error Flag OOT"+zsname);
00108 problem_map_oot[isZS][kMismatchedEt] = create_map(problem_folder, "Mismatched OOT Et"+zsname);
00109 problem_map_oot[isZS][kMismatchedFG] = create_map(problem_folder, "Mismatched OOT FG"+zsname);
00110 problem_map_oot[isZS][kMissingData] = create_map(problem_folder, "Missing OOT Data"+zsname);
00111 problem_map_oot[isZS][kMissingEmul] = create_map(problem_folder, "Missing OOT Emul"+zsname);
00112
00113 for (int isHF = 0; isHF <= 1; ++isHF) {
00114 std::string subdet = (isHF == 0 ? "HBHE " : "HF ");
00115 tp_corr_oot[isZS][isHF] = create_tp_correlation(folder, subdet + "OOT TP Correlation"+zsname);
00116 fg_corr_oot[isZS][isHF] = create_fg_correlation(folder, subdet + "OOT FG Correlation"+zsname);
00117
00118 problem_et_oot[isZS][isHF][kMismatchedFG]
00119 = create_et_histogram(problem_folder + "TP Values/", subdet + "OOT Mismatched FG"+zsname);
00120
00121 problem_et_oot[isZS][isHF][kMissingData]
00122 = create_et_histogram(problem_folder + "TP Values/", subdet + "OOT Missing Data"+zsname);
00123
00124 problem_et_oot[isZS][isHF][kMissingEmul]
00125 = create_et_histogram(problem_folder + "TP Values/", subdet + "OOT Missing Emul"+zsname);
00126 }
00127 }
00128
00129
00130 ProblemsVsLB = dbe_->bookProfile(
00131 "TotalBadTPs_HCAL_vs_LS",
00132 "Total Number of Bad HCAL TPs vs lumi section",
00133 NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,10000);
00134
00135 ProblemsVsLB_HB = dbe_->bookProfile(
00136 "TotalBadTPs_HB_vs_LS",
00137 "Total Number of Bad HB TPs vs lumi section",
00138 NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,3000);
00139
00140 ProblemsVsLB_HE = dbe_->bookProfile(
00141 "TotalBadTPs_HE_vs_LS",
00142 "Total Number of Bad HE TPs vs lumi section",
00143 NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,3000);
00144
00145 ProblemsVsLB_HF = dbe_->bookProfile(
00146 "TotalBadTPs_HF_vs_LS",
00147 "Total Number of Bad HF TPs vs lumi section",
00148 NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,3000);
00149
00150
00151 ProblemsVsLB_HO = dbe_->bookProfile(
00152 "TotalBadTPs_HO_vs_LS",
00153 "Total Number of Bad HO TPs vs lumi section",
00154 NLumiBlocks_,0.5,NLumiBlocks_+0.5,100,0,3000);
00155
00156 ProblemsVsLB->getTProfile()->SetMarkerStyle(20);
00157 ProblemsVsLB_HB->getTProfile()->SetMarkerStyle(20);
00158 ProblemsVsLB_HE->getTProfile()->SetMarkerStyle(20);
00159 ProblemsVsLB_HO->getTProfile()->SetMarkerStyle(20);
00160 ProblemsVsLB_HF->getTProfile()->SetMarkerStyle(20);
00161 }
00162
00163 void HcalTrigPrimMonitor::beginRun(const edm::Run& run, const edm::EventSetup& c)
00164 {
00165 HcalBaseDQMonitor::beginRun(run,c);
00166 if (mergeRuns_ && tevt_>0) return;
00167 if (tevt_==0) this->setup();
00168 if (mergeRuns_==false) this->reset();
00169 }
00170
00171 void
00172 HcalTrigPrimMonitor::analyze (edm::Event const &e, edm::EventSetup const &s) {
00173 if (!IsAllowedCalibType()) return;
00174 if (LumiInOrder(e.luminosityBlock())==false) return;
00175
00176 edm::Handle<HcalTrigPrimDigiCollection> data_tp_col;
00177 if (!e.getByLabel(dataLabel_, data_tp_col)) {
00178 edm::LogWarning("HcalTrigPrimMonitor")<< dataLabel_<< " data TP not available";
00179 return;
00180 }
00181
00182 edm::Handle<HcalTrigPrimDigiCollection> emul_tp_col;
00183 if (!e.getByLabel(emulLabel_, emul_tp_col)) {
00184 edm::LogWarning("HcalTrigPrimMonitor")<< emulLabel_<< " emul TP not available";
00185 return;
00186 }
00187
00188 HcalBaseDQMonitor::analyze(e,s);
00189 processEvent(data_tp_col, emul_tp_col);
00190 }
00191
00192
00193 void
00194 HcalTrigPrimMonitor::processEvent (
00195 const edm::Handle <HcalTrigPrimDigiCollection>& data_tp_col,
00196 const edm::Handle <HcalTrigPrimDigiCollection>& emul_tp_col) {
00197
00198 if(dbe_ == 0)
00199 return;
00200
00201 std::vector<int> errorflag_per_event[2][2];
00202 std::vector<int> errorflag_per_event_oot[2][2];
00203 for (int isZS = 0; isZS <= 1; ++isZS) {
00204 for (int isHF = 0; isHF <= 1; ++isHF) {
00205 errorflag_per_event[isZS][isHF] = std::vector<int>(kNErrorFlag, 0);
00206 errorflag_per_event_oot[isZS][isHF] = std::vector<int>(kNErrorFlag, 0);
00207 }
00208 }
00209
00210 for (int isZS = 0; isZS <= 1; ++isZS) {
00211 good_tps[isZS]->setBinContent(-1,-1,ievt_);
00212 bad_tps[isZS]->setBinContent(-1,-1,ievt_);
00213 good_tps_oot[isZS]->setBinContent(-1,-1,ievt_);
00214 bad_tps_oot[isZS]->setBinContent(-1,-1,ievt_);
00215 }
00216
00217 for (HcalTrigPrimDigiCollection::const_iterator data_tp = data_tp_col->begin();
00218 data_tp != data_tp_col->end();
00219 ++data_tp) {
00220 int ieta = data_tp->id().ieta();
00221 int iphi = data_tp->id().iphi();
00222 int isHF = data_tp->id().ietaAbs() >= 29 ? 1 : 0;
00223
00224
00225
00226 if (data_tp->SOI_compressedEt() > 0) {
00227 TPOccupancy_->Fill(ieta, iphi);
00228 TPOccupancyEta_->Fill(ieta);
00229 TPOccupancyPhi_->Fill(iphi);
00230
00231 if (isHF) {
00232 if (ieta > 0) {
00233 TPOccupancyPhiHFP_->Fill(iphi);
00234 }
00235 else {
00236 TPOccupancyPhiHFM_->Fill(iphi);
00237 }
00238 }
00239 }
00240
00241
00242 HcalTrigPrimDigiCollection::const_iterator emul_tp = emul_tp_col->find(data_tp->id());
00243 if (emul_tp == emul_tp_col->end()) {
00244 bool pass_ZS = true;
00245 bool pass_ZS_OOT = true;
00246
00247 for (int i=0; i<data_tp->size(); ++i) {
00248 if(i==2) {
00249 int dataEt(data_tp->sample(i).compressedEt());
00250 problem_et[0][isHF][kMissingEmul]->Fill(dataEt);
00251
00252 if (dataEt > ZSAlarmThreshold_[abs(ieta)]) {
00253 problem_et[1][isHF][kMissingEmul]->Fill(dataEt);
00254 pass_ZS = false;
00255 }
00256
00257 problem_map[0][kMissingEmul]->Fill(ieta, iphi);
00258 ++errorflag_per_event[0][isHF][kMissingEmul];
00259 bad_tps[0]->Fill(ieta, iphi);
00260
00261 if (!pass_ZS) {
00262 problem_map[1][kMissingEmul]->Fill(ieta, iphi);
00263 ++errorflag_per_event[1][isHF][kMissingEmul];
00264 bad_tps[1]->Fill(ieta, iphi);
00265
00266
00267 if (abs(ieta) <= 16)
00268 ++nBad_TP_per_LS_HB_;
00269 else if(abs(ieta) <= 28)
00270 ++nBad_TP_per_LS_HE_;
00271 else
00272 ++nBad_TP_per_LS_HF_;
00273 }
00274 }
00275
00276 if(i!=2) {
00277 int dataEt(data_tp->sample(i).compressedEt());
00278 problem_et_oot[0][isHF][kMissingEmul]->Fill(dataEt);
00279
00280 if (dataEt > ZSAlarmThreshold_[abs(ieta)]) {
00281 problem_et_oot[1][isHF][kMissingEmul]->Fill(dataEt);
00282 pass_ZS_OOT = false;
00283 }
00284
00285 problem_map_oot[0][kMissingEmul]->Fill(ieta, iphi);
00286 ++errorflag_per_event_oot[0][isHF][kMissingEmul];
00287 bad_tps_oot[0]->Fill(ieta, iphi);
00288
00289 if (!pass_ZS_OOT) {
00290 problem_map_oot[1][kMissingEmul]->Fill(ieta, iphi);
00291 ++errorflag_per_event_oot[1][isHF][kMissingEmul];
00292 bad_tps_oot[1]->Fill(ieta, iphi);
00293 }
00294 }
00295 }
00296 }
00297 else {
00298 bool mismatchedEt_noZS = false;
00299 bool mismatchedEt_ZS = false;
00300 bool mismatchedFG_noZS = false;
00301 bool mismatchedFG_ZS = false;
00302
00303 bool mismatchedEt_OOT_noZS = false;
00304 bool mismatchedEt_OOT_ZS = false;
00305 bool mismatchedFG_OOT_noZS = false;
00306 bool mismatchedFG_OOT_ZS = false;
00307
00308 for (int i=0; i<data_tp->size(); ++i) {
00309 int dataEt(data_tp->sample(i).compressedEt());
00310 int dataFG(data_tp->sample(i).fineGrain());
00311 int emulEt(emul_tp->sample(i).compressedEt());
00312 int emulFG(emul_tp->sample(i).fineGrain());
00313
00314 int diff = abs(dataEt - emulEt);
00315 bool fill_corr_ZS = true;
00316 bool fill_corr_OOT_ZS = true;
00317
00318 if (std::max(dataEt, emulEt) < ZSAlarmThreshold_.at(abs(ieta)))
00319 continue;
00320
00321 if (diff == 0) {
00322 if (dataFG != emulFG) {
00323 if(i==2) {
00324 mismatchedFG_noZS = true;
00325 problem_et[0][isHF][kMismatchedFG]->Fill(dataEt);
00326
00327
00328 if (isHF == 1 && dataEt <= ZSAlarmThreshold_.at(abs(ieta))) {
00329
00330 fill_corr_ZS = false;
00331 }
00332 else {
00333 mismatchedFG_ZS = true;
00334 problem_et[1][isHF][kMismatchedFG]->Fill(dataEt);
00335 }
00336 }
00337 if(i!=2){
00338 mismatchedFG_OOT_noZS = true;
00339 problem_et_oot[0][isHF][kMismatchedFG]->Fill(dataEt);
00340
00341
00342 if (isHF == 1 && dataEt <= ZSAlarmThreshold_.at(abs(ieta))) {
00343
00344 fill_corr_OOT_ZS = false;
00345 }
00346 else {
00347 mismatchedFG_OOT_ZS = true;
00348 problem_et_oot[1][isHF][kMismatchedFG]->Fill(dataEt);
00349 }
00350 }
00351 }
00352 }
00353 else {
00354 if(i==2) {
00355 mismatchedEt_noZS = true;
00356
00357 if (diff > ZSBadTPThreshold_.at(abs(ieta))) {
00358 mismatchedEt_ZS = true;
00359 fill_corr_ZS = false;
00360 }
00361 }
00362 if(i!=2) {
00363 mismatchedEt_OOT_noZS = true;
00364
00365 if (diff > ZSBadTPThreshold_.at(abs(ieta))) {
00366 mismatchedEt_OOT_ZS = true;
00367 fill_corr_OOT_ZS = false;
00368 }
00369 }
00370 }
00371
00372
00373 if(i==2) {
00374 tp_corr[0][isHF]->Fill(dataEt, emulEt);
00375 fg_corr[0][isHF]->Fill(dataFG, emulFG);
00376
00377 if (fill_corr_ZS) {
00378 tp_corr[1][isHF]->Fill(dataEt, emulEt);
00379 fg_corr[1][isHF]->Fill(dataFG, emulFG);
00380 }
00381 }
00382 if(i!=2) {
00383 tp_corr_oot[0][isHF]->Fill(dataEt, emulEt);
00384 fg_corr_oot[0][isHF]->Fill(dataFG, emulFG);
00385
00386 if (fill_corr_OOT_ZS) {
00387 tp_corr_oot[1][isHF]->Fill(dataEt, emulEt);
00388 fg_corr_oot[1][isHF]->Fill(dataFG, emulFG);
00389 }
00390 }
00391 }
00392
00393
00394 if (mismatchedEt_noZS) {
00395 problem_map[0][kMismatchedEt]->Fill(ieta, iphi);
00396 ++errorflag_per_event[0][isHF][kMismatchedEt];
00397 }
00398 if (mismatchedEt_ZS) {
00399 problem_map[1][kMismatchedEt]->Fill(ieta, iphi);
00400 ++errorflag_per_event[1][isHF][kMismatchedEt];
00401 }
00402 if (mismatchedFG_noZS) {
00403 problem_map[0][kMismatchedFG]->Fill(ieta, iphi);
00404 ++errorflag_per_event[0][isHF][kMismatchedFG];
00405 }
00406 if (mismatchedFG_ZS) {
00407 problem_map[1][kMismatchedFG]->Fill(ieta, iphi);
00408 ++errorflag_per_event[1][isHF][kMismatchedFG];
00409 }
00410 if (mismatchedEt_noZS || mismatchedFG_noZS)
00411 bad_tps[0]->Fill(ieta, iphi);
00412 else
00413 good_tps[0]->Fill(ieta, iphi);
00414 if (mismatchedEt_ZS || mismatchedFG_ZS) {
00415
00416 bad_tps[1]->Fill(ieta, iphi);
00417
00418
00419 if (abs(ieta) <= 16)
00420 ++nBad_TP_per_LS_HB_;
00421 else if(abs(ieta) <= 28)
00422 ++nBad_TP_per_LS_HE_;
00423 else
00424 ++nBad_TP_per_LS_HF_;
00425 }
00426 else
00427 good_tps[1]->Fill(ieta, iphi);
00428
00429
00430
00431 if (mismatchedEt_OOT_noZS) {
00432 problem_map_oot[0][kMismatchedEt]->Fill(ieta, iphi);
00433 ++errorflag_per_event_oot[0][isHF][kMismatchedEt];
00434 }
00435 if (mismatchedEt_OOT_ZS) {
00436 problem_map_oot[1][kMismatchedEt]->Fill(ieta, iphi);
00437 ++errorflag_per_event_oot[1][isHF][kMismatchedEt];
00438 }
00439 if (mismatchedFG_noZS) {
00440 problem_map_oot[0][kMismatchedFG]->Fill(ieta, iphi);
00441 ++errorflag_per_event_oot[0][isHF][kMismatchedFG];
00442 }
00443 if (mismatchedFG_OOT_ZS) {
00444 problem_map_oot[1][kMismatchedFG]->Fill(ieta, iphi);
00445 ++errorflag_per_event_oot[1][isHF][kMismatchedFG];
00446 }
00447 if (mismatchedEt_OOT_noZS || mismatchedFG_OOT_noZS)
00448 bad_tps_oot[0]->Fill(ieta, iphi);
00449 else
00450 good_tps_oot[0]->Fill(ieta, iphi);
00451 if (mismatchedEt_OOT_ZS || mismatchedFG_OOT_ZS) {
00452
00453 bad_tps_oot[1]->Fill(ieta, iphi);
00454 }
00455 else
00456 good_tps_oot[1]->Fill(ieta, iphi);
00457 }
00458 }
00459
00460
00461
00462 for (HcalTrigPrimDigiCollection::const_iterator emul_tp = emul_tp_col->begin();
00463 emul_tp != emul_tp_col->end();
00464 ++emul_tp) {
00465 int ieta(emul_tp->id().ieta());
00466 int iphi(emul_tp->id().iphi());
00467 int isHF = emul_tp->id().ietaAbs() >= 29 ? 1 : 0;
00468
00469 HcalTrigPrimDigiCollection::const_iterator data_tp = data_tp_col->find(emul_tp->id());
00470 if (data_tp == data_tp_col->end()) {
00471 bool pass_ZS = true;
00472 bool pass_OOT_ZS = true;
00473
00474 for (int i=0; i<emul_tp->size(); ++i) {
00475 int emulEt(emul_tp->sample(i).compressedEt());
00476 if(i==2) {
00477 problem_et[0][isHF][kMissingData]->Fill(emulEt);
00478
00479 if (emulEt > ZSAlarmThreshold_[abs(ieta)]) {
00480 problem_et[1][isHF][kMissingData]->Fill(emulEt);
00481 pass_ZS = false;
00482 }
00483
00484 problem_map[0][kMissingData]->Fill(ieta, iphi);
00485 ++errorflag_per_event[0][isHF][kMissingData];
00486 bad_tps[0]->Fill(ieta, iphi);
00487
00488 if (!pass_ZS) {
00489 problem_map[1][kMissingData]->Fill(ieta, iphi);
00490 ++errorflag_per_event[1][isHF][kMissingData];
00491 bad_tps[1]->Fill(ieta, iphi);
00492
00493
00494 if (abs(ieta) <= 16)
00495 ++nBad_TP_per_LS_HB_;
00496 else if(abs(ieta) <= 28)
00497 ++nBad_TP_per_LS_HE_;
00498 else
00499 ++nBad_TP_per_LS_HF_;
00500 }
00501 }
00502 else {
00503 problem_et_oot[0][isHF][kMissingData]->Fill(emulEt);
00504
00505 if (emulEt > ZSAlarmThreshold_[abs(ieta)]) {
00506 problem_et_oot[1][isHF][kMissingData]->Fill(emulEt);
00507 pass_OOT_ZS = false;
00508 }
00509
00510 problem_map_oot[0][kMissingData]->Fill(ieta, iphi);
00511 ++errorflag_per_event_oot[0][isHF][kMissingData];
00512 bad_tps_oot[0]->Fill(ieta, iphi);
00513
00514 if (!pass_OOT_ZS) {
00515 problem_map_oot[1][kMissingData]->Fill(ieta, iphi);
00516 ++errorflag_per_event_oot[1][isHF][kMissingData];
00517 bad_tps_oot[1]->Fill(ieta, iphi);
00518 }
00519 }
00520 }
00521 }
00522 }
00523
00524
00525 for (int isZS = 0; isZS <= 1; ++isZS) {
00526 for (int isHF = 0; isHF <= 1; ++isHF) {
00527 for (int i=0; i<kNErrorFlag; ++i) {
00528 if (errorflag_per_event[isZS][isHF][i] > 0)
00529 errorflag[isZS]->Fill(i, isHF);
00530 if (errorflag_per_event_oot[isZS][isHF][i] > 0)
00531 errorflag_oot[isZS]->Fill(i, isHF);
00532 }
00533 }
00534 }
00535 }
00536
00537 void
00538 HcalTrigPrimMonitor::cleanup() {
00539 if (!enableCleanup_) return;
00540 if (dbe_) {
00541 dbe_->setCurrentFolder(subdir_);
00542 dbe_->removeContents();
00543
00544 dbe_->setCurrentFolder(subdir_ + "noZS/Problem TPs/TP Values");
00545 dbe_->removeContents();
00546 dbe_->setCurrentFolder(subdir_ + "noZS/Problem TPs");
00547 dbe_->removeContents();
00548 dbe_->setCurrentFolder(subdir_ + "noZS");
00549
00550 dbe_->setCurrentFolder(subdir_ + "Problem TPs/TP Values");
00551 dbe_->removeContents();
00552 dbe_->setCurrentFolder(subdir_ + "Problem TPs");
00553 dbe_->removeContents();
00554
00555 dbe_->setCurrentFolder(subdir_ + "Problem OOT TPs/TP Values");
00556 dbe_->removeContents();
00557 dbe_->setCurrentFolder(subdir_ + "Problem OOT TPs");
00558 dbe_->removeContents();
00559 }
00560 }
00561
00562 void HcalTrigPrimMonitor::endJob()
00563 {
00564 if (enableCleanup_) cleanup();
00565 }
00566
00567 void HcalTrigPrimMonitor::beginLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& c) {
00568 if (LumiInOrder(lumiSeg.luminosityBlock())==false) return;
00569 HcalBaseDQMonitor::beginLuminosityBlock(lumiSeg,c);
00570 ProblemsCurrentLB->Reset();
00571
00572 nBad_TP_per_LS_HB_ = 0;
00573 nBad_TP_per_LS_HE_ = 0;
00574 nBad_TP_per_LS_HF_ = 0;
00575 }
00576
00577 void HcalTrigPrimMonitor::endLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& c) {
00578 if (LumiInOrder(lumiSeg.luminosityBlock())==false) return;
00579
00580 ProblemsVsLB_HB->Fill(currentLS, nBad_TP_per_LS_HB_);
00581 ProblemsVsLB_HE->Fill(currentLS, nBad_TP_per_LS_HE_);
00582 ProblemsVsLB_HF->Fill(currentLS, nBad_TP_per_LS_HF_);
00583 ProblemsVsLB->Fill(currentLS, nBad_TP_per_LS_HB_ + nBad_TP_per_LS_HE_ + nBad_TP_per_LS_HF_);
00584
00585 ProblemsCurrentLB->Fill(-1,-1,levt_);
00586 ProblemsCurrentLB->Fill(0,0, nBad_TP_per_LS_HB_);
00587 ProblemsCurrentLB->Fill(1,0, nBad_TP_per_LS_HE_);
00588 ProblemsCurrentLB->Fill(3,0, nBad_TP_per_LS_HF_);
00589 }
00590
00591
00592 MonitorElement*
00593 HcalTrigPrimMonitor::create_summary(const std::string& folder, const std::string& name) {
00594 edm::LogInfo("HcalTrigPrimMonitor") << "Creating MonitorElement " << name << " in folder " << folder << "\n";
00595
00596 dbe_->setCurrentFolder(folder);
00597 return dbe_->book2D(name, name, 65, -32.5, 32.5, 72, 0.5, 72.5);
00598 }
00599
00600 MonitorElement*
00601 HcalTrigPrimMonitor::create_errorflag(const std::string& folder, const std::string& name) {
00602 edm::LogInfo("HcalTrigPrimMonitor") << "Creating MonitorElement " << name << " in folder " << folder << "\n";
00603
00604 dbe_->setCurrentFolder(folder);
00605 MonitorElement* element = dbe_->book2D(name, name, 4, 1, 5, 2, 0, 2);
00606 element->setBinLabel(1, "Mismatched E");
00607 element->setBinLabel(2, "Mismatched FG");
00608 element->setBinLabel(3, "Missing Data");
00609 element->setBinLabel(4, "Missing Emul");
00610 element->setBinLabel(1, "HBHE", 2);
00611 element->setBinLabel(2, "HF", 2);
00612 return element;
00613 }
00614
00615 MonitorElement*
00616 HcalTrigPrimMonitor::create_tp_correlation(const std::string& folder, const std::string& name) {
00617 edm::LogInfo("HcalTrigPrimMonitor") << "Creating MonitorElement " << name << " in folder " << folder << "\n";
00618
00619 dbe_->setCurrentFolder(folder);
00620 MonitorElement* element = dbe_->book2D(name, name, 50, 0, 256, 50, 0, 256);
00621 element->setAxisTitle("data TP", 1);
00622 element->setAxisTitle("emul TP", 2);
00623 return element;
00624 }
00625
00626 MonitorElement*
00627 HcalTrigPrimMonitor::create_fg_correlation(const std::string& folder, const std::string& name) {
00628 edm::LogInfo("HcalTrigPrimMonitor") << "Creating MonitorElement " << name << " in folder " << folder << "\n";
00629
00630 dbe_->setCurrentFolder(folder);
00631 MonitorElement* element = dbe_->book2D(name, name, 2, 0, 2, 2, 0, 2);
00632 element->setAxisTitle("data FG", 1);
00633 element->setAxisTitle("emul FG", 2);
00634 return element;
00635 }
00636
00637 MonitorElement*
00638 HcalTrigPrimMonitor::create_map(const std::string& folder, const std::string& name) {
00639 edm::LogInfo("HcalTrigPrimMonitor") << "Creating MonitorElement " << name << " in folder " << folder << "\n";
00640
00641 dbe_->setCurrentFolder(folder);
00642 std::string title = name +";ieta;iphi";
00643 return dbe_->book2D(name, title, 65, -32.5, 32.5, 72, 0.5, 72.5);
00644 }
00645
00646 MonitorElement*
00647 HcalTrigPrimMonitor::create_et_histogram(const std::string& folder, const std::string& name) {
00648 edm::LogInfo("HcalTrigPrimMonitor") << "Creating MonitorElement " << name << " in folder " << folder << "\n";
00649
00650 dbe_->setCurrentFolder(folder);
00651 return dbe_->book1D(name, name, 256, 0, 256);
00652 }
00653
00654 DEFINE_FWK_MODULE (HcalTrigPrimMonitor);