CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 #include "boost/shared_ptr.hpp"
22 
23 // user include files
26 
29 
36 
41 
46 
47 //
48 // class decleration
49 //
50 
52 public:
55 
56  typedef std::auto_ptr<DDCompactView> ReturnType;
57 
59 private:
60  // ----------member data ---------------------------
61  std::string rootDDName_; // this must be the form namespace:name
63  // 2009-07-09 memory patch
64  // for copying and protecting DD Store's after parsing is complete.
70 };
71 
72 //
73 // constants, enums and typedefs
74 //
75 
76 //
77 // static data member definitions
78 //
79 
80 //
81 // constructors and destructor
82 //
84  : rootDDName_(iConfig.getParameter<std::string>("rootDDName")),
85  label_(iConfig.getParameter<std::string>("label"))
86 {
87  //the following line is needed to tell the framework what
88  // data is being produced
89  setWhatProduced(this);
90  //now do what ever other initialization is needed
91 }
92 
93 
95 {
96 
97  // do anything here that needs to be done at desctruction time
98  // (e.g. close files, deallocate resources etc.)
99 
100 }
101 
102 
103 //
104 // member functions
105 //
106 
107 // ------------ method called to produce the data ------------
110 {
111  using namespace edm::es;
112 
114  iRecord.getRecord<GeometryFileRcd>().get( label_, gdd );
115 // if ( gdd.isValid() ) {
116 // std::cout << "gdd.isValid()" << std::endl;
117 // if (gdd.product() != 0) {
118 // std::cout << "object address is not zero" << std::endl;
119 // } else {
120 // std::cout << "object address is zero" << std::endl;
121 // }
122 // } else {
123 // std::cout << "gdd is NOT valid" << std::endl;
124 // }
125  DDName ddName(rootDDName_);
126  DDLogicalPart rootNode(ddName);
127  DDRootDef::instance().set(rootNode);
128  ReturnType returnValue(new DDCompactView(rootNode));
129  DDLParser parser(*returnValue);
130  parser.getDDLSAX2FileHandler()->setUserNS(true);
131  parser.clearFiles();
132 
133  std::unique_ptr<std::vector<unsigned char> > tb = (*gdd).getUncompressedBlob();
134 
135  parser.parse(*tb, tb->size());
136 
137  //std::cout << "In XMLIdealGeometryESProducer::produce" << std::endl;
138  returnValue->lockdown();
139 
140  return returnValue ;
141 }
142 
143 //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:204
DDI::Store< DDName, DDI::Material * > matStore_
std::auto_ptr< DDCompactView > ReturnType
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:18
XMLIdealGeometryESProducer(const edm::ParameterSet &)
type of data representation of DDCompactView
Definition: DDCompactView.h:76
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:88
void clearFiles()
Clear the file list - see Warning!
Definition: DDLParser.cc:373
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_MODULE(type)
Definition: ModuleFactory.h:60
DDI::Store< DDName, DDRotationMatrix * > rotStore_