diff --git a/RecoMTD/DetLayers/src/BTLDetLayerGeometryBuilder.cc b/RecoMTD/DetLayers/plugins/BTLDetLayerGeometryBuilder.cc similarity index 97% rename from RecoMTD/DetLayers/src/BTLDetLayerGeometryBuilder.cc rename to RecoMTD/DetLayers/plugins/BTLDetLayerGeometryBuilder.cc index 97a0261ed80ca..05011f425f45a 100644 --- a/RecoMTD/DetLayers/src/BTLDetLayerGeometryBuilder.cc +++ b/RecoMTD/DetLayers/plugins/BTLDetLayerGeometryBuilder.cc @@ -1,4 +1,4 @@ -#include +#include "BTLDetLayerGeometryBuilder.h" #include #include diff --git a/RecoMTD/DetLayers/src/BTLDetLayerGeometryBuilder.h b/RecoMTD/DetLayers/plugins/BTLDetLayerGeometryBuilder.h similarity index 100% rename from RecoMTD/DetLayers/src/BTLDetLayerGeometryBuilder.h rename to RecoMTD/DetLayers/plugins/BTLDetLayerGeometryBuilder.h diff --git a/RecoMTD/DetLayers/src/ETLDetLayerGeometryBuilder.cc b/RecoMTD/DetLayers/plugins/ETLDetLayerGeometryBuilder.cc similarity index 98% rename from RecoMTD/DetLayers/src/ETLDetLayerGeometryBuilder.cc rename to RecoMTD/DetLayers/plugins/ETLDetLayerGeometryBuilder.cc index 942a5266e9e7e..90229a2f4dd5c 100644 --- a/RecoMTD/DetLayers/src/ETLDetLayerGeometryBuilder.cc +++ b/RecoMTD/DetLayers/plugins/ETLDetLayerGeometryBuilder.cc @@ -1,4 +1,4 @@ -#include +#include "ETLDetLayerGeometryBuilder.h" #include #include diff --git a/RecoMTD/DetLayers/src/ETLDetLayerGeometryBuilder.h b/RecoMTD/DetLayers/plugins/ETLDetLayerGeometryBuilder.h similarity index 100% rename from RecoMTD/DetLayers/src/ETLDetLayerGeometryBuilder.h rename to RecoMTD/DetLayers/plugins/ETLDetLayerGeometryBuilder.h diff --git a/RecoMTD/DetLayers/plugins/MTDDetLayerGeometryESProducer.cc b/RecoMTD/DetLayers/plugins/MTDDetLayerGeometryESProducer.cc index 5c004398e9a31..ee603fac1a6c1 100644 --- a/RecoMTD/DetLayers/plugins/MTDDetLayerGeometryESProducer.cc +++ b/RecoMTD/DetLayers/plugins/MTDDetLayerGeometryESProducer.cc @@ -1,44 +1,60 @@ /** \file + * + * ESProducer for MTDDetLayerGeometry in RecoMTD/DetLayers * * \author L. Gray - FNAL * */ -#include -#include - -#include +#include "FWCore/Framework/interface/ESProducer.h" +#include "FWCore/Framework/interface/ModuleFactory.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include -#include +#include "RecoMTD/Records/interface/MTDRecoGeometryRecord.h" +#include "Geometry/Records/interface/MTDDigiGeometryRecord.h" +#include "Geometry/MTDGeometryBuilder/interface/MTDGeometry.h" -#include -#include +#include "ETLDetLayerGeometryBuilder.h" +#include "BTLDetLayerGeometryBuilder.h" +#include "RecoMTD/DetLayers/interface/MTDDetLayerGeometry.h" -#include -#include +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include #include -using namespace edm; +class MTDDetLayerGeometryESProducer : public edm::ESProducer { +public: + /// Constructor + MTDDetLayerGeometryESProducer(const edm::ParameterSet& p); -MTDDetLayerGeometryESProducer::MTDDetLayerGeometryESProducer(const edm::ParameterSet& p) { setWhatProduced(this); } + /// Produce MuonDeLayerGeometry. + std::unique_ptr produce(const MTDRecoGeometryRecord& record); -MTDDetLayerGeometryESProducer::~MTDDetLayerGeometryESProducer() {} + static void fillDescriptions(edm::ConfigurationDescriptions&); + +private: + edm::ESGetToken geomToken_; +}; + +using namespace edm; + +MTDDetLayerGeometryESProducer::MTDDetLayerGeometryESProducer(const edm::ParameterSet& p) { + setWhatProduced(this).setConsumes(geomToken_); +} std::unique_ptr MTDDetLayerGeometryESProducer::produce(const MTDRecoGeometryRecord& record) { - const std::string metname = "MTD|RecoMTD|RecoMTDDetLayers|MTDDetLayerGeometryESProducer"; auto mtdDetLayerGeometry = std::make_unique(); - edm::ESHandle mtd; - record.getRecord().get(mtd); - if (mtd.isValid()) { + if (auto mtd = record.getHandle(geomToken_)) { // Build BTL layers mtdDetLayerGeometry->addBTLLayers(BTLDetLayerGeometryBuilder::buildLayers(*mtd)); // Build ETL layers mtdDetLayerGeometry->addETLLayers(ETLDetLayerGeometryBuilder::buildLayers(*mtd)); } else { + const std::string metname = "MTD|RecoMTD|RecoMTDDetLayers|MTDDetLayerGeometryESProducer"; LogInfo(metname) << "No MTD geometry is available."; } @@ -47,3 +63,10 @@ std::unique_ptr MTDDetLayerGeometryESProducer::produce(cons return mtdDetLayerGeometry; } + +void MTDDetLayerGeometryESProducer::fillDescriptions(edm::ConfigurationDescriptions& desc) { + edm::ParameterSetDescription ps; + desc.addDefault(ps); +} + +DEFINE_FWK_EVENTSETUP_MODULE(MTDDetLayerGeometryESProducer); diff --git a/RecoMTD/DetLayers/plugins/MTDDetLayerGeometryESProducer.h b/RecoMTD/DetLayers/plugins/MTDDetLayerGeometryESProducer.h deleted file mode 100644 index d20e2f95023c1..0000000000000 --- a/RecoMTD/DetLayers/plugins/MTDDetLayerGeometryESProducer.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef RecoMTD_DetLayers_MTDDetLayerGeometryESProducer_h -#define RecoMTD_DetLayers_MTDDetLayerGeometryESProducer_h - -/** \class MTDDetLayerGeometryESProducer - * - * ESProducer for MTDDetLayerGeometry in RecoMTD/DetLayers - * - * \author L. Gray - FNAL - */ - -#include -#include -#include -#include -#include - -class MTDDetLayerGeometryESProducer : public edm::ESProducer { -public: - /// Constructor - MTDDetLayerGeometryESProducer(const edm::ParameterSet& p); - - /// Destructor - ~MTDDetLayerGeometryESProducer() override; - - /// Produce MuonDeLayerGeometry. - std::unique_ptr produce(const MTDRecoGeometryRecord& record); - -private: -}; - -#endif diff --git a/RecoMTD/DetLayers/plugins/SealModule.cc b/RecoMTD/DetLayers/plugins/SealModule.cc deleted file mode 100644 index 980c733d7f741..0000000000000 --- a/RecoMTD/DetLayers/plugins/SealModule.cc +++ /dev/null @@ -1,6 +0,0 @@ -#include "RecoMTD/DetLayers/plugins/MTDDetLayerGeometryESProducer.h" -#include "FWCore/Framework/interface/ModuleFactory.h" - -#include "FWCore/Utilities/interface/typelookup.h" - -DEFINE_FWK_EVENTSETUP_MODULE(MTDDetLayerGeometryESProducer);