@@ -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,31 @@ 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 - 100 : 101 1-unit bins
130+ // 100 - 700 :100 6-unit bins
131+ // 700 - 1024 : 18 18-unit bins
132+ for (int i = -1 ; i < 100 ; i += 1 )
133+ varbins.push_back (i);
134+ for (int i = 100 ; i < 700 ; i += 6 )
135+ varbins.push_back (i);
136+ for (int i = 700 ; i < 1024 ; i += 18 )
137+ varbins.push_back (i);
138+ TH2D* varBinningTH2D = new TH2D (
139+ histoname.c_str (), histoname.c_str (), varbins.size () - 1 , varbins.data (), varbins.size () - 1 , varbins.data ());
140+ _cZDC_EmuSumTP_DataSum[0 ] = ib.book2DD (histoname.c_str (), varBinningTH2D);
141+
142+ histoname = " ZDCM_EmuSumTP_DataSum" ;
143+ ib.setCurrentFolder (" Hcal/ZDCQIE10Task/Sums" );
144+ _cZDC_EmuSumTP_DataSum[0 ]->setAxisTitle (" Emulated TP Sum (Online Counts)" , 2 );
145+
146+ histoname = " ZDCP_EmuSumTP_DataSum" ;
147+ ib.setCurrentFolder (" Hcal/ZDCQIE10Task/Sums" );
148+ _cZDC_EmuSumTP_DataSum[1 ] = ib.book2DD (histoname.c_str (), varBinningTH2D);
149+ _cZDC_EmuSumTP_DataSum[1 ]->setAxisTitle (" Data TP Sum (Online Counts)" , 1 );
150+ _cZDC_EmuSumTP_DataSum[1 ]->setAxisTitle (" Emulated TP Sum (Online Counts)" , 2 );
151+
122152 histoname = " CapIDs" ;
123153 ib.setCurrentFolder (" Hcal/ZDCQIE10Task" );
124154 _cZDC_CapIDS[0 ] = ib.book1DD (histoname.c_str (), histoname.c_str (), 4 , 0 , 4 );
@@ -252,12 +282,8 @@ ZDCQIE10Task::ZDCQIE10Task(edm::ParameterSet const& ps)
252282 // EM Minus
253283 HcalZDCDetId didm (HcalZDCDetId::EM, false , channel);
254284
255- std::vector<std::string> stationString = {" 2_M_Top" ,
256- " 2_M_Bottom" ,
257- " 3_M_BottomLeft" ,
258- " 3_M_BottomRight" ,
259- " 3_M_TopLeft" ,
260- " 3_M_TopRight" };
285+ std::vector<std::string> stationString = {
286+ " 2_M_Top" , " 2_M_Bottom" , " 3_M_BottomLeft" , " 3_M_BottomRight" , " 3_M_TopLeft" , " 3_M_TopRight" };
261287
262288 histoname = " FSC" + stationString.at (channel - 7 );
263289 ib.setCurrentFolder (" Hcal/ZDCQIE10Task/ADC_perChannel" );
@@ -419,21 +445,54 @@ void ZDCQIE10Task::_process(edm::Event const& e, edm::EventSetup const& es) {
419445
420446 int startBX = sums->getFirstBX ();
421447
448+ // to-do: if the TP is missing, this fills with -1
449+ double emulatedSumP = -1.0 ;
450+ double emulatedSumM = -1.0 ;
422451 for (int ibx = startBX; ibx <= sums->getLastBX (); ++ibx) {
423452 for (auto itr = sums->begin (ibx); itr != sums->end (ibx); ++itr) {
424453 l1t::EtSum::EtSumType type = itr->getType ();
425454
426455 if (type == l1t::EtSum::EtSumType::kZDCP ) {
427- if (ibx == 0 )
456+ if (ibx == 0 ) {
428457 _cZDC_BX_EmuSUMS[1 ]->Fill (bx, itr->hwPt ());
458+ emulatedSumP = itr->hwPt ();
459+ }
429460 }
430461 if (type == l1t::EtSum::EtSumType::kZDCM ) {
431- if (ibx == 0 )
462+ if (ibx == 0 ) {
432463 _cZDC_BX_EmuSUMS[0 ]->Fill (bx, itr->hwPt ());
464+ emulatedSumM = itr->hwPt ();
465+ }
433466 }
434467 }
435468 }
436469
470+ edm::Handle<BXVector<l1t::EtSum> > unpacked_sums;
471+ e.getByToken (sumTokenUnpacked_, unpacked_sums);
472+ int startBX_Unpacked = unpacked_sums->getFirstBX ();
473+ double unpackedSumP = -1.0 ;
474+ double unpackedSumM = -1.0 ;
475+ for (int ibx = startBX_Unpacked; ibx <= unpacked_sums->getLastBX (); ++ibx) {
476+ for (auto itr = unpacked_sums->begin (ibx); itr != unpacked_sums->end (ibx); ++itr) {
477+ l1t::EtSum::EtSumType type = itr->getType ();
478+
479+ if (type == l1t::EtSum::EtSumType::kZDCP ) {
480+ if (ibx == 0 ) {
481+ unpackedSumP = itr->hwPt ();
482+ }
483+ }
484+ if (type == l1t::EtSum::EtSumType::kZDCM ) {
485+ if (ibx == 0 ) {
486+ unpackedSumM = itr->hwPt ();
487+ }
488+ }
489+ }
490+ }
491+
492+ // now fill the unpacked and emulator comparison histogram
493+ _cZDC_EmuSumTP_DataSum[0 ]->Fill (unpackedSumM, emulatedSumM);
494+ _cZDC_EmuSumTP_DataSum[1 ]->Fill (unpackedSumP, emulatedSumP);
495+
437496 edm::Handle<QIE10DigiCollection> digis;
438497 if (!e.getByToken (_tokQIE10, digis))
439498 edm::LogError (" Collection QIE10DigiCollection for ZDC isn't available" + _tagQIE10.label () + " " +
0 commit comments