Example #1
0
from MuonAnalysis.Examples.inclusiveMuonPlots_cfi import makeInclusiveMuonPlots;
commonInputs = cms.PSet(
    muons     = cms.InputTag('patMuonsWithTrigger'),
    onlyLeadingMuon = cms.bool(True),
    old36Xdata      = cms.bool(False),
    primaryVertices = cms.InputTag("offlinePrimaryVertices"),
    doTrackExtrapolations = cms.bool(False),
    extraPlots      = cms.bool(True),
    jets            = cms.InputTag("ak5PFJets"),
    met             = cms.InputTag("pfMet"),
)

CSEL="pt > 20 && (!triggerObjectMatchesByPath('HLT_Mu9').empty() || !triggerObjectMatchesByPath('HLT_Mu15_v1').empty()) && "
process.trackerMuons = cms.EDAnalyzer("InclusiveMuonPlots",
    makeInclusiveMuonPlots(ptScale=3),
    commonInputs,
    selection = cms.string(CSEL+"isTrackerMuon") # && muonID('TMLastStationAngTight')"),
)
addAliases(process, "trackerMuons")

process.globalMuons = process.trackerMuons.clone(selection = CSEL+"isGlobalMuon")
addAliases(process, "globalMuons")

if False:
    process.standAloneMuons   = process.trackerMuons.clone(selection = CSEL+"isStandAloneMuon")
    process.standAloneMuonsVH = process.trackerMuons.clone(selection = CSEL+"isStandAloneMuon && outerTrack.numberOfValidHits > 0")
    addAliases(process, "standAloneMuons")
    addAliases(process, "standAloneMuonsVH")

                cms.Path(sum(modules, process.preFilter + process.bscMinBias)))
        else:
            setattr(process, label + "_Classes",
                    cms.Path(sum(modules, process.preFilter)))


from MuonAnalysis.Examples.inclusiveMuonPlots_cfi import makeInclusiveMuonPlots
commonInputs = cms.PSet(
    muons=cms.InputTag('patMuonsWithTrigger'),
    onlyLeadingMuon=cms.bool(False),
    primaryVertices=cms.InputTag("offlinePrimaryVertices"),
)

process.trackerMuons = cms.EDAnalyzer(
    "InclusiveMuonPlots",
    makeInclusiveMuonPlots(),
    commonInputs,
    selection=cms.string("isTrackerMuon && muonID('TMLastStationAngTight')"),
)
addClassAliases(process, "trackerMuons", "classByHitsTMLSAT")

process.globalMuons = process.trackerMuons.clone(selection="isGlobalMuon")
addClassAliases(process, "globalMuons", "classByHitsGlb")

process.standAloneMuons = process.trackerMuons.clone(
    selection="isStandAloneMuon")
process.standAloneMuonsVH = process.trackerMuons.clone(
    selection="isStandAloneMuon && outerTrack.numberOfValidHits > 0")
addClassAliases(process, "standAloneMuons", "classByHitsSta")
addClassAliases(process, "standAloneMuonsVH", "classByHitsSta")
## trigger_match = '(' \
##                 ' triggerMatchesByPath("HLT_Mu9").at(0).pt() > 15) || ' \
##                 '!triggerObjectMatchesByPath("HLT_Mu15_v1").empty()' \
##                 ')'

trigger_match = ' '

my_cut = ' && isTrackerMuon ' \
         ' &&  innerTrack.pt > 20. '

tight_cut = loose_cut + my_cut + trigger_match

from MuonAnalysis.Examples.inclusiveMuonPlots_cfi import makeInclusiveMuonPlots
process.globalMuons = cms.EDAnalyzer(
    "InclusiveMuonPlots",
    makeInclusiveMuonPlots(0.4, 20.),
    # muons     = cms.InputTag('selectedPatMuons',''),
    muons=cms.InputTag('patMuonsWithTrigger', ''),
    selection=cms.string("isGlobalMuon"),
    onlyLeadingMuon=cms.bool(False),
    primaryVertices=cms.InputTag("offlinePrimaryVertices"),
)

## Now we make the sub-plots with classification by hits
process.globalMuonsGhost = process.globalMuons.clone(
    selection="isGlobalMuon && (-5 <= userInt('classByHitsGlb') <= -1)")
process.globalMuonsPunch = process.globalMuons.clone(
    selection="isGlobalMuon && ( 0 <= userInt('classByHitsGlb') <=  1)")
process.globalMuonsLight = process.globalMuons.clone(
    selection="isGlobalMuon && (userInt('classByHitsGlb') == 2)")
process.globalMuonsHeavy = process.globalMuons.clone(
    setattr(process, label+"B", mbar);
    setattr(process, label+"E", mec );
    if requireMB:
        setattr(process, label+"_Plots", cms.Path(process.preFilter + process.bscMinBias + module + mbar + mec)) 
    else:
        setattr(process, label+"_Plots", cms.Path(process.preFilter + module + mbar + mec))

from MuonAnalysis.Examples.inclusiveMuonPlots_cfi import makeInclusiveMuonPlots;
commonInputs = cms.PSet(
    muons     = cms.InputTag('patMuonsWithTrigger'),
    onlyLeadingMuon = cms.bool(False),
    primaryVertices = cms.InputTag("offlinePrimaryVertices"),
)

process.trackerMuons = cms.EDAnalyzer("InclusiveMuonPlots",
    makeInclusiveMuonPlots(),
    commonInputs,
    selection = cms.string("isTrackerMuon && muonID('TMLastStationAngTight')"),
)
addPlots(process, "trackerMuons")

process.globalMuons = process.trackerMuons.clone(selection = "isGlobalMuon")
addPlots(process, "globalMuons")

process.standAloneMuons   = process.trackerMuons.clone(selection = "isStandAloneMuon")
process.standAloneMuonsVH = process.trackerMuons.clone(selection = "isStandAloneMuon && outerTrack.numberOfValidHits > 0")
addPlots(process, "standAloneMuons")
addPlots(process, "standAloneMuonsVH")

if True:
    process.globalMuonsPt3 = process.globalMuons.clone(