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
int parse(const DDLDocumentProvider &dp)
Parse all files. Return is meaningless.
Definition: DDLParser.cc:144
XMLIdealGeometryESSource(const edm::ParameterSet &p)
std::unique_ptr< DDCompactView > produce()
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:97
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:16
virtual void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &)
type of data representation of DDCompactView
Definition: DDCompactView.h:90
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
static value_type & instance()
bool isValid() const
true, if the wrapped pointer is valid
Definition: DDBase.h:119
static const IOVSyncValue & beginOfTime()
virtual void setUserNS(bool userns)
const double infinity
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:92
GeometryConfiguration geoConfig_
DDLSAX2FileHandler * getDDLSAX2FileHandler()
To get the parent this class allows access to the handler.
Definition: DDLParser.cc:59
DDLParser is the main class of Detector Description Language Parser.
Definition: DDLParser.h:62
#define DEFINE_FWK_EVENTSETUP_SOURCE(type)
Definition: SourceFactory.h:92
std::unique_ptr< DDCompactView > produceGeom(const IdealGeometryRecord &)
std::unique_ptr< DDCompactView > produceMagField(const IdealMagneticFieldRecord &)