CMS 3D CMS Logo

XMLIdealGeometryESProducer.cc
Go to the documentation of this file.
11 
12 #include <memory>
13 
15 {
16 public:
18 
19  using ReturnType = std::unique_ptr<DDCompactView>;
20 
22 
23 private:
24 
25  std::string rootDDName_; // this must be the form namespace:name
27 };
28 
30  : rootDDName_( iConfig.getParameter<std::string>( "rootDDName" )),
31  label_( iConfig.getParameter<std::string>( "label" ))
32 {
33  setWhatProduced( this );
34 }
35 
38 {
40  iRecord.getRecord<GeometryFileRcd>().get( label_, gdd );
41  DDName ddName( rootDDName_ );
42  DDLogicalPart rootNode( ddName );
43  DDRootDef::instance().set( rootNode );
44  auto cpv = std::make_unique<DDCompactView>( rootNode );
45  DDLParser parser( *cpv );
46  parser.getDDLSAX2FileHandler()->setUserNS( true );
47  parser.clearFiles();
48 
49  std::unique_ptr<std::vector<unsigned char> > tb = (*gdd).getUncompressedBlob();
50 
51  parser.parse( *tb, tb->size());
52 
53  cpv->lockdown();
54 
55  return cpv;
56 }
57 
58 //define this as a plug-in
std::unique_ptr< DDCompactView > ReturnType
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
XMLIdealGeometryESProducer(const edm::ParameterSet &)
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
ReturnType produce(const IdealGeometryRecord &)
static value_type & instance()
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:92
DDLParser is the main class of Detector Description Language Parser.
Definition: DDLParser.h:63
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60