CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
XMLIdealGeometryESSource.cc
Go to the documentation of this file.
2 
8 
13 
18 
20 
21 #include <memory>
22 
23 
24 XMLIdealGeometryESSource::XMLIdealGeometryESSource(const edm::ParameterSet & p): rootNodeName_(p.getParameter<std::string>("rootNodeName")),
25  userNS_(p.getUntrackedParameter<bool>("userControlledNamespace", false)),
26  geoConfig_(p)
27 {
28  if ( rootNodeName_ == "" || rootNodeName_ == "\\" ) {
29  throw DDException ("XMLIdealGeometryESSource must have a root node name.");
30  }
31 
32  if ( rootNodeName_ == "MagneticFieldVolumes:MAGF" || rootNodeName_ == "cmsMagneticField:MAGF") {
34  edm::es::Label(p.getParameter<std::string>("@module_label")));
35  findingRecord<IdealMagneticFieldRecord>();
36  } else {
38  edm::es::Label(p.getParameter<std::string>("@module_label")));
39  findingRecord<IdealGeometryRecord>();
40  }
41 }
42 
44 
45 std::auto_ptr<DDCompactView>
47 {
48  return produce();
49 }
50 
51 std::auto_ptr<DDCompactView>
53 {
54  return produce();
55 }
56 
57 
58 std::auto_ptr<DDCompactView>
60 
61  DDName ddName(rootNodeName_);
62  DDLogicalPart rootNode(ddName);
63  DDRootDef::instance().set(rootNode);
64  std::auto_ptr<DDCompactView> returnValue(new DDCompactView(rootNode));
65  DDLParser parser(*returnValue); //* parser = DDLParser::instance();
67  int result2 = parser.parse(geoConfig_);
68  if (result2 != 0) throw DDException("DDD-Parser: parsing failed!");
69 
70  // after parsing the root node should be valid!
71 
72  if( !rootNode.isValid() ){
73  throw cms::Exception("Geometry")<<"There is no valid node named \""
74  <<rootNodeName_<<"\"";
75  }
76  returnValue->lockdown();
77  return returnValue;
78 }
79 
81  const edm::IOVSyncValue & iosv,
82  edm::ValidityInterval & oValidity)
83 {
85  oValidity = infinity;
86 }
87 
88 
90 
91 
93 
94 
T getParameter(std::string const &) const
int parse(const DDLDocumentProvider &dp)
Parse all files. Return is meaningless.
Definition: DDLParser.cc:224
XMLIdealGeometryESSource(const edm::ParameterSet &p)
An exception for DDD errors.
Definition: DDException.h:23
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:97
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:18
virtual void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &)
type of data representation of DDCompactView
Definition: DDCompactView.h:81
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
std::auto_ptr< DDCompactView > produce()
static value_type & instance()
bool isValid() const
true, if the wrapped pointer is valid
Definition: DDBase.h:130
static const IOVSyncValue & beginOfTime()
virtual void setUserNS(bool userns)
std::auto_ptr< DDCompactView > produceMagField(const IdealMagneticFieldRecord &)
const double infinity
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:95
GeometryConfiguration geoConfig_
DDLSAX2FileHandler * getDDLSAX2FileHandler()
To get the parent this class allows access to the handler.
Definition: DDLParser.cc:76
DDLParser is the main class of Detector Description Language Parser.
Definition: DDLParser.h:64
#define DEFINE_FWK_EVENTSETUP_SOURCE(type)
Definition: SourceFactory.h:74
std::auto_ptr< DDCompactView > produceGeom(const IdealGeometryRecord &)