CMS 3D CMS Logo

met_cff.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
3 
4 from Configuration.Eras.Modifier_run2_nanoAOD_94XMiniAODv1_cff import run2_nanoAOD_94XMiniAODv1
5 from Configuration.Eras.Modifier_run2_nanoAOD_94XMiniAODv2_cff import run2_nanoAOD_94XMiniAODv2
6 
7 ##################### Tables for final output and docs ##########################
8 metTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
9  src = cms.InputTag("slimmedMETs"),
10  name = cms.string("MET"),
11  doc = cms.string("slimmedMET, type-1 corrected PF MET"),
12  singleton = cms.bool(True), # there's always exactly one MET per event
13  extension = cms.bool(False), # this is the main table for the MET
14  variables = cms.PSet(PTVars,
15  sumEt = Var("sumEt()", float, doc="scalar sum of Et",precision=10),
16  covXX = Var("getSignificanceMatrix().At(0,0)",float,doc="xx element of met covariance matrix", precision=8),
17  covXY = Var("getSignificanceMatrix().At(0,1)",float,doc="xy element of met covariance matrix", precision=8),
18  covYY = Var("getSignificanceMatrix().At(1,1)",float,doc="yy element of met covariance matrix", precision=8),
19  significance = Var("metSignificance()", float, doc="MET significance",precision=10),
20  sumPtUnclustered = Var("metSumPtUnclustered()", float, doc="sumPt used for MET significance",precision=10),
21  MetUnclustEnUpDeltaX = Var("shiftedPx('UnclusteredEnUp')-px()", float, doc="Delta (METx_mod-METx) Unclustered Energy Up",precision=10),
22  MetUnclustEnUpDeltaY = Var("shiftedPy('UnclusteredEnUp')-py()", float, doc="Delta (METy_mod-METy) Unclustered Energy Up",precision=10),
23 
24  ),
25 )
26 
27 
28 rawMetTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
29  src = metTable.src,
30  name = cms.string("RawMET"),
31  doc = cms.string("raw PF MET"),
32  singleton = cms.bool(True), # there's always exactly one MET per event
33  extension = cms.bool(False), # this is the main table for the MET
34  variables = cms.PSet(#NOTA BENE: we don't copy PTVars here!
35  pt = Var("uncorPt", float, doc="pt", precision=10),
36  phi = Var("uncorPhi", float, doc="phi", precision=10),
37  sumEt = Var("uncorSumEt", float, doc="scalar sum of Et", precision=10),
38  ),
39 )
40 
41 
42 caloMetTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
43  src = metTable.src,
44  name = cms.string("CaloMET"),
45  doc = cms.string("Offline CaloMET (muon corrected)"),
46  singleton = cms.bool(True), # there's always exactly one MET per event
47  extension = cms.bool(False), # this is the main table for the MET
48  variables = cms.PSet(#NOTA BENE: we don't copy PTVars here!
49  pt = Var("caloMETPt", float, doc="pt", precision=10),
50  phi = Var("caloMETPhi", float, doc="phi", precision=10),
51  sumEt = Var("caloMETSumEt", float, doc="scalar sum of Et", precision=10),
52  ),
53 )
54 
55 puppiMetTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
56  src = cms.InputTag("slimmedMETsPuppi"),
57  name = cms.string("PuppiMET"),
58  doc = cms.string("PUPPI MET"),
59  singleton = cms.bool(True), # there's always exactly one MET per event
60  extension = cms.bool(False), # this is the main table for the MET
61  variables = cms.PSet(PTVars,
62  sumEt = Var("sumEt()", float, doc="scalar sum of Et",precision=10),
63  ptJERUp = Var("shiftedPt('JetResUp')", float, doc="JER up pt",precision=10),
64  phiJERUp = Var("shiftedPhi('JetResUp')", float, doc="JER up phi",precision=10),
65  ptJESUp = Var("shiftedPt('JetEnUp')", float, doc="JES up pt",precision=10),
66  phiJESUp = Var("shiftedPhi('JetEnUp')", float, doc="JES up phi",precision=10),
67  ),
68 )
69 
70 rawPuppiMetTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
71  src = puppiMetTable.src,
72  name = cms.string("RawPuppiMET"),
73  doc = cms.string("raw Puppi MET"),
74  singleton = cms.bool(True), # there's always exactly one MET per event
75  extension = cms.bool(False), # this is the main table for the MET
76  variables = cms.PSet(#NOTA BENE: we don't copy PTVars here!
77  pt = Var("uncorPt", float, doc="pt", precision=10),
78  phi = Var("uncorPhi", float, doc="phi", precision=10),
79  sumEt = Var("uncorSumEt", float, doc="scalar sum of Et", precision=10),
80  ),)
81 
82 
83 tkMetTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
84  src = metTable.src,
85  name = cms.string("TkMET"),
86  doc = cms.string("Track MET computed with tracks from PV0 ( pvAssociationQuality()>=4 ) "),
87  singleton = cms.bool(True), # there's always exactly one MET per event
88  extension = cms.bool(False), # this is the main table for the TkMET
89  variables = cms.PSet(#NOTA BENE: we don't copy PTVars here!
90  pt = Var("corPt('RawTrk')", float, doc="raw track MET pt",precision=10),
91  phi = Var("corPhi('RawTrk')", float, doc="raw track MET phi",precision=10),
92  sumEt = Var("corSumEt('RawTrk')", float, doc="raw track scalar sum of Et",precision=10),
93  ),
94 )
95 
96 chsMetTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
97  src = metTable.src,
98  name = cms.string("ChsMET"),
99  doc = cms.string("PF MET computed with CHS PF candidates"),
100  singleton = cms.bool(True), # there's always exactly one MET per event
101  extension = cms.bool(False), # this is the main table for the TkMET
102  variables = cms.PSet(#NOTA BENE: we don't copy PTVars here!
103  pt = Var("corPt('RawChs')", float, doc="raw chs PF MET pt",precision=10),
104  phi = Var("corPhi('RawChs')", float, doc="raw chs PF MET phi",precision=10),
105  sumEt = Var("corSumEt('RawChs')", float, doc="raw chs PF scalar sum of Et",precision=10),
106  ),
107 )
108 
109 deepMetResolutionTuneTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
110  # current deepMets are saved in slimmedMETs in MiniAOD,
111  # in the same way as chsMet/TkMET
112  src = metTable.src,
113  name = cms.string("DeepMETResolutionTune"),
114  doc = cms.string("Deep MET trained with resolution tune"),
115  singleton = cms.bool(True), # there's always exactly one MET per event
116  extension = cms.bool(False), # this is the main table for the MET
117  variables = cms.PSet(#NOTA BENE: we don't copy PTVars here!
118  pt = Var("corPt('RawDeepResolutionTune')", float, doc="DeepMET ResolutionTune pt",precision=-1),
119  phi = Var("corPhi('RawDeepResolutionTune')", float, doc="DeepmET ResolutionTune phi",precision=12),
120  ),
121 )
122 
123 deepMetResponseTuneTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
124  src = metTable.src,
125  name = cms.string("DeepMETResponseTune"),
126  doc = cms.string("Deep MET trained with extra response tune"),
127  singleton = cms.bool(True), # there's always exactly one MET per event
128  extension = cms.bool(False), # this is the main table for the MET
129  variables = cms.PSet(#NOTA BENE: we don't copy PTVars here!
130  pt = Var("corPt('RawDeepResponseTune')", float, doc="DeepMET ResponseTune pt",precision=-1),
131  phi = Var("corPhi('RawDeepResponseTune')", float, doc="DeepMET ResponseTune phi",precision=12),
132  ),
133 )
134 
135 metFixEE2017Table = metTable.clone()
136 metFixEE2017Table.src = cms.InputTag("slimmedMETsFixEE2017")
137 metFixEE2017Table.name = cms.string("METFixEE2017")
138 metFixEE2017Table.doc = cms.string("Type-1 corrected PF MET, with fixEE2017 definition")
139 
140 
141 metMCTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
142  src = metTable.src,
143  name = cms.string("GenMET"),
144  doc = cms.string("Gen MET"),
145  singleton = cms.bool(True),
146  extension = cms.bool(False),
147  variables = cms.PSet(
148  pt = Var("genMET.pt", float, doc="pt", precision=10),
149  phi = Var("genMET.phi", float, doc="phi", precision=10),
150  ),
151 )
152 
153 
154 
155 metTables = cms.Sequence( metTable + rawMetTable + caloMetTable + puppiMetTable + rawPuppiMetTable+ tkMetTable + chsMetTable)
156 deepMetTables = cms.Sequence( deepMetResolutionTuneTable + deepMetResponseTuneTable )
157 _withFixEE2017_sequence = cms.Sequence(metTables.copy() + metFixEE2017Table)
158 for modifier in run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2:
159  modifier.toReplaceWith(metTables,_withFixEE2017_sequence) # only in old miniAOD, the new ones will come from the UL rereco
160 metMC = cms.Sequence( metMCTable )
161 
def Var(expr, valtype, compression=None, doc=None, mcOnly=False, precision=-1)
Definition: common_cff.py:20