From e5d3ea1fa7e29e0e60d0b0250a534734d979c4aa Mon Sep 17 00:00:00 2001 From: lathomasexport Date: Tue, 13 Feb 2024 23:04:42 +0100 Subject: [PATCH] Custom L1 NanoAOD --- DPGAnalysis/L1TNanoAOD/BuildFile.xml | 4 + DPGAnalysis/L1TNanoAOD/README.md | 45 +++ DPGAnalysis/L1TNanoAOD/plugins/BuildFile.xml | 12 + .../L1TNanoAOD/plugins/CaloTPTableProducer.cc | 267 ++++++++++++++++++ .../plugins/SimpleFlatTableProducerPlugins.cc | 11 + .../plugins/ZGammaJetInfoProducer.cc | 159 +++++++++++ .../L1TNanoAOD/python/customL1nano.pybu | 21 ++ DPGAnalysis/L1TNanoAOD/python/l1tNano_cff.py | 76 +++++ .../L1TNanoAOD/python/l1tnanotables_cff.py | 105 +++++++ .../python/l1tnanotables_phase2_cff.py | 25 ++ 10 files changed, 725 insertions(+) create mode 100644 DPGAnalysis/L1TNanoAOD/BuildFile.xml create mode 100644 DPGAnalysis/L1TNanoAOD/README.md create mode 100644 DPGAnalysis/L1TNanoAOD/plugins/BuildFile.xml create mode 100644 DPGAnalysis/L1TNanoAOD/plugins/CaloTPTableProducer.cc create mode 100644 DPGAnalysis/L1TNanoAOD/plugins/SimpleFlatTableProducerPlugins.cc create mode 100644 DPGAnalysis/L1TNanoAOD/plugins/ZGammaJetInfoProducer.cc create mode 100644 DPGAnalysis/L1TNanoAOD/python/customL1nano.pybu create mode 100644 DPGAnalysis/L1TNanoAOD/python/l1tNano_cff.py create mode 100644 DPGAnalysis/L1TNanoAOD/python/l1tnanotables_cff.py create mode 100644 DPGAnalysis/L1TNanoAOD/python/l1tnanotables_phase2_cff.py 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..9085647d8bfe4 --- /dev/null +++ b/DPGAnalysis/L1TNanoAOD/README.md @@ -0,0 +1,45 @@ +# L1T Nano + +This package allows to save Level 1 Trigger information (unpacked or reemulated) in a standard NANOAOD format. 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 standalone +The following examples save L1T information (objects, TPs,...) in a standalone NANOAOD format. + +### Save unpacked objects only (data) +This relies on central customization code (in `PhysicsToos/NanoAOD`) that allows you to store all unpacked L1T objects. + + 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 + + +### 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,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,DPGAnalysis/L1TNanoAOD/l1tNano_cff.addCaloFull,L1Trigger/Configuration/customiseReEmul.L1TReEmulFromRAWsimHcalTP -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_2023_realistic -s RAW2DIGI,USER:DPGAnalysis/L1TNanoAOD/l1tNano_cff.l1tNanoTask --datatier NANOAOD --eventcontent NANOAOD --mc --process customl1nano --scenario pp --era Run3 --customise Configuration/DataProcessing/RecoTLR.customisePostEra_Run3,PhysicsTools/NanoAOD/nano_cff.nanoL1TrigObjCustomizeFull,DPGAnalysis/L1TNanoAOD/l1tNano_cff.addCaloFull,L1Trigger/Configuration/customiseReEmul.L1TReEmulFromRAWsimHcalTP -n 100 --filein /store/mc/Run3Winter23Digi/DYto2L-4Jets_MLL-50_TuneCP5_13p6TeV_madgraphMLM-pythia8/GEN-SIM-RAW/126X_mcRun3_2023_forPU65_v1-v2/70000/66b76d59-de20-4465-af3d-1a7fd296dbc8.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,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,DPGAnalysis/L1TNanoAOD/l1tNano_cff.addCaloFull,L1Trigger/Configuration/customiseReEmul.L1TReEmulFromRAWsimHcalTP -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_2023_realistic -s RAW2DIGI,L1Reco,RECO,PAT,NANO,USER:DPGAnalysis/L1TNanoAOD/l1tNano_cff.l1tNanoTask --datatier NANOAOD --eventcontent NANOAOD --mc --process customl1nano --scenario pp --era Run3 --customise Configuration/DataProcessing/RecoTLR.customisePostEra_Run3,PhysicsTools/NanoAOD/nano_cff.nanoL1TrigObjCustomizeFull,DPGAnalysis/L1TNanoAOD/l1tNano_cff.addCaloFull,L1Trigger/Configuration/customiseReEmul.L1TReEmulFromRAWsimHcalTP -n 100 --filein /store/mc/Run3Winter23Digi/DYto2L-4Jets_MLL-50_TuneCP5_13p6TeV_madgraphMLM-pythia8/GEN-SIM-RAW/126X_mcRun3_2023_forPU65_v1-v2/70000/66b76d59-de20-4465-af3d-1a7fd296dbc8.root --fileout file:out.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,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,DPGAnalysis/L1TNanoAOD/l1tNano_cff.addCaloFull,L1Trigger/Configuration/customiseReEmul.L1TReEmulFromRAWsimHcalTP -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 + 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..c19c3dd1e0314 --- /dev/null +++ b/DPGAnalysis/L1TNanoAOD/plugins/CaloTPTableProducer.cc @@ -0,0 +1,267 @@ +// -*- 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&); + ~CaloTPTableProducer() override; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void beginStream(edm::StreamID) override; + void produce(edm::Event&, const edm::EventSetup&) override; + void endStream() override; + + //void beginRun(edm::Run const&, edm::EventSetup const&) override; + //void endRun(edm::Run const&, edm::EventSetup const&) override; + //void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override; + //void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) 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_; +}; + +// +// constants, enums and typedefs +// + +// +// static data member definitions +// + +// +// constructors and destructor +// +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 +} + +CaloTPTableProducer::~CaloTPTableProducer() { + // do anything here that needs to be done at destruction time + // (e.g. close files, deallocate resources etc.) + // + // please remove this method altogether if it would be left empty +} + +// +// 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); + + vectorecalTPieta; + vectorecalTPCaliphi; + vectorecalTPiphi; + vectorecalTPet; + vectorecalTPcompEt; + vectorecalTPfineGrain; + 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, ""); + + + + vectorhcalTPieta; + vectorhcalTPCaliphi; + vectorhcalTPiphi; + vectorhcalTPet; + vectorhcalTPcompEt; + vectorhcalTPfineGrain; + 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 called when starting to processes a run ------------ +/* +void +CaloTPTableProducer::beginRun(edm::Run const&, edm::EventSetup const&) +{ +} +*/ + +// ------------ method called when ending the processing of a run ------------ +/* +void +CaloTPTableProducer::endRun(edm::Run const&, edm::EventSetup const&) +{ +} +*/ + +// ------------ method called when starting to processes a luminosity block ------------ +/* +void +CaloTPTableProducer::beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) +{ +} +*/ + +// ------------ method called when ending the processing of a luminosity block ------------ +/* +void +CaloTPTableProducer::endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) +{ +} +*/ + +// ------------ method fills 'descriptions' with the allowed parameters for the module ------------ +void CaloTPTableProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + //The following says we do not know what parameters are allowed so do no validation + // Please change this to state exactly what you do use, even if it is no parameters + edm::ParameterSetDescription desc; + desc.setUnknown(); + descriptions.addDefault(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/plugins/ZGammaJetInfoProducer.cc b/DPGAnalysis/L1TNanoAOD/plugins/ZGammaJetInfoProducer.cc new file mode 100644 index 0000000000000..57e78ee47ff72 --- /dev/null +++ b/DPGAnalysis/L1TNanoAOD/plugins/ZGammaJetInfoProducer.cc @@ -0,0 +1,159 @@ +// -*- C++ -*- +// +// Package: DPGAnalysis/L1TNanoAOD +// Class: ZGammaJetInfoProducer +// +/**\class ZGammaJetInfoProducer ZGammaJetInfoProducer.cc DPGAnalysis/L1TNanoAOD/plugins/ZGammaJetInfoProducer.cc + + Description: [one line class summary] + + Implementation: + [Notes on implementation] +*/ +// +// Original Author: localusers user +// Created: Fri, 17 Nov 2023 17:42:46 GMT +// +// + +// system include files +#include + +// user include files +#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" + +// +// class declaration +// + +class ZGammaJetInfoProducer : public edm::stream::EDProducer<> { +public: + explicit ZGammaJetInfoProducer(const edm::ParameterSet&); + ~ZGammaJetInfoProducer() override; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void beginStream(edm::StreamID) override; + void produce(edm::Event&, const edm::EventSetup&) override; + void endStream() override; + + //void beginRun(edm::Run const&, edm::EventSetup const&) override; + //void endRun(edm::Run const&, edm::EventSetup const&) override; + //void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override; + //void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override; + + // ----------member data --------------------------- +}; + +// +// constants, enums and typedefs +// + +// +// static data member definitions +// + +// +// constructors and destructor +// +ZGammaJetInfoProducer::ZGammaJetInfoProducer(const edm::ParameterSet& iConfig) { + //register your products + /* Examples + produces(); + + //if do put with a label + produces("label"); + + //if you want to put into the Run + produces(); + */ + //now do what ever other initialization is needed +} + +ZGammaJetInfoProducer::~ZGammaJetInfoProducer() { + // do anything here that needs to be done at destruction time + // (e.g. close files, deallocate resources etc.) + // + // please remove this method altogether if it would be left empty +} + +// +// member functions +// + +// ------------ method called to produce the data ------------ +void ZGammaJetInfoProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { + using namespace edm; + /* + Build a Z (ee) or a Z(mumu), or find a high pt photon. + + Then save recoGammaOrZ_pt and recoGammaOrZ_phi + + Then loop over genparticles + save genGammaOrZ_pt and genGammaOrZ_phi + save genLeadJet_pt and genLeadJet_phi + + */ +} + +// ------------ method called once each stream before processing any runs, lumis or events ------------ +void ZGammaJetInfoProducer::beginStream(edm::StreamID) { + // please remove this method if not needed +} + +// ------------ method called once each stream after processing all runs, lumis and events ------------ +void ZGammaJetInfoProducer::endStream() { + // please remove this method if not needed +} + +// ------------ method called when starting to processes a run ------------ +/* +void +ZGammaJetInfoProducer::beginRun(edm::Run const&, edm::EventSetup const&) +{ +} +*/ + +// ------------ method called when ending the processing of a run ------------ +/* +void +ZGammaJetInfoProducer::endRun(edm::Run const&, edm::EventSetup const&) +{ +} +*/ + +// ------------ method called when starting to processes a luminosity block ------------ +/* +void +ZGammaJetInfoProducer::beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) +{ +} +*/ + +// ------------ method called when ending the processing of a luminosity block ------------ +/* +void +ZGammaJetInfoProducer::endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) +{ +} +*/ + +// ------------ method fills 'descriptions' with the allowed parameters for the module ------------ +void ZGammaJetInfoProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + //The following says we do not know what parameters are allowed so do no validation + // Please change this to state exactly what you do use, even if it is no parameters + edm::ParameterSetDescription desc; + desc.setUnknown(); + descriptions.addDefault(desc); +} + +//define this as a plug-in +DEFINE_FWK_MODULE(ZGammaJetInfoProducer); diff --git a/DPGAnalysis/L1TNanoAOD/python/customL1nano.pybu b/DPGAnalysis/L1TNanoAOD/python/customL1nano.pybu new file mode 100644 index 0000000000000..dcaafe45faa66 --- /dev/null +++ b/DPGAnalysis/L1TNanoAOD/python/customL1nano.pybu @@ -0,0 +1,21 @@ +import FWCore.ParameterSet.Config as cms +from PhysicsTools.NanoAOD.nano_eras_cff import * +from PhysicsTools.NanoAOD.common_cff import * +from DPGAnalysis.L1TNanoAOD.l1tnanotables_cff import * + +def addEmulCaloTPsandLayer1(process): + """ + Add reemulated TT/clusters to NANOAOD + """ + #process.l1EmulCaloTPsNanoTask = cms.Task(l1EmulCaloTPTable) + #process.l1EmulCaloLayer1NanoTask = cms.Task(l1EmulCaloTowerTable,l1EmulCaloClusterTable) + + + + process.nanoTableTaskCommon.add(process.l1EmulCaloTPsNanoTask) + process.nanoTableTaskCommon.add(process.l1EmulCaloLayer1NanoTask) + #process.testseq = cms.Sequence(process.l1EmulCaloTPsNanoTask) + #process.testseqtwo = cms.Sequence(process.l1EmulCaloLayer1NanoTask) + + + return process diff --git a/DPGAnalysis/L1TNanoAOD/python/l1tNano_cff.py b/DPGAnalysis/L1TNanoAOD/python/l1tNano_cff.py new file mode 100644 index 0000000000000..a934f3cd7a8a3 --- /dev/null +++ b/DPGAnalysis/L1TNanoAOD/python/l1tNano_cff.py @@ -0,0 +1,76 @@ +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) + +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/DPGAnalysis/L1TNanoAOD/python/l1tnanotables_phase2_cff.py b/DPGAnalysis/L1TNanoAOD/python/l1tnanotables_phase2_cff.py new file mode 100644 index 0000000000000..41b1a22fc84b7 --- /dev/null +++ b/DPGAnalysis/L1TNanoAOD/python/l1tnanotables_phase2_cff.py @@ -0,0 +1,25 @@ +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 * + + +gtVtxTable = cms.EDProducer( + "SimpleCandidateFlatTableProducer", + src = cms.InputTag('l1tGTProducer','GTTPrimaryVert'), + cut = cms.string(""), + name = cms.string("L1GTVertex"), + doc = cms.string("GT GTT Vertices"), + singleton = cms.bool(False), # the number of entries is variable + variables = cms.PSet( + z0 = Var("vz",float, doc = "primary vertex position z coordinate"), + # sumPt = Var("hwSum_pT_pv_toInt()*0.25",float, doc = "sum pt of tracks"), + ## hw vars + hwZ0 = Var("hwZ0_toInt()",int, doc = "HW primary vertex position z coordinate"), + # hwSum_pT_pv = Var("hwSum_pT_pv_toInt()",int, doc = "HW sum pt of tracks"), + ) +) + +p2GTL1TablesTask = cms.Task(gtVtxTable) + +