CMS 3D CMS Logo

XMLIdealGeometryESProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: XMLIdealGeometryESProducer
4 // Class: XMLIdealGeometryESProducer
5 //
13 //
14 // Original Author: Mike Case
15 // Created: Fri Jan 16 01:45:49 CET 2009
16 
17 
18 
19 // system include files
20 #include <memory>
21 
22 // user include files
25 
28 
35 
40 
45 
46 //
47 // class decleration
48 //
49 
51 public:
54 
55  typedef std::unique_ptr<DDCompactView> ReturnType;
56 
57  ReturnType produce(const IdealGeometryRecord&);
58 private:
59  // ----------member data ---------------------------
60  std::string rootDDName_; // this must be the form namespace:name
62  // 2009-07-09 memory patch
63  // for copying and protecting DD Store's after parsing is complete.
69 };
70 
71 //
72 // constants, enums and typedefs
73 //
74 
75 //
76 // static data member definitions
77 //
78 
79 //
80 // constructors and destructor
81 //
83  : rootDDName_(iConfig.getParameter<std::string>("rootDDName")),
84  label_(iConfig.getParameter<std::string>("label"))
85 {
86  //the following line is needed to tell the framework what
87  // data is being produced
88  setWhatProduced(this);
89  //now do what ever other initialization is needed
90 }
91 
92 
94 {
95 
96  // do anything here that needs to be done at desctruction time
97  // (e.g. close files, deallocate resources etc.)
98 
99 }
100 
101 
102 //
103 // member functions
104 //
105 
106 // ------------ method called to produce the data ------------
109 {
110  using namespace edm::es;
111 
113  iRecord.getRecord<GeometryFileRcd>().get( label_, gdd );
114 // if ( gdd.isValid() ) {
115 // std::cout << "gdd.isValid()" << std::endl;
116 // if (gdd.product() != 0) {
117 // std::cout << "object address is not zero" << std::endl;
118 // } else {
119 // std::cout << "object address is zero" << std::endl;
120 // }
121 // } else {
122 // std::cout << "gdd is NOT valid" << std::endl;
123 // }
124  DDName ddName(rootDDName_);
125  DDLogicalPart rootNode(ddName);
126  DDRootDef::instance().set(rootNode);
127  ReturnType returnValue(new DDCompactView(rootNode));
128  DDLParser parser(*returnValue);
129  parser.getDDLSAX2FileHandler()->setUserNS(true);
130  parser.clearFiles();
131 
132  std::unique_ptr<std::vector<unsigned char> > tb = (*gdd).getUncompressedBlob();
133 
134  parser.parse(*tb, tb->size());
135 
136  //std::cout << "In XMLIdealGeometryESProducer::produce" << std::endl;
137  returnValue->lockdown();
138 
139  return returnValue ;
140 }
141 
142 //define this as a plug-in
DDI::Store< DDName, DDI::Specific * > specStore_
int parse(const DDLDocumentProvider &dp)
Parse all files. Return is meaningless.
Definition: DDLParser.cc:144
DDI::Store< DDName, DDI::Material * > matStore_
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:16
XMLIdealGeometryESProducer(const edm::ParameterSet &)
type of data representation of DDCompactView
Definition: DDCompactView.h:90
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
DDI::Store< DDName, DDI::Solid * > solidStore_
ReturnType produce(const IdealGeometryRecord &)
static value_type & instance()
virtual void setUserNS(bool userns)
DDI::Store< DDName, DDI::LogicalPart * > lpStore_
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:92
void clearFiles()
Clear the file list - see Warning!
Definition: DDLParser.cc:239
DDLSAX2FileHandler * getDDLSAX2FileHandler()
To get the parent this class allows access to the handler.
Definition: DDLParser.cc:59
DDLParser is the main class of Detector Description Language Parser.
Definition: DDLParser.h:62
std::unique_ptr< DDCompactView > ReturnType
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
DDI::Store< DDName, DDRotationMatrix * > rotStore_