00001
00002
00003
00005
00006 #include <cmath>
00007 #include <algorithm>
00008
00009 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00010 #include "DetectorDescription/Base/interface/DDutils.h"
00011 #include "DetectorDescription/Core/interface/DDLogicalPart.h"
00012 #include "DetectorDescription/Core/interface/DDSolid.h"
00013 #include "DetectorDescription/Core/interface/DDMaterial.h"
00014 #include "DetectorDescription/Core/interface/DDCurrentNamespace.h"
00015 #include "DetectorDescription/Core/interface/DDSplit.h"
00016 #include "Geometry/MTCCTrackerCommonData/interface/DDTIBLayerAlgo_MTCC.h"
00017 #include "CLHEP/Units/GlobalPhysicalConstants.h"
00018 #include "CLHEP/Units/GlobalSystemOfUnits.h"
00019
00020 DDTIBLayerAlgo_MTCC::DDTIBLayerAlgo_MTCC(): ribW(0),ribPhi(0) {
00021 LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC info: Creating an instance";
00022 }
00023
00024 DDTIBLayerAlgo_MTCC::~DDTIBLayerAlgo_MTCC() {}
00025
00026 void DDTIBLayerAlgo_MTCC::initialize(const DDNumericArguments & nArgs,
00027 const DDVectorArguments & vArgs,
00028 const DDMapArguments & ,
00029 const DDStringArguments & sArgs,
00030 const DDStringVectorArguments & ) {
00031
00032 idNameSpace = DDCurrentNamespace::ns();
00033 genMat = sArgs["GeneralMaterial"];
00034 DDName parentName = parent().name();
00035 LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC debug: Parent " << parentName
00036 << " NameSpace " << idNameSpace << " General Material "
00037 << genMat;
00038
00039 detectorTilt = nArgs["DetectorTilt"];
00040 layerL = nArgs["LayerL"];
00041 detectorTol = nArgs["LayerTolerance"];
00042 detectorW = nArgs["DetectorWidth"];
00043 detectorT = nArgs["DetectorThickness"];
00044 coolTubeW = nArgs["CoolTubeWidth"];
00045 coolTubeT = nArgs["CoolTubeThickness"];
00046 LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC debug: Tilt Angle "
00047 << detectorTilt/CLHEP::deg << " Layer Length/tolerance "
00048 << layerL << " " << detectorTol
00049 << " Detector layer Width/Thick " << detectorW << ", "
00050 << detectorT << " Cooling Tube/Cable layer Width/Thick "
00051 << coolTubeW << ", " << coolTubeT;
00052
00053 radiusLo = nArgs["RadiusLo"];
00054 phioffLo = nArgs["PhiOffsetLo"];
00055 phiMinLo = nArgs["PhiMinimumLo"];
00056 phiMaxLo = nArgs["PhiMaximumLo"];
00057 stringsLo = int(nArgs["StringsLo"]);
00058 stringLoList = vArgs["StringLoList"];
00059 detectorLo = sArgs["StringDetLoName"];
00060 emptyDetectorLo = sArgs["EmptyStringDetLoName"];
00061 roffDetLo = nArgs["ROffsetDetLo"];
00062 coolCableLo = sArgs["StringCabLoName"];
00063 emptyCoolCableLo = sArgs["EmptyStringCabLoName"];
00064 roffCableLo = nArgs["ROffsetCabLo"];
00065 LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC debug: Lower layer Radius "
00066 << radiusLo << " Phi offset " << phioffLo/CLHEP::deg
00067 << " min " << phiMinLo/CLHEP::deg << " max "
00068 << phiMaxLo/CLHEP::deg << " Number " << stringsLo
00069 << " String " << detectorLo << " at offset "
00070 << roffDetLo << " String " << coolCableLo <<" at offset "
00071 << roffCableLo << " Strings filled: ";
00072 for(unsigned int i=0; i<stringLoList.size(); i++) {
00073 LogDebug("TIBGeom") << "String " << i << " " << (int)stringLoList[i];
00074 }
00075 LogDebug("TIBGeom") << " Empty String " << emptyDetectorLo << " at offset "
00076 << roffDetLo << " Empty String " << emptyCoolCableLo
00077 << " at offset " << roffCableLo;
00078
00079 radiusUp = nArgs["RadiusUp"];
00080 phioffUp = nArgs["PhiOffsetUp"];
00081 phiMinUp = nArgs["PhiMinimumUp"];
00082 phiMaxUp = nArgs["PhiMaximumUp"];
00083 stringsUp = int(nArgs["StringsUp"]);
00084 stringUpList = vArgs["StringUpList"];
00085 detectorUp = sArgs["StringDetUpName"];
00086 emptyDetectorUp = sArgs["EmptyStringDetUpName"];
00087 roffDetUp = nArgs["ROffsetDetUp"];
00088 coolCableUp = sArgs["StringCabUpName"];
00089 emptyCoolCableUp = sArgs["EmptyStringCabUpName"];
00090 roffCableUp = nArgs["ROffsetCabUp"];
00091 LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC debug: Upper layer Radius "
00092 << radiusUp << " Phi offset " << phioffUp/CLHEP::deg
00093 << " min " << phiMinUp/CLHEP::deg << " max "
00094 << phiMaxUp/CLHEP::deg << " Number " << stringsUp
00095 << " String " << detectorUp << " at offset " << roffDetUp
00096 << " String " << coolCableUp << " at offset "
00097 << roffCableUp << " Strings filled: ";
00098 for(unsigned int i=0; i<stringUpList.size(); i++) {
00099 LogDebug("TIBGeom") << "String " << i << " " << (int)stringUpList[i];
00100 }
00101 LogDebug("TIBGeom") << " Empty String " << emptyDetectorUp << " at offset "
00102 << roffDetUp << " Empty String " << emptyCoolCableUp
00103 << " at offset " << roffCableUp;
00104
00105 cylinderT = nArgs["CylinderThickness"];
00106 cylinderMat = sArgs["CylinderMaterial"];
00107 supportW = nArgs["SupportWidth"];
00108 supportT = nArgs["SupportThickness"];
00109 supportMat = sArgs["SupportMaterial"];
00110 ribMat = sArgs["RibMaterial"];
00111 ribW = vArgs["RibWidth"];
00112 ribPhi = vArgs["RibPhi"];
00113 LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC debug: Cylinder Material/"
00114 << "thickness " << cylinderMat << " " << cylinderT
00115 << " Support Wall Material/Width/Thickness "
00116 << supportMat << " " << supportW << " " << supportT
00117 << " Rib Material " << ribMat << " at "
00118 << ribW.size() << " positions with width/phi";
00119 for (unsigned int i = 0; i < ribW.size(); i++)
00120 LogDebug("TIBGeom") << "Rib " << i << " " << ribW[i] << " "
00121 << ribPhi[i]/CLHEP::deg;
00122
00123 dohmN = int(nArgs["DOHMPhiNumber"]);
00124 dohmCarrierW = nArgs["DOHMCarrierWidth"];
00125 dohmCarrierT = nArgs["DOHMCarrierThickness"];
00126 dohmCarrierR = nArgs["DOHMCarrierRadialHeight"];
00127 dohmCarrierMaterial = sArgs["DOHMCarrierMaterial"];
00128 dohmCableMaterial = sArgs["DOHMCableMaterial"];
00129 dohmPrimW = nArgs["DOHMPRIMWidth"];
00130 dohmPrimL = nArgs["DOHMPRIMLength"];
00131 dohmPrimT = nArgs["DOHMPRIMThickness"];
00132 dohmPrimMaterial = sArgs["DOHMPRIMMaterial"];
00133 dohmAuxW = nArgs["DOHMAUXWidth"];
00134 dohmAuxL = nArgs["DOHMAUXLength"];
00135 dohmAuxT = nArgs["DOHMAUXThickness"];
00136 dohmAuxMaterial = sArgs["DOHMAUXMaterial"];
00137 dohmList = vArgs["DOHMList"];
00138 LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC debug: DOHM PRIMary " << dohmN
00139 << " Width/Length/Thickness " << " Material "
00140 << dohmPrimMaterial << " " << dohmPrimW << " "
00141 << dohmPrimL << " " << dohmPrimT
00142 << " at positions:";
00143 for(unsigned int i=0; i<dohmList.size(); i++) {
00144 if((int)dohmList[i]>0) LogDebug("TIBGeom") << i+1 << ",";
00145 }
00146 LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC debug: DOHM AUXiliary "
00147 << " Material " << dohmAuxMaterial << " "
00148 << dohmAuxW << " " << dohmAuxL << " " << dohmAuxT
00149 << " at positions:";
00150 for(unsigned int i=0; i<dohmList.size(); i++) {
00151 if((int)dohmList[i]==2) LogDebug("TIBGeom") << i+1 << ",";
00152 }
00153 LogDebug("TIBGeom") << " in Carrier Width/Thickness/Radius "
00154 << dohmCarrierW << " " << dohmCarrierT << " "
00155 << dohmCarrierR << " Carrier Material "
00156 << dohmCarrierMaterial
00157 << "\n with cables and connectors Material "
00158 << dohmCableMaterial << "\n"
00159 << "DDTIBLayerAlgo_MTCC debug: no DOHM "
00160 << " at positions: ";
00161 for(unsigned int i=0; i<dohmList.size(); i++) {
00162 if((int)dohmList[i]==0) LogDebug("TIBGeom") << i+1 << ",";
00163 }
00164
00165 }
00166
00167
00168 void DDTIBLayerAlgo_MTCC::execute(DDCompactView& cpv) {
00169
00170 LogDebug("TIBGeom") << "==>> Constructing DDTIBLayerAlgo_MTCC...";
00171
00172
00173 double rotsi = std::abs(detectorTilt);
00174 double redgd1 = 0.5*(detectorW*sin(rotsi)+detectorT*cos(rotsi));
00175 double redgd2 = 0.5*(detectorW*cos(rotsi)-detectorT*sin(rotsi));
00176 double redgc1 = 0.5*(coolTubeW*sin(rotsi)+coolTubeT*cos(rotsi));
00177 double redgc2 = 0.5*(coolTubeW*cos(rotsi)-coolTubeT*sin(rotsi));
00178 LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test DeltaR (Detector Tilt) "
00179 << redgd1 << ", " << redgd2 << " DeltaR (Cable+Cool) "
00180 << redgc1 << ", " << redgc2;
00181
00182 DDName parentName = parent().name();
00183 const std::string &idName = parentName.name();
00184 double rmin = radiusLo + roffDetLo - redgd1 - detectorTol;
00185 double rmax = sqrt((radiusUp+roffDetUp+redgd1)*(radiusUp+roffDetUp+redgd1)+
00186 redgd2*redgd2) + detectorTol;
00187 DDSolid solid = DDSolidFactory::tubs(DDName(idName, idNameSpace), 0.5*layerL,
00188 rmin, rmax, 0, CLHEP::twopi);
00189 LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
00190 << DDName(idName,idNameSpace) << " Tubs made of "
00191 << genMat << " from 0 to " << CLHEP::twopi/CLHEP::deg
00192 << " with Rin " << rmin << " Rout " << rmax << " ZHalf "
00193 << 0.5*layerL;
00194 DDName matname(DDSplit(genMat).first, DDSplit(genMat).second);
00195 DDMaterial matter(matname);
00196 DDLogicalPart layer(solid.ddname(), matter, solid);
00197
00198
00199 double rin = rmin;
00200 double rout = 0.5*(radiusLo+radiusUp-cylinderT);
00201 std::string name = idName + "Down";
00202 solid = DDSolidFactory::tubs(DDName(name, idNameSpace), 0.5*layerL,
00203 rin, rout, 0, CLHEP::twopi);
00204 LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
00205 << DDName(name, idNameSpace) << " Tubs made of "
00206 << genMat << " from 0 to " << CLHEP::twopi/CLHEP::deg
00207 << " with Rin " << rin << " Rout " << rout << " ZHalf "
00208 << 0.5*layerL;
00209 DDLogicalPart layerIn(solid.ddname(), matter, solid);
00210 cpv.position(layerIn, layer, 1, DDTranslation(0.0, 0.0, 0.0), DDRotation());
00211 LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: " << layerIn.name()
00212 << " number 1 positioned in " << layer.name()
00213 << " at (0,0,0) with no rotation";
00214
00215 double rposdet = radiusLo + roffDetLo;
00216 double rposcab = rposdet + roffCableLo;
00217 double dphi = CLHEP::twopi/stringsLo;
00218 DDName detIn(DDSplit(detectorLo).first, DDSplit(detectorLo).second);
00219 DDName cabIn(DDSplit(coolCableLo).first, DDSplit(coolCableLo).second);
00220 for (int n = 0; n < stringsLo; n++) {
00221 double phi = phioffLo + n*dphi;
00222 if( phi>=phiMinLo && phi<phiMaxLo ) {
00223 double phix = phi - detectorTilt + 90*CLHEP::deg;
00224 double phideg = phix/CLHEP::deg;
00225 DDRotation rotation;
00226 if (phideg != 0) {
00227 double theta = 90*CLHEP::deg;
00228 double phiy = phix + 90.*CLHEP::deg;
00229 std::string rotstr = idName + dbl_to_string(phideg*10.);
00230 rotation = DDRotation(DDName(rotstr, idNameSpace));
00231 if (!rotation) {
00232 LogDebug("TIBGeom") << "DDTIBLayer_MTCC test: Creating a new "
00233 << "rotation: " << rotstr << "\t90., "
00234 << phix/CLHEP::deg << ", 90.,"
00235 << phiy/CLHEP::deg << ", 0, 0";
00236 rotation = DDrot(DDName(rotstr, idNameSpace), theta,phix, theta,phiy,
00237 0., 0.);
00238 }
00239 }
00240
00241
00242 bool empty=true;
00243 for(unsigned int i=0; i<stringLoList.size(); i++) {
00244 if(n+1==(int)stringLoList[i]) {
00245 empty=false;
00246 }
00247 }
00248 if(empty) {
00249 if(emptyDetectorLo!="nothing") {
00250 DDName emptyDetIn(DDSplit(emptyDetectorLo).first, DDSplit(emptyDetectorLo).second);
00251 DDTranslation trdet(rposdet*cos(phi), rposdet*sin(phi), 0);
00252 cpv.position(emptyDetIn, layerIn, n+1, trdet, rotation);
00253 LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << emptyDetIn.name()
00254 << " number " << n+1 << " positioned in "
00255 << layerIn.name() << " at " << trdet
00256 << " with " << rotation;
00257 }
00258 if(emptyCoolCableLo!="nothing") {
00259 DDName emptyCabIn(DDSplit(emptyCoolCableLo).first, DDSplit(emptyCoolCableLo).second);
00260 DDTranslation trcab(rposcab*cos(phi), rposcab*sin(phi), 0);
00261 cpv.position(emptyCabIn, layerIn, n+1, trcab, rotation);
00262 LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << emptyCabIn.name()
00263 << " number " << n+1 << " positioned in "
00264 << layerIn.name() << " at " << trcab
00265 << " with " << rotation;
00266 }
00267 } else {
00268 DDTranslation trdet(rposdet*cos(phi), rposdet*sin(phi), 0);
00269 cpv.position(detIn, layerIn, n+1, trdet, rotation);
00270 LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << detIn.name()
00271 << " number " << n+1 << " positioned in "
00272 << layerIn.name() << " at " << trdet
00273 << " with " << rotation;
00274 DDTranslation trcab(rposcab*cos(phi), rposcab*sin(phi), 0);
00275 cpv.position(cabIn, layerIn, n+1, trcab, rotation);
00276 LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << cabIn.name()
00277 << " number " << n+1 << " positioned in "
00278 << layerIn.name() << " at " << trcab
00279 << " with " << rotation;
00280 }
00281
00282
00283 }
00284
00285 }
00286
00287
00288 rin = 0.5*(radiusLo+radiusUp+cylinderT);
00289 rout = rmax;
00290 name = idName + "Up";
00291 solid = DDSolidFactory::tubs(DDName(name, idNameSpace), 0.5*layerL,
00292 rin, rout, 0, CLHEP::twopi);
00293 LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
00294 << DDName(name, idNameSpace) << " Tubs made of "
00295 << genMat << " from 0 to " << CLHEP::twopi/CLHEP::deg
00296 << " with Rin " << rin << " Rout " << rout << " ZHalf "
00297 << 0.5*layerL;
00298 DDLogicalPart layerOut(solid.ddname(), matter, solid);
00299 cpv.position(layerOut, layer, 1, DDTranslation(0.0, 0.0, 0.0), DDRotation());
00300 LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: " << layerOut.name()
00301 << " number 1 positioned in " << layer.name()
00302 << " at (0,0,0) with no rotation";
00303
00304 rposdet = radiusUp + roffDetUp;
00305 rposcab = rposdet + roffCableUp;
00306 dphi = CLHEP::twopi/stringsUp;
00307 DDName detOut(DDSplit(detectorUp).first, DDSplit(detectorUp).second);
00308 DDName cabOut(DDSplit(coolCableUp).first, DDSplit(coolCableUp).second);
00309 for (int n = 0; n < stringsUp; n++) {
00310 double phi = phioffUp + n*dphi;
00311 if( phi>=phiMinUp && phi<phiMaxUp ) {
00312 double phix = phi - detectorTilt - 90*CLHEP::deg;
00313 double phideg = phix/CLHEP::deg;
00314 DDRotation rotation;
00315 if (phideg != 0) {
00316 double theta = 90*CLHEP::deg;
00317 double phiy = phix + 90.*CLHEP::deg;
00318 std::string rotstr = idName + dbl_to_string(phideg*10.);
00319 rotation = DDRotation(DDName(rotstr, idNameSpace));
00320 if (!rotation) {
00321 LogDebug("TIBGeom") << "DDTIBLayer_MTCC test: Creating a new "
00322 << "rotation: " << rotstr << "\t90., "
00323 << phix/CLHEP::deg << ", 90.,"
00324 << phiy/CLHEP::deg << ", 0, 0";
00325 rotation = DDrot(DDName(rotstr, idNameSpace), theta,phix, theta,phiy,
00326 0., 0.);
00327 }
00328 }
00329
00330
00331 bool empty=true;
00332 for(unsigned int i=0; i<stringUpList.size(); i++) {
00333 if(n+1==(int)stringUpList[i]) {
00334 empty=false;
00335 }
00336 }
00337 if(empty) {
00338 if(emptyDetectorUp!="nothing") {
00339 DDName emptyDetOut(DDSplit(emptyDetectorUp).first, DDSplit(emptyDetectorUp).second);
00340 DDTranslation trdet(rposdet*cos(phi), rposdet*sin(phi), 0);
00341 cpv.position(emptyDetOut, layerOut, n+1, trdet, rotation);
00342 LogDebug("TIBGeom") << "DDTIBLayer test " << emptyDetOut.name()
00343 << " number " << n+1 << " positioned in "
00344 << layerOut.name() << " at " << trdet
00345 << " with " << rotation;
00346
00347 }
00348 if(emptyCoolCableUp!="nothing") {
00349 DDName emptyCabOut(DDSplit(emptyCoolCableUp).first, DDSplit(emptyCoolCableUp).second);
00350 DDTranslation trcab(rposcab*cos(phi), rposcab*sin(phi), 0);
00351 cpv.position(emptyCabOut, layerOut, n+1, trcab, rotation);
00352 LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << emptyCabOut.name()
00353 << " number " << n+1 << " positioned in "
00354 << layerOut.name() << " at " << trcab
00355 << " with " << rotation;
00356 }
00357 } else {
00358 DDTranslation trdet(rposdet*cos(phi), rposdet*sin(phi), 0);
00359 cpv.position(detOut, layerOut, n+1, trdet, rotation);
00360 LogDebug("TIBGeom") << "DDTIBLayer test " << detOut.name()
00361 << " number " << n+1 << " positioned in "
00362 << layerOut.name() << " at " << trdet
00363 << " with " << rotation;
00364 DDTranslation trcab(rposcab*cos(phi), rposcab*sin(phi), 0);
00365 cpv.position(cabOut, layerOut, n+1, trcab, rotation);
00366 LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << cabOut.name()
00367 << " number " << n+1 << " positioned in "
00368 << layerOut.name() << " at " << trcab
00369 << " with " << rotation;
00370 }
00371
00372
00373 }
00374
00375 }
00376
00377 double phiMin = phiMinUp-phioffUp;
00378 double phiMax = phiMaxUp-phioffUp;
00379 double phidiff = fabs(phiMax-phiMin);
00380
00381 rin = 0.5*(radiusLo+radiusUp-cylinderT);
00382 rout = 0.5*(radiusLo+radiusUp+cylinderT);
00383 name = idName + "Cylinder";
00384 solid = DDSolidFactory::tubs(DDName(name, idNameSpace), 0.25*layerL,
00385 rin, rout, phiMin, phidiff);
00386 LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
00387 << DDName(name, idNameSpace) << " Tubs made of "
00388 << cylinderMat << " from " << phiMin/CLHEP::deg << " to "
00389 << (phiMin+phidiff)/CLHEP::deg << " with Rin " << rin
00390 << " Rout " << rout << " ZHalf " << 0.25*layerL;
00391 matname = DDName(DDSplit(cylinderMat).first, DDSplit(cylinderMat).second);
00392 DDMaterial matcyl(matname);
00393 DDLogicalPart cylinder(solid.ddname(), matcyl, solid);
00394 cpv.position(cylinder, layer, 1, DDTranslation(0.0,0.0,0.25*layerL), DDRotation());
00395 LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: " << cylinder.name()
00396 << " number 1 positioned in " << layer.name()
00397 << " at (0,0," << 0.25*layerL << ") with no rotation";
00398 rin += supportT;
00399 rout -= supportT;
00400 name = idName + "CylinderIn";
00401 solid = DDSolidFactory::tubs(DDName(name, idNameSpace), 0.5*layerL,
00402 rin, rout, phiMin, phidiff);
00403 LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
00404 << DDName(name, idNameSpace) << " Tubs made of "
00405 << genMat << " from " << phiMin/CLHEP::deg << " to "
00406 << (phiMin+phidiff)/CLHEP::deg << phidiff/CLHEP::deg
00407 << " with Rin " << rin << " Rout " << rout << " ZHalf "
00408 << 0.5*layerL;
00409 DDLogicalPart cylinderIn(solid.ddname(), matter, solid);
00410 cpv.position(cylinderIn, cylinder, 1, DDTranslation(0.0, 0.0, -0.25*layerL), DDRotation());
00411 LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: " << cylinderIn.name()
00412 << " number 1 positioned in " << cylinder.name()
00413 << " at (0,0," << -0.25*layerL << ") with no rotation";
00414 name = idName + "CylinderInSup";
00415 solid = DDSolidFactory::tubs(DDName(name, idNameSpace), 0.5*supportW,
00416 rin, rout, phiMin, phidiff);
00417 LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
00418 << DDName(name, idNameSpace) << " Tubs made of "
00419 << genMat << " from " << phiMin/CLHEP::deg << " to "
00420 << (phiMin+phidiff)/CLHEP::deg << " with Rin " << rin
00421 << " Rout " << rout << " ZHalf " << 0.5*supportW;
00422 matname = DDName(DDSplit(supportMat).first, DDSplit(supportMat).second);
00423 DDMaterial matsup(matname);
00424 DDLogicalPart cylinderSup(solid.ddname(), matsup, solid);
00425 cpv.position(cylinderSup, cylinderIn, 1, DDTranslation(0., 0., 0.), DDRotation());
00426 LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: " << cylinderSup.name()
00427 << " number 1 positioned in " << cylinderIn.name()
00428 << " at (0,0,0) with no rotation";
00429 matname = DDName(DDSplit(ribMat).first, DDSplit(ribMat).second);
00430 DDMaterial matrib(matname);
00431 for (unsigned int i = 0; i < ribW.size(); i++) {
00432 name = idName + "Rib" + dbl_to_string(i);
00433 double width = 2.*ribW[i]/(rin+rout);
00434 double dz = 0.25*(layerL - supportW);
00435 solid = DDSolidFactory::tubs(DDName(name, idNameSpace), dz, rin, rout,
00436 -0.5*width, width);
00437 LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
00438 << DDName(name, idNameSpace) << " Tubs made of "
00439 << ribMat << " from " << -0.5*width/CLHEP::deg
00440 << " to " << 0.5*width/CLHEP::deg << " with Rin "
00441 << rin << " Rout " << rout << " ZHalf " << dz;
00442 DDLogicalPart cylinderRib(solid.ddname(), matrib, solid);
00443 double phix = ribPhi[i];
00444 double phideg = phix/CLHEP::deg;
00445 if( phideg>=phiMin/CLHEP::deg && phideg<phiMax/CLHEP::deg ) {
00446 DDRotation rotation;
00447 if (phideg != 0) {
00448 double theta = 90*CLHEP::deg;
00449 double phiy = phix + 90.*CLHEP::deg;
00450 std::string rotstr = idName + dbl_to_string(phideg*10.);
00451 rotation = DDRotation(DDName(rotstr, idNameSpace));
00452 if (!rotation) {
00453 LogDebug("TIBGeom") << "DDTIBLayer_MTCC test: Creating a new "
00454 << "rotation: " << rotstr << "\t90., "
00455 << phix/CLHEP::deg << ", 90.,"
00456 << phiy/CLHEP::deg << ", 0, 0";
00457 rotation = DDrot(DDName(rotstr, idNameSpace), theta,phix, theta,phiy,
00458 0., 0.);
00459 }
00460 }
00461 DDTranslation tran(0, 0, +0.25*(layerL+supportW));
00462 cpv.position(cylinderRib, cylinderIn, 1, tran, rotation);
00463 LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << cylinderRib.name()
00464 << " number 1 positioned in " << cylinderIn.name()
00465 << " at " << tran << " with " << rotation;
00466 }
00467 }
00468
00469
00470
00471 double dz_dohm = 0.5*dohmCarrierW;
00472 double dphi_dohm = CLHEP::twopi/((double)dohmN);
00473 double rout_dohm = 0.5*(radiusLo+radiusUp+cylinderT)+dohmCarrierR;
00474
00475
00476
00477 name = idName + "DOHMCarrier_lo";
00478 double rin_lo = rout_dohm;
00479 double rout_lo = rin_lo + dohmCarrierT;
00480 solid = DDSolidFactory::tubs(DDName(name, idNameSpace), dz_dohm,
00481 rin_lo, rout_lo,
00482 -0.5*dphi_dohm, dphi_dohm);
00483 LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
00484 << DDName(name, idNameSpace) << " Tubs made of "
00485 << dohmCarrierMaterial << " from "
00486 << -0.5*(dphi_dohm)/CLHEP::deg << " to "
00487 << +0.5*(dphi_dohm)/CLHEP::deg << " with Rin "
00488 << rin_lo << " Rout " << rout_lo << " ZHalf "
00489 << dz_dohm;
00490
00491 std::string name_lo_r = name + "_PRIM_AUX" + "_lo" + "_r";
00492 std::string name_lo_l = name + "_PRIM_AUX" + "_lo" + "_l";
00493 DDLogicalPart dohmCarrierPrimAux_lo_r(name_lo_r, DDMaterial(dohmCarrierMaterial), solid);
00494 DDLogicalPart dohmCarrierPrimAux_lo_l(name_lo_l, DDMaterial(dohmCarrierMaterial), solid);
00495 name_lo_r = name + "_PRIM" + "_lo" + "_r";
00496 name_lo_l = name + "_PRIM" + "_lo" + "_l";
00497 DDLogicalPart dohmCarrierPrim_lo_r(name_lo_r, DDMaterial(dohmCarrierMaterial), solid);
00498 DDLogicalPart dohmCarrierPrim_lo_l(name_lo_l, DDMaterial(dohmCarrierMaterial), solid);
00499
00500 name = idName + "DOHMCarrier_up";
00501 double rin_up = rout_lo + 2.*dohmAuxT;
00502 double rout_up = rin_up + dohmCarrierT;
00503 solid = DDSolidFactory::tubs(DDName(name, idNameSpace), dz_dohm,
00504 rin_up, rout_up,
00505 -0.5*dphi_dohm, dphi_dohm);
00506 LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
00507 << DDName(name, idNameSpace) << " Tubs made of "
00508 << dohmCarrierMaterial << " from "
00509 << -0.5*(dphi_dohm)/CLHEP::deg << " to "
00510 << +0.5*(dphi_dohm)/CLHEP::deg << " with Rin "
00511 << rin_up << " Rout " << rout_up << " ZHalf "
00512 << dz_dohm;
00513
00514 std::string name_up_r = name + "_PRIM_AUX" + "_up" + "_r";
00515 std::string name_up_l = name + "_PRIM_AUX" + "_up" + "_l";
00516 DDLogicalPart dohmCarrierPrimAux_up_r(name_up_r, DDMaterial(dohmCarrierMaterial), solid);
00517 DDLogicalPart dohmCarrierPrimAux_up_l(name_up_l, DDMaterial(dohmCarrierMaterial), solid);
00518 name_up_r = name + "_PRIM" + "_up" + "_r";
00519 name_up_l = name + "_PRIM" + "_up" + "_l";
00520 DDLogicalPart dohmCarrierPrim_up_r(name_up_r, DDMaterial(dohmCarrierMaterial), solid);
00521 DDLogicalPart dohmCarrierPrim_up_l(name_up_l, DDMaterial(dohmCarrierMaterial), solid);
00522
00523 for (unsigned int i = 0; i < (unsigned int)dohmN; i++) {
00524 DDLogicalPart dohmCarrier_lo_r;
00525 DDLogicalPart dohmCarrier_lo_l;
00526 DDLogicalPart dohmCarrier_up_r;
00527 DDLogicalPart dohmCarrier_up_l;
00528
00529 bool prim = false;
00530 bool aux = false;
00531 if((unsigned int)dohmList[i]==2) {
00532 prim = true;
00533 aux = true;
00534 } else if((unsigned int)dohmList[i]==1) {
00535 prim = true;
00536 aux = false;
00537 } else {
00538 prim = false;
00539 aux = false;
00540 }
00541
00542 if(prim) {
00543 dohmCarrier_lo_r = dohmCarrierPrim_lo_r;
00544 dohmCarrier_lo_l = dohmCarrierPrim_lo_l;
00545 dohmCarrier_up_r = dohmCarrierPrim_up_r;
00546 dohmCarrier_up_l = dohmCarrierPrim_up_l;
00547 }
00548 if(prim && aux) {
00549 dohmCarrier_lo_r = dohmCarrierPrimAux_lo_r;
00550 dohmCarrier_lo_l = dohmCarrierPrimAux_lo_l;
00551 dohmCarrier_up_r = dohmCarrierPrimAux_up_r;
00552 dohmCarrier_up_l = dohmCarrierPrimAux_up_l;
00553 }
00554
00555
00556 if(prim) {
00557 double phix = ((double)i+0.5)*dphi_dohm;
00558 double phideg = phix/CLHEP::deg;
00559
00560 DDRotation rotation;
00561 if (phideg != 0) {
00562 double theta = 90*CLHEP::deg;
00563 double phiy = phix + 90.*CLHEP::deg;
00564 std::string rotstr = idName + dbl_to_string(phideg*10.);
00565 rotation = DDRotation(DDName(rotstr, idNameSpace));
00566 if (!rotation) {
00567 LogDebug("TIBGeom") << "DDTIBLayer_MTCC test: Creating a new "
00568 << "rotation: " << rotstr << "\t90., "
00569 << phix/CLHEP::deg << ", 90.,"
00570 << phiy/CLHEP::deg << ", 0, 0";
00571 rotation = DDrot(DDName(rotstr, idNameSpace), theta,phix, theta,phiy,
00572 0., 0.);
00573 }
00574 }
00575
00576 DDTranslation tran(0, 0, 0.5*layerL-dz_dohm);
00577 cpv.position(dohmCarrier_lo_r, parent(), i+1, tran, rotation );
00578 LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << dohmCarrier_lo_r.name()
00579 << " z+ number " << i+1 << " positioned in "
00580 << parent().name() << " at " << tran
00581 << " with " << rotation;
00582
00583 cpv.position(dohmCarrier_up_r, parent(), i+1+(unsigned int)dohmN, tran, rotation );
00584 LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << dohmCarrier_up_r.name()
00585 << " z+ number " << i+1 << " positioned in "
00586 << parent().name() << " at " << tran
00587 << " with " << rotation;
00588 }
00589
00590
00591 }
00592
00593
00594
00595 double dx = 0.5*dohmPrimT;
00596 double dy = 0.5*dohmPrimW;
00597 double dz = 0.5*dohmPrimL;
00598 name = idName + "DOHM_PRIM";
00599 solid = DDSolidFactory::box(DDName(name, idNameSpace), dx, dy, dz);
00600 DDLogicalPart dohmPrim(solid.ddname(), DDMaterial(dohmPrimMaterial), solid);
00601 LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
00602 << DDName(name, idNameSpace) << " Box made of "
00603 << dohmPrimMaterial << " of dimensions " << dx << ", "
00604 << dy << ", " << dz;
00605 name = idName + "DOHM_PRIM_Cable";
00606 double dx_cable = 0.25*dohmPrimT;
00607 double dy_cable = 0.40*dohmPrimW;
00608 double dz_cable = 0.5*dohmPrimL;
00609 solid = DDSolidFactory::box(DDName(name, idNameSpace), dx_cable, dy_cable, dz_cable);
00610 DDLogicalPart dohmCablePrim(solid.ddname(), DDMaterial(dohmCableMaterial), solid);
00611 LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
00612 << DDName(name, idNameSpace) << " Box made of "
00613 << dohmCableMaterial << " of dimensions " << dx_cable
00614 << ", " << dy_cable << ", " << dz_cable;
00615
00616 DDTranslation tran(rout_dohm+0.5*dohmPrimT, 0. , 0.);
00617 cpv.position(dohmPrim, dohmCarrierPrim_lo_r, 1, tran, DDRotation() );
00618 LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << dohmPrim.name()
00619 << " z+ number " << 1 << " positioned in "
00620 << dohmCarrierPrim_lo_r.name() << " at " << tran
00621 << " with no rotation";
00622 tran = DDTranslation(rout_dohm+dx_cable, 0.5*dohmPrimW , 0.);
00623 cpv.position(dohmCablePrim, dohmCarrierPrim_lo_r, 1, tran, DDRotation() );
00624 LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << dohmCablePrim.name()
00625 << " copy number " << 1 << " positioned in "
00626 << dohmCarrierPrim_lo_r.name()
00627 << " at " << tran << " with no rotation";
00628 tran = DDTranslation(rout_dohm+dx_cable, -0.5*dohmPrimW , 0.);
00629 cpv.position(dohmCablePrim, dohmCarrierPrim_lo_r, 2, tran, DDRotation() );
00630 LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << dohmCablePrim.name()
00631 << " copy number " << 2 << " positioned in "
00632 << dohmCarrierPrim_lo_r.name()
00633 << " at " << tran << " with no rotation";
00634
00635
00636 dx = 0.5*dohmPrimT;
00637 dy = 0.5*dohmPrimW;
00638 dz = 0.5*dohmPrimL;
00639 name = idName + "DOHM_PRIM";
00640 solid = DDSolidFactory::box(DDName(name, idNameSpace), dx, dy, dz);
00641 LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
00642 << DDName(name, idNameSpace) << " Box made of "
00643 << dohmPrimMaterial << " of dimensions " << dx << ", "
00644 << dy << ", " << dz;
00645 dohmPrim = DDLogicalPart(solid.ddname(), DDMaterial(dohmPrimMaterial), solid);
00646 name = idName + "DOHM_PRIM_Cable";
00647 dx_cable = 0.25*dohmPrimT;
00648 dy_cable = 0.40*dohmPrimW;
00649 dz_cable = 0.5*dohmPrimL;
00650 solid = DDSolidFactory::box(DDName(name, idNameSpace), dx_cable, dy_cable, dz_cable);
00651 dohmCablePrim = DDLogicalPart(solid.ddname(), DDMaterial(dohmCableMaterial), solid);
00652 LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
00653 << DDName(name, idNameSpace) << " Box made of "
00654 << dohmCableMaterial << " of dimensions " << dx_cable
00655 << ", " << dy_cable << ", " << dz_cable;
00656 dx = 0.5*dohmAuxT;
00657 dy = 0.5*dohmAuxW;
00658 dz = 0.5*dohmAuxL;
00659 name = idName + "DOHM_AUX";
00660 solid = DDSolidFactory::box(DDName(name, idNameSpace), dx, dy, dz);
00661 DDLogicalPart dohmAux(solid.ddname(), DDMaterial(dohmAuxMaterial), solid);
00662 LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
00663 << DDName(name, idNameSpace) << " Box made of "
00664 << dohmAuxMaterial << " of dimensions " << dx << ", "
00665 << dy << ", " << dz;
00666 name = idName + "DOHM_AUX_Cable";
00667 solid = DDSolidFactory::box(DDName(name, idNameSpace), dx_cable, dy_cable, dz_cable);
00668 DDLogicalPart dohmCableAux(solid.ddname(), DDMaterial(dohmCableMaterial), solid);
00669 LogDebug("TIBGeom") << "DDTIBLayerAlgo_MTCC test: "
00670 << DDName(name, idNameSpace) << " Box made of "
00671 << dohmCableMaterial << " of dimensions " << dx_cable
00672 << ", " << dy_cable << ", " << dz_cable;
00673
00674 tran = DDTranslation(rout_dohm+0.5*dohmPrimT, -0.75*dohmPrimW , 0.);
00675 cpv.position(dohmPrim, dohmCarrierPrimAux_lo_r, 1, tran, DDRotation() );
00676 LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << dohmAux.name()
00677 << " z+ number " << 1 << " positioned in "
00678 << dohmCarrierPrimAux_lo_r.name() << " at " << tran
00679 << " with no rotation";
00680 tran = DDTranslation(rout_dohm+dx_cable, -0.75*dohmPrimW+0.5*dohmPrimW , 0.);
00681 cpv.position(dohmCablePrim, dohmCarrierPrimAux_lo_r, 1, tran, DDRotation() );
00682 LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << dohmCablePrim.name()
00683 << " copy number " << 1 << " positioned in "
00684 << dohmCarrierPrimAux_lo_r.name() << " at " << tran
00685 << " with no rotation";
00686 tran = DDTranslation(rout_dohm+dx_cable, -0.75*dohmPrimW-0.5*dohmPrimW , 0.);
00687 cpv.position(dohmCablePrim, dohmCarrierPrimAux_lo_r, 2, tran, DDRotation() );
00688 LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << dohmCablePrim.name()
00689 << " copy number " << 2 << " positioned in "
00690 << dohmCarrierPrimAux_lo_r.name() << " at " << tran
00691 << " with no rotation";
00692 tran = DDTranslation(rout_dohm+0.5*dohmAuxT, 0.75*dohmAuxW , 0.);
00693 cpv.position(dohmAux, dohmCarrierPrimAux_lo_r, 1, tran, DDRotation() );
00694 LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << dohmAux.name()
00695 << " z+ number " << 1 << " positioned in "
00696 << dohmCarrierPrimAux_lo_r.name()
00697 << " at (0,0,0) with no rotation";
00698 tran = DDTranslation(rout_dohm+dx_cable, 0.75*dohmAuxW+0.5*dohmPrimW , 0.);
00699 cpv.position(dohmCableAux, dohmCarrierPrimAux_lo_r, 1, tran, DDRotation() );
00700 LogDebug("TIBGeom") << "DDTIBLayer_MTCC test " << dohmCableAux.name()
00701 << " copy number " << 1 << " positioned in "
00702 << dohmCarrierPrimAux_lo_r.name()
00703 << " at " << tran << " with no rotation";
00704 }