9 "COMPARE_COLLS", std::vector<unsigned int>(0,
DEnsys));
11 if ((
int)dosys.size() !=
DEnsys)
12 edm::LogError(
"L1Comparator") <<
"wrong selection of systems to be compared\n"
13 <<
"\t the size of the mask COPARE_COLLS (" << dosys.size() <<
") is not " <<
DEnsys
17 for (
int isys = 0; isys <
DEnsys; isys++)
18 if (dosys[isys] != 0 && dosys[isys] != 1)
19 throw cms::Exception(
"Invalid configuration") <<
"L1Comparator: comparison flag for system " << isys
20 <<
" is non boolean: " << dosys[isys] <<
". Exiting.\n";
22 std::array<bool, dedefs::DEnsys>
ret;
30 : m_stage1_layer2_{iConfig.
getParameter<
bool>(
"stage1_layer2_")},
32 m_doSys{fillDoSys(iConfig)},
37 std::cout <<
"\nL1COMPARATOR constructor...\n" << std::flush;
45 std::cout <<
"[L1Comparator] list of systems to process: ";
69 if (!m_dumpFile.good())
71 <<
" L1Comparator::L1Comparator() : "
72 <<
" couldn't open dump file " << m_dumpFileName.c_str() << std::endl;
79 produces<L1DataEmulRecord>().setBranchAlias(
"L1DataEmulRecord");
86 tokenCaloEm_[0] = consumes<L1CaloEmCollection>(tag0);
87 tokenCaloEm_[1] = consumes<L1CaloEmCollection>(tag1);
88 tokenCaloRegion_[0] = consumes<L1CaloRegionCollection>(tag0);
89 tokenCaloRegion_[1] = consumes<L1CaloRegionCollection>(tag1);
98 if (m_stage1_layer2_ ==
false) {
99 for (
int i = 0;
i < 2; ++
i) {
103 tokenGctEmCand_nonIsoEm_[
i] = consumes<L1GctEmCandCollection>(
edm::InputTag(
label,
"nonIsoEm"));
104 tokenGctJetCand_cenJets_[
i] = consumes<L1GctJetCandCollection>(
edm::InputTag(
label,
"cenJets"));
105 tokenGctJetCand_forJets_[
i] = consumes<L1GctJetCandCollection>(
edm::InputTag(
label,
"forJets"));
106 tokenGctJetCand_tauJets_[
i] = consumes<L1GctJetCandCollection>(
edm::InputTag(
label,
"tauJets"));
107 tokenGctEtTotal_[
i] = consumes<L1GctEtTotalCollection>(
tag);
108 tokenGctEtHad_[
i] = consumes<L1GctEtHadCollection>(
tag);
109 tokenGctEtMiss_[
i] = consumes<L1GctEtMissCollection>(
tag);
110 tokenGctHFRingEtSums_[
i] = consumes<L1GctHFRingEtSumsCollection>(
tag);
111 tokenGctHFBitCounts_[
i] = consumes<L1GctHFBitCountsCollection>(
tag);
112 tokenGctHtMiss_[
i] = consumes<L1GctHtMissCollection>(
tag);
113 tokenGctJetCounts_[
i] = consumes<L1GctJetCountsCollection>(
tag);
116 if (m_stage1_layer2_ ==
true) {
117 for (
int i = 0;
i < 2; ++
i) {
121 tokenGctEmCand_nonIsoEm_[
i] = consumes<L1GctEmCandCollection>(
edm::InputTag(
label,
"nonIsoEm"));
122 tokenGctJetCand_cenJets_[
i] = consumes<L1GctJetCandCollection>(
edm::InputTag(
label,
"cenJets"));
123 tokenGctJetCand_forJets_[
i] = consumes<L1GctJetCandCollection>(
edm::InputTag(
label,
"forJets"));
124 tokenGctJetCand_tauJets_[
i] = consumes<L1GctJetCandCollection>(
edm::InputTag(
label,
"tauJets"));
125 tokenGctJetCand_isoTauJets_[
i] = consumes<L1GctJetCandCollection>(
edm::InputTag(
label,
"isoTauJets"));
126 tokenGctEtTotal_[
i] = consumes<L1GctEtTotalCollection>(
tag);
127 tokenGctEtHad_[
i] = consumes<L1GctEtHadCollection>(
tag);
128 tokenGctEtMiss_[
i] = consumes<L1GctEtMissCollection>(
tag);
129 tokenGctHFRingEtSums_[
i] = consumes<L1GctHFRingEtSumsCollection>(
tag);
130 tokenGctHFBitCounts_[
i] = consumes<L1GctHFBitCountsCollection>(
tag);
131 tokenGctHtMiss_[
i] = consumes<L1GctHtMissCollection>(
tag);
132 tokenGctJetCounts_[
i] = consumes<L1GctJetCountsCollection>(
tag);
142 tokenMuDTChambPh_[0] = consumes<L1MuDTChambPhContainer>(tag0);
143 tokenMuDTChambPh_[1] = consumes<L1MuDTChambPhContainer>(tag1);
144 tokenMuDTChambTh_[0] = consumes<L1MuDTChambThContainer>(tag0);
145 tokenMuDTChambTh_[1] = consumes<L1MuDTChambThContainer>(tag1);
153 tokenMuDTTrack_[0] = consumes<L1MuDTTrackContainer>(
edm::InputTag(tag0.
label(),
"DATA"));
154 tokenMuDTTrack_[1] = consumes<L1MuDTTrackContainer>(
edm::InputTag(tag1.label(),
"DTTF"));
162 tokenMuRegionalCandRPCb_[0] = consumes<L1MuRegionalCandCollection>(
edm::InputTag(tag0.
label(),
"RPCb"));
163 tokenMuRegionalCandRPCb_[1] = consumes<L1MuRegionalCandCollection>(
edm::InputTag(tag1.label(),
"RPCb"));
164 tokenMuRegionalCandRPCf_[0] = consumes<L1MuRegionalCandCollection>(
edm::InputTag(tag0.
label(),
"RPCf"));
165 tokenMuRegionalCandRPCf_[1] = consumes<L1MuRegionalCandCollection>(
edm::InputTag(tag1.label(),
"RPCf"));
173 tokenLTCDigi_[0] = consumes<LTCDigiCollection>(dummyTag);
174 tokenLTCDigi_[1] = consumes<LTCDigiCollection>(dummyTag);
182 tokenMuGMTCand_[0] = consumes<L1MuGMTCandCollection>(tag0);
183 tokenMuGMTCand_[1] = consumes<L1MuGMTCandCollection>(tag1);
184 tokenMuReadoutCand_[0] = consumes<L1MuGMTReadoutCollection>(tag0);
185 tokenMuReadoutCand_[1] = consumes<L1MuGMTReadoutCollection>(tag1);
189 std::cout <<
"\nL1Comparator constructor...done.\n" << std::flush;
195 std::cout <<
"\nL1COMPARATOR beginRun...\n" << std::flush;
197 auto runDoSys = std::make_shared<RunCache>();
214 std::cout <<
"RCT key is empty. Sub-systems is disabled (" << (*runDoSys)[
RCT] <<
")\n";
216 std::cout <<
"GCT key is empty. Sub-systems is disabled (" << (*runDoSys)[
GCT] <<
")\n";
218 std::cout <<
"DTTF key is empty. Sub-systems is disabled (" << (*runDoSys)[
DTF] <<
")\n";
220 std::cout <<
"CSCTF key is empty. Sub-systems is disabled (" << (*runDoSys)[
CTF] <<
")\n";
222 std::cout <<
"RPC key is empty. Sub-systems is disabled (" << (*runDoSys)[
RPC] <<
")\n";
224 std::cout <<
"GMT key is empty. Sub-systems is disabled (" << (*runDoSys)[
GMT] <<
")\n";
226 std::cout <<
"GT key is empty. Sub-systems is disabled (" << (*runDoSys)[
GLT] <<
")\n";
233 edm::LogWarning(
"L1Comparator") <<
"No L1TriggerKey found." << std::endl;
237 std::cout <<
"L1COMPARATOR beginRun... done\n" << std::flush;
244 <<
"Global data|emulator agreement: " <<
m_match << std::endl;
256 <<
" | run:" <<
eventInfo.runNum_ <<
"\n"
267 auto& runDoSys = *runCache(
runIndex);
397 typedef std::vector<L1MuDTTrackCand> L1MuDTTrackCandCollection;
399 dtf_trk_data_v.clear();
400 dtf_trk_emul_v.clear();
402 L1MuDTTrackCandCollection
const* dttc = dtf_trk_data_->
getContainer();
403 for (L1MuDTTrackCandCollection::const_iterator it = dttc->begin(); it != dttc->end(); it++)
407 L1MuDTTrackCandCollection
const* dttc = dtf_trk_emul_->
getContainer();
408 for (L1MuDTTrackCandCollection::const_iterator it = dttc->begin(); it != dttc->end(); it++)
411 dtf_trk_data = &dtf_trk_data_v;
412 dtf_trk_emul = &dtf_trk_emul_v;
452 gmt_can_data_vec.clear();
453 gmt_can_emul_vec.clear();
454 gmt_rdt_data_vec.clear();
455 gmt_rdt_emul_vec.clear();
457 typedef std::vector<L1MuGMTReadoutRecord>::const_iterator GmtRrIt;
459 std::vector<L1MuGMTReadoutRecord> gmt_rdt_data_bx = gmt_rdt_data_->
getRecords();
460 for (GmtRrIt igmtrr = gmt_rdt_data_bx.begin(); igmtrr != gmt_rdt_data_bx.end(); igmtrr++) {
462 typedef std::vector<L1MuGMTExtendedCand>::const_iterator GmtECIt;
463 std::vector<L1MuGMTExtendedCand> gmc;
464 gmc = igmtrr->getGMTCands();
465 for (GmtECIt iter1 = gmc.begin(); iter1 != gmc.end(); iter1++) {
467 cand.setPhiValue(iter1->phiValue());
468 cand.setEtaValue(iter1->etaValue());
469 cand.setPtValue(iter1->ptValue());
470 gmt_can_data_vec.push_back(
cand);
473 typedef L1MuRegionalCandCollection::const_iterator GmtRCIt;
476 rmc = igmtrr->getDTBXCands();
477 gmt_rdt_data_vec.insert(gmt_rdt_data_vec.end(), rmc.begin(), rmc.end());
479 rmc = igmtrr->getCSCCands();
480 gmt_rdt_data_vec.insert(gmt_rdt_data_vec.end(), rmc.begin(), rmc.end());
482 rmc = igmtrr->getBrlRPCCands();
483 gmt_rdt_data_vec.insert(gmt_rdt_data_vec.end(), rmc.begin(), rmc.end());
485 rmc = igmtrr->getFwdRPCCands();
486 gmt_rdt_data_vec.insert(gmt_rdt_data_vec.end(), rmc.begin(), rmc.end());
489 std::vector<L1MuGMTReadoutRecord> gmt_rdt_emul_bx = gmt_rdt_emul_->
getRecords();
490 for (GmtRrIt igmtrr = gmt_rdt_emul_bx.begin(); igmtrr != gmt_rdt_emul_bx.end(); igmtrr++) {
492 typedef std::vector<L1MuGMTExtendedCand>::const_iterator GmtECIt;
493 std::vector<L1MuGMTExtendedCand> gmc;
494 gmc = igmtrr->getGMTCands();
495 for (GmtECIt iter1 = gmc.begin(); iter1 != gmc.end(); iter1++) {
496 gmt_can_emul_vec.push_back(
L1MuGMTCand(iter1->getDataWord(), iter1->bx()));
499 typedef L1MuRegionalCandCollection::const_iterator GmtRCIt;
502 rmc = igmtrr->getDTBXCands();
503 gmt_rdt_emul_vec.insert(gmt_rdt_emul_vec.end(), rmc.begin(), rmc.end());
505 rmc = igmtrr->getCSCCands();
506 gmt_rdt_emul_vec.insert(gmt_rdt_emul_vec.end(), rmc.begin(), rmc.end());
508 rmc = igmtrr->getBrlRPCCands();
509 gmt_rdt_emul_vec.insert(gmt_rdt_emul_vec.end(), rmc.begin(), rmc.end());
511 rmc = igmtrr->getFwdRPCCands();
512 gmt_rdt_emul_vec.insert(gmt_rdt_emul_vec.end(), rmc.begin(), rmc.end());
515 gmt_rdt_data = &gmt_rdt_data_vec;
516 gmt_rdt_emul = &gmt_rdt_emul_vec;
517 gmt_can_data = &gmt_can_data_vec;
518 gmt_can_emul = &gmt_can_emul_vec;
523 bool isValidDE[
DEnsys][2];
525 for (
int j = 0;
j < 2;
j++)
526 isValidDE[
i][
j] =
false;
534 isValidDE[
GCT][0] = gct_isolaem_data.
isValid();
535 isValidDE[
GCT][1] = gct_isolaem_emul.
isValid();
536 isValidDE[
GCT][0] &= gct_noisoem_data.
isValid();
537 isValidDE[
GCT][1] &= gct_noisoem_emul.
isValid();
538 isValidDE[
GCT][0] &= gct_cenjets_data.
isValid();
539 isValidDE[
GCT][1] &= gct_cenjets_emul.
isValid();
540 isValidDE[
GCT][0] &= gct_forjets_data.
isValid();
541 isValidDE[
GCT][1] &= gct_forjets_emul.
isValid();
542 isValidDE[
GCT][0] &= gct_taujets_data.
isValid();
543 isValidDE[
GCT][1] &= gct_taujets_emul.
isValid();
544 isValidDE[
GCT][0] &= gct_etmiss_data.
isValid();
545 isValidDE[
GCT][1] &= gct_etmiss_emul.
isValid();
546 isValidDE[
GCT][0] &= gct_ettota_data.
isValid();
547 isValidDE[
GCT][1] &= gct_ettota_emul.
isValid();
548 isValidDE[
GCT][0] &= gct_htmiss_data.
isValid();
549 isValidDE[
GCT][1] &= gct_htmiss_emul.
isValid();
550 isValidDE[
GCT][0] &= gct_hfring_data.
isValid();
551 isValidDE[
GCT][1] &= gct_hfring_emul.
isValid();
552 isValidDE[
GCT][0] &= gct_hfbcnt_data.
isValid();
553 isValidDE[
GCT][1] &= gct_hfbcnt_emul.
isValid();
557 isValidDE[
GCT][0] = gct_isolaem_data.
isValid();
558 isValidDE[
GCT][1] = gct_isolaem_emul.
isValid();
559 isValidDE[
GCT][0] &= gct_noisoem_data.
isValid();
560 isValidDE[
GCT][1] &= gct_noisoem_emul.
isValid();
561 isValidDE[
GCT][0] &= gct_cenjets_data.
isValid();
562 isValidDE[
GCT][1] &= gct_cenjets_emul.
isValid();
563 isValidDE[
GCT][0] &= gct_forjets_data.
isValid();
564 isValidDE[
GCT][1] &= gct_forjets_emul.
isValid();
565 isValidDE[
GCT][0] &= gct_taujets_data.
isValid();
566 isValidDE[
GCT][1] &= gct_taujets_emul.
isValid();
567 isValidDE[
GCT][0] &= gct_isotaujets_data.
isValid();
568 isValidDE[
GCT][1] &= gct_isotaujets_emul.
isValid();
569 isValidDE[
GCT][0] &= gct_etmiss_data.
isValid();
570 isValidDE[
GCT][1] &= gct_etmiss_emul.
isValid();
571 isValidDE[
GCT][0] &= gct_ettota_data.
isValid();
572 isValidDE[
GCT][1] &= gct_ettota_emul.
isValid();
573 isValidDE[
GCT][0] &= gct_htmiss_data.
isValid();
574 isValidDE[
GCT][1] &= gct_htmiss_emul.
isValid();
575 isValidDE[
GCT][0] &= gct_hfring_data.
isValid();
576 isValidDE[
GCT][1] &= gct_hfring_emul.
isValid();
577 isValidDE[
GCT][0] &= gct_hfbcnt_data.
isValid();
578 isValidDE[
GCT][1] &= gct_hfbcnt_emul.
isValid();
603 for (
int j = 0;
j < 2;
j++) {
604 isValid[
i] &= isValidDE[
i][
j];
626 std::cout <<
"L1Comparator start processing the collections.\n" << std::flush;
629 if (runDoSys[
RCT] && isValid[
RCT])
631 if (runDoSys[
RCT] && isValid[
RCT])
635 if (runDoSys[
GCT] && isValid[
GCT])
637 if (runDoSys[
GCT] && isValid[
GCT])
639 if (runDoSys[
GCT] && isValid[
GCT])
641 if (runDoSys[
GCT] && isValid[
GCT])
643 if (runDoSys[
GCT] && isValid[
GCT])
645 if (runDoSys[
GCT] && isValid[
GCT])
647 if (runDoSys[
GCT] && isValid[
GCT])
649 if (runDoSys[
GCT] && isValid[
GCT])
651 if (runDoSys[
GCT] && isValid[
GCT])
653 if (runDoSys[
GCT] && isValid[
GCT])
655 if (runDoSys[
GCT] && isValid[
GCT])
656 process<L1GctHFBitCountsCollection>(gct_hfbcnt_data, gct_hfbcnt_emul,
GCT,
GCThfbit,
eventInfo);
660 if (runDoSys[
GCT] && isValid[
GCT])
662 if (runDoSys[
GCT] && isValid[
GCT])
664 if (runDoSys[
GCT] && isValid[
GCT])
666 if (runDoSys[
GCT] && isValid[
GCT])
668 if (runDoSys[
GCT] && isValid[
GCT])
670 if (runDoSys[
GCT] && isValid[
GCT])
672 if (runDoSys[
GCT] && isValid[
GCT])
674 if (runDoSys[
GCT] && isValid[
GCT])
676 if (runDoSys[
GCT] && isValid[
GCT])
678 if (runDoSys[
GCT] && isValid[
GCT])
680 if (runDoSys[
GCT] && isValid[
GCT])
682 if (runDoSys[
GCT] && isValid[
GCT])
683 process<L1GctHFBitCountsCollection>(gct_hfbcnt_data, gct_hfbcnt_emul,
GCT,
GCThfbit,
eventInfo);
687 if (runDoSys[
DTP] && isValid[
DTP])
688 process<L1MuDTChambPhDigiCollection>(dtp_ph_data, dtp_ph_emul,
DTP,
DTtpPh,
eventInfo);
689 if (runDoSys[
DTP] && isValid[
DTP])
690 process<L1MuDTChambThDigiCollection>(dtp_th_data, dtp_th_emul,
DTP,
DTtpTh,
eventInfo);
692 if (runDoSys[
DTF] && isValid[
DTF])
695 if (runDoSys[
RPC] && isValid[
RPC])
696 process<L1MuRegionalCandCollection>(rpc_cen_data, rpc_cen_emul,
RPC,
RPCcen,
eventInfo);
697 if (runDoSys[
RPC] && isValid[
RPC])
698 process<L1MuRegionalCandCollection>(rpc_for_data, rpc_for_emul,
RPC,
RPCfor,
eventInfo);
700 if (runDoSys[
GMT] && isValid[
GMT])
702 if (runDoSys[
GMT] && isValid[
GMT])
703 process<L1MuRegionalCandCollection>(gmt_rdt_data, gmt_rdt_emul,
GMT,
GMTrdt,
eventInfo);
704 if (runDoSys[
GMT] && isValid[
GMT])
711 std::cout <<
"L1Comparator done processing all collections.\n" << std::flush;
722 bool evt_match =
true;
747 std::cout <<
"\n [L1Comparator] adding empty collection to DErecord\n";
755 std::cout <<
"\n [L1Comparator] printing DErecord"
770 std::cout <<
"L1Comparator::process -ing system:" << sys <<
" (" <<
SystLabel[sys] <<
"), data type " << cid
774 std::cout <<
"L1Comparator::process debug "
775 <<
" (size " <<
data->size() <<
"," << emul->size() <<
")"
787 if (
tmp.get_ncand(0) == 0 &&
tmp.get_ncand(1) == 0)
796 int ndata =
cmp.get_ncand(0);
797 int nemul =
cmp.get_ncand(1);
801 <<
" system:" <<
SystLabel[sys] <<
"(id " << sys <<
")"
802 <<
" type:" <<
cmp.GetName(0) <<
"(" <<
cmp.de_type() <<
")"
803 <<
" ndata:" << ndata <<
" nemul:" << nemul <<
" (size " <<
data->size() <<
"," << emul->size() <<
")"
807 if (ndata == 0 && nemul == 0) {
810 <<
"empty collections -- exiting!\n"
816 std::ios::adjustfield);
821 <<
" | run:" <<
eventInfo.runNum_ <<
")\n"
827 eventInfo.dumpToFile_ <<
"\n sys:" <<
SystLabel[sys] <<
" (" << sys <<
"), type:" << cid
831 std::cout <<
"L1Comparator::process print:\n" << std::flush <<
cmp.print() << std::flush;
840 for (L1DEDigiCollection::iterator it = dg.begin(); it != dg.end(); it++)
844 for (L1DEDigiCollection::iterator it = dg.begin(); it != dg.end(); it++)
847 for (L1DEDigiCollection::iterator it = dg.begin(); it != dg.end(); it++)
852 for (
int i = 0;
i < 2;
i++)
857 <<
" system:" <<
SystLabel[sys] <<
" type:" <<
cmp.GetName(0) <<
" ndata:" <<
eventInfo.DEncand[sys][0]
858 <<
" nemul:" <<
eventInfo.DEncand[sys][1] <<
" (size " <<
data->size() <<
"," << emul->size() <<
")"
859 <<
" ndigis:" << dg.size() <<
" agree? " <<
eventInfo.DEmatchEvt[sys] << std::endl;
862 std::cout <<
"L1Comparator::process -ing system:" << sys <<
" (" <<
SystLabel[sys] <<
")...done.\n" << std::flush;
865 template <
class myCol>
868 std::ostream& dumpStream)
const {
871 typedef typename myCol::iterator col_it;
872 col_sz ndata =
data->size();
873 col_sz nemul = emul->size();
874 if (ndata != nemul) {
876 dumpStream <<
" #cand mismatch!"
877 <<
"\tdata: " << ndata <<
"\temul: " << nemul << std::endl;
879 col_it itd =
data->begin();
880 col_it itm = emul->begin();
881 for (col_sz
i = 0;
i < ndata;
i++) {
891 s <<
dt << std::endl;
892 s << em << std::endl << std::endl;