From 47647baa44fe717fc92e06a1e23416b6be9e2fea Mon Sep 17 00:00:00 2001 From: Sam Harper Date: Wed, 1 Feb 2023 15:02:15 +0000 Subject: [PATCH 01/12] initial version of L1Nano --- .../interface/SimpleFlatTableProducer.h | 52 ++++++++ .../plugins/SimpleFlatTableProducerPlugins.cc | 20 +++ PhysicsTools/NanoAOD/python/l1trig_cff.py | 119 ++++++++++++++++++ PhysicsTools/NanoAOD/python/nano_cff.py | 5 + 4 files changed, 196 insertions(+) create mode 100644 PhysicsTools/NanoAOD/python/l1trig_cff.py diff --git a/PhysicsTools/NanoAOD/interface/SimpleFlatTableProducer.h b/PhysicsTools/NanoAOD/interface/SimpleFlatTableProducer.h index 41184463cc12a..26657e489eb87 100644 --- a/PhysicsTools/NanoAOD/interface/SimpleFlatTableProducer.h +++ b/PhysicsTools/NanoAOD/interface/SimpleFlatTableProducer.h @@ -10,6 +10,7 @@ #include "DataFormats/Common/interface/ValueMap.h" #include "DataFormats/NanoAOD/interface/FlatTable.h" #include "Utilities/General/interface/ClassName.h" +#include "DataFormats/L1Trigger/interface/BXVector.h" #include "CommonTools/Utils/interface/StringCutObjectSelector.h" #include "CommonTools/Utils/interface/StringObjectFunction.h" @@ -349,6 +350,57 @@ class SimpleFlatTableProducer : public SimpleFlatTableProducerBase>> extvars_; }; +template +class BXVectorSimpleFlatTableProducer : public SimpleFlatTableProducerBase> { +public: + BXVectorSimpleFlatTableProducer(edm::ParameterSet const ¶ms) + : SimpleFlatTableProducerBase>(params), + maxLen_(params.existsAs("maxLen") ? params.getParameter("maxLen") + : std::numeric_limits::max()), + cut_(params.getParameter("cut"), true), + minBX_(params.getParameter("minBX")), + maxBX_(params.getParameter("maxBX")), + bxVarName_("bx") { + edm::ParameterSet const &varsPSet = params.getParameter("variables"); + auto varNames = varsPSet.getParameterNamesForType(); + if (std::find(varNames.begin(), varNames.end(), bxVarName_) != varNames.end()) { + throw cms::Exception("Configuration", + "BXVectorSimpleFlatTableProducer already defines the " + bxVarName_ + + "internally and thus you should not specify it yourself"); + } + } + std::unique_ptr fillTable(const edm::Event &iEvent, + const edm::Handle> &prod) const override { + std::vector selObjs; + std::vector selObjBXs; + if (prod.isValid() || !(this->skipNonExistingSrc_)) { + for (int bx = minBX_; bx <= maxBX_; bx++) { + for (size_t objNr = 0, nrObjs = prod->size(bx); objNr < nrObjs; ++objNr) { + const auto &obj = prod->at(bx, objNr); + if (cut_(obj)) { + selObjs.push_back(&obj); + selObjBXs.push_back(bx); + } + if (selObjs.size() >= maxLen_) + break; + } + } + } + auto out = std::make_unique(selObjs.size(), this->name_, false, this->extension_); + for (const auto &var : this->vars_) + var->fill(selObjs, *out); + out->template addColumn(bxVarName_, selObjBXs, "BX of the L1 candidate"); + return out; + } + +protected: + const unsigned int maxLen_; + const StringCutObjectSelector cut_; + const int minBX_; + const int maxBX_; + const std::string bxVarName_; +}; + template class EventSingletonSimpleFlatTableProducer : public SimpleFlatTableProducerBase { public: diff --git a/PhysicsTools/NanoAOD/plugins/SimpleFlatTableProducerPlugins.cc b/PhysicsTools/NanoAOD/plugins/SimpleFlatTableProducerPlugins.cc index cf30e060c442b..412f38d8eb129 100644 --- a/PhysicsTools/NanoAOD/plugins/SimpleFlatTableProducerPlugins.cc +++ b/PhysicsTools/NanoAOD/plugins/SimpleFlatTableProducerPlugins.cc @@ -24,6 +24,21 @@ typedef EventSingletonSimpleFlatTableProducer SimpleXYZPointFla #include "DataFormats/BeamSpot/interface/BeamSpot.h" typedef EventSingletonSimpleFlatTableProducer SimpleBeamspotFlatTableProducer; +#include "DataFormats/L1Trigger/interface/EGamma.h" +typedef BXVectorSimpleFlatTableProducer SimpleTriggerL1EGFlatTableProducer; + +#include "DataFormats/L1Trigger/interface/Jet.h" +typedef BXVectorSimpleFlatTableProducer SimpleTriggerL1JetFlatTableProducer; + +#include "DataFormats/L1Trigger/interface/Tau.h" +typedef BXVectorSimpleFlatTableProducer SimpleTriggerL1TauFlatTableProducer; + +#include "DataFormats/L1Trigger/interface/Muon.h" +typedef BXVectorSimpleFlatTableProducer SimpleTriggerL1MuonFlatTableProducer; + +#include "DataFormats/L1Trigger/interface/EtSum.h" +typedef BXVectorSimpleFlatTableProducer SimpleTriggerL1EtSumFlatTableProducer; + #include "FWCore/Framework/interface/MakerMacros.h" DEFINE_FWK_MODULE(SimpleCandidateFlatTableProducer); DEFINE_FWK_MODULE(SimpleGenEventFlatTableProducer); @@ -33,3 +48,8 @@ DEFINE_FWK_MODULE(SimpleProtonTrackFlatTableProducer); DEFINE_FWK_MODULE(SimpleLocalTrackFlatTableProducer); DEFINE_FWK_MODULE(SimpleXYZPointFlatTableProducer); DEFINE_FWK_MODULE(SimpleBeamspotFlatTableProducer); +DEFINE_FWK_MODULE(SimpleTriggerL1EGFlatTableProducer); +DEFINE_FWK_MODULE(SimpleTriggerL1JetFlatTableProducer); +DEFINE_FWK_MODULE(SimpleTriggerL1MuonFlatTableProducer); +DEFINE_FWK_MODULE(SimpleTriggerL1TauFlatTableProducer); +DEFINE_FWK_MODULE(SimpleTriggerL1EtSumFlatTableProducer); diff --git a/PhysicsTools/NanoAOD/python/l1trig_cff.py b/PhysicsTools/NanoAOD/python/l1trig_cff.py new file mode 100644 index 0000000000000..0dcbd9183fbbd --- /dev/null +++ b/PhysicsTools/NanoAOD/python/l1trig_cff.py @@ -0,0 +1,119 @@ +import FWCore.ParameterSet.Config as cms +from PhysicsTools.NanoAOD.nano_eras_cff import * +from PhysicsTools.NanoAOD.common_cff import * + +l1ObjVars = cms.PSet( + P3Vars, + hwPt = Var("hwPt()",int,doc="hardware pt"), + hwEta = Var("hwEta()",int,doc="hardware eta"), + hwPhi = Var("hwPhi()",int,doc="hardware phi"), + hwQual = Var("hwQual()",int,doc="hardware qual"), + hwIso = Var("hwIso()",int,doc="hardware iso") +) + + +l1MuTable = cms.EDProducer("SimpleTriggerL1MuonFlatTableProducer", + src = cms.InputTag("gmtStage2Digis","Muon"), + minBX = cms.int32(-2), + maxBX = cms.int32(2), + cut = cms.string(""), + name= cms.string("L1Mu"), + doc = cms.string(""), + extension = cms.bool(False), # this is the main table for L1 EGs + variables = cms.PSet(l1ObjVars, + hwCharge = Var("hwCharge()",int,doc=""), + hwChargeValid = Var("hwChargeValid()",int,doc=""), + tfMuonIndex = Var("tfMuonIndex()",int,doc=""), + hwTag = Var("hwTag()",int,doc=""), + hwEtaAtVtx = Var("hwEtaAtVtx()",int,doc=""), + hwPhiAtVtx = Var("hwPhiAtVtx()",int,doc=""), + etaAtVtx = Var("etaAtVtx()",float,doc=""), + phiAtVtx = Var("phiAtVtx()",float,doc=""), + hwIsoSum = Var("hwIsoSum()",int,doc=""), + hwDPhiExtra = Var("hwDPhiExtra()",int,doc=""), + hwDEtaExtra = Var("hwDEtaExtra()",int,doc=""), + hwRank = Var("hwRank()",int,doc=""), + hwPtUnconstrained = Var("hwPtUnconstrained()",int,doc=""), + ptUnconstrained = Var("ptUnconstrained()",float,doc=""), + hwDXY = Var("hwDXY()",int,doc=""), + ) +) + + +l1JetTable = cms.EDProducer("SimpleTriggerL1JetFlatTableProducer", + src = cms.InputTag("caloStage2Digis","Jet"), + minBX = cms.int32(-2), + maxBX = cms.int32(2), + cut = cms.string(""), + name= cms.string("L1Jet"), + doc = cms.string(""), + extension = cms.bool(False), # this is the main table for L1 EGs + variables = cms.PSet(l1ObjVars, + towerIEta = Var("towerIEta()",int,doc=""), + towerIPhi = Var("towerIPhi()",int,doc=""), + rawEt = Var("rawEt()",int,doc=""), + seedEt = Var("seedEt()",int,doc=""), + puEt = Var("puEt()",int,doc=""), + puDonutEt0 = Var("puDonutEt(0)",int,doc=""), + puDonutEt1 = Var("puDonutEt(1)",int,doc=""), + puDonutEt2 = Var("puDonutEt(2)",int,doc=""), + puDonutEt3 = Var("puDonutEt(3)",int,doc=""), + ) +) + +l1TauTable = cms.EDProducer("SimpleTriggerL1TauFlatTableProducer", + src = cms.InputTag("caloStage2Digis","Tau"), + minBX = cms.int32(-2), + maxBX = cms.int32(2), + cut = cms.string(""), + name= cms.string("L1Tau"), + doc = cms.string(""), + extension = cms.bool(False), # this is the main table for L1 EGs + variables = cms.PSet(l1ObjVars, + towerIEta = Var("towerIEta()",int,doc=""), + towerIPhi = Var("towerIPhi()",int,doc=""), + rawEt = Var("rawEt()",int,doc=""), + isoEt = Var("isoEt()",int,doc=""), + nTT = Var("nTT()",int,doc=""), + hasEM = Var("hasEM()",int,doc=""), + isMerged = Var("isMerged()",int,doc=""), + + ) +) + +l1EtSumTable = cms.EDProducer("SimpleTriggerL1EtSumFlatTableProducer", + src = cms.InputTag("caloStage2Digis","EtSum"), + minBX = cms.int32(-2), + maxBX = cms.int32(2), + cut = cms.string(""), + name= cms.string("L1EtSum"), + doc = cms.string(""), + extension = cms.bool(False), # this is the main table for L1 EGs + variables = cms.PSet(PTVars, + hwPt = Var("hwPt()",int,doc="hardware pt"), + hwPhi = Var("hwPhi()",int,doc="hardware phi"), + etSumType = Var("getType()",int,doc=""), + ) +) + +l1EGTable = cms.EDProducer("SimpleTriggerL1EGFlatTableProducer", + src = cms.InputTag("caloStage2Digis","EGamma"), + minBX = cms.int32(-2), + maxBX = cms.int32(2), + cut = cms.string(""), + name= cms.string("L1EG"), + doc = cms.string(""), + extension = cms.bool(False), # this is the main table for L1 EGs + variables = cms.PSet(l1ObjVars, + towerIEta = Var("towerIEta()",int,doc="tower ieta"), + towerIPhi = Var("towerIPhi()",int,doc="tower iphi"), + rawEt = Var("rawEt()",int,doc="raw et"), + isoEt = Var("isoEt()",int,doc="iso et"), + footprintEt = Var("footprintEt()",int,doc=" footprint et"), + nTT = Var("nTT()",int,doc="nr trig towers"), + shape = Var("shape()",int,doc="shape"), + towerHoE = Var("towerHoE()",int,doc="tower H/E"), + ) +) + +l1TablesTask = cms.Task(l1EGTable,l1EtSumTable,l1TauTable,l1JetTable,l1MuTable) diff --git a/PhysicsTools/NanoAOD/python/nano_cff.py b/PhysicsTools/NanoAOD/python/nano_cff.py index 4e9965a19b938..4cabc8c788a42 100644 --- a/PhysicsTools/NanoAOD/python/nano_cff.py +++ b/PhysicsTools/NanoAOD/python/nano_cff.py @@ -27,6 +27,7 @@ from PhysicsTools.NanoAOD.NanoAODEDMEventContent_cff import * from PhysicsTools.NanoAOD.fsrPhotons_cff import * from PhysicsTools.NanoAOD.softActivity_cff import * +from PhysicsTools.NanoAOD.l1trig_cff import * nanoMetadata = cms.EDProducer("UniqueStringProducer", strings = cms.PSet( @@ -210,3 +211,7 @@ def nanoWmassGenCustomize(process): etaPrecision="{} ? {} : {}".format(pdgSelection, CandVars.eta.precision.value(), genParticleTable.variables.eta.precision.value()) process.genParticleTable.variables.eta.precision=cms.string(etaPrecision) return process + +def nanoL1TrigObjCustomize(process): + process.nanoTableTaskCommon.add(process.l1TablesTask) + return process From 5a81f6ea6ef70ab220dc37c838abbfcb18a9f7d0 Mon Sep 17 00:00:00 2001 From: Sam Harper Date: Thu, 9 Feb 2023 13:16:11 +0100 Subject: [PATCH 02/12] adding more customisation options for nano --- PhysicsTools/NanoAOD/python/l1trig_cff.py | 45 ++++++++++++++++++++++- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/PhysicsTools/NanoAOD/python/l1trig_cff.py b/PhysicsTools/NanoAOD/python/l1trig_cff.py index 0dcbd9183fbbd..d9f005d41aed6 100644 --- a/PhysicsTools/NanoAOD/python/l1trig_cff.py +++ b/PhysicsTools/NanoAOD/python/l1trig_cff.py @@ -2,8 +2,17 @@ from PhysicsTools.NanoAOD.nano_eras_cff import * from PhysicsTools.NanoAOD.common_cff import * +l1PtVars = cms.PSet( + pt = Var("pt", float, precision=5), + phi = Var("phi", float, precision=5), +) +l1P3Vars = cms.PSet( + l1PtVars, + eta = Var("eta", float, precision=5), +) + l1ObjVars = cms.PSet( - P3Vars, + l1P3Vars, hwPt = Var("hwPt()",int,doc="hardware pt"), hwEta = Var("hwEta()",int,doc="hardware eta"), hwPhi = Var("hwPhi()",int,doc="hardware phi"), @@ -89,7 +98,7 @@ name= cms.string("L1EtSum"), doc = cms.string(""), extension = cms.bool(False), # this is the main table for L1 EGs - variables = cms.PSet(PTVars, + variables = cms.PSet(l1PtVars, hwPt = Var("hwPt()",int,doc="hardware pt"), hwPhi = Var("hwPhi()",int,doc="hardware phi"), etSumType = Var("getType()",int,doc=""), @@ -117,3 +126,35 @@ ) l1TablesTask = cms.Task(l1EGTable,l1EtSumTable,l1TauTable,l1JetTable,l1MuTable) + +def setL1NanoToReduced(process): + """ + sets the L1 objects only have reduced information which is necessary + for central nano + """ + #reduce the variables to the core variables + #note et sum variables are already reduced + process.l1EGTable.variables = cms.PSet(l1ObjVars) + process.l1MuTable.variables = cms.PSet(l1ObjVars) + process.l1JetTable.variables = cms.PSet(l1ObjVars) + process.l1TauTable.variables = cms.PSet(l1ObjVars) + + #restrict bx + process.l1EGTable.minBX = 0 + process.l1EGTable.maxBX = 0 + process.l1MuTable.minBX = 0 + process.l1MuTable.maxBX = 0 + process.l1JetTable.minBX = 0 + process.l1JetTable.maxBX = 0 + process.l1TauTable.minBX = 0 + process.l1TauTable.maxBX = 0 + process.l1EtSumTable.minBX = 0 + process.l1EtSumTable.maxBX = 0 + + #apply cuts + process.l1EGTable.cut="hwPt>=10" + process.l1TauTable.cut="hwPt>=50" + process.l1JetTable.cut="hwPt>=100" + + + return process From 8b713053f870c68101ee1a2f53531851fc8bdea8 Mon Sep 17 00:00:00 2001 From: Sam Harper Date: Thu, 9 Feb 2023 13:18:26 +0100 Subject: [PATCH 03/12] adding fill desc and reduced L1Nano option --- .../NanoAOD/interface/SimpleFlatTableProducer.h | 17 ++++++++++++++++- PhysicsTools/NanoAOD/python/nano_cff.py | 5 +++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/PhysicsTools/NanoAOD/interface/SimpleFlatTableProducer.h b/PhysicsTools/NanoAOD/interface/SimpleFlatTableProducer.h index 26657e489eb87..b6540c4233986 100644 --- a/PhysicsTools/NanoAOD/interface/SimpleFlatTableProducer.h +++ b/PhysicsTools/NanoAOD/interface/SimpleFlatTableProducer.h @@ -369,12 +369,27 @@ class BXVectorSimpleFlatTableProducer : public SimpleFlatTableProducerBase>::baseDescriptions(); + desc.add("cut", "")->setComment("selection on the main input collection (but selection can not be bx based)"); + desc.addOptional("maxLen")->setComment( + "define the maximum length of the input collection to put in the branch"); + desc.add("minBX",-2)->setComment("min bx (inclusive) to include"); + desc.add("maxBX",2)->setComment("max bx (inclusive) to include"); + descriptions.addWithDefaultLabel(desc); + } + std::unique_ptr fillTable(const edm::Event &iEvent, const edm::Handle> &prod) const override { + std::vector selObjs; std::vector selObjBXs; + if (prod.isValid() || !(this->skipNonExistingSrc_)) { - for (int bx = minBX_; bx <= maxBX_; bx++) { + const int minBX = std::max(minBX_,prod->getFirstBX()); + const int maxBX = std::min(maxBX_,prod->getLastBX()); + for (int bx = minBX; bx <= maxBX; bx++) { for (size_t objNr = 0, nrObjs = prod->size(bx); objNr < nrObjs; ++objNr) { const auto &obj = prod->at(bx, objNr); if (cut_(obj)) { diff --git a/PhysicsTools/NanoAOD/python/nano_cff.py b/PhysicsTools/NanoAOD/python/nano_cff.py index 4cabc8c788a42..8eff7f79ed17f 100644 --- a/PhysicsTools/NanoAOD/python/nano_cff.py +++ b/PhysicsTools/NanoAOD/python/nano_cff.py @@ -213,5 +213,10 @@ def nanoWmassGenCustomize(process): return process def nanoL1TrigObjCustomize(process): + process.nanoTableTaskCommon.add(process.l1TablesTask) + process = setL1NanoToReduced(process) + return process + +def nanoL1TrigObjCustomizeFull(process): process.nanoTableTaskCommon.add(process.l1TablesTask) return process From 7d30f14ca71845f736643f330f4d990ce3db7122 Mon Sep 17 00:00:00 2001 From: Sam Harper Date: Tue, 14 Feb 2023 17:24:31 +0100 Subject: [PATCH 04/12] updating format to that suggested by Laurent T --- PhysicsTools/NanoAOD/python/l1trig_cff.py | 50 ++++++++++++++++++----- 1 file changed, 39 insertions(+), 11 deletions(-) diff --git a/PhysicsTools/NanoAOD/python/l1trig_cff.py b/PhysicsTools/NanoAOD/python/l1trig_cff.py index d9f005d41aed6..d9e830ad65223 100644 --- a/PhysicsTools/NanoAOD/python/l1trig_cff.py +++ b/PhysicsTools/NanoAOD/python/l1trig_cff.py @@ -20,6 +20,31 @@ hwIso = Var("hwIso()",int,doc="hardware iso") ) +l1JetReducedVars = cms.PSet( + l1P3Vars +) + +l1EtSumReducedVars = cms.PSet( + l1PtVars +) +l1EGReducedVars = cms.PSet( + l1P3Vars, + hwIso = Var("hwIso()",int,doc="hardware iso") +) + +l1TauReducedVars = cms.PSet( + l1P3Vars, + hwIso = Var("hwIso()",int,doc="hardware iso") +) + +l1MuonReducedVars = cms.PSet( + hwQual = Var("hwQual()",int,doc="hardware qual"), + hwCharge = Var("hwCharge()",int,doc=""), + etaAtVtx = Var("etaAtVtx()",float,doc=""), + phiAtVtx = Var("phiAtVtx()",float,doc=""), + ptUnconstrained = Var("ptUnconstrained()",float,doc=""), + hwDXY = Var("hwDXY()",int,doc=""), +) l1MuTable = cms.EDProducer("SimpleTriggerL1MuonFlatTableProducer", src = cms.InputTag("gmtStage2Digis","Muon"), @@ -28,7 +53,7 @@ cut = cms.string(""), name= cms.string("L1Mu"), doc = cms.string(""), - extension = cms.bool(False), # this is the main table for L1 EGs + extension = cms.bool(False), variables = cms.PSet(l1ObjVars, hwCharge = Var("hwCharge()",int,doc=""), hwChargeValid = Var("hwChargeValid()",int,doc=""), @@ -56,7 +81,7 @@ cut = cms.string(""), name= cms.string("L1Jet"), doc = cms.string(""), - extension = cms.bool(False), # this is the main table for L1 EGs + extension = cms.bool(False), variables = cms.PSet(l1ObjVars, towerIEta = Var("towerIEta()",int,doc=""), towerIPhi = Var("towerIPhi()",int,doc=""), @@ -97,7 +122,7 @@ cut = cms.string(""), name= cms.string("L1EtSum"), doc = cms.string(""), - extension = cms.bool(False), # this is the main table for L1 EGs + extension = cms.bool(False), variables = cms.PSet(l1PtVars, hwPt = Var("hwPt()",int,doc="hardware pt"), hwPhi = Var("hwPhi()",int,doc="hardware phi"), @@ -112,7 +137,7 @@ cut = cms.string(""), name= cms.string("L1EG"), doc = cms.string(""), - extension = cms.bool(False), # this is the main table for L1 EGs + extension = cms.bool(False), variables = cms.PSet(l1ObjVars, towerIEta = Var("towerIEta()",int,doc="tower ieta"), towerIPhi = Var("towerIPhi()",int,doc="tower iphi"), @@ -134,10 +159,11 @@ def setL1NanoToReduced(process): """ #reduce the variables to the core variables #note et sum variables are already reduced - process.l1EGTable.variables = cms.PSet(l1ObjVars) - process.l1MuTable.variables = cms.PSet(l1ObjVars) - process.l1JetTable.variables = cms.PSet(l1ObjVars) - process.l1TauTable.variables = cms.PSet(l1ObjVars) + process.l1EGTable.variables = cms.PSet(l1EGReducedVars) + process.l1MuTable.variables = cms.PSet(l1MuonReducedVars) + process.l1JetTable.variables = cms.PSet(l1JetReducedVars) + process.l1TauTable.variables = cms.PSet(l1TauReducedVars) + process.l1EtSumTable.variables = cms.PSet(l1EtSumReducedVars) #restrict bx process.l1EGTable.minBX = 0 @@ -152,9 +178,11 @@ def setL1NanoToReduced(process): process.l1EtSumTable.maxBX = 0 #apply cuts - process.l1EGTable.cut="hwPt>=10" - process.l1TauTable.cut="hwPt>=50" - process.l1JetTable.cut="hwPt>=100" + process.l1EGTable.cut="pt>=10" + process.l1TauTable.cut="pt>=24" + process.l1JetTable.cut="pt>=30" + process.l1MuTable.cut="pt>=3 && hwQual>=8" + process.l1EtSumTable.cut="(getType==8 || getType==1)" return process From a773bdb72062275e4636eef05257116872f214fd Mon Sep 17 00:00:00 2001 From: Sam Harper Date: Thu, 16 Feb 2023 15:55:18 +0100 Subject: [PATCH 05/12] adjusting pt/eta/phi precision, adding ET types 2 and 3 --- PhysicsTools/NanoAOD/python/l1trig_cff.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/PhysicsTools/NanoAOD/python/l1trig_cff.py b/PhysicsTools/NanoAOD/python/l1trig_cff.py index d9e830ad65223..467998c794a93 100644 --- a/PhysicsTools/NanoAOD/python/l1trig_cff.py +++ b/PhysicsTools/NanoAOD/python/l1trig_cff.py @@ -3,12 +3,12 @@ from PhysicsTools.NanoAOD.common_cff import * l1PtVars = cms.PSet( - pt = Var("pt", float, precision=5), - phi = Var("phi", float, precision=5), + pt = Var("pt", float, precision=10), + phi = Var("phi", float, precision=10), ) l1P3Vars = cms.PSet( l1PtVars, - eta = Var("eta", float, precision=5), + eta = Var("eta", float, precision=10), ) l1ObjVars = cms.PSet( @@ -182,7 +182,6 @@ def setL1NanoToReduced(process): process.l1TauTable.cut="pt>=24" process.l1JetTable.cut="pt>=30" process.l1MuTable.cut="pt>=3 && hwQual>=8" - process.l1EtSumTable.cut="(getType==8 || getType==1)" - + process.l1EtSumTable.cut="(getType==8 || getType==1 || getType==2 || getType==3)" return process From e003ff2b671f72bc8da83b45a3e07b0030917c24 Mon Sep 17 00:00:00 2001 From: Sam Harper Date: Thu, 2 Mar 2023 10:39:35 +0100 Subject: [PATCH 06/12] adding missing variables from reduced as found by Finn --- PhysicsTools/NanoAOD/python/l1trig_cff.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/PhysicsTools/NanoAOD/python/l1trig_cff.py b/PhysicsTools/NanoAOD/python/l1trig_cff.py index 467998c794a93..9f154cba2bfc3 100644 --- a/PhysicsTools/NanoAOD/python/l1trig_cff.py +++ b/PhysicsTools/NanoAOD/python/l1trig_cff.py @@ -25,7 +25,8 @@ ) l1EtSumReducedVars = cms.PSet( - l1PtVars + l1PtVars, + etSumType = Var("getType()",int,doc="et sum type"), ) l1EGReducedVars = cms.PSet( l1P3Vars, @@ -38,6 +39,7 @@ ) l1MuonReducedVars = cms.PSet( + l1P3Vars, hwQual = Var("hwQual()",int,doc="hardware qual"), hwCharge = Var("hwCharge()",int,doc=""), etaAtVtx = Var("etaAtVtx()",float,doc=""), From 915dd4bf3fcd0ee44cf7269381a626e55780c1e9 Mon Sep 17 00:00:00 2001 From: Sam Harper Date: Wed, 8 Mar 2023 14:31:29 +0100 Subject: [PATCH 07/12] code format --- .../NanoAOD/interface/SimpleFlatTableProducer.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/PhysicsTools/NanoAOD/interface/SimpleFlatTableProducer.h b/PhysicsTools/NanoAOD/interface/SimpleFlatTableProducer.h index b6540c4233986..e77af3a99cad0 100644 --- a/PhysicsTools/NanoAOD/interface/SimpleFlatTableProducer.h +++ b/PhysicsTools/NanoAOD/interface/SimpleFlatTableProducer.h @@ -372,23 +372,23 @@ class BXVectorSimpleFlatTableProducer : public SimpleFlatTableProducerBase>::baseDescriptions(); - desc.add("cut", "")->setComment("selection on the main input collection (but selection can not be bx based)"); + desc.add("cut", "")->setComment( + "selection on the main input collection (but selection can not be bx based)"); desc.addOptional("maxLen")->setComment( - "define the maximum length of the input collection to put in the branch"); - desc.add("minBX",-2)->setComment("min bx (inclusive) to include"); - desc.add("maxBX",2)->setComment("max bx (inclusive) to include"); + "define the maximum length of the input collection to put in the branch"); + desc.add("minBX", -2)->setComment("min bx (inclusive) to include"); + desc.add("maxBX", 2)->setComment("max bx (inclusive) to include"); descriptions.addWithDefaultLabel(desc); } std::unique_ptr fillTable(const edm::Event &iEvent, const edm::Handle> &prod) const override { - std::vector selObjs; std::vector selObjBXs; if (prod.isValid() || !(this->skipNonExistingSrc_)) { - const int minBX = std::max(minBX_,prod->getFirstBX()); - const int maxBX = std::min(maxBX_,prod->getLastBX()); + const int minBX = std::max(minBX_, prod->getFirstBX()); + const int maxBX = std::min(maxBX_, prod->getLastBX()); for (int bx = minBX; bx <= maxBX; bx++) { for (size_t objNr = 0, nrObjs = prod->size(bx); objNr < nrObjs; ++objNr) { const auto &obj = prod->at(bx, objNr); From 1b966d0efe7276b9ff384dfaf702ce4a9b2c6336 Mon Sep 17 00:00:00 2001 From: Sam Harper Date: Thu, 23 Mar 2023 14:46:33 +0000 Subject: [PATCH 08/12] review comments; bx value and precision --- .../interface/SimpleFlatTableProducer.h | 7 +- PhysicsTools/NanoAOD/python/l1trig_cff.py | 66 ++++++++----------- 2 files changed, 34 insertions(+), 39 deletions(-) diff --git a/PhysicsTools/NanoAOD/interface/SimpleFlatTableProducer.h b/PhysicsTools/NanoAOD/interface/SimpleFlatTableProducer.h index e77af3a99cad0..3ec683fea74d0 100644 --- a/PhysicsTools/NanoAOD/interface/SimpleFlatTableProducer.h +++ b/PhysicsTools/NanoAOD/interface/SimpleFlatTableProducer.h @@ -360,6 +360,7 @@ class BXVectorSimpleFlatTableProducer : public SimpleFlatTableProducerBase("cut"), true), minBX_(params.getParameter("minBX")), maxBX_(params.getParameter("maxBX")), + alwaysWriteBXValue_(params.getParameter("alwaysWriteBXValue")), bxVarName_("bx") { edm::ParameterSet const &varsPSet = params.getParameter("variables"); auto varNames = varsPSet.getParameterNamesForType(); @@ -378,6 +379,7 @@ class BXVectorSimpleFlatTableProducer : public SimpleFlatTableProducerBase("minBX", -2)->setComment("min bx (inclusive) to include"); desc.add("maxBX", 2)->setComment("max bx (inclusive) to include"); + desc.add("alwaysWriteBXValue",true)->setComment("always write the bx number (event when only one bx can be present, ie minBX==maxBX)"); descriptions.addWithDefaultLabel(desc); } @@ -404,7 +406,9 @@ class BXVectorSimpleFlatTableProducer : public SimpleFlatTableProducerBase(selObjs.size(), this->name_, false, this->extension_); for (const auto &var : this->vars_) var->fill(selObjs, *out); - out->template addColumn(bxVarName_, selObjBXs, "BX of the L1 candidate"); + if(alwaysWriteBXValue_ || minBX_!=maxBX_){ + out->template addColumn(bxVarName_, selObjBXs, "BX of the L1 candidate"); + } return out; } @@ -413,6 +417,7 @@ class BXVectorSimpleFlatTableProducer : public SimpleFlatTableProducerBase cut_; const int minBX_; const int maxBX_; + const bool alwaysWriteBXValue_; const std::string bxVarName_; }; diff --git a/PhysicsTools/NanoAOD/python/l1trig_cff.py b/PhysicsTools/NanoAOD/python/l1trig_cff.py index 9f154cba2bfc3..8aec4b9bca17d 100644 --- a/PhysicsTools/NanoAOD/python/l1trig_cff.py +++ b/PhysicsTools/NanoAOD/python/l1trig_cff.py @@ -2,13 +2,15 @@ from PhysicsTools.NanoAOD.nano_eras_cff import * from PhysicsTools.NanoAOD.common_cff import * +precision=10 + l1PtVars = cms.PSet( - pt = Var("pt", float, precision=10), - phi = Var("phi", float, precision=10), + pt = Var("pt", float, precision=precision), + phi = Var("phi", float, precision=precision), ) l1P3Vars = cms.PSet( l1PtVars, - eta = Var("eta", float, precision=10), + eta = Var("eta", float, precision=precision), ) l1ObjVars = cms.PSet( @@ -41,11 +43,11 @@ l1MuonReducedVars = cms.PSet( l1P3Vars, hwQual = Var("hwQual()",int,doc="hardware qual"), - hwCharge = Var("hwCharge()",int,doc=""), - etaAtVtx = Var("etaAtVtx()",float,doc=""), - phiAtVtx = Var("phiAtVtx()",float,doc=""), - ptUnconstrained = Var("ptUnconstrained()",float,doc=""), - hwDXY = Var("hwDXY()",int,doc=""), + hwCharge = Var("hwCharge()",int,doc="hardware charge"), + etaAtVtx = Var("etaAtVtx()",float,precision=precision,doc="eta estimated at the vertex"), + phiAtVtx = Var("phiAtVtx()",float,precision=precision,doc="phi estimated at the vertex"), + ptUnconstrained = Var("ptUnconstrained()",float,precision=precision,doc="pt when not constrained to the beamspot"), + hwDXY = Var("hwDXY()",int,doc="hardware impact parameter"), ) l1MuTable = cms.EDProducer("SimpleTriggerL1MuonFlatTableProducer", @@ -61,11 +63,11 @@ hwChargeValid = Var("hwChargeValid()",int,doc=""), tfMuonIndex = Var("tfMuonIndex()",int,doc=""), hwTag = Var("hwTag()",int,doc=""), - hwEtaAtVtx = Var("hwEtaAtVtx()",int,doc=""), - hwPhiAtVtx = Var("hwPhiAtVtx()",int,doc=""), - etaAtVtx = Var("etaAtVtx()",float,doc=""), - phiAtVtx = Var("phiAtVtx()",float,doc=""), - hwIsoSum = Var("hwIsoSum()",int,doc=""), + hwEtaAtVtx = Var("hwEtaAtVtx()",int,doc="hardware eta estimated at the vertex"), + hwPhiAtVtx = Var("hwPhiAtVtx()",int,doc="hardware phi estimated at the vertex"), + etaAtVtx = Var("etaAtVtx()",float,doc="eta estimated at the vertex"), + phiAtVtx = Var("phiAtVtx()",float,doc="phi estimated at the vertex"), + hwIsoSum = Var("hwIsoSum()",int,doc="hardware iso sum"), hwDPhiExtra = Var("hwDPhiExtra()",int,doc=""), hwDEtaExtra = Var("hwDEtaExtra()",int,doc=""), hwRank = Var("hwRank()",int,doc=""), @@ -85,11 +87,11 @@ doc = cms.string(""), extension = cms.bool(False), variables = cms.PSet(l1ObjVars, - towerIEta = Var("towerIEta()",int,doc=""), - towerIPhi = Var("towerIPhi()",int,doc=""), - rawEt = Var("rawEt()",int,doc=""), - seedEt = Var("seedEt()",int,doc=""), - puEt = Var("puEt()",int,doc=""), + towerIEta = Var("towerIEta()",int,doc="the ieta of the tower"), + towerIPhi = Var("towerIPhi()",int,doc="the iphi of the tower"), + rawEt = Var("rawEt()",int,doc="raw (uncalibrated) et"), + seedEt = Var("seedEt()",int,doc="et of the seed"), + puEt = Var("puEt()",int,doc="pile up et "), puDonutEt0 = Var("puDonutEt(0)",int,doc=""), puDonutEt1 = Var("puDonutEt(1)",int,doc=""), puDonutEt2 = Var("puDonutEt(2)",int,doc=""), @@ -106,13 +108,13 @@ doc = cms.string(""), extension = cms.bool(False), # this is the main table for L1 EGs variables = cms.PSet(l1ObjVars, - towerIEta = Var("towerIEta()",int,doc=""), - towerIPhi = Var("towerIPhi()",int,doc=""), - rawEt = Var("rawEt()",int,doc=""), - isoEt = Var("isoEt()",int,doc=""), - nTT = Var("nTT()",int,doc=""), - hasEM = Var("hasEM()",int,doc=""), - isMerged = Var("isMerged()",int,doc=""), + towerIEta = Var("towerIEta()",int,doc="the ieta of the tower"), + towerIPhi = Var("towerIPhi()",int,doc="the iphi of the tower"), + rawEt = Var("rawEt()",int,doc="raw Et of tau"), + isoEt = Var("isoEt()",int,doc="raw isolation sum - cluster sum"), + nTT = Var("nTT()",int,doc=" nr towers above threshold"), + hasEM = Var("hasEM()",int,doc="has an em component"), + isMerged = Var("isMerged()",int,doc="is merged"), ) ) @@ -128,7 +130,7 @@ variables = cms.PSet(l1PtVars, hwPt = Var("hwPt()",int,doc="hardware pt"), hwPhi = Var("hwPhi()",int,doc="hardware phi"), - etSumType = Var("getType()",int,doc=""), + 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)"), ) ) @@ -167,18 +169,6 @@ def setL1NanoToReduced(process): process.l1TauTable.variables = cms.PSet(l1TauReducedVars) process.l1EtSumTable.variables = cms.PSet(l1EtSumReducedVars) - #restrict bx - process.l1EGTable.minBX = 0 - process.l1EGTable.maxBX = 0 - process.l1MuTable.minBX = 0 - process.l1MuTable.maxBX = 0 - process.l1JetTable.minBX = 0 - process.l1JetTable.maxBX = 0 - process.l1TauTable.minBX = 0 - process.l1TauTable.maxBX = 0 - process.l1EtSumTable.minBX = 0 - process.l1EtSumTable.maxBX = 0 - #apply cuts process.l1EGTable.cut="pt>=10" process.l1TauTable.cut="pt>=24" From 14e083713e9cfe33e1994ef5bc985cf7d47e07e5 Mon Sep 17 00:00:00 2001 From: Sam Harper Date: Thu, 23 Mar 2023 17:16:24 +0000 Subject: [PATCH 09/12] adjusting to precision=12 and int16 --- PhysicsTools/NanoAOD/python/l1trig_cff.py | 112 +++++++++++----------- 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/PhysicsTools/NanoAOD/python/l1trig_cff.py b/PhysicsTools/NanoAOD/python/l1trig_cff.py index 8aec4b9bca17d..add16a8e67b15 100644 --- a/PhysicsTools/NanoAOD/python/l1trig_cff.py +++ b/PhysicsTools/NanoAOD/python/l1trig_cff.py @@ -2,24 +2,30 @@ from PhysicsTools.NanoAOD.nano_eras_cff import * from PhysicsTools.NanoAOD.common_cff import * -precision=10 - +l1_float_precision_=12 +print("l1pre",l1_float_precision_) l1PtVars = cms.PSet( - pt = Var("pt", float, precision=precision), - phi = Var("phi", float, precision=precision), + pt = Var("pt", float, precision=l1_float_precision_), + phi = Var("phi", float, precision=l1_float_precision_), ) l1P3Vars = cms.PSet( l1PtVars, - eta = Var("eta", float, precision=precision), + eta = Var("eta", float, precision=l1_float_precision_), ) l1ObjVars = cms.PSet( l1P3Vars, - hwPt = Var("hwPt()",int,doc="hardware pt"), - hwEta = Var("hwEta()",int,doc="hardware eta"), - hwPhi = Var("hwPhi()",int,doc="hardware phi"), - hwQual = Var("hwQual()",int,doc="hardware qual"), - hwIso = Var("hwIso()",int,doc="hardware iso") + hwPt = Var("hwPt()","int16",doc="hardware pt"), + hwEta = Var("hwEta()","int16",doc="hardware eta"), + hwPhi = Var("hwPhi()","int16",doc="hardware phi"), + hwQual = Var("hwQual()","int16",doc="hardware qual"), + hwIso = Var("hwIso()","int16",doc="hardware iso") +) + +l1CaloObjVars = cms.PSet( + l1ObjVars, + towerIEta = Var("towerIEta()","int16",doc="the ieta of the tower"), + towerIPhi = Var("towerIPhi()","int16",doc="the iphi of the tower"), ) l1JetReducedVars = cms.PSet( @@ -32,22 +38,22 @@ ) l1EGReducedVars = cms.PSet( l1P3Vars, - hwIso = Var("hwIso()",int,doc="hardware iso") + hwIso = Var("hwIso()","int16",doc="hardware iso") ) l1TauReducedVars = cms.PSet( l1P3Vars, - hwIso = Var("hwIso()",int,doc="hardware iso") + hwIso = Var("hwIso()","int16",doc="hardware iso") ) l1MuonReducedVars = cms.PSet( l1P3Vars, hwQual = Var("hwQual()",int,doc="hardware qual"), - hwCharge = Var("hwCharge()",int,doc="hardware charge"), - etaAtVtx = Var("etaAtVtx()",float,precision=precision,doc="eta estimated at the vertex"), - phiAtVtx = Var("phiAtVtx()",float,precision=precision,doc="phi estimated at the vertex"), - ptUnconstrained = Var("ptUnconstrained()",float,precision=precision,doc="pt when not constrained to the beamspot"), - hwDXY = Var("hwDXY()",int,doc="hardware impact parameter"), + hwCharge = Var("hwCharge()","int16",doc="hardware charge"), + etaAtVtx = Var("etaAtVtx()",float,precision=l1_float_precision_,doc="eta estimated at the vertex"), + phiAtVtx = Var("phiAtVtx()",float,precision=l1_float_precision_,doc="phi estimated at the vertex"), + ptUnconstrained = Var("ptUnconstrained()",float,precision=l1_float_precision_,doc="pt when not constrained to the beamspot"), + hwDXY = Var("hwDXY()","int16",doc="hardware impact parameter"), ) l1MuTable = cms.EDProducer("SimpleTriggerL1MuonFlatTableProducer", @@ -59,21 +65,21 @@ doc = cms.string(""), extension = cms.bool(False), variables = cms.PSet(l1ObjVars, - hwCharge = Var("hwCharge()",int,doc=""), - hwChargeValid = Var("hwChargeValid()",int,doc=""), - tfMuonIndex = Var("tfMuonIndex()",int,doc=""), - hwTag = Var("hwTag()",int,doc=""), - hwEtaAtVtx = Var("hwEtaAtVtx()",int,doc="hardware eta estimated at the vertex"), - hwPhiAtVtx = Var("hwPhiAtVtx()",int,doc="hardware phi estimated at the vertex"), + hwCharge = Var("hwCharge()","int16",doc="Charge (can be 0 if the charge measurement was not valid)"), + hwChargeValid = Var("hwChargeValid()","int16",doc=""), + 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"), + hwTag = Var("hwTag()","int16",doc="not in L1 ntuples"), + hwEtaAtVtx = Var("hwEtaAtVtx()","int16",doc="hardware eta estimated at the vertex"), + hwPhiAtVtx = Var("hwPhiAtVtx()","int16",doc="hardware phi estimated at the vertex"), etaAtVtx = Var("etaAtVtx()",float,doc="eta estimated at the vertex"), phiAtVtx = Var("phiAtVtx()",float,doc="phi estimated at the vertex"), - hwIsoSum = Var("hwIsoSum()",int,doc="hardware iso sum"), - hwDPhiExtra = Var("hwDPhiExtra()",int,doc=""), - hwDEtaExtra = Var("hwDEtaExtra()",int,doc=""), - hwRank = Var("hwRank()",int,doc=""), - hwPtUnconstrained = Var("hwPtUnconstrained()",int,doc=""), + hwIsoSum = Var("hwIsoSum()","int16",doc="not in L1 ntuples"), + 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"), + 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)"), + hwRank = Var("hwRank()","int16",doc="not in L1Ntuples"), + hwPtUnconstrained = Var("hwPtUnconstrained()","int16",doc=""), ptUnconstrained = Var("ptUnconstrained()",float,doc=""), - hwDXY = Var("hwDXY()",int,doc=""), + hwDXY = Var("hwDXY()","uint16",doc=""), ) ) @@ -86,16 +92,14 @@ name= cms.string("L1Jet"), doc = cms.string(""), extension = cms.bool(False), - variables = cms.PSet(l1ObjVars, - towerIEta = Var("towerIEta()",int,doc="the ieta of the tower"), - towerIPhi = Var("towerIPhi()",int,doc="the iphi of the tower"), - rawEt = Var("rawEt()",int,doc="raw (uncalibrated) et"), - seedEt = Var("seedEt()",int,doc="et of the seed"), - puEt = Var("puEt()",int,doc="pile up et "), - puDonutEt0 = Var("puDonutEt(0)",int,doc=""), - puDonutEt1 = Var("puDonutEt(1)",int,doc=""), - puDonutEt2 = Var("puDonutEt(2)",int,doc=""), - puDonutEt3 = Var("puDonutEt(3)",int,doc=""), + variables = cms.PSet(l1CaloObjVars, + rawEt = Var("rawEt()","int16",doc="raw (uncalibrated) et"), + seedEt = Var("seedEt()","int16",doc="et of the seed"), + puEt = Var("puEt()","int16",doc="pile up et "), + puDonutEt0 = Var("puDonutEt(0)","int16",doc=""), + puDonutEt1 = Var("puDonutEt(1)","int16",doc=""), + puDonutEt2 = Var("puDonutEt(2)","int16",doc=""), + puDonutEt3 = Var("puDonutEt(3)","int16",doc=""), ) ) @@ -107,14 +111,12 @@ name= cms.string("L1Tau"), doc = cms.string(""), extension = cms.bool(False), # this is the main table for L1 EGs - variables = cms.PSet(l1ObjVars, - towerIEta = Var("towerIEta()",int,doc="the ieta of the tower"), - towerIPhi = Var("towerIPhi()",int,doc="the iphi of the tower"), - rawEt = Var("rawEt()",int,doc="raw Et of tau"), - isoEt = Var("isoEt()",int,doc="raw isolation sum - cluster sum"), - nTT = Var("nTT()",int,doc=" nr towers above threshold"), - hasEM = Var("hasEM()",int,doc="has an em component"), - isMerged = Var("isMerged()",int,doc="is merged"), + variables = cms.PSet(l1CaloObjVars, + rawEt = Var("rawEt()","int16",doc="raw Et of tau"), + isoEt = Var("isoEt()","int16",doc="raw isolation sum - cluster sum"), + nTT = Var("nTT()","int16",doc=" nr towers above threshold"), + hasEM = Var("hasEM()",bool,doc="has an em component"), + isMerged = Var("isMerged()",bool,doc="is merged"), ) ) @@ -142,15 +144,13 @@ name= cms.string("L1EG"), doc = cms.string(""), extension = cms.bool(False), - variables = cms.PSet(l1ObjVars, - towerIEta = Var("towerIEta()",int,doc="tower ieta"), - towerIPhi = Var("towerIPhi()",int,doc="tower iphi"), - rawEt = Var("rawEt()",int,doc="raw et"), - isoEt = Var("isoEt()",int,doc="iso et"), - footprintEt = Var("footprintEt()",int,doc=" footprint et"), - nTT = Var("nTT()",int,doc="nr trig towers"), - shape = Var("shape()",int,doc="shape"), - towerHoE = Var("towerHoE()",int,doc="tower H/E"), + variables = cms.PSet(l1CaloObjVars, + rawEt = Var("rawEt()","int16",doc="raw et"), + isoEt = Var("isoEt()","int16",doc="iso et"), + footprintEt = Var("footprintEt()","int16",doc=" footprint et"), + nTT = Var("nTT()","int16",doc="nr trig towers"), + shape = Var("shape()","int16",doc="shape"), + towerHoE = Var("towerHoE()","int16",doc="tower H/E"), ) ) From 450027d33f427ca4dfea951f968022640b87257b Mon Sep 17 00:00:00 2001 From: Sam Harper Date: Thu, 23 Mar 2023 18:16:46 +0000 Subject: [PATCH 10/12] code checks --- PhysicsTools/NanoAOD/interface/SimpleFlatTableProducer.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/PhysicsTools/NanoAOD/interface/SimpleFlatTableProducer.h b/PhysicsTools/NanoAOD/interface/SimpleFlatTableProducer.h index 3ec683fea74d0..85d63e7ca8948 100644 --- a/PhysicsTools/NanoAOD/interface/SimpleFlatTableProducer.h +++ b/PhysicsTools/NanoAOD/interface/SimpleFlatTableProducer.h @@ -379,7 +379,8 @@ class BXVectorSimpleFlatTableProducer : public SimpleFlatTableProducerBase("minBX", -2)->setComment("min bx (inclusive) to include"); desc.add("maxBX", 2)->setComment("max bx (inclusive) to include"); - desc.add("alwaysWriteBXValue",true)->setComment("always write the bx number (event when only one bx can be present, ie minBX==maxBX)"); + desc.add("alwaysWriteBXValue", true) + ->setComment("always write the bx number (event when only one bx can be present, ie minBX==maxBX)"); descriptions.addWithDefaultLabel(desc); } @@ -406,7 +407,7 @@ class BXVectorSimpleFlatTableProducer : public SimpleFlatTableProducerBase(selObjs.size(), this->name_, false, this->extension_); for (const auto &var : this->vars_) var->fill(selObjs, *out); - if(alwaysWriteBXValue_ || minBX_!=maxBX_){ + if (alwaysWriteBXValue_ || minBX_ != maxBX_) { out->template addColumn(bxVarName_, selObjBXs, "BX of the L1 candidate"); } return out; From e0a10fce9509d8937cd1a3cd5c4b5edf99947f16 Mon Sep 17 00:00:00 2001 From: Sam Harper Date: Fri, 24 Mar 2023 08:58:45 +0000 Subject: [PATCH 11/12] removing debug statement --- PhysicsTools/NanoAOD/python/l1trig_cff.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PhysicsTools/NanoAOD/python/l1trig_cff.py b/PhysicsTools/NanoAOD/python/l1trig_cff.py index add16a8e67b15..53ca6153e9c95 100644 --- a/PhysicsTools/NanoAOD/python/l1trig_cff.py +++ b/PhysicsTools/NanoAOD/python/l1trig_cff.py @@ -3,7 +3,7 @@ from PhysicsTools.NanoAOD.common_cff import * l1_float_precision_=12 -print("l1pre",l1_float_precision_) + l1PtVars = cms.PSet( pt = Var("pt", float, precision=l1_float_precision_), phi = Var("phi", float, precision=l1_float_precision_), From e1c084ef5f5f1b9a9371f23844ea73ff1ad4d076 Mon Sep 17 00:00:00 2001 From: Sam Harper Date: Tue, 28 Mar 2023 12:08:33 +0100 Subject: [PATCH 12/12] adding relval test for prompt l1 nano --- Configuration/PyReleaseValidation/python/relval_nano.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Configuration/PyReleaseValidation/python/relval_nano.py b/Configuration/PyReleaseValidation/python/relval_nano.py index 74fb42436e75a..221f7e85d536e 100644 --- a/Configuration/PyReleaseValidation/python/relval_nano.py +++ b/Configuration/PyReleaseValidation/python/relval_nano.py @@ -106,6 +106,9 @@ steps['NANO_data12.4']=merge([{'--era':'Run3,run3_nanoAOD_124', '--conditions':'auto:run3_data'}, _NANO_data]) +#prompt nano test +steps['NANO_data12.4_prompt']=merge([{'--customise' : 'PhysicsTools/NanoAOD/nano_cff.nanoL1TrigObjCustomize', '-n' : '1000'}, + steps['NANO_data12.4']]) ##12.6 workflows steps['TTBarMINIAOD12.6'] = {'INPUT':InputInfo(location='STD',ls=run3_lumis, @@ -134,6 +137,8 @@ #12.4 input workflows[2500.501] = ['NANOmc124Xrun3', ['TTbarMINIAOD12.4','NANO_mc12.4', 'HRV_NANO_mc']] workflows[2500.511] = ['NANOdata124Xrun3', ['MuonEG2022MINIAOD12.4','NANO_data12.4', 'HRV_NANO_data']] +workflows[2500.5111] = ['NANOdata124Xrun3', ['MuonEG2022MINIAOD12.4','NANO_data12.4_prompt', 'HRV_NANO_data']] + ################ #12.6 workflows