Skip to content

Commit

Permalink
pre-select high purity tracks as input for muon reco in pp_on_AA era
Browse files Browse the repository at this point in the history
  • Loading branch information
mandrenguyen committed Jan 12, 2022
1 parent 77e4d1f commit 131c83b
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 3 deletions.
7 changes: 6 additions & 1 deletion RecoMuon/GlobalMuonProducer/python/globalMuons_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
GlobalTrajectoryBuilderCommon
),
TrackerCollectionLabel = cms.InputTag("generalTracks"),
MuonCollectionLabel = cms.InputTag("standAloneMuons","UpdatedAtVtx")
MuonCollectionLabel = cms.InputTag("standAloneMuons","UpdatedAtVtx"),
VertexCollectionLabel = cms.InputTag("offlinePrimaryVertices"),
selectHighPurity = cms.bool(False)
)

globalMuons.GLBTrajBuilderParameters.GlobalMuonTrackMatcher.Propagator = 'SmartPropagatorRK'
Expand All @@ -28,3 +30,6 @@
GlobalMuonTrackMatcher = dict(Propagator = 'SmartPropagator')
)
)

from Configuration.ProcessModifiers.pp_on_AA_cff import pp_on_AA
pp_on_AA.toModify(globalMuons, selectHighPurity = True)
4 changes: 4 additions & 0 deletions RecoMuon/GlobalMuonProducer/src/GlobalMuonProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ GlobalMuonProducer::GlobalMuonProducer(const ParameterSet& parameterSet) {
ParameterSet trajectoryBuilderParameters = parameterSet.getParameter<ParameterSet>("GLBTrajBuilderParameters");
InputTag trackCollectionTag = parameterSet.getParameter<InputTag>("TrackerCollectionLabel");
trajectoryBuilderParameters.addParameter<InputTag>("TrackerCollectionLabel", trackCollectionTag);
InputTag vertexCollectionTag = parameterSet.getParameter<InputTag>("VertexCollectionLabel");
trajectoryBuilderParameters.addParameter<InputTag>("VertexCollectionLabel", vertexCollectionTag);
bool selectHighPurity_ = parameterSet.getParameter<bool>("selectHighPurity");
trajectoryBuilderParameters.addParameter<bool>("selectHighPurity", selectHighPurity_);

// STA Muon Collection Label
theSTACollectionLabel = parameterSet.getParameter<InputTag>("MuonCollectionLabel");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "FWCore/Framework/interface/ConsumesCollector.h"
#include "DataFormats/VertexReco/interface/Vertex.h"

namespace edm {
class ParameterSet;
Expand Down Expand Up @@ -48,5 +49,9 @@ class GlobalMuonTrajectoryBuilder : public GlobalTrajectoryBuilderBase {
edm::InputTag theTkTrackLabel;
edm::EDGetTokenT<reco::TrackCollection> allTrackerTracksToken;
edm::Handle<reco::TrackCollection> allTrackerTracks;
edm::InputTag thePrimaryVtxLabel;
edm::EDGetTokenT<reco::VertexCollection> primaryVertexToken;
edm::Handle<reco::VertexCollection> vertexCollection;
bool selectHighPurity_;
};
#endif
7 changes: 7 additions & 0 deletions RecoMuon/GlobalTrackFinder/src/GlobalMuonTrajectoryBuilder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ GlobalMuonTrajectoryBuilder::GlobalMuonTrajectoryBuilder(const edm::ParameterSet
{
theTkTrackLabel = par.getParameter<edm::InputTag>("TrackerCollectionLabel");
allTrackerTracksToken = iC.consumes<reco::TrackCollection>(theTkTrackLabel);
thePrimaryVtxLabel = par.getParameter<edm::InputTag>("VertexCollectionLabel");
primaryVertexToken = iC.mayConsume<reco::VertexCollection>(thePrimaryVtxLabel);
selectHighPurity_ = par.getParameter<bool>("selectHighPurity");
}

//--------------
Expand All @@ -80,6 +83,10 @@ void GlobalMuonTrajectoryBuilder::setEvent(const edm::Event& event) {
// get tracker TrackCollection from Event
event.getByToken(allTrackerTracksToken, allTrackerTracks);
LogDebug(category) << " Found " << allTrackerTracks->size() << " tracker Tracks with label " << theTkTrackLabel;

// get primary vertex from Event
event.getByToken(primaryVertexToken, vertexCollection);
LogDebug(category) << " Found " << vertexCollection->size() << " tracker Tracks with label " << thePrimaryVtxLabel;
}

//
Expand Down
12 changes: 12 additions & 0 deletions RecoMuon/MuonIdentification/plugins/MuonIdProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@ MuonIdProducer::MuonIdProducer(const edm::ParameterSet& iConfig)
std::make_unique<MuonKinkFinder>(iConfig.getParameter<edm::ParameterSet>("TrackerKinkFinderParameters"), iC);
}

if (selectHighPurity_) {
const auto& pvTag = iConfig.getParameter<edm::InputTag>("pvInputTag");
pvToken_ = mayConsume<reco::VertexCollection>(pvTag);
}

//create mesh holder
meshAlgo_ = std::make_unique<MuonMesh>(iConfig.getParameter<edm::ParameterSet>("arbitrationCleanerOptions"));

Expand Down Expand Up @@ -253,6 +258,8 @@ void MuonIdProducer::init(edm::Event& iEvent, const edm::EventSetup& iSetup) {
iEvent.getByToken(rpcHitToken_, rpcHitHandle_);
if (fillGlobalTrackQuality_)
iEvent.getByToken(glbQualToken_, glbQualHandle_);
if (selectHighPurity_)
iEvent.getByToken(pvToken_, pvHandle_);
}

reco::Muon MuonIdProducer::makeMuon(edm::Event& iEvent,
Expand Down Expand Up @@ -540,6 +547,11 @@ void MuonIdProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
const reco::Track& track = innerTrackCollectionHandle_->at(i);
if (!isGoodTrack(track))
continue;
if (selectHighPurity_ && !track.quality(reco::TrackBase::highPurity)) {
const reco::VertexCollection* recoVertices = pvHandle_.product();
if (!recoVertices->at(0).isFake())
continue;
}
const auto& trackRef = reco::TrackRef(innerTrackCollectionHandle_, i);
bool splitTrack = false;
if (track.extra().isAvailable() && TrackDetectorAssociator::crossedIP(track))
Expand Down
5 changes: 5 additions & 0 deletions RecoMuon/MuonIdentification/plugins/MuonIdProducer.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "DataFormats/Common/interface/Handle.h"
#include "DataFormats/TrackReco/interface/Track.h"
#include "DataFormats/TrackReco/interface/TrackToTrackMap.h"
#include "DataFormats/VertexReco/interface/Vertex.h"
#include "DataFormats/MuonReco/interface/Muon.h"
#include "DataFormats/MuonReco/interface/MuonTrackLinks.h"
#include "DataFormats/MuonReco/interface/MuonFwd.h"
Expand Down Expand Up @@ -231,6 +232,7 @@ class MuonIdProducer : public edm::stream::EDProducer<> {
edm::Handle<reco::TrackToTrackMap> tpfmsCollectionHandle_;
edm::Handle<reco::TrackToTrackMap> pickyCollectionHandle_;
edm::Handle<reco::TrackToTrackMap> dytCollectionHandle_;
edm::Handle<reco::VertexCollection> pvHandle_;

edm::EDGetTokenT<reco::TrackCollection> innerTrackCollectionToken_;
edm::EDGetTokenT<reco::TrackCollection> outerTrackCollectionToken_;
Expand All @@ -239,6 +241,7 @@ class MuonIdProducer : public edm::stream::EDProducer<> {
edm::EDGetTokenT<reco::TrackToTrackMap> tpfmsCollectionToken_;
edm::EDGetTokenT<reco::TrackToTrackMap> pickyCollectionToken_;
edm::EDGetTokenT<reco::TrackToTrackMap> dytCollectionToken_;
edm::EDGetTokenT<reco::VertexCollection> pvToken_;

edm::EDGetTokenT<RPCRecHitCollection> rpcHitToken_;
edm::EDGetTokenT<edm::ValueMap<reco::MuonQuality> > glbQualToken_;
Expand All @@ -264,6 +267,8 @@ class MuonIdProducer : public edm::stream::EDProducer<> {
bool fillGlobalTrackRefits_;
edm::InputTag globalTrackQualityInputTag_;

edm::InputTag pvInputTag_;
bool selectHighPurity_;
bool fillTrackerKink_;
std::unique_ptr<MuonKinkFinder> trackerKinkFinder_;

Expand Down
3 changes: 2 additions & 1 deletion RecoMuon/MuonIdentification/python/earlyMuons_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
TrackAssociatorParameters = dict(
useHO = False,
useEcal = False,
useHcal = False)
useHcal = False),
pvInputTag = "firstStepPrimaryVertices" #Not used, but needed to avoid circular dependency in schedule
)
earlyDisplacedMuons = earlyMuons.clone(
inputCollectionLabels = ['earlyGeneralTracks','displacedStandAloneMuons:']
Expand Down
4 changes: 3 additions & 1 deletion RecoMuon/MuonIdentification/python/muons1stStep_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
# global quality
fillGlobalTrackQuality = cms.bool(False), #input depends on external module output --> set to True where the sequence is defined
globalTrackQualityInputTag = cms.InputTag('glbTrackQual'),
selectHighPurity = cms.bool(False),
pvInputTag = cms.InputTag('offlinePrimaryVertices'),

# tracker kink finding
fillTrackerKink = cms.bool(True),
Expand Down Expand Up @@ -100,7 +102,7 @@
)

from Configuration.ProcessModifiers.pp_on_AA_cff import pp_on_AA
pp_on_AA.toModify(muons1stStep, minPt = 0.8)
pp_on_AA.toModify(muons1stStep, minPt = 0.8, selectHighPurity = True)

from Configuration.ProcessModifiers.recoFromReco_cff import recoFromReco
recoFromReco.toModify(muons1stStep,fillShowerDigis = False)

0 comments on commit 131c83b

Please sign in to comment.