CondTools
Geometry
plugins
CSCRecoIdealDBLoader.cc
Go to the documentation of this file.
1
#include "
FWCore/Framework/interface/one/EDAnalyzer.h
"
2
#include "
FWCore/Framework/interface/EventSetup.h
"
3
#include "
FWCore/Framework/interface/ESTransientHandle.h
"
4
#include "
FWCore/Framework/interface/ESHandle.h
"
5
#include "
FWCore/Framework/interface/MakerMacros.h
"
6
#include "
FWCore/ServiceRegistry/interface/Service.h
"
7
#include "
CondCore/DBOutputService/interface/PoolDBOutputService.h
"
8
#include "
CondFormats/GeometryObjects/interface/RecoIdealGeometry.h
"
9
#include "
CondFormats/GeometryObjects/interface/CSCRecoDigiParameters.h
"
10
#include "
Geometry/Records/interface/CSCRecoGeometryRcd.h
"
11
#include "
Geometry/Records/interface/CSCRecoDigiParametersRcd.h
"
12
#include "
Geometry/Records/interface/MuonGeometryRecord.h
"
13
#include "
Geometry/MuonNumbering/interface/MuonGeometryConstants.h
"
14
#include "
Geometry/CSCGeometryBuilder/src/CSCGeometryParsFromDD.h
"
15
#include "
DetectorDescription/Core/interface/DDCompactView.h
"
16
#include "
Geometry/Records/interface/IdealGeometryRecord.h
"
17
#include "
DetectorDescription/DDCMS/interface/DDCompactView.h
"
18
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
19
#include "
FWCore/ParameterSet/interface/ParameterSetDescription.h
"
20
21
class
CSCRecoIdealDBLoader
:
public
edm::one::EDAnalyzer
<edm::one::WatchRuns> {
22
public
:
23
CSCRecoIdealDBLoader
(
edm::ParameterSet
const
&);
24
25
void
beginRun
(
edm::Run
const
&
iEvent
,
edm::EventSetup
const
&)
override
;
26
void
analyze
(
edm::Event
const
&
iEvent
,
edm::EventSetup
const
&)
override
{}
27
void
endRun
(
edm::Run
const
&
iEvent
,
edm::EventSetup
const
&)
override
{}
28
29
private
:
30
bool
fromDD4Hep_
;
31
};
32
33
CSCRecoIdealDBLoader::CSCRecoIdealDBLoader
(
const
edm::ParameterSet
& iC) {
34
fromDD4Hep_
= iC.
getUntrackedParameter
<
bool
>(
"fromDD4Hep"
,
false
);
35
}
36
37
void
CSCRecoIdealDBLoader::beginRun
(
const
edm::Run
&,
edm::EventSetup
const
& es) {
38
edm::LogInfo
(
"CSCRecoIdealDBLoader"
) <<
"CSCRecoIdealDBLoader::beginRun"
;
39
40
RecoIdealGeometry
* rig =
new
RecoIdealGeometry
;
41
CSCRecoDigiParameters
* rdp =
new
CSCRecoDigiParameters
;
42
edm::Service<cond::service::PoolDBOutputService>
mydbservice;
43
if
(!mydbservice.
isAvailable
()) {
44
edm::LogError
(
"CSCRecoIdealDBLoader"
) <<
"PoolDBOutputService unavailable"
;
45
return
;
46
}
47
48
edm::ESHandle<MuonGeometryConstants>
pMNDC;
49
CSCGeometryParsFromDD
cscgp;
50
51
if
(
fromDD4Hep_
) {
52
edm::ESTransientHandle<cms::DDCompactView>
pDD;
53
es.
get
<
IdealGeometryRecord
>().
get
(pDD);
54
es.
get
<
IdealGeometryRecord
>().
get
(pMNDC);
55
const
cms::DDCompactView
& cpv = *pDD;
56
cscgp.
build
(&cpv, *pMNDC, *rig, *rdp);
57
}
else
{
58
edm::ESTransientHandle<DDCompactView>
pDD;
59
es.
get
<
IdealGeometryRecord
>().
get
(pDD);
60
es.
get
<
IdealGeometryRecord
>().
get
(pMNDC);
61
const
DDCompactView
& cpv = *pDD;
62
cscgp.
build
(&cpv, *pMNDC, *rig, *rdp);
63
}
64
65
if
(mydbservice->
isNewTagRequest
(
"CSCRecoGeometryRcd"
)) {
66
mydbservice->
createNewIOV
<
RecoIdealGeometry
>(
67
rig, mydbservice->
beginOfTime
(), mydbservice->
endOfTime
(),
"CSCRecoGeometryRcd"
);
68
}
else
{
69
edm::LogError
(
"CSCRecoIdealDBLoader"
) <<
"CSCRecoGeometryRcd Tag is already present."
;
70
}
71
if
(mydbservice->
isNewTagRequest
(
"CSCRecoDigiParametersRcd"
)) {
72
mydbservice->
createNewIOV
<
CSCRecoDigiParameters
>(
73
rdp, mydbservice->
beginOfTime
(), mydbservice->
endOfTime
(),
"CSCRecoDigiParametersRcd"
);
74
}
else
{
75
edm::LogError
(
"CSCRecoIdealDBLoader"
) <<
"CSCRecoDigiParametersRcd Tag is already present."
;
76
}
77
}
78
79
DEFINE_FWK_MODULE
(
CSCRecoIdealDBLoader
);
CSCGeometryParsFromDD::build
bool build(const DDCompactView *cview, const MuonGeometryConstants &muonConstants, RecoIdealGeometry &rig, CSCRecoDigiParameters &rdp)
Build the geometry returning the RecoIdealGeometry and the CSCRecoDigiParameters objects.
Definition:
CSCGeometryParsFromDD.cc:39
EDAnalyzer.h
ESTransientHandle.h
CSCRecoDigiParameters
Definition:
CSCRecoDigiParameters.h:18
cond::service::PoolDBOutputService::beginOfTime
cond::Time_t beginOfTime() const
Definition:
PoolDBOutputService.cc:215
ESHandle.h
edm::Run
Definition:
Run.h:45
CSCRecoIdealDBLoader::endRun
void endRun(edm::Run const &iEvent, edm::EventSetup const &) override
Definition:
CSCRecoIdealDBLoader.cc:27
MuonGeometryConstants.h
CSCRecoIdealDBLoader::fromDD4Hep_
bool fromDD4Hep_
Definition:
CSCRecoIdealDBLoader.cc:30
CSCRecoIdealDBLoader::CSCRecoIdealDBLoader
CSCRecoIdealDBLoader(edm::ParameterSet const &)
Definition:
CSCRecoIdealDBLoader.cc:33
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::LogInfo
Log< level::Info, false > LogInfo
Definition:
MessageLogger.h:125
edm::one::EDAnalyzer
Definition:
EDAnalyzer.h:30
edm::Service::isAvailable
bool isAvailable() const
Definition:
Service.h:40
DDCompactView.h
MakerMacros.h
PoolDBOutputService.h
edm::EventSetup::get
T get() const
Definition:
EventSetup.h:80
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:116
Service.h
DDCompactView
Compact representation of the geometrical detector hierarchy.
Definition:
DDCompactView.h:81
CSCRecoGeometryRcd.h
edm::ESHandle
Definition:
DTSurvey.h:22
CSCGeometryParsFromDD
Definition:
CSCGeometryParsFromDD.h:29
DDCompactView.h
ParameterSetDescription.h
CSCRecoIdealDBLoader::analyze
void analyze(edm::Event const &iEvent, edm::EventSetup const &) override
Definition:
CSCRecoIdealDBLoader.cc:26
RecoIdealGeometry.h
CSCRecoDigiParameters.h
edm::ParameterSet
Definition:
ParameterSet.h:47
edm::Service< cond::service::PoolDBOutputService >
iEvent
int iEvent
Definition:
GenABIO.cc:224
IdealGeometryRecord.h
edm::EventSetup
Definition:
EventSetup.h:57
edm::LogError
Log< level::Error, false > LogError
Definition:
MessageLogger.h:123
get
#define get
edm::ESTransientHandle
Definition:
ESTransientHandle.h:41
cond::service::PoolDBOutputService::endOfTime
cond::Time_t endOfTime() const
Definition:
PoolDBOutputService.cc:213
CSCRecoIdealDBLoader
Definition:
CSCRecoIdealDBLoader.cc:21
CSCGeometryParsFromDD.h
cms::DDCompactView
Definition:
DDCompactView.h:31
EventSetup.h
cond::service::PoolDBOutputService::isNewTagRequest
bool isNewTagRequest(const std::string &recordName)
Definition:
PoolDBOutputService.cc:128
CSCRecoDigiParametersRcd.h
ParameterSet.h
MuonGeometryRecord.h
CSCRecoIdealDBLoader::beginRun
void beginRun(edm::Run const &iEvent, edm::EventSetup const &) override
Definition:
CSCRecoIdealDBLoader.cc:37
edm::Event
Definition:
Event.h:73
IdealGeometryRecord
Definition:
IdealGeometryRecord.h:25
RecoIdealGeometry
Definition:
RecoIdealGeometry.h:28
Generated for CMSSW Reference Manual by
1.8.16