Skip to content

Commit 037421d

Browse files
authored
Merge pull request #48978 from hjbossi/ZDCDQMUpdates_master
[DQM]: Improvements to ZDC DQM
2 parents c0df755 + 4f548cc commit 037421d

File tree

2 files changed

+109
-13
lines changed

2 files changed

+109
-13
lines changed

DQM/HcalTasks/interface/ZDCQIE10Task.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,11 @@ class ZDCQIE10Task : public hcaldqm::DQTask {
3838
// tags
3939
edm::InputTag _tagQIE10;
4040
edm::InputTag sumTag;
41+
edm::InputTag sumTagUnpacked;
4142
edm::EDGetTokenT<QIE10DigiCollection> _tokQIE10;
4243
edm::ESGetToken<HcalDbService, HcalDbRecord> hcalDbServiceToken_;
4344
edm::EDGetToken sumToken_;
45+
edm::EDGetToken sumTokenUnpacked_;
4446
edm::ESGetToken<HcalTopology, HcalRecNumberingRecord> htopoToken_;
4547
edm::ESGetToken<HcalLongRecoParams, HcalLongRecoParamsRcd> paramsToken_;
4648

@@ -61,6 +63,7 @@ class ZDCQIE10Task : public hcaldqm::DQTask {
6163
std::map<uint32_t, MonitorElement *> _cZDC_SUMS;
6264
std::map<uint32_t, MonitorElement *> _cZDC_BXSUMS;
6365
std::map<uint32_t, MonitorElement *> _cZDC_BX_EmuSUMS;
66+
std::map<uint32_t, MonitorElement *> _cZDC_EmuSumTP_DataSum;
6467
std::map<uint32_t, MonitorElement *> _cZDC_CapIDS;
6568
std::map<uint32_t, MonitorElement *> _cfC_EChannel;
6669
std::map<uint32_t, MonitorElement *> _cTDC_EChannel;

DQM/HcalTasks/plugins/ZDCQIE10Task.cc

Lines changed: 106 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,14 @@ ZDCQIE10Task::ZDCQIE10Task(edm::ParameterSet const& ps)
1111
_tagQIE10 = ps.getUntrackedParameter<edm::InputTag>("tagQIE10", edm::InputTag("hcalDigis", "ZDC"));
1212
_tokQIE10 = consumes<QIE10DigiCollection>(_tagQIE10);
1313

14+
// emulated sums
1415
sumTag = ps.getUntrackedParameter<edm::InputTag>("etSumTag", edm::InputTag("etSumZdcProducer", ""));
1516
sumToken_ = consumes<l1t::EtSumBxCollection>(sumTag);
1617

18+
// unpacked sums
19+
sumTagUnpacked = ps.getUntrackedParameter<edm::InputTag>("etSumTag", edm::InputTag("gtStage2Digis", "EtSumZDC"));
20+
sumTokenUnpacked_ = consumes<l1t::EtSumBxCollection>(sumTag);
21+
1722
htopoToken_ = esConsumes<HcalTopology, HcalRecNumberingRecord>();
1823
paramsToken_ = esConsumes<HcalLongRecoParams, HcalLongRecoParamsRcd>();
1924
}
@@ -119,6 +124,44 @@ ZDCQIE10Task::ZDCQIE10Task(edm::ParameterSet const& ps)
119124
_cZDC_BX_EmuSUMS[1]->setAxisTitle("globalBX", 1);
120125
_cZDC_BX_EmuSUMS[1]->setAxisTitle("0-255 weighted output", 2);
121126

127+
// create variable binning for TP sum histograms
128+
std::vector<double> varbins;
129+
// -1 - 64 : 65 1-unit bins
130+
// 64 - 128 : 32 2-unit bins
131+
// 128 - 256 : 32 4-unit bins
132+
// 256 - 512 : 32 8-unit bins
133+
// 512 - 1008 : 31 16-unit bins
134+
// 1008 - 1023: 1 bin
135+
// 1023 - 1024: 1 bin
136+
for (int i = -1; i < 64; i += 1)
137+
varbins.push_back(i);
138+
for (int i = 64; i < 128; i += 2)
139+
varbins.push_back(i);
140+
for (int i = 128; i < 256; i += 4)
141+
varbins.push_back(i);
142+
for (int i = 256; i < 512; i += 8)
143+
varbins.push_back(i);
144+
for (int i = 512; i <= 1008; i += 16)
145+
varbins.push_back(i);
146+
147+
// add additional bins
148+
varbins.push_back(1023);
149+
varbins.push_back(1024);
150+
151+
histoname = "ZDCM_EmuSumTP_DataSum";
152+
ib.setCurrentFolder("Hcal/ZDCQIE10Task/TPs");
153+
154+
TH2D* varBinningTH2D = new TH2D(
155+
histoname.c_str(), histoname.c_str(), varbins.size() - 1, varbins.data(), varbins.size() - 1, varbins.data());
156+
_cZDC_EmuSumTP_DataSum[0] = ib.book2DD(histoname.c_str(), varBinningTH2D);
157+
_cZDC_EmuSumTP_DataSum[0]->setAxisTitle("Emulated TP Sum (Online Counts)", 2);
158+
159+
histoname = "ZDCP_EmuSumTP_DataSum";
160+
ib.setCurrentFolder("Hcal/ZDCQIE10Task/TPs");
161+
_cZDC_EmuSumTP_DataSum[1] = ib.book2DD(histoname.c_str(), varBinningTH2D);
162+
_cZDC_EmuSumTP_DataSum[1]->setAxisTitle("Data TP Sum (Online Counts)", 1);
163+
_cZDC_EmuSumTP_DataSum[1]->setAxisTitle("Emulated TP Sum (Online Counts)", 2);
164+
122165
histoname = "CapIDs";
123166
ib.setCurrentFolder("Hcal/ZDCQIE10Task");
124167
_cZDC_CapIDS[0] = ib.book1DD(histoname.c_str(), histoname.c_str(), 4, 0, 4);
@@ -212,7 +255,8 @@ ZDCQIE10Task::ZDCQIE10Task(edm::ParameterSet const& ps)
212255
_cfC_vs_TS_EChannel[didp()]->setAxisTitle("sum fC", 2);
213256

214257
histoname = "EM_P_" + std::to_string(channel);
215-
_cTDC_EChannel[didp()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 50, 1, 50);
258+
ib.setCurrentFolder("Hcal/ZDCQIE10Task/TDC_perChannel");
259+
_cTDC_EChannel[didp()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 150, 0, 150);
216260
_cTDC_EChannel[didp()]->setAxisTitle("TDC", 1);
217261
_cTDC_EChannel[didp()]->setAxisTitle("N", 2);
218262

@@ -240,7 +284,8 @@ ZDCQIE10Task::ZDCQIE10Task(edm::ParameterSet const& ps)
240284
_cfC_vs_TS_EChannel[didm()]->setAxisTitle("sum fC", 2);
241285

242286
histoname = "EM_M_" + std::to_string(channel);
243-
_cTDC_EChannel[didm()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 50, 1, 50);
287+
ib.setCurrentFolder("Hcal/ZDCQIE10Task/TDC_perChannel");
288+
_cTDC_EChannel[didm()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 150, 0, 150);
244289
_cTDC_EChannel[didm()]->setAxisTitle("TDC", 1);
245290
_cTDC_EChannel[didm()]->setAxisTitle("N", 2);
246291
}
@@ -250,7 +295,10 @@ ZDCQIE10Task::ZDCQIE10Task(edm::ParameterSet const& ps)
250295
// EM Minus
251296
HcalZDCDetId didm(HcalZDCDetId::EM, false, channel);
252297

