Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run3-sim117 Replace getbylabel with get using token #37697

Merged
merged 2 commits into from
Apr 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions SimG4Core/GFlash/TB/TreeProducerCalibSimul.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ class TreeProducerCalibSimul : public edm::one::EDAnalyzer<edm::one::SharedResou

std::unique_ptr<TreeMatrixCalib> myTree_;

edm::EDGetTokenT<EBRecHitCollection> tokEBRecHit_;
edm::EDGetTokenT<EcalTBHodoscopeRecInfo> tokEcalHodo_;
edm::EDGetTokenT<EcalTBTDCRecInfo> tokEcalTDC_;
edm::EDGetTokenT<EcalTBEventHeader> tokEventHeader_;

int xtalInBeam_;
int tot_events_;
int tot_events_ok_;
Expand Down Expand Up @@ -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<EBRecHitCollection>(edm::InputTag(RecHitProducer_, EBRecHitCollection_));
tokEcalHodo_ = consumes<EcalTBHodoscopeRecInfo>(edm::InputTag(hodoRecInfoProducer_, hodoRecInfoCollection_));
tokEcalTDC_ = consumes<EcalTBTDCRecInfo>(edm::InputTag(tdcRecInfoProducer_, tdcRecInfoCollection_));
tokEventHeader_ = consumes<EcalTBEventHeader>(edm::InputTag(eventHeaderProducer_));
}

// ------------------------------------------------------
Expand Down Expand Up @@ -157,24 +167,16 @@ void TreeProducerCalibSimul::analyze(const edm::Event& iEvent, const edm::EventS

// ---------------------------------------------------------------------
// taking what I need: hits
edm::Handle<EBRecHitCollection> pEBRecHits;
iEvent.getByLabel(RecHitProducer_, EBRecHitCollection_, pEBRecHits);
const EBRecHitCollection* EBRecHits = pEBRecHits.product();
const EBRecHitCollection* EBRecHits = &iEvent.get(tokEBRecHit_);

// taking what I need: hodoscopes
edm::Handle<EcalTBHodoscopeRecInfo> pHodo;
iEvent.getByLabel(hodoRecInfoProducer_, hodoRecInfoCollection_, pHodo);
const EcalTBHodoscopeRecInfo* recHodo = pHodo.product();
const EcalTBHodoscopeRecInfo* recHodo = &iEvent.get(tokEcalHodo_);

// taking what I need: tdc
edm::Handle<EcalTBTDCRecInfo> 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<EcalTBEventHeader> 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)) {
Expand Down