File indexing completed on 2024-04-06 12:14:14
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #include <memory>
0020
0021
0022 #include <FWCore/Framework/interface/ModuleFactory.h>
0023 #include "FWCore/Framework/interface/ESProducer.h"
0024
0025 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0026 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0027 #include "FWCore/Utilities/interface/ESGetToken.h"
0028
0029 #include "Geometry/CaloTopology/interface/HGCalTopology.h"
0030 #include "Geometry/CaloTopology/interface/CaloSubdetectorTopology.h"
0031 #include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h"
0032 #include "Geometry/Records/interface/IdealGeometryRecord.h"
0033 #include "Geometry/CaloTopology/interface/CaloSubdetectorTopology.h"
0034 #include "DataFormats/ForwardDetId/interface/ForwardSubdetector.h"
0035
0036
0037
0038
0039
0040
0041
0042 class HGCalTopologyBuilder : public edm::ESProducer {
0043 public:
0044 HGCalTopologyBuilder(const edm::ParameterSet& iP);
0045 ~HGCalTopologyBuilder() override;
0046
0047 using ReturnType = std::unique_ptr<HGCalTopology>;
0048
0049 ReturnType produce(const IdealGeometryRecord&);
0050
0051 private:
0052
0053 edm::ESGetToken<HGCalDDDConstants, IdealGeometryRecord> hgcToken_;
0054 int det_;
0055 };
0056
0057 HGCalTopologyBuilder::HGCalTopologyBuilder(const edm::ParameterSet& iConfig) {
0058 auto name = iConfig.getParameter<std::string>("Name");
0059 det_ = iConfig.getParameter<int>("Type");
0060 #ifdef EDM_ML_DEBUG
0061 edm::LogVerbatim("HGCalGeom") << "constructing HGCalTopology for " << name << " and det " << det_;
0062 #endif
0063 hgcToken_ = setWhatProduced(this, name).consumes<HGCalDDDConstants>(edm::ESInputTag{"", name});
0064 }
0065
0066 HGCalTopologyBuilder::~HGCalTopologyBuilder() {}
0067
0068
0069
0070
0071
0072
0073 HGCalTopologyBuilder::ReturnType HGCalTopologyBuilder::produce(const IdealGeometryRecord& iRecord) {
0074 const HGCalDDDConstants& hgdc = iRecord.get(hgcToken_);
0075
0076 #ifdef EDM_ML_DEBUG
0077 edm::LogVerbatim("HGCalGeom") << "Create HGCalTopology(hgdc,det)";
0078 #endif
0079 return std::make_unique<HGCalTopology>(hgdc, det_);
0080 }
0081
0082 DEFINE_FWK_EVENTSETUP_MODULE(HGCalTopologyBuilder);