CMS 3D CMS Logo

XMLIdealMagneticFieldGeometryESProducer.cc
Go to the documentation of this file.
3 
6 
12 
17 
22 
23 #include <memory>
24 
26 public:
29 
30  typedef std::unique_ptr<DDCompactView> ReturnType;
31 
32  ReturnType produce(const IdealMagneticFieldRecord&);
33 
34 private:
35  std::string rootDDName_; // this must be the form namespace:name
37 
43 };
44 
46  : rootDDName_(iConfig.getParameter<std::string>("rootDDName")), label_(iConfig.getParameter<std::string>("label")) {
47  setWhatProduced(this);
48 }
49 
51 
53  const IdealMagneticFieldRecord& iRecord) {
54  using namespace edm::es;
55 
57  iRecord.getRecord<MFGeometryFileRcd>().get(label_, gdd);
58 
59  DDName ddName(rootDDName_);
60  DDLogicalPart rootNode(ddName);
61  DDRootDef::instance().set(rootNode);
62  ReturnType returnValue(new DDCompactView(rootNode));
63  DDLParser parser(*returnValue);
64  parser.getDDLSAX2FileHandler()->setUserNS(true);
65  parser.clearFiles();
66 
67  std::unique_ptr<std::vector<unsigned char> > tb = (*gdd).getUncompressedBlob();
68 
69  parser.parse(*tb, tb->size());
70 
71  returnValue->lockdown();
72 
73  return returnValue;
74 }
75 
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:138
int parse(const DDLDocumentProvider &dp)
Parse all files. Return is meaningless.
Definition: DDLParser.cc:123
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()
virtual void setUserNS(bool userns)
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:93
void clearFiles()
Clear the file list - see Warning!
Definition: DDLParser.cc:208
DDLSAX2FileHandler * getDDLSAX2FileHandler()
To get the parent this class allows access to the handler.
Definition: DDLParser.cc:53
DDLParser is the main class of Detector Description Language Parser.
Definition: DDLParser.h:63
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
ReturnType produce(const IdealMagneticFieldRecord &)