CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
XMLIdealGeometryESSource.cc
Go to the documentation of this file.
2 
4 
8 
13 
18 
20 
21 #include <memory>
22 
24  : rootNodeName_(p.getParameter<std::string>("rootNodeName")),
25  userNS_(p.getUntrackedParameter<bool>("userControlledNamespace", false)),
26  geoConfig_(p) {
28 
29  if (rootNodeName_.empty() || rootNodeName_ == "\\") {
30  throw cms::Exception("DDException") << "XMLIdealGeometryESSource must have a root node name.";
31  }
32 
33  if (rootNodeName_ == "MagneticFieldVolumes:MAGF" || rootNodeName_ == "cmsMagneticField:MAGF") {
36  findingRecord<IdealMagneticFieldRecord>();
37  } else {
40  findingRecord<IdealGeometryRecord>();
41  }
42 }
43 
45 
46 std::unique_ptr<DDCompactView> XMLIdealGeometryESSource::produceGeom(const IdealGeometryRecord &) { return produce(); }
47 
49  return produce();
50 }
51 
52 std::unique_ptr<DDCompactView> XMLIdealGeometryESSource::produce() {
53  DDName ddName(rootNodeName_);
54  DDLogicalPart rootNode(ddName);
55  DDRootDef::instance().set(rootNode);
56  std::unique_ptr<DDCompactView> returnValue(new DDCompactView(rootNode));
57  DDLParser parser(*returnValue); //* parser = DDLParser::instance();
59  int result2 = parser.parse(geoConfig_);
60  if (result2 != 0)
61  throw cms::Exception("DDException") << "DDD-Parser: parsing failed!";
62 
63  // after parsing the root node should be valid!
64 
65  if (!rootNode.isValid()) {
66  throw cms::Exception("Geometry") << "There is no valid node named \"" << rootNodeName_ << "\"";
67  }
68  returnValue->lockdown();
69  return returnValue;
70 }
71 
73  const edm::IOVSyncValue &iosv,
74  edm::ValidityInterval &oValidity) {
76  oValidity = infinity;
77 }
78 
80 
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
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:17
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
void usesResources(std::vector< std::string > const &)
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)
static const std::string kDDGeometry
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
#define DEFINE_FWK_EVENTSETUP_SOURCE(type)
Definition: SourceFactory.h:91
std::unique_ptr< DDCompactView > produceGeom(const IdealGeometryRecord &)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
std::unique_ptr< DDCompactView > produceMagField(const IdealMagneticFieldRecord &)