diff --git a/Configuration/PyReleaseValidation/python/relval_nano.py b/Configuration/PyReleaseValidation/python/relval_nano.py index 1409c1b4ce804..9bdd7629108b8 100644 --- a/Configuration/PyReleaseValidation/python/relval_nano.py +++ b/Configuration/PyReleaseValidation/python/relval_nano.py @@ -155,17 +155,14 @@ def subnext(self): steps['NANO_data13.0_prompt']=merge([{'--customise' : 'PhysicsTools/NanoAOD/nano_cff.nanoL1TrigObjCustomize', '-n' : '1000'}, steps['NANO_data13.0']]) - steps['muDPGNANO_data13.0']=merge([{'-s' : 'RAW2DIGI,NANO:@MUDPG', '-n' : '100',}, steps['NANO_data13.0']]) - steps['muDPGNANOBkg_data13.0']=merge([{'-s' : 'RAW2DIGI,NANO:@MUDPGBKG', '-n' : '100',}, steps['NANO_data13.0']]) - steps['hcalDPGNANO_data13.0']=merge([{'-s' : 'RAW2DIGI,RECO,NANO:@HCAL', '-n' : '100', '--processName': 'NANO',}, @@ -177,8 +174,12 @@ def subnext(self): steps['NANO_data13.0']]) steps['muPOGNANO_data13.0']=merge([{'-s' : 'NANO:@MUPOG,DQM:@nanoAODDQM', '-n' : '1000'}, - steps['NANO_data13.0']]) + steps['NANO_data13.0']]) +steps['l1DPGNANO_data13.0']=merge([{'-s' : 'RAW2DIGI,NANO:@L1DPG', + '-n' : '100'}, + steps['NANO_data13.0']]) + steps['EGMNano_data13.0'] = merge([{'-s':'NANO:@EGM,DQM:@nanoAODDQM', '-n' : '1000'}, steps['NANO_data13.0']]) @@ -269,6 +270,7 @@ def subnext(self): workflows[_wfn()] = ['NANOdata130Xrun3', ['MuonEG2023MINIAOD13.0', 'NANO_data13.0', 'HRV_NANO_data']] workflows[_wfn()] = ['NANOdata130Xrun3', ['MuonEG2023MINIAOD13.0', 'NANO_data13.0_prompt', 'HRV_NANO_data']] workflows[_wfn()] = ['muPOGNANO130Xrun3', ['MuonEG2023MINIAOD13.0', 'muPOGNANO_data13.0']] +workflows[_wfn()] = ['l1DPGNANO130Xrun3', ['ZMuSkim2023DRAWRECO13.0', 'l1DPGNANO_data13.0']] workflows[_wfn()] = ['EGMNANOdata130Xrun3', ['MuonEG2023MINIAOD13.0', 'EGMNano_data13.0']] workflows[_wfn()] = ['jmeNANOdata130Xrun3', ['MuonEG2023MINIAOD13.0', 'jmeNano_data13.0']] workflows[_wfn()] = ['lepTimeLifeNANOdata130Xrun3', ['MuonEG2023MINIAOD13.0', 'lepTimeLifeNANO_data13.0']] diff --git a/DPGAnalysis/L1TNanoAOD/BuildFile.xml b/DPGAnalysis/L1TNanoAOD/BuildFile.xml new file mode 100644 index 0000000000000..f7a62182fbdb0 --- /dev/null +++ b/DPGAnalysis/L1TNanoAOD/BuildFile.xml @@ -0,0 +1,4 @@ + + + + diff --git a/DPGAnalysis/L1TNanoAOD/README.md b/DPGAnalysis/L1TNanoAOD/README.md new file mode 100644 index 0000000000000..10a38a665c427 --- /dev/null +++ b/DPGAnalysis/L1TNanoAOD/README.md @@ -0,0 +1,64 @@ +# L1T Nano + +This package allows to save Level 1 Trigger information (unpacked or reemulated) in a standard NANOAOD format, after reemulating the L1 Trigger (except for the first section, where only unpacked objects are retrieved from MINIAOD). A few examples of cmsDriver commands are provided for Run 3 data and simulated samples. + + ## Naming conventions +- Unpacked objects are the same as in central NANO and named `L1EG`, `L1Mu`,... +- Reemulated objects are named `L1EmulEG`, `L1EmulMu`,... +- Unpacked calo TPs/TTs/clusters are named `HcalUnpackedTPs`, `L1UnpackedCaloTower`, `L1UnpackedCaloCluster`,... +- Reemulated calo TPs/TTs/clusters are named `HcalEmulTPs`, `L1EmulCaloTower`, `L1EmulCaloCluster`,... + +## L1T NANO from MINIAOD + + +### Add L1 objects to central NANO +On can add all L1 objects on top of central NANO with the following command: + + cmsDriver.py customL1toNANO --conditions auto:run3_data_prompt -s NANO:@PHYS+@L1FULL --datatier NANOAOD --eventcontent NANOAOD --data --process customl1nano --scenario pp --era Run3 --customise_unsch Configuration/DataProcessing/RecoTLR.customisePostEra_Run3 -n 100 --filein /store/data/Run2023D/Muon1/MINIAOD/22Sep2023_v2-v1/50000/daeae294-4d7c-4f36-8d50-33ef562cbf07.root --fileout file:out.root --python_filename=customl1nano.py + +### Save unpacked objects only (data) +If one wants to only keep L1 objects, and not offline information, use instead: + + cmsDriver.py customL1toNANO --conditions auto:run3_data_prompt -s USER:DPGAnalysis/L1TNanoAOD/l1tNano_cff.l1tNanoTask --datatier NANOAOD --eventcontent NANOAOD --data --process customl1nano --scenario pp --era Run3 --customise Configuration/DataProcessing/RecoTLR.customisePostEra_Run3,PhysicsTools/NanoAOD/nano_cff.nanoL1TrigObjCustomizeFull -n 100 --filein /store/data/Run2023D/Muon1/MINIAOD/22Sep2023_v2-v1/50000/daeae294-4d7c-4f36-8d50-33ef562cbf07.root --fileout file:out.root --python_filename=customl1nano.py --fileout file:out.root --python_filename=customl1nano.py + + +## L1T NANO standalone +The following examples save L1T information (objects, TPs,...) in a standalone NANOAOD format, after reemulating the L1 trigger. + +### Save all calo information (TPs, TT, CaloCluster) and L1T objects, both emulated and unpacked (data) + + cmsDriver.py customL1toNANO --conditions auto:run3_data_prompt -s RAW2DIGI,NANO:@L1DPG --datatier NANOAOD --eventcontent NANOAOD --data --process customl1nano --scenario pp --era Run3 --customise Configuration/DataProcessing/RecoTLR.customisePostEra_Run3 -n 100 --filein /store/data/Run2022D/EGamma/RAW-RECO/ZElectron-27Jun2023-v2/2810003/06757985-055e-4c64-bbe3-187858ea2abf.root --fileout file:out.root --python_filename=customl1nano.py + +### Save all calo information (TPs, TT, CaloCluster) and L1T objects, both emulated and unpacked (MC) + + cmsDriver.py customL1toNANO --conditions auto:phase1_2024_realistic -s RAW2DIGI,NANO:@L1DPG --datatier NANOAOD --eventcontent NANOAOD --mc --process customl1nano --scenario pp --era Run3 --customise Configuration/DataProcessing/RecoTLR.customisePostEra_Run3 -n 100 --filein /store/mc/Run3Winter24Digi/WJetsToLNu_TuneCP5_13p6TeV-madgraphMLM-pythia8/GEN-SIM-RAW/133X_mcRun3_2024_realistic_v9-v2/2830000/756ef2a9-b60a-4ee1-a021-7219e48c6f4b.root --fileout file:out.root --python_filename=customl1nano.py + + +## L1T + central NANO +Also useful is running L1T NANO together with central NANO. Similar commands as above can be defined. A few options exist: one can start from RAW and run the whole RECO/PAT/NANO chain, or start from existing RAW-RECO to skip the time consuming re-RECO step. + + ### Run RECO, PAT, NANO and save all calo information (TPs, TT, CaloCluster) and L1T objects, both emulated and unpacked (data) + + cmsDriver.py customL1toNANO --conditions auto:run3_data_prompt -s RAW2DIGI,L1Reco,RECO,PAT,NANO:@PHYS+@L1DPG --datatier NANOAOD --eventcontent NANOAOD --data --process customl1nano --scenario pp --era Run3 --customise Configuration/DataProcessing/RecoTLR.customisePostEra_Run3 -n 100 --filein /store/data/Run2023D/EphemeralZeroBias0/RAW/v1/000/370/560/00000/9273062a-1a69-4998-8ae1-c121323526e8.root --fileout file:out.root --python_filename=customl1nano.py + + + ### Run RECO, PAT, NANO and save all calo information (TPs, TT, CaloCluster) and L1T objects, both emulated and unpacked (MC) + + cmsDriver.py customL1toNANO --conditions auto:phase1_2024_realistic -s RAW2DIGI,L1Reco,RECO,PAT,NANO:@PHYS+@L1DPG --datatier NANOAOD --eventcontent NANOAOD --mc --process customl1nano --scenario pp --era Run3 --customise Configuration/DataProcessing/RecoTLR.customisePostEra_Run3 -n 100 --filein /store/mc/Run3Winter24Digi/WJetsToLNu_TuneCP5_13p6TeV-madgraphMLM-pythia8/GEN-SIM-RAW/133X_mcRun3_2024_realistic_v9-v2/2830000/756ef2a9-b60a-4ee1-a021-7219e48c6f4b.root --python_filename=customl1nano.py + + ### Run PAT, NANO and save all calo information (TPs, TT, CaloCluster) and L1T objects, both emulated and unpacked (data) + + + cmsDriver.py customL1toNANO --conditions auto:run3_data_prompt -s RAW2DIGI,L1Reco,PAT,NANO:@PHYS+@L1DPG --datatier NANOAOD --eventcontent NANOAOD --data --process customl1nano --scenario pp --era Run3 --customise Configuration/DataProcessing/RecoTLR.customisePostEra_Run3 -n 100 --filein /store/data/Run2022D/EGamma/RAW-RECO/ZElectron-27Jun2023-v2/2810003/06757985-055e-4c64-bbe3-187858ea2abf.root --fileout file:out.root --python_filename=customl1nano.py + + + +## Notes on reemulation options +There exist different options to reemulate the Level 1 Trigger. For calorimeters, one can for example use the original ECAL/HCAL trigger primitives ("unpacked") or reemulate these as well. The former option is the default one. In order to modify this, one can for example add the following customization: + + --customise_unsch L1Trigger/Configuration/customiseReEmul.L1TReEmulFromRAWsimHcalTP + +Mind that `--customise_unsch` (**and not** `--customise`) is to be used. + + + diff --git a/DPGAnalysis/L1TNanoAOD/plugins/BuildFile.xml b/DPGAnalysis/L1TNanoAOD/plugins/BuildFile.xml new file mode 100644 index 0000000000000..fee30c351146f --- /dev/null +++ b/DPGAnalysis/L1TNanoAOD/plugins/BuildFile.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/DPGAnalysis/L1TNanoAOD/plugins/CaloTPTableProducer.cc b/DPGAnalysis/L1TNanoAOD/plugins/CaloTPTableProducer.cc new file mode 100644 index 0000000000000..b73e43d2285c6 --- /dev/null +++ b/DPGAnalysis/L1TNanoAOD/plugins/CaloTPTableProducer.cc @@ -0,0 +1,207 @@ +// -*- C++ -*- +// +// Package: PhysicsTools/NanoAOD +// Class: CaloTPTableProducer +// +/**\class CaloTPTableProducer CaloTPTableProducer.cc PhysicsTools/NanoAOD/plugins/CaloTPTableProducer.cc + + Description: [one line class summary] + + Implementation: + [Notes on implementation] +*/ +// +// Original Author: localusers user +// Created: Wed, 08 Nov 2023 13:16:40 GMT +// +// + +// system include files +#include + +// user include files +#include "CalibFormats/CaloTPG/interface/CaloTPGTranscoder.h" +#include "CalibFormats/CaloTPG/interface/CaloTPGRecord.h" + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/StreamID.h" + +#include "DataFormats/NanoAOD/interface/FlatTable.h" + +#include "DataFormats/EcalDigi/interface/EcalDigiCollections.h" +#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" + +#include "DataFormats/L1TCalorimeter/interface/CaloTower.h" +#include "DataFormats/L1TCalorimeter/interface/CaloCluster.h" + +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" + +// +// class declaration +// + +class CaloTPTableProducer : public edm::stream::EDProducer<> { +public: + explicit CaloTPTableProducer(const edm::ParameterSet&); + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void beginStream(edm::StreamID) override; + void produce(edm::Event&, const edm::EventSetup&) override; + void endStream() override; + + // ----------member data --------------------------- + const double ecalLSB_; + + const edm::EDGetTokenT ecalTPsToken_; + const std::string ecalTPsName_; + + const edm::EDGetTokenT hcalTPsToken_; + const std::string hcalTPsName_; + + const edm::ESGetToken decoderToken_; +}; + +CaloTPTableProducer::CaloTPTableProducer(const edm::ParameterSet& iConfig) + : ecalLSB_(iConfig.getUntrackedParameter("ecalLSB", 0.5)), + ecalTPsToken_(consumes(iConfig.getParameter("ecalTPsSrc"))), + ecalTPsName_(iConfig.getParameter("ecalTPsName")), + hcalTPsToken_(consumes(iConfig.getParameter("hcalTPsSrc"))), + hcalTPsName_(iConfig.getParameter("hcalTPsName")), + decoderToken_(esConsumes()) { + produces("EcalTP"); + produces("HcalTP"); + + //now do what ever other initialization is needed +} + +// +// member functions +// + +// ------------ method called to produce the data ------------ +void CaloTPTableProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { + using namespace edm; + + edm::ESHandle decoder; + decoder = iSetup.getHandle(decoderToken_); + + edm::Handle ecalTPs; + iEvent.getByToken(ecalTPsToken_, ecalTPs); + + edm::Handle hcalTPs; + iEvent.getByToken(hcalTPsToken_, hcalTPs); + + vector ecalTPieta; + vector ecalTPCaliphi; + vector ecalTPiphi; + vector ecalTPet; + vector ecalTPcompEt; + vector ecalTPfineGrain; + int nECALTP(0); + if (ecalTPs.isValid()) { + for (const auto& itr : *(ecalTPs.product())) { + short ieta = (short)itr.id().ieta(); + + unsigned short cal_iphi = (unsigned short)itr.id().iphi(); + unsigned short iphi = (72 + 18 - cal_iphi) % 72; + unsigned short compEt = itr.compressedEt(); + double et = ecalLSB_ * compEt; + unsigned short fineGrain = (unsigned short)itr.fineGrain(); + + if (compEt > 0) { + ecalTPieta.push_back(ieta); + ecalTPCaliphi.push_back(cal_iphi); + ecalTPiphi.push_back(iphi); + ecalTPet.push_back(et); + ecalTPcompEt.push_back(compEt); + ecalTPfineGrain.push_back(fineGrain); + nECALTP++; + } + } + } + auto ecalTPTable = std::make_unique(nECALTP, ecalTPsName_, false); + ecalTPTable->addColumn("ieta", ecalTPieta, ""); + ecalTPTable->addColumn("Caliphi", ecalTPCaliphi, ""); + ecalTPTable->addColumn("iphi", ecalTPiphi, ""); + ecalTPTable->addColumn("et", ecalTPet, "", 12); + ecalTPTable->addColumn("compEt", ecalTPcompEt, ""); + ecalTPTable->addColumn("fineGrain", ecalTPfineGrain, ""); + + vector hcalTPieta; + vector hcalTPCaliphi; + vector hcalTPiphi; + vector hcalTPet; + vector hcalTPcompEt; + vector hcalTPfineGrain; + int nHCALTP(0); + if (hcalTPs.isValid()) { + for (auto itr : (*hcalTPs.product())) { + int ver = itr.id().version(); + short ieta = (short)itr.id().ieta(); + unsigned short absIeta = (unsigned short)abs(ieta); + unsigned short cal_iphi = (unsigned short)itr.id().iphi(); + unsigned short iphi = (72 + 18 - cal_iphi) % 72; + + unsigned short compEt = itr.SOI_compressedEt(); + double et = decoder->hcaletValue(itr.id(), itr.t0()); + unsigned short fineGrain = (unsigned short)itr.SOI_fineGrain(); + + if (compEt > 0 && (absIeta < 29 || ver == 1)) { + hcalTPieta.push_back(ieta); + hcalTPCaliphi.push_back(cal_iphi); + hcalTPiphi.push_back(iphi); + hcalTPet.push_back(et); + hcalTPcompEt.push_back(compEt); + hcalTPfineGrain.push_back(fineGrain); + nHCALTP++; + } + } + } + + auto hcalTPTable = std::make_unique(nHCALTP, hcalTPsName_, false); + hcalTPTable->addColumn("ieta", hcalTPieta, ""); + hcalTPTable->addColumn("Caliphi", hcalTPCaliphi, ""); + hcalTPTable->addColumn("iphi", hcalTPiphi, ""); + hcalTPTable->addColumn("et", hcalTPet, "", 12); + hcalTPTable->addColumn("compEt", hcalTPcompEt, ""); + hcalTPTable->addColumn("fineGrain", hcalTPfineGrain, ""); + + iEvent.put(std::move(ecalTPTable), "HcalTP"); + iEvent.put(std::move(hcalTPTable), "EcalTP"); +} + +// ------------ method called once each stream before processing any runs, lumis or events ------------ +void CaloTPTableProducer::beginStream(edm::StreamID) { + // please remove this method if not needed +} + +// ------------ method called once each stream after processing all runs, lumis and events ------------ +void CaloTPTableProducer::endStream() { + // please remove this method if not needed +} + +// ------------ method fills 'descriptions' with the allowed parameters for the module ------------ +void CaloTPTableProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + + desc.add("name", "l1calotowerflattableproducer"); + desc.addUntracked("ecalLSB", 0.5); + desc.add("ecalTPsSrc", edm::InputTag{"ecalDigis", "EcalTriggerPrimitives"}); + desc.add("ecalTPsName", "EcalUnpackedTPs"); + desc.add("hcalTPsSrc", edm::InputTag{"hcalDigis"}); + desc.add("hcalTPsName", "HcalUnpackedTPs"); + + descriptions.addWithDefaultLabel(desc); +} + +//define this as a plug-in +DEFINE_FWK_MODULE(CaloTPTableProducer); diff --git a/DPGAnalysis/L1TNanoAOD/plugins/SimpleFlatTableProducerPlugins.cc b/DPGAnalysis/L1TNanoAOD/plugins/SimpleFlatTableProducerPlugins.cc new file mode 100644 index 0000000000000..8bc462cfeb02b --- /dev/null +++ b/DPGAnalysis/L1TNanoAOD/plugins/SimpleFlatTableProducerPlugins.cc @@ -0,0 +1,11 @@ +#include "PhysicsTools/NanoAOD/interface/SimpleFlatTableProducer.h" + +#include "DataFormats/L1TCalorimeter/interface/CaloTower.h" +typedef BXVectorSimpleFlatTableProducer SimpleTriggerL1CaloTowerFlatTableProducer; + +#include "DataFormats/L1TCalorimeter/interface/CaloCluster.h" +typedef BXVectorSimpleFlatTableProducer SimpleTriggerL1CaloClusterFlatTableProducer; + +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(SimpleTriggerL1CaloTowerFlatTableProducer); +DEFINE_FWK_MODULE(SimpleTriggerL1CaloClusterFlatTableProducer); diff --git a/DPGAnalysis/L1TNanoAOD/python/l1tNano_cff.py b/DPGAnalysis/L1TNanoAOD/python/l1tNano_cff.py new file mode 100644 index 0000000000000..7a15da5c084da --- /dev/null +++ b/DPGAnalysis/L1TNanoAOD/python/l1tNano_cff.py @@ -0,0 +1,78 @@ +from PhysicsTools.NanoAOD.common_cff import * +from DPGAnalysis.L1TNanoAOD.l1tnanotables_cff import * +from PhysicsTools.NanoAOD.l1trig_cff import * +from PhysicsTools.NanoAOD.nano_cff import * + +l1tnanoMetadata = cms.EDProducer("UniqueStringProducer", + strings = cms.PSet( + tag = cms.string("untagged"), + ) +) + +l1tNanoTask = cms.Task(nanoMetadata,l1TablesTask) + +l1tNanoSequence = cms.Sequence(l1tNanoTask) + +def addEmulObjects(process): + + process.l1tNanoTask.add(l1EmulObjTablesTask) + + return process + + +def addUnpackedCaloTPs(process): + + process.l1tNanoTask.add(process.l1CaloTPsNanoTask) + + return process + +def addEmulCaloTPs(process): + + process.l1tNanoTask.add(process.l1EmulCaloTPsNanoTask) + + return process + +def addUnpackedCaloLayer1(process): + + process.l1tNanoTask.add(process.l1CaloLayer1NanoTask) + + return process + +def addEmulCaloLayer1(process): + + process.l1tNanoTask.add(process.l1EmulCaloLayer1NanoTask) + + return process + +def addUnpackedCaloTPsandLayer1(process): + + addUnpackedCaloTPs(process) + addUnpackedCaloLayer1(process) + + return process + +def addEmulCaloTPsandLayer1(process): + + addEmulCaloTPs(process) + addEmulCaloLayer1(process) + + return process + +def addCaloFull(process): + + addEmulCaloTPsandLayer1(process) + addUnpackedCaloTPsandLayer1(process) + addEmulObjects(process) + + return process + + +''' +l1tNanoTask = cms.Task( + #nanoMetadata, + l1CaloTPsNanoTask, + l1CaloLayer1NanoTask, + l1EmulCaloTPsNanoTask, + l1EmulCaloLayer1NanoTask, +) +''' diff --git a/DPGAnalysis/L1TNanoAOD/python/l1tnanotables_cff.py b/DPGAnalysis/L1TNanoAOD/python/l1tnanotables_cff.py new file mode 100644 index 0000000000000..62be68c02402c --- /dev/null +++ b/DPGAnalysis/L1TNanoAOD/python/l1tnanotables_cff.py @@ -0,0 +1,105 @@ +import FWCore.ParameterSet.Config as cms +from PhysicsTools.NanoAOD.nano_eras_cff import * +from PhysicsTools.NanoAOD.common_cff import * +from PhysicsTools.NanoAOD.l1trig_cff import * + + +l1CaloTPTable = cms.EDProducer("CaloTPTableProducer", + ecalTPsSrc = cms.InputTag("ecalDigis","EcalTriggerPrimitives"), + ecalTPsName = cms.string("EcalUnpackedTPs"), + hcalTPsSrc = cms.InputTag("hcalDigis"), + hcalTPsName = cms.string("HcalUnpackedTPs") +) + + +l1EmulCaloTPTable = cms.EDProducer("CaloTPTableProducer", + ecalTPsSrc = cms.InputTag("simEcalTriggerPrimitiveDigis"), + ecalTPsName = cms.string("EcalEmulTPs"), + hcalTPsSrc = cms.InputTag("simHcalTriggerPrimitiveDigis"), + hcalTPsName = cms.string("HcalEmulTPs") +) + + +l1CaloTowerTable = cms.EDProducer("SimpleTriggerL1CaloTowerFlatTableProducer", + src = cms.InputTag("caloStage2Digis","CaloTower"), + minBX = cms.int32(0), + maxBX = cms.int32(0), + cut = cms.string("hwPt>0"), + name = cms.string("L1UnpackedCaloTower"), + doc = cms.string(""), + extension = cms.bool(False), + variables = cms.PSet( + et = Var("pt()","int",doc=""), + eta = Var("eta()","int",doc=""), + phi = Var("phi()","int",doc=""), + iet = Var("hwPt()","int",doc=""), + ieta = Var("hwEta()","int",doc=""), + iphi = Var("hwPhi()","int",doc=""), + iem = Var("hwEtEm()","int",doc=""), + ihad = Var("hwEtHad()","int",doc=""), + iratio = Var("hwEtRatio()","int",doc=""), + iqual = Var("hwQual()","int",doc="") + ) +) + +l1EmulCaloTowerTable = l1CaloTowerTable.clone( + src = cms.InputTag("simCaloStage2Layer1Digis"), + name = cms.string("L1EmulCaloTower") +) + +l1EmulCaloClusterTable = cms.EDProducer("SimpleTriggerL1CaloClusterFlatTableProducer", + src = cms.InputTag("simCaloStage2Digis", "MP"), + minBX = cms.int32(0), + maxBX = cms.int32(0), + cut = cms.string(""), + name= cms.string("L1EmulCaloCluster"), + doc = cms.string(""), + extension = cms.bool(False), + variables = cms.PSet( + et = Var("pt()","int",doc=""), + eta = Var("eta()","int",doc=""), + phi = Var("phi()","int",doc=""), + iet = Var("hwPt()","int",doc=""), + ieta = Var("hwEta()","int",doc=""), + iphi = Var("hwPhi()","int",doc=""), + iqual = Var("hwQual()","int",doc="") + ) +) + + + +l1CaloTPsNanoTask = cms.Task(l1CaloTPTable) +l1CaloLayer1NanoTask = cms.Task(l1CaloTowerTable) +l1EmulCaloTPsNanoTask = cms.Task(l1EmulCaloTPTable) +l1EmulCaloLayer1NanoTask = cms.Task(l1EmulCaloTowerTable,l1EmulCaloClusterTable) + + +#Now L1 emulated objects +#Cloning the L1 object tables producers used for central NANO (unpacked objects) + +l1EmulMuTable = l1MuTable.clone( + src = cms.InputTag("simGmtStage2Digis"), + name= cms.string("L1EmulMu"), +) + +l1EmulJetTable = l1JetTable.clone( + src = cms.InputTag("simCaloStage2Digis"), + name= cms.string("L1EmulJet"), +) + +l1EmulTauTable = l1TauTable.clone( + src = cms.InputTag("simCaloStage2Digis"), + name= cms.string("L1EmulTau"), +) + +l1EmulEtSumTable = l1EtSumTable.clone( + src = cms.InputTag("simCaloStage2Digis"), + name= cms.string("L1EmulEtSum"), +) + +l1EmulEGTable = l1EGTable.clone( + src = cms.InputTag("simCaloStage2Digis"), + name= cms.string("L1EmulEG"), +) + +l1EmulObjTablesTask = cms.Task(l1EmulEGTable,l1EmulEtSumTable,l1EmulTauTable,l1EmulJetTable,l1EmulMuTable) diff --git a/L1Trigger/Configuration/python/customiseReEmul.py b/L1Trigger/Configuration/python/customiseReEmul.py index 0d1680f403624..802295278863a 100644 --- a/L1Trigger/Configuration/python/customiseReEmul.py +++ b/L1Trigger/Configuration/python/customiseReEmul.py @@ -100,9 +100,10 @@ def L1TReEmulFromRAW2015(process): (~stage2L1Trigger).toModify(process.simRpcTriggerDigis, label = 'muonRPCDigis') (~stage2L1Trigger).toModify(process.simRpcTechTrigDigis, RPCDigiLabel = 'muonRPCDigis') - process.L1TReEmulPath = cms.Path(process.L1TReEmul) - process.schedule.append(process.L1TReEmulPath) - + if not hasattr(process, 'L1TReEmulPath'): + process.L1TReEmulPath = cms.Path(process.L1TReEmul) + process.schedule.append(process.L1TReEmulPath) + print("# L1TReEmul sequence: ") print("# {0}".format(process.L1TReEmul)) print("# {0}".format(process.schedule)) @@ -180,8 +181,10 @@ def L1TReEmulFromRAW2016(process): ) (~stage2L1Trigger).toModify(process.simRpcTriggerDigis, label = 'muonRPCDigis') - process.L1TReEmulPath = cms.Path(process.L1TReEmul) - process.schedule.append(process.L1TReEmulPath) + if not hasattr(process, 'L1TReEmulPath'): + process.L1TReEmulPath = cms.Path(process.L1TReEmul) + process.schedule.append(process.L1TReEmulPath) + return process def L1TReEmulFromRAW(process): @@ -246,9 +249,10 @@ def L1TReEmulFromNANO(process): TauInputTag = "hltGtStage2Digis:Tau", JetInputTag = "hltGtStage2Digis:Jet" ) - - process.L1TReEmulPath = cms.Path(process.L1TReEmul) - process.schedule.append(process.L1TReEmulPath) + + if not hasattr(process, 'L1TReEmulPath'): + process.L1TReEmulPath = cms.Path(process.L1TReEmul) + process.schedule.append(process.L1TReEmulPath) print ("# L1TReEmul sequence: ") print ("# {0}".format(process.L1TReEmul)) @@ -260,8 +264,10 @@ def L1TReEmulFromRAWCalo(process): process.L1TReEmul = cms.Sequence(process.SimL1CaloEmulator) process.simCaloStage2Layer1Digis.ecalToken = cms.InputTag('ecalDigis:EcalTriggerPrimitives') process.simCaloStage2Layer1Digis.hcalToken = cms.InputTag('hcalDigis:') - process.L1TReEmulPath = cms.Path(process.L1TReEmul) - process.schedule.append(process.L1TReEmulPath) + + if not hasattr(process, 'L1TReEmulPath'): + process.L1TReEmulPath = cms.Path(process.L1TReEmul) + process.schedule.append(process.L1TReEmulPath) print ("# L1TReEmul sequence: ") print ("# {0}".format(process.L1TReEmul)) @@ -271,8 +277,9 @@ def L1TReEmulFromRAWCalo(process): def L1TReEmulFromRAWCaloSimTP(process): process.load('L1Trigger.Configuration.SimL1CaloEmulator_cff') process.L1TReEmul = cms.Sequence(process.SimL1CaloEmulator) - process.L1TReEmulPath = cms.Path(process.L1TReEmul) - process.schedule.append(process.L1TReEmulPath) + if not hasattr(process, 'L1TReEmulPath'): + process.L1TReEmulPath = cms.Path(process.L1TReEmul) + process.schedule.append(process.L1TReEmulPath) print ("# L1TReEmul sequence: ") print ("# {0}".format(process.L1TReEmul)) @@ -496,8 +503,9 @@ def L1TReEmulFromRAWLegacyMuon(process): process.L1TReEmul = cms.Sequence( process.L1TReEmul + process.SimL1TechnicalTriggers + process.SimL1TGlobal ) - process.L1TReEmulPath = cms.Path(process.L1TReEmul) - process.schedule.append(process.L1TReEmulPath) + if not hasattr(process, 'L1TReEmulPath'): + process.L1TReEmulPath = cms.Path(process.L1TReEmul) + process.schedule.append(process.L1TReEmulPath) print("# L1TReEmul sequence: ") print("# {0}".format(process.L1TReEmul)) print("# {0}".format(process.schedule)) diff --git a/PhysicsTools/NanoAOD/python/autoNANO.py b/PhysicsTools/NanoAOD/python/autoNANO.py index 70329c42deacb..7332c18dec985 100644 --- a/PhysicsTools/NanoAOD/python/autoNANO.py +++ b/PhysicsTools/NanoAOD/python/autoNANO.py @@ -32,6 +32,9 @@ def expandNanoMapping(seqList, mapping, key): 'Scout' : {'sequence': 'PhysicsTools/NanoAOD/custom_run3scouting_cff'}, 'JME' : { 'sequence': '@PHYS', 'customize': '@PHYS+PhysicsTools/NanoAOD/custom_jme_cff.PrepJMECustomNanoAOD'}, + # L1 DPG (standalone with full calo TP info, L1T reemulation customization) + 'L1DPG' : {'sequence': 'DPGAnalysis/L1TNanoAOD/l1tNano_cff.l1tNanoSequence', + 'customize': 'PhysicsTools/NanoAOD/nano_cff.nanoL1TrigObjCustomizeFull,DPGAnalysis/L1TNanoAOD/l1tNano_cff.addCaloFull,L1Trigger/Configuration/customiseReEmul.L1TReEmulFromRAW'}, # Muon POG flavours : add tables through customize, supposed to be combined with PHYS 'MUPOG' : {'sequence': '@PHYS', 'customize' : '@PHYS+PhysicsTools/NanoAOD/custom_muon_cff.PrepMuonCustomNanoAOD'},