Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:07:35

0001 // -*- C++ -*-
0002 //
0003 // Package:    CaloEventSetup
0004 // Class:      FastTimeTopologyBuilder
0005 //
0006 /**\class FastTimeTopologyBuilder FastTimeTopologyBuilder.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 
0025 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0026 #include "FWCore/Utilities/interface/ESGetToken.h"
0027 #include "Geometry/CaloTopology/interface/FastTimeTopology.h"
0028 #include "Geometry/CaloTopology/interface/CaloSubdetectorTopology.h"
0029 #include "Geometry/HGCalCommonData/interface/FastTimeDDDConstants.h"
0030 #include "Geometry/Records/interface/IdealGeometryRecord.h"
0031 #include "Geometry/CaloTopology/interface/CaloSubdetectorTopology.h"
0032 #include "DataFormats/ForwardDetId/interface/ForwardSubdetector.h"
0033 
0034 //#define EDM_ML_DEBUG
0035 
0036 //
0037 // class decleration
0038 //
0039 
0040 class FastTimeTopologyBuilder : public edm::ESProducer {
0041 public:
0042   FastTimeTopologyBuilder(const edm::ParameterSet& iP);
0043   ~FastTimeTopologyBuilder() override;
0044 
0045   using ReturnType = std::unique_ptr<FastTimeTopology>;
0046 
0047   ReturnType produce(const IdealGeometryRecord&);
0048 
0049 private:
0050   // ----------member data ---------------------------
0051   edm::ESGetToken<FastTimeDDDConstants, IdealGeometryRecord> ftlToken_;
0052   int type_;
0053   ForwardSubdetector subdet_;
0054 };
0055 
0056 FastTimeTopologyBuilder::FastTimeTopologyBuilder(const edm::ParameterSet& iConfig) {
0057   auto name = iConfig.getUntrackedParameter<std::string>("Name");
0058   type_ = iConfig.getUntrackedParameter<int>("Type");
0059   subdet_ = FastTime;
0060 #ifdef EDM_ML_DEBUG
0061   std::cout << "constructing FastTimeTopology for " << name << " Type " << type_ << std::endl;
0062 #endif
0063   ftlToken_ = setWhatProduced(this, name).consumes<FastTimeDDDConstants>(edm::ESInputTag{"", name});
0064 }
0065 
0066 FastTimeTopologyBuilder::~FastTimeTopologyBuilder() {}
0067 
0068 //
0069 // member functions
0070 //
0071 
0072 // ------------ method called to produce the data  ------------
0073 FastTimeTopologyBuilder::ReturnType FastTimeTopologyBuilder::produce(const IdealGeometryRecord& iRecord) {
0074   const FastTimeDDDConstants& hgdc = iRecord.get(ftlToken_);
0075 
0076 #ifdef EDM_ML_DEBUG
0077   std::cout << "Create FastTimeTopology(hgdc,subdet,type)" << std::endl;
0078 #endif
0079   return std::make_unique<FastTimeTopology>(hgdc, subdet_, type_);
0080 }
0081 
0082 DEFINE_FWK_EVENTSETUP_MODULE(FastTimeTopologyBuilder);