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

pre-select high purity tracks as input for muon reco in pp_on_AA era #36693

Merged
merged 6 commits into from
Jan 26, 2022
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion RecoMuon/Configuration/python/RecoMuonPPonly_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
from RecoMuon.Configuration.iterativeTkDisplaced_cff import *
displacedGlobalMuons = globalMuons.clone(
MuonCollectionLabel = 'displacedStandAloneMuons:',
TrackerCollectionLabel = 'displacedTracks'
TrackerCollectionLabel = 'displacedTracks',
selectHighPurity = False
)

# TeV refinement
Expand Down
8 changes: 6 additions & 2 deletions RecoMuon/Configuration/python/RecoMuon_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
TimingFillerParameters = dict(
MatchParameters = dict(DTsegments = 'dt4DCosmicSegments'),
DTTimingParameters = dict(PruneCut = 9999),
CSCTimingParameters = dict(PruneCut = 9999))
CSCTimingParameters = dict(PruneCut = 9999)),
selectHighPurity = False,
minPt = 0.5
)

#add regional cosmic tracks here
Expand Down Expand Up @@ -56,7 +58,9 @@
TimingFillerParameters = dict(
MatchParameters = dict(DTsegments = 'dt4DCosmicSegments'),
DTTimingParameters = dict(PruneCut = 9999),
CSCTimingParameters = dict(PruneCut = 9999))
CSCTimingParameters = dict(PruneCut = 9999)),
selectHighPurity = False,
minPt = 0.5
)

muoncosmicreco1legSTATask = cms.Task(CosmicMuonSeed,cosmicMuons1Leg)
Expand Down
7 changes: 5 additions & 2 deletions RecoMuon/Configuration/python/SETRecoMuon_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@

from RecoMuon.GlobalMuonProducer.GlobalMuonProducer_cff import *
globalSETMuons = globalMuons.clone(
MuonCollectionLabel = 'standAloneSETMuons:UpdatedAtVtx'
MuonCollectionLabel = 'standAloneSETMuons:UpdatedAtVtx',
selectHighPurity = False
)
muontracking_with_SET_Task = cms.Task(SETMuonSeed,standAloneSETMuons,globalSETMuons)
muontracking_with_SET = cms.Sequence(muontracking_with_SET_Task)
Expand All @@ -16,7 +17,9 @@
inputCollectionLabels = ['generalTracks',
'globalSETMuons',
'standAloneSETMuons:UpdatedAtVtx'],
inputCollectionTypes = ['inner tracks', 'links', 'outer tracks']
inputCollectionTypes = ['inner tracks', 'links', 'outer tracks'],
selectHighPurity = False,
minPt = 0.5
)
#muonreco_with_SET = cms.Sequence(muontracking_with_SET*muonsWithSET)
#run only the tracking part for SET, after that it should be merged with the main ones at some point
Expand Down
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_;
mandrenguyen marked this conversation as resolved.
Show resolved Hide resolved
};
#endif
12 changes: 12 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 Expand Up @@ -151,6 +158,11 @@ vector<GlobalMuonTrajectoryBuilder::TrackCand> GlobalMuonTrajectoryBuilder::make
for (unsigned int position = 0; position != allTrackerTracks->size(); ++position) {
reco::TrackRef tkTrackRef(allTrackerTracks, position);
TrackCand tkCand = TrackCand((Trajectory*)nullptr, tkTrackRef);
if (selectHighPurity_ && !tkTrackRef->quality(reco::TrackBase::highPurity)) {
const reco::VertexCollection* recoVertices = vertexCollection.product();
if (!(*recoVertices)[0].isFake())
continue;
}
tkTrackCands.push_back(tkCand);
}

Expand Down
17 changes: 17 additions & 0 deletions RecoMuon/MuonIdentification/plugins/MuonIdProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ MuonIdProducer::MuonIdProducer(const edm::ParameterSet& iConfig)
fillGlobalTrackQuality_ = iConfig.getParameter<bool>("fillGlobalTrackQuality");
fillGlobalTrackRefits_ = iConfig.getParameter<bool>("fillGlobalTrackRefits");
arbitrateTrackerMuons_ = iConfig.getParameter<bool>("arbitrateTrackerMuons");
selectHighPurity_ = iConfig.getParameter<bool>("selectHighPurity");
//SK: (maybe temporary) run it only if the global is also run
fillTrackerKink_ = false;
if (fillGlobalTrackQuality_)
Expand Down Expand Up @@ -157,6 +158,11 @@ MuonIdProducer::MuonIdProducer(const edm::ParameterSet& iConfig)
std::make_unique<MuonKinkFinder>(iConfig.getParameter<edm::ParameterSet>("TrackerKinkFinderParameters"), iC);
}

if (selectHighPurity_) {
mandrenguyen marked this conversation as resolved.
Show resolved Hide resolved
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 +259,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 +548,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)[0].isFake())
continue;
}
const auto& trackRef = reco::TrackRef(innerTrackCollectionHandle_, i);
bool splitTrack = false;
if (track.extra().isAvailable() && TrackDetectorAssociator::crossedIP(track))
Expand Down Expand Up @@ -1396,6 +1409,10 @@ void MuonIdProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptio
desc.add<bool>("arbitrateTrackerMuons", false);
desc.add<bool>("storeCrossedHcalRecHits", false);
desc.add<bool>("fillShowerDigis", false);
desc.ifValue(
edm::ParameterDescription<bool>("selectHighPurity", false, true),
true >> (edm::ParameterDescription<edm::InputTag>("pvInputTag", edm::InputTag("offlinePrimaryVertices"), true)) or
false >> (edm::ParameterDescription<edm::InputTag>("pvInputTag", edm::InputTag(""), true)));

edm::ParameterSetDescription descTrkAsoPar;
descTrkAsoPar.add<edm::InputTag>("GEMSegmentCollectionLabel", edm::InputTag("gemSegments"));
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),
selectHighPurity = False
)
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)