Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 import FWCore.ParameterSet.Config as cms
0002 
0003 process = cms.Process("PATMuon")
0004 
0005 process.load("FWCore.MessageService.MessageLogger_cfi")
0006 process.MessageLogger.cerr.FwkReport.reportEvery = 100
0007 
0008 process.load('Configuration.StandardSequences.Services_cff')
0009 process.load("Configuration.StandardSequences.GeometryDB_cff")
0010 process.load("Configuration.StandardSequences.MagneticField_38T_cff")
0011 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
0012 process.load("Configuration.StandardSequences.Reconstruction_cff")
0013 
0014 process.GlobalTag.globaltag = 'PRE_ST62_V8::All'
0015 
0016 from Configuration.EventContent.EventContent_cff import *
0017 process.source = cms.Source("PoolSource",
0018     fileNames = cms.untracked.vstring(
0019         '/store/relval/CMSSW_6_2_0/RelValTTbar/GEN-SIM-RECO/PU_PRE_ST62_V8-v2/00000/E03F79C5-A7EC-E211-A92E-003048F00520.root',
0020     ),
0021     inputCommands = RECOSIMEventContent.outputCommands,            # keep only RECO out of RAW+RECO, for tests
0022     dropDescendantsOfDroppedBranches = cms.untracked.bool(False),  # keep only RECO out of RAW+RECO, for tests
0023 )
0024 
0025 process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) )
0026 process.options   = cms.untracked.PSet( wantSummary = cms.untracked.bool(True) )
0027 
0028 process.oneGoodVertexFilter = cms.EDFilter("VertexSelector",
0029    src = cms.InputTag("offlinePrimaryVertices"),
0030    cut = cms.string("!isFake && ndof >= 4 && abs(z) <= 15 && position.Rho <= 2"),
0031    filter = cms.bool(True),   # otherwise it won't filter the events, just produce an empty vertex collection.
0032 )
0033 process.noScraping = cms.EDFilter("FilterOutScraping",
0034     applyfilter = cms.untracked.bool(True),
0035     debugOn = cms.untracked.bool(False), ## Or 'True' to get some per-event info
0036     numtrack = cms.untracked.uint32(10),
0037     thresh = cms.untracked.double(0.25)
0038 )
0039 process.countCollisionEvents = cms.EDProducer("EventCountProducer")
0040 process.preFilter = cms.Sequence(process.oneGoodVertexFilter * process.noScraping * process.countCollisionEvents )
0041 
0042 process.mergedTruth = cms.EDProducer("GenPlusSimParticleProducer",
0043         src           = cms.InputTag("g4SimHits"), # use "fastSimProducer" for FastSim
0044         setStatus     = cms.int32(5),             # set status = 5 for GEANT GPs
0045         filter        = cms.vstring("pt > 0.0"),  # just for testing (optional)
0046         genParticles   = cms.InputTag("genParticles") # original genParticle list
0047 )
0048 process.genMuons = cms.EDProducer("GenParticlePruner",
0049     src = cms.InputTag("genParticles"),
0050     select = cms.vstring(
0051         "drop  *  ",                     # this is the default
0052         "++keep abs(pdgId) = 13",        # keep muons and their parents
0053         "drop pdgId == 21 && status = 2" # remove intermediate qcd spam carrying no flavour info
0054     )
0055 )
0056 process.load("PhysicsTools.PatAlgos.mcMatchLayer0.muonMatch_cfi")
0057 
0058 process.filter = cms.EDFilter("CandViewCountFilter",
0059     src = cms.InputTag("muons"),
0060     minNumber = cms.uint32(1),
0061 )
0062 
0063 import PhysicsTools.PatAlgos.producersLayer1.muonProducer_cfi
0064 process.patMuons = PhysicsTools.PatAlgos.producersLayer1.muonProducer_cfi.patMuons.clone(
0065     muonSource = 'muons',
0066     # embed the tracks, so we don't have to carry them around
0067     embedTrack          = True,
0068     embedCombinedMuon   = True,
0069     embedStandAloneMuon = True,
0070     embedPFCandidate    = False,
0071     embedCaloMETMuonCorrs = cms.bool(False),
0072     embedTcMETMuonCorrs   = cms.bool(False),
0073     # then switch off some features we don't need
0074     #addTeVRefits = False, ## <<--- this doesn't work. PAT bug ??
0075     embedPickyMuon = False,
0076     embedTpfmsMuon = False, 
0077     userIsolation = cms.PSet(),   # no extra isolation beyond what's in reco::Muon itself
0078     isoDeposits = cms.PSet(), # no heavy isodeposits
0079     addGenMatch = False,       
0080     embedGenMatch = False,
0081 )
0082 # Reset all these; the default in muonProducer_cfi is not empty, but wrong
0083 process.patMuons.userData.userInts.src    = []
0084 process.patMuons.userData.userFloats.src  = []
0085 process.patMuons.userData.userCands.src   = []
0086 process.patMuons.userData.userClasses.src = []
0087 
0088 process.load("MuonAnalysis.MuonAssociators.muonClassificationByHits_cfi")
0089 
0090 from MuonAnalysis.MuonAssociators.muonClassificationByHits_cfi import addUserData as addClassByHits
0091 addClassByHits(process.patMuons, extraInfo=True)
0092 
0093 # as an example, now we define yet another classification, only for TMLastStationLoose.
0094 # (the selection matters when you define ghosts)
0095 process.classByHitsTMLSLoose = process.classByHitsTM.clone(
0096     muonPreselection = cms.string("muonID('TMLastStationLoose')")
0097 )
0098 addClassByHits(process.patMuons, labels=["classByHitsTMLSLoose"], extraInfo=True)
0099 
0100 
0101 process.go = cms.Path(
0102     process.preFilter +
0103     process.filter    +
0104     ( process.mergedTruth *
0105       process.genMuons    *
0106       process.muonMatch   +
0107       process.muonClassificationByHits +
0108       process.classByHitsTMLSLoose ) *
0109     process.patMuons  
0110 )
0111 
0112 
0113 process.out = cms.OutputModule("PoolOutputModule",
0114     fileName = cms.untracked.string("patMuons_MC.root"),
0115     outputCommands = cms.untracked.vstring(
0116         "drop *",
0117         "keep *_patMuons_*_*",
0118         "keep *_genMuons_*_*",
0119         "keep *_countCollisionEvents_*_*",
0120         "keep recoTrackExtras_standAloneMuons_*_*",          ## track states at the muon system, used both by patMuons and standAloneMuons
0121         "keep recoTracks_standAloneMuons__*",                ## bare standalone muon tracks, using standalone muon momentum (without BS constraint)
0122         "keep edmTriggerResults_*_*_HLT",                    ## 
0123         "keep l1extraL1MuonParticles_l1extraParticles_*_*",  ## 
0124         "keep *_offlinePrimaryVertices__*",                  ## 
0125         "keep *_offlineBeamSpot__*",                         ##
0126     ),
0127     SelectEvents = cms.untracked.PSet( SelectEvents = cms.vstring("go")),
0128 )
0129 process.end = cms.EndPath(process.out)