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.
7 
10 
15 
16 #include <iostream>
17 
34 //
36  : rep_( new DDCompactViewImpl( rootnodedata )),
37  worldpos_( new DDPosData( DDTranslation(), DDRotation(), 0 ))
38 {
39  // 2010-01-27 I am leaving this here so that we are sure the global stores
40  // are open when a new DDCompactView is being made. Eventually I want to
41  // get rid of the need for this somehow? think about it...
42  DDMaterial::StoreT::instance().setReadOnly(false);
43  DDSolid::StoreT::instance().setReadOnly(false);
44  DDLogicalPart::StoreT::instance().setReadOnly(false);
45  DDSpecifics::StoreT::instance().setReadOnly(false);
46  DDRotation::StoreT::instance().setReadOnly(false);
47 }
48 
50 {}
51 
58 {
59  return rep_->graph();
60 }
61 
63 {
64  return const_cast<graph_type&>(rep_->graph());
65 }
66 
68 {
69  return rep_->root();
70 }
71 
73 {
74  return worldpos_.get();
75 }
76 
78 {
79  return rep_->walker();
80 }
81 
82 
101 double DDCompactView::weight(const DDLogicalPart & p) const
102 {
103  return rep_->weight(p);
104 }
105 
107  const DDLogicalPart & parent,
108  DDAlgo & algo
109  ) {
110  if (algo.rep().numRegistered() == 0) {
111  std::string e;
112  e = "DDalgoPosPart: algorithmic positioning\n";
113  e += "\t[" + algo.name().ns()
114  + ":"
115  + algo.name().name()
116  + "] is not defined!\n";
117  throw cms::Exception("DDException") << e;
118  }
119 
120  LogDebug ("AlgoPos") << "DDCompactView, algo=" << std::endl << algo << std::endl;
121  int inner=0;
122  do {
123  ++inner;
124  DDRotationMatrix * rmp = new DDRotationMatrix(algo.rotation());
125  DDRotation anonymRot = DDanonymousRot(rmp);
126  DDTranslation tr(algo.translation());
127  position(self, parent, algo.label(), tr, anonymRot);
128  algo.next();
129  }
130  while(algo.go());
131 
132 }
133 
135  const DDLogicalPart & parent,
136  std::string copyno,
137  const DDTranslation & trans,
138  const DDRotation & rot,
139  const DDDivision * div)
140 {
141  int cpno = atoi(copyno.c_str());
142  position(self,parent,cpno,trans,rot, div);
143 }
144 
146  const DDLogicalPart & parent,
147  int copyno,
148  const DDTranslation & trans,
149  const DDRotation & rot,
150  const DDDivision * div)
151 {
152  rep_->position( self, parent, copyno, trans, rot, div );
153 }
154 
155 
156 // >>---==========================<()>==========================---<<
157 
158 // UNSTABLE STUFF below ...
160 {
161  rep_->setRoot(root);
162 }
163 
164 void DDCompactView::swap( DDCompactView& repToSwap ) {
165  rep_->swap ( *(repToSwap.rep_) );
166 }
167 
169  : rep_(new DDCompactViewImpl),
170  worldpos_( new DDPosData( DDTranslation(), DDRotation(), 0 ))
171 { }
172 
174  // at this point we should have a valid store of DDObjects and we will move these
175  // to the local storage area using swaps with the existing Singleton<Store...>'s
176  // 2010-01-27 memory patch
182 
183  // 2010-01-27 memory patch
184  // not sure this will stay, but for now we want to explicitely lock the global stores.
185  // lock the global stores.
186  DDMaterial::StoreT::instance().setReadOnly(false);
187  DDSolid::StoreT::instance().setReadOnly(false);
188  DDLogicalPart::StoreT::instance().setReadOnly(false);
189  DDSpecifics::StoreT::instance().setReadOnly(false);
190  DDRotation::StoreT::instance().setReadOnly(false);
191 
192 }
193 
#define LogDebug(id)
const DDI::rep_traits< N, C >::reference rep() const
Definition: DDBase.h:89
void next()
Definition: DDAlgo.cc:102
Relative position of a child-volume inside a parent-volume.
Definition: DDPosData.h:16
const N & name() const
Definition: DDBase.h:82
DDCompactView()
Creates a compact-view.
list parent
Definition: dbtoconf.py:74
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...
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:17
graph_type & writeableGraph()
bool go() const
Definition: DDAlgo.cc:108
type of data representation of DDCompactView
Definition: DDCompactView.h:77
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:194
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:81
std::unique_ptr< DDPosData > worldpos_
DDI::Store< DDName, DDI::Solid * > solidStore_
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:88
std::unique_ptr< DDCompactViewImpl > rep_
const DDPosData * worldPosition() const
The absolute position of the world.
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:94
DDTranslation translation()
Definition: DDAlgo.cc:75
DDI::Store< DDName, DDI::LogicalPart * > lpStore_
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_
string root
initialization
Definition: dbtoconf.py:70