CMS 3D CMS Logo

XMLIdealGeometryESSource.cc
Go to the documentation of this file.
2 
6 
11 
16 
18 
19 #include <memory>
20 
21 
22 XMLIdealGeometryESSource::XMLIdealGeometryESSource(const edm::ParameterSet & p): rootNodeName_(p.getParameter<std::string>("rootNodeName")),
23  userNS_(p.getUntrackedParameter<bool>("userControlledNamespace", false)),
24  geoConfig_(p)
25 {
26  if ( rootNodeName_ == "" || rootNodeName_ == "\\" ) {
27  throw cms::Exception("DDException") << "XMLIdealGeometryESSource must have a root node name.";
28  }
29 
30  if ( rootNodeName_ == "MagneticFieldVolumes:MAGF" || rootNodeName_ == "cmsMagneticField:MAGF") {
32  edm::es::Label(p.getParameter<std::string>("@module_label")));
33  findingRecord<IdealMagneticFieldRecord>();
34  } else {
36  edm::es::Label(p.getParameter<std::string>("@module_label")));
37  findingRecord<IdealGeometryRecord>();
38  }
39 }
40 
42 
43 std::unique_ptr<DDCompactView>
45 {
46  return produce();
47 }
48 
49 std::unique_ptr<DDCompactView>
51 {
52  return produce();
53 }
54 
55 
56 std::unique_ptr<DDCompactView>
58 
59  DDName ddName(rootNodeName_);
60  DDLogicalPart rootNode(ddName);
61  DDRootDef::instance().set(rootNode);
62  std::unique_ptr<DDCompactView> returnValue(new DDCompactView(rootNode));
63  DDLParser parser(*returnValue); //* parser = DDLParser::instance();
65  int result2 = parser.parse(geoConfig_);
66  if (result2 != 0) throw cms::Exception("DDException") << "DDD-Parser: parsing failed!";
67 
68  // after parsing the root node should be valid!
69 
70  if( !rootNode.isValid() ){
71  throw cms::Exception("Geometry")<<"There is no valid node named \""
72  <<rootNodeName_<<"\"";
73  }
74  returnValue->lockdown();
75  return returnValue;
76 }
77 
79  const edm::IOVSyncValue & iosv,
80  edm::ValidityInterval & oValidity)
81 {
83  oValidity = infinity;
84 }
85 
86 
88 
89 
91 
92 
T getParameter(std::string const &) const
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:124
int parse(const DDLDocumentProvider &dp)
Parse all files. Return is meaningless.
Definition: DDLParser.cc:149
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:116
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:62
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 &)