Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:22:48

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