253-
histoname = "EM_M_" + std::to_string(channel);
298+
std::vector<std::string> stationString = {
299+
"2_M_Top", "2_M_Bottom", "3_M_BottomLeft", "3_M_BottomRight", "3_M_TopLeft", "3_M_TopRight"};
300+
301+
histoname = "FSC" + stationString.at(channel - 7);
254302
ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_perChannel");
255303
_cADC_EChannel[didm()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 256, 0, 256);
256304
_cADC_EChannel[didm()]->setAxisTitle("ADC", 1);
@@ -260,7 +308,7 @@ ZDCQIE10Task::ZDCQIE10Task(edm::ParameterSet const& ps)
260308
_cADC_vs_TS_EChannel[didm()]->setAxisTitle("TS", 1);
261309
_cADC_vs_TS_EChannel[didm()]->setAxisTitle("sum ADC", 2);
262310

263-
histoname = "EM_M_" + std::to_string(channel);
311+
histoname = "FSC" + stationString.at(channel - 7);
264312
ib.setCurrentFolder("Hcal/ZDCQIE10Task/fC_perChannel");
265313
_cfC_EChannel[didm()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 100, 0, 8000);
266314
_cfC_EChannel[didm()]->setAxisTitle("fC", 1);
@@ -270,8 +318,9 @@ ZDCQIE10Task::ZDCQIE10Task(edm::ParameterSet const& ps)
270318
_cfC_vs_TS_EChannel[didm()]->setAxisTitle("TS", 1);
271319
_cfC_vs_TS_EChannel[didm()]->setAxisTitle("sum fC", 2);
272320

