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 
8 trackingParticlesNoSimHits = mix.clone(
9  digitizers = cms.PSet(
10  mergedtruth = mix.digitizers.mergedtruth.clone(
11  simHitCollections = cms.PSet(
12  pixel = cms.VInputTag(),
13  tracker = cms.VInputTag(),
14  muon = cms.VInputTag(),
15  )
16  ),
17  ),
18  mixObjects = cms.PSet(
19  mixHepMC = mix.mixObjects.mixHepMC.clone(),
20  mixVertices = mix.mixObjects.mixVertices.clone(),
21  mixTracks = mix.mixObjects.mixTracks.clone(),
22  ),
23 )
25 
26 classByHitsTM = cms.EDProducer("MuonMCClassifier",
27  muons = cms.InputTag("muons"),
28  muonPreselection = cms.string("isTrackerMuon"), #
29  #muonPreselection = cms.string("muonID('TrackerMuonArbitrated')"), # You might want this
30  trackType = cms.string("segments"), # or 'inner','outer','global'
31  trackingParticles = cms.InputTag("trackingParticlesNoSimHits","MergedTrackTruth"),
32  associatorLabel = cms.string("muonAssociatorByHitsNoSimHitsHelper"),
33  decayRho = cms.double(200), # to classifiy differently decay muons included in ppMuX
34  decayAbsZ = cms.double(400), # and decay muons that could not be in ppMuX
35  linkToGenParticles = cms.bool(True), # produce also a collection of GenParticles for secondary muons
36  genParticles = cms.InputTag("genParticles"), # and associations to primary and secondaries
37 )
38 classByHitsTMLSAT = classByHitsTM.clone(
39  muonPreselection = cms.string("muonID('TMLastStationAngTight')")
40 )
41 classByHitsGlb = classByHitsTM.clone(
42  muonPreselection = cms.string("isGlobalMuon"),
43  trackType = "global"
44 )
45 classByHitsSta = classByHitsTM.clone(
46  muonPreselection = cms.string("isStandAloneMuon"),
47  trackType = "outer"
48 )
49 
50 
51 muonClassificationByHits = cms.Sequence(
52  #mix +
53  trackingParticlesNoSimHits +
54  muonAssociatorByHitsNoSimHitsHelper +
55  ( classByHitsTM +
56  classByHitsTMLSAT +
57  classByHitsGlb +
58  classByHitsSta )
59 )
60 def addUserData(patMuonProducer,labels=['classByHitsGlb', 'classByHitsTM', 'classByHitsTMLSAT', 'classByHitsSta'], extraInfo = False):
61  for label in labels:
62  patMuonProducer.userData.userInts.src.append( cms.InputTag(label) )
63  patMuonProducer.userData.userInts.src.append( cms.InputTag(label, "ext") )
64  if extraInfo:
65  for ints in ("flav", "hitsPdgId", "momPdgId", "gmomPdgId", "momFlav", "gmomFlav", "hmomFlav", "tpId", "momStatus"):
66  patMuonProducer.userData.userInts.src.append(cms.InputTag(label, ints))
67  for ins in ("prodRho", "prodZ", "tpAssoQuality", "momRho", "momZ"):
68  patMuonProducer.userData.userFloats.src.append(cms.InputTag(label, ins))
69 def addGenParticleRef(patMuonProducer, label = 'classByHitsGlb'):
70  patMuonProducer.addGenMatch = True
71  patMuonProducer.genParticleMatch = cms.VInputTag(cms.InputTag(label, "toPrimaries"), cms.InputTag(label, "toSecondaries"))
72