CMS 3D CMS Logo

DTCCablingMapTestProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: CondTools/SiPhase2Tracker
4 // Class: DTCCablingMapTestProducer
5 //
13 //
14 // Original Author: Luigi Calligaris, SPRACE, São Paulo, BR
15 // Created : Wed, 27 Feb 2019 21:41:13 GMT
16 //
17 //
18 
19 #include <memory>
20 
21 #include <unordered_map>
22 #include <utility>
23 
30 
32 
37 
39 public:
41  ~DTCCablingMapTestProducer() override;
42 
43  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
44 
45 private:
46  void beginJob() override;
47  void analyze(const edm::Event&, const edm::EventSetup&) override;
48  void endJob() override;
49 
50 private:
52  std::unique_ptr<TrackerDetToDTCELinkCablingMap> pCablingMap_;
54 };
55 
58  desc.setComment("Stores a dummy TrackerDetToDTCELinkCablingMap database object from a CSV file.");
59  desc.add<long long unsigned int>("iovBeginTime", 1);
60  desc.add<std::string>("record", "TrackerDetToDTCELinkCablingMap");
61  descriptions.add("DTCCablingMapTestProducer", desc);
62 }
63 
65  : iovBeginTime_(iConfig.getParameter<long long unsigned int>("iovBeginTime")),
66  pCablingMap_(std::make_unique<TrackerDetToDTCELinkCablingMap>()),
67  recordName_(iConfig.getParameter<std::string>("record")) {}
68 
70  using namespace edm;
71  using namespace std;
72 
73  pCablingMap_->insert(DTCELinkId(101u, 1u, 2u), 11111111);
74  pCablingMap_->insert(DTCELinkId(102u, 2u, 2u), 22222222);
75  pCablingMap_->insert(DTCELinkId(103u, 3u, 3u), 33333333);
76  pCablingMap_->insert(DTCELinkId(104u, 4u, 4u), 44444444);
77 
79 
80  if (poolDbService.isAvailable())
81  poolDbService->writeOne(pCablingMap_.release(), iovBeginTime_, recordName_);
82  else
83  throw std::runtime_error("PoolDBService required.");
84 }
85 
87 
89 
91 
92 //define this as a plug-in
TrackerDetToDTCELinkCablingMap
Definition: TrackerDetToDTCELinkCablingMap.h:29
EDAnalyzer.h
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
DTCCablingMapTestProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: DTCCablingMapTestProducer.cc:56
DTCELinkId
Definition: DTCELinkId.h:28
edm
HLT enums.
Definition: AlignableModifier.h:19
Time.h
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::one::EDAnalyzer
Definition: EDAnalyzer.h:30
DTCCablingMapTestProducer::~DTCCablingMapTestProducer
~DTCCablingMapTestProducer() override
Definition: DTCCablingMapTestProducer.cc:90
TrackerDetToDTCELinkCablingMap.h
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
DTCCablingMapTestProducer::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: DTCCablingMapTestProducer.cc:86
DTCCablingMapTestProducer::beginJob
void beginJob() override
Definition: DTCCablingMapTestProducer.cc:69
MakerMacros.h
PoolDBOutputService.h
DTCCablingMapTestProducer::recordName_
std::string recordName_
Definition: DTCCablingMapTestProducer.cc:53
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
Service.h
DTCCablingMapTestProducer::pCablingMap_
std::unique_ptr< TrackerDetToDTCELinkCablingMap > pCablingMap_
Definition: DTCCablingMapTestProducer.cc:52
DTCCablingMapTestProducer::DTCCablingMapTestProducer
DTCCablingMapTestProducer(const edm::ParameterSet &)
Definition: DTCCablingMapTestProducer.cc:64
DTCCablingMapTestProducer::endJob
void endJob() override
Definition: DTCCablingMapTestProducer.cc:88
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:36
edm::ParameterSetDescription::setComment
void setComment(std::string const &value)
Definition: ParameterSetDescription.cc:33
Event.h
DTCCablingMapTestProducer
Definition: DTCCablingMapTestProducer.cc:38
cond::Time_t
unsigned long long Time_t
Definition: Time.h:14
edm::Service< cond::service::PoolDBOutputService >
createfilelist.int
int
Definition: createfilelist.py:10
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:57
std
Definition: JetResolutionObject.h:76
Frameworkfwd.h
TrackerDetToDTCELinkCablingMapRcd.h
cond::service::PoolDBOutputService::writeOne
Hash writeOne(const T *payload, Time_t time, const std::string &recordName)
Definition: PoolDBOutputService.h:57
DTCELinkId.h
ParameterSet.h
edm::Event
Definition: Event.h:73
DTCCablingMapTestProducer::iovBeginTime_
cond::Time_t iovBeginTime_
Definition: DTCCablingMapTestProducer.cc:51