273-
histoname = "EM_M_" + std::to_string(channel);
274-
_cTDC_EChannel[didm()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 50, 1, 50);
321+
histoname = "FSC" + stationString.at(channel - 7);
322+
ib.setCurrentFolder("Hcal/ZDCQIE10Task/TDC_perChannel");
323+
_cTDC_EChannel[didm()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 150, 0, 150);
275324
_cTDC_EChannel[didm()]->setAxisTitle("TDC", 1);
276325
_cTDC_EChannel[didm()]->setAxisTitle("N", 2);
277326
}
@@ -301,7 +350,8 @@ ZDCQIE10Task::ZDCQIE10Task(edm::ParameterSet const& ps)
301350
_cfC_vs_TS_EChannel[didp()]->setAxisTitle("sum fC", 2);
302351

303352
histoname = "HAD_P_" + std::to_string(channel);
304-
_cTDC_EChannel[didp()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 50, 1, 50);
353+
ib.setCurrentFolder("Hcal/ZDCQIE10Task/TDC_perChannel");
354+
_cTDC_EChannel[didp()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 150, 0, 150);
305355
_cTDC_EChannel[didp()]->setAxisTitle("TDC", 1);
306356
_cTDC_EChannel[didp()]->setAxisTitle("N", 2);
307357

@@ -329,7 +379,7 @@ ZDCQIE10Task::ZDCQIE10Task(edm::ParameterSet const& ps)
329379
_cfC_vs_TS_EChannel[didm()]->setAxisTitle("sum fC", 2);
330380

331381
histoname = "HAD_M_" + std::to_string(channel);
332-
_cTDC_EChannel[didm()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 50, 1, 50);
382+
_cTDC_EChannel[didm()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 150, 0, 150);
333383
_cTDC_EChannel[didm()]->setAxisTitle("TDC", 1);
334384
_cTDC_EChannel[didm()]->setAxisTitle("N", 2);
335385
}
@@ -359,7 +409,8 @@ ZDCQIE10Task::ZDCQIE10Task(edm::ParameterSet const& ps)
359409
_cfC_vs_TS_EChannel[didp()]->setAxisTitle("sum fC", 2);
360410

361411
histoname = "RPD_P_" + std::to_string(channel);
362-
_cTDC_EChannel[didp()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 50, 1, 50);
412+
ib.setCurrentFolder("Hcal/ZDCQIE10Task/TDC_perChannel");
413+
_cTDC_EChannel[didp()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 150, 1, 150);
363414
_cTDC_EChannel[didp()]->setAxisTitle("TDC", 1);
364415
_cTDC_EChannel[didp()]->setAxisTitle("N", 2);
365416

@@ -386,7 +437,8 @@ ZDCQIE10Task::ZDCQIE10Task(edm::ParameterSet const& ps)
386437
_cfC_vs_TS_EChannel[didm()]->setAxisTitle("sum fC", 2);
387438

