From cdb2b0e0a4a25c2458d8510d350f16fd7575b3ba Mon Sep 17 00:00:00 2001 From: Sunanda Date: Wed, 27 Apr 2022 04:46:38 +0200 Subject: [PATCH 1/2] Replace getbylabel with get using token --- SimG4Core/GFlash/TB/TreeProducerCalibSimul.cc | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/SimG4Core/GFlash/TB/TreeProducerCalibSimul.cc b/SimG4Core/GFlash/TB/TreeProducerCalibSimul.cc index bb7aa7f97e615..301d1548c084f 100644 --- a/SimG4Core/GFlash/TB/TreeProducerCalibSimul.cc +++ b/SimG4Core/GFlash/TB/TreeProducerCalibSimul.cc @@ -75,6 +75,11 @@ class TreeProducerCalibSimul : public edm::one::EDAnalyzer myTree_; + edm::EDGetTokenT tokEBRecHit_; + edm::EDGetTokenT tokEcalHodo_; + edm::EDGetTokenT tokEcalTDC_; + edm::EDGetTokenT tokEventHeader_; + int xtalInBeam_; int tot_events_; int tot_events_ok_; @@ -112,6 +117,11 @@ TreeProducerCalibSimul::TreeProducerCalibSimul(const edm::ParameterSet& iConfig) << tdcRecInfoProducer_.c_str(); edm::LogVerbatim("GFlash") << "Fetching evHeaCollection: " << eventHeaderCollection_.c_str() << " prod by " << eventHeaderProducer_.c_str() << "\n"; + + tokEBRecHit_ = consumes(edm::InputTag(RecHitProducer_, EBRecHitCollection_)) ; + tokEcalHodo_ = consumes(edm::InputTag(hodoRecInfoProducer_, hodoRecInfoCollection_)); + tokEcalTDC_ = consumes(edm::InputTag(tdcRecInfoProducer_, tdcRecInfoCollection_)); + tokEventHeader_ = consumes(edm::InputTag(eventHeaderProducer_)); } // ------------------------------------------------------ @@ -157,24 +167,16 @@ void TreeProducerCalibSimul::analyze(const edm::Event& iEvent, const edm::EventS // --------------------------------------------------------------------- // taking what I need: hits - edm::Handle pEBRecHits; - iEvent.getByLabel(RecHitProducer_, EBRecHitCollection_, pEBRecHits); - const EBRecHitCollection* EBRecHits = pEBRecHits.product(); + const EBRecHitCollection* EBRecHits = &iEvent.get(tokEBRecHit_); // taking what I need: hodoscopes - edm::Handle pHodo; - iEvent.getByLabel(hodoRecInfoProducer_, hodoRecInfoCollection_, pHodo); - const EcalTBHodoscopeRecInfo* recHodo = pHodo.product(); + const EcalTBHodoscopeRecInfo* recHodo = &iEvent.get(tokEcalHodo_); // taking what I need: tdc - edm::Handle pTDC; - iEvent.getByLabel(tdcRecInfoProducer_, tdcRecInfoCollection_, pTDC); - const EcalTBTDCRecInfo* recTDC = pTDC.product(); + const EcalTBTDCRecInfo* recTDC = &iEvent.get(tokEcalTDC_); // taking what I need: event header - edm::Handle pEventHeader; - iEvent.getByLabel(eventHeaderProducer_, pEventHeader); - const EcalTBEventHeader* evtHeader = pEventHeader.product(); + const EcalTBEventHeader* evtHeader = &iEvent.get(tokEventHeader_); // checking everything is there and fine if ((!EBRecHits) || (EBRecHits->size() == 0)) { From b2edf4e182a1cb6b43817bc6d1b5d4a86ac36477 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Wed, 27 Apr 2022 05:42:13 +0200 Subject: [PATCH 2/2] Code check --- SimG4Core/GFlash/TB/TreeProducerCalibSimul.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SimG4Core/GFlash/TB/TreeProducerCalibSimul.cc b/SimG4Core/GFlash/TB/TreeProducerCalibSimul.cc index 301d1548c084f..a99c6c71a22da 100644 --- a/SimG4Core/GFlash/TB/TreeProducerCalibSimul.cc +++ b/SimG4Core/GFlash/TB/TreeProducerCalibSimul.cc @@ -118,7 +118,7 @@ TreeProducerCalibSimul::TreeProducerCalibSimul(const edm::ParameterSet& iConfig) edm::LogVerbatim("GFlash") << "Fetching evHeaCollection: " << eventHeaderCollection_.c_str() << " prod by " << eventHeaderProducer_.c_str() << "\n"; - tokEBRecHit_ = consumes(edm::InputTag(RecHitProducer_, EBRecHitCollection_)) ; + tokEBRecHit_ = consumes(edm::InputTag(RecHitProducer_, EBRecHitCollection_)); tokEcalHodo_ = consumes(edm::InputTag(hodoRecInfoProducer_, hodoRecInfoCollection_)); tokEcalTDC_ = consumes(edm::InputTag(tdcRecInfoProducer_, tdcRecInfoCollection_)); tokEventHeader_ = consumes(edm::InputTag(eventHeaderProducer_));