CondTools
Geometry
plugins
PGeometricDetExtraBuilder.cc
Go to the documentation of this file.
1
#include "
FWCore/Framework/interface/one/EDAnalyzer.h
"
2
#include "
FWCore/ServiceRegistry/interface/Service.h
"
3
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
4
#include "
FWCore/Framework/interface/Event.h
"
5
#include "
CondCore/DBOutputService/interface/PoolDBOutputService.h
"
6
#include "
FWCore/Framework/interface/EventSetup.h
"
7
#include "
FWCore/Framework/interface/ESTransientHandle.h
"
8
#include "
FWCore/Framework/interface/ESHandle.h
"
9
#include "
FWCore/Framework/interface/MakerMacros.h
"
10
#include "
CondFormats/GeometryObjects/interface/PGeometricDetExtra.h
"
11
#include "
Geometry/Records/interface/PGeometricDetExtraRcd.h
"
12
#include "
Geometry/TrackerNumberingBuilder/interface/GeometricDetExtra.h
"
13
#include "
DetectorDescription/Core/interface/DDCompactView.h
"
14
#include "
Geometry/Records/interface/TrackerDigiGeometryRecord.h
"
15
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
16
#include <vector>
17
18
class
PGeometricDetExtraBuilder
:
public
edm::one::EDAnalyzer
<edm::one::WatchRuns> {
19
public
:
20
PGeometricDetExtraBuilder
(
const
edm::ParameterSet
&) {}
21
22
void
beginRun
(
edm::Run
const
&
iEvent
,
edm::EventSetup
const
&)
override
;
23
void
analyze
(
edm::Event
const
&
iEvent
,
edm::EventSetup
const
&)
override
{}
24
void
endRun
(
edm::Run
const
&
iEvent
,
edm::EventSetup
const
&)
override
{}
25
26
private
:
27
void
putOne
(
const
GeometricDetExtra
& gde,
PGeometricDetExtra
* pgde);
28
};
29
30
void
PGeometricDetExtraBuilder::beginRun
(
const
edm::Run
&,
edm::EventSetup
const
& es) {
31
PGeometricDetExtra
* pgde =
new
PGeometricDetExtra
;
32
edm::Service<cond::service::PoolDBOutputService>
mydbservice;
33
if
(!mydbservice.
isAvailable
()) {
34
edm::LogError
(
"PGeometricDetExtraBuilder"
) <<
"PoolDBOutputService unavailable"
;
35
return
;
36
}
37
edm::ESTransientHandle<DDCompactView>
cpvH;
38
edm::ESHandle<std::vector<GeometricDetExtra>
> gdeH;
39
es.
get
<
IdealGeometryRecord
>().
get
(cpvH);
40
es.
get
<
IdealGeometryRecord
>().
get
(gdeH);
41
const
std::vector<GeometricDetExtra>& gdes = (*gdeH);
42
43
std::vector<GeometricDetExtra>::const_iterator git = gdes.begin();
44
std::vector<GeometricDetExtra>::const_iterator egit = gdes.end();
45
46
for
(; git != egit; ++git) {
// one level below "tracker"
47
putOne
(*git, pgde);
48
}
49
if
(mydbservice->
isNewTagRequest
(
"PGeometricDetExtraRcd"
)) {
50
mydbservice->
createNewIOV
<
PGeometricDetExtra
>(
51
pgde, mydbservice->
beginOfTime
(), mydbservice->
endOfTime
(),
"PGeometricDetExtraRcd"
);
52
}
else
{
53
edm::LogError
(
"PGeometricDetExtraBuilder"
) <<
"PGeometricDetExtra and PGeometricDetExtraRcd Tag already present"
;
54
}
55
}
56
57
void
PGeometricDetExtraBuilder::putOne
(
const
GeometricDetExtra
& gde,
PGeometricDetExtra
* pgde) {
58
PGeometricDetExtra::Item
item
;
59
item
._geographicalId = gde.
geographicalId
();
60
item
._volume = gde.
volume
();
61
item
._density = gde.
density
();
62
item
._weight = gde.
weight
();
63
item
._copy = gde.
copyno
();
64
item
._material = gde.
material
();
65
pgde->
pgdes_
.push_back(
item
);
66
}
67
68
DEFINE_FWK_MODULE
(
PGeometricDetExtraBuilder
);
EDAnalyzer.h
ESTransientHandle.h
MessageLogger.h
cond::service::PoolDBOutputService::beginOfTime
cond::Time_t beginOfTime() const
Definition:
PoolDBOutputService.cc:187
ESHandle.h
edm::Run
Definition:
Run.h:45
PGeometricDetExtraBuilder::analyze
void analyze(edm::Event const &iEvent, edm::EventSetup const &) override
Definition:
PGeometricDetExtraBuilder.cc:23
PGeometricDetExtra.h
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:73
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
PGeometricDetExtraBuilder::putOne
void putOne(const GeometricDetExtra &gde, PGeometricDetExtra *pgde)
Definition:
PGeometricDetExtraBuilder.cc:57
cond::service::PoolDBOutputService::createNewIOV
void createNewIOV(const T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t, const std::string &recordName)
Definition:
PoolDBOutputService.h:110
Service.h
edm::ESHandle
Definition:
DTSurvey.h:22
GeometricDetExtra::weight
double weight() const
Definition:
GeometricDetExtra.h:53
GeometricDetExtra::volume
double volume() const
Definition:
GeometricDetExtra.h:51
GeometricDetExtra::geographicalId
DetId geographicalId() const
Definition:
GeometricDetExtra.h:48
PGeometricDetExtraBuilder::endRun
void endRun(edm::Run const &iEvent, edm::EventSetup const &) override
Definition:
PGeometricDetExtraBuilder.cc:24
TrackerDigiGeometryRecord.h
edm::ParameterSet
Definition:
ParameterSet.h:36
edm::LogError
Definition:
MessageLogger.h:183
Event.h
edm::Service< cond::service::PoolDBOutputService >
iEvent
int iEvent
Definition:
GenABIO.cc:224
GeometricDetExtra
Definition:
GeometricDetExtra.h:17
B2GTnPMonitor_cfi.item
item
Definition:
B2GTnPMonitor_cfi.py:147
edm::EventSetup
Definition:
EventSetup.h:57
get
#define get
GeometricDetExtra.h
PGeometricDetExtra::Item
Definition:
PGeometricDetExtra.h:14
edm::ESTransientHandle
Definition:
ESTransientHandle.h:41
PGeometricDetExtraBuilder
Definition:
PGeometricDetExtraBuilder.cc:18
cond::service::PoolDBOutputService::endOfTime
cond::Time_t endOfTime() const
Definition:
PoolDBOutputService.cc:185
GeometricDetExtra::material
std::string const & material() const
Definition:
GeometricDetExtra.h:54
PGeometricDetExtraBuilder::PGeometricDetExtraBuilder
PGeometricDetExtraBuilder(const edm::ParameterSet &)
Definition:
PGeometricDetExtraBuilder.cc:20
PGeometricDetExtra
Definition:
PGeometricDetExtra.h:9
EventSetup.h
cond::service::PoolDBOutputService::isNewTagRequest
bool isNewTagRequest(const std::string &recordName)
Definition:
PoolDBOutputService.cc:100
PGeometricDetExtraBuilder::beginRun
void beginRun(edm::Run const &iEvent, edm::EventSetup const &) override
Definition:
PGeometricDetExtraBuilder.cc:30
ParameterSet.h
PGeometricDetExtraRcd.h
GeometricDetExtra::density
double density() const
Definition:
GeometricDetExtra.h:52
edm::Event
Definition:
Event.h:73
GeometricDetExtra::copyno
int copyno() const
Definition:
GeometricDetExtra.h:50
IdealGeometryRecord
Definition:
IdealGeometryRecord.h:27
PGeometricDetExtra::pgdes_
std::vector< Item > pgdes_
Definition:
PGeometricDetExtra.h:27
Generated for CMSSW Reference Manual by
1.8.16