Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-05-09 22:40:13

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         isMatchedToEle  = Var("userInt('isMatchedToEle')", bool, doc="track was used to build a PF ele"),
0043         nValidHits      = Var("userInt('nValidHits')", "uint8", doc="Number of valid hits"),
0044         # Covariance matrix elements for helix parameters for decay time uncertainty
0045         covQopQop = Var("userFloat('covQopQop')", float, doc="Cov. of q/p with q/p", precision=10),
0046         covQopLam = Var("userFloat('covQopLam')", float, doc="Cov. of q/p with lambda", precision=10),
0047         covQopPhi = Var("userFloat('covQopPhi')", float, doc="Cov. of q/p with phi", precision=10),
0048         covLamLam = Var("userFloat('covLamLam')", float, doc="Cov. of lambda with lambda", precision=10),
0049         covLamPhi = Var("userFloat('covLamPhi')", float, doc="Cov. of lambda with phi", precision=10),
0050         covPhiPhi = Var("userFloat('covPhiPhi')", float, doc="Cov. of phi with phi", precision=10),
0051         # Additional track parameters for tagging
0052         ptErr      = Var("userFloat('ptErr')", float, doc="Pt uncertainty", precision=6),
0053         normChi2   = Var("userFloat('normChi2')", float, doc="Track fit chi-squared divided by n.d.o.f.", precision=6),
0054         nValidPixelHits = Var("userInt('nValidPixelHits')", "uint8", doc="Number of pixel hits"),
0055         # TODO: check impact parameters
0056         ),
0057 )
0058 
0059 
0060 tracksBPHMCMatch = cms.EDProducer("MCMatcher",              # cut on deltaR, deltaPt/Pt; pick best by deltaR
0061     src         = trackBPHTable.src,                        # final reco collection
0062     matched     = cms.InputTag("finalGenParticlesBPH"),     # final mc-truth particle collection
0063     mcPdgId     = cms.vint32(321, 211),                     # one or more PDG ID (321 = charged kaon, 211 = charged pion); absolute values (see below)
0064     checkCharge = cms.bool(False),                          # True = require RECO and MC objects to have the same charge
0065     mcStatus    = cms.vint32(1),                            # PYTHIA status code (1 = stable, 2 = shower, 3 = hard scattering)
0066     maxDeltaR   = cms.double(0.05),                         # Minimum deltaR for the match
0067     maxDPtRel   = cms.double(0.5),                          # Minimum deltaPt/Pt for the match
0068     resolveAmbiguities    = cms.bool(True),                 # Forbid two RECO objects to match to the same GEN object
0069     resolveByMatchQuality = cms.bool(True),                 # False = just match input in order; True = pick lowest deltaR pair first
0070 )
0071 
0072 
0073 tracksBPHMCTable = cms.EDProducer("CandMCMatchTableProducer",
0074     src   = tracksBPHMCMatch.src,
0075     mcMap         = cms.InputTag("tracksBPHMCMatch"),
0076     objName       = trackBPHTable.name,
0077     objType       = trackBPHTable.name,
0078     branchName = cms.string("genPart"),
0079     docString     = cms.string("MC matching to status==1 kaons or pions"),
0080 )
0081 
0082 
0083 tracksBPHSequence   = cms.Sequence(tracksBPH)
0084 tracksBPHSequenceMC = cms.Sequence(tracksBPH + tracksBPHMCMatch)
0085 tracksBPHTables     = cms.Sequence(trackBPHTable)
0086 tracksBPHTablesMC   = cms.Sequence(trackBPHTable + tracksBPHMCTable)