Skip to content

Commit

Permalink
Merge pull request #34885 from mmusich/Alignment/CommonAlignmentProdu…
Browse files Browse the repository at this point in the history
…cer_migrateToConsumes

migrate `AlignmentProducer` to event consumes
  • Loading branch information
cmsbuild committed Aug 19, 2021
2 parents 24046ab + a7f22d3 commit 5da88e0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ AlignmentProducer::AlignmentProducer(const edm::ParameterSet &config)
maxLoops_{config.getUntrackedParameter<unsigned int>("maxLoops")} {
edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::AlignmentProducer";

// do now all the consumes
trajTrackAssociationCollectionToken_ = consumes<TrajTrackAssociationCollection>(tjTkAssociationMapTag_);
bsToken_ = consumes<reco::BeamSpot>(beamSpotTag_);
tkFittedLasBeamCollectionToken_ = consumes<TkFittedLasBeamCollection>(tkLasBeamTag_);
tsosVectorCollectionToken_ = consumes<TsosVectorCollection>(tkLasBeamTag_);
aliClusterValueMapToken_ = consumes<AliClusterValueMap>(clusterValueMapTag_);

// Tell the framework what data is being produced
if (doTracker_) {
setWhatProduced(this, &AlignmentProducer::produceTracker);
Expand Down
16 changes: 11 additions & 5 deletions Alignment/CommonAlignmentProducer/plugins/AlignmentProducer.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,33 +58,39 @@ class AlignmentProducer : public edm::ESProducerLooper, public AlignmentProducer
bool getAliClusterValueMap(const edm::Event&, edm::Handle<AliClusterValueMap>&) override;

const unsigned int maxLoops_; /// Number of loops to loop

edm::EDGetTokenT<TrajTrackAssociationCollection> trajTrackAssociationCollectionToken_;
edm::EDGetTokenT<reco::BeamSpot> bsToken_;
edm::EDGetTokenT<TkFittedLasBeamCollection> tkFittedLasBeamCollectionToken_;
edm::EDGetTokenT<TsosVectorCollection> tsosVectorCollectionToken_;
edm::EDGetTokenT<AliClusterValueMap> aliClusterValueMapToken_;
};

//------------------------------------------------------------------------------
inline bool AlignmentProducer::getTrajTrackAssociationCollection(const edm::Event& event,
edm::Handle<TrajTrackAssociationCollection>& result) {
return event.getByLabel(tjTkAssociationMapTag_, result);
return event.getByToken(trajTrackAssociationCollectionToken_, result);
}

//------------------------------------------------------------------------------
inline bool AlignmentProducer::getBeamSpot(const edm::Event& event, edm::Handle<reco::BeamSpot>& result) {
return event.getByLabel(beamSpotTag_, result);
return event.getByToken(bsToken_, result);
}

//------------------------------------------------------------------------------
inline bool AlignmentProducer::getTkFittedLasBeamCollection(const edm::Run& run,
edm::Handle<TkFittedLasBeamCollection>& result) {
return run.getByLabel(tkLasBeamTag_, result);
return run.getByToken(tkFittedLasBeamCollectionToken_, result);
}

//------------------------------------------------------------------------------
inline bool AlignmentProducer::getTsosVectorCollection(const edm::Run& run, edm::Handle<TsosVectorCollection>& result) {
return run.getByLabel(tkLasBeamTag_, result);
return run.getByToken(tsosVectorCollectionToken_, result);
}

//------------------------------------------------------------------------------
inline bool AlignmentProducer::getAliClusterValueMap(const edm::Event& event, edm::Handle<AliClusterValueMap>& result) {
return event.getByLabel(clusterValueMapTag_, result);
return event.getByToken(aliClusterValueMapToken_, result);
}

#endif

0 comments on commit 5da88e0

Please sign in to comment.