CMS 3D CMS Logo

XMLIdealGeometryESSource.cc
Go to the documentation of this file.
2 
6 
11 
16 
18 
19 #include <memory>
20 
22  : rootNodeName_(p.getParameter<std::string>("rootNodeName")),
23  userNS_(p.getUntrackedParameter<bool>("userControlledNamespace", false)),
24  geoConfig_(p) {
25  if (rootNodeName_.empty() || rootNodeName_ == "\\") {
26  throw cms::Exception("DDException") << "XMLIdealGeometryESSource must have a root node name.";
27  }
28 
29  if (rootNodeName_ == "MagneticFieldVolumes:MAGF" || rootNodeName_ == "cmsMagneticField:MAGF") {
31  this, &XMLIdealGeometryESSource::produceMagField, edm::es::Label(p.getParameter<std::string>("@module_label")));
32  findingRecord<IdealMagneticFieldRecord>();
33  } else {
35  this, &XMLIdealGeometryESSource::produceGeom, edm::es::Label(p.getParameter<std::string>("@module_label")));
36  findingRecord<IdealGeometryRecord>();
37  }
38 }
39 
41 
42 std::unique_ptr<DDCompactView> XMLIdealGeometryESSource::produceGeom(const IdealGeometryRecord &) { return produce(); }
43 
45  return produce();
46 }
47 
48 std::unique_ptr<DDCompactView> XMLIdealGeometryESSource::produce() {
49  DDName ddName(rootNodeName_);
50  DDLogicalPart rootNode(ddName);
51  DDRootDef::instance().set(rootNode);
52  std::unique_ptr<DDCompactView> returnValue(new DDCompactView(rootNode));
53  DDLParser parser(*returnValue); //* parser = DDLParser::instance();
54  parser.getDDLSAX2FileHandler()->setUserNS(userNS_);
55  int result2 = parser.parse(geoConfig_);
56  if (result2 != 0)
57  throw cms::Exception("DDException") << "DDD-Parser: parsing failed!";
58 
59  // after parsing the root node should be valid!
60 
61  if (!rootNode.isValid()) {
62  throw cms::Exception("Geometry") << "There is no valid node named \"" << rootNodeName_ << "\"";
63  }
64  returnValue->lockdown();
65  return returnValue;
66 }
67 
69  const edm::IOVSyncValue &iosv,
70  edm::ValidityInterval &oValidity) {
72  oValidity = infinity;
73 }
74 
76 
electrons_cff.bool
bool
Definition: electrons_cff.py:372
funct::false
false
Definition: Factorize.h:34
DDName
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
edm::ESProducer::setWhatProduced
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:138
edm::ValidityInterval
Definition: ValidityInterval.h:28
writedatasetfile.parser
parser
Definition: writedatasetfile.py:7
DDLParser.h
infinity
const double infinity
Definition: CSCChamberFitter.cc:10
Specific.h
DDCompactView.h
edm::eventsetup::EventSetupRecordKey
Definition: EventSetupRecordKey.h:30
XMLIdealGeometryESSource::setIntervalFor
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
Definition: XMLIdealGeometryESSource.cc:68
FileInPath.h
XMLIdealGeometryESSource::produceGeom
std::unique_ptr< DDCompactView > produceGeom(const IdealGeometryRecord &)
Definition: XMLIdealGeometryESSource.cc:42
Solid.h
IdealMagneticFieldRecord
Definition: IdealMagneticFieldRecord.h:11
LogicalPart.h
DDCompactView
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:80
edm::es::Label
Definition: es_Label.h:54
DDSolid.h
edm::IOVSyncValue
Definition: IOVSyncValue.h:31
DEFINE_FWK_EVENTSETUP_SOURCE
#define DEFINE_FWK_EVENTSETUP_SOURCE(type)
Definition: SourceFactory.h:91
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SourceFactory.h
DDBase::isValid
bool isValid() const
true, if the wrapped pointer is valid
Definition: DDBase.h:95
edm::ParameterSet
Definition: ParameterSet.h:36
edm::IOVSyncValue::endOfTime
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:82
DDI::Singleton::instance
static value_type & instance()
DDSpecifics.h
DDLParser
DDLParser is the main class of Detector Description Language Parser.
Definition: DDLParser.h:63
DDLogicalPart
A DDLogicalPart aggregates information concerning material, solid and sensitveness ....
Definition: DDLogicalPart.h:93
DDMaterial.h
XMLIdealGeometryESSource::userNS_
bool userNS_
Definition: XMLIdealGeometryESSource.h:33
XMLIdealGeometryESSource
Definition: XMLIdealGeometryESSource.h:16
XMLIdealGeometryESSource::produce
std::unique_ptr< DDCompactView > produce()
Definition: XMLIdealGeometryESSource.cc:48
XMLIdealGeometryESSource.h
XMLIdealGeometryESSource::geoConfig_
GeometryConfiguration geoConfig_
Definition: XMLIdealGeometryESSource.h:34
XMLIdealGeometryESSource::XMLIdealGeometryESSource
XMLIdealGeometryESSource(const edm::ParameterSet &p)
Definition: XMLIdealGeometryESSource.cc:21
XMLIdealGeometryESSource::rootNodeName_
std::string rootNodeName_
Definition: XMLIdealGeometryESSource.h:32
XMLIdealGeometryESSource::produceMagField
std::unique_ptr< DDCompactView > produceMagField(const IdealMagneticFieldRecord &)
Definition: XMLIdealGeometryESSource.cc:44
std
Definition: JetResolutionObject.h:76
DDRoot.h
Exception
Definition: hltDiff.cc:246
edm::IOVSyncValue::beginOfTime
static const IOVSyncValue & beginOfTime()
Definition: IOVSyncValue.cc:88
XMLIdealGeometryESSource::~XMLIdealGeometryESSource
~XMLIdealGeometryESSource() override
Definition: XMLIdealGeometryESSource.cc:40
Material.h
IdealGeometryRecord
Definition: IdealGeometryRecord.h:27
DDRotationMatrix.h