GeometryReaders
XMLIdealGeometryESSource
src
XMLIdealGeometryESProducer.cc
Go to the documentation of this file.
1
#include "
FWCore/Framework/interface/ESProducer.h
"
2
#include "
FWCore/Framework/interface/ESHandle.h
"
3
#include "
FWCore/Framework/interface/ESTransientHandle.h
"
4
#include "
FWCore/Framework/interface/ModuleFactory.h
"
5
#include "
FWCore/Concurrency/interface/SharedResourceNames.h
"
6
#include "
DetectorDescription/Core/interface/DDCompactView.h
"
7
#include "
DetectorDescription/Core/interface/DDRoot.h
"
8
#include "
DetectorDescription/Parser/interface/DDLParser.h
"
9
#include "
Geometry/Records/interface/IdealGeometryRecord.h
"
10
#include "
Geometry/Records/interface/GeometryFileRcd.h
"
11
#include "
CondFormats/Common/interface/FileBlob.h
"
12
13
#include <memory>
14
15
class
XMLIdealGeometryESProducer
:
public
edm::ESProducer
{
16
public
:
17
XMLIdealGeometryESProducer
(
const
edm::ParameterSet
&);
18
19
using
ReturnType
= std::unique_ptr<DDCompactView>;
20
21
ReturnType
produce
(
const
IdealGeometryRecord
&);
22
23
static
void
fillDescriptions
(
edm::ConfigurationDescriptions
& descriptions);
24
25
private
:
26
const
std::string
rootDDName_
;
// this must be the form namespace:name
27
const
edm::ESGetToken<FileBlob, GeometryFileRcd>
blobToken_
;
28
};
29
30
XMLIdealGeometryESProducer::XMLIdealGeometryESProducer
(
const
edm::ParameterSet
& iConfig)
31
: rootDDName_(iConfig.getParameter<
std
::
string
>(
"rootDDName"
)),
32
blobToken_(setWhatProduced(this).consumes(
edm
::
ESInputTag
(
""
, iConfig.getParameter<
std
::
string
>(
"label"
)))) {
33
usesResources
({{
edm::ESSharedResourceNames::kDDGeometry
}});
34
}
35
36
XMLIdealGeometryESProducer::ReturnType
XMLIdealGeometryESProducer::produce
(
const
IdealGeometryRecord
& iRecord) {
37
edm::ESTransientHandle<FileBlob>
gdd = iRecord.
getTransientHandle
(
blobToken_
);
38
auto
cpv = std::make_unique<DDCompactView>(
DDName
(
rootDDName_
));
39
DDLParser
parser
(*cpv);
40
parser
.getDDLSAX2FileHandler()->setUserNS(
true
);
41
parser
.clearFiles();
42
43
std::unique_ptr<std::vector<unsigned char> > tb = (*gdd).getUncompressedBlob();
44
45
parser
.parse(*tb, tb->size());
46
47
cpv->lockdown();
48
49
return
cpv;
50
}
51
52
void
XMLIdealGeometryESProducer::fillDescriptions
(
edm::ConfigurationDescriptions
& descriptions) {
53
edm::ParameterSetDescription
desc
;
54
desc
.add<
std::string
>(
"rootDDName"
)->setComment(
"The value must be of the form 'namespace:name'"
);
55
desc
.add<
std::string
>(
"label"
)->setComment(
"product label used to get the FileBlob"
);
56
57
descriptions.
addDefault
(
desc
);
58
}
59
60
//define this as a plug-in
61
DEFINE_FWK_EVENTSETUP_MODULE
(
XMLIdealGeometryESProducer
);
XMLIdealGeometryESProducer::blobToken_
const edm::ESGetToken< FileBlob, GeometryFileRcd > blobToken_
Definition:
XMLIdealGeometryESProducer.cc:27
ESTransientHandle.h
ESHandle.h
ESInputTag
DDName
DDName is used to identify DDD entities uniquely.
Definition:
DDName.h:15
edm
HLT enums.
Definition:
AlignableModifier.h:19
XMLIdealGeometryESProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition:
XMLIdealGeometryESProducer.cc:52
XMLIdealGeometryESProducer::ReturnType
std::unique_ptr< DDCompactView > ReturnType
Definition:
XMLIdealGeometryESProducer.cc:19
edm::ParameterSetDescription
Definition:
ParameterSetDescription.h:52
ESProducer.h
writedatasetfile.parser
parser
Definition:
writedatasetfile.py:7
DDLParser.h
FileBlob.h
DDCompactView.h
GeometryFileRcd.h
edm::eventsetup::DependentRecordImplementation::getTransientHandle
ESTransientHandle< ProductT > getTransientHandle(ESGetToken< ProductT, DepRecordT > const &iToken) const
Definition:
DependentRecordImplementation.h:92
edm::ESProducer::usesResources
void usesResources(std::vector< std::string > const &)
Definition:
ESProducer.cc:117
SharedResourceNames.h
edm::ConfigurationDescriptions
Definition:
ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition:
ParameterSet.h:47
XMLIdealGeometryESProducer::rootDDName_
const std::string rootDDName_
Definition:
XMLIdealGeometryESProducer.cc:26
DDLParser
DDLParser is the main class of Detector Description Language Parser.
Definition:
DDLParser.h:63
IdealGeometryRecord.h
edm::ESGetToken< FileBlob, GeometryFileRcd >
edm::ESTransientHandle
Definition:
ESTransientHandle.h:41
XMLIdealGeometryESProducer::XMLIdealGeometryESProducer
XMLIdealGeometryESProducer(const edm::ParameterSet &)
Definition:
XMLIdealGeometryESProducer.cc:30
edm::ESSharedResourceNames::kDDGeometry
static const std::string kDDGeometry
Definition:
SharedResourceNames.h:37
ModuleFactory.h
submitPVResolutionJobs.desc
string desc
Definition:
submitPVResolutionJobs.py:251
std
Definition:
JetResolutionObject.h:76
XMLIdealGeometryESProducer
Definition:
XMLIdealGeometryESProducer.cc:15
DDRoot.h
XMLIdealGeometryESProducer::produce
ReturnType produce(const IdealGeometryRecord &)
Definition:
XMLIdealGeometryESProducer.cc:36
DEFINE_FWK_EVENTSETUP_MODULE
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition:
ModuleFactory.h:60
edm::ESProducer
Definition:
ESProducer.h:104
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition:
ConfigurationDescriptions.cc:99
IdealGeometryRecord
Definition:
IdealGeometryRecord.h:25
Generated for CMSSW Reference Manual by
1.8.16