Skip to content

Commit

Permalink
Merge pull request #39833 from bsunanda/Run3-gex142B
Browse files Browse the repository at this point in the history
Run3-gex142B Use tokens rather than labels in accessing collections in Alignment/CommonAlignmentProducer
  • Loading branch information
cmsbuild authored Oct 29, 2022
2 parents 69ee59f + 233abde commit 5c7b24e
Show file tree
Hide file tree
Showing 4 changed files with 733 additions and 645 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
Expand All @@ -54,19 +55,22 @@
class AlignmentMuonHIPTrajectorySelector : public edm::stream::EDProducer<> {
public:
explicit AlignmentMuonHIPTrajectorySelector(const edm::ParameterSet&);
~AlignmentMuonHIPTrajectorySelector() override;
~AlignmentMuonHIPTrajectorySelector() override = default;

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

private:
void produce(edm::Event&, const edm::EventSetup&) override;

// ---------- member data --------------------------------
edm::InputTag m_input;
double m_minPt;
double m_maxTrackerForwardRedChi2;
int m_minTrackerDOF;
double m_maxMuonResidual;

bool m_hists;
const edm::InputTag m_input;
const double m_minPt;
const double m_maxTrackerForwardRedChi2;
const int m_minTrackerDOF;
const double m_maxMuonResidual;

const bool m_hists;
const edm::EDGetTokenT<TrajTrackAssociationCollection> mapToken_;
TH1F *m_pt, *m_tracker_forwardredchi2, *m_tracker_dof;
TH1F *m_resid_before, *m_resid_after;
};
Expand All @@ -89,6 +93,7 @@ AlignmentMuonHIPTrajectorySelector::AlignmentMuonHIPTrajectorySelector(const edm
m_minTrackerDOF(iConfig.getParameter<int>("minTrackerDOF")),
m_maxMuonResidual(iConfig.getParameter<double>("maxMuonResidual")),
m_hists(iConfig.getParameter<bool>("hists")),
mapToken_(consumes<TrajTrackAssociationCollection>(m_input)),
m_pt(nullptr),
m_tracker_forwardredchi2(nullptr),
m_tracker_dof(nullptr) {
Expand All @@ -105,17 +110,19 @@ AlignmentMuonHIPTrajectorySelector::AlignmentMuonHIPTrajectorySelector(const edm
}
}

AlignmentMuonHIPTrajectorySelector::~AlignmentMuonHIPTrajectorySelector() {}

//
// member functions
//
void AlignmentMuonHIPTrajectorySelector::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
desc.setUnknown();
descriptions.addDefault(desc);
}

// ------------ method called to produce the data ------------
void AlignmentMuonHIPTrajectorySelector::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) {
// input
edm::Handle<TrajTrackAssociationCollection> originalTrajTrackMap;
iEvent.getByLabel(m_input, originalTrajTrackMap);
const edm::Handle<TrajTrackAssociationCollection>& originalTrajTrackMap = iEvent.getHandle(mapToken_);

// output
auto newTrajTrackMap = std::make_unique<TrajTrackAssociationCollection>();
Expand Down
Loading

0 comments on commit 5c7b24e

Please sign in to comment.