test
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("muonAssociatorByHits_NoSimHits"),
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  ( classByHitsTM +
55  classByHitsTMLSAT +
56  classByHitsGlb +
57  classByHitsSta )
58 )
59 def addUserData(patMuonProducer,labels=['classByHitsGlb', 'classByHitsTM', 'classByHitsTMLSAT', 'classByHitsSta'], extraInfo = False):
60  for label in labels:
61  patMuonProducer.userData.userInts.src.append( cms.InputTag(label) )
62  patMuonProducer.userData.userInts.src.append( cms.InputTag(label, "ext") )
63  if extraInfo:
64  for ints in ("flav", "hitsPdgId", "momPdgId", "gmomPdgId", "momFlav", "gmomFlav", "hmomFlav", "tpId", "momStatus"):
65  patMuonProducer.userData.userInts.src.append(cms.InputTag(label, ints))
66  for ins in ("prodRho", "prodZ", "tpAssoQuality", "momRho", "momZ"):
67  patMuonProducer.userData.userFloats.src.append(cms.InputTag(label, ins))
68 def addGenParticleRef(patMuonProducer, label = 'classByHitsGlb'):
69  patMuonProducer.addGenMatch = True
70  patMuonProducer.genParticleMatch = cms.VInputTag(cms.InputTag(label, "toPrimaries"), cms.InputTag(label, "toSecondaries"))
71