CMS 3D CMS Logo

muonClassificationByHitsTP_cfi.py
Go to the documentation of this file.
1 ### Add MC classification by hits
2 ### Note: this cfi needs TrackingParticle collection from the Event
3 
5 
6 classByHitsTM = cms.EDProducer("MuonMCClassifier",
7  muons = cms.InputTag("muons"),
8  muonPreselection = cms.string("muonID('TrackerMuonArbitrated')"), # definition of "duplicates" depends on the preselection
9  trackType = cms.string("segments"), # 'inner','outer','global','segments','glb_or_trk'
10  trackingParticles = cms.InputTag("mix","MergedTrackTruth"), # default TrackingParticle collection (should exist in the Event)
11  associatorLabel = cms.InputTag("muonAssociatorByHitsNoSimHitsHelper"),
12  decayRho = cms.double(200), # to classify differently decay muons included in ppMuX
13  decayAbsZ = cms.double(400), # and decay muons that could not be in ppMuX
14  linkToGenParticles = cms.bool(True), # produce also a collection of GenParticles for secondary muons
15  genParticles = cms.InputTag("genParticles"), # and associations to primary and secondaries
16 )
17 classByHitsTMLSAT = classByHitsTM.clone(
18  muonPreselection = cms.string("muonID('TMLastStationAngTight')")
19 )
20 classByHitsGlb = classByHitsTM.clone(
21  muonPreselection = cms.string("isGlobalMuon"),
22  trackType = "global"
23 )
24 classByHitsSta = classByHitsTM.clone(
25  muonPreselection = cms.string("isStandAloneMuon"),
26  trackType = "outer"
27 )
28 classByHitsGlbOrTrk = classByHitsTM.clone(
29  muonPreselection = cms.string("isGlobalMuon || muonID('TrackerMuonArbitrated')"),
30  trackType = "glb_or_trk"
31 )
32 
33 
34 muonClassificationByHits = cms.Sequence(
35  muonAssociatorByHitsNoSimHitsHelper +
36  (
37 # classByHitsTM +
38 # classByHitsTMLSAT +
39 # classByHitsGlb +
40 # classByHitsSta +
41  classByHitsGlbOrTrk
42  )
43 )
44 #def addUserData(patMuonProducer,labels=['classByHitsTM', 'classByHitsSta', 'classByHitsGlbOrTrk'], extraInfo = False):
45 def addUserData(patMuonProducer,labels=['classByHitsGlbOrTrk'], extraInfo = False):
46  for label in labels:
47  patMuonProducer.userData.userInts.src.append( cms.InputTag(label) )
48  patMuonProducer.userData.userInts.src.append( cms.InputTag(label, "ext") )
49  if extraInfo:
50  for ints in ("flav", "hitsPdgId", "G4processType", "momPdgId", "gmomPdgId", "momFlav", "gmomFlav", "hmomFlav", "tpId", "tpBx", "tpEv", "momStatus"):
51  patMuonProducer.userData.userInts.src.append(cms.InputTag(label, ints))
52  for ins in ("signp", "pt", "eta", "phi", "prodRho", "prodZ", "tpAssoQuality", "momRho", "momZ"):
53 
54  patMuonProducer.userData.userFloats.src.append(cms.InputTag(label, ins))
55 
56 def addGenParticleRef(patMuonProducer, label = 'classByHitsGlbOrTrk'):
57  patMuonProducer.addGenMatch = True
58  patMuonProducer.genParticleMatch = cms.VInputTag(cms.InputTag(label, "toPrimaries"), cms.InputTag(label, "toSecondaries"))
59 
def addUserData(patMuonProducer, labels=['classByHitsGlbOrTrk'], extraInfo=False)
def addGenParticleRef(patMuonProducer, label='classByHitsGlbOrTrk')