CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
muonClassificationByHits_cfi.py
Go to the documentation of this file.
1 ### Add MC classification by hits
2 
4 
5 trackingParticlesNoSimHits = mix.clone(
6  digitizers = cms.PSet(
7  mergedtruth = theDigitizersValid.mergedtruth.clone(
8  simHitCollections = cms.PSet(
9  pixel = cms.VInputTag(),
10  tracker = cms.VInputTag(),
11  muon = cms.VInputTag(),
12  )
13  ),
14  ),
15  mixObjects = cms.PSet(
16  mixHepMC = mix.mixObjects.mixHepMC.clone(),
17  mixVertices = mix.mixObjects.mixVertices.clone(),
18  mixTracks = mix.mixObjects.mixTracks.clone(),
19  ),
20 )
21 
23 
24 classByHitsTM = cms.EDProducer("MuonMCClassifier",
25  muons = cms.InputTag("muons"),
26  muonPreselection = cms.string("muonID('TrackerMuonArbitrated')"), # definition of "duplicates" depends on the preselection
27  trackType = cms.string("segments"), # 'inner','outer','global','segments','glb_or_trk'
28  trackingParticles = cms.InputTag("trackingParticlesNoSimHits","MergedTrackTruth"),
29  associatorLabel = cms.InputTag("muonAssociatorByHitsNoSimHitsHelper"),
30  decayRho = cms.double(200), # to classify differently decay muons included in ppMuX
31  decayAbsZ = cms.double(400), # and decay muons that could not be in ppMuX
32  linkToGenParticles = cms.bool(True), # produce also a collection of GenParticles for secondary muons
33  genParticles = cms.InputTag("genParticles"), # and associations to primary and secondaries
34 )
35 classByHitsTMLSAT = classByHitsTM.clone(
36  muonPreselection = cms.string("muonID('TMLastStationAngTight')")
37 )
38 classByHitsGlb = classByHitsTM.clone(
39  muonPreselection = cms.string("isGlobalMuon"),
40  trackType = "global"
41 )
42 classByHitsSta = classByHitsTM.clone(
43  muonPreselection = cms.string("isStandAloneMuon"),
44  trackType = "outer"
45 )
46 classByHitsGlbOrTrk = classByHitsTM.clone(
47  muonPreselection = cms.string("isGlobalMuon || muonID('TrackerMuonArbitrated')"),
48  trackType = "glb_or_trk"
49 )
50 
51 
52 muonClassificationByHits = cms.Sequence(
53  trackingParticlesNoSimHits +
54  muonAssociatorByHitsNoSimHitsHelper +
55  (
56 # classByHitsTM +
57 # classByHitsTMLSAT +
58 # classByHitsGlb +
59 # classByHitsSta +
60  classByHitsGlbOrTrk
61  )
62 )
63 #def addUserData(patMuonProducer,labels=['classByHitsTM', 'classByHitsSta', 'classByHitsGlbOrTrk'], extraInfo = False):
64 def addUserData(patMuonProducer,labels=['classByHitsGlbOrTrk'], extraInfo = False):
65  for label in labels:
66  patMuonProducer.userData.userInts.src.append( cms.InputTag(label) )
67  patMuonProducer.userData.userInts.src.append( cms.InputTag(label, "ext") )
68  if extraInfo:
69  for ints in ("flav", "hitsPdgId", "G4processType", "momPdgId", "gmomPdgId", "momFlav", "gmomFlav", "hmomFlav", "tpId", "tpBx", "tpEv", "momStatus"):
70  patMuonProducer.userData.userInts.src.append(cms.InputTag(label, ints))
71  for ins in ("signp", "pt", "eta", "phi", "prodRho", "prodZ", "tpAssoQuality", "momRho", "momZ"):
72 
73  patMuonProducer.userData.userFloats.src.append(cms.InputTag(label, ins))
74 
75 def addGenParticleRef(patMuonProducer, label = 'classByHitsGlbOrTrk'):
76  patMuonProducer.addGenMatch = True
77  patMuonProducer.genParticleMatch = cms.VInputTag(cms.InputTag(label, "toPrimaries"), cms.InputTag(label, "toSecondaries"))
78