diff --git a/CalibCalorimetry/CaloMiscalibTools/interface/HcalRecHitRecalib.h b/CalibCalorimetry/CaloMiscalibTools/interface/HcalRecHitRecalib.h index e019888f16ae9..8cfa333105c58 100644 --- a/CalibCalorimetry/CaloMiscalibTools/interface/HcalRecHitRecalib.h +++ b/CalibCalorimetry/CaloMiscalibTools/interface/HcalRecHitRecalib.h @@ -32,6 +32,7 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "CalibCalorimetry/CaloMiscalibTools/interface/CaloMiscalibMapHcal.h" +#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" class HcalRecHitRecalib : public edm::EDProducer { @@ -43,9 +44,9 @@ class HcalRecHitRecalib : public edm::EDProducer virtual void produce(edm::Event &, const edm::EventSetup&) override; private: - edm::InputTag hbheLabel_; - edm::InputTag hoLabel_; - edm::InputTag hfLabel_; + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_hf_; std::string RecalibHBHEHits_; std::string RecalibHFHits_; std::string RecalibHOHits_; diff --git a/CalibCalorimetry/CaloMiscalibTools/plugins/HcalRecHitRecalib.cc b/CalibCalorimetry/CaloMiscalibTools/plugins/HcalRecHitRecalib.cc index 5bf6db0c3fc70..ad8d20f57b9ed 100644 --- a/CalibCalorimetry/CaloMiscalibTools/plugins/HcalRecHitRecalib.cc +++ b/CalibCalorimetry/CaloMiscalibTools/plugins/HcalRecHitRecalib.cc @@ -5,16 +5,15 @@ #include "FWCore/ParameterSet/interface/FileInPath.h" #include "FWCore/Framework/interface/ESHandle.h" -#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "CalibCalorimetry/CaloMiscalibTools/interface/MiscalibReaderFromXMLHcal.h" HcalRecHitRecalib::HcalRecHitRecalib(const edm::ParameterSet& iConfig) { - hbheLabel_ = iConfig.getParameter("hbheInput"); - hoLabel_ = iConfig.getParameter("hoInput"); - hfLabel_ = iConfig.getParameter("hfInput"); + tok_hbhe_ = consumes(iConfig.getParameter("hbheInput")); + tok_ho_ = consumes(iConfig.getParameter("hoInput")); + tok_hf_ = consumes(iConfig.getParameter("hfInput")); // HBHEHitsProducer_ = iConfig.getParameter< std::string > ("HBHERecHitsProducer"); // HOHitsProducer_ = iConfig.getParameter< std::string > ("HERecHitsProducer"); @@ -78,21 +77,21 @@ HcalRecHitRecalib::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) const HFRecHitCollection* HFRecHits = 0; const HORecHitCollection* HORecHits = 0; - iEvent.getByLabel(hbheLabel_,HBHERecHitsHandle); + iEvent.getByToken(tok_hbhe_,HBHERecHitsHandle); if (!HBHERecHitsHandle.isValid()) { LogDebug("") << "HcalREcHitRecalib: Error! can't get product!" << std::endl; } else { HBHERecHits = HBHERecHitsHandle.product(); // get a ptr to the product } - iEvent.getByLabel(hoLabel_,HORecHitsHandle); + iEvent.getByToken(tok_ho_,HORecHitsHandle); if (!HORecHitsHandle.isValid()) { LogDebug("") << "HcalREcHitRecalib: Error! can't get product!" << std::endl; } else { HORecHits = HORecHitsHandle.product(); // get a ptr to the product } - iEvent.getByLabel(hfLabel_,HFRecHitsHandle); + iEvent.getByToken(tok_hf_,HFRecHitsHandle); if (!HFRecHitsHandle.isValid()) { LogDebug("") << "HcalREcHitRecalib: Error! can't get product!" << std::endl; } else { diff --git a/CalibCalorimetry/HcalStandardModules/interface/HFLightCal.h b/CalibCalorimetry/HcalStandardModules/interface/HFLightCal.h index 6bbe46e581b62..3b3fff9dd3577 100644 --- a/CalibCalorimetry/HcalStandardModules/interface/HFLightCal.h +++ b/CalibCalorimetry/HcalStandardModules/interface/HFLightCal.h @@ -5,6 +5,9 @@ #include "FWCore/Framework/interface/EDAnalyzer.h" #include "FWCore/Utilities/interface/InputTag.h" +#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" +#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" + class TFile; class TH1F; class TH2F; @@ -43,8 +46,8 @@ class HFLightCal : public edm::EDAnalyzer { TH1F* hpedpin[8][3]; TH1F* htsmpin[8][3]; - edm::InputTag hfDigiCollectionTag_; - edm::InputTag hcalCalibDigiCollectionTag_; + edm::EDGetTokenT tok_hfDigiCollection_; + edm::EDGetTokenT tok_hcalCalibDigiCollection_; }; #endif diff --git a/CalibCalorimetry/HcalStandardModules/interface/HFLightCalRand.h b/CalibCalorimetry/HcalStandardModules/interface/HFLightCalRand.h index bdcb2c6f451bd..389f17f57ac6a 100644 --- a/CalibCalorimetry/HcalStandardModules/interface/HFLightCalRand.h +++ b/CalibCalorimetry/HcalStandardModules/interface/HFLightCalRand.h @@ -5,6 +5,9 @@ #include "FWCore/Framework/interface/EDAnalyzer.h" #include "FWCore/Utilities/interface/InputTag.h" +#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" +#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" + class TFile; class TH1F; class TH2F; @@ -43,8 +46,8 @@ class HFLightCalRand : public edm::EDAnalyzer { TH1F* hpedpin[8][3]; TH1F* htsmpin[8][3]; - edm::InputTag hfDigiCollectionTag_; - edm::InputTag hcalCalibDigiCollectionTag_; + edm::EDGetTokenT tok_hfDigiCollection_; + edm::EDGetTokenT tok_hcalCalibDigiCollection_; }; #endif diff --git a/CalibCalorimetry/HcalStandardModules/interface/HFPreLightCal.h b/CalibCalorimetry/HcalStandardModules/interface/HFPreLightCal.h index 429e8a11f27fc..59bc336308704 100644 --- a/CalibCalorimetry/HcalStandardModules/interface/HFPreLightCal.h +++ b/CalibCalorimetry/HcalStandardModules/interface/HFPreLightCal.h @@ -5,6 +5,10 @@ #include "FWCore/Framework/interface/EDAnalyzer.h" #include "FWCore/Utilities/interface/InputTag.h" +#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" +#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" + + class TFile; class TH1F; class TH2F; @@ -32,8 +36,8 @@ class HFPreLightCal : public edm::EDAnalyzer { TH1F *htsmax,*htspinmax; TH1F* htspin[8][3]; - edm::InputTag hfDigiCollectionTag_; - edm::InputTag hcalCalibDigiCollectionTag_; + edm::EDGetTokenT tok_hfDigiCollection_; + edm::EDGetTokenT tok_hcalCalibDigiCollection_; }; #endif diff --git a/CalibCalorimetry/HcalStandardModules/interface/HcalLedAnalyzer.h b/CalibCalorimetry/HcalStandardModules/interface/HcalLedAnalyzer.h index 1fa2dccd82eb1..82867f5eaddd1 100644 --- a/CalibCalorimetry/HcalStandardModules/interface/HcalLedAnalyzer.h +++ b/CalibCalorimetry/HcalStandardModules/interface/HcalLedAnalyzer.h @@ -55,10 +55,10 @@ void endJob(void); std::string m_inputPedestals_tag; int m_inputPedestals_run; - edm::InputTag hbheDigiCollectionTag_; - edm::InputTag hoDigiCollectionTag_; - edm::InputTag hfDigiCollectionTag_; - edm::InputTag hcalCalibDigiCollectionTag_; + edm::EDGetTokenT tok_hbheDigiCollection_; + edm::EDGetTokenT tok_hoDigiCollection_; + edm::EDGetTokenT tok_hfDigiCollection_; + edm::EDGetTokenT tok_hcalCalibDigiCollection_; }; #endif diff --git a/CalibCalorimetry/HcalStandardModules/interface/HcalPedestalAnalyzer.h b/CalibCalorimetry/HcalStandardModules/interface/HcalPedestalAnalyzer.h index d721dd16fcbd6..1207f54ef0dcc 100644 --- a/CalibCalorimetry/HcalStandardModules/interface/HcalPedestalAnalyzer.h +++ b/CalibCalorimetry/HcalStandardModules/interface/HcalPedestalAnalyzer.h @@ -87,9 +87,9 @@ void endJob(void); std::string m_outputPedestalWidths_tag; int m_outputPedestalWidths_run; - edm::InputTag hbheDigiCollectionTag_; - edm::InputTag hoDigiCollectionTag_; - edm::InputTag hfDigiCollectionTag_; + edm::EDGetTokenT tok_hbheDigiCollection_; + edm::EDGetTokenT tok_hoDigiCollection_; + edm::EDGetTokenT tok_hfDigiCollection_; }; #endif diff --git a/CalibCalorimetry/HcalStandardModules/interface/HcalPedestalMCWidths.h b/CalibCalorimetry/HcalStandardModules/interface/HcalPedestalMCWidths.h index 6a4116d53be9e..843d997538d7c 100644 --- a/CalibCalorimetry/HcalStandardModules/interface/HcalPedestalMCWidths.h +++ b/CalibCalorimetry/HcalStandardModules/interface/HcalPedestalMCWidths.h @@ -96,9 +96,9 @@ class HcalPedestalMCWidths : public edm::EDAnalyzer bool firsttime; bool histflag; - edm::InputTag hbheDigiCollectionTag_; - edm::InputTag hoDigiCollectionTag_; - edm::InputTag hfDigiCollectionTag_; + edm::EDGetTokenT tok_hbheDigiCollection_; + edm::EDGetTokenT tok_hoDigiCollection_; + edm::EDGetTokenT tok_hfDigiCollection_; }; #endif diff --git a/CalibCalorimetry/HcalStandardModules/interface/HcalPedestalsAnalysis.h b/CalibCalorimetry/HcalStandardModules/interface/HcalPedestalsAnalysis.h index 8bb272e4e2403..31c218b48b7e9 100644 --- a/CalibCalorimetry/HcalStandardModules/interface/HcalPedestalsAnalysis.h +++ b/CalibCalorimetry/HcalStandardModules/interface/HcalPedestalsAnalysis.h @@ -116,9 +116,9 @@ class HcalPedestalsAnalysis : public edm::EDAnalyzer HcalPedestalWidths* rawWidthsItemfc; HcalTopology *theTopology; - edm::InputTag hbheDigiCollectionTag_; - edm::InputTag hoDigiCollectionTag_; - edm::InputTag hfDigiCollectionTag_; + edm::EDGetTokenT tok_hbheDigiCollection_; + edm::EDGetTokenT tok_hoDigiCollection_; + edm::EDGetTokenT tok_hfDigiCollection_; }; #endif diff --git a/CalibCalorimetry/HcalStandardModules/src/HFLightCal.cc b/CalibCalorimetry/HcalStandardModules/src/HFLightCal.cc index 156184937dc69..2f516ef4253e6 100644 --- a/CalibCalorimetry/HcalStandardModules/src/HFLightCal.cc +++ b/CalibCalorimetry/HcalStandardModules/src/HFLightCal.cc @@ -18,8 +18,6 @@ #include "CalibCalorimetry/HcalStandardModules/interface/HFLightCal.h" -#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" -#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" #include "CalibFormats/HcalObjects/interface/HcalDbService.h" #include "CalibFormats/HcalObjects/interface/HcalDbRecord.h" @@ -41,9 +39,11 @@ namespace { bool verbose = false; } -HFLightCal::HFLightCal (const edm::ParameterSet& fConfiguration) : - hfDigiCollectionTag_(fConfiguration.getParameter("hfDigiCollectionTag")), - hcalCalibDigiCollectionTag_(fConfiguration.getParameter("hcalCalibDigiCollectionTag")) { +HFLightCal::HFLightCal (const edm::ParameterSet& fConfiguration) { + + + tok_hfDigiCollection_ = consumes(fConfiguration.getParameter("hfDigiCollectionTag")); + tok_hcalCalibDigiCollection_ = consumes(fConfiguration.getParameter("hcalCalibDigiCollectionTag")) ; //std::string histfile = fConfiguration.getUntrackedParameter("rootFile"); histfile = fConfiguration.getUntrackedParameter("rootFile"); @@ -428,7 +428,7 @@ void HFLightCal::analyze(const edm::Event& fEvent, const edm::EventSetup& fSetup // HF PIN-diodes edm::Handle calib; - fEvent.getByLabel(hcalCalibDigiCollectionTag_, calib); + fEvent.getByToken(tok_hcalCalibDigiCollection_, calib); if (verbose) std::cout<<"Analysis-> total CAL digis= "<size()< hf_digi; - fEvent.getByLabel(hfDigiCollectionTag_, hf_digi); + fEvent.getByToken(tok_hfDigiCollection_, hf_digi); if (verbose) std::cout<<"Analysis-> total HF digis= "<size()<size (); ++ihit) { diff --git a/CalibCalorimetry/HcalStandardModules/src/HFLightCalRand.cc b/CalibCalorimetry/HcalStandardModules/src/HFLightCalRand.cc index f33eb6ca95061..897b3e7957c16 100644 --- a/CalibCalorimetry/HcalStandardModules/src/HFLightCalRand.cc +++ b/CalibCalorimetry/HcalStandardModules/src/HFLightCalRand.cc @@ -19,8 +19,6 @@ #include "CalibCalorimetry/HcalStandardModules/interface/HFLightCalRand.h" -#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" -#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" #include "CalibFormats/HcalObjects/interface/HcalDbService.h" #include "CalibFormats/HcalObjects/interface/HcalDbRecord.h" @@ -40,9 +38,10 @@ namespace { bool verbose = false; } -HFLightCalRand::HFLightCalRand (const edm::ParameterSet& fConfiguration) : - hfDigiCollectionTag_(fConfiguration.getParameter("hfDigiCollectionTag")), - hcalCalibDigiCollectionTag_(fConfiguration.getParameter("hcalCalibDigiCollectionTag")) { +HFLightCalRand::HFLightCalRand (const edm::ParameterSet& fConfiguration) { + + tok_hfDigiCollection_ = consumes(fConfiguration.getParameter("hfDigiCollectionTag")); + tok_hcalCalibDigiCollection_ = consumes(fConfiguration.getParameter("hcalCalibDigiCollectionTag")); //std::string histfile = fConfiguration.getUntrackedParameter("rootFile"); histfile = fConfiguration.getUntrackedParameter("rootFile"); @@ -387,7 +386,7 @@ void HFLightCalRand::analyze(const edm::Event& fEvent, const edm::EventSetup& fS // HF PIN-diodes edm::Handle calib; - fEvent.getByLabel(hcalCalibDigiCollectionTag_, calib); + fEvent.getByToken(tok_hcalCalibDigiCollection_, calib); if (verbose) std::cout<<"Analysis-> total CAL digis= "<size()< hf_digi; - fEvent.getByLabel(hfDigiCollectionTag_, hf_digi); + fEvent.getByToken(tok_hfDigiCollection_, hf_digi); if (verbose) std::cout<<"Analysis-> total HF digis= "<size()<size (); ++ihit) { diff --git a/CalibCalorimetry/HcalStandardModules/src/HFPreLightCal.cc b/CalibCalorimetry/HcalStandardModules/src/HFPreLightCal.cc index 951e716d73995..fdd8b447ee659 100644 --- a/CalibCalorimetry/HcalStandardModules/src/HFPreLightCal.cc +++ b/CalibCalorimetry/HcalStandardModules/src/HFPreLightCal.cc @@ -14,9 +14,6 @@ #include "CalibCalorimetry/HcalStandardModules/interface/HFPreLightCal.h" -#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" -#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" - #include "CalibFormats/HcalObjects/interface/HcalDbService.h" #include "CalibFormats/HcalObjects/interface/HcalDbRecord.h" #include "CondFormats/HcalObjects/interface/HcalQIEShape.h" @@ -35,9 +32,10 @@ namespace { bool verbose = false; } -HFPreLightCal::HFPreLightCal (const edm::ParameterSet& fConfiguration) : - hfDigiCollectionTag_(fConfiguration.getParameter("hfDigiCollectionTag")), - hcalCalibDigiCollectionTag_(fConfiguration.getParameter("hcalCalibDigiCollectionTag")) { +HFPreLightCal::HFPreLightCal (const edm::ParameterSet& fConfiguration) { + + tok_hfDigiCollection_ = consumes(fConfiguration.getParameter("hfDigiCollectionTag")); + tok_hcalCalibDigiCollection_ = consumes(fConfiguration.getParameter("hcalCalibDigiCollectionTag")); //std::string histfile = fConfiguration.getUntrackedParameter("rootFile"); histfile = fConfiguration.getUntrackedParameter("rootPreFile"); @@ -137,7 +135,7 @@ void HFPreLightCal::analyze(const edm::Event& fEvent, const edm::EventSetup& fSe // HF PIN-diodes edm::Handle calib; - fEvent.getByLabel(hcalCalibDigiCollectionTag_, calib); + fEvent.getByToken(tok_hcalCalibDigiCollection_, calib); if (verbose) std::cout<<"Analysis-> total CAL digis= "<size()< hf_digi; - fEvent.getByLabel(hfDigiCollectionTag_, hf_digi); + fEvent.getByToken(tok_hfDigiCollection_, hf_digi); if (verbose) std::cout<<"Analysis-> total HF digis= "<size()<size (); ++ihit) { diff --git a/CalibCalorimetry/HcalStandardModules/src/HcalLedAnalyzer.cc b/CalibCalorimetry/HcalStandardModules/src/HcalLedAnalyzer.cc index 9c551a23cbe33..543fb11f4d2d3 100644 --- a/CalibCalorimetry/HcalStandardModules/src/HcalLedAnalyzer.cc +++ b/CalibCalorimetry/HcalStandardModules/src/HcalLedAnalyzer.cc @@ -49,11 +49,12 @@ namespace { } -HcalLedAnalyzer::HcalLedAnalyzer(const edm::ParameterSet& ps) : - hbheDigiCollectionTag_(ps.getParameter("hbheDigiCollectionTag")), - hoDigiCollectionTag_(ps.getParameter("hoDigiCollectionTag")), - hfDigiCollectionTag_(ps.getParameter("hfDigiCollectionTag")), - hcalCalibDigiCollectionTag_ (ps.getParameter("hcalCalibDigiCollectionTag")) { +HcalLedAnalyzer::HcalLedAnalyzer(const edm::ParameterSet& ps) { + + tok_hbheDigiCollection_ = consumes(ps.getParameter("hbheDigiCollectionTag")); + tok_hoDigiCollection_ = consumes(ps.getParameter("hoDigiCollectionTag")); + tok_hfDigiCollection_ = consumes(ps.getParameter("hfDigiCollectionTag")); + tok_hcalCalibDigiCollection_ = consumes(ps.getParameter("hcalCalibDigiCollectionTag")); m_ledAnal = new HcalLedAnalysis(ps); m_ledAnal->LedSetup(ps.getUntrackedParameter("outputFileHist", "HcalLedAnalyzer.root")); @@ -89,12 +90,12 @@ void HcalLedAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& eventS m_ievt++; ///get digis - edm::Handle hbhe; e.getByLabel(hbheDigiCollectionTag_, hbhe); - edm::Handle ho; e.getByLabel(hoDigiCollectionTag_, ho); - edm::Handle hf; e.getByLabel(hfDigiCollectionTag_, hf); + edm::Handle hbhe; e.getByToken(tok_hbheDigiCollection_, hbhe); + edm::Handle ho; e.getByToken(tok_hoDigiCollection_, ho); + edm::Handle hf; e.getByToken(tok_hfDigiCollection_, hf); // get calib digis - edm::Handle calib; e.getByLabel(hcalCalibDigiCollectionTag_, calib); + edm::Handle calib; e.getByToken(tok_hcalCalibDigiCollection_, calib); // get testbeam specific laser info from the TDC. This probably will not work // outside of the testbeam, but it should be easy to modify the Handle/getByType diff --git a/CalibCalorimetry/HcalStandardModules/src/HcalPedestalAnalyzer.cc b/CalibCalorimetry/HcalStandardModules/src/HcalPedestalAnalyzer.cc index c72733ed735b2..037fcd01bf93d 100644 --- a/CalibCalorimetry/HcalStandardModules/src/HcalPedestalAnalyzer.cc +++ b/CalibCalorimetry/HcalStandardModules/src/HcalPedestalAnalyzer.cc @@ -107,10 +107,11 @@ namespace { } } -HcalPedestalAnalyzer::HcalPedestalAnalyzer(const edm::ParameterSet& ps) : - hbheDigiCollectionTag_(ps.getParameter("hbheDigiCollectionTag")), - hoDigiCollectionTag_(ps.getParameter("hoDigiCollectionTag")), - hfDigiCollectionTag_(ps.getParameter("hfDigiCollectionTag")) { +HcalPedestalAnalyzer::HcalPedestalAnalyzer(const edm::ParameterSet& ps) { + + tok_hbheDigiCollection_ = consumes(ps.getParameter("hbheDigiCollectionTag")); + tok_hoDigiCollection_ = consumes(ps.getParameter("hoDigiCollectionTag")); + tok_hfDigiCollection_ = consumes(ps.getParameter("hfDigiCollectionTag")); m_pedAnal = new HcalPedestalAnalysis(ps); m_pedAnal->setup(ps.getUntrackedParameter("outputFileHist", "HcalPedestalAnalyzer.root")); @@ -204,9 +205,9 @@ void HcalPedestalAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& e m_ievt++; ///get digis - edm::Handle hbhe; e.getByLabel(hbheDigiCollectionTag_, hbhe); - edm::Handle ho; e.getByLabel(hoDigiCollectionTag_, ho); - edm::Handle hf; e.getByLabel(hfDigiCollectionTag_, hf); + edm::Handle hbhe; e.getByToken(tok_hbheDigiCollection_, hbhe); + edm::Handle ho; e.getByToken(tok_hoDigiCollection_, ho); + edm::Handle hf; e.getByToken(tok_hfDigiCollection_, hf); // get conditions edm::ESHandle conditions; diff --git a/CalibCalorimetry/HcalStandardModules/src/HcalPedestalMCWidths.cc b/CalibCalorimetry/HcalStandardModules/src/HcalPedestalMCWidths.cc index 112804826a404..4808212f84fcf 100644 --- a/CalibCalorimetry/HcalStandardModules/src/HcalPedestalMCWidths.cc +++ b/CalibCalorimetry/HcalStandardModules/src/HcalPedestalMCWidths.cc @@ -9,10 +9,11 @@ #include "Geometry/CaloTopology/interface/HcalTopology.h" #include "FWCore/Utilities/interface/isFinite.h" -HcalPedestalMCWidths::HcalPedestalMCWidths(const edm::ParameterSet& ps) : - hbheDigiCollectionTag_(ps.getParameter("hbheDigiCollectionTag")), - hoDigiCollectionTag_(ps.getParameter("hoDigiCollectionTag")), - hfDigiCollectionTag_(ps.getParameter("hfDigiCollectionTag")) { +HcalPedestalMCWidths::HcalPedestalMCWidths(const edm::ParameterSet& ps) { + + tok_hbheDigiCollection_ = consumes(ps.getParameter("hbheDigiCollectionTag")); + tok_hoDigiCollection_ = consumes(ps.getParameter("hoDigiCollectionTag")); + tok_hfDigiCollection_ = consumes(ps.getParameter("hfDigiCollectionTag")); firsttime = true; histflag = ps.getUntrackedParameter("saveHists",true); @@ -107,9 +108,9 @@ HcalPedestalMCWidths::analyze(const edm::Event& e, const edm::EventSetup& iSetup using namespace edm; using namespace std; - edm::Handle hbhe; e.getByLabel(hbheDigiCollectionTag_, hbhe); - edm::Handle ho; e.getByLabel(hoDigiCollectionTag_, ho); - edm::Handle hf; e.getByLabel(hfDigiCollectionTag_, hf); + edm::Handle hbhe; e.getByToken(tok_hbheDigiCollection_, hbhe); + edm::Handle ho; e.getByToken(tok_hoDigiCollection_, ho); + edm::Handle hf; e.getByToken(tok_hfDigiCollection_, hf); edm::ESHandle conditions; iSetup.get().get(conditions); diff --git a/CalibCalorimetry/HcalStandardModules/src/HcalPedestalsAnalysis.cc b/CalibCalorimetry/HcalStandardModules/src/HcalPedestalsAnalysis.cc index 1869cd80cf2cf..9857bc3c5de81 100644 --- a/CalibCalorimetry/HcalStandardModules/src/HcalPedestalsAnalysis.cc +++ b/CalibCalorimetry/HcalStandardModules/src/HcalPedestalsAnalysis.cc @@ -9,10 +9,10 @@ #include "CalibCalorimetry/HcalStandardModules/interface/HcalPedestalsAnalysis.h" #include "Geometry/CaloTopology/interface/HcalTopology.h" -HcalPedestalsAnalysis::HcalPedestalsAnalysis(const edm::ParameterSet& ps) : - hbheDigiCollectionTag_(ps.getParameter("hbheDigiCollectionTag")), - hoDigiCollectionTag_(ps.getParameter("hoDigiCollectionTag")), - hfDigiCollectionTag_(ps.getParameter("hfDigiCollectionTag")) { +HcalPedestalsAnalysis::HcalPedestalsAnalysis(const edm::ParameterSet& ps) { + tok_hbheDigiCollection_ = consumes(ps.getParameter("hbheDigiCollectionTag")); + tok_hoDigiCollection_ = consumes(ps.getParameter("hoDigiCollectionTag")); + tok_hfDigiCollection_ = consumes(ps.getParameter("hfDigiCollectionTag")); std::cout << "Code version 10.6\n"; hiSaveFlag = ps.getUntrackedParameter("hiSaveFlag", false); @@ -207,9 +207,9 @@ HcalPedestalsAnalysis::analyze(const edm::Event& e, const edm::EventSetup& iSetu using namespace edm; using namespace std; - edm::Handle hbhe; e.getByLabel(hbheDigiCollectionTag_, hbhe); - edm::Handle ho; e.getByLabel(hoDigiCollectionTag_, ho); - edm::Handle hf; e.getByLabel(hfDigiCollectionTag_, hf); + edm::Handle hbhe; e.getByToken(tok_hbheDigiCollection_, hbhe); + edm::Handle ho; e.getByToken(tok_hoDigiCollection_, ho); + edm::Handle hf; e.getByToken(tok_hfDigiCollection_, hf); edm::ESHandle conditions; iSetup.get().get(conditions); diff --git a/Calibration/HcalAlCaRecoProducers/interface/AlCaDiJetsProducer.h b/Calibration/HcalAlCaRecoProducers/interface/AlCaDiJetsProducer.h index 148ec8bb1fd10..8dadf3a06f9f8 100644 --- a/Calibration/HcalAlCaRecoProducers/interface/AlCaDiJetsProducer.h +++ b/Calibration/HcalAlCaRecoProducers/interface/AlCaDiJetsProducer.h @@ -21,6 +21,10 @@ #include "DataFormats/CaloTowers/interface/CaloTowerCollection.h" #include "DataFormats/DetId/interface/DetId.h" +#include "DataFormats/JetReco/interface/CaloJetCollection.h" +#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" +#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" + #include "Geometry/CaloGeometry/interface/CaloGeometry.h" // @@ -45,11 +49,14 @@ class AlCaDiJetsProducer : public edm::EDProducer { virtual void produce(edm::Event &, const edm::EventSetup&); private: // ----------member data --------------------------- - edm::InputTag jetsInput_; std::vector ecalLabels_; - edm::InputTag hbheInput_; - edm::InputTag hoInput_; - edm::InputTag hfInput_; + + edm::EDGetTokenT tok_jets_; + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_hf_; + + std::vector > toks_ecal_; bool allowMissingInputs_; diff --git a/Calibration/HcalAlCaRecoProducers/interface/AlCaEcalHcalReadoutsProducer.h b/Calibration/HcalAlCaRecoProducers/interface/AlCaEcalHcalReadoutsProducer.h index 14da1110796f2..0a86ef68985ad 100644 --- a/Calibration/HcalAlCaRecoProducers/interface/AlCaEcalHcalReadoutsProducer.h +++ b/Calibration/HcalAlCaRecoProducers/interface/AlCaEcalHcalReadoutsProducer.h @@ -44,8 +44,8 @@ class AlCaEcalHcalReadoutsProducer : public edm::EDProducer { private: // ----------member data --------------------------- - edm::InputTag hbheLabel_; - edm::InputTag hoLabel_; - edm::InputTag hfLabel_; + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_hf_; }; diff --git a/Calibration/HcalAlCaRecoProducers/interface/AlCaGammaJetProducer.h b/Calibration/HcalAlCaRecoProducers/interface/AlCaGammaJetProducer.h index d5884c998e097..6de54d4717475 100644 --- a/Calibration/HcalAlCaRecoProducers/interface/AlCaGammaJetProducer.h +++ b/Calibration/HcalAlCaRecoProducers/interface/AlCaGammaJetProducer.h @@ -17,6 +17,12 @@ #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" +#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" +#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" +#include "DataFormats/JetReco/interface/CaloJetCollection.h" +#include "TrackingTools/TransientTrack/interface/TransientTrack.h" +#include "DataFormats/EgammaReco/interface/SuperCluster.h" +#include "DataFormats/EgammaReco/interface/SuperClusterFwd.h" #include "Geometry/CaloGeometry/interface/CaloGeometry.h" @@ -41,18 +47,26 @@ class AlCaGammaJetProducer : public edm::EDProducer { virtual void produce(edm::Event &, const edm::EventSetup&); private: // ----------member data --------------------------- - edm::InputTag hbheLabel_; - edm::InputTag hoLabel_; - edm::InputTag hfLabel_; std::vector ecalLabels_; std::vector mInputCalo; + + std::vector > toks_ecal_; + std::vector > toks_calo_; + std::string correctedIslandBarrelSuperClusterCollection_; std::string correctedIslandBarrelSuperClusterProducer_; std::string correctedIslandEndcapSuperClusterCollection_; std::string correctedIslandEndcapSuperClusterProducer_; - + + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_hf_; + edm::EDGetTokenT tok_inputTrack_; + edm::EDGetTokenT tok_EBSC_; // token for corrected island barrel super cluster collection + edm::EDGetTokenT tok_EESC_; // token for corrected island end-cap super cluster + bool allowMissingInputs_; - std::string m_inputTrackLabel; + // Calo geometry const CaloGeometry* geo; diff --git a/Calibration/HcalAlCaRecoProducers/interface/AlCaHcalNoiseProducer.h b/Calibration/HcalAlCaRecoProducers/interface/AlCaHcalNoiseProducer.h index af4b7f902ddd3..8014481a611c4 100644 --- a/Calibration/HcalAlCaRecoProducers/interface/AlCaHcalNoiseProducer.h +++ b/Calibration/HcalAlCaRecoProducers/interface/AlCaHcalNoiseProducer.h @@ -30,6 +30,13 @@ #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" + +#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" +#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" +#include "DataFormats/METReco/interface/CaloMETCollection.h" +#include "DataFormats/JetReco/interface/CaloJetCollection.h" +#include "DataFormats/CaloTowers/interface/CaloTowerCollection.h" + // // class decleration // @@ -44,9 +51,6 @@ class AlCaHcalNoiseProducer : public edm::EDProducer { private: // ----------member data --------------------------- - edm::InputTag JetSource_; - edm::InputTag MetSource_; - edm::InputTag TowerSource_; bool useMet_; bool useJet_; double MetCut_; @@ -55,10 +59,18 @@ class AlCaHcalNoiseProducer : public edm::EDProducer { int nAnomalousEvents; int nEvents; - edm::InputTag hbheLabel_; - edm::InputTag hoLabel_; - edm::InputTag hfLabel_; std::vector ecalLabels_; - edm::InputTag ecalPSLabel_; - edm::InputTag rawInLabel_; + + edm::EDGetTokenT tok_jets_; + edm::EDGetTokenT tok_met_; + edm::EDGetTokenT tok_tower_; + + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_hf_; + + edm::EDGetTokenT tok_ps_; + edm::EDGetTokenT tok_raw_; + std::vector > toks_ecal_; + }; diff --git a/Calibration/HcalAlCaRecoProducers/interface/AlCaIsoTracksProducer.h b/Calibration/HcalAlCaRecoProducers/interface/AlCaIsoTracksProducer.h index d38dcbf816a40..03bb88e183406 100644 --- a/Calibration/HcalAlCaRecoProducers/interface/AlCaIsoTracksProducer.h +++ b/Calibration/HcalAlCaRecoProducers/interface/AlCaIsoTracksProducer.h @@ -41,6 +41,8 @@ #include "Geometry/Records/interface/IdealGeometryRecord.h" #include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "DataFormats/HLTReco/interface/TriggerEvent.h" + #include "TH1F.h" class TFile; @@ -63,12 +65,8 @@ class AlCaIsoTracksProducer : public edm::EDProducer { const CaloGeometry* geo; - edm::InputTag hoLabel_; - edm::InputTag hbheLabel_; std::vector ecalLabels_; - edm::InputTag m_inputTrackLabel_; - int nHitsMinCore_; int nHitsMinIso_; double m_dvCut; @@ -83,7 +81,6 @@ class AlCaIsoTracksProducer : public edm::EDProducer { bool skipNeutrals_; bool checkHLTMatch_; - edm::InputTag hltEventTag_; std::vector hltFiltTag_; double hltMatchingCone_; @@ -101,5 +98,13 @@ class AlCaIsoTracksProducer : public edm::EDProducer { std::string l1FilterTag_; double l1jetVetoCone_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_track_; + edm::EDGetTokenT tok_hlt_; + + std::vector > toks_ecal_; + edm::EDGetTokenT tok_ps_; + }; diff --git a/Calibration/HcalAlCaRecoProducers/plugins/PrescalerFHN.cc b/Calibration/HcalAlCaRecoProducers/plugins/PrescalerFHN.cc index 2f827bb8e73cc..3ee7273cffc46 100644 --- a/Calibration/HcalAlCaRecoProducers/plugins/PrescalerFHN.cc +++ b/Calibration/HcalAlCaRecoProducers/plugins/PrescalerFHN.cc @@ -59,7 +59,7 @@ class PrescalerFHN : public edm::EDFilter { edm::ParameterSetID triggerNamesID_; - edm::InputTag triggerTag; + edm::EDGetTokenT tok_trigger; std::map prescales; std::map prescale_counter; @@ -79,8 +79,8 @@ class PrescalerFHN : public edm::EDFilter { // constructors and destructor // PrescalerFHN::PrescalerFHN(const edm::ParameterSet& iConfig) - : triggerTag(iConfig.getParameter("TriggerResultsTag")) { + tok_trigger = consumes(iConfig.getParameter("TriggerResultsTag")); //now do what ever initialization is needed std::vector prescales_in(iConfig.getParameter >("Prescales")); @@ -146,7 +146,7 @@ PrescalerFHN::filter(edm::Event& iEvent, const edm::EventSetup& iSetup) // Trying to mirror HLTrigger/HLTfilters/src/HLTHighLevel.cc where possible Handle trh; - iEvent.getByLabel(triggerTag, trh); + iEvent.getByToken(tok_trigger, trh); if (trh.isValid()) { LogDebug("") << "TriggerResults found, number of HLT paths: " << trh->size(); diff --git a/Calibration/HcalAlCaRecoProducers/src/AlCaDiJetsProducer.cc b/Calibration/HcalAlCaRecoProducers/src/AlCaDiJetsProducer.cc index 9c23072c6ab2b..68f8314c34740 100644 --- a/Calibration/HcalAlCaRecoProducers/src/AlCaDiJetsProducer.cc +++ b/Calibration/HcalAlCaRecoProducers/src/AlCaDiJetsProducer.cc @@ -2,9 +2,6 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "Geometry/Records/interface/CaloGeometryRecord.h" #include "DataFormats/GeometryVector/interface/GlobalPoint.h" -#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" -#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" -#include "DataFormats/JetReco/interface/CaloJetCollection.h" #include "FWCore/Utilities/interface/Exception.h" using namespace edm; @@ -16,13 +13,18 @@ namespace cms AlCaDiJetsProducer::AlCaDiJetsProducer(const edm::ParameterSet& iConfig) { - jetsInput_ = iConfig.getParameter("jetsInput"); + tok_jets_ = consumes(iConfig.getParameter("jetsInput")); ecalLabels_=iConfig.getParameter >("ecalInputs"); - hbheInput_ = iConfig.getParameter("hbheInput"); - hoInput_ = iConfig.getParameter("hoInput"); - hfInput_ = iConfig.getParameter("hfInput"); + tok_hbhe_ = consumes(iConfig.getParameter("hbheInput")); + tok_ho_ = consumes(iConfig.getParameter("hoInput")); + tok_hf_ = consumes(iConfig.getParameter("hfInput")); allowMissingInputs_ = true; + // fill ecal tokens from input labels + const unsigned nLabels = ecalLabels_.size(); + for ( unsigned i=0; i != nLabels; i++ ) + toks_ecal_.push_back(consumes(ecalLabels_[i])); + //register your products produces("DiJetsBackToBackCollection"); produces("DiJetsEcalRecHitCollection"); @@ -65,7 +67,7 @@ AlCaDiJetsProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) CaloJet fJet1, fJet2, fJet3; edm::Handle jets; - iEvent.getByLabel(jetsInput_, jets); + iEvent.getByToken(tok_jets_, jets); int iflag_select = 0; if(jets->size()>1){ fJet1 = (*jets)[0]; @@ -96,10 +98,10 @@ AlCaDiJetsProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) // Ecal Collections - std::vector::const_iterator i; - for (i=ecalLabels_.begin(); i!=ecalLabels_.end(); i++) { + std::vector >::const_iterator i; + for (i=toks_ecal_.begin(); i!=toks_ecal_.end(); i++) { edm::Handle ec; - iEvent.getByLabel(*i,ec); + iEvent.getByToken(*i,ec); for(EcalRecHitCollection::const_iterator ecItr = (*ec).begin(); ecItr != (*ec).end(); ++ecItr) { @@ -123,7 +125,7 @@ AlCaDiJetsProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) // HB & HE Collections edm::Handle hbhe; - iEvent.getByLabel(hbheInput_,hbhe); + iEvent.getByToken(tok_hbhe_,hbhe); for(HBHERecHitCollection::const_iterator hbheItr=hbhe->begin(); hbheItr!=hbhe->end(); hbheItr++) { @@ -146,7 +148,7 @@ AlCaDiJetsProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) edm::Handle ho; - iEvent.getByLabel(hoInput_,ho); + iEvent.getByToken(tok_ho_,ho); for(HORecHitCollection::const_iterator hoItr=ho->begin(); hoItr!=ho->end(); hoItr++) { @@ -168,7 +170,7 @@ AlCaDiJetsProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) edm::Handle hf; - iEvent.getByLabel(hfInput_,hf); + iEvent.getByToken(tok_hf_,hf); for(HFRecHitCollection::const_iterator hfItr=hf->begin(); hfItr!=hf->end(); hfItr++) { diff --git a/Calibration/HcalAlCaRecoProducers/src/AlCaEcalHcalReadoutsProducer.cc b/Calibration/HcalAlCaRecoProducers/src/AlCaEcalHcalReadoutsProducer.cc index a42e728211dbb..80d72540e8847 100644 --- a/Calibration/HcalAlCaRecoProducers/src/AlCaEcalHcalReadoutsProducer.cc +++ b/Calibration/HcalAlCaRecoProducers/src/AlCaEcalHcalReadoutsProducer.cc @@ -5,9 +5,9 @@ AlCaEcalHcalReadoutsProducer::AlCaEcalHcalReadoutsProducer(const edm::ParameterSet& iConfig) { - hoLabel_ = iConfig.getParameter("hoInput"); - hfLabel_ = iConfig.getParameter("hfInput"); - hbheLabel_ = iConfig.getParameter("hbheInput"); + tok_ho_ = consumes(iConfig.getParameter("hoInput")); + tok_hf_ = consumes(iConfig.getParameter("hfInput")); + tok_hbhe_ = consumes(iConfig.getParameter("hbheInput")); //register your products produces("HBHERecHitCollection"); @@ -34,18 +34,18 @@ AlCaEcalHcalReadoutsProducer::produce(edm::Event& iEvent, const edm::EventSetup& edm::Handle ho; edm::Handle hf; - iEvent.getByLabel(hbheLabel_,hbhe); + iEvent.getByToken(tok_hbhe_,hbhe); if(!hbhe.isValid()){ LogDebug("") << "AlCaEcalHcalReadoutProducer: Error! can't get hbhe product!" << std::endl; return ; } - iEvent.getByLabel(hoLabel_,ho); + iEvent.getByToken(tok_ho_,ho); if(!ho.isValid()) { LogDebug("") << "AlCaEcalHcalReadoutProducer: Error! can't get ho product!" << std::endl; } - iEvent.getByLabel(hfLabel_,hf); + iEvent.getByToken(tok_hf_,hf); if(!hf.isValid()) { LogDebug("") << "AlCaEcalHcalReadoutProducer: Error! can't get hf product!" << std::endl; } diff --git a/Calibration/HcalAlCaRecoProducers/src/AlCaGammaJetProducer.cc b/Calibration/HcalAlCaRecoProducers/src/AlCaGammaJetProducer.cc index 427fa824a0667..a98cac898788b 100644 --- a/Calibration/HcalAlCaRecoProducers/src/AlCaGammaJetProducer.cc +++ b/Calibration/HcalAlCaRecoProducers/src/AlCaGammaJetProducer.cc @@ -2,12 +2,6 @@ #include "DataFormats/DetId/interface/DetId.h" #include "Geometry/Records/interface/CaloGeometryRecord.h" #include "DataFormats/GeometryVector/interface/GlobalPoint.h" -#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" -#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" -#include "TrackingTools/TransientTrack/interface/TransientTrack.h" -#include "DataFormats/JetReco/interface/CaloJetCollection.h" -#include "DataFormats/EgammaReco/interface/SuperCluster.h" -#include "DataFormats/EgammaReco/interface/SuperClusterFwd.h" using namespace edm; using namespace std; @@ -20,16 +14,35 @@ AlCaGammaJetProducer::AlCaGammaJetProducer(const edm::ParameterSet& iConfig) { // Take input - hbheLabel_= iConfig.getParameter("hbheInput"); - hoLabel_=iConfig.getParameter("hoInput"); - hfLabel_=iConfig.getParameter("hfInput"); + tok_hbhe_= consumes(iConfig.getParameter("hbheInput")); + tok_ho_ = consumes(iConfig.getParameter("hoInput")); + tok_hf_ = consumes(iConfig.getParameter("hfInput")); + mInputCalo = iConfig.getParameter >("srcCalo"); ecalLabels_=iConfig.getParameter >("ecalInputs"); - m_inputTrackLabel = iConfig.getUntrackedParameter("inputTrackLabel","generalTracks"); + + unsigned nLabels = mInputCalo.size(); + for ( unsigned i=0; i != nLabels; i++ ) + toks_calo_.push_back( consumes( mInputCalo[i] ) ); + + nLabels = ecalLabels_.size(); + for ( unsigned i=0; i != nLabels; i++ ) + toks_ecal_.push_back( consumes( ecalLabels_[i] ) ); + + + tok_inputTrack_ = consumes(iConfig.getUntrackedParameter("inputTrackLabel","generalTracks")); correctedIslandBarrelSuperClusterCollection_ = iConfig.getParameter("correctedIslandBarrelSuperClusterCollection"); correctedIslandBarrelSuperClusterProducer_ = iConfig.getParameter("correctedIslandBarrelSuperClusterProducer"); + tok_EBSC_ = consumes( + edm::InputTag(correctedIslandBarrelSuperClusterProducer_, + correctedIslandBarrelSuperClusterCollection_)); + correctedIslandEndcapSuperClusterCollection_ = iConfig.getParameter("correctedIslandEndcapSuperClusterCollection"); correctedIslandEndcapSuperClusterProducer_ = iConfig.getParameter("correctedIslandEndcapSuperClusterProducer"); + tok_EESC_ = consumes( + edm::InputTag(correctedIslandEndcapSuperClusterProducer_, + correctedIslandEndcapSuperClusterCollection_)); + allowMissingInputs_=iConfig.getUntrackedParameter("AllowMissingInputs",true); @@ -86,8 +99,7 @@ AlCaGammaJetProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) double vetmax = -100.; Handle pCorrectedIslandBarrelSuperClusters; - iEvent.getByLabel(correctedIslandBarrelSuperClusterProducer_, - correctedIslandBarrelSuperClusterCollection_, + iEvent.getByToken(tok_EBSC_, pCorrectedIslandBarrelSuperClusters); if (!pCorrectedIslandBarrelSuperClusters.isValid()) { // can't find it! @@ -116,8 +128,7 @@ AlCaGammaJetProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) } Handle pCorrectedIslandEndcapSuperClusters; - iEvent.getByLabel(correctedIslandEndcapSuperClusterProducer_, - correctedIslandEndcapSuperClusterCollection_, + iEvent.getByToken(tok_EESC_, pCorrectedIslandEndcapSuperClusters); if (!pCorrectedIslandEndcapSuperClusters.isValid()) { // can't find it! @@ -187,11 +198,11 @@ AlCaGammaJetProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) double phijet0 = -100.; double etajet0 = -100.; - std::vector::const_iterator ic; - for (ic=mInputCalo.begin(); ic!=mInputCalo.end(); ic++) { + std::vector >::const_iterator ic; + for (ic=toks_calo_.begin(); ic!=toks_calo_.end(); ic++) { edm::Handle jets; - iEvent.getByLabel(*ic, jets); + iEvent.getByToken(*ic, jets); if (!jets.isValid()) { // can't find it! if (!allowMissingInputs_) { @@ -260,10 +271,10 @@ AlCaGammaJetProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) // Load EcalRecHits - std::vector::const_iterator i; - for (i=ecalLabels_.begin(); i!=ecalLabels_.end(); i++) { + std::vector >::const_iterator i; + for (i=toks_ecal_.begin(); i!=toks_ecal_.end(); i++) { edm::Handle ec; - iEvent.getByLabel(*i,ec); + iEvent.getByToken(*i,ec); if (!ec.isValid()) { // can't find it! if (!allowMissingInputs_) { @@ -298,7 +309,7 @@ AlCaGammaJetProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) // cout<<" Ecal is done "< hbhe; - iEvent.getByLabel(hbheLabel_,hbhe); + iEvent.getByToken(tok_hbhe_,hbhe); if (!hbhe.isValid()) { // can't find it! if (!allowMissingInputs_) { @@ -330,7 +341,7 @@ AlCaGammaJetProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) // cout<<" HBHE is done "< ho; - iEvent.getByLabel(hoLabel_,ho); + iEvent.getByToken(tok_ho_,ho); if (!ho.isValid()) { // can't find it! if (!allowMissingInputs_) { @@ -362,7 +373,7 @@ AlCaGammaJetProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) // cout<<" HO is done "< hf; - iEvent.getByLabel(hfLabel_,hf); + iEvent.getByToken(tok_hf_,hf); if (!hf.isValid()) { // can't find it! if (!allowMissingInputs_) { @@ -398,7 +409,7 @@ AlCaGammaJetProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) // Track Collection edm::Handle trackCollection; - iEvent.getByLabel(m_inputTrackLabel,trackCollection); + iEvent.getByToken(tok_inputTrack_,trackCollection); if (!trackCollection.isValid()) { // can't find it! if (!allowMissingInputs_) { diff --git a/Calibration/HcalAlCaRecoProducers/src/AlCaHOCalibProducer.cc b/Calibration/HcalAlCaRecoProducers/src/AlCaHOCalibProducer.cc index f6271fc795834..4d790ba90dcc7 100644 --- a/Calibration/HcalAlCaRecoProducers/src/AlCaHOCalibProducer.cc +++ b/Calibration/HcalAlCaRecoProducers/src/AlCaHOCalibProducer.cc @@ -243,11 +243,13 @@ class AlCaHOCalibProducer : public edm::EDProducer { //GM #endif edm::InputTag muonTags_; // cosmicMuons or standAloneMuons - edm::InputTag hbheLabel_; - edm::InputTag hoLabel_; - edm::InputTag hltLabel_; - edm::InputTag l1Label_; - edm::InputTag towerLabel_; + + edm::EDGetTokenT tok_muons_; + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_hlt_; + edm::EDGetTokenT tok_l1_; + edm::EDGetTokenT tok_tower_; bool m_digiInput; // digi (true) or rechit (false) bool m_hbinfo; @@ -292,7 +294,6 @@ class AlCaHOCalibProducer : public edm::EDProducer { // constructors and destructor // AlCaHOCalibProducer::AlCaHOCalibProducer(const edm::ParameterSet& iConfig) - : muonTags_(iConfig.getUntrackedParameter("muons")) { //register your products @@ -310,12 +311,17 @@ AlCaHOCalibProducer::AlCaHOCalibProducer(const edm::ParameterSet& iConfig) if (m_endTS >9) m_endTS=9; m_magscale = iConfig.getUntrackedParameter("m_scale", 4.0); m_sigma = iConfig.getUntrackedParameter("sigma", 1.0); - - hoLabel_ = iConfig.getParameter("hoInput"); - hbheLabel_ = iConfig.getParameter("hbheInput"); - hltLabel_ = iConfig.getParameter("hltInput"); - l1Label_ = iConfig.getParameter("l1Input"); - towerLabel_ = iConfig.getParameter("towerInput"); + + // keep InputTag muonTags_ since it is used below. - cowden + muonTags_ = iConfig.getUntrackedParameter("muons"); + tok_muons_ = consumes(muonTags_); + tok_ho_ = consumes(iConfig.getParameter("hoInput")); + tok_hbhe_ = consumes(iConfig.getParameter("hbheInput")); + tok_tower_ = consumes(iConfig.getParameter("towerInput")); + + // Since these accesses are currently commented out, I put the registration as "mayConsume". - cowden + tok_hlt_ = mayConsume(iConfig.getParameter("hltInput")); + tok_l1_ = mayConsume(iConfig.getParameter("l1Input")); produces("HOCalibVariableCollection").setBranchAlias("HOCalibVariableCollection"); @@ -478,8 +484,8 @@ AlCaHOCalibProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) edm::Handle hbhe; if (m_digiInput) { - iEvent.getByLabel(hoLabel_,ho); - iEvent.getByLabel(hbheLabel_,hbhe); + iEvent.getByToken(tok_ho_,ho); + iEvent.getByToken(tok_hbhe_,hbhe); } if (m_hotime && m_digiInput) { @@ -529,7 +535,7 @@ AlCaHOCalibProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) double pival = acos(-1.); Handle cosmicmuon; - iEvent.getByLabel(muonTags_, cosmicmuon); + iEvent.getByToken(tok_muons_, cosmicmuon); if (cosmicmuon->size()>0) { @@ -541,7 +547,7 @@ AlCaHOCalibProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) /* //L1 trigger Handle L1GTRR; - iEvent.getByLabel(l1Label_,L1GTRR); //gtDigis + iEvent.getByToken(tok_l1_,L1GTRR); //gtDigis if ( L1GTRR.isValid()) { const unsigned int n(L1GTRR->decisionWord().size()); @@ -558,7 +564,7 @@ AlCaHOCalibProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) //HLT Handle trigRes; - iEvent.getByLabel(hltLabel_, trigRes); + iEvent.getByToken(tok_hlt_, trigRes); unsigned int size = trigRes->size(); @@ -667,7 +673,7 @@ AlCaHOCalibProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) if (muonTags_.label() =="standAloneMuons") { Handle calotower; - iEvent.getByLabel(towerLabel_, calotower); + iEvent.getByToken(tok_tower_, calotower); for (CaloTowerCollection::const_iterator calt = calotower->begin(); calt !=calotower->end(); calt++) { @@ -917,7 +923,7 @@ AlCaHOCalibProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) } else { edm::Handle hbheht;// iEvent.getByType(hbheht); - iEvent.getByLabel(hbheLabel_,hbheht); + iEvent.getByToken(tok_hbhe_,hbheht); if ((*hbheht).size()>0) { @@ -1153,7 +1159,7 @@ AlCaHOCalibProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) } } else { edm::Handle hoht; - iEvent.getByLabel(hoLabel_,hoht); + iEvent.getByToken(tok_ho_,hoht); if ((*hoht).size()>0) { diff --git a/Calibration/HcalAlCaRecoProducers/src/AlCaHcalNoiseProducer.cc b/Calibration/HcalAlCaRecoProducers/src/AlCaHcalNoiseProducer.cc index 3139db1489d7d..075e7010ba0d9 100644 --- a/Calibration/HcalAlCaRecoProducers/src/AlCaHcalNoiseProducer.cc +++ b/Calibration/HcalAlCaRecoProducers/src/AlCaHcalNoiseProducer.cc @@ -10,20 +10,15 @@ Calibration/HcalIsolatedTrackReco/src/SubdetFEDSelector.cc #include "Calibration/HcalAlCaRecoProducers/interface/AlCaHcalNoiseProducer.h" -#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" -#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" #include "DataFormats/FEDRawData/interface/FEDRawData.h" #include "DataFormats/FEDRawData/interface/FEDNumbering.h" #include "EventFilter/RawDataCollector/interface/RawDataFEDSelector.h" -#include "DataFormats/CaloTowers/interface/CaloTowerCollection.h" #include "DataFormats/CaloTowers/interface/CaloTower.h" -#include "DataFormats/JetReco/interface/CaloJetCollection.h" #include "DataFormats/JetReco/interface/CaloJet.h" #include "DataFormats/METReco/interface/CaloMET.h" -#include "DataFormats/METReco/interface/CaloMETCollection.h" #include "DataFormats/Math/interface/deltaR.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" @@ -31,21 +26,25 @@ Calibration/HcalIsolatedTrackReco/src/SubdetFEDSelector.cc AlCaHcalNoiseProducer::AlCaHcalNoiseProducer(const edm::ParameterSet& iConfig) { - JetSource_ = iConfig.getParameter("JetSource"); - MetSource_ = iConfig.getParameter("MetSource"); - TowerSource_ = iConfig.getParameter("TowerSource"); + tok_jets_ = consumes(iConfig.getParameter("JetSource")); + tok_met_ = consumes(iConfig.getParameter("MetSource")); + tok_tower_ = consumes(iConfig.getParameter("TowerSource")); useMet_ = iConfig.getParameter("UseMET"); useJet_ = iConfig.getParameter("UseJet"); MetCut_ = iConfig.getParameter("MetCut"); JetMinE_ = iConfig.getParameter("JetMinE"); JetHCALminEnergyFraction_ = iConfig.getParameter("JetHCALminEnergyFraction"); - hoLabel_ = iConfig.getParameter("hoInput"); - hfLabel_ = iConfig.getParameter("hfInput"); - hbheLabel_ = iConfig.getParameter("hbheInput"); + tok_ho_ = consumes(iConfig.getParameter("hoInput")); + tok_hf_ = consumes(iConfig.getParameter("hfInput")); + tok_hbhe_ = consumes(iConfig.getParameter("hbheInput")); ecalLabels_= iConfig.getParameter >("ecalInputs"); - ecalPSLabel_=iConfig.getParameter("ecalPSInput"); - rawInLabel_=iConfig.getParameter("rawInput"); + tok_ps_ = consumes(iConfig.getParameter("ecalPSInput")); + tok_raw_ = consumes(iConfig.getParameter("rawInput")); + + const unsigned nLabels = ecalLabels_.size(); + for( unsigned i=0; i != nLabels; i++ ) + toks_ecal_.push_back( consumes(ecalLabels_[i]) ); //register products @@ -80,7 +79,7 @@ AlCaHcalNoiseProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup if (useMet_) { edm::Handle metHandle; - iEvent.getByLabel(MetSource_, metHandle); + iEvent.getByToken(tok_met_, metHandle); const reco::CaloMETCollection *metCol = metHandle.product(); const reco::CaloMET met = metCol->front(); @@ -90,10 +89,10 @@ AlCaHcalNoiseProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup if (useJet_) { edm::Handle calojetHandle; - iEvent.getByLabel(JetSource_,calojetHandle); + iEvent.getByToken(tok_jets_,calojetHandle); edm::Handle towerHandle; - iEvent.getByLabel(TowerSource_, towerHandle); + iEvent.getByToken(tok_tower_, towerHandle); std::vector TowerContainer; std::vector JetContainer; @@ -145,22 +144,22 @@ AlCaHcalNoiseProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup edm::Handle ho; edm::Handle hf; - iEvent.getByLabel(hbheLabel_,hbhe); - iEvent.getByLabel(hoLabel_,ho); - iEvent.getByLabel(hfLabel_,hf); + iEvent.getByToken(tok_hbhe_,hbhe); + iEvent.getByToken(tok_ho_,ho); + iEvent.getByToken(tok_hf_,hf); edm::Handle pRecHits; - iEvent.getByLabel(ecalPSLabel_,pRecHits); + iEvent.getByToken(tok_ps_,pRecHits); // temporary collection of EB+EE recHits std::auto_ptr tmpEcalRecHitCollection(new EcalRecHitCollection); - std::vector::const_iterator i; - for (i=ecalLabels_.begin(); i!=ecalLabels_.end(); i++) + std::vector >::const_iterator i; + for (i=toks_ecal_.begin(); i!=toks_ecal_.end(); i++) { edm::Handle ec; - iEvent.getByLabel(*i,ec); + iEvent.getByToken(*i,ec); for(EcalRecHitCollection::const_iterator recHit = (*ec).begin(); recHit != (*ec).end(); ++recHit) { tmpEcalRecHitCollection->push_back(*recHit); @@ -206,7 +205,7 @@ AlCaHcalNoiseProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup // get HCAL FEDs edm::Handle rawIn; - iEvent.getByLabel(rawInLabel_,rawIn); + iEvent.getByToken(tok_raw_,rawIn); std::vector selFEDs; for (int i=FEDNumbering::MINHCALFEDID; i<=FEDNumbering::MAXHCALFEDID; i++) diff --git a/Calibration/HcalAlCaRecoProducers/src/AlCaIsoTracksProducer.cc b/Calibration/HcalAlCaRecoProducers/src/AlCaIsoTracksProducer.cc index 79075abcb3ed7..aefb3108741d7 100644 --- a/Calibration/HcalAlCaRecoProducers/src/AlCaIsoTracksProducer.cc +++ b/Calibration/HcalAlCaRecoProducers/src/AlCaIsoTracksProducer.cc @@ -28,8 +28,6 @@ #include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidate.h" #include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidateFwd.h" -#include "DataFormats/HLTReco/interface/TriggerEvent.h" - #include "DataFormats/EcalDetId/interface/EBDetId.h" #include "DataFormats/EcalDetId/interface/EEDetId.h" @@ -71,13 +69,13 @@ double getDist(double eta1, double phi1, double eta2, double phi2) return dr; } -bool checkHLTMatch(edm::Event& iEvent, edm::InputTag hltEventTag_, std::vector hltFilterTag_, double eta, double phi, double hltMatchingCone_) +bool checkHLTMatch(edm::Event& iEvent, edm::EDGetTokenT &hltToken, std::vector hltFilterTag_, double eta, double phi, double hltMatchingCone_) { bool match =false; double minDDD=1000; edm::Handle trEv; - iEvent.getByLabel(hltEventTag_,trEv); + iEvent.getByToken(hltToken,trEv); const trigger::TriggerObjectCollection& TOCol(trEv->getObjects()); trigger::Keys KEYS; @@ -105,10 +103,10 @@ bool checkHLTMatch(edm::Event& iEvent, edm::InputTag hltEventTag_, std::vector getL1triggerDirection(edm::Event& iEvent, edm::InputTag hltEventTag_, std::string l1FilterTag_) +std::pair getL1triggerDirection(edm::Event& iEvent, edm::EDGetTokenT &hltToken, std::string l1FilterTag_) { edm::Handle trEv; - iEvent.getByLabel(hltEventTag_,trEv); + iEvent.getByToken(hltToken,trEv); const trigger::TriggerObjectCollection& TOCol(trEv->getObjects()); trigger::Keys KEYS; @@ -138,13 +136,18 @@ std::pair getL1triggerDirection(edm::Event& iEvent, edm::InputTag AlCaIsoTracksProducer::AlCaIsoTracksProducer(const edm::ParameterSet& iConfig) { - m_inputTrackLabel_ = iConfig.getParameter("InputTracksLabel"); + tok_track_ = consumes(iConfig.getParameter("InputTracksLabel")); - hoLabel_ = iConfig.getParameter("HOInput"); + tok_ho_ = consumes(iConfig.getParameter("HOInput")); ecalLabels_=iConfig.getParameter >("ECALInputs"); + const unsigned nLabels = ecalLabels_.size(); + for ( unsigned i=0; i != nLabels; i++ ) + toks_ecal_.push_back( consumes(ecalLabels_[i]) ); + + tok_ps_ = consumes(edm::InputTag("ecalPreshowerRecHit","EcalRecHitsES")); - hbheLabel_= iConfig.getParameter("HBHEInput"); + tok_hbhe_ = consumes(iConfig.getParameter("HBHEInput")); m_dvCut = iConfig.getParameter("vtxCut"); m_ddirCut = iConfig.getParameter("RIsolAtHCALSurface"); @@ -171,7 +174,7 @@ AlCaIsoTracksProducer::AlCaIsoTracksProducer(const edm::ParameterSet& iConfig) matrixSize_=iConfig.getParameter("ECALMatrixFullSize"); checkHLTMatch_=iConfig.getParameter("CheckHLTMatch"); - hltEventTag_=iConfig.getParameter("hltTriggerEventLabel"); + tok_hlt_ = consumes(iConfig.getParameter("hltTriggerEventLabel")); hltFiltTag_=iConfig.getParameter >("hltL3FilterLabels"); hltMatchingCone_=iConfig.getParameter("hltMatchingCone"); l1FilterTag_=iConfig.getParameter("l1FilterLabel"); @@ -221,17 +224,17 @@ void AlCaIsoTracksProducer::produce(edm::Event& iEvent, const edm::EventSetup& i geo = pG.product(); edm::Handle trackCollection; - iEvent.getByLabel(m_inputTrackLabel_,trackCollection); + iEvent.getByToken(tok_track_,trackCollection); // temporary collection of EB+EE recHits std::auto_ptr tmpEcalRecHitCollection(new EcalRecHitCollection); - std::vector::const_iterator i; - for (i=ecalLabels_.begin(); i!=ecalLabels_.end(); i++) + std::vector >::const_iterator i; + for (i=toks_ecal_.begin(); i!=toks_ecal_.end(); i++) { edm::Handle ec; - iEvent.getByLabel(*i,ec); + iEvent.getByToken(*i,ec); for(EcalRecHitCollection::const_iterator recHit = (*ec).begin(); recHit != (*ec).end(); ++recHit) { tmpEcalRecHitCollection->push_back(*recHit); @@ -239,7 +242,7 @@ void AlCaIsoTracksProducer::produce(edm::Event& iEvent, const edm::EventSetup& i } edm::Handle hbheRHcol; - iEvent.getByLabel(hbheLabel_, hbheRHcol); + iEvent.getByToken(tok_hbhe_, hbheRHcol); const reco::TrackCollection tC = *(trackCollection.product()); @@ -280,7 +283,7 @@ void AlCaIsoTracksProducer::produce(edm::Event& iEvent, const edm::EventSetup& i if (track->hitPattern().numberOfValidHits() < nHitsMinCore_) continue; // check that track is not in the region of L1 jet - double l1jDR=deltaR(track->eta(), track->phi(), getL1triggerDirection(iEvent,hltEventTag_,l1FilterTag_).first,getL1triggerDirection(iEvent,hltEventTag_,l1FilterTag_).second); + double l1jDR=deltaR(track->eta(), track->phi(), getL1triggerDirection(iEvent,tok_hlt_,l1FilterTag_).first,getL1triggerDirection(iEvent,tok_hlt_,l1FilterTag_).second); if (l1jDReta())>etaMax_) continue; @@ -514,7 +517,7 @@ void AlCaIsoTracksProducer::produce(edm::Event& iEvent, const edm::EventSetup& i { // Take HO collection edm::Handle ho; - iEvent.getByLabel(hoLabel_,ho); + iEvent.getByToken(tok_ho_,ho); const HORecHitCollection Hitho = *(ho.product()); for(HORecHitCollection::const_iterator hoItr=Hitho.begin(); hoItr!=Hitho.end(); hoItr++) @@ -533,7 +536,7 @@ void AlCaIsoTracksProducer::produce(edm::Event& iEvent, const edm::EventSetup& i // process rechits edm::Handle pRecHits; - iEvent.getByLabel("ecalPreshowerRecHit","EcalRecHitsES",pRecHits); + iEvent.getByToken(tok_ps_,pRecHits); const EcalRecHitCollection& psrechits = *(pRecHits.product()); typedef EcalRecHitCollection::const_iterator IT; diff --git a/Calibration/HcalAlCaRecoProducers/src/ProducerAnalyzer.cc b/Calibration/HcalAlCaRecoProducers/src/ProducerAnalyzer.cc index 3a9bb41f2c40f..d559c07b820cb 100644 --- a/Calibration/HcalAlCaRecoProducers/src/ProducerAnalyzer.cc +++ b/Calibration/HcalAlCaRecoProducers/src/ProducerAnalyzer.cc @@ -4,21 +4,13 @@ #include "Calibration/HcalAlCaRecoProducers/src/ProducerAnalyzer.h" #include "FWCore/Common/interface/Provenance.h" -#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" -#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" -#include "DataFormats/JetReco/interface/CaloJetCollection.h" #include "DataFormats/MuonReco/interface/MuonFwd.h" #include "DataFormats/MuonReco/interface/Muon.h" #include "TrackingTools/TransientTrack/interface/TransientTrack.h" -#include "DataFormats/EgammaReco/interface/SuperCluster.h" -#include "DataFormats/EgammaReco/interface/SuperClusterFwd.h" -#include "DataFormats/TrackReco/interface/Track.h" -#include "DataFormats/TrackReco/interface/TrackFwd.h" #include "Geometry/Records/interface/CaloGeometryRecord.h" #include "Geometry/CaloGeometry/interface/CaloGeometry.h" #include "DataFormats/GeometryVector/interface/GlobalPoint.h" #include "DataFormats/HcalCalibObjects/interface/HOCalibVariables.h" -#include "DataFormats/HcalCalibObjects/interface/HOCalibVariableCollection.h" #include "DataFormats/TrackReco/interface/TrackExtra.h" #include "DataFormats/TrackReco/interface/TrackExtraFwd.h" #include "RecoTracker/TrackProducer/interface/TrackProducerBase.h" @@ -47,6 +39,21 @@ ProducerAnalyzer::ProducerAnalyzer(const edm::ParameterSet& iConfig) hfInput_ = iConfig.getUntrackedParameter("hfInput"); Tracks_ = iConfig.getUntrackedParameter("Tracks","GammaJetTracksCollection"); + tok_hovar_ = consumes( edm::InputTag(nameProd_,hoInput_) ); + tok_horeco_ = consumes( edm::InputTag("horeco") ); + tok_ho_ = consumes( edm::InputTag(hoInput_) ); + tok_hoProd_ = consumes( edm::InputTag(nameProd_,hoInput_) ); + + tok_hf_ = consumes( edm::InputTag(hfInput_) ); + + tok_jets_ = consumes( edm::InputTag(nameProd_,jetCalo_) ); + tok_gamma_ = consumes( edm::InputTag(nameProd_,gammaClus_) ); + tok_ecal_ = consumes( edm::InputTag(nameProd_,ecalInput_) ); + tok_tracks_ = consumes( edm::InputTag(nameProd_,Tracks_) ); + + tok_hbheProd_ = consumes( edm::InputTag(nameProd_,hbheInput_) ); + tok_hbhe_ = consumes( edm::InputTag(hbheInput_) ); + } ProducerAnalyzer::~ProducerAnalyzer() @@ -96,7 +103,7 @@ ProducerAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetu if(nameProd_ == "hoCalibProducer") { edm::Handle ho; - iEvent.getByLabel(nameProd_,hoInput_, ho); + iEvent.getByToken(tok_hovar_, ho); const HOCalibVariableCollection Hitho = *(ho.product()); std::cout<<" Size of HO "<<(Hitho).size()< ho; - iEvent.getByLabel("horeco", ho); + iEvent.getByToken(tok_horeco_, ho); const HORecHitCollection Hitho = *(ho.product()); std::cout<<" Size of HO "<<(Hitho).size()< mucand; @@ -122,19 +129,19 @@ ProducerAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetu if(nameProd_ != "IsoProd" && nameProd_ != "ALCARECOMuAlZMuMu" && nameProd_ != "hoCalibProducer") { edm::Handle hbhe; - iEvent.getByLabel(hbheInput_, hbhe); + iEvent.getByToken(tok_hbhe_, hbhe); const HBHERecHitCollection Hithbhe = *(hbhe.product()); std::cout<<" Size of HBHE "<<(Hithbhe).size()< ho; - iEvent.getByLabel(hoInput_, ho); + iEvent.getByToken(tok_ho_, ho); const HORecHitCollection Hitho = *(ho.product()); std::cout<<" Size of HO "<<(Hitho).size()< hf; - iEvent.getByLabel(hfInput_, hf); + iEvent.getByToken(tok_hf_, hf); const HFRecHitCollection Hithf = *(hf.product()); std::cout<<" Size of HF "<<(Hithf).size()< tracks; - iEvent.getByLabel(nameProd_,Tracks_,tracks); + iEvent.getByToken(tok_tracks_,tracks); std::cout<<" Tracks size "<<(*tracks).size()< ecal; - iEvent.getByLabel(nameProd_,ecalInput_,ecal); + iEvent.getByToken(tok_ecal_,ecal); const EcalRecHitCollection Hitecal = *(ecal.product()); std::cout<<" Size of Ecal "<<(Hitecal).size()<begin (); @@ -183,7 +190,7 @@ ProducerAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetu } edm::Handle hbhe; - iEvent.getByLabel(nameProd_,hbheInput_,hbhe); + iEvent.getByToken(tok_hbheProd_,hbhe); const HBHERecHitCollection Hithbhe = *(hbhe.product()); std::cout<<" Size of HBHE "<<(Hithbhe).size()<begin (); @@ -203,7 +210,7 @@ ProducerAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetu cout<<" Energy ECAL "<< energyECAL<<" Energy HCAL "<< energyHCAL< ho; - iEvent.getByLabel(nameProd_,hoInput_,ho); + iEvent.getByToken(tok_hoProd_,ho); const HORecHitCollection Hitho = *(ho.product()); std::cout<<" Size of HO "<<(Hitho).size()<begin (); @@ -221,11 +228,11 @@ ProducerAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetu { cout<<" we are in GammaJetProd area "< ecal; - iEvent.getByLabel(nameProd_,ecalInput_, ecal); + iEvent.getByToken(tok_ecal_, ecal); std::cout<<" Size of ECAL "<<(*ecal).size()< jets; - iEvent.getByLabel(nameProd_,jetCalo_, jets); + iEvent.getByToken(tok_jets_, jets); std::cout<<" Jet size "<<(*jets).size()<begin (); for (; jet != jets->end (); jet++) @@ -234,13 +241,13 @@ ProducerAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetu } edm::Handle tracks; - iEvent.getByLabel(nameProd_,Tracks_, tracks); + iEvent.getByToken(tok_tracks_, tracks); std::cout<<" Tracks size "<<(*tracks).size()< eclus; - iEvent.getByLabel(nameProd_,gammaClus_, eclus); + iEvent.getByToken(tok_gamma_, eclus); std::cout<<" GammaClus size "<<(*eclus).size()<begin (); for (; iclus != eclus->end (); iclus++) diff --git a/Calibration/HcalAlCaRecoProducers/src/ProducerAnalyzer.h b/Calibration/HcalAlCaRecoProducers/src/ProducerAnalyzer.h index 765eab9c93cb7..1a0194a2e5eac 100644 --- a/Calibration/HcalAlCaRecoProducers/src/ProducerAnalyzer.h +++ b/Calibration/HcalAlCaRecoProducers/src/ProducerAnalyzer.h @@ -15,6 +15,17 @@ #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +// collections +#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" +#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" +#include "DataFormats/JetReco/interface/CaloJetCollection.h" +#include "DataFormats/HcalCalibObjects/interface/HOCalibVariableCollection.h" +#include "DataFormats/EgammaReco/interface/SuperCluster.h" +#include "DataFormats/EgammaReco/interface/SuperClusterFwd.h" +#include "DataFormats/TrackReco/interface/Track.h" +#include "DataFormats/TrackReco/interface/TrackFwd.h" + + namespace edm { class ParameterSet; class Event; @@ -47,6 +58,22 @@ class ProducerAnalyzer : public edm::EDAnalyzer { std::string hoInput_; std::string hfInput_; std::string Tracks_; + + edm::EDGetTokenT tok_hovar_; + edm::EDGetTokenT tok_horeco_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_hoProd_; + + edm::EDGetTokenT tok_hf_; + + edm::EDGetTokenT tok_jets_; + edm::EDGetTokenT tok_gamma_; + edm::EDGetTokenT tok_ecal_; + edm::EDGetTokenT tok_tracks_; + + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_hbheProd_; + }; }// end namespace cms #endif diff --git a/Calibration/HcalCalibAlgos/interface/Analyzer_minbias.h b/Calibration/HcalCalibAlgos/interface/Analyzer_minbias.h index b3f8d1fe6912d..7ef8fa1dd582b 100644 --- a/Calibration/HcalCalibAlgos/interface/Analyzer_minbias.h +++ b/Calibration/HcalCalibAlgos/interface/Analyzer_minbias.h @@ -30,6 +30,7 @@ #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/Run.h" +#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h" //#include "CalibFormats/HcalObjects/interface/HcalDbService.h" #include "TFile.h" #include "TH1.h" @@ -123,14 +124,18 @@ class Analyzer_minbias : public edm::EDAnalyzer { double theDFFillDetMapMin1[5][5][73][43]; double theDFFillDetMapMin2[5][5][73][43]; - edm::InputTag hbherecoMB; - edm::InputTag horecoMB; - edm::InputTag hfrecoMB; - - edm::InputTag hbherecoNoise; - edm::InputTag horecoNoise; - edm::InputTag hfrecoNoise; + + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_hf_; + edm::EDGetTokenT tok_hbheNoise_; + edm::EDGetTokenT tok_hoNoise_; + edm::EDGetTokenT tok_hfNoise_; + + // + edm::EDGetTokenT tok_gtRec_; + edm::EDGetTokenT tok_hbheNorm_; bool theRecalib; diff --git a/Calibration/HcalCalibAlgos/interface/DiJetAnalyzer.h b/Calibration/HcalCalibAlgos/interface/DiJetAnalyzer.h index 2e2617ac687c3..fc4c7a2b5642f 100644 --- a/Calibration/HcalCalibAlgos/interface/DiJetAnalyzer.h +++ b/Calibration/HcalCalibAlgos/interface/DiJetAnalyzer.h @@ -21,6 +21,12 @@ #include "CondFormats/HcalObjects/interface/HcalRespCorrs.h" +// collections +#include "DataFormats/JetReco/interface/CaloJetCollection.h" +#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" +#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" +#include "DataFormats/CaloTowers/interface/CaloTowerCollection.h" + /* #include "TFile.h" #include "TTree.h" @@ -56,11 +62,11 @@ class DiJetAnalyzer : public edm::EDAnalyzer { // ----------member data --------------------------- - edm::InputTag jets_; - edm::InputTag ec_; - edm::InputTag hbhe_; - edm::InputTag ho_; - edm::InputTag hf_; + edm::EDGetTokenT tok_jets_; + edm::EDGetTokenT tok_ec_; + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_hf_; diff --git a/Calibration/HcalCalibAlgos/plugins/HcalCorrPFCalculation.cc b/Calibration/HcalCalibAlgos/plugins/HcalCorrPFCalculation.cc index 1449083cac189..88626c5386407 100755 --- a/Calibration/HcalCalibAlgos/plugins/HcalCorrPFCalculation.cc +++ b/Calibration/HcalCalibAlgos/plugins/HcalCorrPFCalculation.cc @@ -104,16 +104,28 @@ class HcalCorrPFCalculation : public edm::EDAnalyzer { Int_t nTracks; Float_t genEta,genPhi, trackEta[50],trackPhi[50], trackP[50] , delRmc[50]; - edm::InputTag hbheRecHitCollectionTag_; - edm::InputTag hfRecHitCollectionTag_; - edm::InputTag hoRecHitCollectionTag_; + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_hf_; + + edm::EDGetTokenT tok_EE_; + edm::EDGetTokenT tok_EB_; + edm::EDGetTokenT tok_tracks_; + edm::EDGetTokenT tok_gen_; }; -HcalCorrPFCalculation::HcalCorrPFCalculation(edm::ParameterSet const& iConfig) : - hbheRecHitCollectionTag_(iConfig.getParameter("hbheRecHitCollectionTag")), - hfRecHitCollectionTag_(iConfig.getParameter("hfRecHitCollectionTag")), - hoRecHitCollectionTag_(iConfig.getParameter("hoRecHitCollectionTag")) { +HcalCorrPFCalculation::HcalCorrPFCalculation(edm::ParameterSet const& iConfig) { + + tok_hbhe_ = consumes(iConfig.getParameter("hbheRecHitCollectionTag")); + tok_hf_ = consumes(iConfig.getParameter("hfRecHitCollectionTag")); + tok_ho_ = consumes(iConfig.getParameter("hoRecHitCollectionTag")); + + // should maybe add these options to configuration - cowden + tok_EE_ = consumes( edm::InputTag("ecalRecHit","EcalRecHitsEE") ); + tok_EB_ = consumes( edm::InputTag("ecalRecHit","EcalRecHitsEB") ); + tok_tracks_ = consumes( edm::InputTag("generalTracks") ); + tok_gen_ = consumes( edm::InputTag("generator") ); // outputFile_ = iConfig.getUntrackedParameter("outputFile", "myfile.root"); @@ -174,23 +186,23 @@ void HcalCorrPFCalculation::analyze(edm::Event const& ev, edm::EventSetup const& } edm::Handle hbhe; - ev.getByLabel(hbheRecHitCollectionTag_, hbhe); + ev.getByToken(tok_hbhe_, hbhe); const HBHERecHitCollection Hithbhe = *(hbhe.product()); edm::Handle hfcoll; - ev.getByLabel(hfRecHitCollectionTag_, hfcoll); + ev.getByToken(tok_hf_, hfcoll); const HFRecHitCollection Hithf = *(hfcoll.product()); edm::Handle hocoll; - ev.getByLabel(hoRecHitCollectionTag_, hocoll); + ev.getByToken(tok_ho_, hocoll); const HORecHitCollection Hitho = *(hocoll.product()); edm::Handle ecalEE; - ev.getByLabel("ecalRecHit","EcalRecHitsEE",ecalEE); + ev.getByToken(tok_EE_,ecalEE); const EERecHitCollection HitecalEE = *(ecalEE.product()); edm::Handle ecalEB; - ev.getByLabel("ecalRecHit","EcalRecHitsEB",ecalEB); + ev.getByToken(tok_EB_,ecalEB); const EBRecHitCollection HitecalEB = *(ecalEB.product()); // temporary collection of EB+EE recHits @@ -203,7 +215,7 @@ void HcalCorrPFCalculation::analyze(edm::Event const& ev, edm::EventSetup const& edm::Handle generalTracks; - ev.getByLabel("generalTracks", generalTracks); + ev.getByToken(tok_tracks_, generalTracks); edm::ESHandle pG; c.get().get(pG); @@ -250,7 +262,7 @@ void HcalCorrPFCalculation::analyze(edm::Event const& ev, edm::EventSetup const& edm::Handle evtMC; // ev.getByLabel("VtxSmeared",evtMC); - ev.getByLabel("generator",evtMC); + ev.getByToken(tok_gen_,evtMC); if (!evtMC.isValid()) { std::cout << "no HepMCProduct found" << std::endl; diff --git a/Calibration/HcalCalibAlgos/plugins/ValidIsoTrkCalib.cc b/Calibration/HcalCalibAlgos/plugins/ValidIsoTrkCalib.cc index c69c05263c084..34fb1029747c7 100644 --- a/Calibration/HcalCalibAlgos/plugins/ValidIsoTrkCalib.cc +++ b/Calibration/HcalCalibAlgos/plugins/ValidIsoTrkCalib.cc @@ -88,14 +88,16 @@ class ValidIsoTrkCalib : public edm::EDAnalyzer { double taHCALCone_; const CaloGeometry* geo; - InputTag genTracksLabel_; - InputTag genhbheLabel_; + // nothing is done with these tags, so I leave it - cowden + InputTag genhbheLabel_; InputTag genhoLabel_; std::vector genecalLabel_; - InputTag hbheLabel_; - InputTag hoLabel_; - InputTag trackLabel_; - InputTag trackLabel1_; + + edm::EDGetTokenT tok_genTrack_; + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_track_; + edm::EDGetTokenT tok_track1_; //std::string m_inputTrackLabel; //std::string m_hcalLabel; @@ -201,18 +203,18 @@ ValidIsoTrkCalib::ValidIsoTrkCalib(const edm::ParameterSet& iConfig) //takeAllRecHits_=iConfig.getUntrackedParameter("takeAllRecHits"); takeGenTracks_=iConfig.getUntrackedParameter("takeGenTracks"); - genTracksLabel_ = iConfig.getParameter("genTracksLabel"); + tok_genTrack_ = consumes(iConfig.getParameter("genTracksLabel")); genhbheLabel_= iConfig.getParameter("genHBHE"); //genhoLabel_=iConfig.getParameter("genHO"); //genecalLabel_=iConfig.getParameter >("genECAL"); // m_hcalLabel = iConfig.getUntrackedParameter ("hcalRecHitsLabel","hbhereco"); - hbheLabel_= iConfig.getParameter("hbheInput"); - hoLabel_=iConfig.getParameter("hoInput"); + tok_hbhe_ = consumes(iConfig.getParameter("hbheInput")); + tok_ho_ = consumes(iConfig.getParameter("hoInput")); //eLabel_=iConfig.getParameter("eInput"); - trackLabel_ = iConfig.getParameter("HcalIsolTrackInput"); - trackLabel1_ = iConfig.getParameter("trackInput"); + tok_track_ = consumes(iConfig.getParameter("HcalIsolTrackInput")); + tok_track1_ = consumes(iConfig.getParameter("trackInput")); associationConeSize_=iConfig.getParameter("associationConeSize"); allowMissingInputs_=iConfig.getUntrackedParameter("allowMissingInputs", true); @@ -267,15 +269,15 @@ ValidIsoTrkCalib::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetu } edm::Handle generalTracks; - iEvent.getByLabel(genTracksLabel_, generalTracks); + iEvent.getByToken(tok_genTrack_, generalTracks); edm::Handle isoProdTracks; - iEvent.getByLabel(trackLabel1_,isoProdTracks); + iEvent.getByToken(tok_track1_,isoProdTracks); edm::Handle isoPixelTracks; //edm::Handle isoPixelTracks; - iEvent.getByLabel(trackLabel_,isoPixelTracks); + iEvent.getByToken(tok_track_,isoPixelTracks); /* edm::Handle ecal; @@ -284,7 +286,7 @@ ValidIsoTrkCalib::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetu */ edm::Handle hbhe; - iEvent.getByLabel(hbheLabel_,hbhe); + iEvent.getByToken(tok_hbhe_,hbhe); const HBHERecHitCollection Hithbhe = *(hbhe.product()); edm::ESHandle pG; diff --git a/Calibration/HcalCalibAlgos/plugins/ValidationHcalIsoTrackAlCaReco.cc b/Calibration/HcalCalibAlgos/plugins/ValidationHcalIsoTrackAlCaReco.cc index 8ecb46a217b56..559d1969a94c4 100644 --- a/Calibration/HcalCalibAlgos/plugins/ValidationHcalIsoTrackAlCaReco.cc +++ b/Calibration/HcalCalibAlgos/plugins/ValidationHcalIsoTrackAlCaReco.cc @@ -127,15 +127,16 @@ std::pair ValidationHcalIsoTrackAlCaReco::towerIndex(double eta, double } -ValidationHcalIsoTrackAlCaReco::ValidationHcalIsoTrackAlCaReco(const edm::ParameterSet& iConfig) : - simTracksTag_(iConfig.getParameter("simTracksTag")) -{ +ValidationHcalIsoTrackAlCaReco::ValidationHcalIsoTrackAlCaReco(const edm::ParameterSet& iConfig) { + + tok_simTrack_ = consumes(iConfig.getParameter("simTracksTag")); + folderName_ = iConfig.getParameter("folderName"); saveToFile_=iConfig.getParameter("saveToFile"); outRootFileName_=iConfig.getParameter("outputRootFileName"); - hltEventTag_=iConfig.getParameter("hltTriggerEventLabel"); + tok_hlt_ = consumes(iConfig.getParameter("hltTriggerEventLabel")); hltFilterTag_=iConfig.getParameter("hltL3FilterLabel"); - arITrLabel_=iConfig.getParameter("alcarecoIsoTracksLabel"); + tok_arITr_ = consumes(iConfig.getParameter("alcarecoIsoTracksLabel")); recoTrLabel_=iConfig.getParameter("recoTracksLabel"); pThr_=iConfig.getUntrackedParameter("pThrL3",0); heLow_=iConfig.getUntrackedParameter("lowerHighEnergyCut",40); @@ -153,10 +154,10 @@ void ValidationHcalIsoTrackAlCaReco::analyze(const edm::Event& iEvent, const edm nTotal++; edm::Handle trEv; - iEvent.getByLabel(hltEventTag_,trEv); + iEvent.getByToken(tok_hlt_,trEv); edm::Handle recoIsoTracks; - iEvent.getByLabel(arITrLabel_,recoIsoTracks); + iEvent.getByToken(tok_arITr_,recoIsoTracks); const trigger::TriggerObjectCollection& TOCol(trEv->getObjects()); @@ -250,7 +251,7 @@ void ValidationHcalIsoTrackAlCaReco::analyze(const edm::Event& iEvent, const edm std::cout << std::endl << " End / Start " << std::endl; edm::Handle simTracks; - iEvent.getByLabel(simTracksTag_, simTracks); + iEvent.getByToken(tok_simTrack_, simTracks); for (reco::IsolatedPixelTrackCandidateCollection::const_iterator bll=recoIsoTracks->begin(); bll!=recoIsoTracks->end(); bll++) { diff --git a/Calibration/HcalCalibAlgos/plugins/ValidationHcalIsoTrackAlCaReco.h b/Calibration/HcalCalibAlgos/plugins/ValidationHcalIsoTrackAlCaReco.h index 6cf54b71a763d..b015eacd97441 100644 --- a/Calibration/HcalCalibAlgos/plugins/ValidationHcalIsoTrackAlCaReco.h +++ b/Calibration/HcalCalibAlgos/plugins/ValidationHcalIsoTrackAlCaReco.h @@ -87,11 +87,13 @@ class ValidationHcalIsoTrackAlCaReco : public edm::EDAnalyzer { std::string folderName_; bool saveToFile_; std::string outRootFileName_; - edm::InputTag hltEventTag_; edm::InputTag hltFilterTag_; - edm::InputTag arITrLabel_; edm::InputTag recoTrLabel_; - edm::InputTag simTracksTag_; + + edm::EDGetTokenT tok_hlt_; + edm::EDGetTokenT tok_arITr_; + edm::EDGetTokenT tok_simTrack_; + double pThr_; double heLow_; double heUp_; diff --git a/Calibration/HcalCalibAlgos/src/Analyzer_minbias.cc b/Calibration/HcalCalibAlgos/src/Analyzer_minbias.cc index ce0e5d187348a..a35d62507f30f 100644 --- a/Calibration/HcalCalibAlgos/src/Analyzer_minbias.cc +++ b/Calibration/HcalCalibAlgos/src/Analyzer_minbias.cc @@ -11,7 +11,6 @@ #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h" #include "DataFormats/HcalDetId/interface/HcalSubdetector.h" #include "DataFormats/HcalDetId/interface/HcalDetId.h" -#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h" #include "DataFormats/L1GlobalTrigger/interface/L1GtfeWord.h" #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h" #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerRecord.h" @@ -41,13 +40,17 @@ Analyzer_minbias::Analyzer_minbias(const edm::ParameterSet& iConfig) fOutputFileName = iConfig.getUntrackedParameter("HistOutFile"); // get names of modules, producing object collections - hbherecoMB = iConfig.getParameter("hbheInputMB"); - horecoMB = iConfig.getParameter("hoInputMB"); - hfrecoMB = iConfig.getParameter("hfInputMB"); + tok_hbhe_ = consumes(iConfig.getParameter("hbheInputMB")); + tok_ho_ = consumes(iConfig.getParameter("hoInputMB")); + tok_hf_ = consumes(iConfig.getParameter("hfInputMB")); - hbherecoNoise = iConfig.getParameter("hbheInputNoise"); - horecoNoise = iConfig.getParameter("hoInputNoise"); - hfrecoNoise = iConfig.getParameter("hfInputNoise"); + tok_hbheNoise_ = consumes(iConfig.getParameter("hbheInputNoise")); + tok_hoNoise_ = consumes(iConfig.getParameter("hoInputNoise")); + tok_hfNoise_ = consumes(iConfig.getParameter("hfInputNoise")); + + // this was hardcodded.. + tok_gtRec_ = consumes(edm::InputTag("gtDigisAlCaMB")); + tok_hbheNorm_ = consumes(edm::InputTag("hbhereco")); theRecalib = iConfig.getParameter("Recalib"); @@ -375,7 +378,7 @@ Analyzer_minbias::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetu const AlgorithmMap& bitMap = menu->gtAlgorithmMap(); edm::Handle gtRecord; - iEvent.getByLabel("gtDigisAlCaMB", gtRecord); + iEvent.getByToken(tok_gtRec_, gtRecord); if (!gtRecord.isValid()) { @@ -426,7 +429,7 @@ Analyzer_minbias::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetu } } edm::Handle hbheNormal; - iEvent.getByLabel("hbhereco", hbheNormal); + iEvent.getByToken(tok_hbheNorm_, hbheNormal); if(!hbheNormal.isValid()){ cout<<" hbheNormal failed "< hbheNS; - iEvent.getByLabel(hbherecoNoise, hbheNS); + iEvent.getByToken(tok_hbheNoise_, hbheNS); if(!hbheNS.isValid()){ @@ -454,7 +457,7 @@ Analyzer_minbias::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetu return; } edm::Handle hbheMB; - iEvent.getByLabel(hbherecoMB, hbheMB); + iEvent.getByToken(tok_hbhe_, hbheMB); if(!hbheMB.isValid()){ LogDebug("") << "HcalCalibAlgos: Error! can't get hbhe product!" << std::endl; @@ -470,7 +473,7 @@ Analyzer_minbias::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetu } edm::Handle hfNS; - iEvent.getByLabel(hfrecoNoise, hfNS); + iEvent.getByToken(tok_hfNoise_, hfNS); if(!hfNS.isValid()){ LogDebug("") << "HcalCalibAlgos: Error! can't get hbhe product!" << std::endl; @@ -487,7 +490,7 @@ Analyzer_minbias::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetu } edm::Handle hfMB; - iEvent.getByLabel(hfrecoMB, hfMB); + iEvent.getByToken(tok_hf_, hfMB); if(!hfMB.isValid()){ LogDebug("") << "HcalCalibAlgos: Error! can't get hbhe product!" << std::endl; diff --git a/Calibration/HcalCalibAlgos/src/DiJetAnalyzer.cc b/Calibration/HcalCalibAlgos/src/DiJetAnalyzer.cc index 566d71e04be89..ad03df68ddf34 100644 --- a/Calibration/HcalCalibAlgos/src/DiJetAnalyzer.cc +++ b/Calibration/HcalCalibAlgos/src/DiJetAnalyzer.cc @@ -4,10 +4,6 @@ #include "Geometry/Records/interface/CaloGeometryRecord.h" #include "DataFormats/JetReco/interface/CaloJet.h" -#include "DataFormats/JetReco/interface/CaloJetCollection.h" -#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" -#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" -#include "DataFormats/CaloTowers/interface/CaloTowerCollection.h" #include "DataFormats/CaloTowers/interface/CaloTowerDetId.h" #include "DataFormats/HcalDetId/interface/HcalDetId.h" #include "DataFormats/DetId/interface/DetId.h" @@ -36,11 +32,11 @@ namespace cms { DiJetAnalyzer::DiJetAnalyzer(const edm::ParameterSet& iConfig) { - jets_=iConfig.getParameter("jetsInput"); - ec_=iConfig.getParameter("ecInput"); - hbhe_=iConfig.getParameter("hbheInput"); - ho_=iConfig.getParameter("hoInput"); - hf_=iConfig.getParameter("hfInput"); + tok_jets_ = consumes(iConfig.getParameter("jetsInput")); + tok_ec_ = consumes(iConfig.getParameter("ecInput")); + tok_hbhe_ = consumes(iConfig.getParameter("hbheInput")); + tok_ho_ = consumes(iConfig.getParameter("hoInput")); + tok_hf_ = consumes(iConfig.getParameter("hfInput")); // get name of output file with histogramms fOutputFileName = iConfig.getUntrackedParameter("HistOutFile"); @@ -79,7 +75,7 @@ DiJetAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) CaloJet jet1, jet2, jet3; try { edm::Handle jets; - iEvent.getByLabel(jets_,jets); + iEvent.getByToken(tok_jets_,jets); if(jets->size()>1){ jet1 = (*jets)[0]; jet2 = (*jets)[1]; @@ -143,7 +139,7 @@ DiJetAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) double emEnergy = 0.; try { Handle ec; - iEvent.getByLabel(ec_,ec); + iEvent.getByToken(tok_ec_,ec); for(EcalRecHitCollection::const_iterator ecItr = (*ec).begin(); ecItr != (*ec).end(); ++ecItr) { @@ -162,7 +158,7 @@ DiJetAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) int nHits = 0; try { Handle hbhe; - iEvent.getByLabel(hbhe_, hbhe); + iEvent.getByToken(tok_hbhe_, hbhe); for(HBHERecHitCollection::const_iterator hbheItr=hbhe->begin(); hbheItr!=hbhe->end(); hbheItr++) { @@ -180,7 +176,7 @@ DiJetAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) try { Handle ho; - iEvent.getByLabel(ho_, ho); + iEvent.getByToken(tok_ho_, ho); for(HORecHitCollection::const_iterator hoItr=ho->begin(); hoItr!=ho->end(); hoItr++) { @@ -197,7 +193,7 @@ DiJetAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) try { Handle hf; - iEvent.getByLabel(hf_, hf); + iEvent.getByToken(tok_hf_, hf); for(HFRecHitCollection::const_iterator hfItr=hf->begin(); hfItr!=hf->end(); hfItr++) { diff --git a/Calibration/HcalCalibAlgos/src/GammaJetAnalysis.cc b/Calibration/HcalCalibAlgos/src/GammaJetAnalysis.cc index 3fa2d72a6b527..4721ea1731f8f 100644 --- a/Calibration/HcalCalibAlgos/src/GammaJetAnalysis.cc +++ b/Calibration/HcalCalibAlgos/src/GammaJetAnalysis.cc @@ -16,16 +16,15 @@ #include "DataFormats/GeometryVector/interface/GlobalPoint.h" #include "DataFormats/CaloTowers/interface/CaloTowerCollection.h" #include "DataFormats/CaloTowers/interface/CaloTowerDetId.h" -#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" -#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" +// #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" +// #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" #include "DataFormats/JetReco/interface/CaloJetCollection.h" #include "DataFormats/JetReco/interface/CaloJet.h" #include "DataFormats/JetReco/interface/GenJetCollection.h" //#include "DataFormats/JetReco/interface/GenJetfwd.h" -#include "DataFormats/EgammaReco/interface/SuperClusterFwd.h" #include "DataFormats/JetReco/interface/GenJet.h" -#include "DataFormats/JetReco/interface/CaloJetCollection.h" +//#include "DataFormats/JetReco/interface/CaloJetCollection.h" #include "DataFormats/EgammaReco/interface/BasicCluster.h" #include "DataFormats/EgammaReco/interface/SuperCluster.h" #include "DataFormats/EgammaReco/interface/ClusterShape.h" @@ -47,11 +46,31 @@ GammaJetAnalysis::GammaJetAnalysis(const edm::ParameterSet& iConfig) nameProd_ = iConfig.getUntrackedParameter("nameProd"); jetCalo_ = iConfig.getUntrackedParameter("jetCalo","GammaJetJetBackToBackCollection"); + + tok_jets_ = consumes( edm::InputTag(nameProd_, + jetCalo_) ); + gammaClus_ = iConfig.getUntrackedParameter("gammaClus","GammaJetGammaBackToBackCollection"); + + tok_egamma_ = consumes( edm::InputTag(nameProd_, + gammaClus_) ); + ecalInput_=iConfig.getUntrackedParameter("ecalInput","GammaJetEcalRecHitCollection"); + + tok_ecal_ = consumes( edm::InputTag(nameProd_, ecalInput_) ); + hbheInput_ = iConfig.getUntrackedParameter("hbheInput"); + + tok_hbhe_ = consumes(edm::InputTag(nameProd_,hbheInput_)); + hoInput_ = iConfig.getUntrackedParameter("hoInput"); + + tok_ho_ = consumes(edm::InputTag(nameProd_,hoInput_)); + hfInput_ = iConfig.getUntrackedParameter("hfInput"); + + tok_hf_ = consumes(edm::InputTag(nameProd_,hfInput_)); + Tracks_ = iConfig.getUntrackedParameter("Tracks","GammaJetTracksCollection"); CutOnEgammaEnergy_ = iConfig.getParameter("CutOnEgammaEnergy"); @@ -197,7 +216,7 @@ GammaJetAnalysis::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetu try { edm::Handle jets; - iEvent.getByLabel(nameProd_, jetCalo_, jets); + iEvent.getByToken(tok_jets_, jets); reco::CaloJetCollection::const_iterator jet = jets->begin (); cout<<" Size of Calo jets "<size()< ec; - iEvent.getByLabel(nameProd_, ecalInput_,ec); + iEvent.getByToken(tok_ecal_,ec); for(EcalRecHitCollection::const_iterator recHit = (*ec).begin(); recHit != (*ec).end(); ++recHit) @@ -270,7 +289,7 @@ GammaJetAnalysis::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetu // Hcal Barrel and endcap for isolation try { edm::Handle hbhe; - iEvent.getByLabel(nameProd_,hbheInput_,hbhe); + iEvent.getByToken(tok_hbhe_,hbhe); // (*myout_hcal)<<(*hbhe).size()< eclus; - iEvent.getByLabel(nameProd_,gammaClus_, eclus); + iEvent.getByToken(tok_egamma_, eclus); const reco::SuperClusterCollection* correctedSuperClusters=eclus.product(); // loop over the super clusters and fill the histogram for(reco::SuperClusterCollection::const_iterator aClus = correctedSuperClusters->begin(); diff --git a/Calibration/HcalCalibAlgos/src/GammaJetAnalysis.h b/Calibration/HcalCalibAlgos/src/GammaJetAnalysis.h index d9c8c7efc809b..e644c946a5531 100644 --- a/Calibration/HcalCalibAlgos/src/GammaJetAnalysis.h +++ b/Calibration/HcalCalibAlgos/src/GammaJetAnalysis.h @@ -24,10 +24,11 @@ /* #include "Geometry/Vector/interface/GlobalPoint.h" */ /* #include "DataFormats/CaloTowers/interface/CaloTowerCollection.h" */ /* #include "DataFormats/CaloTowers/interface/CaloTowerDetId.h" */ -/* #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" */ -/* #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" */ -/* #include "DataFormats/JetReco/interface/CaloJetCollection.h" */ + #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" +#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" +#include "DataFormats/JetReco/interface/CaloJetCollection.h" /* #include "DataFormats/JetReco/interface/CaloJet.h" */ +#include "DataFormats/EgammaReco/interface/SuperClusterFwd.h" #include @@ -70,6 +71,13 @@ class GammaJetAnalysis : public edm::EDAnalyzer { std::string Tracks_; std::string myName; double CutOnEgammaEnergy_; + + edm::EDGetTokenT tok_jets_; + edm::EDGetTokenT tok_egamma_; + edm::EDGetTokenT tok_ecal_; + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_hf_; // stuff for histogramms // output file name with histograms diff --git a/Calibration/HcalCalibAlgos/src/HOCalibAnalyzer.cc b/Calibration/HcalCalibAlgos/src/HOCalibAnalyzer.cc index b71c1943f5736..7243ec0e21ec3 100644 --- a/Calibration/HcalCalibAlgos/src/HOCalibAnalyzer.cc +++ b/Calibration/HcalCalibAlgos/src/HOCalibAnalyzer.cc @@ -437,6 +437,7 @@ class HOCalibAnalyzer : public edm::EDAnalyzer { int irunold; edm::InputTag hoCalibVariableCollectionTag; + edm::EDGetTokenT tok_ho_; // ----------member data --------------------------- @@ -459,11 +460,13 @@ const int HOCalibAnalyzer::neffip; // // constructors and destructor // -HOCalibAnalyzer::HOCalibAnalyzer(const edm::ParameterSet& iConfig) : - hoCalibVariableCollectionTag(iConfig.getParameter("hoCalibVariableCollectionTag")) +HOCalibAnalyzer::HOCalibAnalyzer(const edm::ParameterSet& iConfig) // It is very likely you want the following in your configuration // hoCalibVariableCollectionTag = cms.InputTag('hoCalibProducer', 'HOCalibVariableCollection') { + + tok_ho_ = consumes(iConfig.getParameter("hoCalibVariableCollectionTag")); + //now do what ever initialization is needed ipass = 0; Nevents = 0; @@ -1000,7 +1003,7 @@ HOCalibAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup edm::HandleHOCalib; bool isCosMu = true; try { - iEvent.getByLabel(hoCalibVariableCollectionTag, HOCalib); + iEvent.getByToken(tok_ho_, HOCalib); // iEvent.getByLabel("hoCalibProducer","HOCalibVariableCollection",HOCalib); } catch ( cms::Exception &iEvent ) { isCosMu = false; } diff --git a/Calibration/HcalCalibAlgos/src/HcalIsoTrkAnalyzer.cc b/Calibration/HcalCalibAlgos/src/HcalIsoTrkAnalyzer.cc index eefdc0886575f..845c67886471a 100644 --- a/Calibration/HcalCalibAlgos/src/HcalIsoTrkAnalyzer.cc +++ b/Calibration/HcalCalibAlgos/src/HcalIsoTrkAnalyzer.cc @@ -108,7 +108,11 @@ class HcalIsoTrkAnalyzer : public edm::EDAnalyzer { TrackAssociatorParameters parameters_; const CaloGeometry* geo; - InputTag hbheLabel_, hoLabel_, eLabel_, trackLabel_, trackLabel1_; + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_ecal_; + edm::EDGetTokenT tok_track_; + edm::EDGetTokenT tok_track1_; std::string m_inputTrackLabel; std::string m_ecalLabel; @@ -173,11 +177,11 @@ HcalIsoTrkAnalyzer::HcalIsoTrkAnalyzer(const edm::ParameterSet& iConfig) m_eeInstance = iConfig.getUntrackedParameter ("eeRecHitsInstance","EcalRecHitsEE"); m_hcalLabel = iConfig.getUntrackedParameter ("hcalRecHitsLabel","hbhereco"); - hbheLabel_= iConfig.getParameter("hbheInput"); - hoLabel_=iConfig.getParameter("hoInput"); - eLabel_=iConfig.getParameter("eInput"); - trackLabel_ = iConfig.getParameter("HcalIsolTrackInput"); - trackLabel1_ = iConfig.getParameter("trackInput"); + tok_hbhe_ = consumes(iConfig.getParameter("hbheInput")); + tok_ho_ = consumes(iConfig.getParameter("hoInput")); + tok_ecal_ = consumes(iConfig.getParameter("eInput")); + tok_track_ = consumes(iConfig.getParameter("HcalIsolTrackInput")); + tok_track1_ = consumes(iConfig.getParameter("trackInput")); associationConeSize_=iConfig.getParameter("associationConeSize"); allowMissingInputs_=iConfig.getUntrackedParameter("allowMissingInputs",true); outputFileName_=iConfig.getParameter("outputFileName"); @@ -222,17 +226,17 @@ HcalIsoTrkAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSe float calEnergy; edm::Handle isoProdTracks; - iEvent.getByLabel(trackLabel1_,isoProdTracks); + iEvent.getByToken(tok_track1_,isoProdTracks); edm::Handle isoPixelTracks; - iEvent.getByLabel(trackLabel_,isoPixelTracks); + iEvent.getByToken(tok_track_,isoPixelTracks); edm::Handle ecal; - iEvent.getByLabel(eLabel_,ecal); + iEvent.getByToken(tok_ecal_,ecal); const EcalRecHitCollection Hitecal = *(ecal.product()); edm::Handle hbhe; - iEvent.getByLabel(hbheLabel_,hbhe); + iEvent.getByToken(tok_hbhe_,hbhe); const HBHERecHitCollection Hithbhe = *(hbhe.product()); edm::ESHandle pG; @@ -543,7 +547,7 @@ HcalIsoTrkAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSe try { Handle ho; - iEvent.getByLabel(hoLabel_,ho); + iEvent.getByToken(tok_ho_,ho); const HORecHitCollection Hitho = *(ho.product()); //clear usedHits diff --git a/Calibration/HcalCalibAlgos/src/HitReCalibrator.cc b/Calibration/HcalCalibAlgos/src/HitReCalibrator.cc index c067491200f49..6f69d1c67cd28 100644 --- a/Calibration/HcalCalibAlgos/src/HitReCalibrator.cc +++ b/Calibration/HcalCalibAlgos/src/HitReCalibrator.cc @@ -2,7 +2,6 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "DataFormats/GeometryVector/interface/GlobalPoint.h" #include "DataFormats/CaloTowers/interface/CaloTowerDetId.h" -#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" #include "RecoTracker/TrackProducer/interface/TrackProducerBase.h" #include "TrackingTools/TransientTrack/interface/TransientTrack.h" @@ -21,9 +20,9 @@ namespace cms HitReCalibrator::HitReCalibrator(const edm::ParameterSet& iConfig) { - hbheInput_ = iConfig.getParameter("hbheInput"); - hoInput_ = iConfig.getParameter("hoInput"); - hfInput_ = iConfig.getParameter("hfInput"); + tok_hbhe_ = consumes(iConfig.getParameter("hbheInput")); + tok_ho_ = consumes(iConfig.getParameter("hoInput")); + tok_hf_ = consumes(iConfig.getParameter("hfInput")); allowMissingInputs_ = true; //register your products @@ -59,7 +58,7 @@ HitReCalibrator::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) try { edm::Handle hbhe; - iEvent.getByLabel(hbheInput_,hbhe); + iEvent.getByToken(tok_hbhe_,hbhe); const HBHERecHitCollection Hithbhe = *(hbhe.product()); for(HBHERecHitCollection::const_iterator hbheItr=Hithbhe.begin(); hbheItr!=Hithbhe.end(); hbheItr++) { @@ -79,7 +78,7 @@ HitReCalibrator::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) try{ edm::Handle ho; - iEvent.getByLabel(hoInput_,ho); + iEvent.getByToken(tok_ho_,ho); const HORecHitCollection Hitho = *(ho.product()); for(HORecHitCollection::const_iterator hoItr=Hitho.begin(); hoItr!=Hitho.end(); hoItr++) { @@ -99,7 +98,7 @@ HitReCalibrator::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) try { edm::Handle hf; - iEvent.getByLabel(hfInput_,hf); + iEvent.getByToken(tok_hf_,hf); const HFRecHitCollection Hithf = *(hf.product()); for(HFRecHitCollection::const_iterator hfItr=Hithf.begin(); hfItr!=Hithf.end(); hfItr++) { diff --git a/Calibration/HcalCalibAlgos/src/HitReCalibrator.h b/Calibration/HcalCalibAlgos/src/HitReCalibrator.h index 349aed3cd8a3a..bb6a7e7bbba28 100644 --- a/Calibration/HcalCalibAlgos/src/HitReCalibrator.h +++ b/Calibration/HcalCalibAlgos/src/HitReCalibrator.h @@ -23,6 +23,8 @@ #include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" + // // class declaration // @@ -47,9 +49,10 @@ class HitReCalibrator : public edm::EDProducer { // ----------member data --------------------------- bool allowMissingInputs_; - edm::InputTag hbheInput_; - edm::InputTag hoInput_; - edm::InputTag hfInput_; + + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_hf_; }; }// end namespace cms diff --git a/Calibration/HcalConnectivity/src/HcalCableMapper.cc b/Calibration/HcalConnectivity/src/HcalCableMapper.cc index a1e570453bcfa..2f8f7d5ed9f4c 100644 --- a/Calibration/HcalConnectivity/src/HcalCableMapper.cc +++ b/Calibration/HcalConnectivity/src/HcalCableMapper.cc @@ -31,7 +31,9 @@ class HcalCableMapper : public edm::EDAnalyzer { std::map > fullHistory_; IdMap IdSet; - edm::InputTag hbheLabel_,hoLabel_,hfLabel_; + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_hf_; template void record(const DigiCollection& digis) { @@ -53,10 +55,10 @@ class HcalCableMapper : public edm::EDAnalyzer { }; -HcalCableMapper::HcalCableMapper(edm::ParameterSet const& conf) : - hbheLabel_(conf.getParameter("hbheLabel")), - hoLabel_(conf.getParameter("hoLabel")), - hfLabel_(conf.getParameter("hfLabel")){ +HcalCableMapper::HcalCableMapper(edm::ParameterSet const& conf) { + tok_hbhe_ = consumes(conf.getParameter("hbheLabel")); + tok_ho_ = consumes(conf.getParameter("hoLabel")); + tok_hf_ = consumes(conf.getParameter("hfLabel")); } @@ -159,12 +161,12 @@ void HcalCableMapper::process(const PathSet& ps, const IdMap& im){ void HcalCableMapper::analyze(edm::Event const& e, edm::EventSetup const& c) { edm::Handle hbhe; - e.getByLabel(hbheLabel_,hbhe); + e.getByToken(tok_hbhe_,hbhe); edm::Handle hf; - e.getByLabel(hfLabel_,hf); + e.getByToken(tok_hf_,hf); edm::Handle ho; - e.getByLabel(hoLabel_,ho); + e.getByToken(tok_ho_,ho); record(*hbhe); diff --git a/Calibration/HcalIsolatedTrackReco/interface/ECALRegFEDSelector.h b/Calibration/HcalIsolatedTrackReco/interface/ECALRegFEDSelector.h index fd00aa659596b..6b4ca915ec036 100644 --- a/Calibration/HcalIsolatedTrackReco/interface/ECALRegFEDSelector.h +++ b/Calibration/HcalIsolatedTrackReco/interface/ECALRegFEDSelector.h @@ -20,6 +20,8 @@ #include "DataFormats/EcalDetId/interface/EcalDetIdCollections.h" +#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" + #include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h" #include "Geometry/EcalMapping/interface/EcalMappingRcd.h" #include "RecoEcal/EgammaCoreTools/interface/EcalEtaPhiRegion.h" @@ -32,11 +34,11 @@ class ECALRegFEDSelector : public edm::EDProducer { ~ECALRegFEDSelector(); const EcalElectronicsMapping* ec_mapping; - edm::InputTag seedLabel_; double delta_; bool fedSaved[1200]; - edm::InputTag rawInLabel_; + edm::EDGetTokenT tok_raw_; + edm::EDGetTokenT tok_seed_; private: virtual void beginJob() ; diff --git a/Calibration/HcalIsolatedTrackReco/interface/EcalIsolatedParticleCandidateProducer.h b/Calibration/HcalIsolatedTrackReco/interface/EcalIsolatedParticleCandidateProducer.h index 054ae167ed259..ebe1fd3c66225 100644 --- a/Calibration/HcalIsolatedTrackReco/interface/EcalIsolatedParticleCandidateProducer.h +++ b/Calibration/HcalIsolatedTrackReco/interface/EcalIsolatedParticleCandidateProducer.h @@ -11,6 +11,8 @@ #include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" +#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" #include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidate.h" // // class decleration @@ -29,10 +31,11 @@ class EcalIsolatedParticleCandidateProducer : public edm::EDProducer { double OutConeSize_; double hitCountEthr_; double hitEthr_; - edm::InputTag l1tausource_; - edm::InputTag hltGTseedlabel_; - edm::InputTag EBrecHitCollectionLabel_; - edm::InputTag EErecHitCollectionLabel_; + + edm::EDGetTokenT tok_l1tau_; + edm::EDGetTokenT tok_hlt_; + edm::EDGetTokenT tok_EB_; + edm::EDGetTokenT tok_EE_; virtual void beginJob() ; virtual void produce(edm::Event&, const edm::EventSetup&); diff --git a/Calibration/HcalIsolatedTrackReco/interface/HITSiStripRawToClustersRoI.h b/Calibration/HcalIsolatedTrackReco/interface/HITSiStripRawToClustersRoI.h index 884b32a082888..0ff2c7339d542 100644 --- a/Calibration/HcalIsolatedTrackReco/interface/HITSiStripRawToClustersRoI.h +++ b/Calibration/HcalIsolatedTrackReco/interface/HITSiStripRawToClustersRoI.h @@ -79,9 +79,9 @@ class HITSiStripRawToClustersRoI : public edm::EDProducer { bool ptrack_; /** reco module labels to define regions of interest */ - edm::InputTag siStripLazyGetter_; - edm::InputTag taujetL1_; - edm::InputTag ptrackLabel_; + edm::EDGetTokenT tok_siStrip_; + edm::EDGetTokenT tok_tauL1_; + edm::EDGetTokenT tok_ptrack_; /** deta/dphi to define regions of interest around physics objects */ diff --git a/Calibration/HcalIsolatedTrackReco/interface/IPTCorrector.h b/Calibration/HcalIsolatedTrackReco/interface/IPTCorrector.h index 6c60b37ff1512..0ab6c6f6f026a 100644 --- a/Calibration/HcalIsolatedTrackReco/interface/IPTCorrector.h +++ b/Calibration/HcalIsolatedTrackReco/interface/IPTCorrector.h @@ -18,6 +18,7 @@ #include "DataFormats/TrackReco/interface/Track.h" #include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidate.h" +#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" class IPTCorrector : public edm::EDProducer { @@ -30,8 +31,8 @@ class IPTCorrector : public edm::EDProducer { private: - edm::InputTag corSource_; - edm::InputTag uncorSource_; + edm::EDGetTokenT tok_cor_; + edm::EDGetTokenT tok_uncor_; double assocCone_; }; diff --git a/Calibration/HcalIsolatedTrackReco/interface/IsolatedPixelTrackCandidateProducer.h b/Calibration/HcalIsolatedTrackReco/interface/IsolatedPixelTrackCandidateProducer.h index 8af482a607788..0e2bce2a2f994 100644 --- a/Calibration/HcalIsolatedTrackReco/interface/IsolatedPixelTrackCandidateProducer.h +++ b/Calibration/HcalIsolatedTrackReco/interface/IsolatedPixelTrackCandidateProducer.h @@ -16,6 +16,11 @@ #include "DataFormats/DetId/interface/DetId.h" //#include "DataFormats/Common/interface/Provenance.h" +#include "DataFormats/VertexReco/interface/VertexFwd.h" +#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetupFwd.h" +#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" +#include "DataFormats/Common/interface/TriggerResults.h" +#include "DataFormats/L1Trigger/interface/L1JetParticleFwd.h" #include "DataFormats/TrackReco/interface/Track.h" #include "DataFormats/L1Trigger/interface/L1JetParticle.h" @@ -37,12 +42,15 @@ class IsolatedPixelTrackCandidateProducer : public edm::EDProducer { private: - edm::InputTag hltGTseedlabel_; - edm::InputTag l1eTauJetsSource_; std::vector pixelTracksSources_; - edm::InputTag vertexLabel_; edm::ParameterSet parameters; + edm::EDGetTokenT tok_hlt_; + edm::EDGetTokenT tok_l1_; + edm::EDGetTokenT tok_vert_; + + std::vector > toks_pix_; + double prelimCone_; double pixelIsolationConeSizeAtEC_; double vtxCutSeed_; diff --git a/Calibration/HcalIsolatedTrackReco/interface/SiStripRegFEDSelector.h b/Calibration/HcalIsolatedTrackReco/interface/SiStripRegFEDSelector.h index 96fae841f77e8..4f54626507129 100644 --- a/Calibration/HcalIsolatedTrackReco/interface/SiStripRegFEDSelector.h +++ b/Calibration/HcalIsolatedTrackReco/interface/SiStripRegFEDSelector.h @@ -14,6 +14,7 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Framework/interface/ESHandle.h" +#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" #include "DataFormats/FEDRawData/interface/FEDRawData.h" #include "DataFormats/FEDRawData/interface/FEDNumbering.h" @@ -27,10 +28,10 @@ class SiStripRegFEDSelector : public edm::EDProducer { edm::ESHandle strip_cabling; - edm::InputTag seedLabel_; double delta_; - edm::InputTag rawInLabel_; + edm::EDGetTokenT tok_raw_; + edm::EDGetTokenT tok_seed_; private: virtual void beginJob() ; diff --git a/Calibration/HcalIsolatedTrackReco/interface/SubdetFEDSelector.h b/Calibration/HcalIsolatedTrackReco/interface/SubdetFEDSelector.h index beece8bd62b8f..079695e4fe34c 100644 --- a/Calibration/HcalIsolatedTrackReco/interface/SubdetFEDSelector.h +++ b/Calibration/HcalIsolatedTrackReco/interface/SubdetFEDSelector.h @@ -29,7 +29,7 @@ class SubdetFEDSelector : public edm::EDProducer { bool getMuon_; bool getTrigger_; - edm::InputTag rawInLabel_; + edm::EDGetTokenT tok_raw_; private: virtual void beginJob() ; diff --git a/Calibration/HcalIsolatedTrackReco/src/ECALRegFEDSelector.cc b/Calibration/HcalIsolatedTrackReco/src/ECALRegFEDSelector.cc index d9c232795628c..8b89f2571224a 100644 --- a/Calibration/HcalIsolatedTrackReco/src/ECALRegFEDSelector.cc +++ b/Calibration/HcalIsolatedTrackReco/src/ECALRegFEDSelector.cc @@ -1,16 +1,15 @@ #include "Calibration/HcalIsolatedTrackReco/interface/ECALRegFEDSelector.h" #include "EventFilter/EcalRawToDigi/interface/EcalRegionCabling.h" -#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" #include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidateFwd.h" #include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidate.h" ECALRegFEDSelector::ECALRegFEDSelector(const edm::ParameterSet& iConfig) { - seedLabel_=iConfig.getParameter("regSeedLabel"); + tok_seed_ = consumes(iConfig.getParameter("regSeedLabel")); delta_=iConfig.getParameter("delta"); - rawInLabel_=iConfig.getParameter("rawInputLabel"); + tok_raw_ = consumes(iConfig.getParameter("rawInputLabel")); ec_mapping = new EcalElectronicsMapping(); @@ -41,13 +40,13 @@ void ECALRegFEDSelector::produce(edm::Event& iEvent, const edm::EventSetup& iSet std::auto_ptr fedList(new EcalListOfFEDS); edm::Handle trigSeedTrks; - iEvent.getByLabel(seedLabel_,trigSeedTrks); + iEvent.getByToken(tok_seed_,trigSeedTrks); std::vector< edm::Ref > isoPixTrackRefs; trigSeedTrks->getObjects(trigger::TriggerTrack, isoPixTrackRefs); edm::Handle rawIn; - iEvent.getByLabel(rawInLabel_,rawIn); + iEvent.getByToken(tok_raw_,rawIn); // std::vector EC_FED_IDs; diff --git a/Calibration/HcalIsolatedTrackReco/src/EcalIsolatedParticleCandidateProducer.cc b/Calibration/HcalIsolatedTrackReco/src/EcalIsolatedParticleCandidateProducer.cc index 6e22a674f4b50..64a69034f9cc8 100644 --- a/Calibration/HcalIsolatedTrackReco/src/EcalIsolatedParticleCandidateProducer.cc +++ b/Calibration/HcalIsolatedTrackReco/src/EcalIsolatedParticleCandidateProducer.cc @@ -30,11 +30,9 @@ #include "Geometry/Records/interface/CaloGeometryRecord.h" #include "Geometry/CaloTopology/interface/EcalBarrelTopology.h" -#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" #include "Calibration/HcalIsolatedTrackReco/interface/EcalIsolatedParticleCandidateProducer.h" -#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" @@ -44,10 +42,10 @@ EcalIsolatedParticleCandidateProducer::EcalIsolatedParticleCandidateProducer(con OutConeSize_= conf.getParameter("EcalOuterConeSize"); hitCountEthr_= conf.getParameter("ECHitCountEnergyThreshold"); hitEthr_=conf.getParameter("ECHitEnergyThreshold"); - l1tausource_=conf.getParameter("L1eTauJetsSource"); - hltGTseedlabel_=conf.getParameter("L1GTSeedLabel"); - EBrecHitCollectionLabel_=conf.getParameter("EBrecHitCollectionLabel"); - EErecHitCollectionLabel_=conf.getParameter("EErecHitCollectionLabel"); + tok_l1tau_ = consumes(conf.getParameter("L1eTauJetsSource")); + tok_hlt_ = consumes(conf.getParameter("L1GTSeedLabel")); + tok_EB_ = consumes(conf.getParameter("EBrecHitCollectionLabel")); + tok_EE_ = consumes(conf.getParameter("EErecHitCollectionLabel")); //register your products produces< reco::IsolatedPixelTrackCandidateCollection >(); @@ -78,7 +76,7 @@ EcalIsolatedParticleCandidateProducer::produce(edm::Event& iEvent, const edm::Ev // std::cout<<"get tau"< l1Taus; - iEvent.getByLabel(l1tausource_,l1Taus); + iEvent.getByToken(tok_l1tau_,l1Taus); // std::cout<<"get geom"< ecalEB; - iEvent.getByLabel(EBrecHitCollectionLabel_,ecalEB); + iEvent.getByToken(tok_EB_,ecalEB); Handle ecalEE; - iEvent.getByLabel(EErecHitCollectionLabel_,ecalEE); + iEvent.getByToken(tok_EE_,ecalEE); // std::cout<<"get l1 trig obj"< l1trigobj; - iEvent.getByLabel(hltGTseedlabel_, l1trigobj); + iEvent.getByToken(tok_hlt_, l1trigobj); std::vector< edm::Ref > l1tauobjref; std::vector< edm::Ref > l1jetobjref; diff --git a/Calibration/HcalIsolatedTrackReco/src/HITSiStripRawToClustersRoI.cc b/Calibration/HcalIsolatedTrackReco/src/HITSiStripRawToClustersRoI.cc index 7a1e6b868d9c1..3d81a5fb4eb85 100644 --- a/Calibration/HcalIsolatedTrackReco/src/HITSiStripRawToClustersRoI.cc +++ b/Calibration/HcalIsolatedTrackReco/src/HITSiStripRawToClustersRoI.cc @@ -16,15 +16,16 @@ HITSiStripRawToClustersRoI::HITSiStripRawToClustersRoI(const edm::ParameterSet& random_(conf.getUntrackedParameter("random",false)), taujets_(conf.getUntrackedParameter("useTauJets",false)), ptrack_(conf.getUntrackedParameter("usePixelTracks",true)), - siStripLazyGetter_(conf.getParameter("siStripLazyGetter")), - taujetL1_(conf.getParameter("l1tauJetLabel")), - ptrackLabel_(conf.getParameter("pixelTrackLabel")), taujetdeta_(conf.getUntrackedParameter("tjetEtaWindow",0.2)), taujetdphi_(conf.getUntrackedParameter("tjetPhiWindow",0.2)), ptrackEta_(conf.getUntrackedParameter("ptrackEtaWindow",0.3)), ptrackPhi_(conf.getUntrackedParameter("ptrackPhiWindow",0.3)) { + tok_siStrip_ = consumes(conf.getParameter("siStripLazyGetter")); + tok_tauL1_ = consumes(conf.getParameter("l1tauJetLabel")); + tok_ptrack_ = consumes(conf.getParameter("pixelTrackLabel")); + produces< RefGetter >(); } @@ -49,7 +50,7 @@ void HITSiStripRawToClustersRoI::produce(edm::Event& event, const edm::EventSetu edm::Handle< LazyGetter > lazygetter; - event.getByLabel(siStripLazyGetter_,lazygetter); + event.getByToken(tok_siStrip_,lazygetter); /// All regions @@ -72,7 +73,7 @@ void HITSiStripRawToClustersRoI::produce(edm::Event& event, const edm::EventSetu if (taujets_) { edm::Handle collection; - event.getByLabel(taujetL1_,collection); + event.getByToken(tok_tauL1_,collection); taujets(*collection,*refgetter,lazygetter); } @@ -80,7 +81,7 @@ void HITSiStripRawToClustersRoI::produce(edm::Event& event, const edm::EventSetu ///seeded by isol tracks if (ptrack_) { edm::Handle collection; - event.getByLabel(ptrackLabel_,collection); + event.getByToken(tok_ptrack_,collection); ptracks(*collection,*refgetter,lazygetter); } diff --git a/Calibration/HcalIsolatedTrackReco/src/IPTCorrector.cc b/Calibration/HcalIsolatedTrackReco/src/IPTCorrector.cc index 53234e43e972c..6d715cc6419a0 100644 --- a/Calibration/HcalIsolatedTrackReco/src/IPTCorrector.cc +++ b/Calibration/HcalIsolatedTrackReco/src/IPTCorrector.cc @@ -13,7 +13,6 @@ // #include "DataFormats/Common/interface/TriggerResults.h" /// -#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" // Math #include "Math/GenVector/VectorUtil.h" #include "Math/GenVector/PxPyPzE4D.h" @@ -21,8 +20,8 @@ IPTCorrector::IPTCorrector(const edm::ParameterSet& config){ - corSource_=config.getParameter("corTracksLabel"); - uncorSource_=config.getParameter("filterLabel"); + tok_cor_ = consumes(config.getParameter("corTracksLabel")); + tok_uncor_ = consumes(config.getParameter("filterLabel")); assocCone_=config.getParameter("associationCone"); // Register the product @@ -38,10 +37,10 @@ void IPTCorrector::produce(edm::Event& theEvent, const edm::EventSetup& theEvent reco::IsolatedPixelTrackCandidateCollection * trackCollection=new reco::IsolatedPixelTrackCandidateCollection; edm::Handle corTracks; - theEvent.getByLabel(corSource_,corTracks); + theEvent.getByToken(tok_cor_,corTracks); edm::Handle fiCand; - theEvent.getByLabel(uncorSource_,fiCand); + theEvent.getByToken(tok_uncor_,fiCand); std::vector< edm::Ref > isoPixTrackRefs; diff --git a/Calibration/HcalIsolatedTrackReco/src/IsolatedPixelTrackCandidateProducer.cc b/Calibration/HcalIsolatedTrackReco/src/IsolatedPixelTrackCandidateProducer.cc index b810f8d3af254..d6548091b5dbc 100644 --- a/Calibration/HcalIsolatedTrackReco/src/IsolatedPixelTrackCandidateProducer.cc +++ b/Calibration/HcalIsolatedTrackReco/src/IsolatedPixelTrackCandidateProducer.cc @@ -12,15 +12,11 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Utilities/interface/Exception.h" // -#include "DataFormats/Common/interface/TriggerResults.h" // L1Extra #include "DataFormats/L1Trigger/interface/L1EmParticle.h" -#include "DataFormats/L1Trigger/interface/L1JetParticleFwd.h" /// -#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" -#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetupFwd.h" #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h" #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMapRecord.h" //#include "DataFormats/L1GlobalTrigger/interface/L1GtLogicParser.h" @@ -35,7 +31,6 @@ //vertices #include "DataFormats/VertexReco/interface/Vertex.h" -#include "DataFormats/VertexReco/interface/VertexFwd.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" #include "DetectorDescription/Core/interface/DDLogicalPart.h" @@ -56,16 +51,21 @@ IsolatedPixelTrackCandidateProducer::IsolatedPixelTrackCandidateProducer(const edm::ParameterSet& config){ - l1eTauJetsSource_ = config.getParameter("L1eTauJetsSource"); + tok_l1_ = consumes(config.getParameter("L1eTauJetsSource")); tauAssocCone_ = config.getParameter("tauAssociationCone"); tauUnbiasCone_ = config.getParameter("tauUnbiasCone"); pixelTracksSources_ = config.getParameter >("PixelTracksSources"); + + const unsigned nLabels = pixelTracksSources_.size(); + for ( unsigned i=0; i != nLabels; i++ ) + toks_pix_.push_back(consumes(pixelTracksSources_[i])); + prelimCone_ = config.getParameter("ExtrapolationConeSize"); pixelIsolationConeSizeAtEC_ = config.getParameter("PixelIsolationConeSizeAtEC"); - hltGTseedlabel_ = config.getParameter("L1GTSeedLabel"); + tok_hlt_ = consumes(config.getParameter("L1GTSeedLabel")); vtxCutSeed_ = config.getParameter("MaxVtxDXYSeed"); vtxCutIsol_ = config.getParameter("MaxVtxDXYIsol"); - vertexLabel_ = config.getParameter("VertexLabel"); + tok_vert_ = consumes(config.getParameter("VertexLabel")); bfield_ = config.getParameter("MagFieldRecordName"); minPTrackValue_ = config.getParameter("minPTrack"); maxPForIsolationValue_ = config.getParameter("maxPTrackForIsolation"); @@ -102,10 +102,10 @@ void IsolatedPixelTrackCandidateProducer::produce(edm::Event& theEvent, const ed //create vector of refs from input collections std::vector pixelTrackRefs; - for (unsigned int iPix=0; iPix iPixCol; - theEvent.getByLabel(pixelTracksSources_[iPix],iPixCol); + theEvent.getByToken(toks_pix_[iPix],iPixCol); for (reco::TrackCollection::const_iterator pit=iPixCol->begin(); pit!=iPixCol->end(); pit++) { pixelTrackRefs.push_back(reco::TrackRef(iPixCol,pit-iPixCol->begin())); @@ -113,17 +113,17 @@ void IsolatedPixelTrackCandidateProducer::produce(edm::Event& theEvent, const ed } edm::Handle l1eTauJets; - theEvent.getByLabel(l1eTauJetsSource_,l1eTauJets); + theEvent.getByToken(tok_l1_,l1eTauJets); edm::Handle pVert; - theEvent.getByLabel(vertexLabel_,pVert); + theEvent.getByToken(tok_vert_,pVert); double ptTriggered = -10; double etaTriggered = -100; double phiTriggered = -100; edm::Handle l1trigobj; - theEvent.getByLabel(hltGTseedlabel_, l1trigobj); + theEvent.getByToken(tok_hlt_, l1trigobj); std::vector< edm::Ref > l1tauobjref; std::vector< edm::Ref > l1jetobjref; diff --git a/Calibration/HcalIsolatedTrackReco/src/SiStripRegFEDSelector.cc b/Calibration/HcalIsolatedTrackReco/src/SiStripRegFEDSelector.cc index 8b987321a1bd0..1f6b950ae47c2 100644 --- a/Calibration/HcalIsolatedTrackReco/src/SiStripRegFEDSelector.cc +++ b/Calibration/HcalIsolatedTrackReco/src/SiStripRegFEDSelector.cc @@ -2,16 +2,15 @@ #include "Calibration/HcalIsolatedTrackReco/interface/SiStripRegFEDSelector.h" #include "CalibTracker/Records/interface/SiStripRegionCablingRcd.h" #include "CondFormats/SiStripObjects/interface/FedChannelConnection.h" -#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" #include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidate.h" #include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidateFwd.h" SiStripRegFEDSelector::SiStripRegFEDSelector(const edm::ParameterSet& iConfig) { - seedLabel_=iConfig.getParameter("regSeedLabel"); + tok_seed_ = consumes(iConfig.getParameter("regSeedLabel")); delta_=iConfig.getParameter("delta"); - rawInLabel_=iConfig.getParameter("rawInputLabel"); + tok_raw_ = consumes(iConfig.getParameter("rawInputLabel")); produces(); } @@ -28,13 +27,13 @@ SiStripRegFEDSelector::produce(edm::Event& iEvent, const edm::EventSetup& iSetup std::auto_ptr producedData(new FEDRawDataCollection); edm::Handle trigSeedTrks; - iEvent.getByLabel(seedLabel_,trigSeedTrks); + iEvent.getByToken(tok_seed_,trigSeedTrks); std::vector< edm::Ref > isoPixTrackRefs; trigSeedTrks->getObjects(trigger::TriggerTrack, isoPixTrackRefs); edm::Handle rawIn; - iEvent.getByLabel(rawInLabel_,rawIn); + iEvent.getByToken(tok_raw_,rawIn); iSetup.get().get(strip_cabling); diff --git a/Calibration/HcalIsolatedTrackReco/src/SubdetFEDSelector.cc b/Calibration/HcalIsolatedTrackReco/src/SubdetFEDSelector.cc index e84a23d98f347..585dd9893c46c 100644 --- a/Calibration/HcalIsolatedTrackReco/src/SubdetFEDSelector.cc +++ b/Calibration/HcalIsolatedTrackReco/src/SubdetFEDSelector.cc @@ -10,7 +10,7 @@ SubdetFEDSelector::SubdetFEDSelector(const edm::ParameterSet& iConfig) getMuon_=iConfig.getParameter("getMuon"); getTrigger_=iConfig.getParameter("getTrigger"); - rawInLabel_=iConfig.getParameter("rawInputLabel"); + tok_raw_ = consumes(iConfig.getParameter("rawInputLabel")); produces(); @@ -27,7 +27,7 @@ SubdetFEDSelector::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) std::auto_ptr producedData(new FEDRawDataCollection); edm::Handle rawIn; - iEvent.getByLabel(rawInLabel_,rawIn); + iEvent.getByToken(tok_raw_,rawIn); std::vector selFEDs; diff --git a/Calibration/IsolatedParticles/plugins/ElectronStudy.cc b/Calibration/IsolatedParticles/plugins/ElectronStudy.cc index ae543a36ec234..6ed7010d0cfb7 100644 --- a/Calibration/IsolatedParticles/plugins/ElectronStudy.cc +++ b/Calibration/IsolatedParticles/plugins/ElectronStudy.cc @@ -18,6 +18,13 @@ ElectronStudy::ElectronStudy(const edm::ParameterSet& ps) { g4Label = ps.getUntrackedParameter("ModuleLabel","g4SimHits"); hitLabEB= ps.getUntrackedParameter("EBCollection","EcalHitsEB"); hitLabEE= ps.getUntrackedParameter("EECollection","EcalHitsEE"); + + + tok_EBhit_ = consumes(edm::InputTag(g4Label,hitLabEB)); + tok_EEhit_ = consumes(edm::InputTag(g4Label,hitLabEE)); + tok_simTk_ = consumes(edm::InputTag(g4Label)); + tok_simVtx_ = consumes(edm::InputTag(g4Label)); + hotZone = ps.getUntrackedParameter("HotZone",0); verbose = ps.getUntrackedParameter("Verbosity",0); edm::LogInfo("ElectronStudy") << "Module Label: " << g4Label << " Hits: " @@ -98,19 +105,19 @@ void ElectronStudy::analyze(const edm::Event& iEvent, const edm::EventSetup& iSe // get PCaloHits for ecal barrel edm::Handle caloHitEB; - iEvent.getByLabel(g4Label,hitLabEB,caloHitEB); + iEvent.getByToken(tok_EBhit_,caloHitEB); // get PCaloHits for ecal endcap edm::Handle caloHitEE; - iEvent.getByLabel(g4Label,hitLabEE,caloHitEE); + iEvent.getByToken(tok_EEhit_,caloHitEE); // get sim tracks edm::Handle SimTk; - iEvent.getByLabel(g4Label, SimTk); + iEvent.getByToken(tok_simTk_, SimTk); // get sim vertices edm::Handle SimVtx; - iEvent.getByLabel(g4Label, SimVtx); + iEvent.getByToken(tok_simVtx_, SimVtx); if (verbose>0) std::cout << "ElectronStudy: hits valid[EB]: " << caloHitEB.isValid() diff --git a/Calibration/IsolatedParticles/plugins/ElectronStudy.h b/Calibration/IsolatedParticles/plugins/ElectronStudy.h index 5801737d57f94..f95cd12f4981d 100644 --- a/Calibration/IsolatedParticles/plugins/ElectronStudy.h +++ b/Calibration/IsolatedParticles/plugins/ElectronStudy.h @@ -45,6 +45,11 @@ class ElectronStudy: public edm::EDAnalyzer { static const int NPBins = 8; double pBins[NPBins+1], etaBins[NEtaBins+1]; + edm::EDGetTokenT tok_EBhit_; + edm::EDGetTokenT tok_EEhit_; + edm::EDGetTokenT tok_simTk_; + edm::EDGetTokenT tok_simVtx_; + std::string sourceLabel, g4Label, hitLabEB, hitLabEE; int hotZone, verbose; bool histos; diff --git a/Calibration/IsolatedParticles/plugins/IsolatedGenParticles.cc b/Calibration/IsolatedParticles/plugins/IsolatedGenParticles.cc index a42e0585bdf81..e012297d0346d 100644 --- a/Calibration/IsolatedParticles/plugins/IsolatedGenParticles.cc +++ b/Calibration/IsolatedParticles/plugins/IsolatedGenParticles.cc @@ -44,6 +44,10 @@ IsolatedGenParticles::IsolatedGenParticles(const edm::ParameterSet& iConfig) { genSrc_ = iConfig.getUntrackedParameter("GenSrc",std::string("generator")); + + tok_hepmc_ = consumes(edm::InputTag(genSrc_)); + tok_genParticles_ = consumes(edm::InputTag(genSrc_)); + useHepMC = iConfig.getUntrackedParameter("UseHepMC", false ); pSeed = iConfig.getUntrackedParameter("ChargedHadronSeedP", 1.0); ptMin = iConfig.getUntrackedParameter("PTMin", 1.0); @@ -63,9 +67,20 @@ IsolatedGenParticles::IsolatedGenParticles(const edm::ParameterSet& iConfig) { L1extraMuonSource_ = iConfig.getParameter("L1extraMuonSource"); L1extraIsoEmSource_ = iConfig.getParameter("L1extraIsoEmSource"); L1extraNonIsoEmSource_ = iConfig.getParameter("L1extraNonIsoEmSource"); - L1GTReadoutRcdSource_ = iConfig.getParameter("L1GTReadoutRcdSource"); + L1GTReadoutRcdSource_ = iConfig.getParameter("L1GTReadoutRcdSource"); L1GTObjectMapRcdSource_= iConfig.getParameter("L1GTObjectMapRcdSource"); + tok_L1GTrorsrc_ = consumes( L1GTReadoutRcdSource_ ); + tok_L1GTobjmap_ = consumes( L1GTObjectMapRcdSource_ ); + tok_L1extMusrc_ = consumes(L1extraMuonSource_); + tok_L1Em_ = consumes( L1extraIsoEmSource_ ); + tok_L1extNonIsoEm_= consumes( L1extraNonIsoEmSource_ ); + tok_L1extTauJet_ = consumes(L1extraTauJetSource_ ); + tok_L1extCenJet_ = consumes(L1extraCenJetSource_ ); + tok_L1extFwdJet_ = consumes(L1extraFwdJetSource_ ); + + + if (!strcmp("Dummy", genSrc_.c_str())) { if (useHepMC) genSrc_ = "generator"; else genSrc_ = "genParticles"; @@ -109,8 +124,8 @@ void IsolatedGenParticles::analyze(const edm::Event& iEvent, const edm::EventSet // get handle to HEPMCProduct edm::Handle hepmc; edm::Handle genParticles; - if (useHepMC) iEvent.getByLabel(genSrc_, hepmc); - else iEvent.getByLabel(genSrc_, genParticles); + if (useHepMC) iEvent.getByToken(tok_hepmc_, hepmc); + else iEvent.getByToken(tok_genParticles_, genParticles); edm::ESHandle pG; iSetup.get().get(pG); @@ -127,10 +142,10 @@ void IsolatedGenParticles::analyze(const edm::Event& iEvent, const edm::EventSet //===================== save L1 Trigger information ======================= // get L1TriggerReadout records edm::Handle gtRecord; - iEvent.getByLabel(L1GTReadoutRcdSource_, gtRecord); + iEvent.getByToken(tok_L1GTrorsrc_, gtRecord); edm::Handle gtOMRec; - iEvent.getByLabel(L1GTObjectMapRcdSource_, gtOMRec); + iEvent.getByToken(tok_L1GTobjmap_, gtOMRec); // sanity check on L1 Trigger Records if (!gtRecord.isValid()) { @@ -184,7 +199,7 @@ void IsolatedGenParticles::analyze(const edm::Event& iEvent, const edm::EventSet //=================== // L1Taus edm::Handle l1TauHandle; - iEvent.getByLabel(L1extraTauJetSource_,l1TauHandle); + iEvent.getByToken(tok_L1extTauJet_,l1TauHandle); l1extra::L1JetParticleCollection::const_iterator itr; for(itr = l1TauHandle->begin(); itr != l1TauHandle->end(); ++itr ) { t_L1TauJetPt ->push_back( itr->pt() ); @@ -199,7 +214,7 @@ void IsolatedGenParticles::analyze(const edm::Event& iEvent, const edm::EventSet // L1 Central Jets edm::Handle l1CenJetHandle; - iEvent.getByLabel(L1extraCenJetSource_,l1CenJetHandle); + iEvent.getByToken(tok_L1extCenJet_,l1CenJetHandle); for( itr = l1CenJetHandle->begin(); itr != l1CenJetHandle->end(); ++itr ) { t_L1CenJetPt ->push_back( itr->pt() ); t_L1CenJetEta ->push_back( itr->eta() ); @@ -212,7 +227,7 @@ void IsolatedGenParticles::analyze(const edm::Event& iEvent, const edm::EventSet } // L1 Forward Jets edm::Handle l1FwdJetHandle; - iEvent.getByLabel(L1extraFwdJetSource_,l1FwdJetHandle); + iEvent.getByToken(tok_L1extFwdJet_,l1FwdJetHandle); for( itr = l1FwdJetHandle->begin(); itr != l1FwdJetHandle->end(); ++itr ) { t_L1FwdJetPt ->push_back( itr->pt() ); t_L1FwdJetEta ->push_back( itr->eta() ); @@ -226,7 +241,7 @@ void IsolatedGenParticles::analyze(const edm::Event& iEvent, const edm::EventSet // L1 Isolated EM onjects l1extra::L1EmParticleCollection::const_iterator itrEm; edm::Handle l1IsoEmHandle ; - iEvent.getByLabel(L1extraIsoEmSource_, l1IsoEmHandle); + iEvent.getByToken(tok_L1Em_, l1IsoEmHandle); for( itrEm = l1IsoEmHandle->begin(); itrEm != l1IsoEmHandle->end(); ++itrEm ) { t_L1IsoEMPt ->push_back( itrEm->pt() ); t_L1IsoEMEta ->push_back( itrEm->eta() ); @@ -239,7 +254,7 @@ void IsolatedGenParticles::analyze(const edm::Event& iEvent, const edm::EventSet } // L1 Non-Isolated EM onjects edm::Handle l1NonIsoEmHandle ; - iEvent.getByLabel(L1extraNonIsoEmSource_, l1NonIsoEmHandle); + iEvent.getByToken(tok_L1extNonIsoEm_, l1NonIsoEmHandle); for( itrEm = l1NonIsoEmHandle->begin(); itrEm != l1NonIsoEmHandle->end(); ++itrEm ) { t_L1NonIsoEMPt ->push_back( itrEm->pt() ); t_L1NonIsoEMEta ->push_back( itrEm->eta() ); @@ -254,7 +269,7 @@ void IsolatedGenParticles::analyze(const edm::Event& iEvent, const edm::EventSet // L1 Muons l1extra::L1MuonParticleCollection::const_iterator itrMu; edm::Handle l1MuHandle ; - iEvent.getByLabel(L1extraMuonSource_, l1MuHandle); + iEvent.getByToken(tok_L1extMusrc_, l1MuHandle); for( itrMu = l1MuHandle->begin(); itrMu != l1MuHandle->end(); ++itrMu ) { t_L1MuonPt ->push_back( itrMu->pt() ); t_L1MuonEta ->push_back( itrMu->eta() ); diff --git a/Calibration/IsolatedParticles/plugins/IsolatedGenParticles.h b/Calibration/IsolatedParticles/plugins/IsolatedGenParticles.h index a6375bab5ce66..386032880620e 100644 --- a/Calibration/IsolatedParticles/plugins/IsolatedGenParticles.h +++ b/Calibration/IsolatedParticles/plugins/IsolatedGenParticles.h @@ -118,6 +118,9 @@ class IsolatedGenParticles : public edm::EDAnalyzer { std::string genSrc_; const MagneticField *bField; + edm::EDGetTokenT tok_hepmc_; + edm::EDGetTokenT tok_genParticles_; + bool initL1, useHepMC; static const size_t nL1BitsMax=128; std::string algoBitToName[nL1BitsMax]; @@ -133,6 +136,15 @@ class IsolatedGenParticles : public edm::EDAnalyzer { edm::InputTag L1extraMuonSource_, L1extraIsoEmSource_, L1extraNonIsoEmSource_; edm::InputTag L1GTReadoutRcdSource_, L1GTObjectMapRcdSource_; + edm::EDGetTokenT tok_L1GTrorsrc_; + edm::EDGetTokenT tok_L1GTobjmap_; + edm::EDGetTokenT tok_L1extMusrc_; + edm::EDGetTokenT tok_L1Em_; + edm::EDGetTokenT tok_L1extNonIsoEm_; + edm::EDGetTokenT tok_L1extTauJet_; + edm::EDGetTokenT tok_L1extCenJet_; + edm::EDGetTokenT tok_L1extFwdJet_; + edm::Service fs; diff --git a/Calibration/IsolatedParticles/plugins/IsolatedParticlesGeneratedJets.cc b/Calibration/IsolatedParticles/plugins/IsolatedParticlesGeneratedJets.cc index 36c141afb1928..0c12d3b7ad1c4 100644 --- a/Calibration/IsolatedParticles/plugins/IsolatedParticlesGeneratedJets.cc +++ b/Calibration/IsolatedParticles/plugins/IsolatedParticlesGeneratedJets.cc @@ -17,14 +17,13 @@ // #include "Calibration/IsolatedParticles/plugins/IsolatedParticlesGeneratedJets.h" -#include "DataFormats/HepMCCandidate/interface/GenParticleFwd.h" #include "DataFormats/HepMCCandidate/interface/GenParticle.h" IsolatedParticlesGeneratedJets::IsolatedParticlesGeneratedJets(const edm::ParameterSet& iConfig) { debug = iConfig.getUntrackedParameter ("Debug", false); - jetSrc = iConfig.getParameter("JetSource"); - partSrc = iConfig.getParameter("ParticleSource"); + tok_jets_ = consumes(iConfig.getParameter("JetSource")); + tok_parts_ = consumes(iConfig.getParameter("ParticleSource")); } @@ -39,11 +38,11 @@ void IsolatedParticlesGeneratedJets::analyze(const edm::Event& iEvent, const edm //=== genJet information edm::Handle genJets; - iEvent.getByLabel(jetSrc, genJets); + iEvent.getByToken(tok_jets_, genJets); //=== genJet information edm::Handle genParticles; - iEvent.getByLabel(partSrc, genParticles); + iEvent.getByToken(tok_parts_, genParticles); JetMatchingTools jetMatching (iEvent); std::vector > genJetConstituents (genJets->size()); diff --git a/Calibration/IsolatedParticles/plugins/IsolatedParticlesGeneratedJets.h b/Calibration/IsolatedParticles/plugins/IsolatedParticlesGeneratedJets.h index b256778aba640..443c5318f7eb2 100644 --- a/Calibration/IsolatedParticles/plugins/IsolatedParticlesGeneratedJets.h +++ b/Calibration/IsolatedParticles/plugins/IsolatedParticlesGeneratedJets.h @@ -20,6 +20,7 @@ #include "DataFormats/JetReco/interface/GenJet.h" #include "DataFormats/JetReco/interface/GenJetCollection.h" #include "RecoJets/JetProducers/interface/JetMatchingTools.h" +#include "DataFormats/HepMCCandidate/interface/GenParticleFwd.h" // root objects #include "TROOT.h" @@ -46,10 +47,12 @@ class IsolatedParticlesGeneratedJets : public edm::EDAnalyzer { void clearTreeVectors(); bool debug; - edm::InputTag jetSrc, partSrc; edm::Service fs; TTree *tree; + edm::EDGetTokenT tok_jets_; + edm::EDGetTokenT tok_parts_; + std::vector *t_gjetN; std::vector *t_gjetE, *t_gjetPt, *t_gjetEta, *t_gjetPhi; diff --git a/Calibration/IsolatedParticles/plugins/IsolatedTracksCone.cc b/Calibration/IsolatedParticles/plugins/IsolatedTracksCone.cc index 4359a06a8fb96..203d24c0daf85 100644 --- a/Calibration/IsolatedParticles/plugins/IsolatedTracksCone.cc +++ b/Calibration/IsolatedParticles/plugins/IsolatedTracksCone.cc @@ -65,12 +65,25 @@ IsolatedTracksCone::IsolatedTracksCone(const edm::ParameterSet& iConfig) { applyEcalIsolation_ = iConfig.getUntrackedParameter("ApplyEcalIsolation"); - _L1extraTauJetSource = - iConfig.getParameter("L1extraTauJetSource"); - _L1extraCenJetSource = - iConfig.getParameter("L1extraCenJetSource"); - _L1extraFwdJetSource = - iConfig.getParameter("L1extraFwdJetSource"); + tok_L1extTauJet_ = + consumes(iConfig.getParameter("L1extraTauJetSource")); + tok_L1extCenJet_ = + consumes(iConfig.getParameter("L1extraCenJetSource")); + tok_L1extFwdJet_ = + consumes(iConfig.getParameter("L1extraFwdJetSource")); + + // hard coded collection access + tok_EB_ = consumes(edm::InputTag("ecalRecHit","EcalRecHitsEB")); + tok_EE_ = consumes(edm::InputTag("ecalRecHit","EcalRecHitsEE")); + tok_hbhe_ = consumes(edm::InputTag("hbhereco")); + tok_genTrack_ = consumes(edm::InputTag("generalTracks")); + tok_simTk_ = consumes(edm::InputTag("g4SimHits")); + tok_simVtx_ = consumes(edm::InputTag("g4SimHits")); + tok_caloEB_ = consumes(edm::InputTag("g4SimHits", "EcalHitsEB")); + tok_caloEE_ = consumes(edm::InputTag("g4SimHits", "EcalHitsEE")); + tok_caloHH_ = consumes(edm::InputTag("g4SimHits", "HcalHits")); + tok_trigger_ = consumes(edm::InputTag("TriggerResults","","HLT")); + edm::ParameterSet parameters = iConfig.getParameter("TrackAssociatorParameters"); @@ -112,7 +125,7 @@ void IsolatedTracksCone::analyze(const edm::Event& iEvent, L1Pass = true; } else { edm::Handle l1TauHandle; - iEvent.getByLabel(_L1extraTauJetSource,l1TauHandle); + iEvent.getByToken(tok_L1extTauJet_,l1TauHandle); l1extra::L1JetParticleCollection::const_iterator itr; for(itr = l1TauHandle->begin(); itr != l1TauHandle->end(); ++itr ) { @@ -123,7 +136,7 @@ void IsolatedTracksCone::analyze(const edm::Event& iEvent, } } edm::Handle l1CenJetHandle; - iEvent.getByLabel(_L1extraCenJetSource,l1CenJetHandle); + iEvent.getByToken(tok_L1extCenJet_,l1CenJetHandle); for( itr = l1CenJetHandle->begin(); itr != l1CenJetHandle->end(); ++itr ) { if( itr->pt()>leadL1JetPT ) { @@ -133,7 +146,7 @@ void IsolatedTracksCone::analyze(const edm::Event& iEvent, } } edm::Handle l1FwdJetHandle; - iEvent.getByLabel(_L1extraFwdJetSource,l1FwdJetHandle); + iEvent.getByToken(tok_L1extFwdJet_,l1FwdJetHandle); for( itr = l1FwdJetHandle->begin(); itr != l1FwdJetHandle->end(); ++itr ) { if( itr->pt()>leadL1JetPT ) { @@ -188,8 +201,8 @@ void IsolatedTracksCone::analyze(const edm::Event& iEvent, edm::Handle barrelRecHitsHandle; edm::Handle endcapRecHitsHandle; - iEvent.getByLabel("ecalRecHit","EcalRecHitsEB",barrelRecHitsHandle); - iEvent.getByLabel("ecalRecHit","EcalRecHitsEE",endcapRecHitsHandle); + iEvent.getByToken(tok_EB_,barrelRecHitsHandle); + iEvent.getByToken(tok_EE_,endcapRecHitsHandle); // Retrieve the good/bad ECAL channels from the DB edm::ESHandle ecalChStatus; @@ -197,11 +210,11 @@ void IsolatedTracksCone::analyze(const edm::Event& iEvent, const EcalChannelStatus* theEcalChStatus = ecalChStatus.product(); edm::Handle hbhe; - iEvent.getByLabel("hbhereco",hbhe); + iEvent.getByToken(tok_hbhe_,hbhe); const HBHERecHitCollection Hithbhe = *(hbhe.product()); edm::Handle trkCollection; - iEvent.getByLabel("generalTracks", trkCollection); + iEvent.getByToken(tok_genTrack_, trkCollection); reco::TrackCollection::const_iterator trkItr; if(debugTrks_>1){ std::cout << "Track Collection: " << std::endl; @@ -213,21 +226,21 @@ void IsolatedTracksCone::analyze(const edm::Event& iEvent, //get Handles to SimTracks and SimHits edm::Handle SimTk; - if (doMC) iEvent.getByLabel("g4SimHits",SimTk); + if (doMC) iEvent.getByToken(tok_simTk_,SimTk); edm::SimTrackContainer::const_iterator simTrkItr; edm::Handle SimVtx; - if (doMC) iEvent.getByLabel("g4SimHits",SimVtx); + if (doMC) iEvent.getByToken(tok_simVtx_,SimVtx); //get Handles to PCaloHitContainers of eb/ee/hbhe edm::Handle pcaloeb; - if (doMC) iEvent.getByLabel("g4SimHits", "EcalHitsEB", pcaloeb); + if (doMC) iEvent.getByToken(tok_caloEB_, pcaloeb); edm::Handle pcaloee; - if (doMC) iEvent.getByLabel("g4SimHits", "EcalHitsEE", pcaloee); + if (doMC) iEvent.getByToken(tok_caloEE_, pcaloee); edm::Handle pcalohh; - if (doMC) iEvent.getByLabel("g4SimHits", "HcalHits", pcalohh); + if (doMC) iEvent.getByToken(tok_caloHH_, pcalohh); @@ -235,9 +248,8 @@ void IsolatedTracksCone::analyze(const edm::Event& iEvent, // Get HLT_IsoTrackHB/HE Information ///////////////////////////////////////////////////////// - edm::InputTag theTriggerResultsLabel ("TriggerResults","","HLT"); edm::Handle triggerResults; - iEvent.getByLabel( theTriggerResultsLabel, triggerResults); + iEvent.getByToken( tok_trigger_, triggerResults); diff --git a/Calibration/IsolatedParticles/plugins/IsolatedTracksCone.h b/Calibration/IsolatedParticles/plugins/IsolatedTracksCone.h index 4be9d4a870d00..42b785e34b0c1 100644 --- a/Calibration/IsolatedParticles/plugins/IsolatedTracksCone.h +++ b/Calibration/IsolatedParticles/plugins/IsolatedTracksCone.h @@ -120,7 +120,22 @@ class IsolatedTracksCone : public edm::EDAnalyzer { int myverbose_; bool useJetTrigger_; double drLeadJetVeto_, ptMinLeadJet_; - edm::InputTag _L1extraTauJetSource, _L1extraCenJetSource, _L1extraFwdJetSource; + + edm::EDGetTokenT tok_L1extTauJet_; + edm::EDGetTokenT tok_L1extCenJet_; + edm::EDGetTokenT tok_L1extFwdJet_; + + edm::EDGetTokenT tok_EB_; + edm::EDGetTokenT tok_EE_; + + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_genTrack_; + edm::EDGetTokenT tok_simTk_; + edm::EDGetTokenT tok_simVtx_; + edm::EDGetTokenT tok_caloEB_; + edm::EDGetTokenT tok_caloEE_; + edm::EDGetTokenT tok_caloHH_; + edm::EDGetTokenT tok_trigger_; double minTrackP_, maxTrackEta_, maxNearTrackP_; diff --git a/Calibration/IsolatedParticles/plugins/IsolatedTracksNxN.cc b/Calibration/IsolatedParticles/plugins/IsolatedTracksNxN.cc index 0b265e3f20dae..3bf0e1bdac2a5 100644 --- a/Calibration/IsolatedParticles/plugins/IsolatedTracksNxN.cc +++ b/Calibration/IsolatedParticles/plugins/IsolatedTracksNxN.cc @@ -62,6 +62,28 @@ IsolatedTracksNxN::IsolatedTracksNxN(const edm::ParameterSet& iConfig) { tMaxH_ = iConfig.getUntrackedParameter("TimeMaxCutHCAL", 500.); nbad = 0; + // define tokens for access + tok_L1extTauJet_ = consumes(L1extraTauJetSource_); + tok_L1extCenJet_ = consumes(L1extraCenJetSource_); + tok_L1extFwdJet_ = consumes(L1extraFwdJetSource_); + tok_L1extMu_ = consumes(L1extraMuonSource_); + tok_L1extIsoEm_ = consumes(L1extraIsoEmSource_); + tok_L1extNoIsoEm_ = consumes(L1extraNonIsoEmSource_); + tok_jets_ = consumes(JetSrc_); + tok_hbhe_ = consumes(HBHERecHitSource_); + + + tok_genTrack_ = consumes(edm::InputTag("generalTracks")); + tok_recVtx_ = consumes(edm::InputTag("offlinePrimaryVertices")); + tok_bs_ = consumes(edm::InputTag("offlineBeamSpot")); + tok_EB_ = consumes(edm::InputTag("ecalRecHit","EcalRecHitsEB")); + tok_EE_ = consumes(edm::InputTag("ecalRecHit","EcalRecHitsEE")); + tok_simTk_ = consumes(edm::InputTag("g4SimHits")); + tok_simVtx_ = consumes(edm::InputTag("g4SimHits")); + tok_caloEB_ = consumes(edm::InputTag("g4SimHits", "EcalHitsEB")); + tok_caloEE_ = consumes(edm::InputTag("g4SimHits", "EcalHitsEE")); + tok_caloHH_ = consumes(edm::InputTag("g4SimHits", "HcalHits")); + if(myverbose_>=0) { std::cout <<"Parameters read from config file \n" <<" doMC " << doMC @@ -113,7 +135,7 @@ void IsolatedTracksNxN::analyze(const edm::Event& iEvent, const edm::EventSetup& nEventProc++; edm::Handle trkCollection; - iEvent.getByLabel("generalTracks", trkCollection); + iEvent.getByToken(tok_genTrack_, trkCollection); reco::TrackCollection::const_iterator trkItr; if(debugTrks_>1){ std::cout << "Track Collection: " << std::endl; @@ -193,7 +215,7 @@ void IsolatedTracksNxN::analyze(const edm::Event& iEvent, const edm::EventSetup& // L1Taus edm::Handle l1TauHandle; - iEvent.getByLabel(L1extraTauJetSource_,l1TauHandle); + iEvent.getByToken(tok_L1extTauJet_,l1TauHandle); l1extra::L1JetParticleCollection::const_iterator itr; int iL1Obj=0; for(itr = l1TauHandle->begin(),iL1Obj=0; itr != l1TauHandle->end(); ++itr,iL1Obj++) { @@ -211,7 +233,7 @@ void IsolatedTracksNxN::analyze(const edm::Event& iEvent, const edm::EventSetup& // L1 Central Jets edm::Handle l1CenJetHandle; - iEvent.getByLabel(L1extraCenJetSource_,l1CenJetHandle); + iEvent.getByToken(tok_L1extCenJet_,l1CenJetHandle); for( itr = l1CenJetHandle->begin(),iL1Obj=0; itr != l1CenJetHandle->end(); ++itr,iL1Obj++ ) { if(iL1Obj<1) { t_L1CenJetPt ->push_back( itr->pt() ); @@ -227,7 +249,7 @@ void IsolatedTracksNxN::analyze(const edm::Event& iEvent, const edm::EventSetup& // L1 Forward Jets edm::Handle l1FwdJetHandle; - iEvent.getByLabel(L1extraFwdJetSource_,l1FwdJetHandle); + iEvent.getByToken(tok_L1extFwdJet_,l1FwdJetHandle); for( itr = l1FwdJetHandle->begin(),iL1Obj=0; itr != l1FwdJetHandle->end(); ++itr,iL1Obj++ ) { if(iL1Obj<1) { t_L1FwdJetPt ->push_back( itr->pt() ); @@ -244,7 +266,7 @@ void IsolatedTracksNxN::analyze(const edm::Event& iEvent, const edm::EventSetup& // L1 Isolated EM onjects l1extra::L1EmParticleCollection::const_iterator itrEm; edm::Handle l1IsoEmHandle ; - iEvent.getByLabel(L1extraIsoEmSource_, l1IsoEmHandle); + iEvent.getByToken(tok_L1extIsoEm_, l1IsoEmHandle); for( itrEm = l1IsoEmHandle->begin(),iL1Obj=0; itrEm != l1IsoEmHandle->end(); ++itrEm,iL1Obj++ ) { if(iL1Obj<1) { t_L1IsoEMPt ->push_back( itrEm->pt() ); @@ -260,7 +282,7 @@ void IsolatedTracksNxN::analyze(const edm::Event& iEvent, const edm::EventSetup& // L1 Non-Isolated EM onjects edm::Handle l1NonIsoEmHandle ; - iEvent.getByLabel(L1extraNonIsoEmSource_, l1NonIsoEmHandle); + iEvent.getByToken(tok_L1extNoIsoEm_, l1NonIsoEmHandle); for( itrEm = l1NonIsoEmHandle->begin(),iL1Obj=0; itrEm != l1NonIsoEmHandle->end(); ++itrEm,iL1Obj++ ) { if(iL1Obj<1) { t_L1NonIsoEMPt ->push_back( itrEm->pt() ); @@ -277,7 +299,7 @@ void IsolatedTracksNxN::analyze(const edm::Event& iEvent, const edm::EventSetup& // L1 Muons l1extra::L1MuonParticleCollection::const_iterator itrMu; edm::Handle l1MuHandle ; - iEvent.getByLabel(L1extraMuonSource_, l1MuHandle); + iEvent.getByToken(tok_L1extMu_, l1MuHandle); for( itrMu = l1MuHandle->begin(),iL1Obj=0; itrMu != l1MuHandle->end(); ++itrMu,iL1Obj++ ) { if(iL1Obj<1) { t_L1MuonPt ->push_back( itrMu->pt() ); @@ -295,7 +317,7 @@ void IsolatedTracksNxN::analyze(const edm::Event& iEvent, const edm::EventSetup& //============== store the information about all the Non-Fake vertices =============== edm::Handle recVtxs; - iEvent.getByLabel("offlinePrimaryVertices",recVtxs); + iEvent.getByToken(tok_recVtx_,recVtxs); std::vector svTracks; math::XYZPoint leadPV(0,0,0); @@ -369,14 +391,14 @@ void IsolatedTracksNxN::analyze(const edm::Event& iEvent, const edm::EventSetup& // Get the beamspot edm::Handle beamSpotH; - iEvent.getByLabel("offlineBeamSpot", beamSpotH); + iEvent.getByToken(tok_bs_, beamSpotH); math::XYZPoint bspot; bspot = ( beamSpotH.isValid() ) ? beamSpotH->position() : math::XYZPoint(0, 0, 0); //===================================================================== edm::Handle jets; - iEvent.getByLabel(JetSrc_,jets); + iEvent.getByToken(tok_jets_,jets); // edm::Handle jetExtender; // iEvent.getByLabel(JetExtender_,jetExtender); @@ -405,8 +427,8 @@ void IsolatedTracksNxN::analyze(const edm::Event& iEvent, const edm::EventSetup& edm::Handle barrelRecHitsHandle; edm::Handle endcapRecHitsHandle; - iEvent.getByLabel("ecalRecHit","EcalRecHitsEB",barrelRecHitsHandle); - iEvent.getByLabel("ecalRecHit","EcalRecHitsEE",endcapRecHitsHandle); + iEvent.getByToken(tok_EB_,barrelRecHitsHandle); + iEvent.getByToken(tok_EE_,endcapRecHitsHandle); // Retrieve the good/bad ECAL channels from the DB edm::ESHandle ecalChStatus; @@ -419,7 +441,7 @@ void IsolatedTracksNxN::analyze(const edm::Event& iEvent, const edm::EventSetup& const EcalTrigTowerConstituentsMap& ttMap = *hTtmap; edm::Handle hbhe; - iEvent.getByLabel(HBHERecHitSource_, hbhe); + iEvent.getByToken(tok_hbhe_, hbhe); if (!hbhe.isValid()) { nbad++; if (nbad < 10) std::cout << "No HBHE rechit collection\n"; @@ -429,21 +451,21 @@ void IsolatedTracksNxN::analyze(const edm::Event& iEvent, const edm::EventSetup& //get Handles to SimTracks and SimHits edm::Handle SimTk; - if (doMC) iEvent.getByLabel("g4SimHits",SimTk); + if (doMC) iEvent.getByToken(tok_simTk_,SimTk); edm::SimTrackContainer::const_iterator simTrkItr; edm::Handle SimVtx; - if (doMC) iEvent.getByLabel("g4SimHits",SimVtx); + if (doMC) iEvent.getByToken(tok_simVtx_,SimVtx); //get Handles to PCaloHitContainers of eb/ee/hbhe edm::Handle pcaloeb; - if (doMC) iEvent.getByLabel("g4SimHits", "EcalHitsEB", pcaloeb); + if (doMC) iEvent.getByToken(tok_caloEB_, pcaloeb); edm::Handle pcaloee; - if (doMC) iEvent.getByLabel("g4SimHits", "EcalHitsEE", pcaloee); + if (doMC) iEvent.getByToken(tok_caloEE_, pcaloee); edm::Handle pcalohh; - if (doMC) iEvent.getByLabel("g4SimHits", "HcalHits", pcalohh); + if (doMC) iEvent.getByToken(tok_caloHH_, pcalohh); //associates tracker rechits/simhits to a track TrackerHitAssociator* associate=0; diff --git a/Calibration/IsolatedParticles/plugins/IsolatedTracksNxN.h b/Calibration/IsolatedParticles/plugins/IsolatedTracksNxN.h index a8c9d8b866ed1..7baaef21efb0e 100644 --- a/Calibration/IsolatedParticles/plugins/IsolatedTracksNxN.h +++ b/Calibration/IsolatedParticles/plugins/IsolatedTracksNxN.h @@ -155,10 +155,33 @@ class IsolatedTracksNxN : public edm::EDAnalyzer { int myverbose_; edm::InputTag L1extraTauJetSource_, L1extraCenJetSource_, L1extraFwdJetSource_; edm::InputTag L1extraMuonSource_, L1extraIsoEmSource_, L1extraNonIsoEmSource_; - edm::InputTag L1GTReadoutRcdSource_, L1GTObjectMapRcdSource_; + edm::InputTag L1GTReadoutRcdSource_, L1GTObjectMapRcdSource_; // there is no associated data access edm::InputTag JetExtender_, JetSrc_; edm::InputTag HBHERecHitSource_; + edm::EDGetTokenT tok_L1extTauJet_; + edm::EDGetTokenT tok_L1extCenJet_; + edm::EDGetTokenT tok_L1extFwdJet_; + + edm::EDGetTokenT tok_L1extMu_; + edm::EDGetTokenT tok_L1extIsoEm_; + edm::EDGetTokenT tok_L1extNoIsoEm_; + + edm::EDGetTokenT tok_jets_; + edm::EDGetTokenT tok_hbhe_; + + edm::EDGetTokenT tok_genTrack_; + edm::EDGetTokenT tok_recVtx_; + edm::EDGetTokenT tok_bs_; + + edm::EDGetTokenT tok_EB_; + edm::EDGetTokenT tok_EE_; + edm::EDGetTokenT tok_simTk_; + edm::EDGetTokenT tok_simVtx_; + edm::EDGetTokenT tok_caloEB_; + edm::EDGetTokenT tok_caloEE_; + edm::EDGetTokenT tok_caloHH_; + double minTrackP_, maxTrackEta_; double tMinE_, tMaxE_, tMinH_, tMaxH_; int nEventProc; diff --git a/DQM/HcalMonitorModule/interface/HcalMonitorModule.h b/DQM/HcalMonitorModule/interface/HcalMonitorModule.h index 214411b4f91e4..64a201cd8a6fd 100644 --- a/DQM/HcalMonitorModule/interface/HcalMonitorModule.h +++ b/DQM/HcalMonitorModule/interface/HcalMonitorModule.h @@ -16,6 +16,9 @@ #include "DQM/HcalMonitorTasks/interface/HcalEtaPhiHists.h" +#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" + +#include "DataFormats/HcalDigi/interface/HcalUnpackerReport.h" // forward declarations class DQMStore; @@ -107,6 +110,9 @@ class HcalMonitorModule : public edm::EDAnalyzer std::string prefixME_; int NLumiBlocks_; + edm::EDGetTokenT tok_raw_; + edm::EDGetTokenT tok_report_; + int HBpresent_, HEpresent_, HOpresent_, HFpresent_; DQMStore* dbe_; diff --git a/DQM/HcalMonitorModule/interface/ZDCMonitorModule.h b/DQM/HcalMonitorModule/interface/ZDCMonitorModule.h index b400d3263c095..3974377fa8b30 100644 --- a/DQM/HcalMonitorModule/interface/ZDCMonitorModule.h +++ b/DQM/HcalMonitorModule/interface/ZDCMonitorModule.h @@ -21,6 +21,9 @@ #include "CalibFormats/HcalObjects/interface/HcalDbService.h" #include "CalibFormats/HcalObjects/interface/HcalDbRecord.h" +#include "DataFormats/HcalDigi/interface/HcalUnpackerReport.h" +#include "DQM/HcalMonitorTasks/interface/HcalZDCMonitor.h" + #include "FWCore/Utilities/interface/CPUTimer.h" class MonitorElement; @@ -137,6 +140,10 @@ class ZDCMonitorModule : public edm::EDAnalyzer{ edm::InputTag FEDRawDataCollection_; // not yet in use, but we still store the tag name + edm::EDGetTokenT tok_hcal_; + edm::EDGetTokenT tok_zdc_; + edm::EDGetTokenT tok_zdcrh_; + MonitorElement* meIEVTALL_; MonitorElement* meIEVTRAW_; MonitorElement* meIEVTDIGI_; diff --git a/DQM/HcalMonitorModule/src/HcalMonitorModule.cc b/DQM/HcalMonitorModule/src/HcalMonitorModule.cc index 4fc3dec9fb6a4..5b1e978502b93 100644 --- a/DQM/HcalMonitorModule/src/HcalMonitorModule.cc +++ b/DQM/HcalMonitorModule/src/HcalMonitorModule.cc @@ -5,10 +5,8 @@ #include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/HcalDetId/interface/HcalDetId.h" #include "DataFormats/HcalDigi/interface/HcalCalibrationEventTypes.h" -#include "DataFormats/HcalDigi/interface/HcalUnpackerReport.h" #include "DataFormats/Provenance/interface/EventID.h" #include "DataFormats/FEDRawData/interface/FEDNumbering.h" -#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/ESHandle.h" @@ -65,7 +63,10 @@ HcalMonitorModule::HcalMonitorModule(const edm::ParameterSet& ps) debug_ = ps.getUntrackedParameter("debug",0); FEDRawDataCollection_ = ps.getUntrackedParameter("FEDRawDataCollection"); + tok_raw_ = consumes(FEDRawDataCollection_); + inputLabelReport_ = ps.getUntrackedParameter("UnpackerReport"); + tok_report_ = consumes(inputLabelReport_); prefixME_ = ps.getUntrackedParameter("subSystemFolder","Hcal/"); if (prefixME_.substr(prefixME_.size()-1,prefixME_.size())!="/") @@ -338,7 +339,7 @@ void HcalMonitorModule::analyze(const edm::Event& e, const edm::EventSetup& c) // Try to get raw data edm::Handle rawraw; - if (!(e.getByLabel(FEDRawDataCollection_,rawraw))) + if (!(e.getByToken(tok_raw_,rawraw))) { edm::LogWarning("HcalMonitorModule")<<" raw data with label "< report; - if (!(e.getByLabel(inputLabelReport_,report))) + if (!(e.getByToken(tok_report_,report))) { edm::LogWarning("HcalMonitorModule")<<" Unpacker Report "< tok_gtro_; + edm::EDGetTokenT tok_L1mu_; - edm::InputTag hbheDigiCollectionTag_; - edm::InputTag hoDigiCollectionTag_; - edm::InputTag hfDigiCollectionTag_; + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_hf_; }; -HcalTimingMonitorModule::HcalTimingMonitorModule(const edm::ParameterSet& iConfig) : - hbheDigiCollectionTag_(iConfig.getParameter("hbheDigiCollectionTag")), - hoDigiCollectionTag_(iConfig.getParameter("hoDigiCollectionTag")), - hfDigiCollectionTag_(iConfig.getParameter("hfDigiCollectionTag")) { +HcalTimingMonitorModule::HcalTimingMonitorModule(const edm::ParameterSet& iConfig) { + + tok_hbhe_ = consumes(iConfig.getParameter("hbheDigiCollectionTag")); + tok_ho_ = consumes(iConfig.getParameter("hoDigiCollectionTag")); + tok_hf_ = consumes(iConfig.getParameter("hfDigiCollectionTag")); std::string str; parameters_ = iConfig; @@ -241,7 +243,11 @@ HcalTimingMonitorModule::HcalTimingMonitorModule(const edm::ParameterSet& iConfi run_number=0; TrigCSC=TrigDT=TrigRPC=TrigGCT=0; - L1ADataLabel = iConfig.getUntrackedParameter("L1ADataLabel" , "l1GtUnpack"); + std::string sLabel = iConfig.getUntrackedParameter("L1ADataLabel" , "l1GtUnpack"); + + tok_gtro_ = consumes(edm::InputTag(sLabel)); + tok_L1mu_ = consumes(edm::InputTag(sLabel)); + prescaleLS_ = parameters_.getUntrackedParameter("prescaleLS", 1); prescaleEvt_ = parameters_.getUntrackedParameter("prescaleEvt", 1); GCTTriggerBit1_= parameters_.getUntrackedParameter("GCTTriggerBit1", -1); @@ -310,8 +316,8 @@ int TRIGGER=0; run_number=iEvent.id().run(); // Check GCT trigger bits edm::Handle< L1GlobalTriggerReadoutRecord > gtRecord; - - if (!iEvent.getByLabel( L1ADataLabel, gtRecord)) + + if (!iEvent.getByToken( tok_gtro_, gtRecord)) return; const TechnicalTriggerWord tWord = gtRecord->technicalTriggerWord(); const DecisionWord dWord = gtRecord->decisionWord(); @@ -328,7 +334,7 @@ int TRIGGER=0; ///////////////////////////////////////////////////////////////////////////////////////// // define trigger trigger source (example from GMT group) edm::Handle gmtrc_handle; - if (!iEvent.getByLabel(L1ADataLabel,gmtrc_handle)) return; + if (!iEvent.getByToken(tok_L1mu_,gmtrc_handle)) return; L1MuGMTReadoutCollection const* gmtrc = gmtrc_handle.product(); int idt =0; @@ -419,7 +425,7 @@ int TRIGGER=0; ///////////////////////////////////////////////////////////////////////////////////////// if(counterEvt_<100){ edm::Handle hbhe; - iEvent.getByLabel(hbheDigiCollectionTag_, hbhe); + iEvent.getByToken(tok_hbhe_, hbhe); if (hbhe.isValid()) { for(HBHEDigiCollection::const_iterator digi=hbhe->begin();digi!=hbhe->end();digi++){ @@ -431,7 +437,7 @@ int TRIGGER=0; } } edm::Handle ho; - iEvent.getByLabel(hoDigiCollectionTag_, ho); + iEvent.getByToken(tok_ho_, ho); if (ho.isValid()) { for(HODigiCollection::const_iterator digi=ho->begin();digi!=ho->end();digi++){ @@ -443,7 +449,7 @@ int TRIGGER=0; } // if edm::Handle hf; - iEvent.getByLabel(hfDigiCollectionTag_, hf); + iEvent.getByToken(tok_hf_, hf); if (hf.isValid()) { for(HFDigiCollection::const_iterator digi=hf->begin();digi!=hf->end();digi++){ @@ -459,7 +465,7 @@ int TRIGGER=0; double data[10]; edm::Handle hbhe; - iEvent.getByLabel(hbheDigiCollectionTag_, hbhe); + iEvent.getByToken(tok_hbhe_, hbhe); if (hbhe.isValid()) { for(HBHEDigiCollection::const_iterator digi=hbhe->begin();digi!=hbhe->end();digi++){ @@ -499,7 +505,7 @@ int TRIGGER=0; } // if (...) edm::Handle ho; - iEvent.getByLabel(hoDigiCollectionTag_, ho); + iEvent.getByToken(tok_ho_, ho); if (ho.isValid()) { for(HODigiCollection::const_iterator digi=ho->begin();digi!=ho->end();digi++){ @@ -529,7 +535,7 @@ int TRIGGER=0; }// if (ho) edm::Handle hf; - iEvent.getByLabel(hfDigiCollectionTag_, hf); + iEvent.getByToken(tok_hf_, hf); if (hf.isValid()) { for(HFDigiCollection::const_iterator digi=hf->begin();digi!=hf->end();digi++){ diff --git a/DQM/HcalMonitorModule/src/ZDCMonitorModule.cc b/DQM/HcalMonitorModule/src/ZDCMonitorModule.cc index 4fc66b8a20e67..c1f3e5f1f0567 100644 --- a/DQM/HcalMonitorModule/src/ZDCMonitorModule.cc +++ b/DQM/HcalMonitorModule/src/ZDCMonitorModule.cc @@ -10,7 +10,6 @@ #include "FWCore/Utilities/interface/CPUTimer.h" #include "DataFormats/Provenance/interface/EventID.h" -#include "DataFormats/HcalDigi/interface/HcalUnpackerReport.h" #include "DataFormats/HcalDigi/interface/HcalCalibrationEventTypes.h" #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetup.h" #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h" @@ -18,7 +17,6 @@ #include "CalibCalorimetry/HcalAlgos/interface/HcalDbASCIIIO.h" #include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/HcalDetId/interface/HcalDetId.h" -#include "DQM/HcalMonitorTasks/interface/HcalZDCMonitor.h" #include "CondFormats/HcalObjects/interface/HcalChannelStatus.h" #include "CondFormats/HcalObjects/interface/HcalChannelQuality.h" @@ -49,6 +47,11 @@ ZDCMonitorModule::ZDCMonitorModule(const edm::ParameterSet& ps){ inputLabelDigi_ = ps.getParameter("digiLabel"); inputLabelRecHitZDC_ = ps.getParameter("zdcRecHitLabel"); + + tok_hcal_ = consumes(inputLabelDigi_); + tok_zdc_ = consumes(inputLabelDigi_); + tok_zdcrh_ = consumes(inputLabelRecHitZDC_); + showTiming_ = ps.getUntrackedParameter("showTiming", false); //-- show CPU time dump2database_ = ps.getUntrackedParameter("dump2database",false); //-- dumps output to database file // Check Online running @@ -272,7 +275,7 @@ void ZDCMonitorModule::analyze(const edm::Event& e, const edm::EventSetup& event bool zdchitOK_ = true; edm::Handle report; - e.getByLabel(inputLabelDigi_,report); + e.getByToken(tok_hcal_,report); if (!report.isValid()) { rawOK_=false; @@ -335,7 +338,7 @@ void ZDCMonitorModule::analyze(const edm::Event& e, const edm::EventSetup& event /////////////////////////////////////////////////////////////////////////////////////////// // try to get digis edm::Handle zdc_digi; - e.getByLabel(inputLabelDigi_,zdc_digi); + e.getByToken(tok_zdc_,zdc_digi); if (!zdc_digi.isValid()) { digiOK_=false; @@ -348,7 +351,7 @@ void ZDCMonitorModule::analyze(const edm::Event& e, const edm::EventSetup& event // try to get rechits edm::Handle zdc_hits; - e.getByLabel(inputLabelRecHitZDC_,zdc_hits); + e.getByToken(tok_zdcrh_,zdc_hits); if (!zdc_hits.isValid()) { zdchitOK_=false; diff --git a/DQM/HcalMonitorTasks/interface/HcalBeamMonitor.h b/DQM/HcalMonitorTasks/interface/HcalBeamMonitor.h index 60170573ae072..67f9b6fc60212 100644 --- a/DQM/HcalMonitorTasks/interface/HcalBeamMonitor.h +++ b/DQM/HcalMonitorTasks/interface/HcalBeamMonitor.h @@ -134,6 +134,11 @@ class HcalBeamMonitor: public HcalBaseDQMonitor { int minBadCells_; // number of channels that must be bad to be included in problem summary edm::InputTag digiLabel_; edm::InputTag hbheRechitLabel_, hfRechitLabel_, hoRechitLabel_; + + edm::EDGetTokenT tok_hfdigi_; + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_hf_; + edm::EDGetTokenT tok_ho_; }; // class HcalBeamMonitor #endif diff --git a/DQM/HcalMonitorTasks/interface/HcalCoarsePedestalMonitor.h b/DQM/HcalMonitorTasks/interface/HcalCoarsePedestalMonitor.h index fe5f5b7e690ca..8d1a7a57e7041 100644 --- a/DQM/HcalMonitorTasks/interface/HcalCoarsePedestalMonitor.h +++ b/DQM/HcalMonitorTasks/interface/HcalCoarsePedestalMonitor.h @@ -61,6 +61,12 @@ class HcalCoarsePedestalMonitor: public HcalBaseDQMonitor { int minEvents_; bool excludeHORing2_; + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_hf_; + edm::EDGetTokenT tok_report_; + + }; #endif diff --git a/DQM/HcalMonitorTasks/interface/HcalDataIntegrityTask.h b/DQM/HcalMonitorTasks/interface/HcalDataIntegrityTask.h index aae5c0812f998..c576b337cf3be 100644 --- a/DQM/HcalMonitorTasks/interface/HcalDataIntegrityTask.h +++ b/DQM/HcalMonitorTasks/interface/HcalDataIntegrityTask.h @@ -102,6 +102,9 @@ class HcalDataIntegrityTask: public HcalBaseDQMonitor edm::InputTag inputLabelRawData_; edm::InputTag inputLabelReport_; + edm::EDGetTokenT tok_raw_; + edm::EDGetTokenT tok_report_; + }; // For crate numbers: diff --git a/DQM/HcalMonitorTasks/interface/HcalDeadCellMonitor.h b/DQM/HcalMonitorTasks/interface/HcalDeadCellMonitor.h index e2aae2a58ba46..785aaefe8a434 100644 --- a/DQM/HcalMonitorTasks/interface/HcalDeadCellMonitor.h +++ b/DQM/HcalMonitorTasks/interface/HcalDeadCellMonitor.h @@ -113,6 +113,15 @@ class HcalDeadCellMonitor: public HcalBaseDQMonitor { edm::InputTag digiLabel_; edm::InputTag hbheRechitLabel_, hoRechitLabel_, hfRechitLabel_; + edm::EDGetTokenT tok_dcs_; + edm::EDGetTokenT tok_hbhedigi_; + edm::EDGetTokenT tok_hodigi_; + edm::EDGetTokenT tok_hfdigi_; + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_hf_; + edm::EDGetTokenT tok_gtEvm_; + bool endLumiProcessed_; bool excludeHORing2_; diff --git a/DQM/HcalMonitorTasks/interface/HcalDetDiagNoiseMonitor.h b/DQM/HcalMonitorTasks/interface/HcalDetDiagNoiseMonitor.h index df566e2d164e5..acbfd17a0c2ce 100644 --- a/DQM/HcalMonitorTasks/interface/HcalDetDiagNoiseMonitor.h +++ b/DQM/HcalMonitorTasks/interface/HcalDetDiagNoiseMonitor.h @@ -13,6 +13,12 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/InputTag.h" +#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" +#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h" +#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" +// to retrive trigger information (local runs only) +#include "TBDataFormats/HcalTBObjects/interface/HcalTBTriggerData.h" + // forward declarations class HcalDetDiagNoiseRMSummary; class DQMStore; @@ -43,10 +49,14 @@ class HcalDetDiagNoiseMonitor:public HcalBaseDQMonitor { void UpdateHistos(); int GetStatistics(){ return ievt_; } private: - edm::InputTag L1ADataLabel_; edm::InputTag digiLabel_; - edm::InputTag rawDataLabel_; - edm::InputTag hcalTBTriggerDataTag_; + + edm::EDGetTokenT tok_raw_; + edm::EDGetTokenT tok_tb_; + edm::EDGetTokenT tok_l1_; + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_ho_; + std::string OutputFilePath; bool Overwrite; diff --git a/DQM/HcalMonitorTasks/interface/HcalDetDiagTimingMonitor.h b/DQM/HcalMonitorTasks/interface/HcalDetDiagTimingMonitor.h index d08ae82a81b6a..e324099a2025e 100644 --- a/DQM/HcalMonitorTasks/interface/HcalDetDiagTimingMonitor.h +++ b/DQM/HcalMonitorTasks/interface/HcalDetDiagTimingMonitor.h @@ -14,6 +14,11 @@ #include "CalibFormats/HcalObjects/interface/HcalDbService.h" #include "CalibFormats/HcalObjects/interface/HcalDbRecord.h" +#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" +#include "DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTReadoutCollection.h" +#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h" +// this is to retrieve HCAL digi's +#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" /** \class HcalDetDiagTimingMonitor * @@ -108,7 +113,13 @@ class HcalDetDiagTimingMonitor:public HcalBaseDQMonitor { private: edm::InputTag inputLabelDigi_; edm::InputTag L1ADataLabel_; - edm::InputTag FEDRawDataCollection_; + + edm::EDGetTokenT tok_raw_; + edm::EDGetTokenT tok_l1_; + edm::EDGetTokenT tok_l1mu_; + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_hf_; int GCTTriggerBit1_; int GCTTriggerBit2_; diff --git a/DQM/HcalMonitorTasks/interface/HcalDigiMonitor.h b/DQM/HcalMonitorTasks/interface/HcalDigiMonitor.h index 0c370ffbe9cd2..0249ebcf2e190 100644 --- a/DQM/HcalMonitorTasks/interface/HcalDigiMonitor.h +++ b/DQM/HcalMonitorTasks/interface/HcalDigiMonitor.h @@ -13,6 +13,8 @@ #include "DataFormats/FEDRawData/interface/FEDTrailer.h" #include "CalibFormats/HcalObjects/interface/HcalDbRecord.h" #include "DataFormats/Scalers/interface/DcsStatus.h" +#include "DataFormats/Common/interface/TriggerResults.h" +#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" #define DIGI_BQ_FRAC_NBINS 101 #define DIGI_NUM 9072 @@ -215,13 +217,20 @@ class HcalDigiMonitor: public HcalBaseDQMonitor { edm::InputTag digiLabel_; edm::InputTag FEDRawDataCollection_; + + edm::EDGetTokenT tok_raw_; + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_hf_; + edm::EDGetTokenT tok_unpack_; + edm::EDGetTokenT tok_trigger_; + edm::EDGetTokenT tok_hfrec_; edm::ESHandle conditions_; edm::InputTag hltresultsLabel_; std::vector MinBiasHLTBits_; - edm::InputTag hfRechitLabel_; // used for calculating HF total ET double HT_HFP_, HT_HFM_; // Should be able to make this a vector of ints, right? diff --git a/DQM/HcalMonitorTasks/interface/HcalHotCellMonitor.h b/DQM/HcalMonitorTasks/interface/HcalHotCellMonitor.h index c69144e833621..6da8199b5674a 100644 --- a/DQM/HcalMonitorTasks/interface/HcalHotCellMonitor.h +++ b/DQM/HcalMonitorTasks/interface/HcalHotCellMonitor.h @@ -126,6 +126,9 @@ class HcalHotCellMonitor: public HcalBaseDQMonitor { hotNeighborParams HBHENeighborParams_, HONeighborParams_, HFNeighborParams_; edm::InputTag hbheRechitLabel_, hoRechitLabel_, hfRechitLabel_; + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_hf_; }; #endif diff --git a/DQM/HcalMonitorTasks/interface/HcalNZSMonitor.h b/DQM/HcalMonitorTasks/interface/HcalNZSMonitor.h index 5187d94f0de40..a2f82a9d24cb6 100644 --- a/DQM/HcalMonitorTasks/interface/HcalNZSMonitor.h +++ b/DQM/HcalMonitorTasks/interface/HcalNZSMonitor.h @@ -51,6 +51,8 @@ class HcalNZSMonitor: public HcalBaseDQMonitor edm::InputTag rawdataLabel_; edm::InputTag hltresultsLabel_; + edm::EDGetTokenT tok_raw_; + edm::EDGetTokenT tok_res_; }; diff --git a/DQM/HcalMonitorTasks/interface/HcalNoiseMonitor.h b/DQM/HcalMonitorTasks/interface/HcalNoiseMonitor.h index a0a3d6cdda13f..c33114ac71b24 100644 --- a/DQM/HcalMonitorTasks/interface/HcalNoiseMonitor.h +++ b/DQM/HcalMonitorTasks/interface/HcalNoiseMonitor.h @@ -6,6 +6,9 @@ #include "EventFilter/HcalRawToDigi/interface/HcalUnpacker.h" // need for emap #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" #include "DataFormats/Common/interface/TriggerResults.h" +#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" +#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" +#include "RecoMET/METAlgorithms/interface/HcalNoiseRBXArray.h" class HcalNoiseMonitor; struct TriangleFitResult; @@ -42,11 +45,12 @@ class HcalNoiseMonitor: public HcalBaseDQMonitor private: // Monitoring elements - edm::InputTag rawdataLabel_; - edm::InputTag hltresultsLabel_; - edm::InputTag hbheDigiLabel_; - edm::InputTag hbheRechitLabel_; - edm::InputTag noiseLabel_; + edm::InputTag rawdataLabel_; // no data access associated - + edm::InputTag hltresultsLabel_; // no data access associated + + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_hbherec_; + edm::EDGetTokenT tok_noise_; // Double-chi2 related stuff MonitorElement *hNominalChi2; diff --git a/DQM/HcalMonitorTasks/interface/HcalRawDataMonitor.h b/DQM/HcalMonitorTasks/interface/HcalRawDataMonitor.h index 90d48e10a5d41..873ef44ad4a85 100644 --- a/DQM/HcalMonitorTasks/interface/HcalRawDataMonitor.h +++ b/DQM/HcalMonitorTasks/interface/HcalRawDataMonitor.h @@ -56,6 +56,10 @@ class HcalRawDataMonitor: public HcalBaseDQMonitor { edm::InputTag FEDRawDataCollection_; edm::InputTag digiLabel_; + + edm::EDGetTokenT tok_raw_; + edm::EDGetTokenT tok_unpack_; + const HcalElectronicsMap* readoutMap_; //Electronics map -> geographic channel map inline int hashup(uint32_t d=0, uint32_t s=0, uint32_t c=1) { diff --git a/DQM/HcalMonitorTasks/interface/HcalRecHitMonitor.h b/DQM/HcalMonitorTasks/interface/HcalRecHitMonitor.h index 490e67ee84c50..8cf2298dbb589 100644 --- a/DQM/HcalMonitorTasks/interface/HcalRecHitMonitor.h +++ b/DQM/HcalMonitorTasks/interface/HcalRecHitMonitor.h @@ -228,8 +228,14 @@ class HcalRecHitMonitor: public HcalBaseDQMonitor { bool setupDone_; edm::InputTag hbheRechitLabel_, hoRechitLabel_, hfRechitLabel_; - edm::InputTag l1gtLabel_; + edm::InputTag l1gtLabel_; // no associated access edm::InputTag hltresultsLabel_; + + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_hf_; + edm::EDGetTokenT tok_trigger_; + std::vector HcalHLTBits_; std::vector MinBiasHLTBits_; }; diff --git a/DQM/HcalMonitorTasks/interface/HcalTrigPrimMonitor.h b/DQM/HcalMonitorTasks/interface/HcalTrigPrimMonitor.h index 649d8058e92f4..ad19ff5b6eb6a 100644 --- a/DQM/HcalMonitorTasks/interface/HcalTrigPrimMonitor.h +++ b/DQM/HcalMonitorTasks/interface/HcalTrigPrimMonitor.h @@ -29,6 +29,10 @@ class HcalTrigPrimMonitor: public HcalBaseDQMonitor { private: edm::InputTag dataLabel_; edm::InputTag emulLabel_; + + edm::EDGetTokenT tok_data_; + edm::EDGetTokenT tok_emu_; + std::vector ZSBadTPThreshold_; std::vector ZSAlarmThreshold_; diff --git a/DQM/HcalMonitorTasks/src/HcalBeamMonitor.cc b/DQM/HcalMonitorTasks/src/HcalBeamMonitor.cc index 4300d41ee421f..0c24259d637e6 100644 --- a/DQM/HcalMonitorTasks/src/HcalBeamMonitor.cc +++ b/DQM/HcalMonitorTasks/src/HcalBeamMonitor.cc @@ -54,9 +54,16 @@ HcalBeamMonitor::HcalBeamMonitor(const edm::ParameterSet& ps): // Collection type info digiLabel_ =ps.getUntrackedParameter("digiLabel"); + tok_hfdigi_ = consumes(digiLabel_); hbheRechitLabel_ = ps.getUntrackedParameter("hbheRechitLabel"); + + tok_hbhe_ = consumes(hbheRechitLabel_); + hoRechitLabel_ = ps.getUntrackedParameter("hoRechitLabel"); + tok_ho_ = consumes(hoRechitLabel_); + hfRechitLabel_ = ps.getUntrackedParameter("hfRechitLabel"); + tok_hf_ = consumes(hfRechitLabel_); // minimum events required in lumi block for tests to be processed minEvents_ = ps.getUntrackedParameter("minEvents",500); @@ -476,24 +483,24 @@ void HcalBeamMonitor::analyze(const edm::Event& e, const edm::EventSetup& c) edm::Handle ho_rechit; edm::Handle hf_rechit; - if (!(e.getByLabel(digiLabel_,hf_digi))) + if (!(e.getByToken(tok_hfdigi_,hf_digi))) { edm::LogWarning("HcalBeamMonitor")<< digiLabel_<<" hf_digi not available"; return; } - if (!(e.getByLabel(hbheRechitLabel_,hbhe_rechit))) + if (!(e.getByToken(tok_hbhe_,hbhe_rechit))) { edm::LogWarning("HcalBeamMonitor")<< hbheRechitLabel_<<" hbhe_rechit not available"; return; } - if (!(e.getByLabel(hfRechitLabel_,hf_rechit))) + if (!(e.getByToken(tok_hf_,hf_rechit))) { edm::LogWarning("HcalBeamMonitor")<< hfRechitLabel_<<" hf_rechit not available"; return; } - if (!(e.getByLabel(hoRechitLabel_,ho_rechit))) + if (!(e.getByToken(tok_ho_,ho_rechit))) { edm::LogWarning("HcalBeamMonitor")<< hoRechitLabel_<<" ho_rechit not available"; return; diff --git a/DQM/HcalMonitorTasks/src/HcalCoarsePedestalMonitor.cc b/DQM/HcalMonitorTasks/src/HcalCoarsePedestalMonitor.cc index 32f72016d7fd2..dfa8d09acaba1 100644 --- a/DQM/HcalMonitorTasks/src/HcalCoarsePedestalMonitor.cc +++ b/DQM/HcalMonitorTasks/src/HcalCoarsePedestalMonitor.cc @@ -33,6 +33,11 @@ HcalCoarsePedestalMonitor::HcalCoarsePedestalMonitor(const edm::ParameterSet& ps minEvents_ = ps.getUntrackedParameter("minEvents",100); // minimum number of events needed before histograms are filled excludeHORing2_ = ps.getUntrackedParameter("excludeHORing2",false); + tok_hbhe_ = consumes(digiLabel_); + tok_ho_ = consumes(digiLabel_); + tok_hf_ = consumes(digiLabel_); + tok_report_ = consumes(digiLabel_); + } @@ -129,23 +134,23 @@ void HcalCoarsePedestalMonitor::analyze(edm::Event const&e, edm::EventSetup cons edm::Handle hf_digi; edm::Handle report; - if (!(e.getByLabel(digiLabel_,hbhe_digi))) + if (!(e.getByToken(tok_hbhe_,hbhe_digi))) { edm::LogWarning("HcalCoarsePedestalMonitor")<< digiLabel_<<" hbhe_digi not available"; return; } - if (!(e.getByLabel(digiLabel_,hf_digi))) + if (!(e.getByToken(tok_hf_,hf_digi))) { edm::LogWarning("HcalCoarsePedestalMonitor")<< digiLabel_<<" hf_digi not available"; return; } - if (!(e.getByLabel(digiLabel_,ho_digi))) + if (!(e.getByToken(tok_ho_,ho_digi))) { edm::LogWarning("HcalCoarsePedestalMonitor")<< digiLabel_<<" ho_digi not available"; return; } - if (!(e.getByLabel(digiLabel_,report))) + if (!(e.getByToken(tok_report_,report))) { edm::LogWarning("HcalCoarsePedestalMonitor")<< digiLabel_<<" unpacker report not available"; return; diff --git a/DQM/HcalMonitorTasks/src/HcalDataIntegrityTask.cc b/DQM/HcalMonitorTasks/src/HcalDataIntegrityTask.cc index dd585164f6e28..5b4dfbb67052c 100644 --- a/DQM/HcalMonitorTasks/src/HcalDataIntegrityTask.cc +++ b/DQM/HcalMonitorTasks/src/HcalDataIntegrityTask.cc @@ -28,6 +28,11 @@ HcalDataIntegrityTask::HcalDataIntegrityTask(const edm::ParameterSet& ps) inputLabelRawData_ = ps.getUntrackedParameter("RawDataLabel",edm::InputTag("source")); inputLabelReport_ = ps.getUntrackedParameter("UnpackerReportLabel",edm::InputTag("hcalDigis")); + + // register for data access + tok_raw_ = consumes(inputLabelRawData_); + tok_report_ = consumes(inputLabelReport_); + } // HcalDataIntegrityTask::HcalDataIntegrityTask() HcalDataIntegrityTask::~HcalDataIntegrityTask() {} @@ -155,14 +160,14 @@ void HcalDataIntegrityTask::analyze(edm::Event const&e, edm::EventSetup const&s) edm::Handle rawraw; // Trying new getByLabel - if (!(e.getByLabel(inputLabelRawData_,rawraw))) + if (!(e.getByToken(tok_raw_,rawraw))) { if (debug_>0) edm::LogWarning("HcalDataIntegrityTask")<<" raw data with label "< report; - if (!(e.getByLabel(inputLabelReport_,report))) + if (!(e.getByToken(tok_report_,report))) { if (debug_>0) edm::LogWarning("HcalDataIntegrityTask")<<" UnpackerReport with label "<(edm::InputTag("scalersRawToDigi")); + tok_hbhedigi_ = consumes(digiLabel_); + tok_hodigi_ = consumes(digiLabel_); + tok_hfdigi_ = consumes(digiLabel_); + tok_hbhe_ = consumes(hbheRechitLabel_); + tok_ho_ = consumes(hoRechitLabel_); + tok_hf_ = consumes(hfRechitLabel_); + tok_gtEvm_ = consumes(edm::InputTag("gtEvmDigis")); + + } //constructor HcalDeadCellMonitor::~HcalDeadCellMonitor() @@ -642,7 +654,7 @@ void HcalDeadCellMonitor::analyze(edm::Event const&e, edm::EventSetup const&s) ///////////////////////////////////////////////////////////////// // check if detectors whether they were ON edm::Handle dcsStatus; - e.getByLabel("scalersRawToDigi", dcsStatus); + e.getByToken(tok_dcs_, dcsStatus); if (dcsStatus.isValid() && dcsStatus->size() != 0) { @@ -671,39 +683,39 @@ void HcalDeadCellMonitor::analyze(edm::Event const&e, edm::EventSetup const&s) } /////////////////////////////////////////////////////////////// - if (!(e.getByLabel(digiLabel_,hbhe_digi))) + if (!(e.getByToken(tok_hbhedigi_,hbhe_digi))) { edm::LogWarning("HcalDeadCellMonitor")<< digiLabel_<<" hbhe_digi not available"; return; } - if (!(e.getByLabel(digiLabel_,ho_digi))) + if (!(e.getByToken(tok_hodigi_,ho_digi))) { edm::LogWarning("HcalDeadCellMonitor")<< digiLabel_<<" ho_digi not available"; return; } - if (!(e.getByLabel(digiLabel_,hf_digi))) + if (!(e.getByToken(tok_hfdigi_,hf_digi))) { edm::LogWarning("HcalDeadCellMonitor")<< digiLabel_<<" hf_digi not available"; return; } - if (!(e.getByLabel(hbheRechitLabel_,hbhe_rechit))) + if (!(e.getByToken(tok_hbhe_,hbhe_rechit))) { edm::LogWarning("HcalDeadCellMonitor")<< hbheRechitLabel_<<" hbhe_rechit not available"; return; } - if (!(e.getByLabel(hfRechitLabel_,hf_rechit))) + if (!(e.getByToken(tok_hf_,hf_rechit))) { edm::LogWarning("HcalDeadCellMonitor")<< hfRechitLabel_<<" hf_rechit not available"; return; } - if (!(e.getByLabel(hoRechitLabel_,ho_rechit))) + if (!(e.getByToken(tok_ho_,ho_rechit))) { edm::LogWarning("HcalDeadCellMonitor")<< hoRechitLabel_<<" ho_rechit not available"; return; } - if (!(e.getByLabel("gtEvmDigis", gtEvm_handle))) + if (!(e.getByToken(tok_gtEvm_, gtEvm_handle))) { edm::LogWarning("HcalDeadCellMonitor")<< "gtEvmDigis"<<" gtEvmDigis not available"; return; diff --git a/DQM/HcalMonitorTasks/src/HcalDetDiagLEDMonitor.cc b/DQM/HcalMonitorTasks/src/HcalDetDiagLEDMonitor.cc index 0e94bc4f285d5..77ad694320acc 100644 --- a/DQM/HcalMonitorTasks/src/HcalDetDiagLEDMonitor.cc +++ b/DQM/HcalMonitorTasks/src/HcalDetDiagLEDMonitor.cc @@ -209,8 +209,12 @@ class HcalDetDiagLEDMonitor:public HcalBaseDQMonitor { EtaPhiHists *ChannelStatusTimeRMS; edm::InputTag digiLabel_; - edm::InputTag calibDigiLabel_; - edm::InputTag hcalTBTriggerDataTag_; + + edm::EDGetTokenT tok_tb_; + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_hf_; + edm::EDGetTokenT tok_calib_; std::map KnownBadCells_; @@ -235,9 +239,9 @@ static const float adc2fC[128]={-0.5,0.5,1.5,2.5,3.5,4.5,5.5,6.5,7.5,8.5,9.5, 10 -HcalDetDiagLEDMonitor::HcalDetDiagLEDMonitor(const edm::ParameterSet& ps) : - hcalTBTriggerDataTag_(ps.getParameter("hcalTBTriggerDataTag")) -{ +HcalDetDiagLEDMonitor::HcalDetDiagLEDMonitor(const edm::ParameterSet& ps) { + + ievt_=0; dataset_seq_number=1; run_number=-1; @@ -267,10 +271,18 @@ HcalDetDiagLEDMonitor::HcalDetDiagLEDMonitor(const edm::ParameterSet& ps) : XmlFilePath = ps.getUntrackedParameter("XmlFilePath", ""); digiLabel_ = ps.getUntrackedParameter("digiLabel", edm::InputTag("hcalDigis")); - calibDigiLabel_ = ps.getUntrackedParameter("calibDigiLabel",edm::InputTag("hcalDigis")); emap=0; needLogicalMap_ = true; + + // register for data access + tok_tb_ = consumes(ps.getParameter("hcalTBTriggerDataTag")); + tok_hbhe_ = consumes(digiLabel_); + tok_ho_ = consumes(digiLabel_); + tok_hf_ = consumes(digiLabel_); + tok_calib_ = consumes(ps.getUntrackedParameter("calibDigiLabel",edm::InputTag("hcalDigis"))); + + } HcalDetDiagLEDMonitor::~HcalDetDiagLEDMonitor(){} @@ -388,7 +400,7 @@ int eta,phi,depth,nTS; // for local runs edm::Handle trigger_data; - iEvent.getByLabel(hcalTBTriggerDataTag_, trigger_data); + iEvent.getByToken(tok_tb_, trigger_data); if(trigger_data.isValid()){ if(trigger_data->triggerWord()==6){ LEDEvent=true;LocalRun=true;} } @@ -403,7 +415,7 @@ int eta,phi,depth,nTS; double data[20]; edm::Handle hbhe; - iEvent.getByLabel(digiLabel_, hbhe); + iEvent.getByToken(tok_hbhe_, hbhe); if(hbhe.isValid()) for(HBHEDigiCollection::const_iterator digi=hbhe->begin();digi!=hbhe->end();digi++){ eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth(); nTS=digi->size(); if(digi->id().subdet()==HcalBarrel){ @@ -417,7 +429,7 @@ int eta,phi,depth,nTS; } edm::Handle ho; - iEvent.getByLabel(digiLabel_,ho); + iEvent.getByToken(tok_ho_,ho); if(ho.isValid()) for(HODigiCollection::const_iterator digi=ho->begin();digi!=ho->end();digi++){ eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth(); nTS=digi->size(); for(int i=0;isample(i).adc()&0xff]-2.5; @@ -425,7 +437,7 @@ int eta,phi,depth,nTS; } edm::Handle hf; - iEvent.getByLabel(digiLabel_,hf); + iEvent.getByToken(tok_hf_,hf); if(hf.isValid()) for(HFDigiCollection::const_iterator digi=hf->begin();digi!=hf->end();digi++){ eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth(); nTS=digi->size(); for(int i=0;isample(i).adc()&0xff]-2.5; @@ -433,7 +445,7 @@ int eta,phi,depth,nTS; } edm::Handle calib; - iEvent.getByLabel(calibDigiLabel_, calib); + iEvent.getByToken(tok_calib_, calib); if(calib.isValid())for(HcalCalibDigiCollection::const_iterator digi=calib->begin();digi!=calib->end();digi++){ if(digi->id().cboxChannel()!=0 || digi->id().hcalSubdet()==0) continue; nTS=digi->size(); diff --git a/DQM/HcalMonitorTasks/src/HcalDetDiagLaserMonitor.cc b/DQM/HcalMonitorTasks/src/HcalDetDiagLaserMonitor.cc index 23ec3b259893a..fe969db8c10e2 100644 --- a/DQM/HcalMonitorTasks/src/HcalDetDiagLaserMonitor.cc +++ b/DQM/HcalMonitorTasks/src/HcalDetDiagLaserMonitor.cc @@ -286,9 +286,13 @@ class HcalDetDiagLaserMonitor : public HcalBaseDQMonitor { const HcalElectronicsMap *emap; edm::InputTag inputLabelDigi_; - edm::InputTag calibDigiLabel_; - edm::InputTag rawDataLabel_; - edm::InputTag hcalTBTriggerDataTag_; + + edm::EDGetTokenT tok_raw_; + edm::EDGetTokenT tok_calib_; + edm::EDGetTokenT tok_tb_; + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_hf_; void SaveReference(); void SaveRaddamData(); @@ -370,9 +374,9 @@ class HcalDetDiagLaserMonitor : public HcalBaseDQMonitor { std::map KnownBadCells_; }; -HcalDetDiagLaserMonitor::HcalDetDiagLaserMonitor(const edm::ParameterSet& iConfig) : - hcalTBTriggerDataTag_(iConfig.getParameter("hcalTBTriggerDataTag")) -{ +HcalDetDiagLaserMonitor::HcalDetDiagLaserMonitor(const edm::ParameterSet& iConfig) { + + ievt_=-1; emap=0; dataset_seq_number=1; @@ -384,8 +388,6 @@ HcalDetDiagLaserMonitor::HcalDetDiagLaserMonitor(const edm::ParameterSet& iConfi nHBHEchecks=nHOchecks=nHFchecks=0; inputLabelDigi_ = iConfig.getUntrackedParameter("digiLabel",edm::InputTag("hcalDigis")); - calibDigiLabel_ = iConfig.getUntrackedParameter("calibDigiLabel",edm::InputTag("hcalDigis")); - rawDataLabel_ = iConfig.getUntrackedParameter("RawDataLabel",edm::InputTag("source")); ReferenceData = iConfig.getUntrackedParameter("LaserReferenceData" ,""); OutputFilePath = iConfig.getUntrackedParameter("OutputFilePath", ""); @@ -407,6 +409,15 @@ HcalDetDiagLaserMonitor::HcalDetDiagLaserMonitor(const edm::ParameterSet& iConfi LaserEnergyThreshold = iConfig.getUntrackedParameter("LaserEnergyThreshold",0.1); RaddamThreshold1 = iConfig.getUntrackedParameter("RaddamThreshold1",10.0); RaddamThreshold2 = iConfig.getUntrackedParameter("RaddamThreshold2",0.95); + + // register for data access + tok_tb_ = consumes(iConfig.getParameter("hcalTBTriggerDataTag")); + tok_raw_ = consumes(iConfig.getUntrackedParameter("RawDataLabel",edm::InputTag("source"))); + tok_calib_ = consumes(iConfig.getUntrackedParameter("calibDigiLabel",edm::InputTag("hcalDigis"))); + tok_hbhe_ = consumes(inputLabelDigi_); + tok_ho_ = consumes(inputLabelDigi_); + tok_hf_ = consumes(inputLabelDigi_); + } void HcalDetDiagLaserMonitor::beginRun(const edm::Run& run, const edm::EventSetup& c){ edm::ESHandle p; @@ -567,7 +578,7 @@ static int lastHBHEorbit,lastHOorbit,lastHForbit,nChecksHBHE,nChecksHO,nChecksH meRUN_->Fill(iEvent.id().run()); // for local runs edm::Handle trigger_data; - iEvent.getByLabel(hcalTBTriggerDataTag_, trigger_data); + iEvent.getByToken(tok_tb_, trigger_data); if(trigger_data.isValid()){ if(trigger_data->wasLaserTrigger()) LaserEvent=true; LocalRun=true; @@ -607,7 +618,7 @@ static int lastHBHEorbit,lastHOorbit,lastHForbit,nChecksHBHE,nChecksHO,nChecksH // Abort Gap laser if(LocalRun==false || LaserEvent==false){ edm::Handle rawdata; - iEvent.getByLabel(rawDataLabel_ ,rawdata); + iEvent.getByToken(tok_raw_ ,rawdata); // edm::Handle rawdata; // iEvent.getByType(rawdata); //checking FEDs for calibration information @@ -625,13 +636,13 @@ static int lastHBHEorbit,lastHOorbit,lastHForbit,nChecksHBHE,nChecksHO,nChecksH } if(!LaserEvent) return; edm::Handle hbhe; - iEvent.getByLabel(inputLabelDigi_,hbhe); + iEvent.getByToken(tok_hbhe_,hbhe); edm::Handle ho; - iEvent.getByLabel(inputLabelDigi_,ho); + iEvent.getByToken(tok_ho_,ho); edm::Handle hf; - iEvent.getByLabel(inputLabelDigi_,hf); + iEvent.getByToken(tok_hf_,hf); edm::Handle calib; - iEvent.getByLabel(calibDigiLabel_, calib); + iEvent.getByToken(tok_calib_, calib); if(LocalRun && LaserEvent){ int N=0; diff --git a/DQM/HcalMonitorTasks/src/HcalDetDiagNoiseMonitor.cc b/DQM/HcalMonitorTasks/src/HcalDetDiagNoiseMonitor.cc index 1d2e5cd22ebf6..8dee254d1ca17 100644 --- a/DQM/HcalMonitorTasks/src/HcalDetDiagNoiseMonitor.cc +++ b/DQM/HcalMonitorTasks/src/HcalDetDiagNoiseMonitor.cc @@ -1,6 +1,5 @@ #include "DQM/HcalMonitorTasks/interface/HcalDetDiagNoiseMonitor.h" #include "DataFormats/FEDRawData/interface/FEDRawData.h" -#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" #include "DataFormats/FEDRawData/interface/FEDNumbering.h" #include "DataFormats/HcalDigi/interface/HcalCalibrationEventTypes.h" #include "EventFilter/HcalRawToDigi/interface/HcalDCCHeader.h" @@ -31,12 +30,10 @@ #include "L1Trigger/RegionalCaloTrigger/interface/L1RCTProducer.h" #include "DataFormats/L1CaloTrigger/interface/L1CaloCollections.h" #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h" -#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" #include "HLTrigger/HLTanalyzers/interface/JetUtil.h" #include "DataFormats/METReco/interface/CaloMET.h" #include "DataFormats/METReco/interface/CaloMETCollection.h" // #include "DataFormats/L1Trigger/interface/L1ParticleMap.h" -#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h" #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetupFwd.h" #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMapRecord.h" #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMapFwd.h" @@ -58,8 +55,6 @@ // this is to retrieve HCAL LogicalMap #include "CondFormats/HcalObjects/interface/HcalLogicalMap.h" -// to retrive trigger information (local runs only) -#include "TBDataFormats/HcalTBObjects/interface/HcalTBTriggerData.h" #include @@ -157,9 +152,10 @@ class HcalDetDiagNoiseRMSummary{ HcalDetDiagNoiseRMData rm[HcalFrontEndId::maxRmIndex]; }; -HcalDetDiagNoiseMonitor::HcalDetDiagNoiseMonitor(const edm::ParameterSet& ps) : - hcalTBTriggerDataTag_(ps.getParameter("hcalTBTriggerDataTag")) -{ +HcalDetDiagNoiseMonitor::HcalDetDiagNoiseMonitor(const edm::ParameterSet& ps) { + + tok_tb_ = consumes(ps.getParameter("hcalTBTriggerDataTag")); + ievt_=0; run_number=-1; NoisyEvents=0; @@ -191,9 +187,13 @@ HcalDetDiagNoiseMonitor::HcalDetDiagNoiseMonitor(const edm::ParameterSet& ps) : SpikeThreshold = ps.getUntrackedParameter("NoiseSpikeThreshold",0.5); Overwrite = ps.getUntrackedParameter ("Overwrite",true); - rawDataLabel_ = ps.getUntrackedParameter("RawDataLabel",edm::InputTag("source","")); + tok_raw_ = consumes(ps.getUntrackedParameter("RawDataLabel",edm::InputTag("source",""))); digiLabel_ = ps.getUntrackedParameter("digiLabel",edm::InputTag("hcalDigis")); - L1ADataLabel_ = ps.getUntrackedParameter("gtLabel"); + tok_l1_ = consumes(ps.getUntrackedParameter("gtLabel")); + + + tok_hbhe_ = consumes(digiLabel_); + tok_ho_ = consumes(digiLabel_); RMSummary = 0; needLogicalMap_=true; @@ -298,7 +298,7 @@ void HcalDetDiagNoiseMonitor::analyze(const edm::Event& iEvent, const edm::Event // for local runs edm::Handle trigger_data; - iEvent.getByLabel(hcalTBTriggerDataTag_, trigger_data); + iEvent.getByToken(tok_tb_, trigger_data); if(trigger_data.isValid()){ if(trigger_data->triggerWord()>1000) isNoiseEvent=true; LocalRun=true; @@ -306,7 +306,7 @@ void HcalDetDiagNoiseMonitor::analyze(const edm::Event& iEvent, const edm::Event // We do not want to look at Abort Gap events edm::Handle rawdata; - iEvent.getByLabel(rawDataLabel_,rawdata); + iEvent.getByToken(tok_raw_,rawdata); //checking FEDs for calibration information for(int i=FEDNumbering::MINHCALFEDID;i<=FEDNumbering::MAXHCALFEDID; i++) { const FEDRawData& fedData = rawdata->FEDData(i) ; @@ -318,7 +318,7 @@ void HcalDetDiagNoiseMonitor::analyze(const edm::Event& iEvent, const edm::Event // Check GCT trigger bits edm::Handle< L1GlobalTriggerReadoutRecord > gtRecord; - iEvent.getByLabel(L1ADataLabel_, gtRecord); + iEvent.getByToken(tok_l1_, gtRecord); if(gtRecord.isValid()){ const TechnicalTriggerWord tWord = gtRecord->technicalTriggerWord(); if(tWord.at(11) || tWord.at(12)) isNoiseEvent=true; @@ -354,7 +354,7 @@ void HcalDetDiagNoiseMonitor::analyze(const edm::Event& iEvent, const edm::Event HcalDetDiagNoiseRMEvent RMs[HcalFrontEndId::maxRmIndex]; edm::Handle hbhe; - iEvent.getByLabel(digiLabel_,hbhe); + iEvent.getByToken(tok_hbhe_,hbhe); for(HBHEDigiCollection::const_iterator digi=hbhe->begin();digi!=hbhe->end();digi++){ double max=-100/*,sum*/,energy=0; int n_zero=0; for(int i=0;isize();i++){ @@ -374,7 +374,7 @@ void HcalDetDiagNoiseMonitor::analyze(const edm::Event& iEvent, const edm::Event } edm::Handle ho; - iEvent.getByLabel(digiLabel_,ho); + iEvent.getByToken(tok_ho_,ho); for(HODigiCollection::const_iterator digi=ho->begin();digi!=ho->end();digi++){ double max=-100,energy=0; int Eta=digi->id().ieta(); int Phi=digi->id().iphi(); int n_zero=0; for(int i=0;isize()-1;i++){ diff --git a/DQM/HcalMonitorTasks/src/HcalDetDiagPedestalMonitor.cc b/DQM/HcalMonitorTasks/src/HcalDetDiagPedestalMonitor.cc index 90e328287c006..ec119b7bfd949 100644 --- a/DQM/HcalMonitorTasks/src/HcalDetDiagPedestalMonitor.cc +++ b/DQM/HcalMonitorTasks/src/HcalDetDiagPedestalMonitor.cc @@ -148,7 +148,12 @@ class HcalDetDiagPedestalMonitor : public HcalBaseDQMonitor { const HcalElectronicsMap *emap; edm::InputTag inputLabelDigi_; - edm::InputTag inputLabelRawData_; + + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_hf_; + edm::EDGetTokenT tok_raw_; + edm::EDGetTokenT tok_tb_; void beginRun(const edm::Run& run, const edm::EventSetup& c) override; void endRun(const edm::Run& run, const edm::EventSetup& c) override; @@ -235,12 +240,10 @@ class HcalDetDiagPedestalMonitor : public HcalBaseDQMonitor { std::map KnownBadCells_; - edm::InputTag hcalTBTriggerDataTag_; }; -HcalDetDiagPedestalMonitor::HcalDetDiagPedestalMonitor(const edm::ParameterSet& iConfig) : - hcalTBTriggerDataTag_(iConfig.getParameter("hcalTBTriggerDataTag")) -{ +HcalDetDiagPedestalMonitor::HcalDetDiagPedestalMonitor(const edm::ParameterSet& iConfig) { + ievt_=-1; emap=0; dataset_seq_number=1; @@ -251,7 +254,6 @@ HcalDetDiagPedestalMonitor::HcalDetDiagPedestalMonitor(const edm::ParameterSet& createHTMLonly=false; nTS_HBHE=nTS_HO=nTS_HF=0; inputLabelDigi_ = iConfig.getUntrackedParameter("digiLabel"); - inputLabelRawData_ = iConfig.getUntrackedParameter("rawDataLabel"); ReferenceData = iConfig.getUntrackedParameter("PedestalReferenceData" ,""); OutputFilePath = iConfig.getUntrackedParameter("OutputFilePath", ""); DatasetName = iConfig.getUntrackedParameter("PedestalDatasetName", ""); @@ -276,7 +278,16 @@ HcalDetDiagPedestalMonitor::HcalDetDiagPedestalMonitor(const edm::ParameterSet& HORmsTreshold = iConfig.getUntrackedParameter("HORmsPedestalTreshold" , 0.3); HFMeanTreshold = iConfig.getUntrackedParameter("HFMeanPedestalTreshold" , 0.2); HFRmsTreshold = iConfig.getUntrackedParameter("HFRmsPedestalTreshold" , 0.3); + + // register for data access + tok_hbhe_ = consumes(inputLabelDigi_); + tok_ho_ = consumes(inputLabelDigi_); + tok_hf_ = consumes(inputLabelDigi_); + tok_raw_ = consumes(iConfig.getUntrackedParameter("rawDataLabel")); + tok_tb_ = consumes(iConfig.getParameter("hcalTBTriggerDataTag")); + } + HcalDetDiagPedestalMonitor::~HcalDetDiagPedestalMonitor(){} void HcalDetDiagPedestalMonitor::beginRun(const edm::Run& run, const edm::EventSetup& c){ @@ -438,7 +449,7 @@ static int lastPEDorbit,nChecksPED; // for local runs edm::Handle trigger_data; - iEvent.getByLabel(hcalTBTriggerDataTag_, trigger_data); + iEvent.getByToken(tok_tb_, trigger_data); if(trigger_data.isValid()){ if((trigger_data->triggerWord())==5) PedestalEvent=true; LocalRun=true; @@ -468,7 +479,7 @@ static int lastPEDorbit,nChecksPED; int calibType = -1 ; if(LocalRun==false){ edm::Handle rawdata; - iEvent.getByLabel(inputLabelRawData_,rawdata); + iEvent.getByToken(tok_raw_,rawdata); //checking FEDs for calibration information for (int i=FEDNumbering::MINHCALFEDID;i<=FEDNumbering::MAXHCALFEDID; i++){ const FEDRawData& fedData = rawdata->FEDData(i) ; @@ -485,7 +496,7 @@ static int lastPEDorbit,nChecksPED; run_number=iEvent.id().run(); edm::Handle hbhe; - iEvent.getByLabel(inputLabelDigi_,hbhe); + iEvent.getByToken(tok_hbhe_,hbhe); if(hbhe.isValid()){ if(hbhe->size()<30 && calibType==hc_Pedestal){ ievt_--; @@ -506,7 +517,7 @@ static int lastPEDorbit,nChecksPED; } } edm::Handle ho; - iEvent.getByLabel(inputLabelDigi_,ho); + iEvent.getByToken(tok_ho_,ho); if(ho.isValid()){ for(HODigiCollection::const_iterator digi=ho->begin();digi!=ho->end();digi++){ eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth(); nTS=digi->size(); @@ -517,7 +528,7 @@ static int lastPEDorbit,nChecksPED; } } edm::Handle hf; - iEvent.getByLabel(inputLabelDigi_,hf); + iEvent.getByToken(tok_hf_,hf); if(hf.isValid()){ for(HFDigiCollection::const_iterator digi=hf->begin();digi!=hf->end();digi++){ eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth(); nTS=digi->size(); diff --git a/DQM/HcalMonitorTasks/src/HcalDetDiagTimingMonitor.cc b/DQM/HcalMonitorTasks/src/HcalDetDiagTimingMonitor.cc index ecb4b845acd42..5f2f57edb655e 100644 --- a/DQM/HcalMonitorTasks/src/HcalDetDiagTimingMonitor.cc +++ b/DQM/HcalMonitorTasks/src/HcalDetDiagTimingMonitor.cc @@ -1,19 +1,14 @@ #include "DQM/HcalMonitorTasks/interface/HcalDetDiagTimingMonitor.h" #include "DataFormats/FEDRawData/interface/FEDRawData.h" -#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" #include "DataFormats/FEDRawData/interface/FEDNumbering.h" #include "DataFormats/HcalDigi/interface/HcalCalibrationEventTypes.h" #include "EventFilter/HcalRawToDigi/interface/HcalDCCHeader.h" #include -// this is to retrieve HCAL digi's -#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" // this is to retrieve GT digi's #include "DataFormats/L1GlobalMuonTrigger/interface/L1MuRegionalCand.h" -#include "DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTReadoutCollection.h" -#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h" #include "DataFormats/L1GlobalTrigger/interface/L1GtPsbWord.h" #include "DataFormats/L1GlobalTrigger/interface/L1GtFdlWord.h" @@ -69,7 +64,14 @@ HcalDetDiagTimingMonitor::HcalDetDiagTimingMonitor(const edm::ParameterSet& ps) L1ADataLabel_ = ps.getUntrackedParameter("gtLabel"); inputLabelDigi_= ps.getUntrackedParameter("digiLabel"); - FEDRawDataCollection_ = ps.getUntrackedParameter("FEDRawDataCollection",edm::InputTag("source","")); + + // register for data access + tok_raw_ = consumes(ps.getUntrackedParameter("FEDRawDataCollection",edm::InputTag("source",""))); + tok_l1_ = consumes(L1ADataLabel_); + tok_l1mu_ = consumes(L1ADataLabel_); + tok_hbhe_ = consumes(inputLabelDigi_); + tok_ho_ = consumes(inputLabelDigi_); + tok_hf_ = consumes(inputLabelDigi_); } HcalDetDiagTimingMonitor::~HcalDetDiagTimingMonitor(){} @@ -152,7 +154,7 @@ void HcalDetDiagTimingMonitor::analyze(const edm::Event& iEvent, const edm::Even if(!dbe_) return; // We do not want to look at Abort Gap events edm::Handle rawdata; - iEvent.getByLabel(FEDRawDataCollection_,rawdata); + iEvent.getByToken(tok_raw_,rawdata); //checking FEDs for calibration information if(!rawdata.isValid()) return; for(int i=FEDNumbering::MINHCALFEDID;i<=FEDNumbering::MAXHCALFEDID; i++) { @@ -165,7 +167,7 @@ void HcalDetDiagTimingMonitor::analyze(const edm::Event& iEvent, const edm::Even bool GCTTrigger1=false,GCTTrigger2=false,GCTTrigger3=false,GCTTrigger4=false,GCTTrigger5=false,HOselfTrigger=false; // Check GCT trigger bits edm::Handle< L1GlobalTriggerReadoutRecord > gtRecord; - iEvent.getByLabel(L1ADataLabel_, gtRecord); + iEvent.getByToken(tok_l1_, gtRecord); if(gtRecord.isValid()){ const TechnicalTriggerWord tWord = gtRecord->technicalTriggerWord(); @@ -184,7 +186,7 @@ void HcalDetDiagTimingMonitor::analyze(const edm::Event& iEvent, const edm::Even // define trigger trigger source (example from GMT group) edm::Handle gmtrc_handle; - iEvent.getByLabel(L1ADataLabel_,gmtrc_handle); + iEvent.getByToken(tok_l1mu_,gmtrc_handle); if(!gmtrc_handle.isValid()) return; L1MuGMTReadoutCollection const* gmtrc = gmtrc_handle.product(); @@ -254,7 +256,7 @@ void HcalDetDiagTimingMonitor::analyze(const edm::Event& iEvent, const edm::Even ///////////////////////////////////////////////////////////////////////////////////////// if(ievt_<100){ edm::Handle hbhe; - iEvent.getByLabel(inputLabelDigi_,hbhe); + iEvent.getByToken(tok_hbhe_,hbhe); if(hbhe.isValid()){ for(HBHEDigiCollection::const_iterator digi=hbhe->begin();digi!=hbhe->end();digi++){ eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth(); nTS=digi->size(); @@ -262,7 +264,7 @@ void HcalDetDiagTimingMonitor::analyze(const edm::Event& iEvent, const edm::Even } } edm::Handle ho; - iEvent.getByLabel(inputLabelDigi_,ho); + iEvent.getByToken(tok_ho_,ho); if(ho.isValid()){ for(HODigiCollection::const_iterator digi=ho->begin();digi!=ho->end();digi++){ eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth(); nTS=digi->size(); @@ -270,7 +272,7 @@ void HcalDetDiagTimingMonitor::analyze(const edm::Event& iEvent, const edm::Even } } edm::Handle hf; - iEvent.getByLabel(inputLabelDigi_,hf); + iEvent.getByToken(tok_hf_,hf); if(hf.isValid()){ for(HFDigiCollection::const_iterator digi=hf->begin();digi!=hf->end();digi++){ eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth(); nTS=digi->size(); @@ -283,7 +285,7 @@ void HcalDetDiagTimingMonitor::analyze(const edm::Event& iEvent, const edm::Even ///////////////////////////////////////////////////////////////////////////////////////// double data[20]; edm::Handle hbhe; - iEvent.getByLabel(inputLabelDigi_,hbhe); + iEvent.getByToken(tok_hbhe_,hbhe); if(hbhe.isValid()){ for(HBHEDigiCollection::const_iterator digi=hbhe->begin();digi!=hbhe->end();digi++){ eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth(); nTS=digi->size(); @@ -312,7 +314,7 @@ void HcalDetDiagTimingMonitor::analyze(const edm::Event& iEvent, const edm::Even } } edm::Handle ho; - iEvent.getByLabel(inputLabelDigi_,ho); + iEvent.getByToken(tok_ho_,ho); if(ho.isValid()){ for(HODigiCollection::const_iterator digi=ho->begin();digi!=ho->end();digi++){ eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth(); nTS=digi->size(); @@ -331,7 +333,7 @@ void HcalDetDiagTimingMonitor::analyze(const edm::Event& iEvent, const edm::Even } } edm::Handle hf; - iEvent.getByLabel(inputLabelDigi_,hf); + iEvent.getByToken(tok_hf_,hf); if(hf.isValid()){ for(HFDigiCollection::const_iterator digi=hf->begin();digi!=hf->end();digi++){ eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth(); nTS=digi->size(); diff --git a/DQM/HcalMonitorTasks/src/HcalDigiMonitor.cc b/DQM/HcalMonitorTasks/src/HcalDigiMonitor.cc index d0654d4013760..c3289142fcb97 100644 --- a/DQM/HcalMonitorTasks/src/HcalDigiMonitor.cc +++ b/DQM/HcalMonitorTasks/src/HcalDigiMonitor.cc @@ -4,9 +4,7 @@ #include "FWCore/Common/interface/TriggerNames.h" #include "FWCore/Framework/interface/LuminosityBlock.h" -#include "DataFormats/Common/interface/TriggerResults.h" #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h" -#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" #include "Geometry/HcalTowerAlgo/src/HcalHardcodeGeometryData.h" // for eta bounds #include "CondFormats/HcalObjects/interface/HcalChannelQuality.h" @@ -30,7 +28,6 @@ HcalDigiMonitor::HcalDigiMonitor(const edm::ParameterSet& ps) makeDiagnostics_ = ps.getUntrackedParameter("makeDiagnostics",false); digiLabel_ = ps.getUntrackedParameter("digiLabel"); FEDRawDataCollection_ = ps.getUntrackedParameter("FEDRawDataCollection"); - hfRechitLabel_ = ps.getUntrackedParameter("hfRechitLabel"); shapeThresh_ = ps.getUntrackedParameter("shapeThresh",20); //shapeThresh_ is used for plotting pulse shapes for all digis with pedestal-subtracted ADC sum > shapeThresh_; shapeThreshHB_ = ps.getUntrackedParameter("shapeThreshHB",shapeThresh_); @@ -87,6 +84,16 @@ HcalDigiMonitor::HcalDigiMonitor(const edm::ParameterSet& ps) HFP_shape=0; HFM_shape=0; setupDone_=false; + + // register for data access + tok_raw_ = consumes(FEDRawDataCollection_); + tok_hbhe_ = consumes(digiLabel_); + tok_ho_ = consumes(digiLabel_); + tok_hf_ = consumes(digiLabel_); + tok_unpack_ = consumes(digiLabel_); + tok_trigger_ = consumes(hltresultsLabel_); + tok_hfrec_ = consumes(ps.getUntrackedParameter("hfRechitLabel")); + } // destructor @@ -474,7 +481,7 @@ void HcalDigiMonitor::analyze(edm::Event const&e, edm::EventSetup const&s) /////////////////////////////////////////////////////////////// edm::Handle hltRes; - if (!(e.getByLabel(hltresultsLabel_,hltRes))) + if (!(e.getByToken(tok_trigger_,hltRes))) { if (debug_>0) edm::LogWarning("HcalDigiMonitor")<<" Could not get HLT results with tag "< hf_rechit; - if (e.getByLabel(hfRechitLabel_,hf_rechit)) + if (e.getByToken(tok_hfrec_,hf_rechit)) { // rechitsFound=true; for (HFRecHitCollection::const_iterator HF=hf_rechit->begin();HF!=hf_rechit->end();++HF) @@ -525,24 +532,24 @@ void HcalDigiMonitor::analyze(edm::Event const&e, edm::EventSetup const&s) edm::Handle ho_digi; edm::Handle hf_digi; - if (!(e.getByLabel(digiLabel_,hbhe_digi))) + if (!(e.getByToken(tok_hbhe_,hbhe_digi))) { edm::LogWarning("HcalDigiMonitor")<< digiLabel_<<" hbhe_digi not available"; return; } - if (!(e.getByLabel(digiLabel_,hf_digi))) + if (!(e.getByToken(tok_hf_,hf_digi))) { edm::LogWarning("HcalDigiMonitor")<< digiLabel_<<" hf_digi not available"; return; } - if (!(e.getByLabel(digiLabel_,ho_digi))) + if (!(e.getByToken(tok_ho_,ho_digi))) { edm::LogWarning("HcalDigiMonitor")<< digiLabel_<<" ho_digi not available"; return; } edm::Handle report; - if (!(e.getByLabel(digiLabel_,report))) + if (!(e.getByToken(tok_unpack_,report))) { edm::LogWarning("HcalDigiMonitor")<< digiLabel_<<" unpacker report not available"; return; diff --git a/DQM/HcalMonitorTasks/src/HcalHotCellMonitor.cc b/DQM/HcalMonitorTasks/src/HcalHotCellMonitor.cc index 4f138e863ced1..410b2cdd0db30 100644 --- a/DQM/HcalMonitorTasks/src/HcalHotCellMonitor.cc +++ b/DQM/HcalMonitorTasks/src/HcalHotCellMonitor.cc @@ -26,6 +26,11 @@ HcalHotCellMonitor::HcalHotCellMonitor(const edm::ParameterSet& ps) hoRechitLabel_ = ps.getUntrackedParameter("hoRechitLabel"); hfRechitLabel_ = ps.getUntrackedParameter("hfRechitLabel"); + // register for data access + tok_hbhe_ = consumes(hbheRechitLabel_); + tok_ho_ = consumes(hoRechitLabel_); + tok_hf_ = consumes(hfRechitLabel_); + // Hot Cell-specific tests minEvents_ = ps.getUntrackedParameter("minEvents"); minErrorFlag_ = ps.getUntrackedParameter("minErrorFlag",1); @@ -379,18 +384,18 @@ void HcalHotCellMonitor::analyze(edm::Event const&e, edm::EventSetup const&s) edm::Handle ho_rechit; edm::Handle hf_rechit; - if (!(e.getByLabel(hbheRechitLabel_,hbhe_rechit))) + if (!(e.getByToken(tok_hbhe_,hbhe_rechit))) { edm::LogWarning("HcalHotCellMonitor")<< hbheRechitLabel_<<" hbhe_rechit not available"; return; } - if (!(e.getByLabel(hfRechitLabel_,hf_rechit))) + if (!(e.getByToken(tok_hf_,hf_rechit))) { edm::LogWarning("HcalHotCellMonitor")<< hfRechitLabel_<<" hf_rechit not available"; return; } - if (!(e.getByLabel(hoRechitLabel_,ho_rechit))) + if (!(e.getByToken(tok_ho_,ho_rechit))) { edm::LogWarning("HcalHotCellMonitor")<< hoRechitLabel_<<" ho_rechit not available"; return; diff --git a/DQM/HcalMonitorTasks/src/HcalNZSMonitor.cc b/DQM/HcalMonitorTasks/src/HcalNZSMonitor.cc index 691dedb41aa64..73b60b8a7b807 100644 --- a/DQM/HcalMonitorTasks/src/HcalNZSMonitor.cc +++ b/DQM/HcalMonitorTasks/src/HcalNZSMonitor.cc @@ -31,6 +31,10 @@ HcalNZSMonitor::HcalNZSMonitor(const edm::ParameterSet& ps) rawdataLabel_ = ps.getUntrackedParameter("RawDataLabel"); hltresultsLabel_ = ps.getUntrackedParameter("HLTResultsLabel"); + // register for data access + tok_raw_ = consumes(rawdataLabel_); + tok_res_ = consumes(hltresultsLabel_); + } HcalNZSMonitor::~HcalNZSMonitor() {} @@ -136,14 +140,14 @@ void HcalNZSMonitor::analyze(edm::Event const&e, edm::EventSetup const&s) edm::Handle rawraw; - if (!(e.getByLabel(rawdataLabel_,rawraw))) + if (!(e.getByToken(tok_raw_,rawraw))) { edm::LogWarning("HcalNZSMonitor")<<" raw data with label "< hltRes; - if (!(e.getByLabel(hltresultsLabel_,hltRes))) + if (!(e.getByToken(tok_res_,hltRes))) { if (debug_>0) edm::LogWarning("HcalNZSMonitor")<<" Could not get HLT results with tag "<("NoiseeventPeriod",4096); //4096 rawdataLabel_ = ps.getUntrackedParameter("RawDataLabel"); hltresultsLabel_ = ps.getUntrackedParameter("HLTResultsLabel"); - hbheDigiLabel_ = ps.getUntrackedParameter("hbheDigiLabel"); - hbheRechitLabel_ = ps.getUntrackedParameter("hbheRechitLabel"); - noiseLabel_ = ps.getUntrackedParameter("noiseLabel"); + tok_hbhe_ = consumes(ps.getUntrackedParameter("hbheDigiLabel")); + tok_hbherec_ = consumes(ps.getUntrackedParameter("hbheRechitLabel")); + tok_noise_ = consumes(ps.getUntrackedParameter("noiseLabel")); mTrianglePeakTS = 4; // for now... @@ -211,16 +208,16 @@ void HcalNoiseMonitor::setup() void HcalNoiseMonitor::analyze(edm::Event const &iEvent, edm::EventSetup const &iSetup) { edm::Handle hHBHEDigis; - iEvent.getByLabel(edm::InputTag(hbheDigiLabel_),hHBHEDigis); + iEvent.getByToken(tok_hbhe_,hHBHEDigis); edm::ESHandle hConditions; iSetup.get().get(hConditions); edm::Handle hRecHits; - iEvent.getByLabel(edm::InputTag(hbheRechitLabel_), hRecHits); + iEvent.getByToken(tok_hbherec_, hRecHits); edm::Handle hRBXCollection; - iEvent.getByLabel(edm::InputTag(noiseLabel_),hRBXCollection); + iEvent.getByToken(tok_noise_,hRBXCollection); HcalBaseDQMonitor::analyze(iEvent, iSetup); diff --git a/DQM/HcalMonitorTasks/src/HcalRawDataMonitor.cc b/DQM/HcalMonitorTasks/src/HcalRawDataMonitor.cc index f498e89a9ee40..029789edab8e3 100644 --- a/DQM/HcalMonitorTasks/src/HcalRawDataMonitor.cc +++ b/DQM/HcalMonitorTasks/src/HcalRawDataMonitor.cc @@ -63,6 +63,10 @@ HcalRawDataMonitor::HcalRawDataMonitor(const edm::ParameterSet& ps) { meChann_DataIntegrityCheck_[29]=meCh_DataIntegrityFED29_; meChann_DataIntegrityCheck_[30]=meCh_DataIntegrityFED30_; meChann_DataIntegrityCheck_[31]=meCh_DataIntegrityFED31_; + + // register for data access + tok_raw_ = consumes(FEDRawDataCollection_); + tok_unpack_ = consumes(digiLabel_); this->reset(); } // HcalRawDataMonitor::HcalRawDataMonitor() @@ -529,14 +533,14 @@ void HcalRawDataMonitor::analyze(const edm::Event& e, const edm::EventSetup& s){ // try to get die Data edm::Handle rawraw; - if (!(e.getByLabel(FEDRawDataCollection_,rawraw))) + if (!(e.getByToken(tok_raw_,rawraw))) // if (!(e.getByType(rawraw))) { edm::LogWarning("HcalRawDataMonitor")<<" raw data with label "< report; - if (!(e.getByLabel(digiLabel_,report))) + if (!(e.getByToken(tok_unpack_,report))) { edm::LogWarning("HcalRawDataMonitor")<<" Unpacker Report "<("collisiontimediffThresh",10.); setupDone_ = false; needLogicalMap_ = true; + + // register for data access + tok_hbhe_ = consumes(hbheRechitLabel_); + tok_ho_ = consumes(hoRechitLabel_); + tok_hf_ = consumes(hfRechitLabel_); + tok_trigger_ = consumes(hltresultsLabel_); + } //constructor HcalRecHitMonitor::~HcalRecHitMonitor() @@ -593,19 +600,19 @@ void HcalRecHitMonitor::analyze(edm::Event const&e, edm::EventSetup const&s) edm::Handle ho_rechit; edm::Handle hf_rechit; - if (!(e.getByLabel(hbheRechitLabel_,hbhe_rechit))) + if (!(e.getByToken(tok_hbhe_,hbhe_rechit))) { edm::LogWarning("HcalHotCellMonitor")<< hbheRechitLabel_<<" hbhe_rechit not available"; return; } - if (!(e.getByLabel(hfRechitLabel_,hf_rechit))) + if (!(e.getByToken(tok_hf_,hf_rechit))) { edm::LogWarning("HcalHotCellMonitor")<< hfRechitLabel_<<" hf_rechit not available"; return; } - if (!(e.getByLabel(hoRechitLabel_,ho_rechit))) + if (!(e.getByToken(tok_ho_,ho_rechit))) { edm::LogWarning("HcalHotCellMonitor")<< hoRechitLabel_<<" ho_rechit not available"; return; @@ -636,7 +643,7 @@ void HcalRecHitMonitor::processEvent(const HBHERecHitCollection& hbHits, bool passedMinBiasHLT=false; edm::Handle hltRes; - if (!(iEvent.getByLabel(hltresultsLabel_,hltRes))) + if (!(iEvent.getByToken(tok_trigger_,hltRes))) { if (debug_>0) edm::LogWarning("HcalRecHitMonitor")<<" Could not get HLT results with tag "<("NLumiBlocks",4000); makeDiagnostics_ = ps.getUntrackedParameter("makeDiagnostics",false); + // register for data access + tok_data_ = consumes(dataLabel_); + tok_emu_ = consumes(emulLabel_); } @@ -174,13 +177,13 @@ HcalTrigPrimMonitor::analyze (edm::Event const &e, edm::EventSetup const &s) { if (LumiInOrder(e.luminosityBlock())==false) return; edm::Handle data_tp_col; - if (!e.getByLabel(dataLabel_, data_tp_col)) { + if (!e.getByToken(tok_data_, data_tp_col)) { edm::LogWarning("HcalTrigPrimMonitor")<< dataLabel_<< " data TP not available"; return; } edm::Handle emul_tp_col; - if (!e.getByLabel(emulLabel_, emul_tp_col)) { + if (!e.getByToken(tok_emu_, emul_tp_col)) { edm::LogWarning("HcalTrigPrimMonitor")<< emulLabel_<< " emul TP not available"; return; } diff --git a/DQMOffline/Hcal/interface/CaloTowersAnalyzer.h b/DQMOffline/Hcal/interface/CaloTowersAnalyzer.h index 0f3523ecf045f..637a670efc56c 100644 --- a/DQMOffline/Hcal/interface/CaloTowersAnalyzer.h +++ b/DQMOffline/Hcal/interface/CaloTowersAnalyzer.h @@ -17,6 +17,7 @@ #include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/CaloTowers/interface/CaloTowerDetId.h" #include "DataFormats/Math/interface/Vector3D.h" +#include "DataFormats/CaloTowers/interface/CaloTowerCollection.h" #include #include @@ -48,7 +49,7 @@ class CaloTowersAnalyzer : public edm::EDAnalyzer { typedef math::RhoEtaPhiVector Vector; - edm::InputTag theCaloTowerCollectionLabel; + edm::EDGetTokenT tok_towers_; int isub; int nevent; diff --git a/DQMOffline/Hcal/interface/HcalNoiseRates.h b/DQMOffline/Hcal/interface/HcalNoiseRates.h index 17da8fbbd6bae..0fa83496b5184 100644 --- a/DQMOffline/Hcal/interface/HcalNoiseRates.h +++ b/DQMOffline/Hcal/interface/HcalNoiseRates.h @@ -31,6 +31,7 @@ #include "FWCore/ServiceRegistry/interface/Service.h" +#include "DataFormats/METReco/interface/HcalNoiseRBX.h" // // class declaration @@ -52,6 +53,7 @@ class HcalNoiseRates : public edm::EDAnalyzer { // parameters edm::InputTag rbxCollName_; // label for the rbx collection + edm::EDGetTokenT tok_rbx_; double minRBXEnergy_; // RBX energy threshold double minHitEnergy_; // RecHit energy threshold bool useAllHistos_; diff --git a/DQMOffline/Hcal/interface/HcalRecHitsAnalyzer.h b/DQMOffline/Hcal/interface/HcalRecHitsAnalyzer.h index ed14ef54ce16b..f8c7c549bd3d7 100644 --- a/DQMOffline/Hcal/interface/HcalRecHitsAnalyzer.h +++ b/DQMOffline/Hcal/interface/HcalRecHitsAnalyzer.h @@ -78,9 +78,12 @@ class HcalRecHitsAnalyzer : public edm::EDAnalyzer { bool useAllHistos_; //RecHit Collection input tags - edm::InputTag theHBHERecHitCollectionLabel; - edm::InputTag theHFRecHitCollectionLabel; - edm::InputTag theHORecHitCollectionLabel; + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_hf_; + edm::EDGetTokenT tok_EB_; + edm::EDGetTokenT tok_EE_; + // choice of subdetector in config : noise/HB/HE/HO/HF/ALL (0/1/2/3/4/5) int subdet_; diff --git a/DQMOffline/Hcal/src/CaloTowersAnalyzer.cc b/DQMOffline/Hcal/src/CaloTowersAnalyzer.cc index 9bcb1984c78dd..0d09b99552a4d 100644 --- a/DQMOffline/Hcal/src/CaloTowersAnalyzer.cc +++ b/DQMOffline/Hcal/src/CaloTowersAnalyzer.cc @@ -1,12 +1,12 @@ #include "DQMOffline/Hcal/interface/CaloTowersAnalyzer.h" -#include "DataFormats/CaloTowers/interface/CaloTowerCollection.h" #include "DataFormats/HcalDetId/interface/HcalSubdetector.h" #include "DataFormats/EcalDetId/interface/EcalSubdetector.h" #include "DataFormats/HcalDetId/interface/HcalDetId.h" -CaloTowersAnalyzer::CaloTowersAnalyzer(edm::ParameterSet const& conf): - theCaloTowerCollectionLabel(conf.getUntrackedParameter("CaloTowerCollectionLabel")) -{ +CaloTowersAnalyzer::CaloTowersAnalyzer(edm::ParameterSet const& conf){ + + tok_towers_ = consumes(conf.getUntrackedParameter("CaloTowerCollectionLabel")); + // DQM ROOT output outputFile_ = conf.getUntrackedParameter("outputFile", "myfile.root"); @@ -410,7 +410,7 @@ void CaloTowersAnalyzer::analyze(edm::Event const& event, edm::EventSetup const& nevent++; edm::Handle towers; - event.getByLabel(theCaloTowerCollectionLabel,towers); + event.getByToken(tok_towers_,towers); CaloTowerCollection::const_iterator cal; double met; diff --git a/DQMOffline/Hcal/src/HcalNoiseRates.cc b/DQMOffline/Hcal/src/HcalNoiseRates.cc index 83e248a78cc72..57ee0080d8354 100644 --- a/DQMOffline/Hcal/src/HcalNoiseRates.cc +++ b/DQMOffline/Hcal/src/HcalNoiseRates.cc @@ -8,7 +8,6 @@ // #include "DQMOffline/Hcal/interface/HcalNoiseRates.h" -#include "DataFormats/METReco/interface/HcalNoiseRBX.h" #include "FWCore/Utilities/interface/EDMException.h" // @@ -33,6 +32,7 @@ HcalNoiseRates::HcalNoiseRates(const edm::ParameterSet& iConfig) // set parameters rbxCollName_ = iConfig.getUntrackedParameter("rbxCollName"); + tok_rbx_ = consumes(rbxCollName_); minRBXEnergy_ = iConfig.getUntrackedParameter("minRBXEnergy"); minHitEnergy_ = iConfig.getUntrackedParameter("minHitEnergy"); @@ -84,7 +84,7 @@ HcalNoiseRates::analyze(const edm::Event& iEvent, const edm::EventSetup& evSetup // get the RBX Noise collection edm::Handle handle; - iEvent.getByLabel(rbxCollName_,handle); + iEvent.getByToken(tok_rbx_,handle); if(!handle.isValid()) { throw edm::Exception(edm::errors::ProductNotFound) << " could not find HcalNoiseRBXCollection named " << rbxCollName_ << ".\n"; diff --git a/DQMOffline/Hcal/src/HcalRecHitsAnalyzer.cc b/DQMOffline/Hcal/src/HcalRecHitsAnalyzer.cc index 5ca2c885a179b..3f6b18194398c 100644 --- a/DQMOffline/Hcal/src/HcalRecHitsAnalyzer.cc +++ b/DQMOffline/Hcal/src/HcalRecHitsAnalyzer.cc @@ -27,9 +27,11 @@ HcalRecHitsAnalyzer::HcalRecHitsAnalyzer(edm::ParameterSet const& conf) { useAllHistos_ = conf.getUntrackedParameter("useAllHistos", false); //Collections - theHBHERecHitCollectionLabel = conf.getUntrackedParameter("HBHERecHitCollectionLabel"); - theHFRecHitCollectionLabel = conf.getUntrackedParameter("HFRecHitCollectionLabel"); - theHORecHitCollectionLabel = conf.getUntrackedParameter("HORecHitCollectionLabel"); + tok_hbhe_ = consumes(conf.getUntrackedParameter("HBHERecHitCollectionLabel")); + tok_hf_ = consumes(conf.getUntrackedParameter("HFRecHitCollectionLabel")); + tok_ho_ = consumes(conf.getUntrackedParameter("HORecHitCollectionLabel")); + tok_EB_ = consumes(edm::InputTag("ecalRecHit","EcalRecHitsEB")); + tok_EE_ = consumes(edm::InputTag("ecalRecHit","EcalRecHitsEE")); subdet_ = 5; if (hcalselector_ == "noise") subdet_ = 0; @@ -707,7 +709,7 @@ void HcalRecHitsAnalyzer::analyze(edm::Event const& ev, edm::EventSetup const& c Handle rhitEB; - ev.getByLabel("ecalRecHit","EcalRecHitsEB", rhitEB); + ev.getByToken(tok_EB_, rhitEB); EcalRecHitCollection::const_iterator RecHit = rhitEB.product()->begin(); EcalRecHitCollection::const_iterator RecHitEnd = rhitEB.product()->end(); @@ -730,7 +732,7 @@ void HcalRecHitsAnalyzer::analyze(edm::Event const& ev, edm::EventSetup const& c Handle rhitEE; - ev.getByLabel("ecalRecHit","EcalRecHitsEE", rhitEE); + ev.getByToken(tok_EE_, rhitEE); RecHit = rhitEE.product()->begin(); RecHitEnd = rhitEE.product()->end(); @@ -1231,7 +1233,7 @@ void HcalRecHitsAnalyzer::fillRecHitsTmp(int subdet_, edm::Event const& ev){ //HBHE edm::Handle hbhecoll; - ev.getByLabel(theHBHERecHitCollectionLabel, hbhecoll); + ev.getByToken(tok_hbhe_, hbhecoll); for (HBHERecHitCollection::const_iterator j=hbhecoll->begin(); j != hbhecoll->end(); j++) { HcalDetId cell(j->id()); @@ -1279,7 +1281,7 @@ void HcalRecHitsAnalyzer::fillRecHitsTmp(int subdet_, edm::Event const& ev){ //HF edm::Handle hfcoll; - ev.getByLabel(theHFRecHitCollectionLabel, hfcoll); + ev.getByToken(tok_hf_, hfcoll); for (HFRecHitCollection::const_iterator j = hfcoll->begin(); j != hfcoll->end(); j++) { HcalDetId cell(j->id()); @@ -1324,7 +1326,7 @@ void HcalRecHitsAnalyzer::fillRecHitsTmp(int subdet_, edm::Event const& ev){ if( subdet_ == 3 || subdet_ == 5 || subdet_ == 6 || subdet_ == 0) { edm::Handle hocoll; - ev.getByLabel(theHORecHitCollectionLabel, hocoll); + ev.getByToken(tok_ho_, hocoll); for (HORecHitCollection::const_iterator j = hocoll->begin(); j != hocoll->end(); j++) { HcalDetId cell(j->id()); diff --git a/EventFilter/HcalRawToDigi/plugins/HcalCalibFEDSelector.cc b/EventFilter/HcalRawToDigi/plugins/HcalCalibFEDSelector.cc index 5c66ebfe959e2..c29b0d6158a72 100644 --- a/EventFilter/HcalRawToDigi/plugins/HcalCalibFEDSelector.cc +++ b/EventFilter/HcalRawToDigi/plugins/HcalCalibFEDSelector.cc @@ -26,7 +26,7 @@ class HcalCalibFEDSelector : public edm::EDProducer { virtual void endJob() override ; // ----------member data --------------------------- - edm::InputTag rawInLabel_ ; + edm::EDGetTokenT tok_fed_; std::vector extraFEDs_ ; }; @@ -36,7 +36,7 @@ class HcalCalibFEDSelector : public edm::EDProducer { HcalCalibFEDSelector::HcalCalibFEDSelector(const edm::ParameterSet& iConfig) { - rawInLabel_ = iConfig.getParameter("rawInputLabel"); + tok_fed_ = consumes(iConfig.getParameter("rawInputLabel")); extraFEDs_ = iConfig.getParameter< std::vector >("extraFEDsToKeep") ; produces(); } @@ -52,7 +52,7 @@ HcalCalibFEDSelector::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) std::auto_ptr producedData(new FEDRawDataCollection); edm::Handle rawIn; - iEvent.getByLabel(rawInLabel_,rawIn); + iEvent.getByToken(tok_fed_,rawIn); std::vector selFEDs; diff --git a/EventFilter/HcalRawToDigi/plugins/HcalCalibTypeFilter.cc b/EventFilter/HcalRawToDigi/plugins/HcalCalibTypeFilter.cc index a337f69c01c9b..577f85561491e 100644 --- a/EventFilter/HcalRawToDigi/plugins/HcalCalibTypeFilter.cc +++ b/EventFilter/HcalRawToDigi/plugins/HcalCalibTypeFilter.cc @@ -53,8 +53,8 @@ class HcalCalibTypeFilter : public edm::EDFilter { virtual void endJob() override ; // ----------member data --------------------------- - - std::string DataLabel_ ; + + edm::EDGetTokenT tok_data_; bool Summary_ ; std::vector CalibTypes_ ; std::vector eventsByType ; @@ -69,7 +69,7 @@ HcalCalibTypeFilter::HcalCalibTypeFilter(const edm::ParameterSet& iConfig) { //now do what ever initialization is needed - DataLabel_ = iConfig.getParameter("InputLabel") ; + tok_data_ = consumes(edm::InputTag(iConfig.getParameter("InputLabel") )); Summary_ = iConfig.getUntrackedParameter("FilterSummary",false) ; CalibTypes_ = iConfig.getParameter< std::vector >("CalibTypes") ; } @@ -95,7 +95,7 @@ HcalCalibTypeFilter::filter(edm::Event& iEvent, const edm::EventSetup& iSetup) using namespace edm; edm::Handle rawdata; - iEvent.getByLabel(DataLabel_,rawdata); + iEvent.getByToken(tok_data_,rawdata); // checking FEDs for calibration information int calibType = -1 ; int numEmptyFEDs = 0 ; diff --git a/EventFilter/HcalRawToDigi/plugins/HcalDigiToRaw.cc b/EventFilter/HcalRawToDigi/plugins/HcalDigiToRaw.cc index 7e12dba545f77..ae66a4a9ed011 100644 --- a/EventFilter/HcalRawToDigi/plugins/HcalDigiToRaw.cc +++ b/EventFilter/HcalRawToDigi/plugins/HcalDigiToRaw.cc @@ -1,6 +1,5 @@ #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" #include "DataFormats/FEDRawData/interface/FEDNumbering.h" -#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" #include "FWCore/Framework/interface/ESHandle.h" #include "CalibFormats/HcalObjects/interface/HcalDbService.h" #include "CalibFormats/HcalObjects/interface/HcalDbRecord.h" @@ -21,6 +20,14 @@ HcalDigiToRaw::HcalDigiToRaw(edm::ParameterSet const& conf) : calibTag_(conf.getUntrackedParameter("CALIB",edm::InputTag())), trigTag_(conf.getUntrackedParameter("TRIG",edm::InputTag())) { + // register for data access + tok_hbhe_ = consumes(hbheTag_); + tok_ho_ = consumes(hoTag_); + tok_hf_ = consumes(hfTag_); + tok_calib_ = consumes(calibTag_); + tok_zdc_ = consumes(zdcTag_); + tok_htp_ = consumes(trigTag_); + produces(); } @@ -36,32 +43,32 @@ void HcalDigiToRaw::produce(edm::Event& e, const edm::EventSetup& es) // Step A: Get Inputs edm::Handle hbhe; if (!hbheTag_.label().empty()) { - e.getByLabel(hbheTag_,hbhe); + e.getByToken(tok_hbhe_,hbhe); colls.hbhe=hbhe.product(); } edm::Handle ho; if (!hoTag_.label().empty()) { - e.getByLabel(hoTag_,ho); + e.getByToken(tok_ho_,ho); colls.hoCont=ho.product(); } edm::Handle hf; if (!hfTag_.label().empty()) { - e.getByLabel(hfTag_,hf); + e.getByToken(tok_hf_,hf); colls.hfCont=hf.product(); } edm::Handle Calib; if (!calibTag_.label().empty()) { - e.getByLabel(calibTag_,Calib); + e.getByToken(tok_calib_,Calib); colls.calibCont=Calib.product(); } edm::Handle zdc; if (!zdcTag_.label().empty()) { - e.getByLabel(zdcTag_,zdc); + e.getByToken(tok_zdc_,zdc); colls.zdcCont=zdc.product(); } edm::Handle htp; if (!trigTag_.label().empty()) { - e.getByLabel(trigTag_,htp); + e.getByToken(tok_htp_,htp); colls.tpCont=htp.product(); } // get the mapping diff --git a/EventFilter/HcalRawToDigi/plugins/HcalDigiToRaw.h b/EventFilter/HcalRawToDigi/plugins/HcalDigiToRaw.h index 27c692d3d6e98..f1f8d2c57c357 100644 --- a/EventFilter/HcalRawToDigi/plugins/HcalDigiToRaw.h +++ b/EventFilter/HcalRawToDigi/plugins/HcalDigiToRaw.h @@ -22,6 +22,7 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "EventFilter/HcalRawToDigi/interface/HcalPacker.h" +#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" class HcalDigiToRaw : public edm::EDProducer { @@ -32,6 +33,12 @@ class HcalDigiToRaw : public edm::EDProducer private: HcalPacker packer_; edm::InputTag hbheTag_, hoTag_, hfTag_, zdcTag_, calibTag_, trigTag_; + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_hf_; + edm::EDGetTokenT tok_calib_; + edm::EDGetTokenT tok_zdc_; + edm::EDGetTokenT tok_htp_; }; #endif diff --git a/EventFilter/HcalRawToDigi/plugins/HcalEmptyEventFilter.cc b/EventFilter/HcalRawToDigi/plugins/HcalEmptyEventFilter.cc index 6c512236aa6eb..5b26eb5bc2023 100644 --- a/EventFilter/HcalRawToDigi/plugins/HcalEmptyEventFilter.cc +++ b/EventFilter/HcalRawToDigi/plugins/HcalEmptyEventFilter.cc @@ -51,8 +51,8 @@ class HcalEmptyEventFilter : public edm::EDFilter { virtual bool filter(edm::Event&, const edm::EventSetup&) override; // ----------member data --------------------------- - - edm::InputTag DataLabel_ ; + + edm::EDGetTokenT tok_data_; }; @@ -64,7 +64,7 @@ HcalEmptyEventFilter::HcalEmptyEventFilter(const edm::ParameterSet& iConfig) { //now do what ever initialization is needed - DataLabel_ = iConfig.getParameter("InputLabel") ; + tok_data_ = consumes(iConfig.getParameter("InputLabel") ); } @@ -88,7 +88,7 @@ HcalEmptyEventFilter::filter(edm::Event& iEvent, const edm::EventSetup& iSetup) using namespace edm; edm::Handle rawdata; - iEvent.getByLabel(DataLabel_,rawdata); + iEvent.getByToken(tok_data_,rawdata); bool haveEmpty=false; diff --git a/EventFilter/HcalRawToDigi/plugins/HcalHistogramRawToDigi.cc b/EventFilter/HcalRawToDigi/plugins/HcalHistogramRawToDigi.cc index c49243c39d78e..8b4ec11f3e793 100644 --- a/EventFilter/HcalRawToDigi/plugins/HcalHistogramRawToDigi.cc +++ b/EventFilter/HcalRawToDigi/plugins/HcalHistogramRawToDigi.cc @@ -1,7 +1,6 @@ using namespace std; #include "EventFilter/HcalRawToDigi/plugins/HcalHistogramRawToDigi.h" #include "DataFormats/FEDRawData/interface/FEDNumbering.h" -#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" #include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" #include "FWCore/Framework/interface/ESHandle.h" #include "CalibFormats/HcalObjects/interface/HcalDbService.h" @@ -11,7 +10,6 @@ using namespace std; HcalHistogramRawToDigi::HcalHistogramRawToDigi(edm::ParameterSet const& conf): - dataTag_(conf.getParameter("InputLabel")), unpacker_(conf.getUntrackedParameter("HcalFirstFED",FEDNumbering::MINHCALFEDID)), fedUnpackList_(conf.getUntrackedParameter >("FEDs")), firstFED_(conf.getUntrackedParameter("HcalFirstFED",FEDNumbering::MINHCALFEDID)) @@ -20,6 +18,9 @@ HcalHistogramRawToDigi::HcalHistogramRawToDigi(edm::ParameterSet const& conf): for (unsigned int i=0; i(conf.getParameter("InputLabel")); // products produced... produces(); @@ -33,7 +34,7 @@ void HcalHistogramRawToDigi::produce(edm::Event& e, const edm::EventSetup& es) { // Step A: Get Inputs edm::Handle rawraw; - e.getByLabel(dataTag_,rawraw); + e.getByToken(tok_data_,rawraw); // get the mapping edm::ESHandle pSetup; es.get().get( pSetup ); diff --git a/EventFilter/HcalRawToDigi/plugins/HcalHistogramRawToDigi.h b/EventFilter/HcalRawToDigi/plugins/HcalHistogramRawToDigi.h index a71917f8137f8..41724a161562e 100644 --- a/EventFilter/HcalRawToDigi/plugins/HcalHistogramRawToDigi.h +++ b/EventFilter/HcalRawToDigi/plugins/HcalHistogramRawToDigi.h @@ -22,6 +22,7 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "EventFilter/HcalRawToDigi/interface/HcalUnpacker.h" +#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" class HcalHistogramRawToDigi : public edm::EDProducer { @@ -30,7 +31,7 @@ class HcalHistogramRawToDigi : public edm::EDProducer virtual ~HcalHistogramRawToDigi(); virtual void produce(edm::Event& e, const edm::EventSetup& c); private: - edm::InputTag dataTag_; + edm::EDGetTokenT tok_data_; HcalUnpacker unpacker_; std::vector fedUnpackList_; int firstFED_; diff --git a/EventFilter/HcalRawToDigi/plugins/HcalLaserHBHEFilter2012.cc b/EventFilter/HcalRawToDigi/plugins/HcalLaserHBHEFilter2012.cc index 2d886f4317731..19db6e16bfc7a 100644 --- a/EventFilter/HcalRawToDigi/plugins/HcalLaserHBHEFilter2012.cc +++ b/EventFilter/HcalRawToDigi/plugins/HcalLaserHBHEFilter2012.cc @@ -65,6 +65,8 @@ class HcalLaserHBHEFilter2012 : public edm::EDFilter { int minCalibChannelsHBHELaser_; // set minimum number of HBHE Calib events that causes an event to be considered a bad (i.e., HBHE laser) event double minFracDiffHBHELaser_; // minimum difference in fractional occupancies between 'good' and 'bad' HBHE regions (i.e., regions whose RBXes receive laser signals and those whose RBXes see no laser) necessary to declare an event as a laser event. In laser events, good fractional occupancy is generally near 1, while bad fractional occupancy is considerably less edm::InputTag digiLabel_; + edm::EDGetTokenT tok_calib_; + edm::EDGetTokenT tok_hbhe_; double HBHEcalibThreshold_; // minimum integrated charge needed for a hit to count as an occupied calib channel std::vector CalibTS_; // time slices used when integrating calib charges @@ -93,6 +95,10 @@ HcalLaserHBHEFilter2012::HcalLaserHBHEFilter2012(const edm::ParameterSet& ps) minFracDiffHBHELaser_ = ps.getUntrackedParameter("minFracDiffHBHELaser",0.3); edm::InputTag digi_default("hcalDigis"); digiLabel_ = ps.getUntrackedParameter("digiLabel",digi_default); + + tok_calib_ = consumes(digiLabel_); + tok_hbhe_ = consumes(digiLabel_); + HBHEcalibThreshold_ = ps.getUntrackedParameter("HBHEcalibThreshold",15); std::vector dummyTS; for (int i=3;i<=6;++i) @@ -125,7 +131,7 @@ HcalLaserHBHEFilter2012::filter(edm::Event& iEvent, const edm::EventSetup& iSetu // Step 1:: try to get calib digi and HBHE collections. // Return true if collection not found? Or false? What should default behavior be? edm::Handle calib_digi; - if (!(iEvent.getByLabel(digiLabel_,calib_digi))) + if (!(iEvent.getByToken(tok_calib_,calib_digi))) { edm::LogWarning("HcalLaserHBHEFilter2012")<< digiLabel_<<" calib_digi not available"; return true; @@ -138,7 +144,7 @@ HcalLaserHBHEFilter2012::filter(edm::Event& iEvent, const edm::EventSetup& iSetu } edm::Handle hbhe_digi; - if (!(iEvent.getByLabel(digiLabel_,hbhe_digi))) + if (!(iEvent.getByToken(tok_hbhe_,hbhe_digi))) { edm::LogWarning("HcalLaserHBHEFilter2012")<< digiLabel_<<" hbhe_digi not available"; return true; diff --git a/EventFilter/HcalRawToDigi/plugins/HcalLaserHBHEHFFilter2012.cc b/EventFilter/HcalRawToDigi/plugins/HcalLaserHBHEHFFilter2012.cc index d273a1483e2e8..db8e940d4c211 100644 --- a/EventFilter/HcalRawToDigi/plugins/HcalLaserHBHEHFFilter2012.cc +++ b/EventFilter/HcalRawToDigi/plugins/HcalLaserHBHEHFFilter2012.cc @@ -71,6 +71,9 @@ class HcalLaserHBHEHFFilter2012 : public edm::EDFilter { int minCalibChannelsHFLaser_; // set minimum number of HF Calib events that causes an event to be considered a bad (i.e., HF laser) event edm::InputTag digiLabel_; + edm::EDGetTokenT tok_calib_; + edm::EDGetTokenT tok_hbhe_; + bool verbose_; // if set to true, then the run:LS:event for any event failing the cut will be printed out std::string prefix_; // prefix will be printed before any event if verbose mode is true, in order to make searching for events easier bool WriteBadToFile_; @@ -102,6 +105,8 @@ HcalLaserHBHEHFFilter2012::HcalLaserHBHEHFFilter2012(const edm::ParameterSet& ps minCalibChannelsHFLaser_ = ps.getParameter("minCalibChannelsHFLaser"); digiLabel_ = ps.getParameter("digiLabel"); + tok_calib_ = consumes(digiLabel_); + tok_hbhe_ = consumes(digiLabel_); verbose_ = ps.getUntrackedParameter("verbose",false); prefix_ = ps.getUntrackedParameter("prefix",""); @@ -132,7 +137,7 @@ HcalLaserHBHEHFFilter2012::filter(edm::Event& iEvent, const edm::EventSetup& iSe // Step 1:: try to get calib digi and HBHE collections. // Return true if collection not found? Or false? What should default behavior be? edm::Handle calib_digi; - if (!(iEvent.getByLabel(digiLabel_,calib_digi))) + if (!(iEvent.getByToken(tok_calib_,calib_digi))) { edm::LogWarning("HcalLaserFilter2012")<< digiLabel_<<" calib_digi not available"; return true; @@ -145,7 +150,7 @@ HcalLaserHBHEHFFilter2012::filter(edm::Event& iEvent, const edm::EventSetup& iSe } edm::Handle hbhe_digi; - if (!(iEvent.getByLabel(digiLabel_,hbhe_digi))) + if (!(iEvent.getByToken(tok_hbhe_,hbhe_digi))) { edm::LogWarning("HcalLaserFilter2012")<< digiLabel_<<" hbhe_digi not available"; return true; diff --git a/EventFilter/HcalRawToDigi/plugins/HcalLaserHFFilter2012.cc b/EventFilter/HcalRawToDigi/plugins/HcalLaserHFFilter2012.cc index cdd9adab855c1..944827fa2d447 100644 --- a/EventFilter/HcalRawToDigi/plugins/HcalLaserHFFilter2012.cc +++ b/EventFilter/HcalRawToDigi/plugins/HcalLaserHFFilter2012.cc @@ -65,6 +65,7 @@ class HcalLaserHFFilter2012 : public edm::EDFilter { std::string prefix_; // prefix will be printed before any event if verbose mode is true, in order to make searching for events easier int minCalibChannelsHFLaser_; // set minimum number of HF Calib events that causes an event to be considered a bad (i.e., HF laser) event edm::InputTag digiLabel_; + edm::EDGetTokenT tok_calib_; bool WriteBadToFile_; bool forceFilterTrue_; @@ -90,6 +91,7 @@ HcalLaserHFFilter2012::HcalLaserHFFilter2012(const edm::ParameterSet& ps) minCalibChannelsHFLaser_=ps.getUntrackedParameter("minCalibChannelsHFLaser",10); edm::InputTag digi_default("hcalDigis"); digiLabel_ = ps.getUntrackedParameter("digiLabel",digi_default); + tok_calib_ = consumes(digiLabel_); WriteBadToFile_=ps.getUntrackedParameter("WriteBadToFile",false); if (WriteBadToFile_) outfile_.open("badHcalLaserList_hffilter.txt"); @@ -118,7 +120,7 @@ HcalLaserHFFilter2012::filter(edm::Event& iEvent, const edm::EventSetup& iSetup) // Step 1:: try to get calib digi collection. // Return true if collection not found? Or false? What should default behavior be? edm::Handle calib_digi; - if (!(iEvent.getByLabel(digiLabel_,calib_digi))) + if (!(iEvent.getByToken(tok_calib_,calib_digi))) { edm::LogWarning("HcalLaserHFFilter2012")<< digiLabel_<<" calib_digi not available"; return true; diff --git a/EventFilter/HcalRawToDigi/plugins/HcalRawToDigi.cc b/EventFilter/HcalRawToDigi/plugins/HcalRawToDigi.cc index e13e216caa60b..3cf70ae42220b 100644 --- a/EventFilter/HcalRawToDigi/plugins/HcalRawToDigi.cc +++ b/EventFilter/HcalRawToDigi/plugins/HcalRawToDigi.cc @@ -1,6 +1,5 @@ using namespace std; #include "EventFilter/HcalRawToDigi/plugins/HcalRawToDigi.h" -#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" #include "DataFormats/FEDRawData/interface/FEDNumbering.h" #include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" #include "FWCore/Framework/interface/ESHandle.h" @@ -10,7 +9,6 @@ using namespace std; #include HcalRawToDigi::HcalRawToDigi(edm::ParameterSet const& conf): - dataTag_(conf.getParameter("InputLabel")), unpacker_(conf.getUntrackedParameter("HcalFirstFED",int(FEDNumbering::MINHCALFEDID)),conf.getParameter("firstSample"),conf.getParameter("lastSample")), filter_(conf.getParameter("FilterDataQuality"),conf.getParameter("FilterDataQuality"), false, @@ -26,6 +24,8 @@ HcalRawToDigi::HcalRawToDigi(edm::ParameterSet const& conf): unpackerMode_(conf.getUntrackedParameter("UnpackerMode",0)), expectedOrbitMessageTime_(conf.getUntrackedParameter("ExpectedOrbitMessageTime",-1)) { + tok_data_ = consumes(conf.getParameter("InputLabel")); + if (fedUnpackList_.empty()) { for (int i=FEDNumbering::MINHCALFEDID; i<=FEDNumbering::MAXHCALFEDID; i++) fedUnpackList_.push_back(i); @@ -64,7 +64,7 @@ void HcalRawToDigi::produce(edm::Event& e, const edm::EventSetup& es) { // Step A: Get Inputs edm::Handle rawraw; - e.getByLabel(dataTag_,rawraw); + e.getByToken(tok_data_,rawraw); // get the mapping edm::ESHandle pSetup; es.get().get( pSetup ); diff --git a/EventFilter/HcalRawToDigi/plugins/HcalRawToDigi.h b/EventFilter/HcalRawToDigi/plugins/HcalRawToDigi.h index 5c18e0528a257..6a33e5ea6cfbb 100644 --- a/EventFilter/HcalRawToDigi/plugins/HcalRawToDigi.h +++ b/EventFilter/HcalRawToDigi/plugins/HcalRawToDigi.h @@ -24,6 +24,8 @@ #include "EventFilter/HcalRawToDigi/interface/HcalUnpacker.h" #include "EventFilter/HcalRawToDigi/interface/HcalDataFrameFilter.h" +#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" + class HcalRawToDigi : public edm::EDProducer { public: @@ -31,7 +33,7 @@ class HcalRawToDigi : public edm::EDProducer virtual ~HcalRawToDigi(); virtual void produce(edm::Event& e, const edm::EventSetup& c); private: - edm::InputTag dataTag_; + edm::EDGetTokenT tok_data_; HcalUnpacker unpacker_; HcalDataFrameFilter filter_; std::vector fedUnpackList_; diff --git a/IORawData/HcalTBInputService/src/HcalTBWriter.cc b/IORawData/HcalTBInputService/src/HcalTBWriter.cc index 5356bc91dea08..d3aaeb3fab496 100644 --- a/IORawData/HcalTBInputService/src/HcalTBWriter.cc +++ b/IORawData/HcalTBInputService/src/HcalTBWriter.cc @@ -11,10 +11,11 @@ HcalTBWriter::HcalTBWriter(const edm::ParameterSet & pset) : - namePattern_(pset.getUntrackedParameter("FilenamePattern","/tmp/HTB_%06d.root")), - fedRawDataCollectionTag_(pset.getParameter("fedRawDataCollectionTag")) + namePattern_(pset.getUntrackedParameter("FilenamePattern","/tmp/HTB_%06d.root")) { + tok_raw_ = consumes(pset.getParameter("fedRawDataCollectionTag")); + std::vector names=pset.getUntrackedParameter >("ChunkNames"); std::vector::iterator j; for (j=names.begin(); j!=names.end(); j++) { @@ -48,7 +49,7 @@ void HcalTBWriter::endJob() { void HcalTBWriter::analyze(const edm::Event& e, const edm::EventSetup& es) { edm::Handle raw; - e.getByLabel(fedRawDataCollectionTag_, raw); + e.getByToken(tok_raw_, raw); if (file_==0) { char fname[4096]; diff --git a/IORawData/HcalTBInputService/src/HcalTBWriter.h b/IORawData/HcalTBInputService/src/HcalTBWriter.h index 904b33e7c185f..9595587405545 100644 --- a/IORawData/HcalTBInputService/src/HcalTBWriter.h +++ b/IORawData/HcalTBInputService/src/HcalTBWriter.h @@ -40,6 +40,6 @@ class HcalTBWriter : public edm::EDAnalyzer { std::map chunkMap_; CDFChunk* chunkList_[1024]; int trigChunk_; - edm::InputTag fedRawDataCollectionTag_; + edm::EDGetTokenT tok_raw_; }; #endif diff --git a/RecoLocalCalo/CaloRecCandCreator/src/CaloRecHitCandidateProducer.cc b/RecoLocalCalo/CaloRecCandCreator/src/CaloRecHitCandidateProducer.cc index ecddbf3933cca..c2228f696e63d 100644 --- a/RecoLocalCalo/CaloRecCandCreator/src/CaloRecHitCandidateProducer.cc +++ b/RecoLocalCalo/CaloRecCandCreator/src/CaloRecHitCandidateProducer.cc @@ -21,8 +21,6 @@ #include "DataFormats/HcalDetId/interface/HcalDetId.h" #include "DataFormats/EcalDetId/interface/EcalSubdetector.h" -#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" -#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" using namespace edm; using namespace reco; @@ -65,10 +63,7 @@ namespace { CaloRecHitCandidateProducer::CaloRecHitCandidateProducer ( const edm::ParameterSet & fConfig ) - : mHBHELabel (fConfig.getParameter("hbheInput")), - mHOLabel (fConfig.getParameter("hoInput")), - mHFLabel (fConfig.getParameter("hfInput")), - mEcalLabels (fConfig.getParameter >("ecalInputs")), + : mEcalLabels (fConfig.getParameter >("ecalInputs")), mAllowMissingInputs (fConfig.getUntrackedParameter("AllowMissingInputs",false)), mUseHO (fConfig.getParameter("UseHO")), @@ -89,6 +84,15 @@ CaloRecHitCandidateProducer::CaloRecHitCandidateProducer ( const edm::ParameterS mHF1weight (fConfig.getParameter("HF1Weight")), mHF2weight (fConfig.getParameter("HF2Weight")) { + + tok_hbhe_ = consumes(fConfig.getParameter("hbheInput")); + tok_ho_ = consumes (fConfig.getParameter("hoInput")); + tok_hf_ = consumes (fConfig.getParameter("hfInput")); + + const unsigned nLabels = mEcalLabels.size(); + for ( unsigned i=0; i != nLabels; i++ ) + toks_ecal_.push_back(consumes(mEcalLabels[i])); + produces(); } @@ -105,7 +109,7 @@ void CaloRecHitCandidateProducer::produce( edm::Event & fEvent, const edm::Event auto_ptr output ( new CandidateCollection ); // get and process Inputs edm::Handle hbhe; - fEvent.getByLabel(mHBHELabel,hbhe); + fEvent.getByToken(tok_hbhe_,hbhe); if (!hbhe.isValid()) { // can't find it! if (!mAllowMissingInputs) { @@ -117,7 +121,7 @@ void CaloRecHitCandidateProducer::produce( edm::Event & fEvent, const edm::Event if (mUseHO) { edm::Handle ho; - fEvent.getByLabel(mHOLabel,ho); + fEvent.getByToken(tok_ho_,ho); if (!ho.isValid()) { // can't find it! if (!mAllowMissingInputs) { @@ -129,7 +133,7 @@ void CaloRecHitCandidateProducer::produce( edm::Event & fEvent, const edm::Event } edm::Handle hf; - fEvent.getByLabel(mHFLabel,hf); + fEvent.getByToken(tok_hf_,hf); if (!hf.isValid()) { // can't find it! if (!mAllowMissingInputs) { @@ -139,10 +143,10 @@ void CaloRecHitCandidateProducer::produce( edm::Event & fEvent, const edm::Event processHits (hf, *this, *geometry, *topology, &*output); } - std::vector::const_iterator i; - for (i=mEcalLabels.begin(); i!=mEcalLabels.end(); i++) { + std::vector >::const_iterator i; + for (i=toks_ecal_.begin(); i!=toks_ecal_.end(); i++) { edm::Handle ec; - fEvent.getByLabel(*i,ec); + fEvent.getByToken(*i,ec); if (!ec.isValid()) { // can't find it! if (!mAllowMissingInputs) { diff --git a/RecoLocalCalo/CaloRecCandCreator/src/CaloRecHitCandidateProducer.h b/RecoLocalCalo/CaloRecCandCreator/src/CaloRecHitCandidateProducer.h index 1cd2803560730..15e67d3f24229 100755 --- a/RecoLocalCalo/CaloRecCandCreator/src/CaloRecHitCandidateProducer.h +++ b/RecoLocalCalo/CaloRecCandCreator/src/CaloRecHitCandidateProducer.h @@ -5,6 +5,8 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "DataFormats/Common/interface/Handle.h" #include "DataFormats/Candidate/interface/CandidateFwd.h" +#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" +#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" class CaloGeometry; class CaloRecHit; @@ -19,8 +21,11 @@ class CaloRecHitCandidateProducer : public edm::EDProducer { private: /// source collection tag - edm::InputTag mHBHELabel, mHOLabel, mHFLabel; std::vector mEcalLabels; + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_hf_; + std::vector > toks_ecal_; bool mAllowMissingInputs; bool mUseHO; double mEBthreshold, mEEthreshold; diff --git a/RecoLocalCalo/CaloTowersCreator/src/CaloTowerCandidateCreator.cc b/RecoLocalCalo/CaloTowersCreator/src/CaloTowerCandidateCreator.cc index f74c7fe1c757f..9d8026ae30af0 100644 --- a/RecoLocalCalo/CaloTowersCreator/src/CaloTowerCandidateCreator.cc +++ b/RecoLocalCalo/CaloTowersCreator/src/CaloTowerCandidateCreator.cc @@ -3,7 +3,6 @@ // modifyed by: F.Ratnikov UMd #include #include "DataFormats/RecoCandidate/interface/RecoCaloTowerCandidate.h" -#include "DataFormats/CaloTowers/interface/CaloTower.h" #include "DataFormats/Common/interface/Handle.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -15,10 +14,11 @@ using namespace std; CaloTowerCandidateCreator::CaloTowerCandidateCreator( const ParameterSet & p ) : mVerbose (p.getUntrackedParameter ("verbose", 0)), - mSource (p.getParameter ("src")), mEtThreshold (p.getParameter ("minimumEt")), mEThreshold (p.getParameter ("minimumE")) { + tok_src_ = consumes (p.getParameter ("src")); + produces(); } @@ -27,7 +27,7 @@ CaloTowerCandidateCreator::~CaloTowerCandidateCreator() { void CaloTowerCandidateCreator::produce( Event& evt, const EventSetup& ) { Handle caloTowers; - evt.getByLabel( mSource, caloTowers ); + evt.getByToken( tok_src_, caloTowers ); auto_ptr cands( new CandidateCollection ); cands->reserve( caloTowers->size() ); diff --git a/RecoLocalCalo/CaloTowersCreator/src/CaloTowerCandidateCreator.h b/RecoLocalCalo/CaloTowersCreator/src/CaloTowerCandidateCreator.h index 9717823ef3766..99c8c14f77c4f 100644 --- a/RecoLocalCalo/CaloTowersCreator/src/CaloTowerCandidateCreator.h +++ b/RecoLocalCalo/CaloTowersCreator/src/CaloTowerCandidateCreator.h @@ -13,6 +13,7 @@ */ #include "FWCore/Framework/interface/EDProducer.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "DataFormats/CaloTowers/interface/CaloTower.h" #include @@ -28,8 +29,8 @@ class CaloTowerCandidateCreator : public edm::EDProducer { void produce( edm::Event& e, const edm::EventSetup& ); /// verbosity int mVerbose; - /// label of source collection - edm::InputTag mSource; + /// token of source collection + edm::EDGetTokenT tok_src_; /// ET threshold double mEtThreshold; /// E threshold diff --git a/RecoLocalCalo/CaloTowersCreator/src/CaloTowersCreator.cc b/RecoLocalCalo/CaloTowersCreator/src/CaloTowersCreator.cc index 5894c5b8cbf84..bf2c4eed8b77a 100644 --- a/RecoLocalCalo/CaloTowersCreator/src/CaloTowersCreator.cc +++ b/RecoLocalCalo/CaloTowersCreator/src/CaloTowersCreator.cc @@ -86,9 +86,6 @@ CaloTowersCreator::CaloTowersCreator(const edm::ParameterSet& conf) : conf.getParameter("MomEEDepth") ), - hbheLabel_(conf.getParameter("hbheInput")), - hoLabel_(conf.getParameter("hoInput")), - hfLabel_(conf.getParameter("hfInput")), ecalLabels_(conf.getParameter >("ecalInputs")), allowMissingInputs_(conf.getParameter("AllowMissingInputs")), @@ -110,6 +107,17 @@ CaloTowersCreator::CaloTowersCreator(const edm::ParameterSet& conf) : { + + // register for data access + tok_hbhe_ = consumes(conf.getParameter("hbheInput")); + tok_ho_ = consumes(conf.getParameter("hoInput")); + tok_hf_ = consumes(conf.getParameter("hfInput")); + + const unsigned nLabels = ecalLabels_.size(); + for ( unsigned i=0; i != nLabels; i++ ) + toks_ecal_.push_back(consumes(ecalLabels_[i])); + + EBEScale=EScales.EBScale; EEEScale=EScales.EEScale; HBEScale=EScales.HBScale; @@ -221,12 +229,12 @@ void CaloTowersCreator::produce(edm::Event& e, const edm::EventSetup& c) { edm::Handle ebHandle; edm::Handle eeHandle; - for (std::vector::const_iterator i=ecalLabels_.begin(); - i!=ecalLabels_.end(); i++) { + for (std::vector >::const_iterator i=toks_ecal_.begin(); + i!=toks_ecal_.end(); i++) { edm::Handle ec_tmp; - if (! e.getByLabel(*i,ec_tmp) ) continue; + if (! e.getByToken(*i,ec_tmp) ) continue; if (ec_tmp->size()==0) continue; // check if this is EB or EE @@ -250,21 +258,21 @@ void CaloTowersCreator::produce(edm::Event& e, const edm::EventSetup& c) { // Step A/C: Get Inputs and process (repeatedly) edm::Handle hbhe; - present=e.getByLabel(hbheLabel_,hbhe); + present=e.getByToken(tok_hbhe_,hbhe); if (present || !allowMissingInputs_) algo_.process(*hbhe); edm::Handle ho; - present=e.getByLabel(hoLabel_,ho); + present=e.getByToken(tok_ho_,ho); if (present || !allowMissingInputs_) algo_.process(*ho); edm::Handle hf; - present=e.getByLabel(hfLabel_,hf); + present=e.getByToken(tok_hf_,hf); if (present || !allowMissingInputs_) algo_.process(*hf); - std::vector::const_iterator i; - for (i=ecalLabels_.begin(); i!=ecalLabels_.end(); i++) { + std::vector >::const_iterator i; + for (i=toks_ecal_.begin(); i!=toks_ecal_.end(); i++) { edm::Handle ec; - present=e.getByLabel(*i,ec); + present=e.getByToken(*i,ec); if (present || !allowMissingInputs_) algo_.process(*ec); } diff --git a/RecoLocalCalo/CaloTowersCreator/src/CaloTowersCreator.h b/RecoLocalCalo/CaloTowersCreator/src/CaloTowersCreator.h index 660140da098b4..76012e92b31b4 100644 --- a/RecoLocalCalo/CaloTowersCreator/src/CaloTowersCreator.h +++ b/RecoLocalCalo/CaloTowersCreator/src/CaloTowersCreator.h @@ -34,8 +34,11 @@ class CaloTowersCreator : public edm::EDProducer { static const std::vector& getGridValues(); CaloTowersCreationAlgo algo_; - edm::InputTag hbheLabel_,hoLabel_,hfLabel_; + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_hf_; std::vector ecalLabels_; + std::vector > toks_ecal_; bool allowMissingInputs_; diff --git a/RecoLocalCalo/CaloTowersCreator/src/CaloTowersMerger.cc b/RecoLocalCalo/CaloTowersCreator/src/CaloTowersMerger.cc index cd9a9eb96d2c5..00867be803f71 100644 --- a/RecoLocalCalo/CaloTowersCreator/src/CaloTowersMerger.cc +++ b/RecoLocalCalo/CaloTowersCreator/src/CaloTowersMerger.cc @@ -58,6 +58,8 @@ class CaloTowersMerger : public edm::EDProducer { // ----------member data --------------------------- edm::InputTag regularTowerTag,extraTowerTag; + edm::EDGetTokenT tok_reg_; + edm::EDGetTokenT tok_ext_; }; // @@ -77,6 +79,10 @@ CaloTowersMerger::CaloTowersMerger(const edm::ParameterSet& iConfig) regularTowerTag=iConfig.getParameter("regularTowerTag"); extraTowerTag=iConfig.getParameter("extraTowerTag"); + // register for data access + tok_reg_ = consumes(regularTowerTag); + tok_ext_ = consumes(extraTowerTag); + //register your products produces(); } @@ -101,8 +107,8 @@ CaloTowersMerger::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { edm::Handle regTower,extraTower; - iEvent.getByLabel(regularTowerTag,regTower); - iEvent.getByLabel(extraTowerTag,extraTower); + iEvent.getByToken(tok_reg_,regTower); + iEvent.getByToken(tok_ext_,extraTower); std::auto_ptr output; diff --git a/RecoLocalCalo/CaloTowersCreator/src/CaloTowersReCreator.cc b/RecoLocalCalo/CaloTowersCreator/src/CaloTowersReCreator.cc index 75cfd49a96270..7e4b44b36f13e 100644 --- a/RecoLocalCalo/CaloTowersCreator/src/CaloTowersReCreator.cc +++ b/RecoLocalCalo/CaloTowersCreator/src/CaloTowersReCreator.cc @@ -40,9 +40,10 @@ CaloTowersReCreator::CaloTowersReCreator(const edm::ParameterSet& conf) : conf.getParameter("MomEEDepth") ), - caloLabel_(conf.getParameter("caloLabel")), allowMissingInputs_(false) { + tok_calo_ = consumes(conf.getParameter("caloLabel")); + EBEScale=conf.getParameter("EBEScale"); EEEScale=conf.getParameter("EEEScale"); HBEScale=conf.getParameter("HBEScale"); @@ -81,7 +82,7 @@ void CaloTowersReCreator::produce(edm::Event& e, const edm::EventSetup& c) { // Step A/C: Get Inputs and process (repeatedly) edm::Handle calt; - e.getByLabel(caloLabel_,calt); + e.getByToken(tok_calo_,calt); /* if (!calt.isValid()) { diff --git a/RecoLocalCalo/CaloTowersCreator/src/CaloTowersReCreator.h b/RecoLocalCalo/CaloTowersCreator/src/CaloTowersReCreator.h index 166e543ffeba3..e7e8cb0a58716 100644 --- a/RecoLocalCalo/CaloTowersCreator/src/CaloTowersReCreator.h +++ b/RecoLocalCalo/CaloTowersCreator/src/CaloTowersReCreator.h @@ -24,7 +24,7 @@ class CaloTowersReCreator : public edm::EDProducer { double HEDEScale, HOEScale, HF1EScale, HF2EScale; private: CaloTowersCreationAlgo algo_; - edm::InputTag caloLabel_; + edm::EDGetTokenT tok_calo_; bool allowMissingInputs_; }; diff --git a/RecoLocalCalo/Castor/src/CastorCellProducer.cc b/RecoLocalCalo/Castor/src/CastorCellProducer.cc index 62671ebbab452..8cfaf807882fb 100644 --- a/RecoLocalCalo/Castor/src/CastorCellProducer.cc +++ b/RecoLocalCalo/Castor/src/CastorCellProducer.cc @@ -55,7 +55,7 @@ class CastorCellProducer : public edm::EDProducer { typedef math::XYZPointD Point; typedef ROOT::Math::RhoZPhiPoint CellPoint; typedef std::vector CastorCellCollection; - std::string input_; + edm::EDGetTokenT tok_input_; }; // @@ -72,9 +72,9 @@ const double MYR2D = 180/M_PI; // constructor and destructor // -CastorCellProducer::CastorCellProducer(const edm::ParameterSet& iConfig) : - input_(iConfig.getUntrackedParameter("inputprocess","castorreco")) +CastorCellProducer::CastorCellProducer(const edm::ParameterSet& iConfig) { + tok_input_ = consumes(edm::InputTag(iConfig.getUntrackedParameter("inputprocess","castorreco"))); // register your products produces(); // now do what ever other initialization is needed @@ -103,7 +103,7 @@ void CastorCellProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSet // Produce CastorCells from CastorRecHits edm::Handle InputRecHits; - iEvent.getByLabel(input_, InputRecHits); + iEvent.getByToken(tok_input_, InputRecHits); std::auto_ptr OutputCells (new CastorCellCollection); diff --git a/RecoLocalCalo/Castor/src/CastorClusterProducer.cc b/RecoLocalCalo/Castor/src/CastorClusterProducer.cc index 1f85f0fa6a2da..3353e49dadcf6 100644 --- a/RecoLocalCalo/Castor/src/CastorClusterProducer.cc +++ b/RecoLocalCalo/Castor/src/CastorClusterProducer.cc @@ -65,6 +65,9 @@ class CastorClusterProducer : public edm::EDProducer { typedef std::vector CastorTowerCollection; typedef std::vector CastorClusterCollection; std::string input_, basicjets_; + edm::EDGetTokenT tok_input_; + edm::EDGetTokenT tok_jets_; + edm::EDGetTokenT tok_tower_; bool clusteralgo_; }; @@ -87,6 +90,10 @@ CastorClusterProducer::CastorClusterProducer(const edm::ParameterSet& iConfig) : basicjets_(iConfig.getUntrackedParameter("basicjets","")), clusteralgo_(iConfig.getUntrackedParameter("ClusterAlgo",false)) { + // register for data access + tok_input_ = consumes(edm::InputTag(input_)); + tok_jets_ = consumes(edm::InputTag(basicjets_)); + tok_tower_ = consumes(edm::InputTag("CastorTowerReco")); // register your products produces(); // now do what ever other initialization is needed @@ -119,7 +126,7 @@ void CastorClusterProducer::produce(edm::Event& iEvent, const edm::EventSetup& i // Produce CastorClusters from CastorTowers edm::Handle InputTowers; - iEvent.getByLabel(input_, InputTowers); + iEvent.getByToken(tok_input_, InputTowers); std::auto_ptr OutputClustersfromClusterAlgo (new CastorClusterCollection); @@ -147,10 +154,10 @@ void CastorClusterProducer::produce(edm::Event& iEvent, const edm::EventSetup& i if ( basicjets_ != "") { Handle bjCollection; - iEvent.getByLabel(basicjets_,bjCollection); + iEvent.getByToken(tok_jets_,bjCollection); Handle ctCollection; - iEvent.getByLabel("CastorTowerReco",ctCollection); + iEvent.getByToken(tok_tower_,ctCollection); std::auto_ptr OutputClustersfromBasicJets (new CastorClusterCollection); diff --git a/RecoLocalCalo/Castor/src/CastorInvalidDataFilter.cc b/RecoLocalCalo/Castor/src/CastorInvalidDataFilter.cc index ca89d12803055..3236be598e9b1 100644 --- a/RecoLocalCalo/Castor/src/CastorInvalidDataFilter.cc +++ b/RecoLocalCalo/Castor/src/CastorInvalidDataFilter.cc @@ -45,6 +45,7 @@ class CastorInvalidDataFilter : public edm::EDFilter { private: virtual bool filter(edm::Event&, const edm::EventSetup&) override; + edm::EDGetTokenT > tok_summary_; }; // @@ -61,6 +62,7 @@ class CastorInvalidDataFilter : public edm::EDFilter { CastorInvalidDataFilter::CastorInvalidDataFilter(const edm::ParameterSet& iConfig) { //now do what ever initialization is needed + tok_summary_ = consumes >(edm::InputTag("logErrorHarvester")); } @@ -85,7 +87,7 @@ CastorInvalidDataFilter::filter(edm::Event& iEvent, const edm::EventSetup& iSetu using namespace edm; edm::Handle > summary; - iEvent.getByLabel("logErrorHarvester",summary); + iEvent.getByToken(tok_summary_,summary); bool invalid = false; //std::cout << " logError summary size = " << summary->size() << std::endl; diff --git a/RecoLocalCalo/Castor/src/CastorTowerProducer.cc b/RecoLocalCalo/Castor/src/CastorTowerProducer.cc index fea9151e3bbb0..f05c142ece264 100644 --- a/RecoLocalCalo/Castor/src/CastorTowerProducer.cc +++ b/RecoLocalCalo/Castor/src/CastorTowerProducer.cc @@ -66,7 +66,7 @@ class CastorTowerProducer : public edm::EDProducer { typedef edm::SortedCollection CastorRecHitCollection; typedef std::vector CastorTowerCollection; typedef edm::RefVector CastorRecHitRefVector; - std::string input_; + edm::EDGetTokenT tok_input_; double towercut_; double mintime_; double maxtime_; @@ -87,11 +87,11 @@ const double MYR2D = 180/M_PI; // CastorTowerProducer::CastorTowerProducer(const edm::ParameterSet& iConfig) : - input_(iConfig.getParameter("inputprocess")), towercut_(iConfig.getParameter("towercut")), mintime_(iConfig.getParameter("mintime")), maxtime_(iConfig.getParameter("maxtime")) { + tok_input_ = consumes(iConfig.getParameter("inputprocess")); //register your products produces(); //now do what ever other initialization is needed @@ -119,7 +119,7 @@ void CastorTowerProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSe // Produce CastorTowers from CastorCells edm::Handle InputRecHits; - iEvent.getByLabel(input_,InputRecHits); + iEvent.getByToken(tok_input_,InputRecHits); std::auto_ptr OutputTowers (new CastorTowerCollection); diff --git a/RecoLocalCalo/Castor/src/RecHitCorrector.cc b/RecoLocalCalo/Castor/src/RecHitCorrector.cc index d97a88e451045..ce558f2d957ae 100644 --- a/RecoLocalCalo/Castor/src/RecHitCorrector.cc +++ b/RecoLocalCalo/Castor/src/RecHitCorrector.cc @@ -55,7 +55,7 @@ class RecHitCorrector : public edm::EDProducer { virtual void endJob() override ; // ----------member data --------------------------- - edm::InputTag inputLabel_; + edm::EDGetTokenT tok_input_; double factor_; bool doInterCalib_; }; @@ -73,10 +73,10 @@ class RecHitCorrector : public edm::EDProducer { // constructors and destructor // RecHitCorrector::RecHitCorrector(const edm::ParameterSet& iConfig): -inputLabel_(iConfig.getParameter("rechitLabel")), factor_(iConfig.getParameter("revertFactor")), doInterCalib_(iConfig.getParameter("doInterCalib")) { + tok_input_ = consumes(iConfig.getParameter("rechitLabel")); //register your products produces(); //now do what ever other initialization is needed @@ -104,7 +104,7 @@ RecHitCorrector::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) // get original rechits edm::Handle rechits; - iEvent.getByLabel(inputLabel_,rechits); + iEvent.getByToken(tok_input_,rechits); // get conditions edm::ESHandle conditions; diff --git a/RecoLocalCalo/CastorReco/plugins/CastorSimpleReconstructor.cc b/RecoLocalCalo/CastorReco/plugins/CastorSimpleReconstructor.cc index f817ab86e87c5..2c901380a4cdc 100644 --- a/RecoLocalCalo/CastorReco/plugins/CastorSimpleReconstructor.cc +++ b/RecoLocalCalo/CastorReco/plugins/CastorSimpleReconstructor.cc @@ -1,6 +1,5 @@ using namespace std; #include "CastorSimpleReconstructor.h" -#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" #include "DataFormats/Common/interface/EDCollection.h" #include "DataFormats/Common/interface/Handle.h" @@ -27,7 +26,6 @@ CastorSimpleReconstructor::CastorSimpleReconstructor(edm::ParameterSet const& co reco_(conf.getParameter("firstSample"),conf.getParameter("samplesToAdd"),conf.getParameter("correctForTimeslew"), conf.getParameter("correctForPhaseContainment"),conf.getParameter("correctionPhaseNS")), det_(DetId::Hcal), -inputLabel_(conf.getParameter("digiLabel")), firstSample_(conf.getParameter("firstSample")), samplesToAdd_(conf.getParameter("samplesToAdd")), maxADCvalue_(conf.getParameter("maxADCvalue")), @@ -35,6 +33,9 @@ tsFromDB_(conf.getParameter("tsFromDB")), setSaturationFlag_(conf.getParameter("setSaturationFlag")), doSaturationCorr_(conf.getParameter("doSaturationCorr")) { + + tok_input_ = consumes(conf.getParameter("digiLabel")); + std::string subd=conf.getParameter("Subdetector"); if (!strcasecmp(subd.c_str(),"CASTOR")) { det_=DetId::Calo; @@ -81,7 +82,7 @@ void CastorSimpleReconstructor::produce(edm::Event& e, const edm::EventSetup& ev if (det_==DetId::Calo && subdet_==HcalCastorDetId::SubdetectorId) { edm::Handle digi; - e.getByLabel(inputLabel_,digi); + e.getByToken(tok_input_,digi); // create empty output std::auto_ptr rec(new CastorRecHitCollection); diff --git a/RecoLocalCalo/CastorReco/plugins/CastorSimpleReconstructor.h b/RecoLocalCalo/CastorReco/plugins/CastorSimpleReconstructor.h index ee5945210302d..88c952ff8a672 100644 --- a/RecoLocalCalo/CastorReco/plugins/CastorSimpleReconstructor.h +++ b/RecoLocalCalo/CastorReco/plugins/CastorSimpleReconstructor.h @@ -4,6 +4,7 @@ #include "FWCore/Framework/interface/EDProducer.h" #include "FWCore/Framework/interface/Event.h" #include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -20,7 +21,7 @@ class CastorSimpleReconstructor : public edm::EDProducer { DetId::Detector det_; int subdet_; // HcalOtherSubdetector subdetOther_; - edm::InputTag inputLabel_; + edm::EDGetTokenT tok_input_; int firstSample_; int samplesToAdd_; diff --git a/RecoLocalCalo/HcalLaserReco/src/HcalLaserReco.cc b/RecoLocalCalo/HcalLaserReco/src/HcalLaserReco.cc index da1511f1b1361..499887183b1fa 100644 --- a/RecoLocalCalo/HcalLaserReco/src/HcalLaserReco.cc +++ b/RecoLocalCalo/HcalLaserReco/src/HcalLaserReco.cc @@ -20,13 +20,13 @@ class HcalLaserReco : public edm::EDProducer { private: int qdctdcFed_; HcalLaserUnpacker unpacker_; - edm::InputTag fedRawDataCollectionTag_; + edm::EDGetTokenT tok_raw_; }; HcalLaserReco::HcalLaserReco(edm::ParameterSet const& conf): - qdctdcFed_(conf.getUntrackedParameter("QADCTDCFED",8)), - fedRawDataCollectionTag_(conf.getParameter("fedRawDataCollectionTag")) + qdctdcFed_(conf.getUntrackedParameter("QADCTDCFED",8)) { + tok_raw_ = consumes(conf.getParameter("fedRawDataCollectionTag")); produces(); } @@ -39,7 +39,7 @@ void HcalLaserReco::produce(edm::Event& e, const edm::EventSetup&) { // Step A: Get Inputs edm::Handle rawraw; - e.getByLabel(fedRawDataCollectionTag_, rawraw); + e.getByToken(tok_raw_, rawraw); // Step B: Create empty output std::auto_ptr diff --git a/RecoLocalCalo/HcalRecAlgos/test/HcalRecHitReflagger.cc b/RecoLocalCalo/HcalRecAlgos/test/HcalRecHitReflagger.cc index ece5decdc73f1..dc52fabb672ef 100644 --- a/RecoLocalCalo/HcalRecAlgos/test/HcalRecHitReflagger.cc +++ b/RecoLocalCalo/HcalRecAlgos/test/HcalRecHitReflagger.cc @@ -74,6 +74,7 @@ class HcalRecHitReflagger : public edm::EDProducer { // ----------member data --------------------------- edm::InputTag hfInputLabel_; + edm::EDGetTokenT tok_hf_; int hfFlagBit_; // Select the test you wish to run @@ -120,6 +121,7 @@ HcalRecHitReflagger::HcalRecHitReflagger(const edm::ParameterSet& ps) produces(); hfInputLabel_ = ps.getUntrackedParameter("hfInputLabel",edm::InputTag("hfreco")); + tok_hf_ = consumes(hfInputLabel_); hfFlagBit_ = ps.getUntrackedParameter("hfFlagBit",HcalCaloFlagLabels::UserDefinedBit0); debug_ = ps.getUntrackedParameter("debug",0); @@ -186,7 +188,7 @@ void HcalRecHitReflagger::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { // read HF RecHits - if (!iEvent.getByLabel(hfInputLabel_,hfRecHits)) + if (!iEvent.getByToken(tok_hf_,hfRecHits)) { if (debug_>0) std::cout <<"Unable to find HFRecHitCollection with label '"<("hbheInput")), - ebLabel_(iConfig.getParameter("ebInput")), - eeLabel_(iConfig.getParameter("eeInput")), - trackExtrapolationLabel_(iConfig.getParameter("trackExtrapolationInput")), LooseHcalIsol_(iConfig.getParameter("LooseHcalIsol")), LooseEcalIsol_(iConfig.getParameter("LooseEcalIsol")), @@ -59,6 +55,12 @@ HBHEIsolatedNoiseReflagger::HBHEIsolatedNoiseReflagger(const edm::ParameterSet& debug_(iConfig.getUntrackedParameter("debug",true)), objvalidator_(iConfig) { + + tok_hbhe_ = consumes(iConfig.getParameter("hbheInput")); + tok_EB_ = consumes(iConfig.getParameter("ebInput")); + tok_EE_ = consumes(iConfig.getParameter("eeInput")); + tok_trackExt_ = consumes >(iConfig.getParameter("trackExtrapolationInput")); + produces(); } @@ -95,17 +97,17 @@ HBHEIsolatedNoiseReflagger::produce(edm::Event& iEvent, const edm::EventSetup& e // get the HB/HE hits edm::Handle hbhehits_h; - iEvent.getByLabel(hbheLabel_, hbhehits_h); + iEvent.getByToken(tok_hbhe_, hbhehits_h); // get the ECAL hits edm::Handle ebhits_h; - iEvent.getByLabel(ebLabel_, ebhits_h); + iEvent.getByToken(tok_EB_, ebhits_h); edm::Handle eehits_h; - iEvent.getByLabel(eeLabel_, eehits_h); + iEvent.getByToken(tok_EE_, eehits_h); // get the tracks edm::Handle > trackextraps_h; - iEvent.getByLabel(trackExtrapolationLabel_, trackextraps_h); + iEvent.getByToken(tok_trackExt_, trackextraps_h); // set the status maps and severity level computers for the hit validator objvalidator_.setHcalChannelQuality(dbHcalChStatus); diff --git a/RecoLocalCalo/HcalRecProducers/src/HBHEIsolatedNoiseReflagger.h b/RecoLocalCalo/HcalRecProducers/src/HBHEIsolatedNoiseReflagger.h index 5f8477dfa0607..0bd6250d79bd1 100644 --- a/RecoLocalCalo/HcalRecProducers/src/HBHEIsolatedNoiseReflagger.h +++ b/RecoLocalCalo/HcalRecProducers/src/HBHEIsolatedNoiseReflagger.h @@ -27,9 +27,10 @@ class HBHEIsolatedNoiseReflagger : public edm::EDProducer { void DumpHBHEHitMap(std::vector& i) const; // parameters - edm::InputTag hbheLabel_; - edm::InputTag ebLabel_, eeLabel_; - edm::InputTag trackExtrapolationLabel_; + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_EB_; + edm::EDGetTokenT tok_EE_; + edm::EDGetTokenT > tok_trackExt_; double LooseHcalIsol_; double LooseEcalIsol_; diff --git a/RecoLocalCalo/HcalRecProducers/src/HcalHitReconstructor.cc b/RecoLocalCalo/HcalRecProducers/src/HcalHitReconstructor.cc index 6e6ead481cb65..91267e6cca0ce 100644 --- a/RecoLocalCalo/HcalRecProducers/src/HcalHitReconstructor.cc +++ b/RecoLocalCalo/HcalRecProducers/src/HcalHitReconstructor.cc @@ -1,12 +1,10 @@ #include "HcalHitReconstructor.h" -#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" #include "DataFormats/Common/interface/EDCollection.h" #include "DataFormats/Common/interface/Handle.h" #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" #include "CalibFormats/HcalObjects/interface/HcalCoderDb.h" -#include "CalibFormats/HcalObjects/interface/HcalCalibrations.h" #include "CalibFormats/HcalObjects/interface/HcalDbService.h" #include "CalibFormats/HcalObjects/interface/HcalDbRecord.h" #include "RecoLocalCalo/HcalRecAlgos/interface/HcalSeverityLevelComputer.h" @@ -42,6 +40,12 @@ HcalHitReconstructor::HcalHitReconstructor(edm::ParameterSet const& conf): theTopology(0) { + // register for data access + tok_hbhe_ = consumes(inputLabel_); + tok_ho_ = consumes(inputLabel_); + tok_hf_ = consumes(inputLabel_); + tok_calib_ = consumes(inputLabel_); + std::string subd=conf.getParameter("Subdetector"); //Set all FlagSetters to 0 /* Important to do this! Otherwise, if the setters are turned off, @@ -295,7 +299,7 @@ void HcalHitReconstructor::produce(edm::Event& e, const edm::EventSetup& eventSe if (subdet_==HcalBarrel || subdet_==HcalEndcap) { edm::Handle digi; - e.getByLabel(inputLabel_,digi); + e.getByToken(tok_hbhe_,digi); // create empty output std::auto_ptr rec(new HBHERecHitCollection); @@ -429,7 +433,7 @@ void HcalHitReconstructor::produce(edm::Event& e, const edm::EventSetup& eventSe // HO ------------------------------------------------------------------ } else if (subdet_==HcalOuter) { edm::Handle digi; - e.getByLabel(inputLabel_,digi); + e.getByToken(tok_ho_,digi); // create empty output std::auto_ptr rec(new HORecHitCollection); @@ -513,7 +517,7 @@ void HcalHitReconstructor::produce(edm::Event& e, const edm::EventSetup& eventSe // HF ------------------------------------------------------------------- } else if (subdet_==HcalForward) { edm::Handle digi; - e.getByLabel(inputLabel_,digi); + e.getByToken(tok_hf_,digi); ///////////////////////////////////////////////////////////////// HF @@ -656,7 +660,7 @@ void HcalHitReconstructor::produce(edm::Event& e, const edm::EventSetup& eventSe e.put(rec); } else if (subdet_==HcalOther && subdetOther_==HcalCalibration) { edm::Handle digi; - e.getByLabel(inputLabel_,digi); + e.getByToken(tok_calib_,digi); // create empty output std::auto_ptr rec(new HcalCalibRecHitCollection); diff --git a/RecoLocalCalo/HcalRecProducers/src/HcalHitReconstructor.h b/RecoLocalCalo/HcalRecProducers/src/HcalHitReconstructor.h index b250bde2b4c35..1a1552bac5a10 100644 --- a/RecoLocalCalo/HcalRecProducers/src/HcalHitReconstructor.h +++ b/RecoLocalCalo/HcalRecProducers/src/HcalHitReconstructor.h @@ -28,6 +28,8 @@ #include "RecoLocalCalo/HcalRecAlgos/interface/HFTimingTrustFlag.h" #include "RecoLocalCalo/HcalRecAlgos/interface/HcalHF_S9S1algorithm.h" #include "RecoLocalCalo/HcalRecAlgos/interface/HcalHF_PETalgorithm.h" +#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" +#include "CalibFormats/HcalObjects/interface/HcalCalibrations.h" /** \class HcalHitReconstructor @@ -61,6 +63,10 @@ class HcalTopology; int subdet_; HcalOtherSubdetector subdetOther_; edm::InputTag inputLabel_; + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_hf_; + edm::EDGetTokenT tok_calib_; //std::vector channelStatusToDrop_; bool correctTiming_; // turn on/off Ken Rossato's algorithm to fix timing bool setNoiseFlags_; // turn on/off basic noise flags diff --git a/RecoLocalCalo/HcalRecProducers/src/HcalHitSelection.cc b/RecoLocalCalo/HcalRecProducers/src/HcalHitSelection.cc index c8ba6244854ed..ea97b1e2980b8 100644 --- a/RecoLocalCalo/HcalRecProducers/src/HcalHitSelection.cc +++ b/RecoLocalCalo/HcalRecProducers/src/HcalHitSelection.cc @@ -54,6 +54,10 @@ class HcalHitSelection : public edm::EDProducer { virtual void endJob() override ; edm::InputTag hbheTag,hoTag,hfTag; + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_hf_; + std::vector > toks_did_; int hoSeverityLevel; std::vector interestingDetIdCollections; @@ -109,8 +113,17 @@ HcalHitSelection::HcalHitSelection(const edm::ParameterSet& iConfig) hfTag=iConfig.getParameter("hfTag"); hoTag=iConfig.getParameter("hoTag"); + // register for data access + tok_hbhe_ = consumes(hbheTag); + tok_hf_ = consumes(hfTag); + tok_ho_ = consumes(hoTag); + interestingDetIdCollections = iConfig.getParameter< std::vector >("interestingDetIds"); + const unsigned nLabels = interestingDetIdCollections.size(); + for ( unsigned i=0; i != nLabels; i++ ) + toks_did_.push_back(consumes(interestingDetIdCollections[i])); + hoSeverityLevel=iConfig.getParameter("hoSeverityLevel"); produces(hbheTag.label()); @@ -144,15 +157,15 @@ HcalHitSelection::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) edm::Handle hf; edm::Handle ho; - iEvent.getByLabel(hbheTag,hbhe); - iEvent.getByLabel(hfTag,hf); - iEvent.getByLabel(hoTag,ho); + iEvent.getByToken(tok_hbhe_,hbhe); + iEvent.getByToken(tok_hf_,hf); + iEvent.getByToken(tok_ho_,ho); toBeKept.clear(); edm::Handle detId; - for( unsigned int t = 0; t < interestingDetIdCollections.size(); ++t ) + for( unsigned int t = 0; t < toks_did_.size(); ++t ) { - iEvent.getByLabel(interestingDetIdCollections[t],detId); + iEvent.getByToken(toks_did_[t],detId); if (!detId.isValid()){ edm::LogError("MissingInput")<<"the collection of interesting detIds:"<(inputLabel_); + tok_hf_ = consumes(inputLabel_); + std::string subd=conf.getParameter("Subdetector"); if(!strcasecmp(subd.c_str(),"upgradeHBHE")) { upgradeHBHE_ = true; @@ -139,7 +141,7 @@ void HcalSimpleReconstructor::processUpgrade(edm::Event& e, const edm::EventSetu if(upgradeHBHE_){ edm::Handle digi; - e.getByLabel(inputLabel_, digi); + e.getByToken(tok_hbhe_, digi); // create empty output std::auto_ptr rec(new HBHERecHitCollection); @@ -177,7 +179,7 @@ void HcalSimpleReconstructor::processUpgrade(edm::Event& e, const edm::EventSetu if(upgradeHF_){ edm::Handle digi; - e.getByLabel(inputLabel_, digi); + e.getByToken(tok_hf_, digi); // create empty output std::auto_ptr rec(new HFRecHitCollection); diff --git a/RecoLocalCalo/HcalRecProducers/src/HcalSimpleReconstructor.h b/RecoLocalCalo/HcalRecProducers/src/HcalSimpleReconstructor.h index e9066b2829e27..c7f26aed1190c 100644 --- a/RecoLocalCalo/HcalRecProducers/src/HcalSimpleReconstructor.h +++ b/RecoLocalCalo/HcalRecProducers/src/HcalSimpleReconstructor.h @@ -11,6 +11,8 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "RecoLocalCalo/HcalRecAlgos/interface/HcalSimpleRecAlgo.h" +#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" +#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" /** \class HcalSimpleReconstructor @@ -35,6 +37,9 @@ class HcalTopology; HcalOtherSubdetector subdetOther_; edm::InputTag inputLabel_; + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_hf_; + bool dropZSmarkedPassed_; // turn on/off dropping of zero suppression marked and passed digis // legacy parameters for config-set values compatibility diff --git a/RecoLocalCalo/HcalRecProducers/src/ZdcHitReconstructor.cc b/RecoLocalCalo/HcalRecProducers/src/ZdcHitReconstructor.cc index ab4040db92719..b3112866ed602 100644 --- a/RecoLocalCalo/HcalRecProducers/src/ZdcHitReconstructor.cc +++ b/RecoLocalCalo/HcalRecProducers/src/ZdcHitReconstructor.cc @@ -1,6 +1,4 @@ #include "ZdcHitReconstructor.h" -#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" -#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" #include "DataFormats/Common/interface/EDCollection.h" #include "DataFormats/Common/interface/Handle.h" #include "FWCore/Framework/interface/ESHandle.h" @@ -25,7 +23,6 @@ ZdcHitReconstructor::ZdcHitReconstructor(edm::ParameterSet const& conf): conf.getParameter("lowGainOffset"), conf.getParameter("lowGainFrac")), det_(DetId::Hcal), - inputLabel_(conf.getParameter("digiLabel")), correctTiming_(conf.getParameter("correctTiming")), setNoiseFlags_(conf.getParameter("setNoiseFlags")), setHSCPFlags_(conf.getParameter("setHSCPFlags")), @@ -37,6 +34,8 @@ ZdcHitReconstructor::ZdcHitReconstructor(edm::ParameterSet const& conf): theTopology(0) { + tok_input_ = consumes(conf.getParameter("digiLabel")); + std::sort(AuxTSvec_.begin(),AuxTSvec_.end()); // sort vector in ascending TS order std::string subd=conf.getParameter("Subdetector"); @@ -98,7 +97,7 @@ void ZdcHitReconstructor::produce(edm::Event& e, const edm::EventSetup& eventSet if (det_==DetId::Calo && subdet_==HcalZDCDetId::SubdetectorId) { edm::Handle digi; - e.getByLabel(inputLabel_,digi); + e.getByToken(tok_input_,digi); // create empty output std::auto_ptr rec(new ZDCRecHitCollection); diff --git a/RecoLocalCalo/HcalRecProducers/src/ZdcHitReconstructor.h b/RecoLocalCalo/HcalRecProducers/src/ZdcHitReconstructor.h index 80b42c2935736..04ff085d3f221 100644 --- a/RecoLocalCalo/HcalRecProducers/src/ZdcHitReconstructor.h +++ b/RecoLocalCalo/HcalRecProducers/src/ZdcHitReconstructor.h @@ -23,6 +23,9 @@ #include "RecoLocalCalo/HcalRecAlgos/interface/HcalADCSaturationFlag.h" #include "RecoLocalCalo/HcalRecAlgos/interface/HFTimingTrustFlag.h" +#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" +#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" + class HcalTopology; /** \class ZdcHitReconstructor @@ -50,7 +53,7 @@ class HcalTopology; DetId::Detector det_; int subdet_; HcalOtherSubdetector subdetOther_; - edm::InputTag inputLabel_; + edm::EDGetTokenT tok_input_; //std::vector channelStatusToDrop_; bool correctTiming_; // turn on/off Ken Rossato's algorithm to fix timing bool setNoiseFlags_; // turn on/off basic noise flags diff --git a/RecoLocalCalo/HcalRecProducers/src/ZdcSimpleReconstructor.cc b/RecoLocalCalo/HcalRecProducers/src/ZdcSimpleReconstructor.cc index 386e0e264f70e..9419a662fdc7a 100644 --- a/RecoLocalCalo/HcalRecProducers/src/ZdcSimpleReconstructor.cc +++ b/RecoLocalCalo/HcalRecProducers/src/ZdcSimpleReconstructor.cc @@ -1,6 +1,4 @@ #include "ZdcSimpleReconstructor.h" -#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" -#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" #include "DataFormats/Common/interface/EDCollection.h" #include "DataFormats/Common/interface/Handle.h" #include "FWCore/Framework/interface/ESHandle.h" @@ -20,9 +18,10 @@ ZdcSimpleReconstructor::ZdcSimpleReconstructor(edm::ParameterSet const& conf): conf.getParameter("lowGainOffset"), conf.getParameter("lowGainFrac")), det_(DetId::Hcal), - inputLabel_(conf.getParameter("digiLabel")), dropZSmarkedPassed_(conf.getParameter("dropZSmarkedPassed")) { + tok_input_ = consumes(conf.getParameter("digiLabel")); + std::string subd=conf.getParameter("Subdetector"); if (!strcasecmp(subd.c_str(),"ZDC")) { det_=DetId::Calo; @@ -61,7 +60,7 @@ void ZdcSimpleReconstructor::produce(edm::Event& e, const edm::EventSetup& event if (det_==DetId::Calo && subdet_==HcalZDCDetId::SubdetectorId) { edm::Handle digi; - e.getByLabel(inputLabel_,digi); + e.getByToken(tok_input_,digi); // create empty output std::auto_ptr rec(new ZDCRecHitCollection); diff --git a/RecoLocalCalo/HcalRecProducers/src/ZdcSimpleReconstructor.h b/RecoLocalCalo/HcalRecProducers/src/ZdcSimpleReconstructor.h index 8c8953d3a1f56..948d93216b5d0 100644 --- a/RecoLocalCalo/HcalRecProducers/src/ZdcSimpleReconstructor.h +++ b/RecoLocalCalo/HcalRecProducers/src/ZdcSimpleReconstructor.h @@ -11,6 +11,9 @@ #include "RecoLocalCalo/HcalRecAlgos/interface/ZdcSimpleRecAlgo.h" +#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" +#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" + /** \class HcalSimpleReconstructor \author E. Garcia - CSU @@ -28,7 +31,7 @@ DetId::Detector det_; int subdet_; HcalOtherSubdetector subdetOther_; - edm::InputTag inputLabel_; + edm::EDGetTokenT tok_input_; bool dropZSmarkedPassed_; // turn on/off dropping of zero suppression marked and passed digis diff --git a/RecoTBCalo/HcalPlotter/src/HcalQLPlotAnal.cc b/RecoTBCalo/HcalPlotter/src/HcalQLPlotAnal.cc index 3d943d9f7add0..178b7de0de6a0 100644 --- a/RecoTBCalo/HcalPlotter/src/HcalQLPlotAnal.cc +++ b/RecoTBCalo/HcalPlotter/src/HcalQLPlotAnal.cc @@ -49,8 +49,15 @@ class HcalQLPlotAnal : public edm::EDAnalyzer { virtual void endJob() override ; // ----------member data --------------------------- - edm::InputTag hbheRHLabel_,hoRHLabel_,hfRHLabel_; - edm::InputTag hcalDigiLabel_, hcalTrigLabel_; + edm::InputTag hcalDigiLabel_; + edm::EDGetTokenT tok_hbherec_; + edm::EDGetTokenT tok_horec_; + edm::EDGetTokenT tok_hfrec_; + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_hf_; + edm::EDGetTokenT tok_calib_; + edm::EDGetTokenT tok_tb_; bool doCalib_; double calibFC2GeV_; HcalQLPlotAnalAlgos * algo_; @@ -69,17 +76,23 @@ class HcalQLPlotAnal : public edm::EDAnalyzer { // constructors and destructor // HcalQLPlotAnal::HcalQLPlotAnal(const edm::ParameterSet& iConfig) : - hbheRHLabel_(iConfig.getUntrackedParameter("hbheRHtag")), - hoRHLabel_(iConfig.getUntrackedParameter("hoRHtag")), - hfRHLabel_(iConfig.getUntrackedParameter("hfRHtag")), hcalDigiLabel_(iConfig.getUntrackedParameter("hcalDigiTag")), - hcalTrigLabel_(iConfig.getUntrackedParameter("hcalTrigTag")), doCalib_(iConfig.getUntrackedParameter("doCalib",false)), calibFC2GeV_(iConfig.getUntrackedParameter("calibFC2GeV",0.2)) { algo_ = new HcalQLPlotAnalAlgos(iConfig.getUntrackedParameter("outputFilename").c_str(), iConfig.getParameter("HistoParameters")); + + tok_hbherec_ = consumes(iConfig.getUntrackedParameter("hbheRHtag")); + tok_horec_ = consumes(iConfig.getUntrackedParameter("hoRHtag")); + tok_hfrec_ = consumes(iConfig.getUntrackedParameter("hfRHtag")); + tok_hbhe_ = consumes(hcalDigiLabel_); + tok_ho_ = consumes(hcalDigiLabel_); + tok_hf_ = consumes(hcalDigiLabel_); + tok_calib_ = consumes(hcalDigiLabel_); + tok_tb_ = consumes(iConfig.getUntrackedParameter("hcalTrigTag")); + } @@ -100,7 +113,7 @@ HcalQLPlotAnal::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { // Step A/C: Get Inputs and process (repeatedly) edm::Handle trig; - iEvent.getByLabel(hcalTrigLabel_,trig); + iEvent.getByToken(tok_tb_,trig); if (!trig.isValid()) { edm::LogError("HcalQLPlotAnal::analyze") << "No Trigger Data found, skip event"; return; @@ -108,14 +121,14 @@ HcalQLPlotAnal::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) algo_->SetEventType(*trig); } edm::Handle hbhedg; - iEvent.getByLabel(hcalDigiLabel_,hbhedg); + iEvent.getByToken(tok_hbhe_,hbhedg); if (!hbhedg.isValid()) { edm::LogWarning("HcalQLPlotAnal::analyze") << "One of HBHE Digis/RecHits not found"; } else { algo_->processDigi(*hbhedg); } edm::Handle hbherh; - iEvent.getByLabel(hbheRHLabel_,hbherh); + iEvent.getByToken(tok_hbherec_,hbherh); if (!hbherh.isValid()) { edm::LogWarning("HcalQLPlotAnal::analyze") << "One of HBHE Digis/RecHits not found"; } else { @@ -123,7 +136,7 @@ HcalQLPlotAnal::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) } edm::Handle hodg; - iEvent.getByLabel(hcalDigiLabel_,hodg); + iEvent.getByToken(tok_ho_,hodg); if (!hodg.isValid()) { // can't find it! edm::LogWarning("HcalQLPlotAnal::analyze") << "One of HO Digis/RecHits not found"; @@ -131,7 +144,7 @@ HcalQLPlotAnal::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) algo_->processDigi(*hodg); } edm::Handle horh; - iEvent.getByLabel(hoRHLabel_,horh); + iEvent.getByToken(tok_horec_,horh); if (!horh.isValid()) { // can't find it! edm::LogWarning("HcalQLPlotAnal::analyze") << "One of HO Digis/RecHits not found"; @@ -140,7 +153,7 @@ HcalQLPlotAnal::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) } edm::Handle hfdg; - iEvent.getByLabel(hcalDigiLabel_,hfdg); + iEvent.getByToken(tok_hf_,hfdg); if (!hfdg.isValid()) { // can't find it! @@ -150,7 +163,7 @@ HcalQLPlotAnal::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) } edm::Handle hfrh; - iEvent.getByLabel(hfRHLabel_,hfrh); + iEvent.getByToken(tok_hfrec_,hfrh); if (!hfrh.isValid()) { // can't find it! edm::LogWarning("HcalQLPlotAnal::analyze") << "One of HF Digis/RecHits not found"; @@ -161,7 +174,7 @@ HcalQLPlotAnal::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) if (doCalib_) { // No rechits as of yet... edm::Handle calibdg; - iEvent.getByLabel(hcalDigiLabel_,calibdg); + iEvent.getByToken(tok_calib_,calibdg); if (!calibdg.isValid()) { edm::LogWarning("HcalQLPlotAnal::analyze") << "Hcal Calib Digis not found"; } else { diff --git a/RecoTBCalo/HcalTBObjectUnpacker/plugins/HcalTBObjectUnpacker.cc b/RecoTBCalo/HcalTBObjectUnpacker/plugins/HcalTBObjectUnpacker.cc index 9b2e2aa52c601..81eb9052da77d 100644 --- a/RecoTBCalo/HcalTBObjectUnpacker/plugins/HcalTBObjectUnpacker.cc +++ b/RecoTBCalo/HcalTBObjectUnpacker/plugins/HcalTBObjectUnpacker.cc @@ -1,6 +1,5 @@ using namespace std; -#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" #include "TBDataFormats/HcalTBObjects/interface/HcalTBTriggerData.h" #include "TBDataFormats/HcalTBObjects/interface/HcalTBRunData.h" #include "TBDataFormats/HcalTBObjects/interface/HcalTBEventPosition.h" @@ -21,10 +20,11 @@ using namespace std; qadcFed_(conf.getUntrackedParameter("HcalQADCFED",-1)), calibFile_(conf.getUntrackedParameter("ConfigurationFile","")), tdcUnpacker_(conf.getUntrackedParameter("IncludeUnmatchedHits",false)), - doRunData_(false),doTriggerData_(false),doEventPosition_(false),doTiming_(false),doSourcePos_(false),doBeamADC_(false), - fedRawDataCollectionTag_(conf.getParameter("fedRawDataCollectionTag")) + doRunData_(false),doTriggerData_(false),doEventPosition_(false),doTiming_(false),doSourcePos_(false),doBeamADC_(false) { + tok_raw_ = consumes(conf.getParameter("fedRawDataCollectionTag")); + if (triggerFed_ >=0) { std::cout << "HcalTBObjectUnpacker will unpack Trigger FED "; std::cout << triggerFed_ << endl; @@ -93,7 +93,7 @@ using namespace std; { // Step A: Get Inputs edm::Handle rawraw; - e.getByLabel(fedRawDataCollectionTag_, rawraw); + e.getByToken(tok_raw_, rawraw); // Step B: Create empty output std::auto_ptr diff --git a/RecoTBCalo/HcalTBObjectUnpacker/plugins/HcalTBObjectUnpacker.h b/RecoTBCalo/HcalTBObjectUnpacker/plugins/HcalTBObjectUnpacker.h index e0a12ecdc8c87..10597f6d81c3e 100644 --- a/RecoTBCalo/HcalTBObjectUnpacker/plugins/HcalTBObjectUnpacker.h +++ b/RecoTBCalo/HcalTBObjectUnpacker/plugins/HcalTBObjectUnpacker.h @@ -28,6 +28,8 @@ #include "RecoTBCalo/HcalTBObjectUnpacker/interface/HcalTBQADCUnpacker.h" #include "RecoTBCalo/HcalTBObjectUnpacker/interface/HcalTBSourcePositionDataUnpacker.h" +#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" + class HcalTBObjectUnpacker : public edm::EDProducer { public: @@ -49,7 +51,7 @@ bool doRunData_, doTriggerData_, doEventPosition_, doTiming_, doSourcePos_,doBeamADC_; std::vector > calibLines_; - edm::InputTag fedRawDataCollectionTag_; + edm::EDGetTokenT tok_raw_; void parseCalib(); diff --git a/RecoTBCalo/HcalTBTools/src/HcalTBTriggerFilter.cc b/RecoTBCalo/HcalTBTools/src/HcalTBTriggerFilter.cc index f49e677ff67e5..9a1a0ead0e9cf 100644 --- a/RecoTBCalo/HcalTBTools/src/HcalTBTriggerFilter.cc +++ b/RecoTBCalo/HcalTBTools/src/HcalTBTriggerFilter.cc @@ -1,5 +1,4 @@ #include "RecoTBCalo/HcalTBTools/src/HcalTBTriggerFilter.h" -#include "TBDataFormats/HcalTBObjects/interface/HcalTBTriggerData.h" #include "DataFormats/Common/interface/Handle.h" HcalTBTriggerFilter::HcalTBTriggerFilter(const edm::ParameterSet& ps) : @@ -8,15 +7,15 @@ HcalTBTriggerFilter::HcalTBTriggerFilter(const edm::ParameterSet& ps) : allowPedestalOutSpill_(ps.getParameter("AllowPedestalOutSpill")), allowLaser_(ps.getParameter("AllowLaser")), allowLED_(ps.getParameter("AllowLED")), - allowBeam_(ps.getParameter("AllowBeam")), - hcalTBTriggerDataTag_(ps.getParameter("hcalTBTriggerDataTag")) + allowBeam_(ps.getParameter("AllowBeam")) { + tok_tb_ = consumes(ps.getParameter("hcalTBTriggerDataTag")); } bool HcalTBTriggerFilter::filter(edm::Event& e, edm::EventSetup const& c) { edm::Handle h; - e.getByLabel(hcalTBTriggerDataTag_, h); + e.getByToken(tok_tb_, h); bool allowed=false; diff --git a/RecoTBCalo/HcalTBTools/src/HcalTBTriggerFilter.h b/RecoTBCalo/HcalTBTools/src/HcalTBTriggerFilter.h index 8e9e882b3a607..d7c124093cb60 100644 --- a/RecoTBCalo/HcalTBTools/src/HcalTBTriggerFilter.h +++ b/RecoTBCalo/HcalTBTools/src/HcalTBTriggerFilter.h @@ -6,6 +6,7 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Utilities/interface/InputTag.h" +#include "TBDataFormats/HcalTBObjects/interface/HcalTBTriggerData.h" /** \class HcalTBTriggerFilter @@ -23,7 +24,7 @@ class HcalTBTriggerFilter : public edm::EDFilter { bool allowLaser_; bool allowLED_; bool allowBeam_; - edm::InputTag hcalTBTriggerDataTag_; + edm::EDGetTokenT tok_tb_; }; #endif diff --git a/RecoTBCalo/ZDCTBAnalysis/src/ZdcTBAnalyzer.cc b/RecoTBCalo/ZDCTBAnalysis/src/ZdcTBAnalyzer.cc index 15afe3358de74..fbeb0e90e2f36 100644 --- a/RecoTBCalo/ZDCTBAnalysis/src/ZdcTBAnalyzer.cc +++ b/RecoTBCalo/ZDCTBAnalysis/src/ZdcTBAnalyzer.cc @@ -37,20 +37,21 @@ class ZdcTBAnalyzer : public edm::EDAnalyzer { bool triggerInfo; ZdcTBAnalysis zdcTBAnalysis; - edm::InputTag zdcRecHitCollectionTag; - edm::InputTag hcalTBTriggerDataTag; - edm::InputTag hcalTBTimingTag; - edm::InputTag hcalTBBeamCountersTag; - edm::InputTag hcalTBEventPositionTag; + edm::EDGetTokenT tok_zdc_; + edm::EDGetTokenT tok_tb_; + edm::EDGetTokenT tok_timing_; + edm::EDGetTokenT tok_bc_; + edm::EDGetTokenT tok_pos_; }; -ZdcTBAnalyzer::ZdcTBAnalyzer(const edm::ParameterSet& iConfig) : - zdcRecHitCollectionTag(iConfig.getParameter("zdcRecHitCollectionTag")), - hcalTBTriggerDataTag(iConfig.getParameter("hcalTBTriggerDataTag")), - hcalTBTimingTag(iConfig.getParameter("hcalTBTimingTag")), - hcalTBBeamCountersTag(iConfig.getParameter("hcalTBBeamCountersTag")), - hcalTBEventPositionTag(iConfig.getParameter("hcalTBEventPositionTag")) -{ +ZdcTBAnalyzer::ZdcTBAnalyzer(const edm::ParameterSet& iConfig) { + + tok_zdc_ = consumes(iConfig.getParameter("zdcRecHitCollectionTag")); + tok_tb_ = consumes(iConfig.getParameter("hcalTBTriggerDataTag")); + tok_timing_ = consumes(iConfig.getParameter("hcalTBTimingTag")); + tok_bc_ = consumes(iConfig.getParameter("hcalTBBeamCountersTag")); + tok_pos_ = consumes(iConfig.getParameter("hcalTBEventPositionTag")); + std::cout<<"**************** ZdcTBAnalizer Start**************************"<("ZdcTBAnalyzer"); @@ -72,21 +73,21 @@ void ZdcTBAnalyzer::analyze(const edm::Event& e, const edm::EventSetup&){ edm::Handle bc; edm::Handle chpos; - e.getByLabel(zdcRecHitCollectionTag, zdcRecHits); + e.getByToken(tok_zdc_, zdcRecHits); if(triggerInfo){ - e.getByLabel(hcalTBTriggerDataTag, triggers); + e.getByToken(tok_tb_, triggers); zdcTBAnalysis.analyze(*triggers); } if(beamDetectorsTDCInfo){ - e.getByLabel(hcalTBTimingTag, times); // e.getByLabel("tbunpacker2",times); + e.getByToken(tok_timing_, times); // e.getByLabel("tbunpacker2",times); zdcTBAnalysis.analyze(*times); } if(beamDetectorsADCInfo){ - e.getByLabel(hcalTBBeamCountersTag, bc); + e.getByToken(tok_bc_, bc); zdcTBAnalysis.analyze(*bc); } if(wireChambersInfo){ - e.getByLabel(hcalTBEventPositionTag, chpos); + e.getByToken(tok_pos_, chpos); zdcTBAnalysis.analyze(*chpos); } zdcTBAnalysis.analyze(*zdcRecHits); diff --git a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTTPDigiProducer.cc b/SimCalorimetry/HcalTrigPrimProducers/src/HcalTTPDigiProducer.cc index 2f2bed30151c8..63922b9ca8d2a 100644 --- a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTTPDigiProducer.cc +++ b/SimCalorimetry/HcalTrigPrimProducers/src/HcalTTPDigiProducer.cc @@ -2,7 +2,6 @@ #include "DataFormats/HcalDigi/interface/HFDataFrame.h" #include "DataFormats/HcalDetId/interface/HcalSubdetector.h" -#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" #include "CalibFormats/HcalObjects/interface/HcalTPGRecord.h" #include "CalibFormats/HcalObjects/interface/HcalTPGCoder.h" #include "DataFormats/Common/interface/Handle.h" @@ -23,7 +22,7 @@ const int HcalTTPDigiProducer::inputs_[] = { 30,66,4,44,4,44,0,68, HcalTTPDigiProducer::HcalTTPDigiProducer(const edm::ParameterSet& ps) { - hfDigis_ = ps.getParameter("HFDigiCollection") ; + tok_hf_ = consumes(ps.getParameter("HFDigiCollection")); maskedChannels_ = ps.getParameter< std::vector >("maskedChannels") ; bit_[0] = ps.getParameter("defTT8") ; bit_[1] = ps.getParameter("defTT9") ; @@ -115,7 +114,7 @@ void HcalTTPDigiProducer::produce(edm::Event& e, const edm::EventSetup& eventSet // Step A: Get Inputs edm::Handle hfDigiCollection ; - e.getByLabel(hfDigis_,hfDigiCollection) ; + e.getByToken(tok_hf_,hfDigiCollection) ; edm::ESHandle inputCoder ; eventSetup.get().get(inputCoder) ; diff --git a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTTPDigiProducer.h b/SimCalorimetry/HcalTrigPrimProducers/src/HcalTTPDigiProducer.h index 443537216f9dd..6e562432ca158 100644 --- a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTTPDigiProducer.h +++ b/SimCalorimetry/HcalTrigPrimProducers/src/HcalTTPDigiProducer.h @@ -6,6 +6,7 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "DataFormats/HcalDetId/interface/HcalDetId.h" +#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" class HcalTTPDigiProducer : public edm::EDProducer { @@ -21,7 +22,7 @@ class HcalTTPDigiProducer : public edm::EDProducer bool isMasked(HcalDetId id) ; bool decision(int nP, int nM, int bit) ; - edm::InputTag hfDigis_ ; + edm::EDGetTokenT tok_hf_; std::vector maskedChannels_ ; std::string bit_[4] ; int calc_[4] ; diff --git a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTTPTriggerRecord.cc b/SimCalorimetry/HcalTrigPrimProducers/src/HcalTTPTriggerRecord.cc index fce959ec71cff..32438abc8a473 100644 --- a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTTPTriggerRecord.cc +++ b/SimCalorimetry/HcalTrigPrimProducers/src/HcalTTPTriggerRecord.cc @@ -1,7 +1,6 @@ #include "SimCalorimetry/HcalTrigPrimProducers/src/HcalTTPTriggerRecord.h" #include "DataFormats/HcalDigi/interface/HcalTTPDigi.h" -#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" #include "DataFormats/L1GlobalTrigger/interface/L1GtTechnicalTriggerRecord.h" #include "DataFormats/Common/interface/Handle.h" #include "FWCore/Framework/interface/ESHandle.h" @@ -9,7 +8,7 @@ HcalTTPTriggerRecord::HcalTTPTriggerRecord(const edm::ParameterSet& ps) { - ttpDigis_ = ps.getParameter("ttpDigiCollection") ; + tok_ttp_ = consumes(ps.getParameter("ttpDigiCollection")); ttpBits_ = ps.getParameter< std::vector >("ttpBits"); names_ = ps.getParameter< std::vector >("ttpBitNames"); @@ -26,7 +25,7 @@ void HcalTTPTriggerRecord::produce(edm::Event& e, const edm::EventSetup& eventSe // Get Inputs edm::Handle ttpDigiCollection ; - e.getByLabel(ttpDigis_,ttpDigiCollection) ; + e.getByToken(tok_ttp_,ttpDigiCollection) ; if ( !ttpDigiCollection.failedToGet() ) { const HcalTTPDigiCollection* ttpDigis = ttpDigiCollection.product() ; diff --git a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTTPTriggerRecord.h b/SimCalorimetry/HcalTrigPrimProducers/src/HcalTTPTriggerRecord.h index ae8b9d6d291f9..ffe8061956b48 100644 --- a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTTPTriggerRecord.h +++ b/SimCalorimetry/HcalTrigPrimProducers/src/HcalTTPTriggerRecord.h @@ -5,6 +5,7 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" +#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" class HcalTTPTriggerRecord : public edm::EDProducer { @@ -16,8 +17,8 @@ class HcalTTPTriggerRecord : public edm::EDProducer virtual void produce(edm::Event& e, const edm::EventSetup& c); private: - - edm::InputTag ttpDigis_ ; + + edm::EDGetTokenT tok_ttp_; std::vector ttpBits_ ; std::vector names_ ; diff --git a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.cc b/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.cc index 93dd52251d40e..852ee1899fb8f 100644 --- a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.cc +++ b/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.cc @@ -4,7 +4,6 @@ #include "DataFormats/Common/interface/Handle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Framework/interface/ESHandle.h" -#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" #include "DataFormats/HcalDigi/interface/HBHEDataFrame.h" #include "DataFormats/HcalDigi/interface/HFDataFrame.h" #include "DataFormats/HcalDigi/interface/HcalTriggerPrimitiveDigi.h" @@ -17,7 +16,6 @@ #include "CalibFormats/CaloTPG/interface/CaloTPGTranscoder.h" #include "CalibFormats/HcalObjects/interface/HcalDbService.h" #include "CalibFormats/HcalObjects/interface/HcalDbRecord.h" -#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" #include "CondFormats/HcalObjects/interface/HcalElectronicsMap.h" #include "CondFormats/HcalObjects/interface/HcalLutMetadata.h" #include "Geometry/Records/interface/CaloGeometryRecord.h" @@ -41,6 +39,11 @@ HcalTrigPrimDigiProducer::HcalTrigPrimDigiProducer(const edm::ParameterSet& ps) runZS_(ps.getParameter("RunZS")), runFrontEndFormatError_(ps.getParameter("FrontEndFormatError")) { + // register for data access + tok_raw_ = consumes(inputTagFEDRaw_); + tok_hbhe_ = consumes(inputLabel_[0]); + tok_hf_ = consumes(inputLabel_[1]); + produces(); theAlgo_.setPeakFinderAlgorithm(ps.getParameter("PeakFinderAlgorithm")); } @@ -69,8 +72,8 @@ void HcalTrigPrimDigiProducer::produce(edm::Event& iEvent, const edm::EventSetup edm::Handle hbheDigis; edm::Handle hfDigis; - iEvent.getByLabel(inputLabel_[0],hbheDigis); - iEvent.getByLabel(inputLabel_[1],hfDigis); + iEvent.getByToken(tok_hbhe_,hbheDigis); + iEvent.getByToken(tok_hf_,hfDigis); // protect here against missing input collections // there is no protection in HcalTriggerPrimitiveAlgo @@ -118,7 +121,7 @@ void HcalTrigPrimDigiProducer::produce(edm::Event& iEvent, const edm::EventSetup const HcalElectronicsMap *emap = pSetup->getHcalMapping(); edm::Handle < FEDRawDataCollection > fedHandle; - iEvent.getByLabel(inputTagFEDRaw_, fedHandle); + iEvent.getByToken(tok_raw_, fedHandle); if (fedHandle.isValid() && emap != 0) { theAlgo_.runFEFormatError(fedHandle.product(), emap, *result); diff --git a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.h b/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.h index 8ccab8ce4ccda..32ad83f4300e1 100644 --- a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.h +++ b/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.h @@ -5,6 +5,8 @@ #include "FWCore/Framework/interface/EventSetup.h" #include "SimCalorimetry/HcalTrigPrimAlgos/interface/HcalTriggerPrimitiveAlgo.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" +#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" #include class HcalTrigPrimDigiProducer : public edm::EDProducer @@ -23,9 +25,13 @@ class HcalTrigPrimDigiProducer : public edm::EDProducer /// input tags for HCAL digis std::vector inputLabel_; + // this seems a strange way of doing things + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_hf_; /// input tag for FEDRawDataCollection edm::InputTag inputTagFEDRaw_; + edm::EDGetTokenT tok_raw_; bool runZS_; diff --git a/SimCalorimetry/HcalZeroSuppressionProducers/src/HcalRealisticZS.cc b/SimCalorimetry/HcalZeroSuppressionProducers/src/HcalRealisticZS.cc index 13b9c3448ec06..dd871a1eb4e61 100644 --- a/SimCalorimetry/HcalZeroSuppressionProducers/src/HcalRealisticZS.cc +++ b/SimCalorimetry/HcalZeroSuppressionProducers/src/HcalRealisticZS.cc @@ -1,5 +1,4 @@ #include "HcalRealisticZS.h" -#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" #include "DataFormats/Common/interface/EDCollection.h" #include "DataFormats/Common/interface/Handle.h" #include "FWCore/Framework/interface/ESHandle.h" @@ -15,6 +14,13 @@ HcalRealisticZS::HcalRealisticZS(edm::ParameterSet const& conf): bool markAndPass=conf.getParameter("markAndPass"); + // register for data access + tok_hbhe_ = consumes(edm::InputTag(inputLabel_)); + tok_ho_ = consumes(edm::InputTag(inputLabel_)); + tok_hf_ = consumes(edm::InputTag(inputLabel_)); + tok_hbheUpgrade_ = consumes(edm::InputTag(inputLabel_, "HBHEUpgradeDigiCollection")); + tok_hfUpgrade_ = consumes(edm::InputTag(inputLabel_, "HFUpgradeDigiCollection")); + std::vector tmp = conf.getParameter >("HBregion"); @@ -103,25 +109,23 @@ void HcalRealisticZS::produce(edm::Event& e, const edm::EventSetup& eventSetup) eventSetup.get().get(conditions); algo_->setDbService(conditions.product()); - e.getByLabel(inputLabel_,hbhe); + e.getByToken(tok_hbhe_,hbhe); // create empty output std::auto_ptr zs_hbhe(new HBHEDigiCollection); - e.getByLabel(inputLabel_,ho); + e.getByToken(tok_ho_,ho); // create empty output std::auto_ptr zs_ho(new HODigiCollection); - e.getByLabel(inputLabel_,hf); + e.getByToken(tok_hf_,hf); // create empty output std::auto_ptr zs_hf(new HFDigiCollection); - edm::InputTag hbheUpgradeTag(inputLabel_, "HBHEUpgradeDigiCollection"); - e.getByLabel(hbheUpgradeTag,hbheUpgrade); - edm::InputTag hfUpgradeTag(inputLabel_, "HFUpgradeDigiCollection"); - e.getByLabel(hfUpgradeTag,hfUpgrade); + e.getByToken(tok_hbheUpgrade_,hbheUpgrade); + e.getByToken(tok_hfUpgrade_,hfUpgrade); // create empty output std::auto_ptr zs_hbheUpgrade(new HBHEUpgradeDigiCollection); diff --git a/SimCalorimetry/HcalZeroSuppressionProducers/src/HcalRealisticZS.h b/SimCalorimetry/HcalZeroSuppressionProducers/src/HcalRealisticZS.h index 3f6dd421cf2b6..4df2662bfe863 100644 --- a/SimCalorimetry/HcalZeroSuppressionProducers/src/HcalRealisticZS.h +++ b/SimCalorimetry/HcalZeroSuppressionProducers/src/HcalRealisticZS.h @@ -9,6 +9,7 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "HcalZSAlgoRealistic.h" +#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" #include @@ -24,6 +25,11 @@ class HcalRealisticZS : public edm::EDProducer { private: std::auto_ptr algo_; std::string inputLabel_; + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_hf_; + edm::EDGetTokenT tok_hbheUpgrade_; + edm::EDGetTokenT tok_hfUpgrade_; }; #endif diff --git a/SimCalorimetry/HcalZeroSuppressionProducers/src/HcalSimpleAmplitudeZS.cc b/SimCalorimetry/HcalZeroSuppressionProducers/src/HcalSimpleAmplitudeZS.cc index b829fc9e7537e..1db63d0d0edcc 100644 --- a/SimCalorimetry/HcalZeroSuppressionProducers/src/HcalSimpleAmplitudeZS.cc +++ b/SimCalorimetry/HcalZeroSuppressionProducers/src/HcalSimpleAmplitudeZS.cc @@ -1,5 +1,4 @@ #include "HcalSimpleAmplitudeZS.h" -#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" #include "DataFormats/Common/interface/EDCollection.h" #include "DataFormats/Common/interface/Handle.h" #include "FWCore/Framework/interface/ESHandle.h" @@ -17,6 +16,14 @@ using namespace std; HcalSimpleAmplitudeZS::HcalSimpleAmplitudeZS(edm::ParameterSet const& conf): inputLabel_(conf.getParameter("digiLabel")) { + + // register for data access + tok_hbhe_ = consumes(edm::InputTag(inputLabel_)); + tok_ho_ = consumes(edm::InputTag(inputLabel_)); + tok_hf_ = consumes(edm::InputTag(inputLabel_)); + tok_hbheUpgrade_ = consumes(edm::InputTag(inputLabel_, "HBHEUpgradeDigiCollection")); + tok_hfUpgrade_ = consumes(edm::InputTag(inputLabel_, "HFUpgradeDigiCollection")); + const edm::ParameterSet& psHBHE=conf.getParameter("hbhe"); bool markAndPass=psHBHE.getParameter("markAndPass"); hbhe_=std::auto_ptr(new HcalZSAlgoEnergy(markAndPass, @@ -71,7 +78,7 @@ void HcalSimpleAmplitudeZS::produce(edm::Event& e, const edm::EventSetup& eventS { hbhe_->prepare(&(*conditions)); edm::Handle digi; - e.getByLabel(inputLabel_,digi); + e.getByToken(tok_hbhe_,digi); // create empty output std::auto_ptr zs(new HBHEDigiCollection); @@ -87,7 +94,7 @@ void HcalSimpleAmplitudeZS::produce(edm::Event& e, const edm::EventSetup& eventS { ho_->prepare(&(*conditions)); edm::Handle digi; - e.getByLabel(inputLabel_,digi); + e.getByToken(tok_ho_,digi); // create empty output std::auto_ptr zs(new HODigiCollection); @@ -103,7 +110,7 @@ void HcalSimpleAmplitudeZS::produce(edm::Event& e, const edm::EventSetup& eventS { hf_->prepare(&(*conditions)); edm::Handle digi; - e.getByLabel(inputLabel_,digi); + e.getByToken(tok_hf_,digi); // create empty output std::auto_ptr zs(new HFDigiCollection); @@ -119,8 +126,7 @@ void HcalSimpleAmplitudeZS::produce(edm::Event& e, const edm::EventSetup& eventS { hbheUpgrade_->prepare(&(*conditions)); edm::Handle digi; - edm::InputTag hbheUpgradeTag(inputLabel_, "HBHEUpgradeDigiCollection"); - e.getByLabel(hbheUpgradeTag,digi); + e.getByToken(tok_hbheUpgrade_,digi); // create empty output std::auto_ptr zs(new HBHEUpgradeDigiCollection); @@ -136,8 +142,7 @@ void HcalSimpleAmplitudeZS::produce(edm::Event& e, const edm::EventSetup& eventS { hfUpgrade_->prepare(&(*conditions)); edm::Handle digi; - edm::InputTag hfUpgradeTag(inputLabel_, "HFUpgradeDigiCollection"); - e.getByLabel(hfUpgradeTag,digi); + e.getByToken(tok_hfUpgrade_,digi); // create empty output std::auto_ptr zs(new HFUpgradeDigiCollection); diff --git a/SimCalorimetry/HcalZeroSuppressionProducers/src/HcalSimpleAmplitudeZS.h b/SimCalorimetry/HcalZeroSuppressionProducers/src/HcalSimpleAmplitudeZS.h index 332abaefbeccf..921a477f0ae3b 100644 --- a/SimCalorimetry/HcalZeroSuppressionProducers/src/HcalSimpleAmplitudeZS.h +++ b/SimCalorimetry/HcalZeroSuppressionProducers/src/HcalSimpleAmplitudeZS.h @@ -8,6 +8,7 @@ #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" #include "HcalZSAlgoEnergy.h" #include @@ -24,6 +25,11 @@ class HcalSimpleAmplitudeZS : public edm::EDProducer { private: std::auto_ptr hbhe_,ho_,hf_,hbheUpgrade_,hfUpgrade_; std::string inputLabel_; + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_hf_; + edm::EDGetTokenT tok_hbheUpgrade_; + edm::EDGetTokenT tok_hfUpgrade_; }; #endif diff --git a/SimG4CMS/Calo/test/CaloSimHitStudy.cc b/SimG4CMS/Calo/test/CaloSimHitStudy.cc index 4c61dab79d75d..525fb04fef1f7 100644 --- a/SimG4CMS/Calo/test/CaloSimHitStudy.cc +++ b/SimG4CMS/Calo/test/CaloSimHitStudy.cc @@ -1,18 +1,19 @@ #include "SimG4CMS/Calo/test/CaloSimHitStudy.h" #include "DataFormats/HcalDetId/interface/HcalDetId.h" #include "SimG4CMS/Calo/interface/CaloHitID.h" -#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" #include "FWCore/Utilities/interface/Exception.h" CaloSimHitStudy::CaloSimHitStudy(const edm::ParameterSet& ps) { - sourceLabel = ps.getUntrackedParameter("SourceLabel","generator"); + tok_evt_ = consumes(edm::InputTag(ps.getUntrackedParameter("SourceLabel","generator"))); g4Label = ps.getUntrackedParameter("ModuleLabel","g4SimHits"); hitLab[0] = ps.getUntrackedParameter("EBCollection","EcalHitsEB"); hitLab[1] = ps.getUntrackedParameter("EECollection","EcalHitsEE"); hitLab[2] = ps.getUntrackedParameter("ESCollection","EcalHitsES"); hitLab[3] = ps.getUntrackedParameter("HCCollection","HcalHits"); + + double maxEnergy_= ps.getUntrackedParameter("MaxEnergy", 200.0); tmax_ = ps.getUntrackedParameter("TimeCut", 100.0); eMIP_ = ps.getUntrackedParameter("MIPCut", 0.70); @@ -32,6 +33,20 @@ CaloSimHitStudy::CaloSimHitStudy(const edm::ParameterSet& ps) { tkLowLab[3] = "TrackerHitsTIBLowTof"; tkLowLab[4] = "TrackerHitsTIDLowTof"; tkLowLab[5] = "TrackerHitsTOBLowTof"; + + // register for data access + for ( unsigned i=0; i != 4; i++ ) + toks_calo_[i] = consumes(edm::InputTag(g4Label,hitLab[i])); + + for ( unsigned i=0; i != 3; i++ ) + toks_track_[i] = consumes(edm::InputTag(g4Label,muonLab[i])); + + for ( unsigned i=0; i != 6; i++ ) { + toks_tkHigh_[i] = consumes(edm::InputTag(g4Label,tkHighLab[i])); + toks_tkLow_[i] = consumes(edm::InputTag(g4Label,tkLowLab[i])); + } + + edm::LogInfo("HitStudy") << "Module Label: " << g4Label << " Hits: " << hitLab[0] << ", " << hitLab[1] << ", " << hitLab[2] << ", "<< hitLab[3] @@ -160,7 +175,7 @@ void CaloSimHitStudy::analyze(const edm::Event& e, const edm::EventSetup& ) { << e.id().event(); edm::Handle EvtHandle; - e.getByLabel(sourceLabel, EvtHandle); + e.getByToken(tok_evt_, EvtHandle); const HepMC::GenEvent* myGenEvent = EvtHandle->GetEvent(); double eInc=0, etaInc=0, phiInc=0; @@ -180,7 +195,7 @@ void CaloSimHitStudy::analyze(const edm::Event& e, const edm::EventSetup& ) { for (int i=0; i<4; i++) { bool getHits = false; edm::Handle hitsCalo; - e.getByLabel(g4Label,hitLab[i],hitsCalo); + e.getByToken(toks_calo_[i],hitsCalo); if (hitsCalo.isValid()) getHits = true; LogDebug("HitStudy") << "HcalValidation: Input flags Hits " << getHits; @@ -200,7 +215,7 @@ void CaloSimHitStudy::analyze(const edm::Event& e, const edm::EventSetup& ) { std::vector muonHits; edm::Handle hitsTrack; for (int i=0; i<3; i++) { - e.getByLabel(g4Label,muonLab[i],hitsTrack); + e.getByToken(toks_track_[i],hitsTrack); if (hitsTrack.isValid()) { muonHits.insert(muonHits.end(),hitsTrack->begin(),hitsTrack->end()); analyzeHits (hitsTrack, i+12); @@ -210,7 +225,7 @@ void CaloSimHitStudy::analyze(const edm::Event& e, const edm::EventSetup& ) { hitMu->Fill(double(nhmu)); std::vector tkHighHits; for (int i=0; i<6; i++) { - e.getByLabel(g4Label,tkHighLab[i],hitsTrack); + e.getByToken(toks_tkHigh_[i],hitsTrack); if (hitsTrack.isValid()) { tkHighHits.insert(tkHighHits.end(),hitsTrack->begin(),hitsTrack->end()); analyzeHits (hitsTrack, i); @@ -220,7 +235,7 @@ void CaloSimHitStudy::analyze(const edm::Event& e, const edm::EventSetup& ) { hitHigh->Fill(double(nhtkh)); std::vector tkLowHits; for (int i=0; i<6; i++) { - e.getByLabel(g4Label,tkLowLab[i],hitsTrack); + e.getByToken(toks_tkLow_[i],hitsTrack); if (hitsTrack.isValid()) { tkLowHits.insert(tkLowHits.end(),hitsTrack->begin(),hitsTrack->end()); analyzeHits (hitsTrack, i+6); diff --git a/SimG4CMS/Calo/test/CaloSimHitStudy.h b/SimG4CMS/Calo/test/CaloSimHitStudy.h index c20032c115a2b..4a16047f4e62a 100644 --- a/SimG4CMS/Calo/test/CaloSimHitStudy.h +++ b/SimG4CMS/Calo/test/CaloSimHitStudy.h @@ -21,6 +21,8 @@ #include "SimDataFormats/TrackingHit/interface/PSimHit.h" #include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h" +#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" + #include #include @@ -48,7 +50,12 @@ class CaloSimHitStudy: public edm::EDAnalyzer{ private: - std::string sourceLabel, g4Label, hitLab[4]; + std::string g4Label, hitLab[4]; + edm::EDGetTokenT tok_evt_; + edm::EDGetTokenT toks_calo_[4]; + edm::EDGetTokenT toks_track_[3]; + edm::EDGetTokenT toks_tkHigh_[6]; + edm::EDGetTokenT toks_tkLow_[6]; std::string muonLab[3], tkHighLab[6], tkLowLab[6]; double tmax_, eMIP_; diff --git a/SimG4CMS/Calo/test/HFPMTHitAnalyzer.cc b/SimG4CMS/Calo/test/HFPMTHitAnalyzer.cc index fd387fc53a36f..da6022699825f 100644 --- a/SimG4CMS/Calo/test/HFPMTHitAnalyzer.cc +++ b/SimG4CMS/Calo/test/HFPMTHitAnalyzer.cc @@ -9,12 +9,9 @@ //SimHits #include "SimDataFormats/CaloHit/interface/PCaloHit.h" -#include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h" #include "SimDataFormats/Track/interface/SimTrack.h" -#include "SimDataFormats/Track/interface/SimTrackContainer.h" //propagation -#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" //other stuff #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -30,9 +27,12 @@ HFPMTHitAnalyzer::HFPMTHitAnalyzer(const edm::ParameterSet& iConfig) { - sourceLabel = iConfig.getUntrackedParameter("SourceLabel","generator"); + tok_evt_ = consumes(edm::InputTag(iConfig.getUntrackedParameter("SourceLabel","generator"))); g4Label = iConfig.getUntrackedParameter("ModuleLabel","g4SimHits"); hcalHits = iConfig.getUntrackedParameter("HitCollection","HcalHits"); + + tok_calo_ = consumes(edm::InputTag(g4Label,hcalHits)); + tok_track_ = consumes(edm::InputTag(g4Label)); } @@ -136,13 +136,13 @@ void HFPMTHitAnalyzer::analyze(const edm::Event& iEvent, std::vector caloHits; edm::Handle hitsHcal; - iEvent.getByLabel(g4Label,hcalHits,hitsHcal); + iEvent.getByToken(tok_calo_,hitsHcal); std::vector simTracks; edm::Handle Tracks; - iEvent.getByLabel (g4Label, Tracks); + iEvent.getByToken (tok_track_, Tracks); edm::Handle EvtHandle; - iEvent.getByLabel(sourceLabel, EvtHandle); + iEvent.getByToken(tok_evt_, EvtHandle); const HepMC::GenEvent* myGenEvent = EvtHandle->GetEvent(); float orig_energy=0; diff --git a/SimG4CMS/Calo/test/HFPMTHitAnalyzer.h b/SimG4CMS/Calo/test/HFPMTHitAnalyzer.h index 51e9208b5eeb7..0a7cb845cc810 100644 --- a/SimG4CMS/Calo/test/HFPMTHitAnalyzer.h +++ b/SimG4CMS/Calo/test/HFPMTHitAnalyzer.h @@ -1,6 +1,10 @@ #ifndef SimG4CMS_Calo_HFPMTHitAnalyzer_H #define SimG4CMS_Calo_HFPMTHitAnalyzer_H +#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" +#include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h" +#include "SimDataFormats/Track/interface/SimTrackContainer.h" + #include #include #include @@ -23,7 +27,10 @@ class HFPMTHitAnalyzer : public edm::EDAnalyzer { void analyzeHits (std::vector &,const std::vector &); //user parameters - std::string sourceLabel, g4Label, hcalHits; + std::string g4Label, hcalHits; + edm::EDGetTokenT tok_evt_; + edm::EDGetTokenT tok_calo_; + edm::EDGetTokenT tok_track_; int event_no; diff --git a/SimG4CMS/Calo/test/HOSimHitStudy.cc b/SimG4CMS/Calo/test/HOSimHitStudy.cc index cbdaeb2bdf6a3..64530a880a0f9 100644 --- a/SimG4CMS/Calo/test/HOSimHitStudy.cc +++ b/SimG4CMS/Calo/test/HOSimHitStudy.cc @@ -3,7 +3,6 @@ #include "DataFormats/HcalDetId/interface/HcalDetId.h" #include "SimG4CMS/Calo/interface/CaloHitID.h" #include "SimG4CMS/Calo/interface/HcalTestNumberingScheme.h" -#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" #include "FWCore/Utilities/interface/Exception.h" #include "CLHEP/Units/GlobalPhysicalConstants.h" @@ -13,10 +12,14 @@ HOSimHitStudy::HOSimHitStudy(const edm::ParameterSet& ps) { - sourceLabel = ps.getUntrackedParameter("SourceLabel","generator"); + tok_evt_ = consumes(edm::InputTag(ps.getUntrackedParameter("SourceLabel","generator"))); g4Label = ps.getUntrackedParameter("ModuleLabel","g4SimHits"); hitLab[0] = ps.getUntrackedParameter("EBCollection","EcalHitsEB"); hitLab[1] = ps.getUntrackedParameter("HCCollection","HcalHits"); + + for ( unsigned i=0; i != 2; i++ ) + toks_calo_[i] = consumes(edm::InputTag(g4Label,hitLab[i])); + maxEnergy = ps.getUntrackedParameter("MaxEnergy", 200.0); scaleEB = ps.getUntrackedParameter("ScaleEB", 1.0); scaleHB = ps.getUntrackedParameter("ScaleHB", 100.0); @@ -277,7 +280,7 @@ void HOSimHitStudy::analyze(const edm::Event& e, const edm::EventSetup& ) { << e.id().event(); edm::Handle EvtHandle; - e.getByLabel(sourceLabel, EvtHandle); + e.getByToken(tok_evt_, EvtHandle); const HepMC::GenEvent* myGenEvent = EvtHandle->GetEvent(); eInc = etaInc = phiInc = 0; @@ -296,7 +299,7 @@ void HOSimHitStudy::analyze(const edm::Event& e, const edm::EventSetup& ) { if (i == 0) ecalHits.clear(); else hcalHits.clear(); edm::Handle hitsCalo; - e.getByLabel(g4Label,hitLab[i],hitsCalo); + e.getByToken(toks_calo_[i],hitsCalo); if (hitsCalo.isValid()) getHits = true; LogDebug("HitStudy") << "HcalValidation: Input flag " << hitLab[i] << " getHits flag " << getHits; diff --git a/SimG4CMS/Calo/test/HOSimHitStudy.h b/SimG4CMS/Calo/test/HOSimHitStudy.h index 0aef6db7eea2f..a96f1d60f9382 100644 --- a/SimG4CMS/Calo/test/HOSimHitStudy.h +++ b/SimG4CMS/Calo/test/HOSimHitStudy.h @@ -19,6 +19,8 @@ #include "SimDataFormats/CaloHit/interface/PCaloHit.h" #include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h" +#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" + #include #include #include @@ -47,7 +49,9 @@ class HOSimHitStudy: public edm::EDAnalyzer{ private: - std::string sourceLabel, g4Label, hitLab[2]; + std::string g4Label, hitLab[2]; + edm::EDGetTokenT tok_evt_; + edm::EDGetTokenT toks_calo_[2]; std::vector ecalHits, hcalHits; double maxEnergy, scaleEB, scaleHB, scaleHO; bool scheme_, print_; diff --git a/SimG4CMS/Calo/test/HitParentTest.cc b/SimG4CMS/Calo/test/HitParentTest.cc index e429ba6e8b18d..455bc746b5f12 100644 --- a/SimG4CMS/Calo/test/HitParentTest.cc +++ b/SimG4CMS/Calo/test/HitParentTest.cc @@ -1,7 +1,6 @@ #include "SimG4CMS/Calo/test/HitParentTest.h" #include "DataFormats/HcalDetId/interface/HcalDetId.h" #include "SimG4CMS/Calo/interface/CaloHitID.h" -#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/Utilities/interface/Exception.h" @@ -22,6 +21,13 @@ HitParentTest::HitParentTest(const edm::ParameterSet& ps) { << hitLabEB << ", " << hitLabEE << ", " << hitLabES << ", " << hitLabHC; + tok_eb_ = consumes(edm::InputTag(g4Label,hitLabEB)); + tok_ee_ = consumes(edm::InputTag(g4Label,hitLabEE)); + tok_es_ = consumes(edm::InputTag(g4Label,hitLabES)); + tok_hc_ = consumes(edm::InputTag(g4Label,hitLabHC)); + tok_tk_ = consumes(edm::InputTag(g4Label)); + tok_vtx_ = consumes(edm::InputTag(g4Label)); + for (unsigned int i=0; i<2; ++i) { total_num_apd_hits_seen[i] = 0; num_apd_hits_no_parent[i] = 0; @@ -71,25 +77,25 @@ void HitParentTest::analyze(const edm::Event& e, const edm::EventSetup& ) { // get PCaloHits for ecal barrel edm::Handle caloHitEB; - e.getByLabel(g4Label,hitLabEB,caloHitEB); + e.getByToken(tok_eb_,caloHitEB); // get PCaloHits for ecal endcap edm::Handle caloHitEE; - e.getByLabel(g4Label,hitLabEE,caloHitEE); + e.getByToken(tok_ee_,caloHitEE); // get PCaloHits for preshower edm::Handle caloHitES; - e.getByLabel(g4Label,hitLabES,caloHitES); + e.getByToken(tok_es_,caloHitES); // get PCaloHits for hcal edm::Handle caloHitHC; - e.getByLabel(g4Label,hitLabHC,caloHitHC); + e.getByToken(tok_hc_,caloHitHC); // get sim tracks - e.getByLabel(g4Label, SimTk); + e.getByToken(tok_tk_, SimTk); // get sim vertices - e.getByLabel(g4Label, SimVtx); + e.getByToken(tok_vtx_, SimVtx); LogDebug("HitParentTest") << "HitParentTest: hits valid[EB]: " << caloHitEB.isValid() << " valid[EE]: " << caloHitEE.isValid() << " valid[ES]: " << caloHitES.isValid() << " valid[HC]: " << caloHitHC.isValid(); diff --git a/SimG4CMS/Calo/test/HitParentTest.h b/SimG4CMS/Calo/test/HitParentTest.h index 777ca44e0419e..3410227f5bd96 100644 --- a/SimG4CMS/Calo/test/HitParentTest.h +++ b/SimG4CMS/Calo/test/HitParentTest.h @@ -22,6 +22,8 @@ #include "SimDataFormats/Track/interface/SimTrackContainer.h" #include "SimDataFormats/Vertex/interface/SimVertexContainer.h" +#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" + #include #include @@ -58,6 +60,12 @@ class HitParentTest: public edm::EDAnalyzer{ private: std::string sourceLabel, g4Label, hitLabEB, hitLabEE, hitLabES, hitLabHC; + edm::EDGetTokenT tok_eb_; + edm::EDGetTokenT tok_ee_; + edm::EDGetTokenT tok_es_; + edm::EDGetTokenT tok_hc_; + edm::EDGetTokenT tok_tk_; + edm::EDGetTokenT tok_vtx_; /** error and other counters */ unsigned int total_num_apd_hits_seen[2]; diff --git a/SimG4CMS/CherenkovAnalysis/test/CherenkovAnalysis.cpp b/SimG4CMS/CherenkovAnalysis/test/CherenkovAnalysis.cpp index 0328e32277546..743de3afa68c7 100644 --- a/SimG4CMS/CherenkovAnalysis/test/CherenkovAnalysis.cpp +++ b/SimG4CMS/CherenkovAnalysis/test/CherenkovAnalysis.cpp @@ -45,7 +45,7 @@ class CherenkovAnalysis : public edm::EDAnalyzer { private: - edm::InputTag caloHitSource_; + edm::EDGetTokenT tok_calo_; TH1F* hEnergy_; double maxEnergy_; int nBinsEnergy_; @@ -61,10 +61,10 @@ class CherenkovAnalysis : public edm::EDAnalyzer { //__________________________________________________________________________________________________ CherenkovAnalysis::CherenkovAnalysis(const edm::ParameterSet& iConfig) : - caloHitSource_( iConfig.getParameter("caloHitSource") ), maxEnergy_( iConfig.getParameter("maxEnergy")), nBinsEnergy_( iConfig.getParameter("nBinsEnergy")) { + tok_calo_ = consumes( iConfig.getParameter("caloHitSource") ); // Book histograms edm::Service tfile; @@ -86,7 +86,7 @@ void CherenkovAnalysis::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { edm::Handle pCaloHits; - iEvent.getByLabel( caloHitSource_, pCaloHits ); + iEvent.getByToken( tok_calo_, pCaloHits ); double totalEnergy = 0; diff --git a/SimG4CMS/CherenkovAnalysis/test/XtalDedxAnalysis.cpp b/SimG4CMS/CherenkovAnalysis/test/XtalDedxAnalysis.cpp index b36b128540412..badd31e7c4efd 100644 --- a/SimG4CMS/CherenkovAnalysis/test/XtalDedxAnalysis.cpp +++ b/SimG4CMS/CherenkovAnalysis/test/XtalDedxAnalysis.cpp @@ -52,6 +52,10 @@ class XtalDedxAnalysis : public edm::EDAnalyzer { edm::InputTag caloHitSource_; std::string simTkLabel_; + edm::EDGetTokenT tok_calo_; + edm::EDGetTokenT tok_tk_; + edm::EDGetTokenT tok_vtx_; + TH1F *meNHit_[4], *meE1T0_[4], *meE9T0_[4], *meE1T1_[4], *meE9T1_[4]; TH1I *mType_; @@ -67,6 +71,11 @@ XtalDedxAnalysis::XtalDedxAnalysis(const edm::ParameterSet& ps) { << simTkLabel_ << " Energy Max " << energyMax; + // register for data access + tok_calo_ = consumes(caloHitSource_); + tok_tk_ = consumes(edm::InputTag(simTkLabel_)); + tok_vtx_ = consumes(edm::InputTag(simTkLabel_)); + // Book histograms edm::Service tfile; @@ -117,15 +126,15 @@ void XtalDedxAnalysis::analyze(const edm::Event& e, const edm::EventSetup& ) { std::vector caloHits; edm::Handle pCaloHits; - e.getByLabel(caloHitSource_, pCaloHits); + e.getByToken(tok_calo_, pCaloHits); std::vector theSimTracks; edm::Handle simTk; - e.getByLabel(simTkLabel_,simTk); + e.getByToken(tok_tk_,simTk); std::vector theSimVertex; edm::Handle simVtx; - e.getByLabel(simTkLabel_,simVtx); + e.getByToken(tok_vtx_,simVtx); if (pCaloHits.isValid()) { caloHits.insert(caloHits.end(),pCaloHits->begin(),pCaloHits->end()); diff --git a/TBDataFormats/HcalTBObjects/test/HcalTBObjectDump.cc b/TBDataFormats/HcalTBObjects/test/HcalTBObjectDump.cc index d677d8f2eb3d9..6b4ee55f4a070 100644 --- a/TBDataFormats/HcalTBObjects/test/HcalTBObjectDump.cc +++ b/TBDataFormats/HcalTBObjects/test/HcalTBObjectDump.cc @@ -25,19 +25,19 @@ namespace cms { explicit HcalTBObjectDump(edm::ParameterSet const& conf); virtual void analyze(edm::Event const& e, edm::EventSetup const& c); private: - edm::InputTag hcalTBTriggerDataTag_; - edm::InputTag hcalTBRunDataTag_; - edm::InputTag hcalTBEventPositionTag_; - edm::InputTag hcalTBTimingTag_; + edm::EDGetTokenT tok_tb_; + edm::EDGetTokenT tok_run_; + edm::EDGetTokenT tok_pos_; + edm::EDGetTokenT tok_timing_; }; - HcalTBObjectDump::HcalTBObjectDump(edm::ParameterSet const& conf) : - hcalTBTriggerDataTag_(conf.getParameter("hcalTBTriggerDataTag")), - hcalTBRunDataTag_(conf.getParameter("hcalTBRunDataTag")), - hcalTBEventPositionTag_(conf.getParameter("hcalTBEventPositionTag")), - hcalTBTimingTag_(conf.getParameter("hcalTBTimingTag")) + HcalTBObjectDump::HcalTBObjectDump(edm::ParameterSet const& conf) { + tok_tb_ = consumes(conf.getParameter("hcalTBTriggerDataTag")); + tok_run_ = consumes(conf.getParameter("hcalTBRunDataTag")); + tok_pos_ = consumes(conf.getParameter("hcalTBEventPositionTag")); + tok_timing_ = consumes(conf.getParameter("hcalTBTimingTag")); } void HcalTBObjectDump::analyze(edm::Event const& e, edm::EventSetup const& c) { @@ -45,7 +45,7 @@ namespace cms { try { edm::Handle td; - e.getByLabel(hcalTBTriggerDataTag_, td); + e.getByToken(tok_tb_, td); const HcalTBTriggerData& info=*(td); cout << "TRIGGER DATA: "; @@ -57,7 +57,7 @@ namespace cms { try { edm::Handle td; - e.getByLabel(hcalTBRunDataTag_, td); + e.getByToken(tok_run_, td); const HcalTBRunData& info=*(td); cout << "RUN DATA: "; @@ -69,7 +69,7 @@ namespace cms { try { edm::Handle td; - e.getByLabel(hcalTBEventPositionTag_, td); + e.getByToken(tok_pos_, td); const HcalTBEventPosition& info=*td; cout << "Event position info: "; @@ -82,7 +82,7 @@ namespace cms { edm::Handletd; - e.getByLabel(hcalTBTimingTag_, td); + e.getByToken(tok_timing_, td); const HcalTBTiming& info=*(td); cout << "Timing: "; diff --git a/Validation/CaloTowers/interface/CaloTowersValidation.h b/Validation/CaloTowers/interface/CaloTowersValidation.h index 2dd550be5e6cb..6deb7e9ca3153 100644 --- a/Validation/CaloTowers/interface/CaloTowersValidation.h +++ b/Validation/CaloTowers/interface/CaloTowersValidation.h @@ -19,6 +19,9 @@ #include "DataFormats/CaloTowers/interface/CaloTowerDetId.h" #include "DataFormats/Math/interface/Vector3D.h" +#include "DataFormats/CaloTowers/interface/CaloTowerCollection.h" +#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" + #include #include #include @@ -49,7 +52,8 @@ class CaloTowersValidation : public edm::EDAnalyzer { typedef math::RhoEtaPhiVector Vector; - edm::InputTag theCaloTowerCollectionLabel; + edm::EDGetTokenT tok_calo_; + edm::EDGetTokenT tok_evt_; int isub; int nevent; diff --git a/Validation/CaloTowers/src/CaloTowersValidation.cc b/Validation/CaloTowers/src/CaloTowersValidation.cc index a9a98655a0a3e..c95dfd68b9752 100644 --- a/Validation/CaloTowers/src/CaloTowersValidation.cc +++ b/Validation/CaloTowers/src/CaloTowersValidation.cc @@ -1,13 +1,14 @@ #include "Validation/CaloTowers/interface/CaloTowersValidation.h" -#include "DataFormats/CaloTowers/interface/CaloTowerCollection.h" -#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" #include "DataFormats/HcalDetId/interface/HcalSubdetector.h" #include "DataFormats/EcalDetId/interface/EcalSubdetector.h" #include "DataFormats/HcalDetId/interface/HcalDetId.h" -CaloTowersValidation::CaloTowersValidation(edm::ParameterSet const& conf): - theCaloTowerCollectionLabel(conf.getUntrackedParameter("CaloTowerCollectionLabel")) +CaloTowersValidation::CaloTowersValidation(edm::ParameterSet const& conf) { + + tok_calo_ = consumes(conf.getUntrackedParameter("CaloTowerCollectionLabel")); + tok_evt_ = consumes(edm::InputTag("generator")); + // DQM ROOT output outputFile_ = conf.getUntrackedParameter("outputFile", "myfile.root"); @@ -488,7 +489,7 @@ void CaloTowersValidation::analyze(edm::Event const& event, edm::EventSetup cons if (imc != 0){ edm::Handle evtMC; // ev.getByLabel("VtxSmeared",evtMC); - event.getByLabel("generator",evtMC); // generator in late 310_preX + event.getByToken(tok_evt_,evtMC); // generator in late 310_preX if (!evtMC.isValid()) { std::cout << "no HepMCProduct found" << std::endl; } else { @@ -513,7 +514,7 @@ void CaloTowersValidation::analyze(edm::Event const& event, edm::EventSetup cons } edm::Handle towers; - event.getByLabel(theCaloTowerCollectionLabel,towers); + event.getByToken(tok_calo_,towers); CaloTowerCollection::const_iterator cal; double met; diff --git a/Validation/HcalDigis/interface/Digi2Raw2Digi.h b/Validation/HcalDigis/interface/Digi2Raw2Digi.h index 56e0897cfb6da..efcf1cb020431 100644 --- a/Validation/HcalDigis/interface/Digi2Raw2Digi.h +++ b/Validation/HcalDigis/interface/Digi2Raw2Digi.h @@ -9,6 +9,8 @@ #include "DQMServices/Core/interface/DQMStore.h" #include "DQMServices/Core/interface/MonitorElement.h" +#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" + #include class Digi2Raw2Digi : public edm::EDAnalyzer { @@ -16,7 +18,7 @@ class Digi2Raw2Digi : public edm::EDAnalyzer { explicit Digi2Raw2Digi(const edm::ParameterSet&); ~Digi2Raw2Digi(); virtual void analyze(const edm::Event&, const edm::EventSetup&); - template void compare(const edm::Event&, const edm::EventSetup&); virtual void beginJob() ; + template void compare(const edm::Event&, const edm::EventSetup&, const edm::EDGetTokenT >& tok1, const edm::EDGetTokenT >& tok2); virtual void beginJob() ; virtual void endJob() ; private: @@ -24,6 +26,15 @@ class Digi2Raw2Digi : public edm::EDAnalyzer { edm::InputTag inputTag1_; edm::InputTag inputTag2_; + edm::EDGetTokenT > tok_hbhe1_; + edm::EDGetTokenT > tok_hbhe2_; + edm::EDGetTokenT > tok_ho1_; + edm::EDGetTokenT > tok_ho2_; + edm::EDGetTokenT > tok_hf1_; + edm::EDGetTokenT > tok_hf2_; + edm::EDGetTokenT > tok_zdc1_; + edm::EDGetTokenT > tok_zdc2_; + std::string outputFile_; DQMStore* dbe_; diff --git a/Validation/HcalDigis/interface/HcalDigiTester.h b/Validation/HcalDigis/interface/HcalDigiTester.h index d92bdf0c3967f..71a99e986f340 100644 --- a/Validation/HcalDigis/interface/HcalDigiTester.h +++ b/Validation/HcalDigis/interface/HcalDigiTester.h @@ -13,6 +13,12 @@ #include #include "Validation/HcalDigis/src/HcalSubdetDigiMonitor.h" +#include "DataFormats/HcalDigi/interface/HBHEDataFrame.h" +#include "DataFormats/HcalDigi/interface/HFDataFrame.h" +#include "DataFormats/HcalDigi/interface/HODataFrame.h" +#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" +#include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h" + class HcalDigiTester : public edm::EDAnalyzer { public: @@ -20,7 +26,7 @@ class HcalDigiTester : public edm::EDAnalyzer { ~HcalDigiTester(); virtual void analyze(const edm::Event&, const edm::EventSetup&); virtual void beginJob() ; - template void reco(const edm::Event&, const edm::EventSetup&); + template void reco(const edm::Event&, const edm::EventSetup&, const edm::EDGetTokenT > &); virtual void endRun() ; virtual void endJob() ; @@ -35,6 +41,11 @@ class HcalDigiTester : public edm::EDAnalyzer { DQMStore* dbe_; edm::InputTag inputTag_; + edm::EDGetTokenT tok_mc_; + edm::EDGetTokenT > tok_hbhe_; + edm::EDGetTokenT > tok_ho_; + edm::EDGetTokenT > tok_hf_; + std::string outputFile_; std::string hcalselector_; std::string zside_; diff --git a/Validation/HcalDigis/interface/HcalDigisValidation.h b/Validation/HcalDigis/interface/HcalDigisValidation.h index b5387b68b4f0a..ad537af532ad8 100644 --- a/Validation/HcalDigis/interface/HcalDigisValidation.h +++ b/Validation/HcalDigis/interface/HcalDigisValidation.h @@ -96,7 +96,7 @@ class HcalDigisValidation : public edm::EDAnalyzer { std::string str(int x); - template void reco(const edm::Event& iEvent, const edm::EventSetup& iSetup); + template void reco(const edm::Event& iEvent, const edm::EventSetup& iSetup, const edm::EDGetTokenT > &tok); void eval_occupancy(); std::string outputFile_; @@ -108,6 +108,11 @@ class HcalDigisValidation : public edm::EDAnalyzer { std::string mc_; int noise_; + edm::EDGetTokenT tok_mc_; + edm::EDGetTokenT > tok_hbhe_; + edm::EDGetTokenT > tok_ho_; + edm::EDGetTokenT > tok_hf_; + edm::ESHandle geometry; edm::ESHandle conditions; int nevent1; diff --git a/Validation/HcalDigis/interface/ZDCDigiStudy.h b/Validation/HcalDigis/interface/ZDCDigiStudy.h index cdc9931b78e34..743bb2d6abf54 100644 --- a/Validation/HcalDigis/interface/ZDCDigiStudy.h +++ b/Validation/HcalDigis/interface/ZDCDigiStudy.h @@ -75,6 +75,8 @@ class ZDCDigiStudy: public edm::EDAnalyzer{ bool verbose_, checkHit_; DQMStore *dbe_; + edm::EDGetTokenT tok_zdc_; + ///////////////// diff --git a/Validation/HcalDigis/src/Digi2Raw2Digi.cc b/Validation/HcalDigis/src/Digi2Raw2Digi.cc index 57ecd5ede6650..d20fd3632f91a 100644 --- a/Validation/HcalDigis/src/Digi2Raw2Digi.cc +++ b/Validation/HcalDigis/src/Digi2Raw2Digi.cc @@ -4,17 +4,16 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "Validation/HcalDigis/interface/Digi2Raw2Digi.h" -#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" #include "DataFormats/HcalDetId/interface/HcalSubdetector.h" #include "DataFormats/HcalDetId/interface/HcalElectronicsId.h" #include "DataFormats/HcalDetId/interface/HcalGenericDetId.h" #include "DataFormats/HcalDetId/interface/HcalZDCDetId.h" #include "DataFormats/HcalDetId/interface/HcalDetId.h" -#include "DataFormats/HcalDigi/interface/HcalQIESample.h" #include "DQMServices/Core/interface/DQMStore.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "DataFormats/HcalDigi/interface/HcalQIESample.h" #include "DataFormats/HcalDigi/interface/HBHEDataFrame.h" #include "DataFormats/HcalDigi/interface/HFDataFrame.h" #include "DataFormats/HcalDigi/interface/HODataFrame.h" @@ -37,7 +36,7 @@ template -void Digi2Raw2Digi::compare(const edm::Event& iEvent, const edm::EventSetup& iSetup) { +void Digi2Raw2Digi::compare(const edm::Event& iEvent, const edm::EventSetup& iSetup, const edm::EDGetTokenT > &tok1, const edm::EDGetTokenT > &tok2) { typename edm::Handle > digiCollection1; typename edm::SortedCollection::const_iterator digiItr1; @@ -45,11 +44,11 @@ void Digi2Raw2Digi::compare(const edm::Event& iEvent, const edm::EventSetup& iSe typename edm::SortedCollection::const_iterator digiItr2; if(unsuppressed) { // ZDC - iEvent.getByLabel ("simHcalUnsuppressedDigis", digiCollection1); + iEvent.getByToken (tok1, digiCollection1); } - else iEvent.getByLabel (inputTag1_, digiCollection1); + else iEvent.getByToken (tok1, digiCollection1); - iEvent.getByLabel (inputTag2_, digiCollection2); + iEvent.getByToken (tok2, digiCollection2); int size1 = 0; int size2 = 0; @@ -222,7 +221,18 @@ Digi2Raw2Digi::Digi2Raw2Digi(const edm::ParameterSet& iConfig) inputTag2_(iConfig.getParameter("digiLabel2")), outputFile_(iConfig.getUntrackedParameter("outputFile")), dbe_(0) -{ +{ + + // register for data access + tok_hbhe1_ = consumes >(inputTag1_); + tok_hbhe2_ = consumes >(inputTag2_); + tok_ho1_ = consumes >(inputTag1_); + tok_ho2_ = consumes >(inputTag2_); + tok_hf1_ = consumes >(inputTag1_); + tok_hf2_ = consumes >(inputTag2_); + tok_zdc1_ = consumes >(edm::InputTag("simHcalUnsuppressedDigis")); + tok_zdc2_ = consumes >(inputTag2_); + // DQM ROOT output if ( outputFile_.size() != 0 ) { @@ -263,18 +273,18 @@ void Digi2Raw2Digi::analyze(const edm::Event& iEvent, const edm::EventSetup& iSe unsuppressed = 0; // std::cout << "=== HBHE ==================" << std::endl; - compare(iEvent,iSetup); + compare(iEvent,iSetup,tok_hbhe1_,tok_hbhe2_); // std::cout << "=== HO ====================" << std::endl; - compare(iEvent,iSetup); + compare(iEvent,iSetup,tok_ho1_,tok_ho2_); // std::cout << "=== HF ====================" << std::endl; - compare(iEvent,iSetup); + compare(iEvent,iSetup,tok_hf1_,tok_hf2_); // std::cout << "=== ZDC ===================" << std::endl; unsuppressed = 1; - compare(iEvent,iSetup); + compare(iEvent,iSetup,tok_zdc1_,tok_zdc2_); // std::cout << "=== CASTOR ================" << std::endl; diff --git a/Validation/HcalDigis/src/HcalDigiTester.cc b/Validation/HcalDigis/src/HcalDigiTester.cc index 00f69d3399f74..a80e6da134a3f 100644 --- a/Validation/HcalDigis/src/HcalDigiTester.cc +++ b/Validation/HcalDigis/src/HcalDigiTester.cc @@ -3,7 +3,6 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "Validation/HcalDigis/interface/HcalDigiTester.h" -#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" #include "DataFormats/HcalDetId/interface/HcalSubdetector.h" #include "DataFormats/HcalDetId/interface/HcalElectronicsId.h" #include "DataFormats/HcalDetId/interface/HcalDetId.h" @@ -13,7 +12,6 @@ #include "Geometry/Records/interface/CaloGeometryRecord.h" #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h" -#include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h" #include "CalibFormats/HcalObjects/interface/HcalDbRecord.h" #include "CalibFormats/HcalObjects/interface/HcalCoderDb.h" @@ -21,9 +19,6 @@ #include "DQMServices/Core/interface/DQMStore.h" -#include "DataFormats/HcalDigi/interface/HBHEDataFrame.h" -#include "DataFormats/HcalDigi/interface/HFDataFrame.h" -#include "DataFormats/HcalDigi/interface/HODataFrame.h" #include #include #include @@ -36,9 +31,9 @@ #include "CondFormats/HcalObjects/interface/HcalPedestal.h" #include "CondFormats/HcalObjects/interface/HcalPedestalWidth.h" -template +template -void HcalDigiTester::reco(const edm::Event& iEvent, const edm::EventSetup& iSetup) { +void HcalDigiTester::reco(const edm::Event& iEvent, const edm::EventSetup& iSetup, const edm::EDGetTokenT > &tok) { typename edm::Handle > digiCollection; @@ -49,7 +44,7 @@ void HcalDigiTester::reco(const edm::Event& iEvent, const edm::EventSetup& iSetu CaloSamples tool; - iEvent.getByLabel (inputTag_, digiCollection); + iEvent.getByToken (tok, digiCollection); int subdet = 0; if (hcalselector_ == "HB" ) subdet = 1; @@ -88,7 +83,7 @@ void HcalDigiTester::reco(const edm::Event& iEvent, const edm::EventSetup& iSetu // SimHits MC only if( mc_ == "yes") { edm::Handle hcalHits ; - iEvent.getByLabel("g4SimHits","HcalHits",hcalHits); + iEvent.getByToken(tok_mc_,hcalHits); const edm::PCaloHitContainer * simhitResult = hcalHits.product () ; @@ -476,7 +471,7 @@ void HcalDigiTester::reco(const edm::Event& iEvent, const edm::EventSetup& iSetu if(mc_ == "yes") { edm::Handle hcalHits ; - iEvent.getByLabel("g4SimHits","HcalHits",hcalHits); + iEvent.getByToken(tok_mc_,hcalHits); const edm::PCaloHitContainer * simhitResult = hcalHits.product () ; for (std::vector::const_iterator simhits = simhitResult->begin (); simhits != simhitResult->end () ; ++simhits) { @@ -535,6 +530,13 @@ HcalDigiTester::HcalDigiTester(const edm::ParameterSet& iConfig) mc_(iConfig.getUntrackedParameter("mc", "no")), monitors_() { + + // register for data access + tok_mc_ = consumes(edm::InputTag("g4SimHits","HcalHits")); + tok_hbhe_ = consumes >(edm::InputTag(inputTag_)); + tok_ho_ = consumes >(edm::InputTag(inputTag_)); + tok_hf_ = consumes >(edm::InputTag(inputTag_)); + if ( outputFile_.size() != 0 ) { edm::LogInfo("OutputInfo") << " Hcal Digi Task histograms will be saved to '" << outputFile_.c_str() << "'"; } else { @@ -687,10 +689,10 @@ HcalDigiTester::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) - if (hcalselector_ == "HB" ) reco(iEvent,iSetup); - if (hcalselector_ == "HE" ) reco(iEvent,iSetup); - if (hcalselector_ == "HO" ) reco(iEvent,iSetup); - if (hcalselector_ == "HF" ) reco(iEvent,iSetup); + if (hcalselector_ == "HB" ) reco(iEvent,iSetup,tok_hbhe_); + if (hcalselector_ == "HE" ) reco(iEvent,iSetup,tok_hbhe_); + if (hcalselector_ == "HO" ) reco(iEvent,iSetup,tok_ho_); + if (hcalselector_ == "HF" ) reco(iEvent,iSetup,tok_hf_); if (hcalselector_ == "noise") { noise_ = 1; @@ -700,13 +702,13 @@ HcalDigiTester::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) hcalselector_ = "HB"; - reco(iEvent,iSetup); + reco(iEvent,iSetup,tok_hbhe_); hcalselector_ = "HE"; - reco(iEvent,iSetup); + reco(iEvent,iSetup,tok_hbhe_); hcalselector_ = "HO"; - reco(iEvent,iSetup); + reco(iEvent,iSetup,tok_ho_); hcalselector_ = "HF"; - reco(iEvent,iSetup); + reco(iEvent,iSetup,tok_hf_); hcalselector_ = "noise"; } } @@ -715,13 +717,13 @@ HcalDigiTester::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) noise_ = 0; hcalselector_ = "HB"; - reco(iEvent,iSetup); + reco(iEvent,iSetup,tok_hbhe_); hcalselector_ = "HE"; - reco(iEvent,iSetup); + reco(iEvent,iSetup,tok_hbhe_); hcalselector_ = "HO"; - reco(iEvent,iSetup); + reco(iEvent,iSetup,tok_ho_); hcalselector_ = "HF"; - reco(iEvent,iSetup); + reco(iEvent,iSetup,tok_hf_); hcalselector_ = "all"; } diff --git a/Validation/HcalDigis/src/HcalDigisValidation.cc b/Validation/HcalDigis/src/HcalDigisValidation.cc index 2cb3717c5518e..ee840b2b64903 100644 --- a/Validation/HcalDigis/src/HcalDigisValidation.cc +++ b/Validation/HcalDigis/src/HcalDigisValidation.cc @@ -30,6 +30,12 @@ HcalDigisValidation::HcalDigisValidation(const edm::ParameterSet& iConfig) { mode_ = iConfig.getUntrackedParameter ("mode", "multi"); dirName_ = iConfig.getUntrackedParameter ("dirName", "HcalDigisV/HcalDigiTask"); + // register for data access + tok_mc_ = consumes(edm::InputTag("g4SimHits", "HcalHits")); + tok_hbhe_ = consumes >(inputTag_); + tok_ho_ = consumes >(inputTag_); + tok_hf_ = consumes >(inputTag_); + dbe_ = edm::Service ().operator->(); msm_ = new std::map(); @@ -426,23 +432,23 @@ void HcalDigisValidation::analyze(const edm::Event& iEvent, const edm::EventSetu if (subdet_ != "all") { noise_ = 0; - if (subdet_ == "HB") reco (iEvent, iSetup); - if (subdet_ == "HE") reco (iEvent, iSetup); - if (subdet_ == "HO") reco (iEvent, iSetup); - if (subdet_ == "HF") reco (iEvent, iSetup); + if (subdet_ == "HB") reco (iEvent, iSetup, tok_hbhe_); + if (subdet_ == "HE") reco (iEvent, iSetup, tok_hbhe_); + if (subdet_ == "HO") reco (iEvent, iSetup, tok_ho_); + if (subdet_ == "HF") reco (iEvent, iSetup, tok_hf_); if (subdet_ == "noise") { noise_ = 1; // std::cout << " >>>>> HcalDigiTester::analyze entering noise " // << std::endl; subdet_ = "HB"; - reco (iEvent, iSetup); + reco (iEvent, iSetup, tok_hbhe_); subdet_ = "HE"; - reco (iEvent, iSetup); + reco (iEvent, iSetup, tok_hbhe_); subdet_ = "HO"; - reco (iEvent, iSetup); + reco (iEvent, iSetup, tok_ho_); subdet_ = "HF"; - reco (iEvent, iSetup); + reco (iEvent, iSetup, tok_hf_); subdet_ = "noise"; } }// all subdetectors @@ -450,13 +456,13 @@ void HcalDigisValidation::analyze(const edm::Event& iEvent, const edm::EventSetu noise_ = 0; subdet_ = "HB"; - reco (iEvent, iSetup); + reco (iEvent, iSetup, tok_hbhe_); subdet_ = "HE"; - reco (iEvent, iSetup); + reco (iEvent, iSetup, tok_hbhe_); subdet_ = "HO"; - reco (iEvent, iSetup); + reco (iEvent, iSetup, tok_ho_); subdet_ = "HF"; - reco (iEvent, iSetup); + reco (iEvent, iSetup, tok_hf_); subdet_ = "all"; } @@ -464,7 +470,7 @@ void HcalDigisValidation::analyze(const edm::Event& iEvent, const edm::EventSetu nevtot++; } -template void HcalDigisValidation::reco(const edm::Event& iEvent, const edm::EventSetup& iSetup) { +template void HcalDigisValidation::reco(const edm::Event& iEvent, const edm::EventSetup& iSetup, const edm::EDGetTokenT > & tok) { // HistLim ============================================================= @@ -479,7 +485,7 @@ template void HcalDigisValidation::reco(const edm::Event& iEvent, co // ADC2fC HcalCalibrations calibrations; CaloSamples tool; - iEvent.getByLabel(inputTag_, digiCollection); + iEvent.getByToken(tok, digiCollection); // std::cout << "***************RECO*****************" << std::endl; int isubdet = 0; if (subdet_ == "HB") isubdet = 1; @@ -514,7 +520,7 @@ template void HcalDigisValidation::reco(const edm::Event& iEvent, co // SimHits MC only if (mc_ == "yes") { edm::Handle hcalHits; - iEvent.getByLabel("g4SimHits", "HcalHits", hcalHits); + iEvent.getByToken(tok_mc_, hcalHits); const edm::PCaloHitContainer * simhitResult = hcalHits.product(); if (isubdet != 0 && noise_ == 0) { // signal only SimHits @@ -771,7 +777,7 @@ template void HcalDigisValidation::reco(const edm::Event& iEvent, co if (mc_ == "yes") { edm::Handle hcalHits; - iEvent.getByLabel("g4SimHits", "HcalHits", hcalHits); + iEvent.getByToken(tok_mc_, hcalHits); const edm::PCaloHitContainer * simhitResult = hcalHits.product(); for (std::vector::const_iterator simhits = simhitResult->begin(); simhits != simhitResult->end(); ++simhits) { diff --git a/Validation/HcalDigis/src/ZDCDigiStudy.cc b/Validation/HcalDigis/src/ZDCDigiStudy.cc index 0d189fa1e8d3f..16fdfd11a23a4 100644 --- a/Validation/HcalDigis/src/ZDCDigiStudy.cc +++ b/Validation/HcalDigis/src/ZDCDigiStudy.cc @@ -34,6 +34,8 @@ ZDCDigiStudy::ZDCDigiStudy(const edm::ParameterSet& ps) { verbose_ = ps.getUntrackedParameter("Verbose", false); checkHit_= true; + tok_zdc_ = consumes(edm::InputTag("simHcalUnsuppressedDigis")); + edm::LogInfo("ZDCDigiStudy") //std::cout << " Hits: " @@ -218,7 +220,7 @@ void ZDCDigiStudy::analyze(const edm::Event& iEvent, const edm::EventSetup& iSet Handle zdchandle; - if (!(iEvent.getByLabel("simHcalUnsuppressedDigis",zdchandle))) + if (!(iEvent.getByToken(tok_zdc_,zdchandle))) { gotZDCDigis=false; //this is a boolean set up to check if there are ZDCDigis in the input root file } diff --git a/Validation/HcalHits/interface/HcalSimHitStudy.h b/Validation/HcalHits/interface/HcalSimHitStudy.h index 2a8317570d277..b030367756e76 100644 --- a/Validation/HcalHits/interface/HcalSimHitStudy.h +++ b/Validation/HcalHits/interface/HcalSimHitStudy.h @@ -45,6 +45,8 @@ class HcalSimHitStudy: public edm::EDAnalyzer{ bool verbose_, checkHit_; DQMStore *dbe_; + edm::EDGetTokenT tok_hits_; + MonitorElement *meAllNHit_, *meBadDetHit_, *meBadSubHit_, *meBadIdHit_; MonitorElement *meHBNHit_, *meHENHit_, *meHONHit_, *meHFNHit_; MonitorElement *meDetectHit_, *meSubdetHit_, *meDepthHit_, *meEtaHit_; diff --git a/Validation/HcalHits/interface/HcalSimHitsValidation.h b/Validation/HcalHits/interface/HcalSimHitsValidation.h index 38c40433bf11d..13991c67f655d 100644 --- a/Validation/HcalHits/interface/HcalSimHitsValidation.h +++ b/Validation/HcalHits/interface/HcalSimHitsValidation.h @@ -58,6 +58,11 @@ class HcalSimHitsValidation : public edm::EDAnalyzer { std::string outputFile_; + edm::EDGetTokenT tok_evt_; + edm::EDGetTokenT tok_hcal_; + edm::EDGetTokenT tok_ecal_; + + // Hits counters MonitorElement* Nhb; MonitorElement* Nhe; diff --git a/Validation/HcalHits/interface/SimHitsValidationHcal.h b/Validation/HcalHits/interface/SimHitsValidationHcal.h index abf9fd52f922d..44f75c358020b 100644 --- a/Validation/HcalHits/interface/SimHitsValidationHcal.h +++ b/Validation/HcalHits/interface/SimHitsValidationHcal.h @@ -43,6 +43,7 @@ class SimHitsValidationHcal: public edm::EDAnalyzer{ private: std::string g4Label, hcalHits; + edm::EDGetTokenT tok_hits_; bool verbose_; DQMStore *dbe_; diff --git a/Validation/HcalHits/interface/ZdcSimHitStudy.h b/Validation/HcalHits/interface/ZdcSimHitStudy.h index 65573ecee84c8..ecae521313960 100644 --- a/Validation/HcalHits/interface/ZdcSimHitStudy.h +++ b/Validation/HcalHits/interface/ZdcSimHitStudy.h @@ -80,6 +80,8 @@ class ZdcSimHitStudy: public edm::EDAnalyzer{ std::string g4Label, zdcHits, outFile_; + edm::EDGetTokenT tok_gen_; + edm::EDGetTokenT tok_hits_; bool verbose_, checkHit_; DQMStore *dbe_; diff --git a/Validation/HcalHits/src/HcalSimHitStudy.cc b/Validation/HcalHits/src/HcalSimHitStudy.cc index fc8b3236339bb..3dc39938464da 100644 --- a/Validation/HcalHits/src/HcalSimHitStudy.cc +++ b/Validation/HcalHits/src/HcalSimHitStudy.cc @@ -11,6 +11,8 @@ HcalSimHitStudy::HcalSimHitStudy(const edm::ParameterSet& ps) { verbose_ = ps.getUntrackedParameter("Verbose", false); checkHit_= true; + tok_hits_ = consumes(edm::InputTag(g4Label,hcalHits)); + edm::LogInfo("HcalSim") << "Module Label: " << g4Label << " Hits: " << hcalHits << " / "<< checkHit_ << " Output: " << outFile_; @@ -102,7 +104,7 @@ void HcalSimHitStudy::analyze(const edm::Event& e, const edm::EventSetup& ) { bool getHits = false; if (checkHit_) { - e.getByLabel(g4Label,hcalHits,hitsHcal); + e.getByToken(tok_hits_,hitsHcal); if (hitsHcal.isValid()) getHits = true; } diff --git a/Validation/HcalHits/src/HcalSimHitsValidation.cc b/Validation/HcalHits/src/HcalSimHitsValidation.cc index 53427a52c620e..7b9c8aa8ef7a7 100644 --- a/Validation/HcalHits/src/HcalSimHitsValidation.cc +++ b/Validation/HcalHits/src/HcalSimHitsValidation.cc @@ -5,6 +5,11 @@ HcalSimHitsValidation::HcalSimHitsValidation(edm::ParameterSet const& conf) { // DQM ROOT output outputFile_ = conf.getUntrackedParameter("outputFile", "myfile.root"); + + // register for data access + tok_evt_ = consumes(edm::InputTag("generator")); + tok_hcal_ = consumes(edm::InputTag("g4SimHits","HcalHits")); + tok_ecal_ = consumes(edm::InputTag("g4SimHits","EcalHitsEE")); if ( outputFile_.size() != 0 ) { edm::LogInfo("OutputInfo") << " Hcal SimHit Task histograms will be saved to '" << outputFile_.c_str() << "'"; } else { @@ -168,7 +173,7 @@ void HcalSimHitsValidation::analyze(edm::Event const& ev, edm::EventSetup const& edm::Handle evtMC; // ev.getByLabel("VtxSmeared",evtMC); - ev.getByLabel("generator",evtMC); // generator in late 310_preX + ev.getByToken(tok_evt_,evtMC); // generator in late 310_preX if (!evtMC.isValid()) { std::cout << "no HepMCProduct found" << std::endl; } @@ -198,7 +203,7 @@ void HcalSimHitsValidation::analyze(edm::Event const& ev, edm::EventSetup const& const float calib_HF2 = 1.0/0.368; edm::Handle hcalHits; - ev.getByLabel("g4SimHits","HcalHits",hcalHits); + ev.getByToken(tok_hcal_,hcalHits); const PCaloHitContainer * SimHitResult = hcalHits.product () ; float eta_diff; @@ -289,7 +294,7 @@ void HcalSimHitsValidation::analyze(edm::Event const& ev, edm::EventSetup const& //Ecal EB SimHits edm::Handle ecalEBHits; - ev.getByLabel("g4SimHits","EcalHitsEB",ecalEBHits); + ev.getByToken(tok_ecal_,ecalEBHits); const PCaloHitContainer * SimHitResultEB = ecalEBHits.product () ; double EcalCone = 0; @@ -310,7 +315,7 @@ void HcalSimHitsValidation::analyze(edm::Event const& ev, edm::EventSetup const& //Ecal EE SimHits edm::Handle ecalEEHits; - ev.getByLabel("g4SimHits","EcalHitsEE",ecalEEHits); + ev.getByToken(tok_ecal_,ecalEEHits); const PCaloHitContainer * SimHitResultEE = ecalEEHits.product () ; for (std::vector::const_iterator SimHits = SimHitResultEE->begin () ; SimHits != SimHitResultEE->end(); ++SimHits) { diff --git a/Validation/HcalHits/src/SimHitsValidationHcal.cc b/Validation/HcalHits/src/SimHitsValidationHcal.cc index 63d3ece07d1aa..6685818277898 100644 --- a/Validation/HcalHits/src/SimHitsValidationHcal.cc +++ b/Validation/HcalHits/src/SimHitsValidationHcal.cc @@ -7,6 +7,8 @@ SimHitsValidationHcal::SimHitsValidationHcal(const edm::ParameterSet& ps) { hcalHits = ps.getUntrackedParameter("HitCollection","HcalHits"); verbose_ = ps.getUntrackedParameter("Verbose", false); + tok_hits_ = consumes(edm::InputTag(g4Label,hcalHits)); + edm::LogInfo("HitsValidationHcal") << "Module Label: " << g4Label << " Hits: " << hcalHits; @@ -117,7 +119,7 @@ void SimHitsValidationHcal::analyze(const edm::Event& e, const edm::EventSetup& edm::Handle hitsHcal; bool getHits = false; - e.getByLabel(g4Label,hcalHits,hitsHcal); + e.getByToken(tok_hits_,hitsHcal); if (hitsHcal.isValid()) getHits = true; LogDebug("SimHitsValidationHcal") << "SimHitsValidationHcal.: Input flags Hits " << getHits; diff --git a/Validation/HcalHits/src/ZdcSimHitStudy.cc b/Validation/HcalHits/src/ZdcSimHitStudy.cc index 1a060c7fcc732..8d2a71b1bdb3c 100644 --- a/Validation/HcalHits/src/ZdcSimHitStudy.cc +++ b/Validation/HcalHits/src/ZdcSimHitStudy.cc @@ -35,6 +35,9 @@ ZdcSimHitStudy::ZdcSimHitStudy(const edm::ParameterSet& ps) { verbose_ = ps.getUntrackedParameter("Verbose", false); checkHit_= true; + tok_gen_ = consumes(edm::InputTag("genParticles")); + tok_hits_ = consumes(edm::InputTag(g4Label,zdcHits)); + edm::LogInfo("ZdcSimHitStudy") //std::cout << "Module Label: " << g4Label << " Hits: " @@ -476,8 +479,8 @@ void ZdcSimHitStudy::analyze(const edm::Event& iEvent, const edm::EventSetup& iS Handle genhandle; - - if (!(iEvent.getByLabel("genParticles",genhandle))) + + if (!(iEvent.getByToken(tok_gen_,genhandle))) { gotGenParticles=false; //this is the same kind of boolean except for the genparticles collection } @@ -579,7 +582,7 @@ void ZdcSimHitStudy::analyze(const edm::Event& iEvent, const edm::EventSetup& iS bool getHits = false; if (checkHit_) { - iEvent.getByLabel(g4Label,zdcHits,hitsZdc); + iEvent.getByToken(tok_hits_,hitsZdc); // e.getByLabel(g4Label,zdcHits,hitsZdc); if (hitsZdc.isValid()) getHits = true; } diff --git a/Validation/HcalHits/test/HcalHitValidation.cc b/Validation/HcalHits/test/HcalHitValidation.cc index ee2dbe4c6c18c..c0bf8a9906f09 100644 --- a/Validation/HcalHits/test/HcalHitValidation.cc +++ b/Validation/HcalHits/test/HcalHitValidation.cc @@ -18,6 +18,12 @@ HcalHitValidation::HcalHitValidation(const edm::ParameterSet& ps) { checkNxN_= ps.getUntrackedParameter("CheckNxN", true); checkJet_= ps.getUntrackedParameter("CheckJets", true); + // register for data access + tok_hh_ = consumes(edm::InputTag(g4Label,hcalHits)); + tok_iL_ = consumes(edm::InputTag(g4Label,layerInfo)); + tok_iN_ = consumes(edm::InputTag(g4Label,nxNInfo)); + tok_iJ_ = consumes(edm::InputTag(g4Label,jetsInfo)); + edm::LogInfo("HcalHitValid") << "Module Label: " << g4Label << " Hits: " << hcalHits << " / "<< checkHit_ << " LayerInfo: " << layerInfo << " / " @@ -184,25 +190,25 @@ void HcalHitValidation::analyze(const edm::Event& e, const edm::EventSetup& ) { bool getHits = false; if (checkHit_) { - e.getByLabel(g4Label,hcalHits,hitsHcal); + e.getByToken(tok_hh_,hitsHcal); if (hitsHcal.isValid()) getHits = true; } bool getLayer = false; if (checkLay_) { - e.getByLabel(g4Label,layerInfo,infoLayer); + e.getByToken(tok_iL_,infoLayer); if (infoLayer.isValid()) getLayer = true; } bool getNxN = false; if (checkNxN_) { - e.getByLabel(g4Label,nxNInfo,infoNxN); + e.getByToken(tok_iN_,infoNxN); if (infoNxN.isValid()) getNxN = true; } bool getJets = false; if (checkJet_) { - e.getByLabel(g4Label,jetsInfo,infoJets); + e.getByToken(tok_iJ_,infoJets); if (infoJets.isValid()) getJets = true; } diff --git a/Validation/HcalHits/test/HcalHitValidation.h b/Validation/HcalHits/test/HcalHitValidation.h index c5baf8f7ae52f..33cbc7cfddd5d 100644 --- a/Validation/HcalHits/test/HcalHitValidation.h +++ b/Validation/HcalHits/test/HcalHitValidation.h @@ -46,6 +46,10 @@ class HcalHitValidation: public edm::EDAnalyzer{ private: std::string g4Label, hcalHits, layerInfo, nxNInfo, jetsInfo; + edm::EDGetTokenT tok_hh_; + edm::EDGetTokenT tok_iL_; + edm::EDGetTokenT tok_iN_; + edm::EDGetTokenT tok_iJ_; std::string outFile_; bool verbose_, scheme_; bool checkHit_, checkLay_, checkNxN_, checkJet_; diff --git a/Validation/HcalRecHits/interface/HcalRecHitsValidation.h b/Validation/HcalRecHits/interface/HcalRecHitsValidation.h index e6d510061926b..76f3cfbd6c3d8 100644 --- a/Validation/HcalRecHits/interface/HcalRecHitsValidation.h +++ b/Validation/HcalRecHits/interface/HcalRecHitsValidation.h @@ -81,9 +81,13 @@ class HcalRecHitsValidation : public edm::EDAnalyzer { bool useAllHistos_; //RecHit Collection input tags - edm::InputTag theHBHERecHitCollectionLabel; - edm::InputTag theHFRecHitCollectionLabel; - edm::InputTag theHORecHitCollectionLabel; + edm::EDGetTokenT tok_evt_; + edm::EDGetTokenT tok_EB_; + edm::EDGetTokenT tok_EE_; + edm::EDGetTokenT tok_hh_; + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_hf_; + edm::EDGetTokenT tok_ho_; // choice of subdetector in config : noise/HB/HE/HO/HF/ALL (0/1/2/3/4/5) int subdet_; diff --git a/Validation/HcalRecHits/interface/NoiseRates.h b/Validation/HcalRecHits/interface/NoiseRates.h index ed8e9ec3cd5c1..ac210f4475705 100644 --- a/Validation/HcalRecHits/interface/NoiseRates.h +++ b/Validation/HcalRecHits/interface/NoiseRates.h @@ -31,6 +31,7 @@ #include "FWCore/ServiceRegistry/interface/Service.h" +#include "DataFormats/METReco/interface/HcalNoiseRBX.h" // // class declaration @@ -52,6 +53,7 @@ class NoiseRates : public edm::EDAnalyzer { // parameters edm::InputTag rbxCollName_; // label for the rbx collection + edm::EDGetTokenT tok_rbx_; double minRBXEnergy_; // RBX energy threshold double minHitEnergy_; // RecHit energy threshold bool useAllHistos_; diff --git a/Validation/HcalRecHits/src/HcalRecHitsValidation.cc b/Validation/HcalRecHits/src/HcalRecHitsValidation.cc index 439f9ee99591f..2a39588acc393 100644 --- a/Validation/HcalRecHits/src/HcalRecHitsValidation.cc +++ b/Validation/HcalRecHits/src/HcalRecHitsValidation.cc @@ -29,9 +29,15 @@ HcalRecHitsValidation::HcalRecHitsValidation(edm::ParameterSet const& conf) { useAllHistos_ = conf.getUntrackedParameter("useAllHistos", false); //Collections - theHBHERecHitCollectionLabel = conf.getUntrackedParameter("HBHERecHitCollectionLabel"); - theHFRecHitCollectionLabel = conf.getUntrackedParameter("HFRecHitCollectionLabel"); - theHORecHitCollectionLabel = conf.getUntrackedParameter("HORecHitCollectionLabel"); + tok_hbhe_ = consumes(conf.getUntrackedParameter("HBHERecHitCollectionLabel")); + tok_hf_ = consumes(conf.getUntrackedParameter("HFRecHitCollectionLabel")); + tok_ho_ = consumes(conf.getUntrackedParameter("HORecHitCollectionLabel")); + + // register for data access + tok_evt_ = consumes(edm::InputTag("generator")); + tok_EB_ = consumes(edm::InputTag("ecalRecHit","EcalRecHitsEB")); + tok_EE_ = consumes(edm::InputTag("ecalRecHit","EcalRecHitsEE")); + tok_hh_ = consumes(edm::InputTag("g4SimHits","HcalHits")); // std::cout << "*** famos_ = " << famos_ << std::endl; @@ -755,7 +761,7 @@ void HcalRecHitsValidation::analyze(edm::Event const& ev, edm::EventSetup const& edm::Handle evtMC; // ev.getByLabel("VtxSmeared",evtMC); - ev.getByLabel("generator",evtMC); // generator in late 310_preX + ev.getByToken(tok_evt_,evtMC); // generator in late 310_preX if (!evtMC.isValid()) { std::cout << "no HepMCProduct found" << std::endl; } else { @@ -832,7 +838,7 @@ void HcalRecHitsValidation::analyze(edm::Event const& ev, edm::EventSetup const& Handle rhitEB; - ev.getByLabel("ecalRecHit","EcalRecHitsEB", rhitEB); + ev.getByToken(tok_EB_, rhitEB); EcalRecHitCollection::const_iterator RecHit = rhitEB.product()->begin(); EcalRecHitCollection::const_iterator RecHitEnd = rhitEB.product()->end(); @@ -860,7 +866,7 @@ void HcalRecHitsValidation::analyze(edm::Event const& ev, edm::EventSetup const& Handle rhitEE; - ev.getByLabel("ecalRecHit","EcalRecHitsEE", rhitEE); + ev.getByToken(tok_EE_, rhitEE); RecHit = rhitEE.product()->begin(); RecHitEnd = rhitEE.product()->end(); @@ -1436,7 +1442,7 @@ void HcalRecHitsValidation::analyze(edm::Event const& ev, edm::EventSetup const& double phiHotS = 1000.; edm::Handle hcalHits; - ev.getByLabel("g4SimHits","HcalHits",hcalHits); + ev.getByToken(tok_hh_,hcalHits); const PCaloHitContainer * SimHitResult = hcalHits.product () ; double enSimHits = 0.; @@ -1578,7 +1584,7 @@ void HcalRecHitsValidation::fillRecHitsTmp(int subdet_, edm::Event const& ev){ //HBHE edm::Handle hbhecoll; - ev.getByLabel(theHBHERecHitCollectionLabel, hbhecoll); + ev.getByToken(tok_hbhe_, hbhecoll); for (HBHERecHitCollection::const_iterator j=hbhecoll->begin(); j != hbhecoll->end(); j++) { HcalDetId cell(j->id()); @@ -1626,7 +1632,7 @@ void HcalRecHitsValidation::fillRecHitsTmp(int subdet_, edm::Event const& ev){ //HF edm::Handle hfcoll; - ev.getByLabel(theHFRecHitCollectionLabel, hfcoll); + ev.getByToken(tok_hf_, hfcoll); for (HFRecHitCollection::const_iterator j = hfcoll->begin(); j != hfcoll->end(); j++) { HcalDetId cell(j->id()); @@ -1671,7 +1677,7 @@ void HcalRecHitsValidation::fillRecHitsTmp(int subdet_, edm::Event const& ev){ if( subdet_ == 3 || subdet_ == 5 || subdet_ == 6 || subdet_ == 0) { edm::Handle hocoll; - ev.getByLabel(theHORecHitCollectionLabel, hocoll); + ev.getByToken(tok_ho_, hocoll); for (HORecHitCollection::const_iterator j = hocoll->begin(); j != hocoll->end(); j++) { HcalDetId cell(j->id()); diff --git a/Validation/HcalRecHits/src/NoiseRates.cc b/Validation/HcalRecHits/src/NoiseRates.cc index 65ce4a6e5276d..9825c210f7b15 100644 --- a/Validation/HcalRecHits/src/NoiseRates.cc +++ b/Validation/HcalRecHits/src/NoiseRates.cc @@ -8,7 +8,6 @@ // #include "Validation/HcalRecHits/interface/NoiseRates.h" -#include "DataFormats/METReco/interface/HcalNoiseRBX.h" #include "FWCore/Utilities/interface/EDMException.h" // @@ -36,6 +35,8 @@ NoiseRates::NoiseRates(const edm::ParameterSet& iConfig) minRBXEnergy_ = iConfig.getUntrackedParameter("minRBXEnergy"); minHitEnergy_ = iConfig.getUntrackedParameter("minHitEnergy"); + tok_rbx_ = consumes(rbxCollName_); + useAllHistos_ = iConfig.getUntrackedParameter("useAllHistos", false); // book histograms @@ -84,7 +85,7 @@ NoiseRates::analyze(const edm::Event& iEvent, const edm::EventSetup& evSetup) // get the RBX Noise collection edm::Handle handle; - iEvent.getByLabel(rbxCollName_,handle); + iEvent.getByToken(tok_rbx_,handle); if(!handle.isValid()) { throw edm::Exception(edm::errors::ProductNotFound) << " could not find HcalNoiseRBXCollection named " << rbxCollName_ << ".\n";