CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/MuonAnalysis/MuonAssociators/python/muonClassificationByHits_cfi.py

Go to the documentation of this file.
00001 ### Add MC classification by hits
00002 # Requires:
00003 #   SimGeneral/TrackingAnalysis V04-01-05    (35X+)
00004 #   SimTracker/TrackAssociation V01-08-17    (35X+)
00005 #   SimMuon/MCTruth             V02-05-00-03 (35X) or V02-06-00+ (37X+)
00006 
00007 from SimGeneral.MixingModule.mixNoPU_cfi                          import *
00008 from SimGeneral.TrackingAnalysis.trackingParticlesNoSimHits_cfi   import * 
00009 from SimMuon.MCTruth.MuonAssociatorByHitsESProducer_NoSimHits_cfi import * 
00010 
00011 classByHitsTM = cms.EDProducer("MuonMCClassifier",
00012     muons = cms.InputTag("muons"),
00013     muonPreselection = cms.string("isTrackerMuon"),  #
00014     #muonPreselection = cms.string("muonID('TrackerMuonArbitrated')"), # You might want this
00015     trackType = cms.string("segments"),  # or 'inner','outer','global'
00016     trackingParticles = cms.InputTag("mergedtruthNoSimHits"),         
00017     associatorLabel   = cms.string("muonAssociatorByHits_NoSimHits"),
00018     decayRho  = cms.double(200), # to classifiy differently decay muons included in ppMuX
00019     decayAbsZ = cms.double(400), # and decay muons that could not be in ppMuX
00020     linkToGenParticles = cms.bool(True),          # produce also a collection of genParticles for secondary muons
00021     genParticles = cms.InputTag("genParticles"),  # and associations to primary and secondaries
00022 )
00023 classByHitsTMLSAT = classByHitsTM.clone(
00024     muonPreselection = cms.string("muonID('TMLastStationAngTight')")
00025 )
00026 classByHitsGlb = classByHitsTM.clone(
00027     muonPreselection = cms.string("isGlobalMuon"),
00028     trackType = "global"
00029 )
00030 classByHitsSta = classByHitsTM.clone(
00031     muonPreselection = cms.string("isStandAloneMuon"),
00032     trackType = "outer"
00033 )
00034 
00035 
00036 muonClassificationByHits = cms.Sequence(
00037     mix +
00038     trackingParticlesNoSimHits +
00039     ( classByHitsTM      +
00040       classByHitsTMLSAT  +
00041       classByHitsGlb     +  
00042       classByHitsSta )
00043 )
00044 def addUserData(patMuonProducer,labels=['classByHitsGlb', 'classByHitsTM', 'classByHitsTMLSAT', 'classByHitsSta'], extraInfo = False):
00045     for label in labels:
00046         patMuonProducer.userData.userInts.src.append( cms.InputTag(label) )
00047         patMuonProducer.userData.userInts.src.append( cms.InputTag(label, "ext") )
00048         if extraInfo:
00049             for ints in ("flav", "hitsPdgId", "momPdgId", "gmomPdgId", "momFlav", "gmomFlav", "hmomFlav", "tpId", "momStatus"):
00050                 patMuonProducer.userData.userInts.src.append(cms.InputTag(label, ints))
00051             for ins in ("prodRho", "prodZ", "tpAssoQuality", "momRho", "momZ"):
00052                 patMuonProducer.userData.userFloats.src.append(cms.InputTag(label, ins))
00053 def addGenParticleRef(patMuonProducer, label = 'classByHitsGlb'):
00054     patMuonProducer.addGenMatch = True
00055     patMuonProducer.genParticleMatch = cms.VInputTag(cms.InputTag(label, "toPrimaries"), cms.InputTag(label, "toSecondaries"))
00056