From 17312031ac33a25796f4a997a067684af2117c3a Mon Sep 17 00:00:00 2001 From: wmtan Date: Tue, 3 Mar 2015 00:00:49 +0100 Subject: [PATCH] Use getByToken, not getByLabel --- .../interface/L1Comparator.h | 25 +- .../HardwareValidation/src/L1Comparator.cc | 242 ++++++++---------- 2 files changed, 129 insertions(+), 138 deletions(-) diff --git a/L1Trigger/HardwareValidation/interface/L1Comparator.h b/L1Trigger/HardwareValidation/interface/L1Comparator.h index ded5dba8cd81c..1de32cc27f20d 100644 --- a/L1Trigger/HardwareValidation/interface/L1Comparator.h +++ b/L1Trigger/HardwareValidation/interface/L1Comparator.h @@ -22,6 +22,7 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/Utilities/interface/EDGetToken.h" // l1 dataformats, d|e record includes #include "L1Trigger/HardwareValidation/interface/DEtrait.h" @@ -73,7 +74,29 @@ class L1Comparator : public edm::EDProducer { int verbose_; bool dumpEvent_; - edm::InputTag m_DEsource[dedefs::DEnsys][4]; + edm::EDGetTokenT tokenCaloEm_[2]; + edm::EDGetTokenT tokenCaloRegion_[2]; + edm::EDGetTokenT tokenGctEmCand_isoEm_[2]; + edm::EDGetTokenT tokenGctEmCand_nonIsoEm_[2]; + edm::EDGetTokenT tokenGctJetCand_cenJets_[2]; + edm::EDGetTokenT tokenGctJetCand_forJets_[2]; + edm::EDGetTokenT tokenGctJetCand_tauJets_[2]; + edm::EDGetTokenT tokenGctEtTotal_[2]; + edm::EDGetTokenT tokenGctEtHad_[2]; + edm::EDGetTokenT tokenGctEtMiss_[2]; + edm::EDGetTokenT tokenGctHFRingEtSums_[2]; + edm::EDGetTokenT tokenGctHFBitCounts_[2]; + edm::EDGetTokenT tokenGctHtMiss_[2]; + edm::EDGetTokenT tokenGctJetCounts_[2]; + edm::EDGetTokenT tokenMuDTChambPh_[2]; + edm::EDGetTokenT tokenMuDTChambTh_[2]; + edm::EDGetTokenT tokenLTCDigi_[2]; + edm::EDGetTokenT tokenMuDTTrack_[2]; + edm::EDGetTokenT tokenMuRegionalCandRPCb_[2]; + edm::EDGetTokenT tokenMuRegionalCandRPCf_[2]; + edm::EDGetTokenT tokenMuGMTCand_[2]; + edm::EDGetTokenT tokenMuReadoutCand_[2]; + bool m_doSys[dedefs::DEnsys]; std::string m_dumpFileName; std::ofstream m_dumpFile; diff --git a/L1Trigger/HardwareValidation/src/L1Comparator.cc b/L1Trigger/HardwareValidation/src/L1Comparator.cc index f52c2807822cd..36b28cdd5b710 100644 --- a/L1Trigger/HardwareValidation/src/L1Comparator.cc +++ b/L1Trigger/HardwareValidation/src/L1Comparator.cc @@ -48,52 +48,7 @@ L1Comparator::L1Comparator(const edm::ParameterSet& iConfig) { assert(DTP==4); assert(DTF==5); assert(CTP== 6); assert(CTF== 7); assert(RPC==8); assert(LTC==9); assert(GMT==10); assert(GLT==11); - if(verbose()) - std::cout << "[L1Comparator] debug print collection labels\n"; - - m_DEsource[RCT][0] = iConfig.getParameter("RCTsourceData"); - m_DEsource[RCT][1] = iConfig.getParameter("RCTsourceEmul"); - - m_DEsource[GCT][0] = iConfig.getParameter("GCTsourceData"); - m_DEsource[GCT][1] = iConfig.getParameter("GCTsourceEmul"); - - m_DEsource[DTP][0] = iConfig.getParameter("DTPsourceData"); - m_DEsource[DTP][1] = iConfig.getParameter("DTPsourceEmul"); - - m_DEsource[DTF][0] = iConfig.getParameter("DTFsourceData"); - m_DEsource[DTF][1] = iConfig.getParameter("DTFsourceEmul"); - - m_DEsource[RPC][0] = iConfig.getParameter("RPCsourceData"); - m_DEsource[RPC][1] = iConfig.getParameter("RPCsourceEmul"); - - m_DEsource[GMT][0] = iConfig.getParameter("GMTsourceData"); - m_DEsource[GMT][1] = iConfig.getParameter("GMTsourceEmul"); - - for(int sys=0; sys(data_label); - //m_DEsource[sys][1] = iConfig.getParameter(emul_label); - //if(sys==CTF) { - // std::string data_label(""); data_label+="CTTsourceData"; - // std::string emul_label(""); emul_label+="CTTsourceEmul"; - // m_DEsource[sys][2] = iConfig.getParameter(data_label); - // m_DEsource[sys][3] = iConfig.getParameter(emul_label); - //} - if(m_doSys[sys] && verbose()) { - std::cout << " sys:" << sys << " label:" << SystLabel[sys] - << "\n\tdt:" << data_label << " : " <("DumpMode",0); m_dumpFileName = iConfig.getUntrackedParameter("DumpFile",""); @@ -121,74 +76,88 @@ L1Comparator::L1Comparator(const edm::ParameterSet& iConfig) { // -- RCT [regional calorimeter trigger] if(m_doSys[RCT]) { - consumes(m_DEsource[RCT][0]); - consumes(m_DEsource[RCT][1]); - consumes(m_DEsource[RCT][0]); - consumes(m_DEsource[RCT][1]); + edm::InputTag tag0 = iConfig.getParameter("RCTsourceData"); + edm::InputTag tag1 = iConfig.getParameter("RCTsourceEmul"); + + tokenCaloEm_[0] = consumes(tag0); + tokenCaloEm_[1] = consumes(tag1); + tokenCaloRegion_[0] = consumes(tag0); + tokenCaloRegion_[1] = consumes(tag1); } // -- GCT [global calorimeter trigger] if(m_doSys[GCT]) { - consumes(edm::InputTag(m_DEsource[GCT][0].label(),"isoEm")); - consumes(edm::InputTag(m_DEsource[GCT][1].label(),"isoEm")); - consumes(edm::InputTag(m_DEsource[GCT][0].label(),"nonIsoEm")); - consumes(edm::InputTag(m_DEsource[GCT][1].label(),"nonIsoEm")); - consumes(edm::InputTag(m_DEsource[GCT][0].label(),"cenJets")); - consumes(edm::InputTag(m_DEsource[GCT][1].label(),"cenJets")); - consumes(edm::InputTag(m_DEsource[GCT][0].label(),"forJets")); - consumes(edm::InputTag(m_DEsource[GCT][1].label(),"forJets")); - consumes(edm::InputTag(m_DEsource[GCT][0].label(),"tauJets")); - consumes(edm::InputTag(m_DEsource[GCT][1].label(),"tauJets")); - consumes(m_DEsource[GCT][0]); - consumes(m_DEsource[GCT][1]); - consumes(m_DEsource[GCT][0]); - consumes(m_DEsource[GCT][1]); - consumes(m_DEsource[GCT][0]); - consumes(m_DEsource[GCT][1]); - consumes(m_DEsource[GCT][0]); - consumes(m_DEsource[GCT][1]); - consumes(m_DEsource[GCT][0]); - consumes(m_DEsource[GCT][1]); - consumes(m_DEsource[GCT][0]); - consumes(m_DEsource[GCT][1]); - consumes(m_DEsource[GCT][0]); - consumes(m_DEsource[GCT][1]); + edm::InputTag tags[2]; + tags[0] = iConfig.getParameter("GCTsourceData"); + tags[1] = iConfig.getParameter("GCTsourceEmul"); + + for (int i = 0; i < 2 ; ++i) { + edm::InputTag const& tag = tags[i]; + std::string const label = tag.label(); + tokenGctEmCand_isoEm_[i] = consumes(edm::InputTag(label, "isoEm")); + tokenGctEmCand_nonIsoEm_[i] = consumes(edm::InputTag(label, "nonIsoEm")); + tokenGctJetCand_cenJets_[i] = consumes(edm::InputTag(label, "cenJets")); + tokenGctJetCand_forJets_[i] = consumes(edm::InputTag(label, "forJets")); + tokenGctJetCand_tauJets_[i] = consumes(edm::InputTag(label, "tauJets")); + tokenGctEtTotal_[i] = consumes(tag); + tokenGctEtHad_[i] = consumes(tag); + tokenGctEtMiss_[i] = consumes(tag); + tokenGctHFRingEtSums_[i] = consumes(tag); + tokenGctHFBitCounts_[i] = consumes(tag); + tokenGctHtMiss_[i] = consumes(tag); + tokenGctJetCounts_[i] = consumes(tag); + } } // -- DTP [drift tube trigger primitive] if(m_doSys[DTP]) { - consumes(m_DEsource[DTP][0]); - consumes(m_DEsource[DTP][1]); - consumes(m_DEsource[DTP][0]); - consumes(m_DEsource[DTP][1]); + edm::InputTag tag0 = iConfig.getParameter("DTPsourceData"); + edm::InputTag tag1 = iConfig.getParameter("DTPsourceEmul"); + + tokenMuDTChambPh_[0] = consumes(tag0); + tokenMuDTChambPh_[1] = consumes(tag1); + tokenMuDTChambTh_[0] = consumes(tag0); + tokenMuDTChambTh_[1] = consumes(tag1); } // -- DTF [drift tube track finder] if(m_doSys[DTF]) { - consumes(edm::InputTag(m_DEsource[DTF][0].label(),"DATA")); - consumes(edm::InputTag(m_DEsource[DTF][1].label(),"DTTF")); + edm::InputTag tag0 = iConfig.getParameter("DTFsourceData"); + edm::InputTag tag1 = iConfig.getParameter("DTFsourceEmul"); + + tokenMuDTTrack_[0] = consumes(edm::InputTag(tag0.label(),"DATA")); + tokenMuDTTrack_[1] = consumes(edm::InputTag(tag1.label(),"DTTF")); } // -- RPC [resistive plate chambers regional trigger] if(m_doSys[RPC]) { - consumes(edm::InputTag(m_DEsource[RPC][0].label(),"RPCb")); - consumes(edm::InputTag(m_DEsource[RPC][1].label(),"RPCb")); - consumes(edm::InputTag(m_DEsource[RPC][0].label(),"RPCf")); - consumes(edm::InputTag(m_DEsource[RPC][1].label(),"RPCf")); + edm::InputTag tag0 = iConfig.getParameter("RPCsourceData"); + edm::InputTag tag1 = iConfig.getParameter("RPCsourceEmul"); + + tokenMuRegionalCandRPCb_[0] = consumes(edm::InputTag(tag0.label(),"RPCb")); + tokenMuRegionalCandRPCb_[1] = consumes(edm::InputTag(tag1.label(),"RPCb")); + tokenMuRegionalCandRPCf_[0] = consumes(edm::InputTag(tag0.label(),"RPCf")); + tokenMuRegionalCandRPCf_[1] = consumes(edm::InputTag(tag1.label(),"RPCf")); } // -- LTC [local trigger controller] if(m_doSys[LTC]) { - consumes(m_DEsource[LTC][0]); - consumes(m_DEsource[LTC][1]); + // FIXME + // There should be a real input tag here, but there was none in the original code. + edm::InputTag dummyTag; + tokenLTCDigi_[0] = consumes(dummyTag); + tokenLTCDigi_[1] = consumes(dummyTag); } // -- GMT [global muon trigger] if(m_doSys[GMT]) { - consumes(m_DEsource[GMT][0]); - consumes(m_DEsource[GMT][1]); - consumes(m_DEsource[GMT][0]); - consumes(m_DEsource[GMT][1]); + edm::InputTag tag0 = iConfig.getParameter("GMTsourceData"); + edm::InputTag tag1 = iConfig.getParameter("GMTsourceEmul"); + + tokenMuGMTCand_[0] = consumes(tag0); + tokenMuGMTCand_[1] = consumes(tag1); + tokenMuReadoutCand_[0] = consumes(tag0); + tokenMuReadoutCand_[1] = consumes(tag1); } if(verbose()) @@ -292,10 +261,10 @@ L1Comparator::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { edm::Handle rct_rgn_data; edm::Handle rct_rgn_emul; if(m_doSys[RCT]) { - iEvent.getByLabel(m_DEsource[RCT][0], rct_em_data); - iEvent.getByLabel(m_DEsource[RCT][1], rct_em_emul); - iEvent.getByLabel(m_DEsource[RCT][0], rct_rgn_data); - iEvent.getByLabel(m_DEsource[RCT][1], rct_rgn_emul); + iEvent.getByToken(tokenCaloEm_[0], rct_em_data); + iEvent.getByToken(tokenCaloEm_[1], rct_em_emul); + iEvent.getByToken(tokenCaloRegion_[0], rct_rgn_data); + iEvent.getByToken(tokenCaloRegion_[1], rct_rgn_emul); } // -- GCT [global calorimeter trigger] @@ -322,35 +291,34 @@ L1Comparator::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { edm::Handlegct_hfring_emul; edm::Handle gct_hfbcnt_data; edm::Handle gct_hfbcnt_emul; - edm::Handle gct_jetcnt_data; + edm::Handle gct_jetcnt_data; edm::Handle gct_jetcnt_emul; if(m_doSys[GCT]) { - iEvent.getByLabel(m_DEsource[GCT][0].label(),"isoEm", gct_isolaem_data); - iEvent.getByLabel(m_DEsource[GCT][1].label(),"isoEm", gct_isolaem_emul); - iEvent.getByLabel(m_DEsource[GCT][0].label(),"nonIsoEm",gct_noisoem_data); - iEvent.getByLabel(m_DEsource[GCT][1].label(),"nonIsoEm",gct_noisoem_emul); - iEvent.getByLabel(m_DEsource[GCT][0].label(),"cenJets", gct_cenjets_data); - iEvent.getByLabel(m_DEsource[GCT][1].label(),"cenJets", gct_cenjets_emul); - iEvent.getByLabel(m_DEsource[GCT][0].label(),"forJets", gct_forjets_data); - iEvent.getByLabel(m_DEsource[GCT][1].label(),"forJets", gct_forjets_emul); - iEvent.getByLabel(m_DEsource[GCT][0].label(),"tauJets", gct_taujets_data); - iEvent.getByLabel(m_DEsource[GCT][1].label(),"tauJets", gct_taujets_emul); - - iEvent.getByLabel(m_DEsource[GCT][0],gct_ht_data); - iEvent.getByLabel(m_DEsource[GCT][1],gct_ht_emul); - iEvent.getByLabel(m_DEsource[GCT][0],gct_etmiss_data); - iEvent.getByLabel(m_DEsource[GCT][1],gct_etmiss_emul); - iEvent.getByLabel(m_DEsource[GCT][0],gct_ettota_data); - iEvent.getByLabel(m_DEsource[GCT][1],gct_ettota_emul); - iEvent.getByLabel(m_DEsource[GCT][0],gct_htmiss_data); - iEvent.getByLabel(m_DEsource[GCT][1],gct_htmiss_emul); - iEvent.getByLabel(m_DEsource[GCT][0],gct_hfring_data); - iEvent.getByLabel(m_DEsource[GCT][1],gct_hfring_emul); - iEvent.getByLabel(m_DEsource[GCT][0],gct_hfbcnt_data); - iEvent.getByLabel(m_DEsource[GCT][1],gct_hfbcnt_emul); - iEvent.getByLabel(m_DEsource[GCT][0],gct_jetcnt_data); - iEvent.getByLabel(m_DEsource[GCT][1],gct_jetcnt_emul); + iEvent.getByToken(tokenGctEmCand_isoEm_[0],gct_isolaem_data); + iEvent.getByToken(tokenGctEmCand_isoEm_[1],gct_isolaem_emul); + iEvent.getByToken(tokenGctEmCand_nonIsoEm_[0],gct_noisoem_data); + iEvent.getByToken(tokenGctEmCand_nonIsoEm_[1],gct_noisoem_emul); + iEvent.getByToken(tokenGctJetCand_cenJets_[0],gct_cenjets_data); + iEvent.getByToken(tokenGctJetCand_cenJets_[1],gct_cenjets_emul); + iEvent.getByToken(tokenGctJetCand_forJets_[0],gct_forjets_data); + iEvent.getByToken(tokenGctJetCand_forJets_[1],gct_forjets_emul); + iEvent.getByToken(tokenGctJetCand_tauJets_[0],gct_taujets_data); + iEvent.getByToken(tokenGctJetCand_tauJets_[1],gct_taujets_emul); + iEvent.getByToken(tokenGctEtHad_[0],gct_ht_data); + iEvent.getByToken(tokenGctEtHad_[1],gct_ht_emul); + iEvent.getByToken(tokenGctEtMiss_[0],gct_etmiss_data); + iEvent.getByToken(tokenGctEtMiss_[1],gct_etmiss_emul); + iEvent.getByToken(tokenGctEtTotal_[0],gct_ettota_data); + iEvent.getByToken(tokenGctEtTotal_[1],gct_ettota_emul); + iEvent.getByToken(tokenGctHtMiss_[0],gct_htmiss_data); + iEvent.getByToken(tokenGctHtMiss_[1],gct_htmiss_emul); + iEvent.getByToken(tokenGctHFRingEtSums_[0],gct_hfring_data); + iEvent.getByToken(tokenGctHFRingEtSums_[1],gct_hfring_emul); + iEvent.getByToken(tokenGctHFBitCounts_[0],gct_hfbcnt_data); + iEvent.getByToken(tokenGctHFBitCounts_[1],gct_hfbcnt_emul); + iEvent.getByToken(tokenGctJetCounts_[0],gct_jetcnt_data); + iEvent.getByToken(tokenGctJetCounts_[1],gct_jetcnt_emul); } // -- DTP [drift tube trigger primitive] @@ -359,10 +327,10 @@ L1Comparator::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { edm::Handle dtp_th_data_; edm::Handle dtp_th_emul_; if(m_doSys[DTP]) { - iEvent.getByLabel(m_DEsource[DTP][0],dtp_ph_data_); - iEvent.getByLabel(m_DEsource[DTP][1],dtp_ph_emul_); - iEvent.getByLabel(m_DEsource[DTP][0],dtp_th_data_); - iEvent.getByLabel(m_DEsource[DTP][1],dtp_th_emul_); + iEvent.getByToken(tokenMuDTChambPh_[0],dtp_ph_data_); + iEvent.getByToken(tokenMuDTChambPh_[1],dtp_ph_emul_); + iEvent.getByToken(tokenMuDTChambTh_[0],dtp_th_data_); + iEvent.getByToken(tokenMuDTChambTh_[1],dtp_th_emul_); } L1MuDTChambPhDigiCollection const* dtp_ph_data = 0; L1MuDTChambPhDigiCollection const* dtp_ph_emul = 0; @@ -380,8 +348,8 @@ L1Comparator::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { L1MuRegionalCandCollection const* dtf_trk_data = 0; L1MuRegionalCandCollection const* dtf_trk_emul = 0; if(m_doSys[DTF]) { - iEvent.getByLabel(m_DEsource[DTF][0].label(),"DATA",dtf_trk_data_); - iEvent.getByLabel(m_DEsource[DTF][1].label(),"DTTF",dtf_trk_emul_); + iEvent.getByToken(tokenMuDTTrack_[0],dtf_trk_data_); + iEvent.getByToken(tokenMuDTTrack_[1],dtf_trk_emul_); } //extract the regional cands typedef std::vector L1MuDTTrackCandCollection; @@ -409,18 +377,18 @@ L1Comparator::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { edm::Handle rpc_for_data; edm::Handle rpc_for_emul; if(m_doSys[RPC]) { - iEvent.getByLabel(m_DEsource[RPC][0].label(),"RPCb",rpc_cen_data); - iEvent.getByLabel(m_DEsource[RPC][1].label(),"RPCb",rpc_cen_emul); - iEvent.getByLabel(m_DEsource[RPC][0].label(),"RPCf",rpc_for_data); - iEvent.getByLabel(m_DEsource[RPC][1].label(),"RPCf",rpc_for_emul); - } + iEvent.getByToken(tokenMuRegionalCandRPCb_[0],rpc_cen_data); + iEvent.getByToken(tokenMuRegionalCandRPCb_[1],rpc_cen_emul); + iEvent.getByToken(tokenMuRegionalCandRPCf_[0],rpc_for_data); + iEvent.getByToken(tokenMuRegionalCandRPCf_[1],rpc_for_emul); + } // -- LTC [local trigger controller] edm::Handle ltc_data; edm::Handle ltc_emul; if(m_doSys[LTC]) { - iEvent.getByLabel(m_DEsource[LTC][0],ltc_data); - iEvent.getByLabel(m_DEsource[LTC][1],ltc_emul); + iEvent.getByToken(tokenLTCDigi_[0],ltc_data); + iEvent.getByToken(tokenLTCDigi_[1],ltc_emul); } // -- GMT [global muon trigger] @@ -434,11 +402,11 @@ L1Comparator::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { L1MuGMTCandCollection const *gmt_can_data(new L1MuGMTCandCollection); L1MuGMTCandCollection const *gmt_can_emul(new L1MuGMTCandCollection); if(m_doSys[GMT]) { - iEvent.getByLabel(m_DEsource[GMT][0], gmt_data); - iEvent.getByLabel(m_DEsource[GMT][1], gmt_emul); - iEvent.getByLabel(m_DEsource[GMT][0], gmt_rdt_data_); - iEvent.getByLabel(m_DEsource[GMT][1], gmt_rdt_emul_); - } + iEvent.getByToken(tokenMuGMTCand_[0], gmt_data); + iEvent.getByToken(tokenMuGMTCand_[1], gmt_emul); + iEvent.getByToken(tokenMuReadoutCand_[0], gmt_rdt_data_); + iEvent.getByToken(tokenMuReadoutCand_[1], gmt_rdt_emul_); + } L1MuGMTCandCollection gmt_can_data_vec, gmt_can_emul_vec; L1MuRegionalCandCollection gmt_rdt_data_vec, gmt_rdt_emul_vec; gmt_can_data_vec.clear(); gmt_can_emul_vec.clear();