CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
muonClassificationByHits_cfi.py
Go to the documentation of this file.
1 ### Add MC classification by hits
2 # Requires:
3 # SimGeneral/TrackingAnalysis V04-01-05 (35X+)
4 # SimTracker/TrackAssociation V01-08-17 (35X+)
5 # SimMuon/MCTruth V02-05-00-03 (35X) or V02-06-00+ (37X+)
6 
10 
11 classByHitsTM = cms.EDProducer("MuonMCClassifier",
12  muons = cms.InputTag("muons"),
13  muonPreselection = cms.string("isTrackerMuon"), #
14  #muonPreselection = cms.string("muonID('TrackerMuonArbitrated')"), # You might want this
15  trackType = cms.string("segments"), # or 'inner','outer','global'
16  trackingParticles = cms.InputTag("mergedtruthNoSimHits"),
17  associatorLabel = cms.string("muonAssociatorByHits_NoSimHits"),
18  decayRho = cms.double(200), # to classifiy differently decay muons included in ppMuX
19  decayAbsZ = cms.double(400), # and decay muons that could not be in ppMuX
20  linkToGenParticles = cms.bool(True), # produce also a collection of GenParticles for secondary muons
21  genParticles = cms.InputTag("genParticles"), # and associations to primary and secondaries
22 )
23 classByHitsTMLSAT = classByHitsTM.clone(
24  muonPreselection = cms.string("muonID('TMLastStationAngTight')")
25 )
26 classByHitsGlb = classByHitsTM.clone(
27  muonPreselection = cms.string("isGlobalMuon"),
28  trackType = "global"
29 )
30 classByHitsSta = classByHitsTM.clone(
31  muonPreselection = cms.string("isStandAloneMuon"),
32  trackType = "outer"
33 )
34 
35 
36 muonClassificationByHits = cms.Sequence(
37  mix +
38  trackingParticlesNoSimHits +
39  ( classByHitsTM +
40  classByHitsTMLSAT +
41  classByHitsGlb +
42  classByHitsSta )
43 )
44 def addUserData(patMuonProducer,labels=['classByHitsGlb', 'classByHitsTM', 'classByHitsTMLSAT', 'classByHitsSta'], extraInfo = False):
45  for label in labels:
46  patMuonProducer.userData.userInts.src.append( cms.InputTag(label) )
47  patMuonProducer.userData.userInts.src.append( cms.InputTag(label, "ext") )
48  if extraInfo:
49  for ints in ("flav", "hitsPdgId", "momPdgId", "gmomPdgId", "momFlav", "gmomFlav", "hmomFlav", "tpId", "momStatus"):
50  patMuonProducer.userData.userInts.src.append(cms.InputTag(label, ints))
51  for ins in ("prodRho", "prodZ", "tpAssoQuality", "momRho", "momZ"):
52  patMuonProducer.userData.userFloats.src.append(cms.InputTag(label, ins))
53 def addGenParticleRef(patMuonProducer, label = 'classByHitsGlb'):
54  patMuonProducer.addGenMatch = True
55  patMuonProducer.genParticleMatch = cms.VInputTag(cms.InputTag(label, "toPrimaries"), cms.InputTag(label, "toSecondaries"))
56