Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-04-04 00:15:37

0001 // -*- C++ -*-
0002 //
0003 // Package:    HGCalGeometry
0004 // Class:      FastTimeGeometryESProducer
0005 //
0006 /**\class FastTimeGeometryESProducer FastTimeGeometryESProducer.h 
0007 
0008  Description: <one line class summary>
0009 
0010  Implementation:
0011      <Notes on implementation>
0012 */
0013 //
0014 // Original Author:  Sunanda Banerjee
0015 //
0016 //
0017 
0018 // system include files
0019 #include <memory>
0020 
0021 // user include files
0022 #include "FWCore/Framework/interface/ModuleFactory.h"
0023 #include "FWCore/Framework/interface/ESProducer.h"
0024 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0025 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0026 #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
0027 #include "Geometry/CaloTopology/interface/FastTimeTopology.h"
0028 #include "Geometry/HGCalGeometry/interface/FastTimeGeometry.h"
0029 #include "Geometry/HGCalGeometry/interface/FastTimeGeometryLoader.h"
0030 #include "Geometry/Records/interface/IdealGeometryRecord.h"
0031 
0032 //#define EDM_ML_DEBUG
0033 
0034 //
0035 // class decleration
0036 //
0037 
0038 class FastTimeGeometryESProducer : public edm::ESProducer {
0039 public:
0040   FastTimeGeometryESProducer(const edm::ParameterSet& iP);
0041   ~FastTimeGeometryESProducer() override = default;
0042 
0043   using ReturnType = std::unique_ptr<FastTimeGeometry>;
0044 
0045   ReturnType produce(const IdealGeometryRecord&);
0046 
0047 private:
0048   // ----------member data ---------------------------
0049   edm::ESGetToken<FastTimeTopology, IdealGeometryRecord> topologyToken_;
0050 };
0051 
0052 FastTimeGeometryESProducer::FastTimeGeometryESProducer(const edm::ParameterSet& iConfig) {
0053   auto name = iConfig.getUntrackedParameter<std::string>("Name");
0054 #ifdef EDM_ML_DEBUG
0055   auto type = iConfig.getUntrackedParameter<int>("Type");
0056   edm::LogVerbatim("HGCalGeom") << "constructing FastTimeGeometry for " << name << " Type " << type;
0057 #endif
0058   auto cc = setWhatProduced(this, name);
0059   topologyToken_ = cc.consumes<FastTimeTopology>(edm::ESInputTag{"", name});
0060 }
0061 
0062 //
0063 // member functions
0064 //
0065 
0066 // ------------ method called to produce the data  ------------
0067 FastTimeGeometryESProducer::ReturnType FastTimeGeometryESProducer::produce(const IdealGeometryRecord& iRecord) {
0068   const auto& topo = iRecord.get(topologyToken_);
0069 
0070   FastTimeGeometryLoader builder;
0071 #ifdef EDM_ML_DEBUG
0072   edm::LogVerbatim("HGCalGeom") << "Create FastTimeGeometry (topo)";
0073 #endif
0074   return ReturnType(builder.build(topo));
0075 }
0076 
0077 DEFINE_FWK_EVENTSETUP_MODULE(FastTimeGeometryESProducer);