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
{
20
public
:
21
22
PGeometricDetExtraBuilder
(
const
edm::ParameterSet
& ) {}
23
24
void
beginRun
(
edm::Run
const
&
iEvent
,
edm::EventSetup
const
&)
override
;
25
void
analyze
(
edm::Event
const
& iEvent,
edm::EventSetup
const
&)
override
{}
26
void
endRun
(
edm::Run
const
& iEvent,
edm::EventSetup
const
&)
override
{}
27
private
:
28
void
putOne
(
const
GeometricDetExtra
& gde,
PGeometricDetExtra
* pgde );
29
};
30
31
void
32
PGeometricDetExtraBuilder::beginRun
(
const
edm::Run
&,
edm::EventSetup
const
& es)
33
{
34
PGeometricDetExtra
* pgde =
new
PGeometricDetExtra
;
35
edm::Service<cond::service::PoolDBOutputService>
mydbservice;
36
if
( !mydbservice.
isAvailable
() ){
37
edm::LogError
(
"PGeometricDetExtraBuilder"
)<<
"PoolDBOutputService unavailable"
;
38
return
;
39
}
40
edm::ESTransientHandle<DDCompactView>
cpvH;
41
edm::ESHandle<std::vector<GeometricDetExtra>
> gdeH;
42
es.
get
<
IdealGeometryRecord
>().
get
( cpvH );
43
es.
get
<
IdealGeometryRecord
>().
get
( gdeH );
44
const
std::vector<GeometricDetExtra>& gdes = (*gdeH);
45
46
std::vector<GeometricDetExtra>::const_iterator git = gdes.begin();
47
std::vector<GeometricDetExtra>::const_iterator egit = gdes.end();
48
49
for
(; git!= egit; ++git) {
// one level below "tracker"
50
putOne
(*git, pgde);
51
}
52
if
( mydbservice->
isNewTagRequest
(
"PGeometricDetExtraRcd"
) ) {
53
mydbservice->
createNewIOV
<
PGeometricDetExtra
>( pgde,mydbservice->
beginOfTime
(),mydbservice->
endOfTime
(),
"PGeometricDetExtraRcd"
);
54
}
else
{
55
edm::LogError
(
"PGeometricDetExtraBuilder"
)<<
"PGeometricDetExtra and PGeometricDetExtraRcd Tag already present"
;
56
}
57
}
58
59
void
PGeometricDetExtraBuilder::putOne
(
const
GeometricDetExtra
& gde,
PGeometricDetExtra
* pgde ) {
60
PGeometricDetExtra::Item
item;
61
item.
_geographicalId
= gde.
geographicalId
();
62
item.
_volume
= gde.
volume
();
63
item.
_density
= gde.
density
();
64
item.
_weight
= gde.
weight
();
65
item.
_copy
= gde.
copyno
();
66
item.
_material
= gde.
material
();
67
pgde->
pgdes_
.push_back ( item );
68
}
69
70
DEFINE_FWK_MODULE
(
PGeometricDetExtraBuilder
);
PGeometricDetExtraBuilder::beginRun
void beginRun(edm::Run const &iEvent, edm::EventSetup const &) override
Definition:
PGeometricDetExtraBuilder.cc:32
TrackerDigiGeometryRecord.h
PGeometricDetExtraBuilder::PGeometricDetExtraBuilder
PGeometricDetExtraBuilder(const edm::ParameterSet &)
Definition:
PGeometricDetExtraBuilder.cc:22
MessageLogger.h
edm::Service< cond::service::PoolDBOutputService >
GeometricDetExtra::material
std::string const & material() const
Definition:
GeometricDetExtra.h:91
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:17
Event.h
MakerMacros.h
PGeometricDetExtra::Item::_weight
double _weight
Definition:
PGeometricDetExtra.h:21
EventSetup.h
PGeometricDetExtra::pgdes_
std::vector< Item > pgdes_
Definition:
PGeometricDetExtra.h:28
PGeometricDetExtraBuilder
Definition:
PGeometricDetExtraBuilder.cc:18
GeometricDetExtra::weight
double weight() const
Definition:
GeometricDetExtra.h:87
PGeometricDetExtra::Item::_volume
double _volume
Definition:
PGeometricDetExtra.h:19
PGeometricDetExtraBuilder::endRun
void endRun(edm::Run const &iEvent, edm::EventSetup const &) override
Definition:
PGeometricDetExtraBuilder.cc:26
ParameterSet.h
edm::LogError
Definition:
MessageLogger.h:174
iEvent
int iEvent
Definition:
GenABIO.cc:230
PoolDBOutputService.h
PGeometricDetExtraBuilder::putOne
void putOne(const GeometricDetExtra &gde, PGeometricDetExtra *pgde)
Definition:
PGeometricDetExtraBuilder.cc:59
cond::service::PoolDBOutputService::isNewTagRequest
bool isNewTagRequest(const std::string &recordName)
Definition:
PoolDBOutputService.cc:98
PGeometricDetExtra::Item::_geographicalId
int _geographicalId
Definition:
PGeometricDetExtra.h:16
edm::ESHandle
Definition:
DTSurvey.h:22
cond::service::PoolDBOutputService::beginOfTime
cond::Time_t beginOfTime() const
Definition:
PoolDBOutputService.cc:175
edm::Service::isAvailable
bool isAvailable() const
Definition:
Service.h:46
ESHandle.h
Service.h
GeometricDetExtra::density
double density() const
Definition:
GeometricDetExtra.h:83
PGeometricDetExtra::Item
Definition:
PGeometricDetExtra.h:15
edm::EventSetup
Definition:
EventSetup.h:54
PGeometricDetExtraBuilder::analyze
void analyze(edm::Event const &iEvent, edm::EventSetup const &) override
Definition:
PGeometricDetExtraBuilder.cc:25
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:65
PGeometricDetExtra::Item::_density
double _density
Definition:
PGeometricDetExtra.h:20
GeometricDetExtra::volume
double volume() const
Definition:
GeometricDetExtra.h:79
cond::service::PoolDBOutputService::endOfTime
cond::Time_t endOfTime() const
Definition:
PoolDBOutputService.cc:170
GeometricDetExtra.h
PGeometricDetExtra::Item::_copy
int _copy
Definition:
PGeometricDetExtra.h:22
EDAnalyzer.h
PGeometricDetExtra.h
ESTransientHandle.h
edm::EventSetup::get
T get() const
Definition:
EventSetup.h:68
edm::ParameterSet
Definition:
ParameterSet.h:36
edm::ESTransientHandle
Definition:
ESTransientHandle.h:41
DDCompactView.h
PGeometricDetExtra::Item::_material
std::string _material
Definition:
PGeometricDetExtra.h:23
edm::Event
Definition:
Event.h:70
GeometricDetExtra
Definition:
GeometricDetExtra.h:25
PGeometricDetExtra
Definition:
PGeometricDetExtra.h:9
edm::one::EDAnalyzer
Definition:
EDAnalyzer.h:30
GeometricDetExtra::copyno
int copyno() const
Definition:
GeometricDetExtra.h:75
PGeometricDetExtraRcd.h
edm::Run
Definition:
Run.h:44
Generated for CMSSW Reference Manual by
1.8.11