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/DDPosPart.h"
00012 #include "DetectorDescription/Core/interface/DDLogicalPart.h"
00013 #include "DetectorDescription/Core/interface/DDSolid.h"
00014 #include "DetectorDescription/Core/interface/DDMaterial.h"
00015 #include "DetectorDescription/Core/interface/DDCurrentNamespace.h"
00016 #include "DetectorDescription/Core/interface/DDSplit.h"
00017 #include "Geometry/TrackerCommonData/interface/DDTIBLayerAlgo.h"
00018 #include "CLHEP/Units/PhysicalConstants.h"
00019 #include "CLHEP/Units/SystemOfUnits.h"
00020
00021
00022 DDTIBLayerAlgo::DDTIBLayerAlgo(): ribW(0),ribPhi(0) {
00023 LogDebug("TIBGeom") << "DDTIBLayerAlgo info: Creating an instance";
00024 }
00025
00026 DDTIBLayerAlgo::~DDTIBLayerAlgo() {}
00027
00028 void DDTIBLayerAlgo::initialize(const DDNumericArguments & nArgs,
00029 const DDVectorArguments & vArgs,
00030 const DDMapArguments & ,
00031 const DDStringArguments & sArgs,
00032 const DDStringVectorArguments & ) {
00033
00034 idNameSpace = DDCurrentNamespace::ns();
00035 genMat = sArgs["GeneralMaterial"];
00036 DDName parentName = parent().name();
00037 LogDebug("TIBGeom") << "DDTIBLayerAlgo debug: Parent " << parentName
00038 << " NameSpace " << idNameSpace
00039 << " General Material " << genMat;
00040
00041 detectorTilt = nArgs["DetectorTilt"];
00042 layerL = nArgs["LayerL"];
00043
00044 radiusLo = nArgs["RadiusLo"];
00045 stringsLo = int(nArgs["StringsLo"]);
00046 detectorLo = sArgs["StringDetLoName"];
00047 LogDebug("TIBGeom") << "DDTIBLayerAlgo debug: Lower layer Radius "
00048 << radiusLo << " Number " << stringsLo << " String "
00049 << detectorLo;
00050
00051 radiusUp = nArgs["RadiusUp"];
00052 stringsUp = int(nArgs["StringsUp"]);
00053 detectorUp = sArgs["StringDetUpName"];
00054 LogDebug("TIBGeom") << "DDTIBLayerAlgo debug: Upper layer Radius "
00055 << radiusUp << " Number " << stringsUp << " String "
00056 << detectorUp;
00057
00058 cylinderT = nArgs["CylinderThickness"];
00059 cylinderInR = nArgs["CylinderInnerRadius"];
00060 cylinderMat = sArgs["CylinderMaterial"];
00061 MFRingInR = nArgs["MFRingInnerRadius"];
00062 MFRingOutR = nArgs["MFRingOuterRadius"];
00063 MFRingT = nArgs["MFRingThickness"];
00064 MFRingDz = nArgs["MFRingDeltaz"];
00065 MFIntRingMat = sArgs["MFIntRingMaterial"];
00066 MFExtRingMat = sArgs["MFExtRingMaterial"];
00067
00068 supportT = nArgs["SupportThickness"];
00069
00070 centMat = sArgs["CentRingMaterial"];
00071 centRing1par = vArgs["CentRing1"];
00072 centRing2par = vArgs["CentRing2"];
00073
00074 fillerMat = sArgs["FillerMaterial"];
00075 fillerDz = nArgs["FillerDeltaz"];
00076
00077 ribMat = sArgs["RibMaterial"];
00078 ribW = vArgs["RibWidth"];
00079 ribPhi = vArgs["RibPhi"];
00080 LogDebug("TIBGeom") << "DDTIBLayerAlgo debug: Cylinder Material/"
00081 << "thickness " << cylinderMat << " " << cylinderT
00082 << " Rib Material " << ribMat << " at "
00083 << ribW.size() << " positions with width/phi";
00084
00085 for (unsigned int i = 0; i < ribW.size(); i++)
00086 LogDebug("TIBGeom") << "\tribW[" << i << "] = " << ribW[i]
00087 << "\tribPhi[" << i << "] = " << ribPhi[i]/deg;
00088
00089 dohmCarrierPhiOff = nArgs["DOHMCarrierPhiOffset"];
00090
00091 dohmtoMF = nArgs["DOHMtoMFDist"];
00092
00093 dohmPrimName = sArgs["StringDOHMPrimName"];
00094 dohmAuxName = sArgs["StringDOHMAuxName"];
00095
00096 dohmCarrierMaterial = sArgs["DOHMCarrierMaterial"];
00097 dohmCableMaterial = sArgs["DOHMCableMaterial"];
00098 dohmPrimL = nArgs["DOHMPRIMLength"];
00099 dohmPrimMaterial = sArgs["DOHMPRIMMaterial"];
00100 dohmAuxL = nArgs["DOHMAUXLength"];
00101 dohmAuxMaterial = sArgs["DOHMAUXMaterial"];
00102 dohmListFW = vArgs["DOHMListFW"];
00103 dohmListBW = vArgs["DOHMListBW"];
00104 LogDebug("TIBGeom") << "DDTIBLayerAlgo debug: DOHM Primary "
00105 << " Material " << dohmPrimMaterial << " Length " << dohmPrimL;
00106 LogDebug("TIBGeom") << "DDTIBLayerAlgo debug: DOHM Aux "
00107 << " Material " << dohmAuxMaterial << " Length " << dohmAuxL;
00108 for (unsigned int i=0; i<dohmListFW.size(); i++) {
00109 if (dohmListFW[i]>0.) LogDebug("TIBGeom") << "DOHM Primary at FW Position " << dohmListFW[i];
00110 if (dohmListFW[i]<0.) LogDebug("TIBGeom") << "DOHM Aux at FW Position " << -dohmListFW[i];
00111 }
00112 for (unsigned int i=0; i<dohmListBW.size(); i++) {
00113 if (dohmListBW[i]>0.) LogDebug("TIBGeom") << "DOHM Primary at BW Position " << dohmListBW[i];
00114 if (dohmListBW[i]<0.) LogDebug("TIBGeom") << "DOHM Aux at BW Position " << -dohmListBW[i];
00115 }
00116
00117
00118 pillarMaterial = sArgs["PillarMaterial"];
00119
00120
00121 fwIntPillarDz = nArgs["FWIntPillarDz"];
00122 fwIntPillarDPhi = nArgs["FWIntPillarDPhi"];
00123 fwIntPillarZ = vArgs["FWIntPillarZ"];
00124 fwIntPillarPhi = vArgs["FWIntPillarPhi"];
00125 bwIntPillarDz = nArgs["BWIntPillarDz"];
00126 bwIntPillarDPhi = nArgs["BWIntPillarDPhi"];
00127 bwIntPillarZ = vArgs["BWIntPillarZ"];
00128 bwIntPillarPhi = vArgs["BWIntPillarPhi"];
00129 LogDebug("TIBGeom") << "FW Internal Pillar [Dz, DPhi] "
00130 << fwIntPillarDz << ", "
00131 << fwIntPillarDPhi;
00132 for (unsigned int i=0; i<fwIntPillarZ.size(); i++) {
00133 if( fwIntPillarPhi[i]>0. ) {
00134 LogDebug("TIBGeom") << " at positions [z, phi] "
00135 << fwIntPillarZ[i] << " " << fwIntPillarPhi[i];
00136 }
00137 }
00138 LogDebug("TIBGeom") << "BW Internal Pillar [Dz, DPhi] "
00139 << bwIntPillarDz << ", "
00140 << bwIntPillarDPhi;
00141 for (unsigned int i=0; i<bwIntPillarZ.size(); i++) {
00142 if( bwIntPillarPhi[i]>0. ) {
00143 LogDebug("TIBGeom") << " at positions [z, phi] "
00144 << bwIntPillarZ[i] << " " << bwIntPillarPhi[i];
00145 }
00146 }
00147
00148
00149 fwExtPillarDz = nArgs["FWExtPillarDz"];
00150 fwExtPillarDPhi = nArgs["FWExtPillarDPhi"];
00151 fwExtPillarZ = vArgs["FWExtPillarZ"];
00152 fwExtPillarPhi = vArgs["FWExtPillarPhi"];
00153 bwExtPillarDz = nArgs["BWExtPillarDz"];
00154 bwExtPillarDPhi = nArgs["BWExtPillarDPhi"];
00155 bwExtPillarZ = vArgs["BWExtPillarZ"];
00156 bwExtPillarPhi = vArgs["BWExtPillarPhi"];
00157 LogDebug("TIBGeom") << "FW External Pillar [Dz, DPhi] "
00158 << fwExtPillarDz << ", "
00159 << fwExtPillarDPhi;
00160 for (unsigned int i=0; i<fwExtPillarZ.size(); i++) {
00161 if( fwExtPillarPhi[i]>0. ) {
00162 LogDebug("TIBGeom") << " at positions [z, phi] "
00163 << fwExtPillarZ[i] << " " << fwExtPillarPhi[i];
00164 }
00165 }
00166 LogDebug("TIBGeom") << "BW External Pillar [Dz, DPhi] "
00167 << bwExtPillarDz << ", "
00168 << bwExtPillarDPhi;
00169 for (unsigned int i=0; i<bwExtPillarZ.size(); i++) {
00170 if( bwExtPillarPhi[i]>0. ) {
00171 LogDebug("TIBGeom") << " at positions [z, phi] "
00172 << bwExtPillarZ[i] << " " << bwExtPillarPhi[i];
00173 }
00174 }
00175 }
00176
00177 void DDTIBLayerAlgo::execute() {
00178
00179 LogDebug("TIBGeom") << "==>> Constructing DDTIBLayerAlgo...";
00180
00181 DDName parentName = parent().name();
00182 std::string idName = DDSplit(parentName).first;
00183
00184 double rmin = MFRingInR;
00185 double rmax = MFRingOutR;
00186
00187 DDSolid solid = DDSolidFactory::tubs(DDName(idName, idNameSpace), 0.5*layerL,
00188 rmin, rmax, 0, twopi);
00189
00190 LogDebug("TIBGeom") << "DDTIBLayerAlgo test: "
00191 << DDName(idName,idNameSpace) << " Tubs made of "
00192 << genMat << " from 0 to " << twopi/deg
00193 << " with Rin " << rmin << " Rout " << rmax
00194 << " ZHalf " << 0.5*layerL;
00195
00196 DDName matname(DDSplit(genMat).first, DDSplit(genMat).second);
00197 DDMaterial matter(matname);
00198 DDLogicalPart layer(solid.ddname(), matter, solid);
00199
00200
00201 double rin = rmin+MFRingT;
00202
00203 double rout = cylinderInR;
00204 std::string name = idName + "Down";
00205 solid = DDSolidFactory::tubs(DDName(name, idNameSpace), 0.5*layerL,
00206 rin, rout, 0, twopi);
00207 LogDebug("TIBGeom") << "DDTIBLayerAlgo test: "
00208 << DDName(name, idNameSpace) << " Tubs made of "
00209 << genMat << " from 0 to " << twopi/deg
00210 << " with Rin " << rin << " Rout " << rout
00211 << " ZHalf " << 0.5*layerL;
00212 DDLogicalPart layerIn(solid.ddname(), matter, solid);
00213 DDpos (layerIn, layer, 1, DDTranslation(0.0, 0.0, 0.0), DDRotation());
00214 LogDebug("TIBGeom") << "DDTIBLayerAlgo test: " << layerIn.name()
00215 << " number 1 positioned in " << layer.name()
00216 << " at (0,0,0) with no rotation";
00217
00218 double rposdet = radiusLo;
00219 double dphi = twopi/stringsLo;
00220 DDName detIn(DDSplit(detectorLo).first, DDSplit(detectorLo).second);
00221 for (int n = 0; n < stringsLo; n++) {
00222 double phi = (n+0.5)*dphi;
00223 double phix = phi - detectorTilt + 90*deg;
00224 double phideg = phix/deg;
00225 DDRotation rotation;
00226 if (phideg != 0) {
00227 double theta = 90*deg;
00228 double phiy = phix + 90.*deg;
00229 std::string rotstr = idName + dbl_to_string(phideg*10.);
00230 rotation = DDRotation(DDName(rotstr, idNameSpace));
00231 if (!rotation) {
00232 LogDebug("TIBGeom") << "DDTIBLayerAlgo test: Creating a new "
00233 << "rotation: " << rotstr << "\t90., "
00234 << phix/deg << ", 90.," << phiy/deg <<", 0, 0";
00235 rotation = DDrot(DDName(rotstr, idNameSpace), theta, phix, theta, phiy,
00236 0., 0.);
00237 }
00238 }
00239 DDTranslation trdet(rposdet*cos(phi), rposdet*sin(phi), 0);
00240 DDpos (detIn, layerIn, n+1, trdet, rotation);
00241 LogDebug("TIBGeom") << "DDTIBLayerAlgo test " << detIn.name()
00242 << " number " << n+1 << " positioned in "
00243 << layerIn.name() << " at " << trdet << " with "
00244 << rotation;
00245 }
00246
00247
00248 rin = cylinderInR + cylinderT;
00249 rout = rmax-MFRingT;
00250 name = idName + "Up";
00251 solid = DDSolidFactory::tubs(DDName(name, idNameSpace), 0.5*layerL,
00252 rin, rout, 0, twopi);
00253 LogDebug("TIBGeom") << "DDTIBLayerAlgo test: "
00254 << DDName(name, idNameSpace) << " Tubs made of "
00255 << genMat << " from 0 to " << twopi/deg
00256 << " with Rin " << rin << " Rout " << rout
00257 << " ZHalf " << 0.5*layerL;
00258 DDLogicalPart layerOut(solid.ddname(), matter, solid);
00259 DDpos (layerOut, layer, 1, DDTranslation(0.0, 0.0, 0.0), DDRotation());
00260 LogDebug("TIBGeom") << "DDTIBLayerAlgo test: " << layerOut.name()
00261 << " number 1 positioned in " << layer.name()
00262 << " at (0,0,0) with no rotation";
00263
00264 rposdet = radiusUp;
00265 dphi = twopi/stringsUp;
00266 DDName detOut(DDSplit(detectorUp).first, DDSplit(detectorUp).second);
00267 for (int n = 0; n < stringsUp; n++) {
00268 double phi = (n+0.5)*dphi;
00269 double phix = phi - detectorTilt - 90*deg;
00270 double phideg = phix/deg;
00271 DDRotation rotation;
00272 if (phideg != 0) {
00273 double theta = 90*deg;
00274 double phiy = phix + 90.*deg;
00275 std::string rotstr = idName + dbl_to_string(phideg*10.);
00276 rotation = DDRotation(DDName(rotstr, idNameSpace));
00277 if (!rotation) {
00278 LogDebug("TIBGeom") << "DDTIBLayerAlgo test: Creating a new "
00279 << "rotation: " << rotstr << "\t90., "
00280 << phix/deg << ", 90.," << phiy/deg <<", 0, 0";
00281 rotation = DDrot(DDName(rotstr, idNameSpace), theta, phix, theta, phiy,
00282 0., 0.);
00283 }
00284 }
00285 DDTranslation trdet(rposdet*cos(phi), rposdet*sin(phi), 0);
00286 DDpos (detOut, layerOut, n+1, trdet, rotation);
00287 LogDebug("TIBGeom") << "DDTIBLayerAlgo test " << detOut.name()
00288 << " number " << n+1 << " positioned in "
00289 << layerOut.name() << " at " << trdet << " with "
00290 << rotation;
00291 }
00292
00293
00294
00295
00296
00297 rin = cylinderInR;
00298 rout = cylinderInR+cylinderT;
00299 name = idName + "Cylinder";
00300 solid = DDSolidFactory::tubs(DDName(name, idNameSpace), 0.5*layerL,
00301 rin, rout, 0, twopi);
00302 LogDebug("TIBGeom") << "DDTIBLayerAlgo test: "
00303 << DDName(name, idNameSpace) << " Tubs made of "
00304 << cylinderMat << " from 0 to " << twopi/deg
00305 << " with Rin " << rin << " Rout " << rout
00306 << " ZHalf " << 0.5*layerL;
00307 matname = DDName(DDSplit(cylinderMat).first, DDSplit(cylinderMat).second);
00308 DDMaterial matcyl(matname);
00309 DDLogicalPart cylinder(solid.ddname(), matcyl, solid);
00310 DDpos (cylinder, layer, 1, DDTranslation(0.0, 0.0, 0.0), DDRotation());
00311 LogDebug("TIBGeom") << "DDTIBLayerAlgo test: " << cylinder.name()
00312 << " number 1 positioned in " << layer.name()
00313 << " at (0,0,0) with no rotation";
00314
00315
00316
00317 rin += supportT;
00318 rout -= supportT;
00319 name = idName + "CylinderIn";
00320 solid = DDSolidFactory::tubs(DDName(name, idNameSpace), 0.5*layerL,
00321 rin, rout, 0, twopi);
00322 LogDebug("TIBGeom") << "DDTIBLayerAlgo test: "
00323 << DDName(name, idNameSpace) << " Tubs made of "
00324 << genMat << " from 0 to " << twopi/deg
00325 << " with Rin " << rin << " Rout " << rout
00326 << " ZHalf " << 0.5*layerL;
00327 DDLogicalPart cylinderIn(solid.ddname(), matter, solid);
00328 DDpos (cylinderIn, cylinder, 1, DDTranslation(0.0, 0.0, 0.0), DDRotation());
00329 LogDebug("TIBGeom") << "DDTIBLayerAlgo test: " << cylinderIn.name()
00330 << " number 1 positioned in " << cylinder.name()
00331 << " at (0,0,0) with no rotation";
00332
00333
00334
00335 matname = DDName(DDSplit(fillerMat).first, DDSplit(fillerMat).second);
00336 DDMaterial matfiller(matname);
00337 name = idName + "Filler";
00338 solid = DDSolidFactory::tubs(DDName(name, idNameSpace), fillerDz, rin, rout,
00339 0., twopi);
00340 LogDebug("TIBGeom") << "DDTIBLayerAlgo test: "
00341 << DDName(name, idNameSpace) << " Tubs made of "
00342 << fillerMat << " from " << 0. << " to "
00343 << twopi/deg << " with Rin " << rin << " Rout "
00344 << rout << " ZHalf " << fillerDz;
00345 DDLogicalPart cylinderFiller(solid.ddname(), matfiller, solid);
00346 DDpos (cylinderFiller, cylinderIn, 1, DDTranslation(0.0, 0.0, 0.5*layerL-fillerDz), DDRotation());
00347 DDpos (cylinderFiller, cylinderIn, 2, DDTranslation(0.0, 0.0,-0.5*layerL+fillerDz), DDRotation());
00348 LogDebug("TIBGeom") << "DDTIBLayerAlgo test " << cylinderFiller.name()
00349 << " number 1" << " positioned in "
00350 << cylinderIn.name() << " at " << DDTranslation(0.0, 0.0, 0.5*layerL-fillerDz)
00351 << " number 2" << " positioned in "
00352 << cylinderIn.name() << " at " << DDTranslation(0.0, 0.0,-0.5*layerL+fillerDz);
00353
00354
00355
00356
00357 matname = DDName(DDSplit(ribMat).first, DDSplit(ribMat).second);
00358 DDMaterial matrib(matname);
00359 for (int i = 0; i < (int)(ribW.size()); i++) {
00360 name = idName + "Rib" + dbl_to_string(i);
00361 double width = 2.*ribW[i]/(rin+rout);
00362 double dz = 0.5*layerL-2.*fillerDz;
00363 solid = DDSolidFactory::tubs(DDName(name, idNameSpace), dz, rin+0.5*mm, rout-0.5*mm,
00364 -0.5*width, width);
00365 LogDebug("TIBGeom") << "DDTIBLayerAlgo test: "
00366 << DDName(name, idNameSpace) << " Tubs made of "
00367 << ribMat << " from " << -0.5*width/deg << " to "
00368 << 0.5*width/deg << " with Rin " << rin+0.5*mm << " Rout "
00369 << rout-0.5*mm << " ZHalf " << dz;
00370 DDLogicalPart cylinderRib(solid.ddname(), matrib, solid);
00371 double phix = ribPhi[i];
00372 double phideg = phix/deg;
00373 DDRotation rotation;
00374 if (phideg != 0) {
00375 double theta = 90*deg;
00376 double phiy = phix + 90.*deg;
00377 std::string rotstr = idName + dbl_to_string(phideg*10.);
00378 rotation = DDRotation(DDName(rotstr, idNameSpace));
00379 if (!rotation) {
00380 LogDebug("TIBGeom") << "DDTIBLayerAlgo test: Creating a new "
00381 << "rotation: " << rotstr << "\t90., "
00382 << phix/deg << ", 90.," << phiy/deg <<", 0, 0";
00383 rotation = DDrot(DDName(rotstr, idNameSpace), theta, phix, theta, phiy,
00384 0., 0.);
00385 }
00386 }
00387 DDTranslation tran(0, 0, 0);
00388 DDpos (cylinderRib, cylinderIn, 1, tran, rotation);
00389 LogDebug("TIBGeom") << "DDTIBLayerAlgo test " << cylinderRib.name()
00390 << " number 1" << " positioned in "
00391 << cylinderIn.name() << " at " << tran << " with "
00392 << rotation;
00393 }
00394
00395
00396
00397
00398 matname = DDName(DDSplit(MFIntRingMat).first, DDSplit(MFIntRingMat).second);
00399 DDMaterial matintmfr(matname);
00400 rin = MFRingInR;
00401 rout = rin + MFRingT;
00402 name = idName + "InnerMFRing";
00403 solid = DDSolidFactory::tubs(DDName(name, idNameSpace), MFRingDz,
00404 rin, rout, 0, twopi);
00405
00406 LogDebug("TIBGeom") << "DDTIBLayerAlgo test: "
00407 << DDName(name, idNameSpace) << " Tubs made of "
00408 << MFIntRingMat << " from 0 to " << twopi/deg
00409 << " with Rin " << rin << " Rout " << rout
00410 << " ZHalf " << MFRingDz;
00411
00412 DDLogicalPart inmfr(solid.ddname(), matintmfr, solid);
00413 DDpos (inmfr, layer, 1, DDTranslation(0.0, 0.0, -0.5*layerL+MFRingDz), DDRotation());
00414 DDpos (inmfr, layer, 2, DDTranslation(0.0, 0.0, +0.5*layerL-MFRingDz), DDRotation());
00415 LogDebug("TIBGeom") << "DDTIBLayerAlgo test: " << inmfr.name()
00416 << " number 1 and 2 positioned in " << layer.name()
00417 << " at (0,0,+-" << 0.5*layerL-MFRingDz << ") with no rotation";
00418
00419 matname = DDName(DDSplit(MFExtRingMat).first, DDSplit(MFExtRingMat).second);
00420 DDMaterial matextmfr(matname);
00421 rout = MFRingOutR;
00422 rin = rout - MFRingT;
00423 name = idName + "OuterMFRing";
00424 solid = DDSolidFactory::tubs(DDName(name, idNameSpace), MFRingDz,
00425 rin, rout, 0, twopi);
00426
00427 LogDebug("TIBGeom") << "DDTIBLayerAlgo test: "
00428 << DDName(name, idNameSpace) << " Tubs made of "
00429 << MFExtRingMat << " from 0 to " << twopi/deg
00430 << " with Rin " << rin << " Rout " << rout
00431 << " ZHalf " << MFRingDz;
00432
00433 DDLogicalPart outmfr(solid.ddname(), matextmfr, solid);
00434 DDpos (outmfr, layer, 1, DDTranslation(0.0, 0.0, -0.5*layerL+MFRingDz), DDRotation());
00435 DDpos (outmfr, layer, 2, DDTranslation(0.0, 0.0, +0.5*layerL-MFRingDz), DDRotation());
00436 LogDebug("TIBGeom") << "DDTIBLayerAlgo test: " << outmfr.name()
00437 << " number 1 and 2 positioned in " << layer.name()
00438 << " at (0,0,+-" << 0.5*layerL-MFRingDz << ") with no rotation";
00439
00440
00441
00442 matname = DDName(DDSplit(centMat).first, DDSplit(centMat).second);
00443 DDMaterial matcent(matname);
00444
00445 double centZ = centRing1par[0];
00446 double centDz = 0.5*centRing1par[1];
00447 rin = centRing1par[2];
00448 rout = centRing1par[3];
00449 name = idName + "CentRing1";
00450 solid = DDSolidFactory::tubs(DDName(name, idNameSpace), centDz,
00451 rin, rout, 0, twopi);
00452
00453 LogDebug("TIBGeom") << "DDTIBLayerAlgo test: "
00454 << DDName(name, idNameSpace) << " Tubs made of "
00455 << centMat << " from 0 to " << twopi/deg
00456 << " with Rin " << rin << " Rout " << rout
00457 << " ZHalf " << centDz;
00458
00459 DDLogicalPart cent1(solid.ddname(), matcent, solid);
00460 DDpos (cent1, layer, 1, DDTranslation(0.0, 0.0, centZ), DDRotation());
00461 LogDebug("TIBGeom") << "DDTIBLayerAlgo test: " << cent1.name()
00462 << " positioned in " << layer.name()
00463 << " at (0,0," << centZ << ") with no rotation";
00464
00465 centZ = centRing2par[0];
00466 centDz = 0.5*centRing2par[1];
00467 rin = centRing2par[2];
00468 rout = centRing2par[3];
00469 name = idName + "CentRing2";
00470 solid = DDSolidFactory::tubs(DDName(name, idNameSpace), centDz,
00471 rin, rout, 0, twopi);
00472
00473 LogDebug("TIBGeom") << "DDTIBLayerAlgo test: "
00474 << DDName(name, idNameSpace) << " Tubs made of "
00475 << centMat << " from 0 to " << twopi/deg
00476 << " with Rin " << rin << " Rout " << rout
00477 << " ZHalf " << centDz;
00478
00479 DDLogicalPart cent2(solid.ddname(), matcent, solid);
00480 DDpos (cent2, layer, 1, DDTranslation(0.0, 0.0, centZ), DDRotation());
00481 LogDebug("TIBGeom") << "DDTIBLayerAlgo test: " << cent2.name()
00482 << " positioned in " << layer.name()
00483 << " at (0,0," << centZ << ") with no rotation";
00484
00486
00487
00488
00489 name = idName + "DOHMCarrier";
00490
00491 double dohmCarrierRin = MFRingOutR - MFRingT;
00492 double dohmCarrierRout = MFRingOutR;
00493 double dohmCarrierDz = 0.5*(dohmPrimL+dohmtoMF);
00494 double dohmCarrierZ = 0.5*layerL-2.*MFRingDz-dohmCarrierDz;
00495
00496 solid = DDSolidFactory::tubs(DDName(name, idNameSpace), dohmCarrierDz,
00497 dohmCarrierRin, dohmCarrierRout,
00498 dohmCarrierPhiOff, 180.*deg-2.*dohmCarrierPhiOff);
00499 LogDebug("TIBGeom") << "DDTIBLayerAlgo test: "
00500 << DDName(name, idNameSpace) << " Tubs made of "
00501 << dohmCarrierMaterial << " from "
00502 << dohmCarrierPhiOff << " to "
00503 << 180.*deg-dohmCarrierPhiOff << " with Rin "
00504 << dohmCarrierRin << " Rout " << MFRingOutR << " ZHalf "
00505 << dohmCarrierDz;
00506
00507
00508
00509
00510
00511 dphi = twopi/stringsUp;
00512
00513 DDRotation dohmRotation;
00514
00515 double dohmR = 0.5*(dohmCarrierRin+dohmCarrierRout);
00516
00517
00518 for (int j = 0; j<4; j++) {
00519
00520 std::vector<double> dohmList;
00521 DDTranslation tran;
00522 std::string rotstr;
00523 DDRotation rotation;
00524 int dohmCarrierReplica=0;
00525 int placeDohm = 0;
00526
00527 switch (j){
00528 case 0:
00529 name = idName + "DOHMCarrierFW";
00530 dohmList = dohmListFW;
00531 tran = DDTranslation(0., 0., dohmCarrierZ);
00532 rotstr = idName + "FwUp";
00533 rotation = DDRotation();
00534 dohmCarrierReplica = 1;
00535 placeDohm=1;
00536 break;
00537 case 1:
00538 name = idName + "DOHMCarrierFW";
00539 dohmList = dohmListFW;
00540 tran = DDTranslation(0., 0., dohmCarrierZ);
00541 rotstr = idName + "FwDown";
00542 rotation = DDrot(DDName(rotstr, idNameSpace), 90.*deg, 180.*deg,
00543 90.*deg, 270.*deg, 0.*deg, 0.*deg);
00544 dohmCarrierReplica = 2;
00545 placeDohm=0;
00546 break;
00547 case 2:
00548 name = idName + "DOHMCarrierBW";
00549 dohmList = dohmListBW;
00550 tran = DDTranslation(0., 0., -dohmCarrierZ);
00551 rotstr = idName + "BwUp";
00552 rotation = DDrot(DDName(rotstr, idNameSpace), 90.*deg, 180.*deg,
00553 90.*deg, 90.*deg, 180.*deg, 0.*deg);
00554 dohmCarrierReplica = 1;
00555 placeDohm=1;
00556 break;
00557 case 3:
00558 name = idName + "DOHMCarrierBW";
00559 dohmList = dohmListBW;
00560 tran = DDTranslation(0., 0., -dohmCarrierZ);
00561 rotstr = idName + "BwDown";
00562 rotation = DDrot(DDName(rotstr, idNameSpace), 90.*deg, 0.*deg,
00563 90.*deg, 270.*deg, 180.*deg, 0.*deg);
00564 dohmCarrierReplica = 2;
00565 placeDohm=0;
00566 break;
00567 }
00568
00569 DDLogicalPart dohmCarrier(name,DDMaterial(dohmCarrierMaterial),solid);
00570
00571 int primReplica = 0;
00572 int auxReplica = 0;
00573
00574 for (int i = 0; i < placeDohm*((int)(dohmList.size())); i++) {
00575
00576 double phi = (std::abs(dohmList[i])+0.5-1.)*dphi;
00577 double phix = phi + 90*deg;
00578 double phideg = phix/deg;
00579 if (phideg != 0) {
00580 double theta = 90*deg;
00581 double phiy = phix + 90.*deg;
00582 std::string rotstr = idName+dbl_to_string(std::abs(dohmList[i])-1.);
00583 dohmRotation = DDRotation(DDName(rotstr, idNameSpace));
00584 if (!dohmRotation) {
00585 LogDebug("TIBGeom") << "DDTIBLayerAlgo test: Creating a new "
00586 << "rotation: " << rotstr << "\t" << theta
00587 << ", " << phix/deg << ", " << theta << ", "
00588 << phiy/deg <<", 0, 0";
00589 dohmRotation = DDrot(DDName(rotstr, idNameSpace), theta, phix, theta,
00590 phiy, 0., 0.);
00591 }
00592 }
00593
00594 std::string dohmName;
00595 int dohmReplica = 0;
00596 double dohmZ = 0.;
00597
00598 if(dohmList[i]<0.) {
00599
00600 dohmName = dohmAuxName;
00601 dohmZ = dohmCarrierDz - 0.5*dohmAuxL - dohmtoMF;
00602 primReplica++;
00603 dohmReplica = primReplica;
00604
00605 } else {
00606
00607 dohmName = dohmPrimName;
00608 dohmZ = dohmCarrierDz - 0.5*dohmPrimL - dohmtoMF;
00609 auxReplica++;
00610 dohmReplica = auxReplica;
00611 }
00612
00613 DDName dohm(DDSplit(dohmName).first, DDSplit(dohmName).second);
00614 DDTranslation dohmTrasl(dohmR*cos(phi), dohmR*sin(phi), dohmZ);
00615 DDpos (dohm, dohmCarrier, dohmReplica, dohmTrasl, dohmRotation);
00616 LogDebug("TIBGeom") << "DDTIBLayerAlgo test " << dohm.name()
00617 << " replica " << dohmReplica << " positioned in "
00618 << dohmCarrier.name() << " at " << dohmTrasl << " with "
00619 << dohmRotation;
00620
00621 }
00622
00623
00624 DDpos (dohmCarrier, parent(), dohmCarrierReplica, tran, rotation );
00625 LogDebug("TIBGeom") << "DDTIBLayerAlgo test "
00626 << dohmCarrier.name() << " positioned in " << parent().name() << " at "
00627 << tran << " with " << rotation;
00628
00629 }
00630
00632
00633 for (int j = 0; j<4; j++) {
00634
00635 matname = DDName(DDSplit(pillarMaterial).first, DDSplit(pillarMaterial).second);
00636 DDMaterial pillarMat(matname);
00637 std::vector<double> pillarZ;
00638 std::vector<double> pillarPhi;
00639 double pillarDz;
00640 double pillarDPhi;
00641 double pillarRin;
00642 double pillarRout;
00643
00644 switch (j){
00645 case 0:
00646 name = idName + "FWIntPillar";
00647 pillarZ = fwIntPillarZ;
00648 pillarPhi = fwIntPillarPhi;
00649 pillarRin = MFRingInR;
00650 pillarRout = MFRingInR + MFRingT;
00651 pillarDz = fwIntPillarDz;
00652 pillarDPhi = fwIntPillarDPhi;
00653 break;
00654 case 1:
00655 name = idName + "BWIntPillar";
00656 pillarZ = bwIntPillarZ;
00657 pillarPhi = bwIntPillarPhi;
00658 pillarRin = MFRingInR;
00659 pillarRout = MFRingInR + MFRingT;
00660 pillarDz = bwIntPillarDz;
00661 pillarDPhi = bwIntPillarDPhi;
00662 break;
00663 case 2:
00664 name = idName + "FWExtPillar";
00665 pillarZ = fwExtPillarZ;
00666 pillarPhi = fwExtPillarPhi;
00667 pillarRin = MFRingOutR - MFRingT;
00668 pillarRout = MFRingOutR;
00669 pillarDz = fwExtPillarDz;
00670 pillarDPhi = fwExtPillarDPhi;
00671 break;
00672 case 3:
00673 name = idName + "BWExtPillar";
00674 pillarZ = bwExtPillarZ;
00675 pillarPhi = bwExtPillarPhi;
00676 pillarRin = MFRingOutR - MFRingT;
00677 pillarRout = MFRingOutR;
00678 pillarDz = bwExtPillarDz;
00679 pillarDPhi = bwExtPillarDPhi;
00680 break;
00681 }
00682
00683
00684 solid = DDSolidFactory::tubs(DDName(name, idNameSpace), pillarDz,
00685 pillarRin, pillarRout,
00686 -pillarDPhi, 2.*pillarDPhi);
00687
00688 DDLogicalPart Pillar(name,DDMaterial(pillarMat),solid);
00689
00690 LogDebug("TIBGeom") << "DDTIBLayerAlgo test: "
00691 << DDName(name, idNameSpace) << " Tubs made of "
00692 << pillarMat << " from "
00693 << -pillarDPhi << " to "
00694 << pillarDPhi << " with Rin "
00695 << pillarRin << " Rout " << pillarRout << " ZHalf "
00696 << pillarDz;
00697
00698 DDTranslation pillarTran;
00699 DDRotation pillarRota;
00700 int pillarReplica = 0;
00701 for (unsigned int i=0; i<pillarZ.size(); i++) {
00702 if( pillarPhi[i]>0. ) {
00703
00704 pillarTran = DDTranslation(0., 0., pillarZ[i]);
00705 pillarRota = DDanonymousRot(DDcreateRotationMatrix(90.*deg, pillarPhi[i], 90.*deg, 90.*deg+pillarPhi[i], 0., 0.));
00706
00707 DDpos (Pillar, parent(), i, pillarTran, pillarRota);
00708 LogDebug("TIBGeom") << "DDTIBLayerAlgo test "
00709 << Pillar.name() << " positioned in " << parent().name() << " at "
00710 << pillarTran << " with " << pillarRota << " copy number " << pillarReplica;
00711
00712 pillarReplica++;
00713 }
00714
00715 }
00716
00717 }
00718
00719 }