Use of the AT Gene f h T G eric Matching in PAT M h P T Roger Wolf Jan V Roger Wolf, Jan V Ve erka Veverka PAT Tutorial Ju une 2010
Object Matching Object Matching What ever Analysis you do you will arrive e at some point where you want to match one object to another obje ect Examples: Matching for tag & probe methods (STA Muon to Glo obal Muon) Matching of calibration truth and calibration measure Matching of calibration truth and calibration measure ement (Photon to Jet) ement (Photon to Jet) Matching of trigger objects to reco objects Matching of MC truth vs reco object 2 / 14
Definition Definition Matching means the association of o objects from different collections based on spacial or kinem matic similarity. Goal is to find the same object in diffe erent representations ( generator level – reco level or trigger le ( g evel – reco level ) ) gg Note that in the following we we are talk ing about a one to one or a one to many relation of the kind: ... ( target collection reco::Jet ) ... ( match collection gen::Jet ) 3 / 14
Implementations in Implementations in n Analysis Tools n Analysis Tools In Analysis Tools (AT) we have a very co In Analysis Tools (AT) we have a very co ommon framework for ommon framework for matching ( reco::PhysObjectMatcher ) Five-fold template, which can be expande ed using several methods/classes of matching, distance characterization and d object pre-selection. Input Types Match Config. 4 / 14
Match Configurati Match Configurati on on S D and Q can be expanded by the foll S , D and Q can be expanded by the foll lowing classes: lowing classes: 5 / 14
MCMatcher Config MCMatcher Config guration guration MC matching in PAT exploits the reco::M MC matching in PAT exploits the reco::M MCMacher : MCMacher : Special Selection criteria for MC particles for match collection Allow window in D R and D pt for matching Match by distance in D R.(closest in D R) 6 / 14
Resolve Ambiguitie Resolve Ambiguitie es? es? f several parts 1) : The configuration in general consists of The configuration in general consists of f several parts : jetPartonMatch = cms.EDFilter("MCMatcher", # cut on n deltaR, deltaPt/Pt; pick best by deltaR src = cms.InputTag("ak5CaloJets"), # RECO o objects to match matched = cms.InputTag("genParticles"), # mc-tru uth particle collection mcPdgId = cms.vint32(1, 2, 3, 4, 5, 21), # one or r more PDG ID (quarks except top; gluons) mcStatus = cms.vint32(3), i 32(3) # # PYTHIA A status code (3 = hard scattering) d (3 h d i ) checkCharge = cms.bool(False), # False = any value of the charge of MC and RECO is ok maxDeltaR = cms.double(0.4), # Minimu um deltaR for the match maxDPtRel = cms.double(3.0), # Minimu um deltaPt/Pt for the match resolveAmbiguities = cms.bool(True), # Forbid d two RECO objects to match to the same GEN object resolveByMatchQuality = cms.bool(False), # False = just match input in order; True = pick lowest dR pair first ) ... ( target collection reco::Jet ) ( target collection reco::Jet ) ... ... ( match collection gen::Jet ) ( match collection gen::Jet ) Color Coding: PhysObjectMatcher O j MatchByDRDPt MCMat C tchSelector S 7 / 14 1) to follow the expansion in detail have a look into the links on the indico page
Configuration Princ Configuration Princ ciples ciples f several parts 1) : The configuration in general consists of The configuration in general consists of f several parts : jetPartonMatch = cms.EDProducer("MCMatcher", # cut on deltaR, deltaPt/Pt; pick best by deltaR src = cms.InputTag("ak5CaloJets"), # RECO O objects to match matched = cms.InputTag("genParticles"), # mc-t truth particle collection mcPdgId = cms.vint32(1, 2, 3, 4, 5, 21), # one o or more PDG ID (quarks except top; gluons) mcStatus = cms.vint32(3), i 32(3) # PYTH # HIA status code (3 = hard scattering) d (3 h d i ) checkCharge = cms.bool(False), # Fals se = any value of the charge of MC and RECO is ok maxDeltaR = cms.double(0.4), # Mini imum deltaR for the match maxDPtRel = cms.double(3.0), # Mini imum deltaPt/Pt for the match resolveAmbiguities = cms.bool(True), # Forb bid two RECO objects to match to the same GEN object resolveByMatchQuality = cms.bool(False), # Fals se = just match input in order; True = pick lowest dR pair first ) jetGenJetMatch = cms.EDProducer("GenJetMatcher", # cut on deltaR, deltaPt/Pt; pick best by deltaR src = cms.InputTag("ak5CaloJets"), # RECO O jets (any View<Jet> is ok) matched = cms.InputTag("ak5GenJets"), matched = cms InputTag("ak5GenJets") # GEN # GEN jets (must be GenJetCollection) jets (must be GenJetCollection) mcPdgId = cms.vint32(), # n/a mcStatus = cms.vint32(), # n/a checkCharge = cms.bool(False), # n/a maxDeltaR = cms.double(0.4), # Mini imum deltaR for the match maxDPtRel = cms.double(3.0), # Mini imum deltaPt/Pt for the match resolveAmbiguities = cms.bool(True), # Forb bid two RECO objects to match to the same GEN object resolveByMatchQuality = cms.bool(False), # Fals se = just match input in order; True = pick lowest dR pair first ) Color Coding: PhysObjectMatcher O j MatchByDRDPt MCMat C tchSelector S 8 / 14 1) to follow the expansion in detail have a look into the links on the indico page
MC Matching in th MC Matching in th he PAT Workflows he PAT Workflows Associations produced before hand : Associations produced before hand : Muon production workflow: Find the muonMatch cfi.py in mcMatchingLayer0 _ py g y Find the muonProducer_cff.py in producersLayer1 Jet production workflow: Find the jetMatch_cfi.py in mcMatchingLayer0 Find the jetProducer_cff.py in producersLayer1 9 / 14
Embedding the MC Embedding the MC C Match C Match Example for Muons ( python/producersLay Example for Muons ( python/producersLay yer1/muonProducer_cfi.py ): yer1/muonProducer cfi.py ): patMuons = cms.EDProducer("PATMuonProducer", # input muonSource = cms.InputTag("muons"), # use particle flow instead of std reco useParticleFlow = cms.bool( False ), pfMuonSource = cms.InputTag("pfIsolatedMuons"), , # add TeV refit tracks ... # add user data … # embedding objects ... # embed IsoDeposits isoDeposits = cms.PSet(), # user defined isolation variables the variables d defined here will be accessible # via pat::Muon::userIsolation(IsolationKeys key) with the key as defined in # DataFormats/PatCandidates/interface/Isolation.h userIsolation = cms.PSet(), # mc matching addGenMatch = cms.bool(True), embedGenMatch = cms.bool(True), genParticleMatch = cms.InputTag("muonMatch"), ## p particles source to be used for the matching # efficiencies # efficiencies addEfficiencies = cms.bool(False), efficiencies = cms.PSet(), # resolution configurables addResolutions = cms.bool(False), resolutions = cms.PSet(), # high level selections embedHighLevelSelection = cms.bool(True), b d i h l l i b l( ) beamLineSrc = cms.InputTag("offlineBea amSpot") ) 10 / 14
Embedding the MC Embedding the MC C Match C Match Example for Jets ( python/producersLayer Example for Jets ( python/producersLayer r1/jetProducer_cfi.py ): r1/jetProducer cfi.py ): patJets = cms.EDProducer("PATJetProducer", # input jetSource = cms.InputTag("ak5CaloJets"), # add user data ... # embedding of AOD items embedCaloTowers = cms.bool(False), ## ... # jet energy corrections addJetCorrFactors = cms.bool(True), jetCorrFactorsSource = cms.VInputTag(cms.InputTag( ("jetCorrFactors") ), # btag information # btag information ... # clone tag infos ATTENTION: these take lots of sp pace! # usually the discriminators from the default algo os # are sufficient ... # mc matching addGenPartonMatch = cms.bool(True), ## ... embedGenPartonMatch = cms.bool(True), ## ... genPartonMatch = cms.InputTag("patJetPartonMa atch"), ## ... addGenJetMatch = cms.bool(True), ## ... embedGenJetMatch = cms.bool(True), ## ... genJetMatch = cms.InputTag("patJetGenJetMa atch"), ## ... ... ... ) Don t forget to keep the genParticle/genJet collec Don't forget to keep the genParticle/genJet collec ction when not embedding ction when not embedding the match into the pat::Candidate (see Module 2 t to check how to do that) 11 / 14
How to access the How to access the e GenMatch? e GenMatch? Common getter f nctions for all pat Candid Common getter functions for all pat::Candid dates (from PATObj dates (from PATObject.h ): t h ) More getter functions exist for the concrete e derived classes for Leptons, Photons, Jets Leptons, Photons, Jets 12 / 14
Summary Summary AT holds powerful tools to apply any kin nd of matching you could think of PAT exploits an expanded template vers sion which is the MCMatcher for MC matching For any more than trivial Matching you s should consider using the PhysObjectMatcher, as it just relieves y you from re-inventing In what ever complexity you want to have it suc ch reduces to a 'one-liner' You will find many parts of this also in le ectures 4.1 and 4.2 that discuss the matching between trigg ger and reco objects. 13 / 14
Recommend
More recommend