CondTools
Geometry
plugins
PTrackerParametersDBBuilder.cc
Go to the documentation of this file.
1
#include "
FWCore/Framework/interface/one/EDAnalyzer.h
"
2
#include "
FWCore/Framework/interface/ESTransientHandle.h
"
3
#include "
FWCore/Framework/interface/MakerMacros.h
"
4
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
5
#include "
FWCore/ServiceRegistry/interface/Service.h
"
6
#include "
CondCore/DBOutputService/interface/PoolDBOutputService.h
"
7
#include "
CondFormats/GeometryObjects/interface/PTrackerParameters.h
"
8
#include "
DetectorDescription/Core/interface/DDCompactView.h
"
9
#include "
Geometry/Records/interface/IdealGeometryRecord.h
"
10
#include "
Geometry/TrackerGeometryBuilder/interface/TrackerParametersFromDD.h
"
11
12
class
PTrackerParametersDBBuilder
:
public
edm::one::EDAnalyzer
<edm::one::WatchRuns> {
13
public
:
14
PTrackerParametersDBBuilder
(
const
edm::ParameterSet
&) {}
15
16
void
beginRun
(
edm::Run
const
&
iEvent
,
edm::EventSetup
const
&)
override
;
17
void
analyze
(
edm::Event
const
&
iEvent
,
edm::EventSetup
const
&)
override
{}
18
void
endRun
(
edm::Run
const
&
iEvent
,
edm::EventSetup
const
&)
override
{}
19
};
20
21
void
PTrackerParametersDBBuilder::beginRun
(
const
edm::Run
&,
edm::EventSetup
const
& es) {
22
PTrackerParameters
* ptp =
new
PTrackerParameters
;
23
edm::Service<cond::service::PoolDBOutputService>
mydbservice;
24
if
(!mydbservice.
isAvailable
()) {
25
edm::LogError
(
"PTrackerParametersDBBuilder"
) <<
"PoolDBOutputService unavailable"
;
26
return
;
27
}
28
edm::ESTransientHandle<DDCompactView>
cpv;
29
es.
get
<
IdealGeometryRecord
>().
get
(cpv);
30
31
TrackerParametersFromDD
builder;
32
builder.
build
(&(*cpv), *ptp);
33
34
if
(mydbservice->
isNewTagRequest
(
"PTrackerParametersRcd"
)) {
35
mydbservice->
createNewIOV
<
PTrackerParameters
>(
36
ptp, mydbservice->
beginOfTime
(), mydbservice->
endOfTime
(),
"PTrackerParametersRcd"
);
37
}
else
{
38
edm::LogError
(
"PTrackerParametersDBBuilder"
) <<
"PTrackerParameters and PTrackerParametersRcd Tag already present"
;
39
}
40
}
41
42
DEFINE_FWK_MODULE
(
PTrackerParametersDBBuilder
);
TrackerParametersFromDD.h
PTrackerParametersDBBuilder::PTrackerParametersDBBuilder
PTrackerParametersDBBuilder(const edm::ParameterSet &)
Definition:
PTrackerParametersDBBuilder.cc:14
EDAnalyzer.h
ESTransientHandle.h
MessageLogger.h
cond::service::PoolDBOutputService::beginOfTime
cond::Time_t beginOfTime() const
Definition:
PoolDBOutputService.cc:177
PTrackerParameters
Definition:
PTrackerParameters.h:6
edm::Run
Definition:
Run.h:45
PTrackerParameters.h
edm::one::EDAnalyzer
Definition:
EDAnalyzer.h:30
edm::Service::isAvailable
bool isAvailable() const
Definition:
Service.h:40
DDCompactView.h
PTrackerParametersDBBuilder::endRun
void endRun(edm::Run const &iEvent, edm::EventSetup const &) override
Definition:
PTrackerParametersDBBuilder.cc:18
MakerMacros.h
PoolDBOutputService.h
edm::EventSetup::get
T get() const
Definition:
EventSetup.h:73
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
cond::service::PoolDBOutputService::createNewIOV
void createNewIOV(const T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t, const std::string &recordName)
Definition:
PoolDBOutputService.h:107
Service.h
edm::ParameterSet
Definition:
ParameterSet.h:36
edm::LogError
Definition:
MessageLogger.h:183
edm::Service< cond::service::PoolDBOutputService >
iEvent
int iEvent
Definition:
GenABIO.cc:224
PTrackerParametersDBBuilder::analyze
void analyze(edm::Event const &iEvent, edm::EventSetup const &) override
Definition:
PTrackerParametersDBBuilder.cc:17
PTrackerParametersDBBuilder
Definition:
PTrackerParametersDBBuilder.cc:12
IdealGeometryRecord.h
edm::EventSetup
Definition:
EventSetup.h:57
get
#define get
edm::ESTransientHandle
Definition:
ESTransientHandle.h:41
cond::service::PoolDBOutputService::endOfTime
cond::Time_t endOfTime() const
Definition:
PoolDBOutputService.cc:175
TrackerParametersFromDD::build
bool build(const DDCompactView *, PTrackerParameters &)
Definition:
TrackerParametersFromDD.cc:9
cond::service::PoolDBOutputService::isNewTagRequest
bool isNewTagRequest(const std::string &recordName)
Definition:
PoolDBOutputService.cc:90
TrackerParametersFromDD
Definition:
TrackerParametersFromDD.h:14
edm::Event
Definition:
Event.h:73
IdealGeometryRecord
Definition:
IdealGeometryRecord.h:27
PTrackerParametersDBBuilder::beginRun
void beginRun(edm::Run const &iEvent, edm::EventSetup const &) override
Definition:
PTrackerParametersDBBuilder.cc:21
Generated for CMSSW Reference Manual by
1.8.16