CMS 3D CMS Logo

nanoDQM_cff.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 import copy
3 
4 from PhysicsTools.NanoAOD.nanoDQM_cfi import nanoDQM
7 
8 ## Modify plots accordingly to era
9 _vplots80X = nanoDQM.vplots.clone()
10 # Tau plots
11 (run2_miniAOD_80XLegacy | run2_nanoAOD_92X | run2_nanoAOD_94XMiniAODv1 | run2_nanoAOD_94X2016 | run2_nanoAOD_94XMiniAODv2 | run2_nanoAOD_102Xv1 | run2_nanoAOD_106Xv1).toModify(nanoDQM.vplots, boostedTau = None)
12 _tauPlots80X = cms.VPSet()
13 for plot in _vplots80X.Tau.plots:
14  if (plot.name.value().find("MVA")>-1 and plot.name.value().find("2017")>-1) or (plot.name.value().find("AntiEle")>-1 and plot.name.value().find("2018")>-1):
15  continue
16  _tauPlots80X.append(plot)
17 _tauPlots80X.append(Plot1D('idMVAnewDM', 'idMVAnewDM', 64, -0.5, 63.5, 'IsolationMVArun2v1DBnewDMwLT ID working point: bitmask 1 = VLoose, 2 = Loose, 4 = Medium, 8 = Tight, 16 = VTight, 32 = VVTight'))
18 _tauPlots80X.append(Plot1D('idMVAoldDMdR03', 'idMVAoldDMdR03', 64, -0.5, 63.5, 'IsolationMVArun2v1DBdR03oldDMwLT ID working point: bitmask 1 = VLoose, 2 = Loose, 4 = Medium, 8 = Tight, 16 = VTight, 32 = VVTight'))
19 _tauPlots80X.append(Plot1D('rawMVAnewDM', 'rawMVAnewDM', 20, -1, 1, 'byIsolationMVArun2v1DBnewDMwLT raw output discriminator'))
20 _tauPlots80X.append(Plot1D('rawMVAoldDMdR03', 'rawMVAoldDMdR03', 20, -1, 1, 'byIsolationMVArun2v1DBdR03oldDMwLT raw output discriminator'))
21 _vplots80X.Tau.plots = _tauPlots80X
22 run2_miniAOD_80XLegacy.toModify(nanoDQM,
23  vplots = _vplots80X
24 )
25 _tauPlotsPreV9 = cms.VPSet()
26 for plot in nanoDQM.vplots.Tau.plots:
27  if plot.name.value()!="idDecayModeOldDMs":
28  _tauPlotsPreV9.append(plot)
29 _tauPlotsPreV9.extend([
30  Plot1D('idDecayMode', 'idDecayMode', 2, -0.5, 1.5, "tauID('decayModeFinding')"),
31  Plot1D('idDecayModeNewDMs', 'idDecayModeNewDMs', 2, -0.5, 1.5, "tauID('decayModeFindingNewDMs')"),
32  Plot1D('idMVAnewDM2017v2', 'idMVAnewDM2017v2', 128, -0.5, 127.5, 'IsolationMVArun2v1DBnewDMwLT ID working point (2017v2): bitmask 1 = VVLoose, 2 = VLoose, 4 = Loose, 8 = Medium, 16 = Tight, 32 = VTight, 64 = VVTight'),
33  Plot1D('idMVAoldDM', 'idMVAoldDM', 64, -0.5, 63.5, 'IsolationMVArun2v1DBoldDMwLT ID working point: bitmask 1 = VLoose, 2 = Loose, 4 = Medium, 8 = Tight, 16 = VTight, 32 = VVTight'),
34  Plot1D('idMVAoldDM2017v1', 'idMVAoldDM2017v1', 128, -0.5, 127.5, 'IsolationMVArun2v1DBoldDMwLT ID working point (2017v1): bitmask 1 = VVLoose, 2 = VLoose, 4 = Loose, 8 = Medium, 16 = Tight, 32 = VTight, 64 = VVTight'),
35  Plot1D('idMVAoldDM2017v2', 'idMVAoldDM2017v2', 128, -0.5, 127.5, 'IsolationMVArun2v1DBoldDMwLT ID working point (2017v2): bitmask 1 = VVLoose, 2 = VLoose, 4 = Loose, 8 = Medium, 16 = Tight, 32 = VTight, 64 = VVTight'),
36  Plot1D('idMVAoldDMdR032017v2', 'idMVAoldDMdR032017v2', 128, -0.5, 127.5, 'IsolationMVArun2v1DBdR03oldDMwLT ID working point (217v2): bitmask 1 = VVLoose, 2 = VLoose, 4 = Loose, 8 = Medium, 16 = Tight, 32 = VTight, 64 = VVTight'),
37  Plot1D('rawAntiEle', 'rawAntiEle', 20, -100, 100, 'Anti-electron MVA discriminator V6 raw output discriminator'),
38  Plot1D('rawAntiEle2018', 'rawAntiEle2018', 20, -100, 100, 'Anti-electron MVA discriminator V6 raw output discriminator (2018)'),
39  Plot1D('rawAntiEleCat', 'rawAntiEleCat', 17, -1.5, 15.5, 'Anti-electron MVA discriminator V6 category'),
40  Plot1D('rawAntiEleCat2018', 'rawAntiEleCat2018', 17, -1.5, 15.5, 'Anti-electron MVA discriminator V6 category (2018)'),
41  Plot1D('rawMVAnewDM2017v2', 'rawMVAnewDM2017v2', 20, -1, 1, 'byIsolationMVArun2v1DBnewDMwLT raw output discriminator (2017v2)'),
42  Plot1D('rawMVAoldDM', 'rawMVAoldDM', 20, -1, 1, 'byIsolationMVArun2v1DBoldDMwLT raw output discriminator'),
43  Plot1D('rawMVAoldDM2017v1', 'rawMVAoldDM2017v1', 20, -1, 1, 'byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2017v1)'),
44  Plot1D('rawMVAoldDM2017v2', 'rawMVAoldDM2017v2', 20, -1, 1, 'byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2017v2)'),
45  Plot1D('rawMVAoldDMdR032017v2', 'rawMVAoldDMdR032017v2', 20, -1, 1, 'byIsolationMVArun2v1DBdR03oldDMwLT raw output discriminator (2017v2)')
46 ])
47 (run2_nanoAOD_92X | run2_nanoAOD_94XMiniAODv1 | run2_nanoAOD_94XMiniAODv2 | run2_nanoAOD_94X2016 | run2_nanoAOD_102Xv1 | run2_nanoAOD_106Xv1).toModify(nanoDQM.vplots.Tau, plots = _tauPlotsPreV9)
48 
49 _METFixEE2017_DQMentry = nanoDQM.vplots.MET.clone()
50 _METFixEE2017_plots = cms.VPSet()
51 for plot in _METFixEE2017_DQMentry.plots:
52  if plot.name.value().find("fiducial")>-1: continue
53  _METFixEE2017_plots.append(plot)
54 _METFixEE2017_DQMentry.plots = _METFixEE2017_plots
55 for modifier in run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2:
56  modifier.toModify(nanoDQM.vplots, METFixEE2017 = _METFixEE2017_DQMentry)
57 
58 _Electron_plots_2016 = copy.deepcopy(nanoDQM.vplots.Electron.plots)
59 _Electron_plots_2016.append(Plot1D('cutBased_HLTPreSel', 'cutBased_HLTPreSel', 2, -0.5, 1.5, 'cut-based HLT pre-selection ID'))
60 _Electron_plots_2016.append(Plot1D('cutBased_Spring15', 'cutBased_Spring15', 5, -0.5, 4.5, 'cut-based Spring15 ID (0:fail, 1:veto, 2:loose, 3:medium, 4:tight)'))
61 _Electron_plots_2016.append(Plot1D('mvaSpring16GP', 'mvaSpring16GP', 20, -1, 1, 'MVA Spring16 general-purpose ID score'))
62 _Electron_plots_2016.append(Plot1D('mvaSpring16GP_WP80', 'mvaSpring16GP_WP80', 2, -0.5, 1.5, 'MVA Spring16 general-purpose ID WP80'))
63 _Electron_plots_2016.append(Plot1D('mvaSpring16GP_WP90', 'mvaSpring16GP_WP90', 2, -0.5, 1.5, 'MVA Spring16 general-purpose ID WP90'))
64 _Electron_plots_2016.append(Plot1D('mvaSpring16HZZ', 'mvaSpring16HZZ', 20, -1, 1, 'MVA Spring16 HZZ ID score'))
65 _Electron_plots_2016.append(Plot1D('mvaSpring16HZZ_WPL', 'mvaSpring16HZZ_WPL', 2, -0.5, 1.5, 'MVA Spring16 HZZ ID loose WP'))
66 _Electron_plots_2016.append(NoPlot('vidNestedWPBitmapSpring15'))
67 
68 #putting back the fall17V1 plots for non v9 case
69 _Electron_plots_withFall17V1 = copy.deepcopy(nanoDQM.vplots.Electron.plots)
70 _Electron_plots_withFall17V1.append(Plot1D('cutBased_Fall17_V1', 'cutBased_Fall17_V1', 5, -0.5, 4.5, 'cut-based ID Fall17 V1 (0:fail, 1:veto, 2:loose, 3:medium, 4:tight)'))
71 _Electron_plots_withFall17V1.append(Plot1D('mvaFall17V1Iso', 'mvaFall17V1Iso', 20, -1, 1, 'MVA Iso ID V1 score'))
72 _Electron_plots_withFall17V1.append(Plot1D('mvaFall17V1Iso_WP80', 'mvaFall17V1Iso_WP80', 2, -0.5, 1.5, 'MVA Iso ID V1 WP80'))
73 _Electron_plots_withFall17V1.append(Plot1D('mvaFall17V1Iso_WP90', 'mvaFall17V1Iso_WP90', 2, -0.5, 1.5, 'MVA Iso ID V1 WP90'))
74 _Electron_plots_withFall17V1.append(Plot1D('mvaFall17V1Iso_WPL', 'mvaFall17V1Iso_WPL', 2, -0.5, 1.5, 'MVA Iso ID V1 loose WP'))
75 _Electron_plots_withFall17V1.append(Plot1D('mvaFall17V1noIso', 'mvaFall17V1noIso', 20, -1, 1, 'MVA noIso ID V1 score'))
76 _Electron_plots_withFall17V1.append(Plot1D('mvaFall17V1noIso_WP80', 'mvaFall17V1noIso_WP80', 2, -0.5, 1.5, 'MVA noIso ID V1 WP80'))
77 _Electron_plots_withFall17V1.append(Plot1D('mvaFall17V1noIso_WP90', 'mvaFall17V1noIso_WP90', 2, -0.5, 1.5, 'MVA noIso ID V1 WP90'))
78 _Electron_plots_withFall17V1.append(Plot1D('mvaFall17V1noIso_WPL', 'mvaFall17V1noIso_WPL', 2, -0.5, 1.5, 'MVA noIso ID V1 loose WP'))
79 
80 _Photon_plots_2016 = copy.deepcopy(nanoDQM.vplots.Photon.plots)
81 _Photon_plots_2016.append(Plot1D('cutBased', 'cutBased', 4, -0.5, 3.5, 'cut-based Spring16-V2p2 ID (0:fail, 1::loose, 2:medium, 3:tight)'))
82 _Photon_plots_2016.append(Plot1D('cutBased17Bitmap', 'cutBased17Bitmap', 8, -0.5, 7.5, 'cut-based Fall17-94X-V1 ID bitmap, 2^(0:loose, 1:medium, 2:tight)'))
83 _Photon_plots_2016.append(Plot1D('mvaID17', 'mvaID17', 20, -1, 1, 'MVA Fall17v1p1 ID score'))
84 _Photon_plots_2016.append(Plot1D('mvaID17_WP80', 'mvaID17_WP80', 2, -0.5, 1.5, 'MVA Fall17v1p1 ID WP80'))
85 _Photon_plots_2016.append(Plot1D('mvaID17_WP90', 'mvaID17_WP90', 2, -0.5, 1.5, 'MVA Fall17v1p1 ID WP90'))
86 
87 _FatJet_plots_80x = copy.deepcopy(nanoDQM.vplots.FatJet.plots)
88 _FatJet_plots_80x.append(Plot1D('msoftdrop_chs', 'msoftdrop_chs', 20, -300, 300, 'Legacy uncorrected soft drop mass with CHS'))
89 
90 _Flag_plots_80x = copy.deepcopy(nanoDQM.vplots.Flag.plots)
91 _Flag_plots_80x.append(Plot1D('BadGlobalMuon', 'BadGlobalMuon', 2, -0.5, 1.5, 'Bad muon flag'))
92 _Flag_plots_80x.append(Plot1D('CloneGlobalMuon', 'CloneGlobalMuon', 2, -0.5, 1.5, 'Clone muon flag'))
93 
94 for modifier in run2_miniAOD_80XLegacy, run2_nanoAOD_94X2016:
95  modifier.toModify(nanoDQM.vplots.Electron, plots = _Electron_plots_2016)
96  modifier.toModify(nanoDQM.vplots.Photon, plots = _Photon_plots_2016)
97 run2_miniAOD_80XLegacy.toModify(nanoDQM.vplots.FatJet, plots = _FatJet_plots_80x)
98 run2_miniAOD_80XLegacy.toModify(nanoDQM.vplots.Flag, plots = _Flag_plots_80x)
99 (run2_nanoAOD_92X | run2_nanoAOD_94XMiniAODv1 | run2_nanoAOD_94XMiniAODv2 | run2_nanoAOD_94X2016 | run2_nanoAOD_102Xv1 | (run2_nanoAOD_106Xv1 & ~run2_nanoAOD_devel)).toModify(nanoDQM.vplots.Electron, plots=_Electron_plots_withFall17V1)
100 
101 
102 ## no-change policy in run2_nanoAOD_106Xv1 (nanoAOD-v8)
103 _sv_plots_nom = copy.deepcopy(nanoDQM.vplots.SV.plots)
104 _sv_plots_106Xv1 = cms.VPSet()
105 for plot in _sv_plots_nom:
106  if (plot.name.value() != "charge"):
107  _sv_plots_106Xv1.append(plot)
108 (run2_nanoAOD_106Xv1 & ~run2_nanoAOD_devel).toModify(nanoDQM.vplots.SV, plots = _sv_plots_106Xv1 )
109 
110 (run2_nanoAOD_106Xv1 & ~run2_nanoAOD_devel).toModify(nanoDQM.vplots.FatJet, plots=cms.VPSet(
111  v for v in nanoDQM.vplots.FatJet.plots if v.name.value() != 'particleNet_mass'))
112 
113 _Jet_plots_nom = copy.deepcopy(nanoDQM.vplots.Jet.plots)
114 _Jet_plots_106Xv1 = cms.VPSet()
115 for plot in _Jet_plots_nom:
116  _Jet_plots_106Xv1.append(plot)
117 _Jet_plots_106Xv1.append(Plot1D('chFPV1EF', 'chFPV1EF', 20, 0, 1, 'charged fromPV==1 Energy Fraction (component of the total charged Energy Fraction).'))
118 _Jet_plots_106Xv1.append(Plot1D('chFPV2EF', 'chFPV2EF', 20, 0, 1, 'charged fromPV==2 Energy Fraction (component of the total charged Energy Fraction).'))
119 _Jet_plots_106Xv1.append(Plot1D('chFPV3EF', 'chFPV3EF', 20, 0, 1, 'charged fromPV==3 Energy Fraction (component of the total charged Energy Fraction).'))
120 (run2_nanoAOD_106Xv1 & ~run2_nanoAOD_devel).toModify(nanoDQM.vplots.Jet, plots=_Jet_plots_106Xv1)
121 
122 #remove new plots from old campaign
123 _Muon_noIsStandalone = [plot for plot in nanoDQM.vplots.Muon.plots if plot.name.value() != 'isStandalone']
124 (run2_nanoAOD_106Xv1 & ~run2_nanoAOD_devel).toModify(nanoDQM.vplots.Muon, plots = _Muon_noIsStandalone)
125 _Isotk_nocharge = [plot for plot in nanoDQM.vplots.IsoTrack.plots if plot.name.value() != 'charge']
126 (run2_nanoAOD_106Xv1 & ~run2_nanoAOD_devel).toModify(nanoDQM.vplots.IsoTrack, plots = _Isotk_nocharge)
127 
128 
129 egammascalesystvars=['dEscaleUp','dEscaleDown','dEsigmaUp','dEsigmaDown']
130 _electron_noscalesyst = [plot for plot in nanoDQM.vplots.Electron.plots if plot.name.value() not in egammascalesystvars]
131 _photon_noscalesyst = [plot for plot in nanoDQM.vplots.Photon.plots if plot.name.value() not in egammascalesystvars]
132 (run2_nanoAOD_106Xv1 & ~run2_nanoAOD_devel).toModify(nanoDQM.vplots.Electron, plots = _electron_noscalesyst)
133 (run2_nanoAOD_106Xv1 & ~run2_nanoAOD_devel).toModify(nanoDQM.vplots.Photon, plots = _photon_noscalesyst)
134 
135 ## no-change policy in run2_nanoAOD_106Xv1 (nanoAOD-v8)
136 from Configuration.Eras.Modifier_run2_nanoAOD_106Xv1_cff import run2_nanoAOD_106Xv1
137 from Configuration.Eras.Modifier_run2_nanoAOD_devel_cff import run2_nanoAOD_devel
138 _fatjet_plots_nom = copy.deepcopy(nanoDQM.vplots.FatJet.plots)
139 _fatjet_plots_106Xv1 = cms.VPSet()
140 for plot in _fatjet_plots_nom:
141  if (plot.name.value() != "nConstituents"):
142  _fatjet_plots_106Xv1.append(plot)
143 (run2_nanoAOD_106Xv1 & ~run2_nanoAOD_devel).toModify(nanoDQM.vplots.FatJet, plots = _fatjet_plots_106Xv1 )
144 
145 _prefire_plots_nom = copy.deepcopy(nanoDQM.vplots.L1PreFiringWeight.plots)
146 _prefire_plots_106Xv1 = cms.VPSet()
147 for plot in _prefire_plots_nom:
148  if (not "Muon" in plot.name.value() and not "ECAL" in plot.name.value()):
149  _prefire_plots_106Xv1.append(plot)
150 (run2_nanoAOD_106Xv1 & ~run2_nanoAOD_devel).toModify(nanoDQM.vplots.L1PreFiringWeight, plots = _prefire_plots_106Xv1 )
151 
152 
153 
154 ## MC
155 nanoDQMMC = nanoDQM.clone()
156 nanoDQMMC.vplots.Electron.sels.Prompt = cms.string("genPartFlav == 1")
157 nanoDQMMC.vplots.LowPtElectron.sels.Prompt = cms.string("genPartFlav == 1")
158 nanoDQMMC.vplots.Muon.sels.Prompt = cms.string("genPartFlav == 1")
159 nanoDQMMC.vplots.Photon.sels.Prompt = cms.string("genPartFlav == 1")
160 nanoDQMMC.vplots.Tau.sels.Prompt = cms.string("genPartFlav == 5")
161 nanoDQMMC.vplots.Jet.sels.Prompt = cms.string("genJetIdx != 1")
162 nanoDQMMC.vplots.Jet.sels.PromptB = cms.string("genJetIdx != 1 && hadronFlavour == 5")
163 
164 run2_miniAOD_80XLegacy.toModify(nanoDQM.vplots, IsoTrack = None)
165 
166 nanoDQMQTester = cms.EDAnalyzer("QualityTester",
167  qtList = cms.untracked.FileInPath('PhysicsTools/NanoAOD/test/dqmQualityTests.xml'),
168  prescaleFactor = cms.untracked.int32(1),
169  testInEventloop = cms.untracked.bool(False),
170  qtestOnEndLumi = cms.untracked.bool(False),
171  verboseQT = cms.untracked.bool(True)
172 )
173 
174 nanoHarvest = cms.Sequence( nanoDQMQTester )
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20