CMS 3D CMS Logo

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") {
35  this, &XMLIdealGeometryESSource::produceMagField, edm::es::Label(p.getParameter<std::string>("@module_label")));
36  findingRecord<IdealMagneticFieldRecord>();
37  } else {
39  this, &XMLIdealGeometryESSource::produceGeom, edm::es::Label(p.getParameter<std::string>("@module_label")));
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();
58  parser.getDDLSAX2FileHandler()->setUserNS(userNS_);
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 
electrons_cff.bool
bool
Definition: electrons_cff.py:393
funct::false
false
Definition: Factorize.h:29
DDName
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
edm::ESProducer::setWhatProduced
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
edm::ValidityInterval
Definition: ValidityInterval.h:28
writedatasetfile.parser
parser
Definition: writedatasetfile.py:7
DDLParser.h
infinity
const double infinity
Definition: CSCChamberFitter.cc:10
Specific.h
DDCompactView.h
edm::eventsetup::EventSetupRecordKey
Definition: EventSetupRecordKey.h:30
XMLIdealGeometryESSource::setIntervalFor
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
Definition: XMLIdealGeometryESSource.cc:72
FileInPath.h
XMLIdealGeometryESSource::produceGeom
std::unique_ptr< DDCompactView > produceGeom(const IdealGeometryRecord &)
Definition: XMLIdealGeometryESSource.cc:46
Solid.h
IdealMagneticFieldRecord
Definition: IdealMagneticFieldRecord.h:11
LogicalPart.h
DDCompactView
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
edm::ESProducer::usesResources
void usesResources(std::vector< std::string > const &)
Definition: ESProducer.cc:117
edm::es::Label
Definition: es_Label.h:56
DDSolid.h
SharedResourceNames.h
edm::IOVSyncValue
Definition: IOVSyncValue.h:31
DEFINE_FWK_EVENTSETUP_SOURCE
#define DEFINE_FWK_EVENTSETUP_SOURCE(type)
Definition: SourceFactory.h:91
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SourceFactory.h
DDBase::isValid
bool isValid() const
true, if the wrapped pointer is valid
Definition: DDBase.h:95
edm::ParameterSet
Definition: ParameterSet.h:47
edm::IOVSyncValue::endOfTime
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:82
DDI::Singleton::instance
static value_type & instance()
DDSpecifics.h
DDLParser
DDLParser is the main class of Detector Description Language Parser.
Definition: DDLParser.h:63
DDLogicalPart
A DDLogicalPart aggregates information concerning material, solid and sensitveness ....
Definition: DDLogicalPart.h:93
DDMaterial.h
XMLIdealGeometryESSource::userNS_
bool userNS_
Definition: XMLIdealGeometryESSource.h:33
XMLIdealGeometryESSource
Definition: XMLIdealGeometryESSource.h:16
XMLIdealGeometryESSource::produce
std::unique_ptr< DDCompactView > produce()
Definition: XMLIdealGeometryESSource.cc:52
XMLIdealGeometryESSource.h
XMLIdealGeometryESSource::geoConfig_
GeometryConfiguration geoConfig_
Definition: XMLIdealGeometryESSource.h:34
XMLIdealGeometryESSource::XMLIdealGeometryESSource
XMLIdealGeometryESSource(const edm::ParameterSet &p)
Definition: XMLIdealGeometryESSource.cc:23
XMLIdealGeometryESSource::rootNodeName_
std::string rootNodeName_
Definition: XMLIdealGeometryESSource.h:32
edm::ESSharedResourceNames::kDDGeometry
static const std::string kDDGeometry
Definition: SharedResourceNames.h:37
XMLIdealGeometryESSource::produceMagField
std::unique_ptr< DDCompactView > produceMagField(const IdealMagneticFieldRecord &)
Definition: XMLIdealGeometryESSource.cc:48
std
Definition: JetResolutionObject.h:76
DDRoot.h
DDRotationMatrix.h
Exception
Definition: hltDiff.cc:246
edm::IOVSyncValue::beginOfTime
static const IOVSyncValue & beginOfTime()
Definition: IOVSyncValue.cc:88
XMLIdealGeometryESSource::~XMLIdealGeometryESSource
~XMLIdealGeometryESSource() override
Definition: XMLIdealGeometryESSource.cc:44
Material.h
IdealGeometryRecord
Definition: IdealGeometryRecord.h:25