00158 {
00159
00160 LogDebug("TIDGeom") << "==>> Constructing DDTIDModuleAlgo...";
00161
00162 DDName parentName = parent().name();
00163 DDName name;
00164
00165 double sidfr = sideFrameWidth - sideFrameOver;
00166 double botfr;
00167 double topfr;
00168 double kaptonHeight;
00169 if (dlHybrid > dlTop) {
00170
00171 topfr = topFrameHeight - pitchHeight - topFrameOver;
00172 botfr = bottomFrameHeight - bottomFrameOver;
00173 kaptonHeight = fullHeight + botfr;
00174 } else {
00175
00176 topfr = topFrameHeight - topFrameOver;
00177 botfr = bottomFrameHeight - bottomFrameOver - pitchHeight;
00178 kaptonHeight = fullHeight + topfr;
00179 }
00180
00181 double sideFrameHeight = fullHeight + pitchHeight + botfr + topfr;
00182 double kaptonWidth = sidfr + kaptonOver;
00183
00184 double dxbot = 0.5*dlBottom + sidfr;
00185 double dxtop = 0.5*dlTop + sidfr;
00186 double dxtopenv, dxbotenv;
00187
00188
00189 if (dlHybrid > dlTop) {
00190
00191 dxtopenv = dxbot + (dxtop-dxbot)*(fullHeight+pitchHeight+topfr+hybridHeight)/fullHeight;
00192 dxbotenv = dxtop - (dxtop-dxbot)*(fullHeight+botfr)/fullHeight;
00193 } else {
00194
00195 dxtopenv = dxbot + (dxtop-dxbot)*(fullHeight+topfr)/fullHeight;
00196 dxbotenv = dxbot;
00197 }
00198 double bl1 = dxbotenv;
00199 double bl2 = dxtopenv;
00200 double h1 = 0.5 * moduleThick;
00201 double dz = 0.5 * (boxFrameHeight + sideFrameHeight);
00202
00203 DDSolid solidUncut, solidCut;
00204 DDSolid solid = DDSolidFactory::trap(parentName, dz, 0, 0,
00205 h1, bl1, bl1, 0, h1, bl2, bl2, 0);
00206 DDName matname = DDName(DDSplit(genMat).first, DDSplit(genMat).second);
00207 DDMaterial matter = DDMaterial(matname);
00208 DDLogicalPart module(solid.ddname(), matter, solid);
00209 LogDebug("TIDGeom") << "DDTIDModuleAlgo test:\t" << solid.name()
00210 << " Trap made of " << genMat << " of dimensions " << dz
00211 << ", 0, 0, " << h1 << ", " << bl1 << ", " << bl1
00212 << ", 0, " << h1 << ", " << bl2 << ", " << bl2
00213 << ", 0";
00214
00215 if (doComponents) {
00216
00217
00218 name = DDName(DDSplit(boxFrameName).first,DDSplit(boxFrameName).second);
00219 matname = DDName(DDSplit(boxFrameMat).first, DDSplit(boxFrameMat).second);
00220 matter = DDMaterial(matname);
00221 double dx = 0.5 * boxFrameWidth;
00222 double dy = 0.5 * boxFrameThick;
00223 double dz = 0.5 * boxFrameHeight;
00224 solid = DDSolidFactory::box(name, dx, dy, dz);
00225 LogDebug("TIDGeom") << "DDTIDModuleAlgo test:\t" << solid.name()
00226 << " Box made of " << matname << " of dimensions "
00227 << dx << ", " << dy << ", " << dz;
00228 DDLogicalPart boxFrame(solid.ddname(), matter, solid);
00229
00230
00231
00232 name = DDName(DDSplit(hybridName).first, DDSplit(hybridName).second);
00233 matname = DDName(DDSplit(hybridMat).first, DDSplit(hybridMat).second);
00234 matter = DDMaterial(matname);
00235 dx = 0.5 * hybridWidth;
00236 dy = 0.5 * hybridThick;
00237 dz = 0.5 * hybridHeight;
00238 solid = DDSolidFactory::box(name, dx, dy, dz);
00239 LogDebug("TIDGeom") << "DDTIDModuleAlgo test:\t" << solid.name()
00240 << " Box made of " << matname << " of dimensions "
00241 << dx << ", " << dy << ", " << dz;
00242 DDLogicalPart hybrid(solid.ddname(), matter, solid);
00243
00244
00245 name = DDName(DDSplit(coolName).first, DDSplit(coolName).second);
00246 matname = DDName(DDSplit(coolMat).first, DDSplit(coolMat).second);
00247 matter = DDMaterial(matname);
00248 dx = 0.5 * coolWidth;
00249 dy = 0.5 * coolThick;
00250 dz = 0.5 * coolHeight;
00251 solid = DDSolidFactory::box(name, dx, dy, dz);
00252 LogDebug("TIDGeom") << "DDTIDModuleAlgo test:\t" << solid.name()
00253 << " Box made of " << matname << " of dimensions "
00254 << dx << ", " << dy << ", " << dz;
00255 DDLogicalPart cool(solid.ddname(), matter, solid);
00256
00257
00258 for (int k = 0; k < detectorN; k++) {
00259
00260 double bbl1, bbl2;
00261
00262
00263 name = DDName(DDSplit(sideFrameName[k]).first,DDSplit(sideFrameName[k]).second);
00264 matname = DDName(DDSplit(sideFrameMat).first,DDSplit(sideFrameMat).second);
00265 matter = DDMaterial(matname);
00266 if (dlHybrid > dlTop) {
00267
00268 bbl1 = dxtop - (dxtop-dxbot)*(fullHeight+botfr)/fullHeight;
00269 bbl2 = dxbot + (dxtop-dxbot)*(fullHeight+pitchHeight+topfr)/fullHeight;
00270 } else {
00271
00272 bbl1 = dxtop - (dxtop-dxbot)*(fullHeight+pitchHeight+botfr)/fullHeight;
00273 bbl2 = dxbot + (dxtop-dxbot)*(fullHeight+topfr)/fullHeight;
00274 }
00275 h1 = 0.5 * sideFrameThick;
00276 dz = 0.5 * sideFrameHeight;
00277 solid = DDSolidFactory::trap(name, dz, 0, 0, h1, bbl1, bbl1, 0, h1, bbl2, bbl2, 0);
00278 LogDebug("TIDGeom") << "DDTIDModuleAlgo test:\t" << solid.name()
00279 << " Trap made of " << matname << " of dimensions "
00280 << dz << ", 0, 0, " << h1 << ", " << bbl1 << ", "
00281 << bbl1 << ", 0, " << h1 << ", " << bbl2 << ", "
00282 << bbl2 << ", 0";
00283 DDLogicalPart sideFrame(solid.ddname(), matter, solid);
00284
00285 std::string rotstr, rotns;
00286 DDRotation rot;
00287
00288
00289 name = DDName(DDSplit(holeFrameName[k]).first,
00290 DDSplit(holeFrameName[k]).second);
00291 matname = DDName(DDSplit(genMat).first, DDSplit(genMat).second);
00292 matter = DDMaterial(matname);
00293 double xpos, zpos;
00294 dz = fullHeight - bottomFrameOver - topFrameOver;
00295 bbl1 = dxbot - sideFrameWidth + bottomFrameOver*(dxtop-dxbot)/fullHeight;
00296 bbl2 = dxtop - sideFrameWidth - topFrameOver*(dxtop-dxbot)/fullHeight;
00297 if (dlHybrid > dlTop) {
00298
00299 zpos = -(topFrameHeight+0.5*dz-0.5*sideFrameHeight);
00300 } else {
00301
00302 zpos = bottomFrameHeight+0.5*dz-0.5*sideFrameHeight;
00303 }
00304 dz /= 2.;
00305 solid = DDSolidFactory::trap(name, dz, 0,0, h1,bbl1,bbl1, 0, h1,bbl2,bbl2, 0);
00306 LogDebug("TIDGeom") << "DDTIDModuleAlgo test:\t" << solid.name()
00307 << " Trap made of " << matname << " of dimensions "
00308 << dz << ", 0, 0, " << h1 << ", " << bbl1 << ", "
00309 << bbl1 << ", 0, " << h1 << ", " << bbl2 << ", " << bbl2
00310 << ", 0";
00311 DDLogicalPart holeFrame(solid.ddname(), matter, solid);
00312
00313 rotstr = DDSplit(holeFrameRot[k]).first;
00314 if (rotstr != "NULL") {
00315 rotns = DDSplit(holeFrameRot[k]).second;
00316 rot = DDRotation(DDName(rotstr, rotns));
00317 } else {
00318 rot = DDRotation();
00319 }
00320 DDpos (holeFrame, sideFrame, 1, DDTranslation(0.0, 0.0, zpos), rot );
00321 LogDebug("TIDGeom") << "DDTIDModuleAlgo test: " << holeFrame.name()
00322 << " number 1 positioned in " << sideFrame.name()
00323 << " at (0,0," << zpos << ") with no rotation";
00324
00325
00326
00327 matname = DDName(DDSplit(kaptonMat).first,DDSplit(kaptonMat).second);
00328 matter = DDMaterial(matname);
00329 double kaptonExtraHeight=0;
00330 if (dlHybrid > dlTop) {
00331
00332 bbl1 = dxtop - (dxtop-dxbot)*(fullHeight+botfr)/fullHeight;
00333 if ( k == 1 ) {
00334 kaptonExtraHeight = dlTop*sin(detTilt)-fullHeight*(1-cos(detTilt));
00335 kaptonExtraHeight = 0.5*fabs(kaptonExtraHeight);
00336 bbl2 = dxbot + (dxtop-dxbot)*(fullHeight+kaptonExtraHeight)/fullHeight;
00337 }
00338 else {
00339 bbl2 = dxtop;
00340 }
00341 } else {
00342
00343 bbl2 = dxbot + (dxtop-dxbot)*(fullHeight+topfr)/fullHeight;
00344 if ( k == 1) {
00345 kaptonExtraHeight = dlBottom*sin(detTilt)-fullHeight*(1-cos(detTilt));
00346 kaptonExtraHeight = 0.5*fabs(kaptonExtraHeight);
00347 bbl1 = dxtop - (dxtop-dxbot)*(fullHeight+kaptonExtraHeight)/fullHeight;
00348 } else {
00349 bbl1 = dxbot;
00350 }
00351 }
00352 h1 = 0.5 * kaptonThick;
00353 dz = 0.5 * (kaptonHeight+kaptonExtraHeight);
00354
00355
00356 if ( k == 1 ) {
00357
00358 std::string kaptonUncutName=kaptonName[k]+"Uncut";
00359 name = DDName(DDSplit(kaptonUncutName).first,DDSplit(kaptonUncutName).second);
00360 solidUncut = DDSolidFactory::trap(name, dz, 0, 0, h1, bbl1, bbl1, 0, h1, bbl2, bbl2, 0);
00361
00362
00363 std::string kaptonCutName=kaptonName[k]+"Cut";
00364 name = DDName(DDSplit(kaptonCutName).first,DDSplit(kaptonCutName).second);
00365
00366 if (dlHybrid > dlTop) {
00367 dz = 0.5 * dlTop;
00368 } else {
00369 dz = 0.5 * dlBottom;
00370 }
00371 h1 = 0.5 * kaptonThick;
00372 bbl1 = fabs(dz*sin(detTilt));
00373 bbl2 = bbl1*0.000001;
00374 double thet = atan((bbl1-bbl2)/(2*dz));
00375 solidCut = DDSolidFactory::trap(name, dz, thet, 0, h1, bbl1, bbl1, 0, h1, bbl2, bbl2, 0);
00376
00377 std::string aRot("tidmodpar:9PYX");
00378 rotstr = DDSplit(aRot).first;
00379 rotns = DDSplit(aRot).second;
00380 rot = DDRotation(DDName(rotstr, rotns));
00381
00382 xpos = -0.5 * fullHeight * sin(detTilt);
00383 zpos = 0.5 * kaptonHeight - bbl2;
00384
00385
00386 name = DDName(DDSplit(kaptonName[k]).first,DDSplit(kaptonName[k]).second);
00387 solid = DDSolidFactory::subtraction(name, solidUncut, solidCut, DDTranslation(xpos,0.0,zpos), rot );
00388 } else {
00389 name = DDName(DDSplit(kaptonName[k]).first,DDSplit(kaptonName[k]).second);
00390 solid = DDSolidFactory::trap(name, dz, 0, 0, h1, bbl1, bbl1, 0, h1, bbl2, bbl2, 0);
00391 }
00392
00393 DDLogicalPart kapton(solid.ddname(), matter, solid);
00394 LogDebug("TIDGeom") << "DDTIDModuleAlgo test:\t" << solid.name()
00395 << " SUBTRACTION SOLID Trap made of " << matname << " of dimensions "
00396 << dz << ", 0, 0, " << h1 << ", " << bbl1 << ", "
00397 << bbl1 << ", 0, " << h1 << ", " << bbl2 << ", "
00398 << bbl2 << ", 0";
00399
00400
00401
00402 name = DDName(DDSplit(holeKaptonName[k]).first,
00403 DDSplit(holeKaptonName[k]).second);
00404 matname = DDName(DDSplit(genMat).first, DDSplit(genMat).second);
00405 matter = DDMaterial(matname);
00406 dz = fullHeight - kaptonOver;
00407 xpos = 0;
00408 if (dlHybrid > dlTop) {
00409
00410 bbl1 = dxbot - kaptonWidth + kaptonOver*(dxtop-dxbot)/fullHeight;
00411 bbl2 = dxtop - kaptonWidth;
00412 zpos = 0.5*(kaptonHeight-kaptonExtraHeight-dz);
00413 if ( k == 1 ) {
00414 zpos -= 0.5*kaptonOver*(1-cos(detTilt));
00415 xpos = -0.5*kaptonOver*sin(detTilt);
00416 }
00417 } else {
00418
00419 bbl1 = dxbot - kaptonWidth;
00420 bbl2 = dxtop - kaptonWidth - kaptonOver*(dxtop-dxbot)/fullHeight;
00421 zpos = -0.5*(kaptonHeight-kaptonExtraHeight-dz);
00422 }
00423 dz /= 2.;
00424 solid = DDSolidFactory::trap(name, dz, 0,0, h1,bbl1,bbl1, 0, h1,bbl2,bbl2, 0);
00425 LogDebug("TIDGeom") << "DDTIDModuleAlgo test:\t" << solid.name()
00426 << " Trap made of " << matname << " of dimensions "
00427 << dz << ", 0, 0, " << h1 << ", " << bbl1 << ", "
00428 << bbl1 << ", 0, " << h1 << ", " << bbl2 << ", " << bbl2
00429 << ", 0";
00430 DDLogicalPart holeKapton(solid.ddname(), matter, solid);
00431
00432 rotstr = DDSplit(holeKaptonRot[k]).first;
00433 if (rotstr != "NULL") {
00434 rotns = DDSplit(holeKaptonRot[k]).second;
00435 rot = DDRotation(DDName(rotstr, rotns));
00436 } else {
00437 rot = DDRotation();
00438 }
00439 DDpos (holeKapton, kapton, 1, DDTranslation(xpos, 0.0, zpos), rot );
00440 LogDebug("TIDGeom") << "DDTIDModuleAlgo test: " << holeKapton.name()
00441 << " number 1 positioned in " << kapton.name()
00442 << " at (0,0," << zpos << ") with no rotation";
00443
00444
00445
00446
00447 name = DDName(DDSplit(waferName[k]).first,DDSplit(waferName[k]).second);
00448 matname = DDName(DDSplit(waferMat).first, DDSplit(waferMat).second);
00449 matter = DDMaterial(matname);
00450 if (k == 0 && dlHybrid < dlTop) {
00451 bl1 = 0.5 * dlTop;
00452 bl2 = 0.5 * dlBottom;
00453 } else {
00454 bl1 = 0.5 * dlBottom;
00455 bl2 = 0.5 * dlTop;
00456 }
00457 h1 = 0.5 * waferThick[k];
00458 dz = 0.5 * fullHeight;
00459 solid = DDSolidFactory::trap(name, dz, 0,0, h1,bl1,bl1,0, h1,bl2,bl2,0);
00460 LogDebug("TIDGeom") << "DDTIDModuleAlgo test:\t" << solid.name()
00461 << " Trap made of " << matname << " of dimensions "
00462 << dz << ", 0, 0, " << h1 << ", " << bl1 << ", "
00463 << bl1 << ", 0, " << h1 << ", " << bl2 << ", "
00464 << bl2 << ", 0";
00465 DDLogicalPart wafer(solid.ddname(), matter, solid);
00466
00467
00468 name = DDName(DDSplit(activeName[k]).first,
00469 DDSplit(activeName[k]).second);
00470 matname = DDName(DDSplit(activeMat).first, DDSplit(activeMat).second);
00471 matter = DDMaterial(matname);
00472 if (k == 0 && dlHybrid < dlTop) {
00473 bl1 -= sideWidthTop;
00474 bl2 -= sideWidthBottom;
00475 }
00476 else {
00477 bl1 -= sideWidthBottom;
00478 bl2 -= sideWidthTop;
00479 }
00480 dz = 0.5 * (waferThick[k] - backplaneThick[k]);
00481 h1 = 0.5 * activeHeight;
00482 solid = DDSolidFactory::trap(name, dz, 0,0, h1,bl2,bl1,0, h1,bl2,bl1,0);
00483 LogDebug("TIDGeom") << "DDTIDModuleAlgo test:\t" << solid.name()
00484 << " Trap made of " << matname << " of dimensions "
00485 << dz << ", 0, 0, " << h1 << ", " << bl2 << ", "
00486 << bl1 << ", 0, " << h1 << ", " << bl2 << ", "
00487 << bl1 << ", 0";
00488 DDLogicalPart active(solid.ddname(), matter, solid);
00489 rotstr = DDSplit(activeRot).first;
00490 if (rotstr != "NULL") {
00491 rotns = DDSplit(activeRot).second;
00492 rot = DDRotation(DDName(rotstr, rotns));
00493 } else {
00494 rot = DDRotation();
00495 }
00496 DDTranslation tran(0.0,-0.5 * backplaneThick[k],0.0);
00497 DDpos (active, wafer, 1, tran, rot);
00498 LogDebug("TIDGeom") << "DDTIDModuleAlgo test: " << active.name()
00499 << " number 1 positioned in " << wafer.name()
00500 << " at " << tran << " with " << rot;
00501
00502
00503 name = DDName(DDSplit(pitchName[k]).first,DDSplit(pitchName[k]).second);
00504 matname = DDName(DDSplit(pitchMat).first, DDSplit(pitchMat).second);
00505 matter = DDMaterial(matname);
00506 if (dlHybrid > dlTop) {
00507 dz = 0.5 * dlTop;
00508 } else {
00509 dz = 0.5 * dlBottom;
00510 }
00511 if (k == 0) {
00512 dx = dz;
00513 dy = 0.5 * pitchThick;
00514 dz = 0.5 * pitchHeight;
00515 solid = DDSolidFactory::box(name, dx, dy, dz);
00516 LogDebug("TIDGeom") << "DDTIDModuleAlgo test:\t" << solid.name()
00517 << " Box made of " << matname << " of dimensions"
00518 << " " << dx << ", " << dy << ", " << dz;
00519 } else {
00520 h1 = 0.5 * pitchThick;
00521 bl1 = 0.5 * pitchHeight + 0.5 * dz * sin(detTilt);
00522 bl2 = 0.5 * pitchHeight - 0.5 * dz * sin(detTilt);
00523
00524 dz -=0.5*pitchStereoTol;
00525 bl1-=pitchStereoTol;
00526 bl2-=pitchStereoTol;
00527
00528 double thet = atan((bl1-bl2)/(2.*dz));
00529 solid = DDSolidFactory::trap(name, dz, thet, 0, h1, bl1, bl1, 0,
00530 h1, bl2, bl2, 0);
00531 LogDebug("TIDGeom") << "DDTIDModuleAlgo test:\t" << solid.name()
00532 << " Trap made of " << matname << " of "
00533 << "dimensions " << dz << ", " << thet/deg
00534 << ", 0, " << h1 << ", " << bl1 << ", " << bl1
00535 << ", 0, " << h1 << ", " << bl2 << ", " << bl2
00536 << ", 0";
00537 }
00538 DDLogicalPart pa(solid.ddname(), matter, solid);
00539 }
00540 }
00541 LogDebug("TIDGeom") << "<<== End of DDTIDModuleAlgo construction ...";
00542 }