diff --git a/DPGAnalysis/HcalNanoAOD/BuildFile.xml b/DPGAnalysis/HcalNanoAOD/BuildFile.xml new file mode 100644 index 0000000000000..0bc8b75d85a64 --- /dev/null +++ b/DPGAnalysis/HcalNanoAOD/BuildFile.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/DPGAnalysis/HcalNanoAOD/README.md b/DPGAnalysis/HcalNanoAOD/README.md new file mode 100644 index 0000000000000..653d9f763aebe --- /dev/null +++ b/DPGAnalysis/HcalNanoAOD/README.md @@ -0,0 +1,5 @@ +### HcalNanoAOD + +This package provides modules for saving HCAL raw data to NanoAOD. Specifically, modules are provided for HB/HE/HF/HO digis, RecHits, trigger primitives (TPs), HF pre-RecHits, and calibration metadata. Also see DPGAnalysis/CaloNanoAOD for modules related to HCAL+particle flow. + +The digis are saved as a dense array (counting on compression to minimize the space consumed by 0s). The outputs are also sorted by DetId; the sorting is performed by the classes named *SortedTable. diff --git a/DPGAnalysis/HcalNanoAOD/interface/HFPreRecHitSortedTable.h b/DPGAnalysis/HcalNanoAOD/interface/HFPreRecHitSortedTable.h new file mode 100644 index 0000000000000..da24a3276874b --- /dev/null +++ b/DPGAnalysis/HcalNanoAOD/interface/HFPreRecHitSortedTable.h @@ -0,0 +1,31 @@ +#ifndef HFPreRecHitSortedTable_h +#define HFPreRecHitSortedTable_h + +#include +#include + +#include "CalibFormats/HcalObjects/interface/HcalCoderDb.h" +#include "CalibFormats/HcalObjects/interface/HcalDbRecord.h" +#include "CalibFormats/HcalObjects/interface/HcalDbService.h" +#include "DataFormats/HcalDetId/interface/HcalSubdetector.h" +#include "DataFormats/HcalDetId/interface/HcalDetId.h" +#include "DataFormats/HcalDetId/interface/HcalGenericDetId.h" +#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" +#include "CondFormats/HcalObjects/interface/HcalElectronicsMap.h" +#include "CondFormats/HcalObjects/interface/HcalChannelQuality.h" +#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" + +class HFPreRecHitSortedTable { +public: + std::vector dids_; + std::map did_indexmap_; // Use std::map for efficient lookup, rather than std::find + + std::vector charges_; + std::vector chargeAsymmetries_; + std::vector valids_; + + HFPreRecHitSortedTable(const std::vector& dids); + void add(const HFPreRecHitCollection::const_iterator itPreRecHit); + void reset(); +}; +#endif diff --git a/DPGAnalysis/HcalNanoAOD/interface/HODigiSortedTable.h b/DPGAnalysis/HcalNanoAOD/interface/HODigiSortedTable.h new file mode 100644 index 0000000000000..ff6e12f94c944 --- /dev/null +++ b/DPGAnalysis/HcalNanoAOD/interface/HODigiSortedTable.h @@ -0,0 +1,47 @@ +#ifndef HODigiSortedTable_h +#define HODigiSortedTable_h + +#include +#include + +#include "CalibFormats/HcalObjects/interface/HcalCoderDb.h" +#include "CalibFormats/HcalObjects/interface/HcalDbRecord.h" +#include "CalibFormats/HcalObjects/interface/HcalDbService.h" +#include "DataFormats/HcalDetId/interface/HcalSubdetector.h" +#include "DataFormats/HcalDetId/interface/HcalDetId.h" +#include "DataFormats/HcalDetId/interface/HcalGenericDetId.h" +#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" +#include "CondFormats/HcalObjects/interface/HcalElectronicsMap.h" +#include "CondFormats/HcalObjects/interface/HcalChannelQuality.h" +#include "DQM/HcalCommon/interface/Utilities.h" + +class HODigiSortedTable { +public: + std::vector dids_; + std::map did_indexmap_; // Use std::map for efficient lookup, rather than std::find + + std::vector ietas_; + std::vector iphis_; + std::vector subdets_; + std::vector depths_; + std::vector rawIds_; + std::vector fiberIdleOffsets_; + std::vector sois_; + std::vector valids_; + + unsigned int nTS_; + std::vector> adcs_; + std::vector> fcs_; + std::vector> pedestalfcs_; + std::vector> capids_; + std::vector> fibers_; + std::vector> fiberChans_; + std::vector> dvs_; + std::vector> ers_; + + HODigiSortedTable(const std::vector& dids, const unsigned int nTS); + void add(const HODataFrame* digi, const edm::ESHandle& dbService); + void reset(); +}; + +#endif diff --git a/DPGAnalysis/HcalNanoAOD/interface/QIE10DigiSortedTable.h b/DPGAnalysis/HcalNanoAOD/interface/QIE10DigiSortedTable.h new file mode 100644 index 0000000000000..2a0c965d50ef6 --- /dev/null +++ b/DPGAnalysis/HcalNanoAOD/interface/QIE10DigiSortedTable.h @@ -0,0 +1,49 @@ +#ifndef QIE10DigiSortedTable_h +#define QIE10DigiSortedTable_h + +#include +#include + +#include "CalibFormats/HcalObjects/interface/HcalCoderDb.h" +#include "CalibFormats/HcalObjects/interface/HcalDbRecord.h" +#include "CalibFormats/HcalObjects/interface/HcalDbService.h" +#include "DataFormats/HcalDetId/interface/HcalSubdetector.h" +#include "DataFormats/HcalDetId/interface/HcalDetId.h" +#include "DataFormats/HcalDetId/interface/HcalGenericDetId.h" +#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" +#include "CondFormats/HcalObjects/interface/HcalElectronicsMap.h" +#include "CondFormats/HcalObjects/interface/HcalChannelQuality.h" +#include "DQM/HcalCommon/interface/Utilities.h" + +class QIE10DigiSortedTable { +public: + std::vector dids_; + std::map did_indexmap_; // Use std::map for efficient lookup, rather than std::find + + std::vector ietas_; + std::vector iphis_; + std::vector subdets_; + std::vector depths_; + std::vector rawIds_; + std::vector linkErrors_; + std::vector flags_; + std::vector sois_; + std::vector valids_; + //std::vector sipmTypes_; + + unsigned int nTS_; + std::vector> adcs_; + std::vector> fcs_; + std::vector> pedestalfcs_; + std::vector> tdcs_; + std::vector> capids_; + std::vector> oks_; + + QIE10DigiSortedTable(const std::vector& dids, const unsigned int nTS); + void add(const QIE10DataFrame* digi, const edm::ESHandle& dbService); + void reset(); +}; + +typedef QIE10DigiSortedTable HFDigiSortedTable; + +#endif diff --git a/DPGAnalysis/HcalNanoAOD/interface/QIE11DigiSortedTable.h b/DPGAnalysis/HcalNanoAOD/interface/QIE11DigiSortedTable.h new file mode 100644 index 0000000000000..7c3c9d13dab7e --- /dev/null +++ b/DPGAnalysis/HcalNanoAOD/interface/QIE11DigiSortedTable.h @@ -0,0 +1,49 @@ +#ifndef QIE11DigiSortedTable_h +#define QIE11DigiSortedTable_h + +#include +#include + +#include "CalibFormats/HcalObjects/interface/HcalCoderDb.h" +#include "CalibFormats/HcalObjects/interface/HcalDbRecord.h" +#include "CalibFormats/HcalObjects/interface/HcalDbService.h" +#include "DataFormats/HcalDetId/interface/HcalSubdetector.h" +#include "DataFormats/HcalDetId/interface/HcalDetId.h" +#include "DataFormats/HcalDetId/interface/HcalGenericDetId.h" +#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" +#include "CondFormats/HcalObjects/interface/HcalElectronicsMap.h" +#include "CondFormats/HcalObjects/interface/HcalChannelQuality.h" +#include "DQM/HcalCommon/interface/Utilities.h" + +class QIE11DigiSortedTable { +public: + std::vector dids_; + std::map did_indexmap_; // Use std::map for efficient lookup, rather than std::find + + std::vector ietas_; + std::vector iphis_; + std::vector subdets_; + std::vector depths_; + std::vector rawIds_; + std::vector linkErrors_; + std::vector capidErrors_; + std::vector flags_; + std::vector sois_; + std::vector valids_; + std::vector sipmTypes_; + + unsigned int nTS_; + std::vector> adcs_; + std::vector> fcs_; + std::vector> pedestalfcs_; + std::vector> tdcs_; + std::vector> capids_; + + QIE11DigiSortedTable(const std::vector& dids, const unsigned int nTS); + void add(const QIE11DataFrame* digi, const edm::ESHandle& dbService); + void reset(); +}; + +typedef QIE11DigiSortedTable HBDigiSortedTable; +typedef QIE11DigiSortedTable HEDigiSortedTable; +#endif diff --git a/DPGAnalysis/HcalNanoAOD/plugins/BuildFile.xml b/DPGAnalysis/HcalNanoAOD/plugins/BuildFile.xml new file mode 100644 index 0000000000000..0518902dd00b2 --- /dev/null +++ b/DPGAnalysis/HcalNanoAOD/plugins/BuildFile.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DPGAnalysis/HcalNanoAOD/plugins/HcalDetIdTableProducer.cc b/DPGAnalysis/HcalNanoAOD/plugins/HcalDetIdTableProducer.cc new file mode 100644 index 0000000000000..754c1987c14e1 --- /dev/null +++ b/DPGAnalysis/HcalNanoAOD/plugins/HcalDetIdTableProducer.cc @@ -0,0 +1,108 @@ +#include + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/global/EDProducer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Utilities/interface/ESInputTag.h" +#include "FWCore/Utilities/interface/Transition.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" + +#include "CommonTools/Utils/interface/StringCutObjectSelector.h" +#include "CommonTools/Utils/interface/StringObjectFunction.h" + +#include "CalibFormats/HcalObjects/interface/HcalCoderDb.h" +#include "CalibFormats/HcalObjects/interface/HcalDbRecord.h" +#include "CalibFormats/HcalObjects/interface/HcalDbService.h" +#include "CondFormats/HcalObjects/interface/HcalElectronicsMap.h" +#include "CondFormats/HcalObjects/interface/HcalChannelQuality.h" +#include "DataFormats/HcalDetId/interface/HcalSubdetector.h" +#include "DataFormats/HcalDetId/interface/HcalDetId.h" +#include "DataFormats/HcalDetId/interface/HcalGenericDetId.h" +#include "DataFormats/NanoAOD/interface/FlatTable.h" + +class HcalDetIdTableProducer : public edm::global::EDProducer { +private: + edm::ESGetToken tokenHcalDbService_; + edm::EDPutTokenT> hbDetIdListToken_; + edm::EDPutTokenT> heDetIdListToken_; + edm::EDPutTokenT> hfDetIdListToken_; + edm::EDPutTokenT> hoDetIdListToken_; + +public: + explicit HcalDetIdTableProducer(const edm::ParameterSet& iConfig) + : tokenHcalDbService_(esConsumes()) { + hbDetIdListToken_ = produces, edm::Transition::BeginRun>("HBDetIdList"); + heDetIdListToken_ = produces, edm::Transition::BeginRun>("HEDetIdList"); + hfDetIdListToken_ = produces, edm::Transition::BeginRun>("HFDetIdList"); + hoDetIdListToken_ = produces, edm::Transition::BeginRun>("HODetIdList"); + + produces("HBDetIdList"); + produces("HEDetIdList"); + produces("HFDetIdList"); + produces("HODetIdList"); + }; + + void produce(edm::StreamID, edm::Event&, edm::EventSetup const&) const override; + void globalBeginRunProduce(edm::Run& iRun, edm::EventSetup const& iSetup) const override; +}; + +void HcalDetIdTableProducer::produce(edm::StreamID, edm::Event&, edm::EventSetup const&) const {} + +void HcalDetIdTableProducer::globalBeginRunProduce(edm::Run& iRun, edm::EventSetup const& iSetup) const { + // Setup products + const std::vector subdets = {HcalBarrel, HcalEndcap, HcalForward, HcalOuter}; + std::map>> didLists; + didLists[HcalBarrel] = std::make_unique>(); + didLists[HcalEndcap] = std::make_unique>(); + didLists[HcalForward] = std::make_unique>(); + didLists[HcalOuter] = std::make_unique>(); + + // Load channels from emap + edm::ESHandle dbService = iSetup.getHandle(tokenHcalDbService_); + HcalElectronicsMap const* emap = dbService->getHcalMapping(); + + std::vector alldids = emap->allPrecisionId(); + for (auto it_did = alldids.begin(); it_did != alldids.end(); ++it_did) { + if (!it_did->isHcalDetId()) { + continue; + } + HcalDetId did = HcalDetId(it_did->rawId()); + if (!(did.subdet() == HcalBarrel || did.subdet() == HcalEndcap || did.subdet() == HcalForward || + did.subdet() == HcalOuter)) { + continue; + } + + // TODO: Add filtering, for example on FED whitelist + + didLists[did.subdet()]->push_back(did); + } + + // Sort HcalDetIds + for (auto& it_subdet : subdets) { + std::sort(didLists[it_subdet]->begin(), didLists[it_subdet]->end()); + } + + // Make NanoAOD tables + std::map subdetNames = { + {HcalBarrel, "HB"}, {HcalEndcap, "HE"}, {HcalForward, "HF"}, {HcalOuter, "HO"}}; + + for (auto& it_subdet : subdets) { + auto didTable = + std::make_unique(didLists[it_subdet]->size(), subdetNames[it_subdet], false, false); + + std::vector vdids; + for (auto& it_did : *(didLists[it_subdet])) { + vdids.push_back(it_did.rawId()); + } + didTable->addColumn("did", vdids, "HcalDetId"); + + iRun.put(std::move(didTable), subdetNames[it_subdet] + "DetIdList"); + iRun.put(std::move(didLists[it_subdet]), subdetNames[it_subdet] + "DetIdList"); + } +} + +#include "FWCore/Framework/interface/MakerMacros.h" +//define this as a plug-in +DEFINE_FWK_MODULE(HcalDetIdTableProducer); diff --git a/DPGAnalysis/HcalNanoAOD/plugins/HcalDigiSortedTableProducer.cc b/DPGAnalysis/HcalNanoAOD/plugins/HcalDigiSortedTableProducer.cc new file mode 100644 index 0000000000000..f3df4add9d772 --- /dev/null +++ b/DPGAnalysis/HcalNanoAOD/plugins/HcalDigiSortedTableProducer.cc @@ -0,0 +1,337 @@ +// 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/Utilities/interface/ESInputTag.h" +#include "FWCore/Utilities/interface/Transition.h" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" + +#include "DataFormats/NanoAOD/interface/FlatTable.h" + +#include "CommonTools/Utils/interface/StringCutObjectSelector.h" +#include "CommonTools/Utils/interface/StringObjectFunction.h" + +#include "CalibFormats/HcalObjects/interface/HcalCoderDb.h" +#include "CalibFormats/HcalObjects/interface/HcalDbRecord.h" +#include "CalibFormats/HcalObjects/interface/HcalDbService.h" +#include "DataFormats/HcalDetId/interface/HcalSubdetector.h" +#include "DataFormats/HcalDetId/interface/HcalDetId.h" +#include "DataFormats/HcalDetId/interface/HcalGenericDetId.h" +#include "CondFormats/HcalObjects/interface/HcalElectronicsMap.h" +#include "CondFormats/HcalObjects/interface/HcalChannelQuality.h" + +#include "DPGAnalysis/HcalNanoAOD/interface/QIE11DigiSortedTable.h" +#include "DPGAnalysis/HcalNanoAOD/interface/QIE10DigiSortedTable.h" +#include "DPGAnalysis/HcalNanoAOD/interface/HODigiSortedTable.h" + +class HcalDigiSortedTableProducer : public edm::stream::EDProducer<> { +private: + std::map>> dids_; + + //std::map > eids_; + static const std::vector subdets_; + HcalElectronicsMap const* emap_; + + edm::InputTag tagHBDetIdList_; + edm::InputTag tagHEDetIdList_; + edm::InputTag tagHFDetIdList_; + edm::InputTag tagHODetIdList_; + + edm::EDGetTokenT> tokenHBDetIdList_; + edm::EDGetTokenT> tokenHEDetIdList_; + edm::EDGetTokenT> tokenHFDetIdList_; + edm::EDGetTokenT> tokenHODetIdList_; + + edm::InputTag tagQIE11_; + edm::InputTag tagQIE10_; + edm::InputTag tagHO_; + + edm::EDGetTokenT tokenQIE11_; + edm::EDGetTokenT tokenQIE10_; + edm::EDGetTokenT tokenHO_; + + edm::ESGetToken tokenHcalDbService_; + edm::ESHandle dbService_; + + HBDigiSortedTable* hbDigiTable_; + HEDigiSortedTable* heDigiTable_; + HFDigiSortedTable* hfDigiTable_; + HODigiSortedTable* hoDigiTable_; + + const unsigned int nTS_HB_; + const unsigned int nTS_HE_; + const unsigned int nTS_HF_; + const unsigned int nTS_HO_; + +public: + explicit HcalDigiSortedTableProducer(const edm::ParameterSet& iConfig) + : tokenHBDetIdList_(consumes(iConfig.getUntrackedParameter( + "HBDetIdList", edm::InputTag("hcalDetIdTable", "HBDetIdList")))), + tokenHEDetIdList_(consumes(iConfig.getUntrackedParameter( + "HEDetIdList", edm::InputTag("hcalDetIdTable", "HEDetIdList")))), + tokenHFDetIdList_(consumes(iConfig.getUntrackedParameter( + "HFDetIdList", edm::InputTag("hcalDetIdTable", "HFDetIdList")))), + tokenHODetIdList_(consumes(iConfig.getUntrackedParameter( + "HODetIdList", edm::InputTag("hcalDetIdTable", "HODetIdList")))), + tagQIE11_(iConfig.getUntrackedParameter("tagQIE11", edm::InputTag("hcalDigis"))), + tagQIE10_(iConfig.getUntrackedParameter("tagQIE10", edm::InputTag("hcalDigis"))), + tagHO_(iConfig.getUntrackedParameter("tagHO", edm::InputTag("hcalDigis"))), + tokenHcalDbService_(esConsumes()), + nTS_HB_(iConfig.getUntrackedParameter("nTS_HB", 8)), + nTS_HE_(iConfig.getUntrackedParameter("nTS_HE", 8)), + nTS_HF_(iConfig.getUntrackedParameter("nTS_HF", 3)), + nTS_HO_(iConfig.getUntrackedParameter("nTS_HO", 10)) { + tokenQIE11_ = consumes(tagQIE11_); + tokenHO_ = consumes(tagHO_); + tokenQIE10_ = consumes(tagQIE10_); + + produces("HBDigiSortedTable"); + produces("HEDigiSortedTable"); + produces("HFDigiSortedTable"); + produces("HODigiSortedTable"); + + hbDigiTable_ = nullptr; + heDigiTable_ = nullptr; + hfDigiTable_ = nullptr; + hoDigiTable_ = nullptr; + } + + ~HcalDigiSortedTableProducer() override { + delete hbDigiTable_; + delete heDigiTable_; + delete hfDigiTable_; + delete hoDigiTable_; + }; + + /* + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("tagQIE11")->setComment("Input QIE 11 digi collection"); + // desc.add("name")->setComment(""); + descriptions.add("HcalDigiTable", desc); + } + */ + +private: + void beginRun(edm::Run const&, edm::EventSetup const&) override; + void produce(edm::Event&, edm::EventSetup const&) override; +}; + +const std::vector HcalDigiSortedTableProducer::subdets_ = { + HcalBarrel, HcalEndcap, HcalForward, HcalOuter}; + +void HcalDigiSortedTableProducer::beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) { + // List DetIds of interest from emap + dbService_ = iSetup.getHandle(tokenHcalDbService_); + emap_ = dbService_->getHcalMapping(); + + iRun.getByToken(tokenHBDetIdList_, dids_[HcalBarrel]); + iRun.getByToken(tokenHEDetIdList_, dids_[HcalEndcap]); + iRun.getByToken(tokenHFDetIdList_, dids_[HcalForward]); + iRun.getByToken(tokenHODetIdList_, dids_[HcalOuter]); + + // Create persistent, sorted digi storage + hbDigiTable_ = new HBDigiSortedTable(*(dids_[HcalBarrel]), nTS_HB_); + heDigiTable_ = new HEDigiSortedTable(*(dids_[HcalEndcap]), nTS_HE_); + hfDigiTable_ = new HFDigiSortedTable(*(dids_[HcalForward]), nTS_HF_); + hoDigiTable_ = new HODigiSortedTable(*(dids_[HcalOuter]), nTS_HO_); +} + +void HcalDigiSortedTableProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { + // * Load digis */ + edm::Handle qie11Digis; + iEvent.getByToken(tokenQIE11_, qie11Digis); + + edm::Handle qie10Digis; + iEvent.getByToken(tokenQIE10_, qie10Digis); + + edm::Handle hoDigis; + iEvent.getByToken(tokenHO_, hoDigis); + + // * Process digis */ + // HB + hbDigiTable_->reset(); + for (QIE11DigiCollection::const_iterator itDigi = qie11Digis->begin(); itDigi != qie11Digis->end(); ++itDigi) { + const QIE11DataFrame digi = static_cast(*itDigi); + HcalDetId const& did = digi.detid(); + if (did.subdet() != HcalBarrel) + continue; + + hbDigiTable_->add(&digi, dbService_); + } // End loop over qie11 HB digis + + // HE + heDigiTable_->reset(); + for (QIE11DigiCollection::const_iterator itDigi = qie11Digis->begin(); itDigi != qie11Digis->end(); ++itDigi) { + const QIE11DataFrame digi = static_cast(*itDigi); + HcalDetId const& did = digi.detid(); + if (did.subdet() != HcalEndcap) + continue; + + heDigiTable_->add(&digi, dbService_); + } // End loop over qie11 HE digis + + // HF + hfDigiTable_->reset(); + for (QIE10DigiCollection::const_iterator itDigi = qie10Digis->begin(); itDigi != qie10Digis->end(); ++itDigi) { + const QIE10DataFrame digi = static_cast(*itDigi); + HcalDetId const& did = digi.detid(); + if (did.subdet() != HcalForward) + continue; + + hfDigiTable_->add(&digi, dbService_); + } // End loop over qie10 HF digis + + // HO + hoDigiTable_->reset(); + for (HODigiCollection::const_iterator itDigi = hoDigis->begin(); itDigi != hoDigis->end(); ++itDigi) { + const HODataFrame digi = static_cast(*itDigi); + HcalDetId const& did = digi.id(); + if (did.subdet() != HcalOuter) + continue; + + hoDigiTable_->add(&digi, dbService_); + } // End loop over HO digis + + // * Save to NanoAOD tables */ + + // HB + auto hbNanoTable = std::make_unique(dids_[HcalBarrel]->size(), "DigiHB", false, false); + hbNanoTable->addColumn("rawId", hbDigiTable_->rawIds_, "rawId"); + hbNanoTable->addColumn("ieta", hbDigiTable_->ietas_, "ieta"); + hbNanoTable->addColumn("iphi", hbDigiTable_->iphis_, "iphi"); + hbNanoTable->addColumn("depth", hbDigiTable_->depths_, "depth"); + hbNanoTable->addColumn("subdet", hbDigiTable_->subdets_, "subdet"); + hbNanoTable->addColumn("linkError", hbDigiTable_->linkErrors_, "linkError"); + hbNanoTable->addColumn("capidError", hbDigiTable_->capidErrors_, "capidError"); + hbNanoTable->addColumn("flags", hbDigiTable_->flags_, "flags"); + hbNanoTable->addColumn("soi", hbDigiTable_->sois_, "soi"); + hbNanoTable->addColumn("valid", hbDigiTable_->valids_, "valid"); + hbNanoTable->addColumn("sipmTypes", hbDigiTable_->sipmTypes_, "sipmTypes"); + + for (unsigned int iTS = 0; iTS < 8; ++iTS) { + hbNanoTable->addColumn( + std::string("adc") + std::to_string(iTS), hbDigiTable_->adcs_[iTS], std::string("adc") + std::to_string(iTS)); + hbNanoTable->addColumn( + std::string("tdc") + std::to_string(iTS), hbDigiTable_->tdcs_[iTS], std::string("tdc") + std::to_string(iTS)); + hbNanoTable->addColumn(std::string("capid") + std::to_string(iTS), + hbDigiTable_->capids_[iTS], + std::string("capid") + std::to_string(iTS)); + hbNanoTable->addColumn( + std::string("fc") + std::to_string(iTS), hbDigiTable_->fcs_[iTS], std::string("fc") + std::to_string(iTS)); + hbNanoTable->addColumn(std::string("pedestalfc") + std::to_string(iTS), + hbDigiTable_->pedestalfcs_[iTS], + std::string("pedestalfc") + std::to_string(iTS)); + } + iEvent.put(std::move(hbNanoTable), "HBDigiSortedTable"); + + // HE + auto heNanoTable = std::make_unique(dids_[HcalEndcap]->size(), "DigiHE", false, false); + heNanoTable->addColumn("rawId", heDigiTable_->rawIds_, "rawId"); + heNanoTable->addColumn("ieta", heDigiTable_->ietas_, "ieta"); + heNanoTable->addColumn("iphi", heDigiTable_->iphis_, "iphi"); + heNanoTable->addColumn("depth", heDigiTable_->depths_, "depth"); + heNanoTable->addColumn("subdet", heDigiTable_->subdets_, "subdet"); + heNanoTable->addColumn("linkError", heDigiTable_->linkErrors_, "linkError"); + heNanoTable->addColumn("capidError", heDigiTable_->capidErrors_, "capidError"); + heNanoTable->addColumn("flags", heDigiTable_->flags_, "flags"); + heNanoTable->addColumn("soi", heDigiTable_->sois_, "soi"); + heNanoTable->addColumn("valid", heDigiTable_->valids_, "valid"); + heNanoTable->addColumn("sipmTypes", heDigiTable_->sipmTypes_, "sipmTypes"); + + for (unsigned int iTS = 0; iTS < 8; ++iTS) { + heNanoTable->addColumn( + std::string("adc") + std::to_string(iTS), heDigiTable_->adcs_[iTS], std::string("adc") + std::to_string(iTS)); + heNanoTable->addColumn( + std::string("tdc") + std::to_string(iTS), heDigiTable_->tdcs_[iTS], std::string("tdc") + std::to_string(iTS)); + heNanoTable->addColumn(std::string("capid") + std::to_string(iTS), + heDigiTable_->capids_[iTS], + std::string("capid") + std::to_string(iTS)); + heNanoTable->addColumn( + std::string("fc") + std::to_string(iTS), heDigiTable_->fcs_[iTS], std::string("fc") + std::to_string(iTS)); + heNanoTable->addColumn(std::string("pedestalfc") + std::to_string(iTS), + heDigiTable_->pedestalfcs_[iTS], + std::string("pedestalfc") + std::to_string(iTS)); + } + iEvent.put(std::move(heNanoTable), "HEDigiSortedTable"); + + // HF + auto hfNanoTable = std::make_unique(dids_[HcalForward]->size(), "DigiHF", false, false); + hfNanoTable->addColumn("rawId", hfDigiTable_->rawIds_, "rawId"); + hfNanoTable->addColumn("ieta", hfDigiTable_->ietas_, "ieta"); + hfNanoTable->addColumn("iphi", hfDigiTable_->iphis_, "iphi"); + hfNanoTable->addColumn("depth", hfDigiTable_->depths_, "depth"); + hfNanoTable->addColumn("subdet", hfDigiTable_->subdets_, "subdet"); + hfNanoTable->addColumn("linkError", hfDigiTable_->linkErrors_, "linkError"); + hfNanoTable->addColumn("flags", hfDigiTable_->flags_, "flags"); + hfNanoTable->addColumn("soi", hfDigiTable_->sois_, "soi"); + hfNanoTable->addColumn("valid", hfDigiTable_->valids_, "valid"); + //hfNanoTable->addColumn("sipmTypes", hfDigiTable_->sipmTypes_, "sipmTypes"); + + for (unsigned int iTS = 0; iTS < 3; ++iTS) { + hfNanoTable->addColumn( + std::string("adc") + std::to_string(iTS), hfDigiTable_->adcs_[iTS], std::string("adc") + std::to_string(iTS)); + hfNanoTable->addColumn( + std::string("tdc") + std::to_string(iTS), hfDigiTable_->tdcs_[iTS], std::string("tdc") + std::to_string(iTS)); + //hfNanoTable->addColumn(std::string("tetdc") + std::to_string(iTS), + // hfDigiTable_->tetdcs_[iTS], + // std::string("tetdc") + std::to_string(iTS)); + hfNanoTable->addColumn(std::string("capid") + std::to_string(iTS), + hfDigiTable_->capids_[iTS], + std::string("capid") + std::to_string(iTS)); + hfNanoTable->addColumn( + std::string("fc") + std::to_string(iTS), hfDigiTable_->fcs_[iTS], std::string("fc") + std::to_string(iTS)); + hfNanoTable->addColumn(std::string("pedestalfc") + std::to_string(iTS), + hfDigiTable_->pedestalfcs_[iTS], + std::string("pedestalfc") + std::to_string(iTS)); + hfNanoTable->addColumn( + std::string("ok") + std::to_string(iTS), hfDigiTable_->oks_[iTS], std::string("ok") + std::to_string(iTS)); + } + iEvent.put(std::move(hfNanoTable), "HFDigiSortedTable"); + + // HO + auto hoNanoTable = std::make_unique(dids_[HcalOuter]->size(), "DigiHO", false, false); + hoNanoTable->addColumn("rawId", hoDigiTable_->rawIds_, "rawId"); + hoNanoTable->addColumn("ieta", hoDigiTable_->ietas_, "ieta"); + hoNanoTable->addColumn("iphi", hoDigiTable_->iphis_, "iphi"); + hoNanoTable->addColumn("depth", hoDigiTable_->depths_, "depth"); + hoNanoTable->addColumn("subdet", hoDigiTable_->subdets_, "subdet"); + hoNanoTable->addColumn("fiberIdleOffset", hoDigiTable_->fiberIdleOffsets_, "fiberIdleOffset"); + hoNanoTable->addColumn("soi", hoDigiTable_->sois_, "soi"); + hoNanoTable->addColumn("valid", hoDigiTable_->valids_, "valid"); + + for (unsigned int iTS = 0; iTS < 10; ++iTS) { + hoNanoTable->addColumn( + std::string("adc") + std::to_string(iTS), hoDigiTable_->adcs_[iTS], std::string("adc") + std::to_string(iTS)); + hoNanoTable->addColumn(std::string("capid") + std::to_string(iTS), + hoDigiTable_->capids_[iTS], + std::string("capid") + std::to_string(iTS)); + hoNanoTable->addColumn( + std::string("fc") + std::to_string(iTS), hoDigiTable_->fcs_[iTS], std::string("fc") + std::to_string(iTS)); + hoNanoTable->addColumn(std::string("pedestalfc") + std::to_string(iTS), + hoDigiTable_->pedestalfcs_[iTS], + std::string("pedestalfc") + std::to_string(iTS)); + hoNanoTable->addColumn(std::string("fiber") + std::to_string(iTS), + hoDigiTable_->fibers_[iTS], + std::string("fiber") + std::to_string(iTS)); + hoNanoTable->addColumn(std::string("fiberChan") + std::to_string(iTS), + hoDigiTable_->fiberChans_[iTS], + std::string("fiberChan") + std::to_string(iTS)); + hoNanoTable->addColumn( + std::string("dv") + std::to_string(iTS), hoDigiTable_->dvs_[iTS], std::string("dv") + std::to_string(iTS)); + hoNanoTable->addColumn( + std::string("er") + std::to_string(iTS), hoDigiTable_->ers_[iTS], std::string("er") + std::to_string(iTS)); + } + iEvent.put(std::move(hoNanoTable), "HODigiSortedTable"); +} + +#include "FWCore/Framework/interface/MakerMacros.h" +//define this as a plug-in +DEFINE_FWK_MODULE(HcalDigiSortedTableProducer); diff --git a/DPGAnalysis/HcalNanoAOD/plugins/HcalRecHitTableProducer.cc b/DPGAnalysis/HcalNanoAOD/plugins/HcalRecHitTableProducer.cc new file mode 100644 index 0000000000000..245ea75124c71 --- /dev/null +++ b/DPGAnalysis/HcalNanoAOD/plugins/HcalRecHitTableProducer.cc @@ -0,0 +1,15 @@ +#include "PhysicsTools/NanoAOD/interface/SimpleFlatTableProducer.h" + +#include "DataFormats/HcalRecHit/interface/HBHERecHit.h" +typedef SimpleFlatTableProducer HBHERecHitFlatTableProducer; + +#include "DataFormats/HcalRecHit/interface/HFRecHit.h" +typedef SimpleFlatTableProducer HFRecHitFlatTableProducer; + +#include "DataFormats/HcalRecHit/interface/HORecHit.h" +typedef SimpleFlatTableProducer HORecHitFlatTableProducer; + +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(HBHERecHitFlatTableProducer); +DEFINE_FWK_MODULE(HFRecHitFlatTableProducer); +DEFINE_FWK_MODULE(HORecHitFlatTableProducer); diff --git a/DPGAnalysis/HcalNanoAOD/plugins/HcalUMNioTableProducer.cc b/DPGAnalysis/HcalNanoAOD/plugins/HcalUMNioTableProducer.cc new file mode 100644 index 0000000000000..2ba7c3a0b2f62 --- /dev/null +++ b/DPGAnalysis/HcalNanoAOD/plugins/HcalUMNioTableProducer.cc @@ -0,0 +1,64 @@ +// 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/Utilities/interface/ESInputTag.h" +#include "FWCore/Utilities/interface/Transition.h" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" + +#include "DataFormats/NanoAOD/interface/FlatTable.h" +#include "DataFormats/HcalDigi/interface/HcalUMNioDigi.h" + +class HcalUMNioTableProducer : public edm::stream::EDProducer<> { +private: + edm::EDGetTokenT tokenUMNio_; + edm::InputTag tagUMNio_; + +public: + explicit HcalUMNioTableProducer(const edm::ParameterSet& iConfig) + : tagUMNio_(iConfig.getUntrackedParameter("tagUMNio", edm::InputTag("hcalDigis"))) { + tokenUMNio_ = consumes(tagUMNio_); + + produces("uMNioTable"); + } + + ~HcalUMNioTableProducer() override{}; + + /* + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("tagUMNio")->setComment("Input uMNio digi collection"); + descriptions.add("HcalUMNioTable", desc); + } + */ + +private: + void beginRun(edm::Run const&, edm::EventSetup const&) override; + void produce(edm::Event&, edm::EventSetup const&) override; +}; + +void HcalUMNioTableProducer::beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) {} + +void HcalUMNioTableProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { + edm::Handle uMNioDigi; + iEvent.getByToken(tokenUMNio_, uMNioDigi); + uint8_t eventType = uMNioDigi->eventType(); + uint32_t laserType = uMNioDigi->valueUserWord(0); + + auto uMNioNanoTable = std::make_unique(1, "uMNio", true); + + uMNioNanoTable->addColumnValue("EventType", eventType, "EventType"); + uMNioNanoTable->addColumnValue("LaserType", laserType, "LaserType"); + iEvent.put(std::move(uMNioNanoTable), "uMNioTable"); +} + +#include "FWCore/Framework/interface/MakerMacros.h" +//define this as a plug-in +DEFINE_FWK_MODULE(HcalUMNioTableProducer); diff --git a/DPGAnalysis/HcalNanoAOD/python/customiseHcalCalib_cff.py b/DPGAnalysis/HcalNanoAOD/python/customiseHcalCalib_cff.py new file mode 100644 index 0000000000000..6067d4a686ad1 --- /dev/null +++ b/DPGAnalysis/HcalNanoAOD/python/customiseHcalCalib_cff.py @@ -0,0 +1,54 @@ +import FWCore.ParameterSet.Config as cms + +# Customization for running on testEnablesEcalHcal +# - Call from cmsDriver.py with: `--customise DPGAnalysis/HcalNanoAOD/customiseHcalCalib_cff.customiseHcalCalib` +def customiseHcalCalib(process): + # Add uMNio digi (special digi identifies calib event type) + process.load("DPGAnalysis.HcalNanoAOD.hcalUMNioTable_cff") + process.hcalNanoTask.add(process.uMNioTable) + process.hcalNanoDigiTask.add(process.uMNioTable) + + # Raw data has a different name, hltHcalCalibrationRaw instead of rawDataCollector + process.hcalDigis.InputLabel = cms.InputTag('hltHcalCalibrationRaw') + + # Create EDFilter for HLT_HcalCalibration + # (HCAL raw data is not present in ECAL-triggered events, annoyingly. The filter stops downstream modules from throwing ProductNotFound.) + process.hcalCalibHLTFilter = cms.EDFilter("TriggerResultsFilter", + triggerConditions = cms.vstring( + 'HLT_HcalCalibration_v5 / 1'), + hltResults = cms.InputTag( "TriggerResults", "", "HLT" ), + l1tResults = cms.InputTag( "" ), + l1tIgnoreMask = cms.bool( False ), + l1techIgnorePrescales = cms.bool( False ), + daqPartitions = cms.uint32( 1 ), + throw = cms.bool( True ) + ) + + # Remove hcalDigis from normal raw2digi task, and put on a sequence after the HLT filter + process.RawToDigiTask.remove(process.hcalDigis) + process.hcalCalibDigiSequence = cms.Sequence(process.hcalCalibHLTFilter + process.hcalDigis) + process.raw2digi_step = cms.Path(process.hcalCalibDigiSequence, process.RawToDigiTask) + + # Insert the HLT filter at start of user path and nanoaod endpath + process.user_step.insert(0, process.hcalCalibHLTFilter) + process.NANOAODoutput_step.insert(0, process.hcalCalibHLTFilter) + + + #process.raw2digi_step = cms.Path(process.hcalCalibHLTFilter + process.RawToDigi) + #process.raw2digi_step.replace(process.hcalDigis, process.hcalCalibDigis) + #process.hcalDigiSortedTableTask.add(process.hcalCalibDigis) + #process.hcalDigiSortedTableSeq.add(process.hcalCalibDigis) + + #process.options.SkipEvent.append('ProductNotFound') + + #process.hcalDigiSortedTable.tagQIE11 = cms.untracked.InputTag("hcalCalibDigis") + #process.hcalDigiSortedTable.tagQIE10 = cms.untracked.InputTag("hcalCalibDigis") + #process.hcalDigiSortedTable.tagHO = cms.untracked.InputTag("hcalCalibDigis") + + process.load("FWCore.MessageService.MessageLogger_cfi") + process.MessageLogger.cout.threshold = "DEBUG" + process.MessageLogger.cerr.threshold = "DEBUG" + # enable LogDebug messages only for specific modules + process.MessageLogger.debugModules = ["*"] + + return process diff --git a/DPGAnalysis/HcalNanoAOD/python/customiseHcalLocal_cff.py b/DPGAnalysis/HcalNanoAOD/python/customiseHcalLocal_cff.py new file mode 100644 index 0000000000000..92dd3ce058fb3 --- /dev/null +++ b/DPGAnalysis/HcalNanoAOD/python/customiseHcalLocal_cff.py @@ -0,0 +1,29 @@ +import FWCore.ParameterSet.Config as cms + +# Customization for running on HCAL local run data +# - Call from cmsDriver.py with: `--customise DPGAnalysis/HcalNanoAOD/customise_hcalLocal_cff.customiseHcalLocal` +def customiseHcalLocal(process): + input_files = process.source.fileNames + max_events = process.maxEvents.input + process.source = cms.Source("HcalTBSource", + fileNames = input_files, + maxEvents = max_events, + firstLuminosityBlockForEachRun = cms.untracked.VLuminosityBlockID([]), + ) + process.hcalDigis.InputLabel = cms.InputTag('source') + #process.hcalDigis.saveQIE10DataNSamples = cms.untracked.vint32(10) + #process.hcalDigis.saveQIE10DataTags = cms.untracked.vstring("ZDC") + + if hasattr(process, "hcalDigiSortedTableTask"): + process.hcalDigiSortedTable.nTS_HB = cms.untracked.uint32(8) + process.hcalDigiSortedTable.nTS_HE = cms.untracked.uint32(8) + process.hcalDigiSortedTable.nTS_HF = cms.untracked.uint32(6) + process.hcalDigiSortedTable.nTS_HO = cms.untracked.uint32(10) + + process.load("DPGAnalysis.HcalNanoAOD.hcalUMNioTable_cff") + if hasattr(process, "hcalNanoTask"): + process.hcalNanoTask.add(process.uMNioTable) + if hasattr(process, "hcalNanoDigiTask"): + process.hcalNanoDigiTask.add(process.uMNioTable) + + return process diff --git a/DPGAnalysis/HcalNanoAOD/python/hcalDetIdTable_cff.py b/DPGAnalysis/HcalNanoAOD/python/hcalDetIdTable_cff.py new file mode 100644 index 0000000000000..664e0d8400c19 --- /dev/null +++ b/DPGAnalysis/HcalNanoAOD/python/hcalDetIdTable_cff.py @@ -0,0 +1,6 @@ +import FWCore.ParameterSet.Config as cms +from PhysicsTools.NanoAOD.common_cff import * + +hcalDetIdTable = cms.EDProducer("HcalDetIdTableProducer") +hcalDetIdTableTask = cms.Task(hcalDetIdTable) +hcalDetIdTableSeq = cms.Sequence(hcalDetIdTable) diff --git a/DPGAnalysis/HcalNanoAOD/python/hcalDigiSortedTable_cff.py b/DPGAnalysis/HcalNanoAOD/python/hcalDigiSortedTable_cff.py new file mode 100644 index 0000000000000..32651c8103743 --- /dev/null +++ b/DPGAnalysis/HcalNanoAOD/python/hcalDigiSortedTable_cff.py @@ -0,0 +1,19 @@ +import FWCore.ParameterSet.Config as cms +from PhysicsTools.NanoAOD.common_cff import * + +# IMPORTANT: This variable has to end in "Table"! +# Otherwise, the NanoAODOutputModule will ignore it by default +# (e.g., the `keep nanoaodFlatTable_*Table_*_*"` bit in +# process.NanoAODEDMEventContent.outputCommands, +# see cmssw source code for details on this arcane syntax) +hcalDigiSortedTable= cms.EDProducer("HcalDigiSortedTableProducer", + tagQIE11 = cms.untracked.InputTag("hcalDigis"), + tagQIE10 = cms.untracked.InputTag("hcalDigis"), + tagHO = cms.untracked.InputTag("hcalDigis"), + #taguMNio = cms.untracked.InputTag("hcalDigis"), + #StoreLaser = cms.untracked.bool(False), + #chargeSkim = cms.untracked.double(0) +) + +hcalDigiSortedTableTask = cms.Task(hcalDigiSortedTable) +hcalDigiSortedTableSeq = cms.Sequence(hcalDigiSortedTable) \ No newline at end of file diff --git a/DPGAnalysis/HcalNanoAOD/python/hcalNano_cff.py b/DPGAnalysis/HcalNanoAOD/python/hcalNano_cff.py new file mode 100644 index 0000000000000..3e4a7b8356ec7 --- /dev/null +++ b/DPGAnalysis/HcalNanoAOD/python/hcalNano_cff.py @@ -0,0 +1,108 @@ +from PhysicsTools.NanoAOD.common_cff import Var,CandVars +from DPGAnalysis.HcalNanoAOD.hcalRecHitTable_cff import * +from DPGAnalysis.HcalNanoAOD.hcalDigiSortedTable_cff import * +from DPGAnalysis.HcalNanoAOD.hcalDetIdTable_cff import * + +nanoMetadata = cms.EDProducer("UniqueStringProducer", + strings = cms.PSet( + tag = cms.string("untagged"), + ) +) + +hcalNanoTask = cms.Task( + nanoMetadata, + hcalDetIdTableTask, + hcalDigiSortedTableTask, + hcalRecHitTableTask, +) + +hcalNanoDigiTask = cms.Task( + nanoMetadata, + hcalDetIdTableTask, + hcalDigiSortedTableTask, +) + +hcalNanoRecHitTask = cms.Task( + nanoMetadata, + hcalDetIdTableTask, + hcalRecHitTableTask, +) + +# Tasks for HCAL AlCa workflows +hcalNanoPhiSymTask = cms.Task( + nanoMetadata, + hcalDetIdTableTask, + hbheRecHitTable, + hfRecHitTable, +) + +hcalNanoIsoTrkTask = cms.Task( + nanoMetadata, + hcalDetIdTableTask, + hbheRecHitTable, +) + +# Customization for running on testEnablesEcalHcal +# - Call from cmsDriver.py with: `--customise DPGAnalysis/HcalNanoAOD/hcalNano_cff.customiseHcalCalib` +def customiseHcalCalib(process): + # Add uMNio digi (special digi identifies calib event type) + process.load("DPGAnalysis.HcalNanoAOD.hcalUMNioTable_cff") + process.hcalNanoTask.add(process.uMNioTable) + process.hcalNanoDigiTask.add(process.uMNioTable) + + # Raw data has a different name, hltHcalCalibrationRaw instead of rawDataCollector + process.hcalDigis.InputLabel = cms.InputTag('hltHcalCalibrationRaw') + + # Create EDFilter for HLT_HcalCalibration + # (HCAL raw data is not present in ECAL-triggered events, annoyingly. The filter stops downstream modules from throwing ProductNotFound.) + process.hcalCalibHLTFilter = cms.EDFilter("TriggerResultsFilter", + triggerConditions = cms.vstring( + 'HLT_HcalCalibration_v5 / 1'), + hltResults = cms.InputTag( "TriggerResults", "", "HLT" ), + l1tResults = cms.InputTag( "" ), + l1tIgnoreMask = cms.bool( False ), + l1techIgnorePrescales = cms.bool( False ), + daqPartitions = cms.uint32( 1 ), + throw = cms.bool( True ) + ) + + # Remove hcalDigis from normal raw2digi task, and put on a sequence after the HLT filter + process.RawToDigiTask.remove(process.hcalDigis) + process.hcalCalibDigiSequence = cms.Sequence(process.hcalCalibHLTFilter + process.hcalDigis) + process.raw2digi_step = cms.Path(process.hcalCalibDigiSequence, process.RawToDigiTask) + + # Insert the HLT filter at start of user path and nanoaod endpath + process.user_step.insert(0, process.hcalCalibHLTFilter) + process.NANOAODoutput_step.insert(0, process.hcalCalibHLTFilter) + + return process + +# Customization for running on HCAL local run data +# - Call from cmsDriver.py with: `--customise DPGAnalysis/HcalNanoAOD/customise_hcalLocal_cff.customiseHcalLocal` +def customiseHcalLocal(process): + input_files = process.source.fileNames + max_events = process.maxEvents.input + process.source = cms.Source("HcalTBSource", + fileNames = input_files, + maxEvents = max_events, + firstLuminosityBlockForEachRun = cms.untracked.VLuminosityBlockID([]), + ) + process.hcalDigis.InputLabel = cms.InputTag('source') + + # Uncomment if ZDC digis (QIE10, nTS=10) are causing problems + #process.hcalDigis.saveQIE10DataNSamples = cms.untracked.vint32(10) + #process.hcalDigis.saveQIE10DataTags = cms.untracked.vstring("ZDC") + + if hasattr(process, "hcalDigiSortedTableTask"): + process.hcalDigiSortedTable.nTS_HB = cms.untracked.uint32(8) + process.hcalDigiSortedTable.nTS_HE = cms.untracked.uint32(8) + process.hcalDigiSortedTable.nTS_HF = cms.untracked.uint32(6) + process.hcalDigiSortedTable.nTS_HO = cms.untracked.uint32(10) + + process.load("DPGAnalysis.HcalNanoAOD.hcalUMNioTable_cff") + if hasattr(process, "hcalNanoTask"): + process.hcalNanoTask.add(process.uMNioTable) + if hasattr(process, "hcalNanoDigiTask"): + process.hcalNanoDigiTask.add(process.uMNioTable) + + return process diff --git a/DPGAnalysis/HcalNanoAOD/python/hcalRecHitTable_cff.py b/DPGAnalysis/HcalNanoAOD/python/hcalRecHitTable_cff.py new file mode 100644 index 0000000000000..5478e4c8261c6 --- /dev/null +++ b/DPGAnalysis/HcalNanoAOD/python/hcalRecHitTable_cff.py @@ -0,0 +1,65 @@ +import FWCore.ParameterSet.Config as cms +from PhysicsTools.NanoAOD.common_cff import Var,P3Vars + +hbheRecHitTable = cms.EDProducer("HBHERecHitFlatTableProducer", + src = cms.InputTag("hbhereco"), + cut = cms.string(""), + name = cms.string("RecHitHBHE"), + doc = cms.string("HCAL barrel and endcap rec hits"), + singleton = cms.bool(False), # the number of entries is variable + extension = cms.bool(False), # this is the main table for the object + variables = cms.PSet( + detId = Var('detid().rawId()', 'int', precision=-1, doc='detId'), + energy = Var('energy', 'float', precision=14, doc='energy'), + time = Var('time', 'float', precision=14, doc='hit time'), + ieta = Var('id().ieta()', 'int', precision=-1, doc='ieta'), + iphi = Var('id().iphi()', 'int', precision=-1, doc='iphi'), + depth = Var('id().depth()', 'int', precision=-1, doc='depth') + ) +) + +hfRecHitTable = cms.EDProducer("HFRecHitFlatTableProducer", + src = cms.InputTag("hfreco"), + cut = cms.string(""), + name = cms.string("RecHitHF"), + doc = cms.string("HCAL forward (HF) rec hits"), + singleton = cms.bool(False), # the number of entries is variable + extension = cms.bool(False), # this is the main table for the object + variables = cms.PSet( + detId = Var('detid().rawId()', 'int', precision=-1, doc='detId'), + energy = Var('energy', 'float', precision=14, doc='energy'), + time = Var('time', 'float', precision=14, doc='hit time'), + ieta = Var('id().ieta()', 'int', precision=-1, doc='ieta'), + iphi = Var('id().iphi()', 'int', precision=-1, doc='iphi'), + depth = Var('id().depth()', 'int', precision=-1, doc='depth') + ) +) + +hoRecHitTable = cms.EDProducer("HORecHitFlatTableProducer", + src = cms.InputTag("horeco"), + cut = cms.string(""), + name = cms.string("RecHitHO"), + doc = cms.string("HCAL outer (HO) rec hits"), + singleton = cms.bool(False), # the number of entries is variable + extension = cms.bool(False), # this is the main table for the object + variables = cms.PSet( + detId = Var('detid().rawId()', 'int', precision=-1, doc='detId'), + energy = Var('energy', 'float', precision=14, doc='energy'), + time = Var('time', 'float', precision=14, doc='hit time'), + ieta = Var('id().ieta()', 'int', precision=-1, doc='ieta'), + iphi = Var('id().iphi()', 'int', precision=-1, doc='iphi'), + depth = Var('id().depth()', 'int', precision=-1, doc='depth') + ) +) + +hcalRecHitTableSeq = cms.Sequence( + hbheRecHitTable + + hfRecHitTable + + hoRecHitTable +) + +hcalRecHitTableTask = cms.Task( + hbheRecHitTable, + hfRecHitTable, + hoRecHitTable, +) diff --git a/DPGAnalysis/HcalNanoAOD/python/hcalUMNioTable_cff.py b/DPGAnalysis/HcalNanoAOD/python/hcalUMNioTable_cff.py new file mode 100644 index 0000000000000..96a050999cec3 --- /dev/null +++ b/DPGAnalysis/HcalNanoAOD/python/hcalUMNioTable_cff.py @@ -0,0 +1,10 @@ +import FWCore.ParameterSet.Config as cms +from PhysicsTools.NanoAOD.common_cff import * + +# IMPORTANT: This variable has to end in "Table"! +uMNioTable= cms.EDProducer("HcalUMNioTableProducer", + tagUMNio = cms.untracked.InputTag("hcalDigis"), +) + +uMNioTableTask = cms.Task(uMNioTable) +uMNioTableSeq = cms.Sequence(uMNioTable) \ No newline at end of file diff --git a/DPGAnalysis/HcalNanoAOD/src/HFPreRecHitSortedTable.cc b/DPGAnalysis/HcalNanoAOD/src/HFPreRecHitSortedTable.cc new file mode 100644 index 0000000000000..cacc827e9fc6e --- /dev/null +++ b/DPGAnalysis/HcalNanoAOD/src/HFPreRecHitSortedTable.cc @@ -0,0 +1,28 @@ +#include "DPGAnalysis/HcalNanoAOD/interface/HFPreRecHitSortedTable.h" + +HFPreRecHitSortedTable::HFPreRecHitSortedTable(const std::vector& dids) { + dids_ = dids; + for (std::vector::const_iterator it_did = dids_.begin(); it_did != dids_.end(); ++it_did) { + did_indexmap_[*it_did] = (unsigned int)(it_did - dids_.begin()); + } + + charges_.resize(dids_.size()); + chargeAsymmetries_.resize(dids_.size()); + valids_.resize(dids_.size()); +} + +void HFPreRecHitSortedTable::add(const HFPreRecHitCollection::const_iterator itPreRecHit) { + HcalDetId did = itPreRecHit->id(); + unsigned int index = did_indexmap_.at(did); + + charges_[index] = itPreRecHit->charge(); + chargeAsymmetries_[index] = + itPreRecHit->chargeAsymmetry(0.).first; // chargeAsymmetry() returns std::pair + valids_[index] = true; +} + +void HFPreRecHitSortedTable::reset() { + std::fill(charges_.begin(), charges_.end(), 0); + std::fill(chargeAsymmetries_.begin(), chargeAsymmetries_.end(), 0); + std::fill(valids_.begin(), valids_.end(), false); +} diff --git a/DPGAnalysis/HcalNanoAOD/src/HODigiSortedTable.cc b/DPGAnalysis/HcalNanoAOD/src/HODigiSortedTable.cc new file mode 100644 index 0000000000000..7e44641b7e032 --- /dev/null +++ b/DPGAnalysis/HcalNanoAOD/src/HODigiSortedTable.cc @@ -0,0 +1,78 @@ +#include "DPGAnalysis/HcalNanoAOD/interface/HODigiSortedTable.h" + +HODigiSortedTable::HODigiSortedTable(const std::vector& dids, const unsigned int nTS) { + dids_ = dids; + for (std::vector::const_iterator it_did = dids_.begin(); it_did != dids_.end(); ++it_did) { + did_indexmap_[*it_did] = (unsigned int)(it_did - dids_.begin()); + } + + nTS_ = nTS; + + ietas_.resize(dids_.size()); + iphis_.resize(dids_.size()); + subdets_.resize(dids_.size()); + depths_.resize(dids_.size()); + rawIds_.resize(dids_.size()); + fiberIdleOffsets_.resize(dids_.size()); + sois_.resize(dids_.size()); + valids_.resize(dids_.size()); + + adcs_.resize(nTS_, std::vector(dids_.size())); + fcs_.resize(nTS_, std::vector(dids_.size())); + pedestalfcs_.resize(nTS_, std::vector(dids_.size())); + capids_.resize(nTS_, std::vector(dids_.size())); + fibers_.resize(nTS_, std::vector(dids_.size())); + fiberChans_.resize(nTS_, std::vector(dids_.size())); + dvs_.resize(nTS_, std::vector(dids_.size())); + ers_.resize(nTS_, std::vector(dids_.size())); +} + +void HODigiSortedTable::add(const HODataFrame* digi, const edm::ESHandle& dbService) { + HcalDetId did = digi->id(); + unsigned int index = did_indexmap_.at(did); + + CaloSamples digiCaloSamples = hcaldqm::utilities::loadADC2fCDB(dbService, did, *digi); + HcalCalibrations calibrations = dbService->getHcalCalibrations(did); + + ietas_[index] = did.ieta(); + iphis_[index] = did.iphi(); + subdets_[index] = did.subdet(); + depths_[index] = did.depth(); + rawIds_[index] = did.rawId(); + fiberIdleOffsets_[index] = digi->fiberIdleOffset(); + sois_[index] = digi->presamples(); + + for (unsigned int iTS = 0; iTS < (unsigned int)digi->size(); ++iTS) { + adcs_[iTS][index] = digi->sample(iTS).adc(); + capids_[iTS][index] = digi->sample(iTS).capid(); + fcs_[iTS][index] = digiCaloSamples[iTS]; + pedestalfcs_[iTS][index] = calibrations.pedestal(digi->sample(iTS).capid()); + dvs_[iTS][index] = digi->sample(iTS).dv(); + ers_[iTS][index] = digi->sample(iTS).er(); + } + valids_[index] = true; +} + +void HODigiSortedTable::reset() { + std::fill(ietas_.begin(), ietas_.end(), 0); + std::fill(iphis_.begin(), iphis_.end(), -100); + std::fill(subdets_.begin(), subdets_.end(), -1); + std::fill(depths_.begin(), depths_.end(), 0); + std::fill(rawIds_.begin(), rawIds_.end(), 0); + std::fill(fiberIdleOffsets_.begin(), fiberIdleOffsets_.end(), 0); + std::fill(sois_.begin(), sois_.end(), -1); + std::fill(valids_.begin(), valids_.end(), false); + + for (unsigned int i = 0; i < nTS_; ++i) { + for (unsigned int j = 0; j < dids_.size(); ++j) { + adcs_[i][j] = 0; + fcs_[i][j] = 0; + pedestalfcs_[i][j] = 0; + capids_[i][j] = 0; + fibers_[i][j] = 0; + fiberChans_[i][j] = 0; + dvs_[i][j] = 0; + ers_[i][j] = 0; + } + } +} diff --git a/DPGAnalysis/HcalNanoAOD/src/QIE10DigiSortedTable.cc b/DPGAnalysis/HcalNanoAOD/src/QIE10DigiSortedTable.cc new file mode 100644 index 0000000000000..d8f173eef1803 --- /dev/null +++ b/DPGAnalysis/HcalNanoAOD/src/QIE10DigiSortedTable.cc @@ -0,0 +1,82 @@ +#include "DPGAnalysis/HcalNanoAOD/interface/QIE10DigiSortedTable.h" + +QIE10DigiSortedTable::QIE10DigiSortedTable(const std::vector& dids, const unsigned int nTS) { + dids_ = dids; + for (std::vector::const_iterator it_did = dids_.begin(); it_did != dids_.end(); ++it_did) { + did_indexmap_[*it_did] = (unsigned int)(it_did - dids_.begin()); + } + + nTS_ = nTS; + ietas_.resize(dids_.size()); + iphis_.resize(dids_.size()); + subdets_.resize(dids_.size()); + depths_.resize(dids_.size()); + rawIds_.resize(dids_.size()); + linkErrors_.resize(dids_.size()); + flags_.resize(dids_.size()); + sois_.resize(dids_.size()); + valids_.resize(dids_.size()); + //sipmTypes_.resize(dids_.size()); + + adcs_.resize(nTS_, std::vector(dids_.size())); + fcs_.resize(nTS_, std::vector(dids_.size())); + pedestalfcs_.resize(nTS_, std::vector(dids_.size())); + tdcs_.resize(nTS_, std::vector(dids_.size())); + capids_.resize(nTS_, std::vector(dids_.size())); + oks_.resize(nTS_, std::vector(dids_.size())); +} + +void QIE10DigiSortedTable::add(const QIE10DataFrame* digi, const edm::ESHandle& dbService) { + HcalDetId did = digi->detid(); + unsigned int index = did_indexmap_.at(did); + + CaloSamples digiCaloSamples = hcaldqm::utilities::loadADC2fCDB(dbService, did, *digi); + HcalCalibrations calibrations = dbService->getHcalCalibrations(did); + + ietas_[index] = did.ieta(); + iphis_[index] = did.iphi(); + subdets_[index] = did.subdet(); + depths_[index] = did.depth(); + rawIds_[index] = did.rawId(); + linkErrors_[index] = digi->linkError(); + flags_[index] = digi->flags(); + //sipmTypes_[index] = (uint8_t)dbService->getHcalSiPMParameter(did)->getType(); + + for (unsigned int iTS = 0; iTS < (unsigned int)digi->samples(); ++iTS) { + if ((*digi)[iTS].soi()) { + sois_[index] = iTS; + } + oks_[iTS][index] = (*digi)[iTS].ok(); + adcs_[iTS][index] = (*digi)[iTS].adc(); + tdcs_[iTS][index] = (*digi)[iTS].le_tdc(); + //tetdcs_[iTS][index] = (*digi)[iTS].te_tdc(); + capids_[iTS][index] = (*digi)[iTS].capid(); + fcs_[iTS][index] = digiCaloSamples[iTS]; + pedestalfcs_[iTS][index] = calibrations.pedestal((*digi)[iTS].capid()); + } + valids_[index] = true; +} + +void QIE10DigiSortedTable::reset() { + std::fill(ietas_.begin(), ietas_.end(), 0); + std::fill(iphis_.begin(), iphis_.end(), 0); + std::fill(subdets_.begin(), subdets_.end(), 0); + std::fill(depths_.begin(), depths_.end(), 0); + std::fill(rawIds_.begin(), rawIds_.end(), 0); + std::fill(linkErrors_.begin(), linkErrors_.end(), 0); + std::fill(flags_.begin(), flags_.end(), 0); + std::fill(sois_.begin(), sois_.end(), -1); + std::fill(valids_.begin(), valids_.end(), false); + //std::fill(sipmTypes_.begin(), sipmTypes_.end(), 0); + + for (unsigned int i = 0; i < nTS_; ++i) { + for (unsigned int j = 0; j < dids_.size(); ++j) { + adcs_[i][j] = 0; + fcs_[i][j] = 0.; + pedestalfcs_[i][j] = 0.; + tdcs_[i][j] = 0; + capids_[i][j] = 0; + oks_[i][j] = false; + } + } +} diff --git a/DPGAnalysis/HcalNanoAOD/src/QIE11DigiSortedTable.cc b/DPGAnalysis/HcalNanoAOD/src/QIE11DigiSortedTable.cc new file mode 100644 index 0000000000000..45c01811a9491 --- /dev/null +++ b/DPGAnalysis/HcalNanoAOD/src/QIE11DigiSortedTable.cc @@ -0,0 +1,87 @@ +#include "DPGAnalysis/HcalNanoAOD/interface/QIE11DigiSortedTable.h" + +QIE11DigiSortedTable::QIE11DigiSortedTable(const std::vector& dids, const unsigned int nTS) { + dids_ = dids; + for (std::vector::const_iterator it_did = dids_.begin(); it_did != dids_.end(); ++it_did) { + did_indexmap_[*it_did] = (unsigned int)(it_did - dids_.begin()); + } + + nTS_ = nTS; + ietas_.resize(dids_.size()); + iphis_.resize(dids_.size()); + subdets_.resize(dids_.size()); + depths_.resize(dids_.size()); + rawIds_.resize(dids_.size()); + linkErrors_.resize(dids_.size()); + capidErrors_.resize(dids_.size()); + flags_.resize(dids_.size()); + sois_.resize(dids_.size()); + valids_.resize(dids_.size()); + sipmTypes_.resize(dids_.size()); + + adcs_.resize(nTS_, std::vector(dids_.size())); + fcs_.resize(nTS_, std::vector(dids_.size())); + pedestalfcs_.resize(nTS_, std::vector(dids_.size())); + tdcs_.resize(nTS_, std::vector(dids_.size())); + capids_.resize(nTS_, std::vector(dids_.size())); +} + +void QIE11DigiSortedTable::add(const QIE11DataFrame* digi, const edm::ESHandle& dbService) { + HcalDetId did = digi->detid(); + unsigned int index = did_indexmap_.at(did); + + CaloSamples digiCaloSamples = hcaldqm::utilities::loadADC2fCDB(dbService, did, *digi); + HcalCalibrations calibrations = dbService->getHcalCalibrations(did); + + ietas_[index] = did.ieta(); + iphis_[index] = did.iphi(); + subdets_[index] = did.subdet(); + depths_[index] = did.depth(); + rawIds_[index] = did.rawId(); + linkErrors_[index] = digi->linkError(); + capidErrors_[index] = digi->capidError(); + flags_[index] = digi->flags(); + sipmTypes_[index] = (uint8_t)dbService->getHcalSiPMParameter(did)->getType(); + + for (unsigned int iTS = 0; iTS < (unsigned int)digi->samples(); ++iTS) { + if ((*digi)[iTS].soi()) { + sois_[index] = iTS; + } + adcs_[iTS][index] = (*digi)[iTS].adc(); + tdcs_[iTS][index] = (*digi)[iTS].tdc(); + capids_[iTS][index] = (*digi)[iTS].capid(); + fcs_[iTS][index] = digiCaloSamples[iTS]; + pedestalfcs_[iTS][index] = calibrations.pedestal((*digi)[iTS].capid()); + } + valids_[index] = true; +} + +void QIE11DigiSortedTable::reset() { + std::fill(ietas_.begin(), ietas_.end(), 0); + std::fill(iphis_.begin(), iphis_.end(), 0); + std::fill(subdets_.begin(), subdets_.end(), 0); + std::fill(depths_.begin(), depths_.end(), 0); + std::fill(rawIds_.begin(), rawIds_.end(), 0); + std::fill(linkErrors_.begin(), linkErrors_.end(), false); + std::fill(capidErrors_.begin(), capidErrors_.end(), false); + std::fill(flags_.begin(), flags_.end(), 0); + std::fill(sois_.begin(), sois_.end(), 0); + std::fill(valids_.begin(), valids_.end(), false); + std::fill(sipmTypes_.begin(), sipmTypes_.end(), 0); + + for (auto& it : adcs_) { + std::fill(it.begin(), it.end(), 0); + } + for (auto& it : fcs_) { + std::fill(it.begin(), it.end(), 0); + } + for (auto& it : pedestalfcs_) { + std::fill(it.begin(), it.end(), 0); + } + for (auto& it : tdcs_) { + std::fill(it.begin(), it.end(), 0); + } + for (auto& it : capids_) { + std::fill(it.begin(), it.end(), 0); + } +} diff --git a/DPGAnalysis/HcalNanoAOD/src/classes.h b/DPGAnalysis/HcalNanoAOD/src/classes.h new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/DPGAnalysis/HcalNanoAOD/src/classes_def.xml b/DPGAnalysis/HcalNanoAOD/src/classes_def.xml new file mode 100644 index 0000000000000..b7b5d8f526fcf --- /dev/null +++ b/DPGAnalysis/HcalNanoAOD/src/classes_def.xml @@ -0,0 +1,3 @@ + + + diff --git a/DPGAnalysis/HcalNanoAOD/test/testhcalnano_cfg.py b/DPGAnalysis/HcalNanoAOD/test/testhcalnano_cfg.py new file mode 100644 index 0000000000000..727f0954a0cf7 --- /dev/null +++ b/DPGAnalysis/HcalNanoAOD/test/testhcalnano_cfg.py @@ -0,0 +1,159 @@ +#------------------------------------------------------------------------------------ +# Imports +#------------------------------------------------------------------------------------ +import FWCore.ParameterSet.Config as cms +import FWCore.ParameterSet.VarParsing as VarParsing +from Configuration.StandardSequences.Eras import eras + +#------------------------------------------------------------------------------------ +# Options +#------------------------------------------------------------------------------------ +options = VarParsing.VarParsing() + +options.register('skipEvents', + 0, # default value + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.int, + "Number of events to skip") + +options.register('processEvents', + -1, # default value + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.int, + "Number of events to process") + +options.register('inputFiles', + "file:inputFile.root", + VarParsing.VarParsing.multiplicity.list, + VarParsing.VarParsing.varType.string, + "Input files") + +options.register('outputFile', + "file:hcalnano.root", # default value + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.string, + "Output file") + +options.register('nThreads', + 4, + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.int) + +options.register('compressionAlgorithm', + "ZLIB", + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.string) + +options.register('compressionLevel', + 5, + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.int) + +options.register('reportEvery', + 100, + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.int) + +options.parseArguments() + +print(" ") +print("Using options:") +print(" skipEvents =", options.skipEvents) +print(" processEvents =", options.processEvents) +print(" inputFiles =", options.inputFiles) +print(" outputFile =", options.outputFile) +print(" nThreads. =", options.nThreads) +print(" ") + +#------------------------------------------------------------------------------------ +# Declare the process and input variables +#------------------------------------------------------------------------------------ +process = cms.Process('HCALNANO', eras.Run3) + +#------------------------------------------------------------------------------------ +# Get and parse the command line arguments +#------------------------------------------------------------------------------------ +process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(options.processEvents) ) + +process.source = cms.Source( + "PoolSource", + fileNames = cms.untracked.vstring(options.inputFiles), + skipEvents = cms.untracked.uint32(options.skipEvents) + ) + +process.TFileService = cms.Service( + "TFileService", + fileName = cms.string(options.outputFile) + ) +process.options.numberOfThreads=cms.untracked.uint32(options.nThreads) +process.options.numberOfStreams=cms.untracked.uint32(0) +#------------------------------------------------------------------------------------ +# import of standard configurations +#------------------------------------------------------------------------------------ + +# Reduce message log output +process.load('FWCore.MessageService.MessageLogger_cfi') +process.MessageLogger.cerr.FwkReport.reportEvery = cms.untracked.int32(options.reportEvery) + +process.load('Configuration.StandardSequences.GeometryRecoDB_cff') +process.load('Configuration.StandardSequences.RawToDigi_Data_cff') +process.load('Configuration.StandardSequences.L1Reco_cff') +process.load('Configuration.StandardSequences.Reconstruction_Data_cff') + +#------------------------------------------------------------------------------------ +# Specify Global Tag +#------------------------------------------------------------------------------------ +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') +process.GlobalTag.globaltag = '122X_dataRun3_HLT_v3' +print("GlobalTag = ", str(process.GlobalTag.globaltag).split("'")[1]) +print(" ") + +#------------------------------------------------------------------------------------ +# HcalNano sequence definition +#------------------------------------------------------------------------------------ +#from PhysicsTools.NanoAOD.common_cff import * +process.load("PhysicsTools.NanoAOD.nano_cff") +process.load("RecoLocalCalo/Configuration/hcalLocalReco_cff") +process.load("RecoLocalCalo/Configuration/hcalGlobalReco_cff") +process.load("DPGAnalysis.HcalNanoAOD.hcalRecHitTable_cff") +process.load("DPGAnalysis.HcalNanoAOD.hcalDetIdTable_cff") +process.load("DPGAnalysis.HcalNanoAOD.hcalDigiSortedTable_cff") + +# This creates a sorted list of HcalDetIds for use by downstream HcalNano table producers +process.hcalNanoPrep = cms.Sequence(process.hcalDetIdTable) + +process.hcalNanoTask = cms.Task( + process.hcalDigis, + + ## Do energy reconstruction + process.hcalLocalRecoTask, + process.hcalGlobalRecoTask, + + # Make digi tables + process.hcalDigiSortedTable, + + # Make RecHit tables + process.hbheRecHitTable, + process.hfRecHitTable, + process.hoRecHitTable, +) + +process.preparation = cms.Path(process.hcalNanoPrep, process.hcalNanoTask) + +process.NanoAODEDMEventContent.outputCommands = cms.untracked.vstring( + 'drop *', + "keep nanoaodFlatTable_*Table_*_*", # event data + "keep edmTriggerResults_*_*_*", # event data + "keep String_*_genModel_*", # generator model data + "keep nanoaodMergeableCounterTable_*Table_*_*", # accumulated per/run or per/lumi data + "keep nanoaodUniqueString_nanoMetadata_*_*", # basic metadata + ) + +process.out = cms.OutputModule("NanoAODOutputModule", + fileName = cms.untracked.string(options.outputFile), + outputCommands = process.NanoAODEDMEventContent.outputCommands, + compressionLevel = cms.untracked.int32(options.compressionLevel), + compressionAlgorithm = cms.untracked.string(options.compressionAlgorithm), + +) +process.end = cms.EndPath(process.out) diff --git a/DataFormats/HcalDetId/src/classes.h b/DataFormats/HcalDetId/src/classes.h index 39f2652a45975..a546bc95d4b87 100644 --- a/DataFormats/HcalDetId/src/classes.h +++ b/DataFormats/HcalDetId/src/classes.h @@ -9,4 +9,5 @@ #include "DataFormats/HcalDetId/interface/HcalDcsDetId.h" #include "DataFormats/HcalDetId/interface/HcalCastorDetId.h" #include "DataFormats/HcalDetId/interface/CastorElectronicsId.h" +#include "DataFormats/Common/interface/Wrapper.h" #include diff --git a/DataFormats/HcalDetId/src/classes_def.xml b/DataFormats/HcalDetId/src/classes_def.xml index 7931ead9cc912..2d3c956aa7305 100644 --- a/DataFormats/HcalDetId/src/classes_def.xml +++ b/DataFormats/HcalDetId/src/classes_def.xml @@ -45,6 +45,8 @@ + +