Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:23:44

0001 import FWCore.ParameterSet.Config as cms
0002 from PhysicsTools.NanoAOD.nano_eras_cff import *
0003 from PhysicsTools.NanoAOD.common_cff import *
0004 
0005 l1_float_precision_=12
0006 
0007 l1PtVars = cms.PSet(
0008     pt  = Var("pt",  float, precision=l1_float_precision_),
0009     phi = Var("phi", float, precision=l1_float_precision_),
0010 )
0011 l1P3Vars = cms.PSet(
0012     l1PtVars,
0013     eta = Var("eta", float, precision=l1_float_precision_),
0014 )
0015 
0016 l1ObjVars = cms.PSet(
0017     l1P3Vars,
0018     hwPt = Var("hwPt()","int16",doc="hardware pt"),
0019     hwEta = Var("hwEta()","int16",doc="hardware eta"),
0020     hwPhi = Var("hwPhi()","int16",doc="hardware phi"),
0021     hwQual = Var("hwQual()","int16",doc="hardware qual"),
0022     hwIso = Var("hwIso()","int16",doc="hardware iso")
0023 )
0024 
0025 l1CaloObjVars = cms.PSet(
0026     l1ObjVars,
0027     towerIEta = Var("towerIEta()","int16",doc="the ieta of the tower"),
0028     towerIPhi = Var("towerIPhi()","int16",doc="the iphi of the tower"),
0029 )
0030 
0031 l1JetReducedVars = cms.PSet(
0032     l1P3Vars
0033 )
0034 
0035 l1EtSumReducedVars = cms.PSet(
0036     l1PtVars,
0037     etSumType = Var("getType()",int,doc="et sum type"),
0038 )
0039 l1EGReducedVars = cms.PSet(
0040     l1P3Vars,
0041     hwIso = Var("hwIso()","int16",doc="hardware iso")
0042 )
0043 
0044 l1TauReducedVars = cms.PSet(
0045     l1P3Vars,
0046     hwIso = Var("hwIso()","int16",doc="hardware iso")
0047 )
0048 
0049 l1MuonReducedVars = cms.PSet(
0050     l1P3Vars,
0051     hwQual = Var("hwQual()",int,doc="hardware qual"),
0052     hwCharge = Var("hwCharge()","int16",doc="hardware charge"), 
0053     etaAtVtx = Var("etaAtVtx()",float,precision=l1_float_precision_,doc="eta estimated at the vertex"),
0054     phiAtVtx = Var("phiAtVtx()",float,precision=l1_float_precision_,doc="phi estimated at the vertex"),
0055     ptUnconstrained = Var("ptUnconstrained()",float,precision=l1_float_precision_,doc="pt when not constrained to the beamspot"),
0056     hwDXY = Var("hwDXY()","int16",doc="hardware impact parameter"),
0057 )
0058 
0059 l1MuTable = cms.EDProducer("SimpleTriggerL1MuonFlatTableProducer",
0060     src = cms.InputTag("gmtStage2Digis","Muon"),
0061     minBX = cms.int32(-2),
0062     maxBX = cms.int32(2),                           
0063     cut = cms.string(""), 
0064     name= cms.string("L1Mu"),
0065     doc = cms.string(""),
0066     extension = cms.bool(False), 
0067     variables = cms.PSet(l1ObjVars,
0068                          hwCharge = Var("hwCharge()","int16",doc="Charge (can be 0 if the charge measurement was not valid)"),
0069                          hwChargeValid = Var("hwChargeValid()","int16",doc=""),
0070                          tfMuonIndex = Var("tfMuonIndex()","uint16",doc="Index of muon at the uGMT input. 3 indices per link/sector/wedge. EMTF+ are 0-17, OMTF+ are 18-35, BMTF are 36-71, OMTF- are 72-89, EMTF- are 90-107"),
0071                          hwTag = Var("hwTag()","int16",doc="not in L1 ntuples"),
0072                          hwEtaAtVtx = Var("hwEtaAtVtx()","int16",doc="hardware eta estimated at the vertex"),
0073                          hwPhiAtVtx = Var("hwPhiAtVtx()","int16",doc="hardware phi estimated at the vertex"),
0074                          etaAtVtx = Var("etaAtVtx()",float,doc="eta estimated at the vertex"),
0075                          phiAtVtx = Var("phiAtVtx()",float,doc="phi estimated at the vertex"),
0076                          hwIsoSum = Var("hwIsoSum()","int16",doc="not in L1 ntuples"),
0077                          hwDPhiExtra = Var("hwDPhiExtra()","int16",doc="Delta between Pseudo-rapidity at the muon system and the projected coordinate at the vertex in HW unit (for future l1t-integration-tag"),
0078                          hwDEtaExtra = Var("hwDEtaExtra()","int16",doc="Delta between Azimuth at the muon system and the projected coordinate at the vertex in HW unit (for future l1t-integration-tag)"),
0079                          hwRank = Var("hwRank()","int16",doc="not in L1Ntuples"),
0080                          hwPtUnconstrained = Var("hwPtUnconstrained()","int16",doc=""),
0081                          ptUnconstrained = Var("ptUnconstrained()",float,doc=""),
0082                          hwDXY = Var("hwDXY()","uint16",doc=""),
0083                      )
0084 )
0085 
0086 
0087 l1JetTable = cms.EDProducer("SimpleTriggerL1JetFlatTableProducer",
0088     src = cms.InputTag("caloStage2Digis","Jet"),
0089     minBX = cms.int32(-2),
0090     maxBX = cms.int32(2),                           
0091     cut = cms.string(""), 
0092     name= cms.string("L1Jet"),
0093     doc = cms.string(""),
0094     extension = cms.bool(False),
0095     variables = cms.PSet(l1CaloObjVars,
0096                          rawEt = Var("rawEt()","int16",doc="raw (uncalibrated) et"),
0097                          seedEt = Var("seedEt()","int16",doc="et of the seed"),
0098                          puEt = Var("puEt()","int16",doc="pile up et "),
0099                          puDonutEt0 = Var("puDonutEt(0)","int16",doc=""),
0100                          puDonutEt1 = Var("puDonutEt(1)","int16",doc=""),
0101                          puDonutEt2 = Var("puDonutEt(2)","int16",doc=""),
0102                          puDonutEt3 = Var("puDonutEt(3)","int16",doc=""),
0103                      )
0104 )
0105 
0106 l1TauTable = cms.EDProducer("SimpleTriggerL1TauFlatTableProducer",
0107     src = cms.InputTag("caloStage2Digis","Tau"),
0108     minBX = cms.int32(-2),
0109     maxBX = cms.int32(2),                           
0110     cut = cms.string(""), 
0111     name= cms.string("L1Tau"),
0112     doc = cms.string(""),
0113     extension = cms.bool(False), # this is the main table for L1 EGs
0114     variables = cms.PSet(l1CaloObjVars,
0115                          rawEt = Var("rawEt()","int16",doc="raw Et of tau"),
0116                          isoEt = Var("isoEt()","int16",doc="raw isolation sum - cluster sum"),
0117                          nTT = Var("nTT()","int16",doc=" nr towers above threshold"),
0118                          hasEM = Var("hasEM()",bool,doc="has an em component"),
0119                          isMerged = Var("isMerged()",bool,doc="is merged"),
0120 
0121                      )
0122 )
0123 
0124 l1EtSumTable = cms.EDProducer("SimpleTriggerL1EtSumFlatTableProducer",
0125     src = cms.InputTag("caloStage2Digis","EtSum"),
0126     minBX = cms.int32(-2),
0127     maxBX = cms.int32(2),                           
0128     cut = cms.string(""), 
0129     name= cms.string("L1EtSum"),
0130     doc = cms.string(""),
0131     extension = cms.bool(False), 
0132     variables = cms.PSet(l1PtVars,
0133                          hwPt = Var("hwPt()",int,doc="hardware pt"),
0134                          hwPhi = Var("hwPhi()",int,doc="hardware phi"),
0135                          etSumType = Var("getType()",int,doc="the type of the ET Sum (https://github.com/cms-sw/cmssw/blob/master/DataFormats/L1Trigger/interface/EtSum.h#L27-L56)"),
0136                      )
0137 )
0138 
0139 l1EGTable = cms.EDProducer("SimpleTriggerL1EGFlatTableProducer",
0140     src = cms.InputTag("caloStage2Digis","EGamma"),
0141     minBX = cms.int32(-2),
0142     maxBX = cms.int32(2),                           
0143     cut = cms.string(""), 
0144     name= cms.string("L1EG"),
0145     doc = cms.string(""),
0146     extension = cms.bool(False), 
0147     variables = cms.PSet(l1CaloObjVars,
0148                          rawEt = Var("rawEt()","int16",doc="raw et"),
0149                          isoEt = Var("isoEt()","int16",doc="iso et"),
0150                          footprintEt = Var("footprintEt()","int16",doc=" footprint et"),
0151                          nTT = Var("nTT()","int16",doc="nr trig towers"),
0152                          shape = Var("shape()","int16",doc="shape"),
0153                          towerHoE = Var("towerHoE()","int16",doc="tower H/E"),
0154                      )
0155 )
0156 
0157 l1TablesTask = cms.Task(l1EGTable,l1EtSumTable,l1TauTable,l1JetTable,l1MuTable)
0158 
0159 def setL1NanoToReduced(process):
0160     """
0161     sets the L1 objects only have reduced information which is necessary 
0162     for central nano
0163     """
0164     #reduce the variables to the core variables
0165     #note et sum variables are already reduced
0166     process.l1EGTable.variables = cms.PSet(l1EGReducedVars)
0167     process.l1MuTable.variables = cms.PSet(l1MuonReducedVars)
0168     process.l1JetTable.variables = cms.PSet(l1JetReducedVars)
0169     process.l1TauTable.variables = cms.PSet(l1TauReducedVars)
0170     process.l1EtSumTable.variables = cms.PSet(l1EtSumReducedVars)
0171 
0172     #apply cuts
0173     process.l1EGTable.cut="pt>=10"
0174     process.l1TauTable.cut="pt>=24"
0175     process.l1JetTable.cut="pt>=30"
0176     process.l1MuTable.cut="pt>=3 && hwQual>=8"
0177     process.l1EtSumTable.cut="(getType==8 || getType==1 || getType==2 || getType==3)"
0178 
0179     return process
0180 
0181 def nanoL1TrigObjCustomize(process):
0182     process.load("PhysicsTools.NanoAOD.l1trig_cff")
0183     process.nanoTableTaskCommon.add(process.l1TablesTask)
0184     process = setL1NanoToReduced(process)
0185     return process
0186 
0187 def nanoL1TrigObjCustomizeFull(process):
0188     process.load("PhysicsTools.NanoAOD.l1trig_cff")
0189     process.nanoTableTaskCommon.add(process.l1TablesTask)
0190     return process