Go to the documentation of this file.00001 #include "DetectorDescription/Core/interface/DDCompactView.h"
00002 #include "DetectorDescription/Core/interface/DDLogicalPart.h"
00003 #include "DetectorDescription/Core/interface/DDMaterial.h"
00004 #include "DetectorDescription/Core/interface/DDSolid.h"
00005 #include "DetectorDescription/Core/interface/DDName.h"
00006 #include "DetectorDescription/ExprAlgo/interface/AlgoPos.h"
00007
00008 #include "DetectorDescription/Core/interface/DDSpecifics.h"
00009 #include "DetectorDescription/Base/interface/DDRotationMatrix.h"
00010
00011 #include "DetectorDescription/Core/src/Material.h"
00012 #include "DetectorDescription/Core/src/Solid.h"
00013 #include "DetectorDescription/Core/src/LogicalPart.h"
00014 #include "DetectorDescription/Core/src/Specific.h"
00015
00016 #include <iostream>
00017
00018
00019
00036
00037 DDCompactView::DDCompactView(const DDLogicalPart & rootnodedata)
00038 : rep_(new DDCompactViewImpl(rootnodedata))
00039 {
00040
00041
00042
00043 DDMaterial::StoreT::instance().setReadOnly(false);
00044 DDSolid::StoreT::instance().setReadOnly(false);
00045 DDLogicalPart::StoreT::instance().setReadOnly(false);
00046 DDSpecifics::StoreT::instance().setReadOnly(false);
00047 DDRotation::StoreT::instance().setReadOnly(false);
00048 }
00049
00050 DDCompactView::~DDCompactView()
00051 {
00052 if (rep_ != 0) {
00053 delete rep_;
00054 }
00055 }
00056
00062 const DDCompactView::graph_type & DDCompactView::graph() const
00063 {
00064 return rep_->graph();
00065 }
00066
00067 DDCompactView::graph_type & DDCompactView::writeableGraph()
00068 {
00069 return const_cast<graph_type&>(rep_->graph());
00070 }
00071
00072 const DDLogicalPart & DDCompactView::root() const
00073 {
00074 return rep_->root();
00075 }
00076
00077
00078 DDCompactView::walker_type DDCompactView::walker() const
00079 {
00080 return rep_->walker();
00081 }
00082
00083
00102 double DDCompactView::weight(const DDLogicalPart & p) const
00103 {
00104 return rep_->weight(p);
00105 }
00106
00107 void DDCompactView::algoPosPart(const DDLogicalPart & self,
00108 const DDLogicalPart & parent,
00109 DDAlgo & algo
00110 ) {
00111 static int cnt_=0;
00112 ++cnt_;
00113 if (algo.rep().numRegistered() == 0) {
00114 std::string e;
00115 e = "DDalgoPosPart: algorithmic positioning\n";
00116 e += "\t[" + algo.name().ns()
00117 + ":"
00118 + algo.name().name()
00119 + "] is not defined!\n";
00120 throw cms::Exception("DDException") << e;
00121 }
00122
00123 LogDebug ("AlgoPos") << "DDCompactView, algo=" << std::endl << algo << std::endl;
00124 int inner=0;
00125 do {
00126 ++inner;
00127 DDRotationMatrix * rmp = new DDRotationMatrix(algo.rotation());
00128 DDRotation anonymRot = DDanonymousRot(rmp);
00129 DDTranslation tr(algo.translation());
00130 position(self, parent, algo.label(), tr, anonymRot);
00131 algo.next();
00132 }
00133 while(algo.go());
00134
00135 }
00136
00137 void DDCompactView::position (const DDLogicalPart & self,
00138 const DDLogicalPart & parent,
00139 std::string copyno,
00140 const DDTranslation & trans,
00141 const DDRotation & rot,
00142 const DDDivision * div)
00143 {
00144 int cpno = atoi(copyno.c_str());
00145 position(self,parent,cpno,trans,rot, div);
00146 }
00147
00148 void DDCompactView::position (const DDLogicalPart & self,
00149 const DDLogicalPart & parent,
00150 int copyno,
00151 const DDTranslation & trans,
00152 const DDRotation & rot,
00153 const DDDivision * div)
00154 {
00155 rep_->position( self, parent, copyno, trans, rot, div );
00156 }
00157
00158
00159
00160
00161
00162 void DDCompactView::setRoot(const DDLogicalPart & root)
00163 {
00164 rep_->setRoot(root);
00165 }
00166
00167 void DDCompactView::swap( DDCompactView& repToSwap ) {
00168 rep_->swap ( *(repToSwap.rep_) );
00169 }
00170
00171 DDCompactView::DDCompactView() : rep_(new DDCompactViewImpl) { }
00172
00173 void DDCompactView::lockdown() {
00174
00175
00176
00177 DDMaterial::StoreT::instance().swap(matStore_);
00178 DDSolid::StoreT::instance().swap(solidStore_);
00179 DDLogicalPart::StoreT::instance().swap(lpStore_);
00180 DDSpecifics::StoreT::instance().swap(specStore_);
00181 DDRotation::StoreT::instance().swap(rotStore_);
00182
00183
00184
00185
00186 DDMaterial::StoreT::instance().setReadOnly(false);
00187 DDSolid::StoreT::instance().setReadOnly(false);
00188 DDLogicalPart::StoreT::instance().setReadOnly(false);
00189 DDSpecifics::StoreT::instance().setReadOnly(false);
00190 DDRotation::StoreT::instance().setReadOnly(false);
00191
00192 }
00193