CondTools
Geometry
plugins
XMLGeometryReader.cc
Go to the documentation of this file.
1
#include "
FWCore/Framework/interface/one/EDAnalyzer.h
"
2
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
3
#include "
FWCore/ServiceRegistry/interface/Service.h
"
4
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
5
#include "
FWCore/Framework/interface/Event.h
"
6
#include "
FWCore/Framework/interface/EventSetup.h
"
7
#include "
FWCore/Framework/interface/ESHandle.h
"
8
#include "
FWCore/Framework/interface/MakerMacros.h
"
9
#include "
CondFormats/Common/interface/FileBlob.h
"
10
#include "
Geometry/Records/interface/GeometryFileRcd.h
"
11
12
#include <string>
13
#include <vector>
14
#include <fstream>
15
16
class
XMLGeometryReader
:
public
edm::one::EDAnalyzer
<edm::one::WatchRuns> {
17
public
:
18
XMLGeometryReader
(
const
edm::ParameterSet
&);
19
20
void
beginJob
()
override
{}
21
void
beginRun
(
edm::Run
const
&
iEvent
,
edm::EventSetup
const
&)
override
;
22
void
analyze
(
edm::Event
const
&
iEvent
,
edm::EventSetup
const
&)
override
{}
23
void
endRun
(
edm::Run
const
&
iEvent
,
edm::EventSetup
const
&)
override
{}
24
25
private
:
26
std::string
m_fname
;
27
std::string
m_label
;
28
};
29
30
XMLGeometryReader::XMLGeometryReader
(
const
edm::ParameterSet
& iConfig) {
31
m_fname
= iConfig.
getUntrackedParameter
<
std::string
>(
"XMLFileName"
,
"test.xml"
);
32
m_label
= iConfig.
getUntrackedParameter
<
std::string
>(
"geomLabel"
,
"Extended"
);
33
}
34
35
void
XMLGeometryReader::beginRun
(
edm::Run
const
&
run
,
edm::EventSetup
const
& iSetup) {
36
edm::LogInfo
(
"XMLGeometryReader"
) <<
"XMLGeometryReader::beginRun"
;
37
38
edm::ESHandle<FileBlob>
geometry
;
39
iSetup.
get
<
GeometryFileRcd
>().
get
(
m_label
,
geometry
);
40
std::unique_ptr<std::vector<unsigned char> > blob((*geometry).getUncompressedBlob());
41
42
std::string
outfile1(
m_fname
);
43
std::ofstream
output1
(outfile1.c_str());
44
output1
.write((
const
char
*)&(*blob)[0], blob->size());
45
output1
.close();
46
}
47
48
DEFINE_FWK_MODULE
(
XMLGeometryReader
);
EDAnalyzer.h
GeometryFileRcd
Definition:
GeometryFileRcd.h:5
MessageLogger.h
skim900GeV_StreamA_MinBiasPD_cfg.output1
output1
Definition:
skim900GeV_StreamA_MinBiasPD_cfg.py:212
ESHandle.h
edm::Run
Definition:
Run.h:45
geometry
Definition:
geometry.py:1
XMLGeometryReader::XMLGeometryReader
XMLGeometryReader(const edm::ParameterSet &)
Definition:
XMLGeometryReader.cc:30
XMLGeometryReader::analyze
void analyze(edm::Event const &iEvent, edm::EventSetup const &) override
Definition:
XMLGeometryReader.cc:22
relativeConstraints.geometry
geometry
Definition:
relativeConstraints.py:39
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
FileBlob.h
GeometryFileRcd.h
MakerMacros.h
edm::EventSetup::get
T get() const
Definition:
EventSetup.h:87
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
Service.h
edm::ESHandle
Definition:
DTSurvey.h:22
XMLGeometryReader::beginJob
void beginJob() override
Definition:
XMLGeometryReader.cc:20
edm::ParameterSet
Definition:
ParameterSet.h:47
Event.h
iEvent
int iEvent
Definition:
GenABIO.cc:224
XMLGeometryReader::m_fname
std::string m_fname
Definition:
XMLGeometryReader.cc:26
edm::EventSetup
Definition:
EventSetup.h:58
get
#define get
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
writedatasetfile.run
run
Definition:
writedatasetfile.py:27
XMLGeometryReader
Definition:
XMLGeometryReader.cc:16
EventSetup.h
XMLGeometryReader::endRun
void endRun(edm::Run const &iEvent, edm::EventSetup const &) override
Definition:
XMLGeometryReader.cc:23
XMLGeometryReader::m_label
std::string m_label
Definition:
XMLGeometryReader.cc:27
ParameterSet.h
XMLGeometryReader::beginRun
void beginRun(edm::Run const &iEvent, edm::EventSetup const &) override
Definition:
XMLGeometryReader.cc:35
edm::Event
Definition:
Event.h:73
Generated for CMSSW Reference Manual by
1.8.16