Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-06-03 00:12:32

0001 import FWCore.ParameterSet.Config as cms
0002 from PhysicsTools.NanoAOD.common_cff import *
0003 
0004 tracksBPH = cms.EDProducer(
0005     "BPHTrackMerger",
0006     beamSpot        = cms.InputTag("offlineBeamSpot"),
0007     dileptons       = cms.InputTag("MuMu:SelectedDiLeptons"),
0008     tracks          = cms.InputTag("packedPFCandidates"),
0009     lostTracks      = cms.InputTag("lostTracks"),
0010     trackSelection  = cms.string("pt>0.7 && abs(eta)<3.0"),  # We need all tracks for tagging, no cuts here for now
0011     muons           = cms.InputTag("slimmedMuons"),
0012     electrons       = cms.InputTag("slimmedElectrons"),
0013     pvSrc           = cms.InputTag("offlineSlimmedPrimaryVertices"),
0014     maxDzDilep      = cms.double(1.0),
0015     dcaSig          = cms.double(-100000),
0016 )
0017 
0018 
0019 trackBPHTable = cms.EDProducer(
0020     "SimpleCompositeCandidateFlatTableProducer",
0021     src  = cms.InputTag("tracksBPH:SelectedTracks"),
0022     cut  = cms.string(""),
0023     name = cms.string("Track"),
0024     doc  = cms.string("track collection"),
0025     singleton = cms.bool(False),
0026     extension = cms.bool(False), 
0027     variables = cms.PSet(
0028         CandVars,
0029         vx = Var("vx()", float, doc="x coordinate of of ref point [cm]", precision=6),
0030         vy = Var("vy()", float, doc="y coordinate of of ref point [cm]", precision=6),
0031         vz = Var("vz()", float, doc="z coordinate of of ref point [cm]", precision=6),
0032         # User variables defined in plugins/BPHTrackMerger.cc
0033         isPacked  = Var("userInt('isPacked')", bool, doc="track from packedCandidate collection"),
0034         isLostTrk = Var("userInt('isLostTrk')", bool, doc="track from lostTrack collection"),
0035         dz      = Var("userFloat('dz')", float, doc="dz signed wrt PV[0] [cm]", precision=6),
0036         dxy     = Var("userFloat('dxy')", float, doc="dxy (with sign) wrt PV associated with the track [cm]", precision=6),
0037         dzS     = Var("userFloat('dzS')", float, doc="dz/err (with sign) wrt PV[0] [cm]", precision=6),
0038         dxyS    = Var("userFloat('dxyS')", float, doc="dxy/err (with sign) wrt PV associated with the track [cm]", precision=6),
0039         DCASig  = Var("userFloat('DCASig')", float, doc="significance of xy-distance of closest approach wrt beamspot", precision=6),
0040         dzTrg   = Var("userFloat('dzTrg')", float, doc="dz from the corresponding trigger muon [cm]", precision=6),
0041         isMatchedToMuon = Var("userInt('isMatchedToMuon')", bool, doc="track was used to build a muon"),
0042         isMatchedToMuon_Idx = Var("userInt('MatchedMuonIdx')", int, doc="index to matched muon"),
0043         isMatchedToEle  = Var("userInt('isMatchedToEle')", bool, doc="track was used to build a PF ele"),
0044         nValidHits      = Var("userInt('nValidHits')", "uint8", doc="Number of valid hits"),
0045         # Covariance matrix elements for helix parameters for decay time uncertainty
0046         covQopQop = Var("userFloat('covQopQop')", float, doc="Cov. of q/p with q/p", precision=12),
0047         covQopLam = Var("userFloat('covQopLam')", float, doc="Cov. of q/p with lambda", precision=12),
0048         covQopPhi = Var("userFloat('covQopPhi')", float, doc="Cov. of q/p with phi", precision=12),
0049         covLamLam = Var("userFloat('covLamLam')", float, doc="Cov. of lambda with lambda", precision=12),
0050         covLamPhi = Var("userFloat('covLamPhi')", float, doc="Cov. of lambda with phi", precision=12),
0051         covPhiPhi = Var("userFloat('covPhiPhi')", float, doc="Cov. of phi with phi", precision=12),
0052         # Additional track parameters for tagging
0053         ptErr      = Var("userFloat('ptErr')", float, doc="Pt uncertainty", precision=6),
0054         normChi2   = Var("userFloat('normChi2')", float, doc="Track fit chi-squared divided by n.d.o.f.", precision=6),
0055         nValidPixelHits = Var("userInt('nValidPixelHits')", "uint8", doc="Number of pixel hits"),
0056         # TODO: check impact parameters
0057         ),
0058 )
0059 
0060 
0061 tracksBPHMCMatch = cms.EDProducer("MCMatcher",              # cut on deltaR, deltaPt/Pt; pick best by deltaR
0062     src         = trackBPHTable.src,                        # final reco collection
0063     matched     = cms.InputTag("finalGenParticlesBPH"),     # final mc-truth particle collection
0064     mcPdgId     = cms.vint32(321, 211),                     # one or more PDG ID (321 = charged kaon, 211 = charged pion); absolute values (see below)
0065     checkCharge = cms.bool(False),                          # True = require RECO and MC objects to have the same charge
0066     mcStatus    = cms.vint32(1),                            # PYTHIA status code (1 = stable, 2 = shower, 3 = hard scattering)
0067     maxDeltaR   = cms.double(0.05),                         # Minimum deltaR for the match
0068     maxDPtRel   = cms.double(0.5),                          # Minimum deltaPt/Pt for the match
0069     resolveAmbiguities    = cms.bool(True),                 # Forbid two RECO objects to match to the same GEN object
0070     resolveByMatchQuality = cms.bool(True),                 # False = just match input in order; True = pick lowest deltaR pair first
0071 )
0072 
0073 
0074 tracksBPHMCTable = cms.EDProducer("CandMCMatchTableProducer",
0075     src   = tracksBPHMCMatch.src,
0076     mcMap         = cms.InputTag("tracksBPHMCMatch"),
0077     objName       = trackBPHTable.name,
0078     objType       = trackBPHTable.name,
0079     branchName = cms.string("genPart"),
0080     docString     = cms.string("MC matching to status==1 kaons or pions"),
0081 )
0082 
0083 
0084 tracksBPHSequence   = cms.Sequence(tracksBPH)
0085 tracksBPHSequenceMC = cms.Sequence(tracksBPH + tracksBPHMCMatch)
0086 tracksBPHTables     = cms.Sequence(trackBPHTable)
0087 tracksBPHTablesMC   = cms.Sequence(trackBPHTable + tracksBPHMCTable)