test
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 
7 
12 
17 
19 
20 #include <memory>
21 
22 
23 XMLIdealGeometryESSource::XMLIdealGeometryESSource(const edm::ParameterSet & p): rootNodeName_(p.getParameter<std::string>("rootNodeName")),
24  userNS_(p.getUntrackedParameter<bool>("userControlledNamespace", false)),
25  geoConfig_(p)
26 {
27  if ( rootNodeName_ == "" || rootNodeName_ == "\\" ) {
28  throw cms::Exception("DDException") << "XMLIdealGeometryESSource must have a root node name.";
29  }
30 
31  if ( rootNodeName_ == "MagneticFieldVolumes:MAGF" || rootNodeName_ == "cmsMagneticField:MAGF") {
33  edm::es::Label(p.getParameter<std::string>("@module_label")));
34  findingRecord<IdealMagneticFieldRecord>();
35  } else {
37  edm::es::Label(p.getParameter<std::string>("@module_label")));
38  findingRecord<IdealGeometryRecord>();
39  }
40 }
41 
43 
44 std::auto_ptr<DDCompactView>
46 {
47  return produce();
48 }
49 
50 std::auto_ptr<DDCompactView>
52 {
53  return produce();
54 }
55 
56 
57 std::auto_ptr<DDCompactView>
59 
60  DDName ddName(rootNodeName_);
61  DDLogicalPart rootNode(ddName);
62  DDRootDef::instance().set(rootNode);
63  std::auto_ptr<DDCompactView> returnValue(new DDCompactView(rootNode));
64  DDLParser parser(*returnValue); //* parser = DDLParser::instance();
66  int result2 = parser.parse(geoConfig_);
67  if (result2 != 0) throw cms::Exception("DDException") << "DDD-Parser: parsing failed!";
68 
69  // after parsing the root node should be valid!
70 
71  if( !rootNode.isValid() ){
72  throw cms::Exception("Geometry")<<"There is no valid node named \""
73  <<rootNodeName_<<"\"";
74  }
75  returnValue->lockdown();
76  return returnValue;
77 }
78 
80  const edm::IOVSyncValue & iosv,
81  edm::ValidityInterval & oValidity)
82 {
84  oValidity = infinity;
85 }
86 
87 
89 
90 
92 
93 
T getParameter(std::string const &) const
int parse(const DDLDocumentProvider &dp)
Parse all files. Return is meaningless.
Definition: DDLParser.cc:204
XMLIdealGeometryESSource(const edm::ParameterSet &p)
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:97
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:14
virtual void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &)
type of data representation of DDCompactView
Definition: DDCompactView.h:77
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:119
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:88
GeometryConfiguration geoConfig_
DDLSAX2FileHandler * getDDLSAX2FileHandler()
To get the parent this class allows access to the handler.
Definition: DDLParser.cc:73
DDLParser is the main class of Detector Description Language Parser.
Definition: DDLParser.h:64
#define DEFINE_FWK_EVENTSETUP_SOURCE(type)
Definition: SourceFactory.h:92
std::auto_ptr< DDCompactView > produceGeom(const IdealGeometryRecord &)
volatile std::atomic< bool > shutdown_flag false