Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-02-14 23:39:44

0001 import FWCore.ParameterSet.Config as cms
0002 from  PhysicsTools.NanoAOD.common_cff import *
0003 from PhysicsTools.NanoAOD.nano_eras_cff import *
0004 
0005 
0006 ##################### Tables for final output and docs ##########################
0007 metTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
0008     src = cms.InputTag("slimmedMETs"),
0009     name = cms.string("MET"),
0010     doc = cms.string("slimmedMET, type-1 corrected PF MET"),
0011     singleton = cms.bool(True),  # there's always exactly one MET per event
0012     extension = cms.bool(False), # this is the main table for the MET
0013     variables = cms.PSet(PTVars,
0014        sumEt = Var("sumEt()", float, doc="scalar sum of Et",precision=10),
0015        covXX = Var("getSignificanceMatrix().At(0,0)",float,doc="xx element of met covariance matrix", precision=8),
0016        covXY = Var("getSignificanceMatrix().At(0,1)",float,doc="xy element of met covariance matrix", precision=8),
0017        covYY = Var("getSignificanceMatrix().At(1,1)",float,doc="yy element of met covariance matrix", precision=8),
0018        significance = Var("metSignificance()", float, doc="MET significance",precision=10),
0019        sumPtUnclustered = Var("metSumPtUnclustered()", float, doc="sumPt used for MET significance",precision=10),
0020        MetUnclustEnUpDeltaX = Var("shiftedPx('UnclusteredEnUp')-px()", float, doc="Delta (METx_mod-METx) Unclustered Energy Up",precision=10),
0021        MetUnclustEnUpDeltaY = Var("shiftedPy('UnclusteredEnUp')-py()", float, doc="Delta (METy_mod-METy) Unclustered Energy Up",precision=10),
0022 
0023     ),
0024 )
0025 
0026 
0027 rawMetTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
0028     src = metTable.src,
0029     name = cms.string("RawMET"),
0030     doc = cms.string("raw PF MET"),
0031     singleton = cms.bool(True),  # there's always exactly one MET per event
0032     extension = cms.bool(False), # this is the main table for the MET
0033     variables = cms.PSet(#NOTA BENE: we don't copy PTVars here!
0034        pt  = Var("uncorPt",  float, doc="pt", precision=10),
0035        phi = Var("uncorPhi", float, doc="phi", precision=10),
0036        sumEt = Var("uncorSumEt", float, doc="scalar sum of Et", precision=10),
0037     ),
0038 )
0039 
0040 
0041 caloMetTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
0042     src = metTable.src,
0043     name = cms.string("CaloMET"),
0044     doc = cms.string("Offline CaloMET (muon corrected)"),
0045     singleton = cms.bool(True),  # there's always exactly one MET per event
0046     extension = cms.bool(False), # this is the main table for the MET
0047     variables = cms.PSet(#NOTA BENE: we don't copy PTVars here!
0048        pt  = Var("caloMETPt",  float, doc="pt", precision=10),
0049        phi = Var("caloMETPhi", float, doc="phi", precision=10),
0050        sumEt = Var("caloMETSumEt", float, doc="scalar sum of Et", precision=10),
0051     ),
0052 )
0053 
0054 puppiMetTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
0055     src = cms.InputTag("slimmedMETsPuppi"),
0056     name = cms.string("PuppiMET"),
0057     doc = cms.string("PUPPI  MET"),
0058     singleton = cms.bool(True),  # there's always exactly one MET per event
0059     extension = cms.bool(False), # this is the main table for the MET
0060     variables = cms.PSet(PTVars,
0061        sumEt = Var("sumEt()", float, doc="scalar sum of Et",precision=10),
0062        ptJERUp = Var("shiftedPt('JetResUp')", float, doc="JER up pt",precision=10),
0063        ptJERDown = Var("shiftedPt('JetResDown')", float, doc="JER down pt",precision=10),
0064        phiJERUp = Var("shiftedPhi('JetResUp')", float, doc="JER up phi",precision=10),
0065        phiJERDown = Var("shiftedPhi('JetResDown')", float, doc="JER down phi",precision=10),
0066        ptJESUp = Var("shiftedPt('JetEnUp')", float, doc="JES up pt",precision=10),
0067        ptJESDown = Var("shiftedPt('JetEnDown')", float, doc="JES down pt",precision=10),
0068        phiJESUp = Var("shiftedPhi('JetEnUp')", float, doc="JES up phi",precision=10),
0069        phiJESDown = Var("shiftedPhi('JetEnDown')", float, doc="JES down phi",precision=10),
0070        ptUnclusteredUp = Var("shiftedPt('UnclusteredEnUp')", float, doc="Unclustered up pt",precision=10),
0071        ptUnclusteredDown = Var("shiftedPt('UnclusteredEnDown')", float, doc="Unclustered down pt",precision=10),
0072        phiUnclusteredUp = Var("shiftedPhi('UnclusteredEnUp')", float, doc="Unclustered up phi",precision=10),
0073        phiUnclusteredDown = Var("shiftedPhi('UnclusteredEnDown')", float, doc="Unclustered down phi",precision=10),
0074     ),
0075 )
0076 
0077 rawPuppiMetTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
0078     src = puppiMetTable.src,
0079     name = cms.string("RawPuppiMET"),
0080     doc = cms.string("raw Puppi MET"),
0081     singleton = cms.bool(True),  # there's always exactly one MET per event
0082     extension = cms.bool(False), # this is the main table for the MET
0083     variables = cms.PSet(#NOTA BENE: we don't copy PTVars here!
0084        pt  = Var("uncorPt",  float, doc="pt", precision=10),
0085        phi = Var("uncorPhi", float, doc="phi", precision=10),
0086        sumEt = Var("uncorSumEt", float, doc="scalar sum of Et", precision=10),
0087     ),)
0088 
0089 
0090 tkMetTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
0091     src = metTable.src,
0092     name = cms.string("TkMET"),
0093     doc = cms.string("Track MET computed with tracks from PV0 ( pvAssociationQuality()>=4 ) "),
0094     singleton = cms.bool(True),  # there's always exactly one MET per event
0095     extension = cms.bool(False), # this is the main table for the TkMET
0096     variables = cms.PSet(#NOTA BENE: we don't copy PTVars here!
0097        pt = Var("corPt('RawTrk')", float, doc="raw track MET pt",precision=10),
0098        phi = Var("corPhi('RawTrk')", float, doc="raw track MET phi",precision=10),
0099        sumEt = Var("corSumEt('RawTrk')", float, doc="raw track scalar sum of Et",precision=10),
0100     ),
0101 )
0102 
0103 chsMetTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
0104     src = metTable.src,
0105     name = cms.string("ChsMET"),
0106     doc = cms.string("PF MET computed with CHS PF candidates"),
0107     singleton = cms.bool(True),  # there's always exactly one MET per event
0108     extension = cms.bool(False), # this is the main table for the TkMET
0109     variables = cms.PSet(#NOTA BENE: we don't copy PTVars here!
0110        pt = Var("corPt('RawChs')", float, doc="raw chs PF MET pt",precision=10),
0111        phi = Var("corPhi('RawChs')", float, doc="raw chs PF MET phi",precision=10),
0112        sumEt = Var("corSumEt('RawChs')", float, doc="raw chs PF scalar sum of Et",precision=10),
0113     ),
0114 )
0115 
0116 deepMetResolutionTuneTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
0117     # current deepMets are saved in slimmedMETs in MiniAOD,
0118     # in the same way as chsMet/TkMET
0119     src = metTable.src,
0120     name = cms.string("DeepMETResolutionTune"),
0121     doc = cms.string("Deep MET trained with resolution tune"),
0122     singleton = cms.bool(True), # there's always exactly one MET per event
0123     extension = cms.bool(False), # this is the main table for the MET
0124     variables = cms.PSet(#NOTA BENE: we don't copy PTVars here!
0125         pt = Var("corPt('RawDeepResolutionTune')", float, doc="DeepMET ResolutionTune pt",precision=-1),
0126         phi = Var("corPhi('RawDeepResolutionTune')", float, doc="DeepmET ResolutionTune phi",precision=12),
0127     ),
0128 )
0129 
0130 deepMetResponseTuneTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
0131     src = metTable.src,
0132     name = cms.string("DeepMETResponseTune"),
0133     doc = cms.string("Deep MET trained with extra response tune"),
0134     singleton = cms.bool(True), # there's always exactly one MET per event
0135     extension = cms.bool(False), # this is the main table for the MET
0136     variables = cms.PSet(#NOTA BENE: we don't copy PTVars here!
0137         pt = Var("corPt('RawDeepResponseTune')", float, doc="DeepMET ResponseTune pt",precision=-1),
0138         phi = Var("corPhi('RawDeepResponseTune')", float, doc="DeepMET ResponseTune phi",precision=12),
0139     ),
0140 )
0141 
0142 metFixEE2017Table = metTable.clone(
0143     src = cms.InputTag("slimmedMETsFixEE2017"),
0144     name = cms.string("METFixEE2017"),
0145     doc = cms.string("Type-1 corrected PF MET, with fixEE2017 definition"),
0146 )
0147 
0148 metMCTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
0149     src = metTable.src,
0150     name = cms.string("GenMET"),
0151     doc = cms.string("Gen MET"),
0152     singleton = cms.bool(True),  
0153     extension = cms.bool(False),
0154     variables = cms.PSet(
0155        pt  = Var("genMET.pt",  float, doc="pt", precision=10),
0156        phi = Var("genMET.phi", float, doc="phi", precision=10),
0157     ),
0158 )
0159 
0160 
0161 metTablesTask = cms.Task( metTable, rawMetTable, caloMetTable, puppiMetTable, rawPuppiMetTable, tkMetTable, chsMetTable, deepMetResolutionTuneTable, deepMetResponseTuneTable )
0162 _withFixEE2017_task = cms.Task(metTablesTask.copy(), metFixEE2017Table)
0163 for modifier in run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2:
0164     modifier.toReplaceWith(metTablesTask,_withFixEE2017_task) # only in old miniAOD, the new ones will come from the UL rereco
0165 metMCTask = cms.Task( metMCTable )