diff --git a/DQM/HcalTasks/interface/ZDCQIE10Task.h b/DQM/HcalTasks/interface/ZDCQIE10Task.h index ee80cc3dcdbca..3d1326b16713c 100644 --- a/DQM/HcalTasks/interface/ZDCQIE10Task.h +++ b/DQM/HcalTasks/interface/ZDCQIE10Task.h @@ -38,9 +38,11 @@ class ZDCQIE10Task : public hcaldqm::DQTask { // tags edm::InputTag _tagQIE10; edm::InputTag sumTag; + edm::InputTag sumTagUnpacked; edm::EDGetTokenT _tokQIE10; edm::ESGetToken hcalDbServiceToken_; edm::EDGetToken sumToken_; + edm::EDGetToken sumTokenUnpacked_; edm::ESGetToken htopoToken_; edm::ESGetToken paramsToken_; @@ -61,6 +63,7 @@ class ZDCQIE10Task : public hcaldqm::DQTask { std::map _cZDC_SUMS; std::map _cZDC_BXSUMS; std::map _cZDC_BX_EmuSUMS; + std::map _cZDC_EmuSumTP_DataSum; std::map _cZDC_CapIDS; std::map _cfC_EChannel; std::map _cTDC_EChannel; diff --git a/DQM/HcalTasks/plugins/ZDCQIE10Task.cc b/DQM/HcalTasks/plugins/ZDCQIE10Task.cc index 0af1b328c1ab3..9db594dbeae6e 100644 --- a/DQM/HcalTasks/plugins/ZDCQIE10Task.cc +++ b/DQM/HcalTasks/plugins/ZDCQIE10Task.cc @@ -11,9 +11,14 @@ ZDCQIE10Task::ZDCQIE10Task(edm::ParameterSet const& ps) _tagQIE10 = ps.getUntrackedParameter("tagQIE10", edm::InputTag("hcalDigis", "ZDC")); _tokQIE10 = consumes(_tagQIE10); + // emulated sums sumTag = ps.getUntrackedParameter("etSumTag", edm::InputTag("etSumZdcProducer", "")); sumToken_ = consumes(sumTag); + // unpacked sums + sumTagUnpacked = ps.getUntrackedParameter("etSumTag", edm::InputTag("gtStage2Digis", "EtSumZDC")); + sumTokenUnpacked_ = consumes(sumTag); + htopoToken_ = esConsumes(); paramsToken_ = esConsumes(); } @@ -119,6 +124,44 @@ ZDCQIE10Task::ZDCQIE10Task(edm::ParameterSet const& ps) _cZDC_BX_EmuSUMS[1]->setAxisTitle("globalBX", 1); _cZDC_BX_EmuSUMS[1]->setAxisTitle("0-255 weighted output", 2); + // create variable binning for TP sum histograms + std::vector varbins; + // -1 - 64 : 65 1-unit bins + // 64 - 128 : 32 2-unit bins + // 128 - 256 : 32 4-unit bins + // 256 - 512 : 32 8-unit bins + // 512 - 1008 : 31 16-unit bins + // 1008 - 1023: 1 bin + // 1023 - 1024: 1 bin + for (int i = -1; i < 64; i += 1) + varbins.push_back(i); + for (int i = 64; i < 128; i += 2) + varbins.push_back(i); + for (int i = 128; i < 256; i += 4) + varbins.push_back(i); + for (int i = 256; i < 512; i += 8) + varbins.push_back(i); + for (int i = 512; i <= 1008; i += 16) + varbins.push_back(i); + + // add additional bins + varbins.push_back(1023); + varbins.push_back(1024); + + histoname = "ZDCM_EmuSumTP_DataSum"; + ib.setCurrentFolder("Hcal/ZDCQIE10Task/TPs"); + + TH2D* varBinningTH2D = new TH2D( + histoname.c_str(), histoname.c_str(), varbins.size() - 1, varbins.data(), varbins.size() - 1, varbins.data()); + _cZDC_EmuSumTP_DataSum[0] = ib.book2DD(histoname.c_str(), varBinningTH2D); + _cZDC_EmuSumTP_DataSum[0]->setAxisTitle("Emulated TP Sum (Online Counts)", 2); + + histoname = "ZDCP_EmuSumTP_DataSum"; + ib.setCurrentFolder("Hcal/ZDCQIE10Task/TPs"); + _cZDC_EmuSumTP_DataSum[1] = ib.book2DD(histoname.c_str(), varBinningTH2D); + _cZDC_EmuSumTP_DataSum[1]->setAxisTitle("Data TP Sum (Online Counts)", 1); + _cZDC_EmuSumTP_DataSum[1]->setAxisTitle("Emulated TP Sum (Online Counts)", 2); + histoname = "CapIDs"; ib.setCurrentFolder("Hcal/ZDCQIE10Task"); _cZDC_CapIDS[0] = ib.book1DD(histoname.c_str(), histoname.c_str(), 4, 0, 4); @@ -212,7 +255,8 @@ ZDCQIE10Task::ZDCQIE10Task(edm::ParameterSet const& ps) _cfC_vs_TS_EChannel[didp()]->setAxisTitle("sum fC", 2); histoname = "EM_P_" + std::to_string(channel); - _cTDC_EChannel[didp()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 50, 1, 50); + ib.setCurrentFolder("Hcal/ZDCQIE10Task/TDC_perChannel"); + _cTDC_EChannel[didp()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 150, 0, 150); _cTDC_EChannel[didp()]->setAxisTitle("TDC", 1); _cTDC_EChannel[didp()]->setAxisTitle("N", 2); @@ -240,7 +284,8 @@ ZDCQIE10Task::ZDCQIE10Task(edm::ParameterSet const& ps) _cfC_vs_TS_EChannel[didm()]->setAxisTitle("sum fC", 2); histoname = "EM_M_" + std::to_string(channel); - _cTDC_EChannel[didm()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 50, 1, 50); + ib.setCurrentFolder("Hcal/ZDCQIE10Task/TDC_perChannel"); + _cTDC_EChannel[didm()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 150, 0, 150); _cTDC_EChannel[didm()]->setAxisTitle("TDC", 1); _cTDC_EChannel[didm()]->setAxisTitle("N", 2); } @@ -250,7 +295,10 @@ ZDCQIE10Task::ZDCQIE10Task(edm::ParameterSet const& ps) // EM Minus HcalZDCDetId didm(HcalZDCDetId::EM, false, channel); - histoname = "EM_M_" + std::to_string(channel); + std::vector stationString = { + "2_M_Top", "2_M_Bottom", "3_M_BottomLeft", "3_M_BottomRight", "3_M_TopLeft", "3_M_TopRight"}; + + histoname = "FSC" + stationString.at(channel - 7); ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_perChannel"); _cADC_EChannel[didm()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 256, 0, 256); _cADC_EChannel[didm()]->setAxisTitle("ADC", 1); @@ -260,7 +308,7 @@ ZDCQIE10Task::ZDCQIE10Task(edm::ParameterSet const& ps) _cADC_vs_TS_EChannel[didm()]->setAxisTitle("TS", 1); _cADC_vs_TS_EChannel[didm()]->setAxisTitle("sum ADC", 2); - histoname = "EM_M_" + std::to_string(channel); + histoname = "FSC" + stationString.at(channel - 7); ib.setCurrentFolder("Hcal/ZDCQIE10Task/fC_perChannel"); _cfC_EChannel[didm()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 100, 0, 8000); _cfC_EChannel[didm()]->setAxisTitle("fC", 1); @@ -270,8 +318,9 @@ ZDCQIE10Task::ZDCQIE10Task(edm::ParameterSet const& ps) _cfC_vs_TS_EChannel[didm()]->setAxisTitle("TS", 1); _cfC_vs_TS_EChannel[didm()]->setAxisTitle("sum fC", 2); - histoname = "EM_M_" + std::to_string(channel); - _cTDC_EChannel[didm()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 50, 1, 50); + histoname = "FSC" + stationString.at(channel - 7); + ib.setCurrentFolder("Hcal/ZDCQIE10Task/TDC_perChannel"); + _cTDC_EChannel[didm()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 150, 0, 150); _cTDC_EChannel[didm()]->setAxisTitle("TDC", 1); _cTDC_EChannel[didm()]->setAxisTitle("N", 2); } @@ -301,7 +350,8 @@ ZDCQIE10Task::ZDCQIE10Task(edm::ParameterSet const& ps) _cfC_vs_TS_EChannel[didp()]->setAxisTitle("sum fC", 2); histoname = "HAD_P_" + std::to_string(channel); - _cTDC_EChannel[didp()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 50, 1, 50); + ib.setCurrentFolder("Hcal/ZDCQIE10Task/TDC_perChannel"); + _cTDC_EChannel[didp()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 150, 0, 150); _cTDC_EChannel[didp()]->setAxisTitle("TDC", 1); _cTDC_EChannel[didp()]->setAxisTitle("N", 2); @@ -329,7 +379,7 @@ ZDCQIE10Task::ZDCQIE10Task(edm::ParameterSet const& ps) _cfC_vs_TS_EChannel[didm()]->setAxisTitle("sum fC", 2); histoname = "HAD_M_" + std::to_string(channel); - _cTDC_EChannel[didm()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 50, 1, 50); + _cTDC_EChannel[didm()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 150, 0, 150); _cTDC_EChannel[didm()]->setAxisTitle("TDC", 1); _cTDC_EChannel[didm()]->setAxisTitle("N", 2); } @@ -359,7 +409,8 @@ ZDCQIE10Task::ZDCQIE10Task(edm::ParameterSet const& ps) _cfC_vs_TS_EChannel[didp()]->setAxisTitle("sum fC", 2); histoname = "RPD_P_" + std::to_string(channel); - _cTDC_EChannel[didp()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 50, 1, 50); + ib.setCurrentFolder("Hcal/ZDCQIE10Task/TDC_perChannel"); + _cTDC_EChannel[didp()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 150, 1, 150); _cTDC_EChannel[didp()]->setAxisTitle("TDC", 1); _cTDC_EChannel[didp()]->setAxisTitle("N", 2); @@ -386,7 +437,8 @@ ZDCQIE10Task::ZDCQIE10Task(edm::ParameterSet const& ps) _cfC_vs_TS_EChannel[didm()]->setAxisTitle("sum fC", 2); histoname = "RPD_M_" + std::to_string(channel); - _cTDC_EChannel[didm()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 50, 1, 50); + ib.setCurrentFolder("Hcal/ZDCQIE10Task/TDC_perChannel"); + _cTDC_EChannel[didm()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 150, 1, 150); _cTDC_EChannel[didm()]->setAxisTitle("TDC", 1); _cTDC_EChannel[didm()]->setAxisTitle("N", 2); } @@ -406,21 +458,54 @@ void ZDCQIE10Task::_process(edm::Event const& e, edm::EventSetup const& es) { int startBX = sums->getFirstBX(); + // to-do: if the TP is missing, this fills with -1 + double emulatedSumP = -1.0; + double emulatedSumM = -1.0; for (int ibx = startBX; ibx <= sums->getLastBX(); ++ibx) { for (auto itr = sums->begin(ibx); itr != sums->end(ibx); ++itr) { l1t::EtSum::EtSumType type = itr->getType(); if (type == l1t::EtSum::EtSumType::kZDCP) { - if (ibx == 0) + if (ibx == 0) { _cZDC_BX_EmuSUMS[1]->Fill(bx, itr->hwPt()); + emulatedSumP = itr->hwPt(); + } } if (type == l1t::EtSum::EtSumType::kZDCM) { - if (ibx == 0) + if (ibx == 0) { _cZDC_BX_EmuSUMS[0]->Fill(bx, itr->hwPt()); + emulatedSumM = itr->hwPt(); + } + } + } + } + + edm::Handle > unpacked_sums; + e.getByToken(sumTokenUnpacked_, unpacked_sums); + int startBX_Unpacked = unpacked_sums->getFirstBX(); + double unpackedSumP = -1.0; + double unpackedSumM = -1.0; + for (int ibx = startBX_Unpacked; ibx <= unpacked_sums->getLastBX(); ++ibx) { + for (auto itr = unpacked_sums->begin(ibx); itr != unpacked_sums->end(ibx); ++itr) { + l1t::EtSum::EtSumType type = itr->getType(); + + if (type == l1t::EtSum::EtSumType::kZDCP) { + if (ibx == 0) { + unpackedSumP = itr->hwPt(); + } + } + if (type == l1t::EtSum::EtSumType::kZDCM) { + if (ibx == 0) { + unpackedSumM = itr->hwPt(); + } } } } + // now fill the unpacked and emulator comparison histogram + _cZDC_EmuSumTP_DataSum[0]->Fill(unpackedSumM, emulatedSumM); + _cZDC_EmuSumTP_DataSum[1]->Fill(unpackedSumP, emulatedSumP); + edm::Handle digis; if (!e.getByToken(_tokQIE10, digis)) edm::LogError("Collection QIE10DigiCollection for ZDC isn't available" + _tagQIE10.label() + " " + @@ -488,7 +573,15 @@ void ZDCQIE10Task::_process(edm::Event const& e, edm::EventSetup const& es) { if (_cADC_EChannel.find(did()) != _cADC_EChannel.end()) { _cADC_EChannel[did()]->Fill(digi[i].adc()); _cfC_EChannel[did()]->Fill(constants::adc2fC[digi[i].adc()]); - _cTDC_EChannel[did()]->Fill(digi[i].le_tdc()); + // fill the tdc time the same way as in the reco + float tmp_tdctime = 0; + // TDC error codes will be 60=-1, 61 = -2, 62 = -3, 63 = -4 + // assume max amplitude should occur in TS2 + if (digi[i].le_tdc() >= 60) + tmp_tdctime = -1 * (digi[i].le_tdc() - 59); + else + tmp_tdctime = 50. + (digi[i].le_tdc() / 2); + _cTDC_EChannel[did()]->Fill(tmp_tdctime); } if (_cADC_vs_TS_EChannel.find(did()) != _cADC_vs_TS_EChannel.end()) { _cADC_vs_TS_EChannel[did()]->Fill(i, digi[i].adc());