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") {
32  findingRecord<IdealMagneticFieldRecord>();
33  } else {
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();
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 
T getParameter(std::string const &) const
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:138
int parse(const DDLDocumentProvider &dp)
Parse all files. Return is meaningless.
Definition: DDLParser.cc:123
XMLIdealGeometryESSource(const edm::ParameterSet &p)
std::unique_ptr< DDCompactView > produce()
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:82
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:80
static value_type & instance()
bool isValid() const
true, if the wrapped pointer is valid
Definition: DDBase.h:95
static const IOVSyncValue & beginOfTime()
Definition: IOVSyncValue.cc:88
virtual void setUserNS(bool userns)
const double infinity
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:93
GeometryConfiguration geoConfig_
DDLSAX2FileHandler * getDDLSAX2FileHandler()
To get the parent this class allows access to the handler.
Definition: DDLParser.cc:53
DDLParser is the main class of Detector Description Language Parser.
Definition: DDLParser.h:63
std::unique_ptr< DDCompactView > produceGeom(const IdealGeometryRecord &)
#define DEFINE_FWK_EVENTSETUP_SOURCE(type)
Definition: SourceFactory.h:91
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
std::unique_ptr< DDCompactView > produceMagField(const IdealMagneticFieldRecord &)