388439
histoname = "RPD_M_" + std::to_string(channel);
389-
_cTDC_EChannel[didm()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 50, 1, 50);
440+
ib.setCurrentFolder("Hcal/ZDCQIE10Task/TDC_perChannel");
441+
_cTDC_EChannel[didm()] = ib.book1DD(histoname.c_str(), histoname.c_str(), 150, 1, 150);
390442
_cTDC_EChannel[didm()]->setAxisTitle("TDC", 1);
391443
_cTDC_EChannel[didm()]->setAxisTitle("N", 2);
392444
}
@@ -406,21 +458,54 @@ void ZDCQIE10Task::_process(edm::Event const& e, edm::EventSetup const& es) {
406458

407459
int startBX = sums->getFirstBX();
408460

461+
// to-do: if the TP is missing, this fills with -1
462+
double emulatedSumP = -1.0;
463+
double emulatedSumM = -1.0;
409464
for (int ibx = startBX; ibx <= sums->getLastBX(); ++ibx) {
410465
for (auto itr = sums->begin(ibx); itr != sums->end(ibx); ++itr) {
411466
l1t::EtSum::EtSumType type = itr->getType();
412467

413468
if (type == l1t::EtSum::EtSumType::kZDCP) {
414-
if (ibx == 0)
469+
if (ibx == 0) {
415470
_cZDC_BX_EmuSUMS[1]->Fill(bx, itr->hwPt());
471+
emulatedSumP = itr->hwPt();
472+
}
416473
}
417474
if (type == l1t::EtSum::EtSumType::kZDCM) {
418-
if (ibx == 0)
475+
if (ibx == 0) {
419476
_cZDC_BX_EmuSUMS[0]->Fill(bx, itr->hwPt());
477+
emulatedSumM = itr->hwPt();
478+
}
479+
}
480+
}
481+
}
482+
483+
edm::Handle<BXVector<l1t::EtSum> > unpacked_sums;
484+
e.getByToken(sumTokenUnpacked_, unpacked_sums);
485+
int startBX_Unpacked = unpacked_sums->getFirstBX();
486+
double unpackedSumP = -1.0;
487+
double unpackedSumM = -1.0;
488+
for (int ibx = startBX_Unpacked; ibx <= unpacked_sums->getLastBX(); ++ibx) {
489+
for (auto itr = unpacked_sums->begin(ibx); itr != unpacked_sums->end(ibx); ++itr) {
490+
l1t::EtSum::EtSumType type = itr->getType();
491+
492+
if (type == l1t::EtSum::EtSumType::kZDCP) {
493+
if (ibx == 0) {
494+
unpackedSumP = itr->hwPt();
495+
}
496+
}
497+
if (type == l1t::EtSum::EtSumType::kZDCM) {
498+
if (ibx == 0) {
499+
unpackedSumM = itr->hwPt();
500+
}
420501
}
421502
}
422503
}
423504

505+
// now fill the unpacked and emulator comparison histogram
506+
_cZDC_EmuSumTP_DataSum[0]->Fill(unpackedSumM, emulatedSumM);
507+
_cZDC_EmuSumTP_DataSum[1]->Fill(unpackedSumP, emulatedSumP);
508+
424509
edm::Handle<QIE10DigiCollection> digis;
425510
if (!e.getByToken(_tokQIE10, digis))
426511
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) {
488573
if (_cADC_EChannel.find(did()) != _cADC_EChannel.end()) {
489574
_cADC_EChannel[did()]->Fill(digi[i].adc());
490575
_cfC_EChannel[did()]->Fill(constants::adc2fC[digi[i].adc()]);
491-
_cTDC_EChannel[did()]->Fill(digi[i].le_tdc());
576+
// fill the tdc time the same way as in the reco
577+
float tmp_tdctime = 0;
578+
// TDC error codes will be 60=-1, 61 = -2, 62 = -3, 63 = -4
579+
// assume max amplitude should occur in TS2
580+
if (digi[i].le_tdc() >= 60)
581+
tmp_tdctime = -1 * (digi[i].le_tdc() - 59);
582+
else
583+
tmp_tdctime = 50. + (digi[i].le_tdc() / 2);
584+
_cTDC_EChannel[did()]->Fill(tmp_tdctime);
492585
}
493586
if (_cADC_vs_TS_EChannel.find(did()) != _cADC_vs_TS_EChannel.end()) {
494587
_cADC_vs_TS_EChannel[did()]->Fill(i, digi[i].adc());

0 commit comments

Comments
 (0)