Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
from builtins import range
import FWCore.ParameterSet.Config as cms

# define binning for efficiency plots
# pt
import itertools
effVsPtBins=list(itertools.chain(range(0, 30, 1), range(30, 50, 2), 
                                 range(50, 70, 5), range(70, 100, 10), 
                                 range(100, 200, 25), range(200, 300, 50), 
                                 range(300, 500, 100), range(500, 700, 200), 
                                 range(700, 1000, 300)))
effVsPtBins.append(1000)

# phi
nPhiBins = 34
phiMin = -3.4
phiMax = 3.4
effVsPhiBins = [i*(phiMax-phiMin)/nPhiBins + phiMin for i in range(nPhiBins+1)]

# eta
nEtaBins = 50
etaMin = -2.5
etaMax = 2.5
effVsEtaBins = [i*(etaMax-etaMin)/nEtaBins + etaMin for i in range(nEtaBins+1)]

# vtx
effVsVtxBins = range(0, 101)

# A list of pt cut + quality cut pairs for which efficiency plots should be made
ptQualCuts = [[22, 12], [15, 8], [7, 8], [3, 4]]
cutsPSets = []
for ptQualCut in ptQualCuts:
    cutsPSets.append(cms.untracked.PSet(ptCut = cms.untracked.int32(ptQualCut[0]),
                                        qualCut = cms.untracked.int32(ptQualCut[1])))

from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer
l1tMuonDQMOffline = DQMEDAnalyzer('L1TMuonDQMOffline',
    histFolder = cms.untracked.string('L1T/L1TObjects/L1TMuon/L1TriggerVsReco'),
    tagPtCut = cms.untracked.double(26.),
    recoToL1PtCutFactor = cms.untracked.double(1.2),
    cuts = cms.untracked.VPSet(cutsPSets),
    useL1AtVtxCoord = cms.untracked.bool(False),

    muonInputTag = cms.untracked.InputTag("muons"),
    gmtInputTag  = cms.untracked.InputTag("gmtStage2Digis","Muon"),
    vtxInputTag = cms.untracked.InputTag("offlinePrimaryVertices"),
    bsInputTag  = cms.untracked.InputTag("offlineBeamSpot"),

    triggerNames = cms.untracked.vstring(
        "HLT_IsoMu27_v*",
        "HLT_IsoMu30_v*"
    ),
    trigInputTag       = cms.untracked.InputTag("hltTriggerSummaryAOD", "", "HLT"),
    trigProcess        = cms.untracked.string("HLT"),
    trigProcess_token  = cms.untracked.InputTag("TriggerResults","","HLT"),

    efficiencyVsPtBins = cms.untracked.vdouble(effVsPtBins),
    efficiencyVsPhiBins = cms.untracked.vdouble(effVsPhiBins),
    efficiencyVsEtaBins = cms.untracked.vdouble(effVsEtaBins),
    efficiencyVsVtxBins = cms.untracked.vdouble(effVsVtxBins),

    # muon track extrapolation to 2nd station
    muProp = cms.PSet(
        useTrack = cms.string("tracker"),  # 'none' to use Candidate P4; or 'tracker', 'muon', 'global'
        useState = cms.string("atVertex"), # 'innermost' and 'outermost' require the TrackExtra
        useSimpleGeometry = cms.bool(True),
        useStation2 = cms.bool(True),
        fallbackToME1 = cms.bool(False),
        cosmicPropagationHypothesis = cms.bool(False),
        useMB2InOverlap = cms.bool(False),
        propagatorAlong = cms.ESInputTag("", "SteppingHelixPropagatorAlong"),
        propagatorAny = cms.ESInputTag("", "SteppingHelixPropagatorAny"),
        propagatorOpposite = cms.ESInputTag("", "SteppingHelixPropagatorOpposite")	
    ),

    verbose   = cms.untracked.bool(False)
)

# emulator module
l1tMuonDQMOfflineEmu = l1tMuonDQMOffline.clone(
    gmtInputTag  = "simGmtStage2Digis",
    histFolder = 'L1TEMU/L1TObjects/L1TMuon/L1TriggerVsReco'
)

# modifications for the pp reference run
# A list of pt cut + quality cut pairs for which efficiency plots should be made
ptQualCuts_HI = [[12, 12], [7, 8], [5, 4]]
cutsPSets_HI = []
for ptQualCut in ptQualCuts_HI:
    cutsPSets_HI.append(cms.untracked.PSet(ptCut = cms.untracked.int32(ptQualCut[0]),
                                           qualCut = cms.untracked.int32(ptQualCut[1])))
from Configuration.Eras.Modifier_ppRef_2017_cff import ppRef_2017
ppRef_2017.toModify(l1tMuonDQMOffline,
    tagPtCut = cms.untracked.double(14.),
    cuts = cms.untracked.VPSet(cutsPSets_HI),
    triggerNames = cms.untracked.vstring(
        "HLT_HIL3Mu12_v*",
    )
)
ppRef_2017.toModify(l1tMuonDQMOfflineEmu,
    tagPtCut = cms.untracked.double(14.),
    cuts = cms.untracked.VPSet(cutsPSets_HI),
    triggerNames = cms.untracked.vstring(
        "HLT_HIL3Mu12_v*",
    )
)