Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:30:15

0001 // -*- C++ -*-
0002 //
0003 // Package:    FastTimeNumberingInitialization
0004 // Class:      FastTimeNumberingInitialization
0005 //
0006 /**\class FastTimeNumberingInitialization FastTimeNumberingInitialization.h
0007  Geometry/HGCalCommonData/interface/FastTimeNumberingInitialization.h
0008 
0009  Description: <one line class summary>
0010 
0011  Implementation:
0012      <Notes on implementation>
0013 */
0014 //
0015 // Original Author:  Sunanda Banerjee
0016 //         Created:  Tue Mar 21 16:40:29 PDT 2013
0017 // $Id: FastTimeNumberingInitialization.cc,v 1.0 2014/04/24 12:47:41 sunanda Exp
0018 // $
0019 //
0020 //
0021 
0022 // user include files
0023 #include <FWCore/Framework/interface/ESProducer.h>
0024 #include <FWCore/Framework/interface/ModuleFactory.h>
0025 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0026 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0027 
0028 #include <DetectorDescription/Core/interface/DDFilter.h>
0029 #include <DetectorDescription/Core/interface/DDFilteredView.h>
0030 #include <DetectorDescription/Core/interface/DDsvalues.h>
0031 #include <Geometry/HGCalCommonData/interface/FastTimeDDDConstants.h>
0032 #include <Geometry/Records/interface/IdealGeometryRecord.h>
0033 #include "Geometry/HGCalCommonData/interface/FastTimeParameters.h"
0034 
0035 //#define EDM_ML_DEBUG
0036 
0037 class FastTimeNumberingInitialization : public edm::ESProducer {
0038 public:
0039   FastTimeNumberingInitialization(const edm::ParameterSet&);
0040   ~FastTimeNumberingInitialization() override;
0041 
0042   using ReturnType = std::unique_ptr<FastTimeDDDConstants>;
0043 
0044   ReturnType produce(const IdealGeometryRecord&);
0045 
0046 private:
0047   edm::ESGetToken<FastTimeParameters, IdealGeometryRecord> ftParToken_;
0048 };
0049 
0050 FastTimeNumberingInitialization::FastTimeNumberingInitialization(const edm::ParameterSet&)
0051     : ftParToken_{setWhatProduced(this).consumes<FastTimeParameters>(edm::ESInputTag{})} {
0052 #ifdef EDM_ML_DEBUG
0053   edm::LogVerbatim("HGCalGeom") << "constructing FastTimeNumberingInitialization";
0054 #endif
0055 }
0056 
0057 FastTimeNumberingInitialization::~FastTimeNumberingInitialization() {}
0058 
0059 // ------------ method called to produce the data  ------------
0060 FastTimeNumberingInitialization::ReturnType FastTimeNumberingInitialization::produce(
0061     const IdealGeometryRecord& iRecord) {
0062 #ifdef EDM_ML_DEBUG
0063   edm::LogVerbatim("HGCalGeom") << "in FastTimeNumberingInitialization::produce";
0064 #endif
0065   const auto& pFTpar = iRecord.get(ftParToken_);
0066   return std::make_unique<FastTimeDDDConstants>(&pFTpar);
0067 }
0068 
0069 // define this as a plug-in
0070 DEFINE_FWK_EVENTSETUP_MODULE(FastTimeNumberingInitialization);