Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:31:43

0001 ### Add MC classification by hits
0002 ### Note: this cfi needs TrackingParticle collection from the Event
0003  
0004 from SimMuon.MCTruth.muonAssociatorByHitsNoSimHitsHelper_cfi import * 
0005 
0006 classByHitsTM = cms.EDProducer("MuonMCClassifier",
0007     muons = cms.InputTag("muons"),
0008     muonPreselection = cms.string("muonID('TrackerMuonArbitrated')"), # definition of "duplicates" depends on the preselection
0009     trackType = cms.string("segments"),  # 'inner','outer','global','segments','glb_or_trk'
0010     trackingParticles = cms.InputTag("mix","MergedTrackTruth"), # default TrackingParticle collection (should exist in the Event)      
0011     associatorLabel   = cms.InputTag("muonAssociatorByHitsNoSimHitsHelper"),
0012     decayRho  = cms.double(200), # to classify differently decay muons included in ppMuX
0013     decayAbsZ = cms.double(400), # and decay muons that could not be in ppMuX
0014     linkToGenParticles = cms.bool(True),          # produce also a collection of GenParticles for secondary muons
0015     genParticles = cms.InputTag("genParticles"),  # and associations to primary and secondaries
0016 )
0017 classByHitsTMLSAT = classByHitsTM.clone(
0018     muonPreselection = cms.string("muonID('TMLastStationAngTight')")
0019 )
0020 classByHitsGlb = classByHitsTM.clone(
0021     muonPreselection = cms.string("isGlobalMuon"),
0022     trackType = "global"
0023 )
0024 classByHitsSta = classByHitsTM.clone(
0025     muonPreselection = cms.string("isStandAloneMuon"),
0026     trackType = "outer"
0027 )
0028 classByHitsGlbOrTrk = classByHitsTM.clone(
0029     muonPreselection = cms.string("isGlobalMuon || muonID('TrackerMuonArbitrated')"),
0030     trackType = "glb_or_trk"
0031 )
0032 
0033 
0034 muonClassificationByHits = cms.Sequence(
0035     muonAssociatorByHitsNoSimHitsHelper +
0036     ( 
0037 #      classByHitsTM      +
0038 #      classByHitsTMLSAT  +
0039 #      classByHitsGlb     +  
0040 #      classByHitsSta     +
0041       classByHitsGlbOrTrk
0042     )
0043 )
0044 #def addUserData(patMuonProducer,labels=['classByHitsTM', 'classByHitsSta', 'classByHitsGlbOrTrk'], extraInfo = False):
0045 def addUserData(patMuonProducer,labels=['classByHitsGlbOrTrk'], extraInfo = False):
0046     for label in labels:
0047         patMuonProducer.userData.userInts.src.append( cms.InputTag(label) )
0048         patMuonProducer.userData.userInts.src.append( cms.InputTag(label, "ext") )
0049         if extraInfo:
0050             for ints in ("flav", "hitsPdgId", "G4processType", "momPdgId", "gmomPdgId", "momFlav", "gmomFlav", "hmomFlav", "tpId", "tpBx", "tpEv", "momStatus"):
0051                 patMuonProducer.userData.userInts.src.append(cms.InputTag(label, ints))
0052             for ins in ("signp", "pt", "eta", "phi", "prodRho", "prodZ", "tpAssoQuality", "momRho", "momZ"):
0053 
0054                 patMuonProducer.userData.userFloats.src.append(cms.InputTag(label, ins))
0055 
0056 def addGenParticleRef(patMuonProducer, label = 'classByHitsGlbOrTrk'):
0057     patMuonProducer.addGenMatch = True
0058     patMuonProducer.genParticleMatch = cms.VInputTag(cms.InputTag(label, "toPrimaries"), cms.InputTag(label, "toSecondaries"))
0059