CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DDCompactView.cc
Go to the documentation of this file.
11 
14 
19 
20 #include <iostream>
21 
22 //DDCompactViewmpl * DDCompactView::global_ = 0;
23 
40 //
42  : rep_(new DDCompactViewImpl(rootnodedata))
43 {
44  // 2010-01-27 I am leaving this here so that we are sure the global stores
45  // are open when a new DDCompactView is being made. Eventually I want to
46  // get rid of the need for this somehow? think about it...
47  DDMaterial::StoreT::instance().setReadOnly(false);
48  DDSolid::StoreT::instance().setReadOnly(false);
49  DDLogicalPart::StoreT::instance().setReadOnly(false);
50  DDSpecifics::StoreT::instance().setReadOnly(false);
51  DDRotation::StoreT::instance().setReadOnly(false);
52 }
53 
55 {
56  if (rep_ != 0) {
57  delete rep_;
58  }
59 }
60 
67 {
68  return rep_->graph();
69 }
70 
72 {
73  return const_cast<graph_type&>(rep_->graph());
74 }
75 
77 {
78  return rep_->root();
79 }
80 
81 
83 {
84  return rep_->walker();
85 }
86 
87 
106 double DDCompactView::weight(const DDLogicalPart & p) const
107 {
108  return rep_->weight(p);
109 }
110 
112  const DDLogicalPart & parent,
113  DDAlgo & algo
114  ) {
115  static int cnt_=0;
116  ++cnt_;
117  if (algo.rep().numRegistered() == 0) {
118  std::string e;
119  e = "DDalgoPosPart: algorithmic positioning\n";
120  e += "\t[" + algo.name().ns()
121  + ":"
122  + algo.name().name()
123  + "] is not defined!\n";
124  throw DDException(e);
125  }
126 
127  LogDebug ("AlgoPos") << "DDCompactView, algo=" << std::endl << algo << std::endl;
128  int inner=0;
129  do {
130  ++inner;
131  DDRotationMatrix * rmp = new DDRotationMatrix(algo.rotation());
132  DDRotation anonymRot = DDanonymousRot(rmp);
133  DDTranslation tr(algo.translation());
134  position(self, parent, algo.label(), tr, anonymRot);
135  algo.next();
136  }
137  while(algo.go());
138 
139 }
140 
142  const DDLogicalPart & parent,
143  std::string copyno,
144  const DDTranslation & trans,
145  const DDRotation & rot,
146  const DDDivision * div)
147 {
148  int cpno = atoi(copyno.c_str());
149  position(self,parent,cpno,trans,rot, div);
150 }
151 
153  const DDLogicalPart & parent,
154  int copyno,
155  const DDTranslation & trans,
156  const DDRotation & rot,
157  const DDDivision * div)
158 {
159  rep_->position( self, parent, copyno, trans, rot, div );
160 }
161 
162 
163 // >>---==========================<()>==========================---<<
164 
165 // UNSTABLE STUFF below ...
167 {
168  rep_->setRoot(root);
169 }
170 
171 void DDCompactView::swap( DDCompactView& repToSwap ) {
172  rep_->swap ( *(repToSwap.rep_) );
173 }
174 
176 
178  // at this point we should have a valid store of DDObjects and we will move these
179  // to the local storage area using swaps with the existing Singleton<Store...>'s
180  // 2010-01-27 memory patch
186 
187  // 2010-01-27 memory patch
188  // not sure this will stay, but for now we want to explicitely lock the global stores.
189  // lock the global stores.
190  DDMaterial::StoreT::instance().setReadOnly(false);
191  DDSolid::StoreT::instance().setReadOnly(false);
192  DDLogicalPart::StoreT::instance().setReadOnly(false);
193  DDSpecifics::StoreT::instance().setReadOnly(false);
194  DDRotation::StoreT::instance().setReadOnly(false);
195 
196 }
197 
#define LogDebug(id)
const DDI::rep_traits< N, C >::reference rep() const
Definition: DDBase.h:95
void next()
Definition: DDAlgo.cc:105
void position(const DDLogicalPart &self, const DDLogicalPart &parent, int copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div)
const N & name() const
Definition: DDBase.h:88
DDCompactView()
Creates a compact-view.
graphwalker< DDLogicalPart, DDPosData * > walker() const
list parent
Definition: dbtoconf.py:74
DDCompactViewImpl * rep_
void setRoot(const DDLogicalPart &root)
double weight(const DDLogicalPart &p) const
Prototype version of calculating the weight of a detector component.
void algoPosPart(const DDLogicalPart &self, const DDLogicalPart &parent, DDAlgo &algo)
positioning...
An exception for DDD errors.
Definition: DDException.h:23
const graph_type & graph() const
Provides read-only access to the data structure of the compact-view.
void position(const DDLogicalPart &self, const DDLogicalPart &parent, std::string copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=NULL)
const std::string & ns() const
Returns the namespace.
Definition: DDName.cc:101
Definition: DDAlgo.h:21
graph_type & writeableGraph()
bool go() const
Definition: DDAlgo.cc:111
type of data representation of DDCompactView
Definition: DDCompactView.h:81
void setRoot(const DDLogicalPart &root)
don&#39;t use : interface not stable ....
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
DDRotation DDanonymousRot(DDRotationMatrix *rot)
Defines a anonymous rotation or rotation-reflection matrix.
Definition: DDRotation.cc:198
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:66
static value_type & instance()
DDI::Store< DDName, DDI::Specific * > specStore_
void swap(DDCompactView &)
DDRotationMatrix rotation()
Definition: DDAlgo.cc:84
DDI::Store< DDName, DDI::Solid * > solidStore_
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:95
void swap(DDCompactViewImpl &)
DDI::Store< DDName, DDRotationMatrix * > rotStore_
walker_type walker() const
dont&#39;t use ! Proper implementation missing ...
const DDLogicalPart & root() const
returns the DDLogicalPart representing the root of the geometrical hierarchy
std::string label() const
Definition: DDAlgo.cc:97
const DDLogicalPart & root() const
DDTranslation translation()
Definition: DDAlgo.cc:78
DDI::Store< DDName, DDI::LogicalPart * > lpStore_
double weight(const DDLogicalPart &) const
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
const std::string & name() const
Returns the name.
Definition: DDName.cc:87
DDI::Store< DDName, DDI::Material * > matStore_
const GraphNav & graph() const
string root
initialization
Definition: dbtoconf.py:70