Main Page
Namespaces
Classes
Package Documentation
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
);
PGeometricDetExtraBuilder::beginRun
void beginRun(edm::Run const &iEvent, edm::EventSetup const &) override
Definition:
PGeometricDetExtraBuilder.cc:30
TrackerDigiGeometryRecord.h
PGeometricDetExtraBuilder::PGeometricDetExtraBuilder
PGeometricDetExtraBuilder(const edm::ParameterSet &)
Definition:
PGeometricDetExtraBuilder.cc:20
MessageLogger.h
edm::Service< cond::service::PoolDBOutputService >
GeometricDetExtra::material
std::string const & material() const
Definition:
GeometricDetExtra.h:54
Event.h
MakerMacros.h
PGeometricDetExtra::Item::_weight
double _weight
Definition:
PGeometricDetExtra.h:20
EventSetup.h
PGeometricDetExtra::pgdes_
std::vector< Item > pgdes_
Definition:
PGeometricDetExtra.h:27
PGeometricDetExtraBuilder
Definition:
PGeometricDetExtraBuilder.cc:18
GeometricDetExtra::weight
double weight() const
Definition:
GeometricDetExtra.h:53
PGeometricDetExtra::Item::_volume
double _volume
Definition:
PGeometricDetExtra.h:18
B2GTnPMonitor_cfi.item
item
Definition:
B2GTnPMonitor_cfi.py:147
PGeometricDetExtraBuilder::endRun
void endRun(edm::Run const &iEvent, edm::EventSetup const &) override
Definition:
PGeometricDetExtraBuilder.cc:24
ParameterSet.h
edm::LogError
Definition:
MessageLogger.h:183
iEvent
int iEvent
Definition:
GenABIO.cc:224
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
PoolDBOutputService.h
PGeometricDetExtraBuilder::putOne
void putOne(const GeometricDetExtra &gde, PGeometricDetExtra *pgde)
Definition:
PGeometricDetExtraBuilder.cc:57
cond::service::PoolDBOutputService::isNewTagRequest
bool isNewTagRequest(const std::string &recordName)
Definition:
PoolDBOutputService.cc:89
PGeometricDetExtra::Item::_geographicalId
int _geographicalId
Definition:
PGeometricDetExtra.h:15
edm::ESHandle
Definition:
DTSurvey.h:22
cond::service::PoolDBOutputService::beginOfTime
cond::Time_t beginOfTime() const
Definition:
PoolDBOutputService.cc:156
edm::Service::isAvailable
bool isAvailable() const
Definition:
Service.h:40
ESHandle.h
Service.h
GeometricDetExtra::density
double density() const
Definition:
GeometricDetExtra.h:52
PGeometricDetExtra::Item
Definition:
PGeometricDetExtra.h:14
edm::EventSetup
Definition:
EventSetup.h:57
PGeometricDetExtraBuilder::analyze
void analyze(edm::Event const &iEvent, edm::EventSetup const &) override
Definition:
PGeometricDetExtraBuilder.cc:23
cond::service::PoolDBOutputService::createNewIOV
void createNewIOV(T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t firstTillTime, const std::string &recordName, bool withlogging=false)
Definition:
PoolDBOutputService.h:73
IdealGeometryRecord
Definition:
IdealGeometryRecord.h:27
GeometricDetExtra::geographicalId
DetId geographicalId() const
Definition:
GeometricDetExtra.h:48
PGeometricDetExtra::Item::_density
double _density
Definition:
PGeometricDetExtra.h:19
GeometricDetExtra::volume
double volume() const
Definition:
GeometricDetExtra.h:51
cond::service::PoolDBOutputService::endOfTime
cond::Time_t endOfTime() const
Definition:
PoolDBOutputService.cc:154
GeometricDetExtra.h
PGeometricDetExtra::Item::_copy
int _copy
Definition:
PGeometricDetExtra.h:21
EDAnalyzer.h
PGeometricDetExtra.h
ESTransientHandle.h
edm::EventSetup::get
T get() const
Definition:
EventSetup.h:73
edm::ParameterSet
Definition:
ParameterSet.h:36
edm::ESTransientHandle
Definition:
ESTransientHandle.h:41
PGeometricDetExtra::Item::_material
std::string _material
Definition:
PGeometricDetExtra.h:22
edm::Event
Definition:
Event.h:72
GeometricDetExtra
Definition:
GeometricDetExtra.h:17
PGeometricDetExtra
Definition:
PGeometricDetExtra.h:9
edm::one::EDAnalyzer
Definition:
EDAnalyzer.h:30
DDCompactView.h
GeometricDetExtra::copyno
int copyno() const
Definition:
GeometricDetExtra.h:50
PGeometricDetExtraRcd.h
edm::Run
Definition:
Run.h:45
Generated for CMSSW Reference Manual by
1.8.11