Warning, file /DD4hep/examples/DDCMS/src/plugins/DDTECModuleAlgo.cpp was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #include "DD4hep/DetFactoryHelper.h"
0020 #include "DDCMS/DDCMSPlugins.h"
0021
0022 using namespace std;
0023 using namespace dd4hep;
0024 using namespace dd4hep::cms;
0025
0026 static void doPos(ParsingContext& ctxt, Volume toPos, Volume mother,
0027 int copyNr, double x, double y, double z,
0028 const string& rotName)
0029 {
0030 Namespace ns(ctxt);
0031 mother.placeVolume(toPos,copyNr,Transform3D(ns.rotation(rotName),Position(x,y,z)));
0032 LogDebug("TECGeom") << "Volume: " << mother.name() << " positioned daughter "<< mother.name();
0033 }
0034
0035 static void doPos(ParsingContext& ctxt, Volume toPos, Volume mother,
0036 bool isStereo, double rPos,
0037 double posCorrectionPhi,
0038 double x, double y, double z,
0039 string rotName)
0040 {
0041 int copyNr = isStereo ? 2 : 1;
0042
0043
0044 z += rPos;
0045
0046 if(isStereo){
0047
0048
0049 x += rPos*sin(posCorrectionPhi);
0050 }
0051
0052 doPos(ctxt,toPos,mother,copyNr,x,y,z,rotName);
0053 }
0054
0055 static long algorithm(Detector& ,
0056 ParsingContext& ctxt,
0057 xml_h e,
0058 SensitiveDetector& )
0059 {
0060 Namespace ns(ctxt, e, true);
0061 AlgoArguments args(ctxt, e);
0062 Volume mother = ns.volume(args.parentName());
0063
0064
0065
0066 int ringNo = args.value<int>("RingNo");
0067 bool isStereo = args.value<int>("isStereo") == 1;
0068 bool isRing6 = (ringNo == 6);
0069 double rPos = args.value<double>("RPos");
0070 double posCorrectionPhi = isStereo ? args.value<double>("PosCorrectionPhi") : 0e0;
0071 string standardRot = args.value<string>("StandardRotation");
0072 string genMat = args.value<string>("GeneralMaterial");
0073 double moduleThick = args.value<double>("ModuleThick");
0074 double detTilt = args.value<double>("DetTilt");
0075 double fullHeight = args.value<double>("FullHeight");
0076 double dlTop = args.value<double>("DlTop");
0077 double dlBottom = args.value<double>("DlBottom");
0078 double dlHybrid = args.value<double>("DlHybrid");
0079 double frameWidth = args.value<double>("FrameWidth");
0080 double frameThick = args.value<double>("FrameThick");
0081 double frameOver = args.value<double>("FrameOver");
0082 string topFrameMat = args.value<string>("TopFrameMaterial");
0083 double topFrameHeight = args.value<double>("TopFrameHeight");
0084 double topFrameThick = args.value<double>("TopFrameThick");
0085 double topFrameTopWidth = args.value<double>("TopFrameTopWidth");
0086 double topFrameBotWidth = args.value<double>("TopFrameBotWidth");
0087 double topFrame2Width = isStereo ? args.value<double>("TopFrame2Width") : 0e0;
0088 double topFrame2LHeight = isStereo ? args.value<double>("TopFrame2LHeight") : 0e0;
0089 double topFrame2RHeight = isStereo ? args.value<double>("TopFrame2RHeight") : 0e0;
0090 double topFrameZ = args.value<double>("TopFrameZ");
0091 string sideFrameMat = args.value<string>("SideFrameMaterial");
0092 double sideFrameThick = args.value<double>("SideFrameThick");
0093 double sideFrameLWidth = args.value<double>("SideFrameLWidth");
0094 double sideFrameLWidthLow = isStereo ? args.value<double>("SideFrameLWidthLow") : 0e0;
0095 double sideFrameLHeight = args.value<double>("SideFrameLHeight");
0096 double sideFrameLtheta = args.value<double>("SideFrameLtheta");
0097 double sideFrameRWidth = args.value<double>("SideFrameRWidth");
0098 double sideFrameRWidthLow = isStereo ? args.value<double>("SideFrameRWidthLow") : 0e0;
0099 double sideFrameRHeight = args.value<double>("SideFrameRHeight");
0100 double sideFrameRtheta = args.value<double>("SideFrameRtheta");
0101 vector<double> siFrSuppBoxWidth = args.value<vector<double> >("SiFrSuppBoxWidth");
0102 vector<double> siFrSuppBoxHeight = args.value<vector<double> >("SiFrSuppBoxHeight");
0103 vector<double> siFrSuppBoxYPos = args.value<vector<double> >("SiFrSuppBoxYPos");
0104 double sideFrameZ = args.value<double>("SideFrameZ");
0105 double siFrSuppBoxThick = args.value<double>("SiFrSuppBoxThick");
0106 string siFrSuppBoxMat = args.value<string>("SiFrSuppBoxMaterial");
0107 string waferMat = args.value<string>("WaferMaterial");
0108 double waferPosition = args.value<double>("WaferPosition");
0109 double sideWidthTop = args.value<double>("SideWidthTop");
0110 double sideWidthBottom = args.value<double>("SideWidthBottom");
0111 string waferRot = args.value<string>("WaferRotation");
0112 string activeMat = args.value<string>("ActiveMaterial");
0113 double activeHeight = args.value<double>("ActiveHeight");
0114 double waferThick = args.value<double>("WaferThick");
0115 string activeRot = args.value<string>("ActiveRotation");
0116 double activeZ = args.value<double>("ActiveZ");
0117 double backplaneThick = args.value<double>("BackPlaneThick");
0118 double inactiveDy = ringNo > 3 ? args.value<double>("InactiveDy") : 0e0;
0119 double inactivePos = ringNo > 3 ? args.value<double>("InactivePos") : 0e0;
0120 string inactiveMat = ringNo > 3 ? args.value<string>("InactiveMaterial") : string();
0121 string hybridMat = args.value<string>("HybridMaterial");
0122 double hybridHeight = args.value<double>("HybridHeight");
0123 double hybridWidth = args.value<double>("HybridWidth");
0124 double hybridThick = args.value<double>("HybridThick");
0125 double hybridZ = args.value<double>("HybridZ");
0126 string pitchMat = args.value<string>("PitchMaterial");
0127 double pitchWidth = args.value<double>("PitchWidth");
0128 double pitchHeight = args.value<double>("PitchHeight");
0129 double pitchThick = args.value<double>("PitchThick");
0130 double pitchZ = args.value<double>("PitchZ");
0131 string pitchRot = args.value<string>("PitchRotation");
0132 string bridgeMat = args.value<string>("BridgeMaterial");
0133 double bridgeWidth = args.value<double>("BridgeWidth");
0134 double bridgeThick = args.value<double>("BridgeThick");
0135 double bridgeHeight = args.value<double>("BridgeHeight");
0136 double bridgeSep = args.value<double>("BridgeSeparation");
0137 vector<double> siReenforceHeight = args.value<vector<double> >("SiReenforcementHeight");
0138 vector<double> siReenforceWidth = args.value<vector<double> >("SiReenforcementWidth");
0139 vector<double> siReenforceYPos = args.value<vector<double> >("SiReenforcementPosY");
0140 double siReenforceThick = args.value<double>("SiReenforcementThick");
0141 string siReenforceMat = args.value<string>("SiReenforcementMaterial");
0142
0143 LogDebug("TECGeom") << "debug: ModuleThick " << moduleThick
0144 << " Detector Tilt " << detTilt/CLHEP::deg << " Height "
0145 << fullHeight << " dl(Top) " << dlTop << " dl(Bottom) "
0146 << dlBottom << " dl(Hybrid) " << dlHybrid
0147 << " rPos " << rPos << " standrad rotation "
0148 << standardRot;
0149 LogDebug("TECGeom") << "debug: Frame Width " << frameWidth
0150 << " Thickness " << frameThick << " Overlap "
0151 << frameOver;
0152 LogDebug("TECGeom") << "debug: Top Frame Material "
0153 << topFrameMat << " Height " << topFrameHeight
0154 << " Top Width " << topFrameTopWidth << " Bottom Width "
0155 << topFrameTopWidth
0156 << " Thickness " << topFrameThick <<" positioned at"
0157 << topFrameZ;
0158 LogDebug("TECGeom") << "debug : Side Frame Material "
0159 << sideFrameMat << " Thickness " << sideFrameThick
0160 << " left Leg's Width: " << sideFrameLWidth
0161 << " left Leg's Height: " << sideFrameLHeight
0162 << " left Leg's tilt(theta): " << sideFrameLtheta
0163 << " right Leg's Width: " << sideFrameRWidth
0164 << " right Leg's Height: " << sideFrameRHeight
0165 << " right Leg's tilt(theta): " << sideFrameRtheta
0166 << "Supplies Box's Material: " << siFrSuppBoxMat
0167 << " positioned at" << sideFrameZ;
0168 for (int i= 0; i < (int)(siFrSuppBoxWidth.size());i++)
0169 LogDebug("TECGeom") << " Supplies Box" << i << "'s Width: "
0170 << siFrSuppBoxWidth[i] << " Supplies Box" << i
0171 <<"'s Height: " << siFrSuppBoxHeight[i]
0172 << " Supplies Box" << i << "'s y Position: "
0173 << siFrSuppBoxYPos[i];
0174 LogDebug("TECGeom") << "debug: Wafer Material "
0175 << waferMat << " Side Width Top" << sideWidthTop
0176 << " Side Width Bottom" << sideWidthBottom
0177 << " and positioned at "<<waferPosition
0178 << " positioned with rotation" << " matrix:"
0179 << waferRot;
0180 LogDebug("TECGeom") << "debug: Active Material "
0181 << activeMat << " Height " << activeHeight
0182 << " rotated by " << activeRot
0183 << " translated by (0,0," << -0.5 * backplaneThick << ")"
0184 << " Thickness/Z"
0185 << waferThick-backplaneThick << "/" << activeZ;
0186 LogDebug("TECGeom") << "debug: Hybrid Material "
0187 << hybridMat << " Height " << hybridHeight
0188 << " Width " << hybridWidth << " Thickness "
0189 << hybridThick << " Z" << hybridZ;
0190 LogDebug("TECGeom") << "debug: Pitch Adapter Material "
0191 << pitchMat << " Height " << pitchHeight
0192 << " Thickness " << pitchThick << " position with "
0193 << " rotation " << pitchRot << " at Z" << pitchZ;
0194 LogDebug("TECGeom") << "debug: Bridge Material "
0195 << bridgeMat << " Width " << bridgeWidth
0196 << " Thickness " << bridgeThick << " Height "
0197 << bridgeHeight << " Separation "<< bridgeSep;
0198 LogDebug("TECGeom") << "FALTBOOT DDTECModuleAlgo debug : Si-Reenforcement Material "
0199 << sideFrameMat << " Thickness " << siReenforceThick;
0200 for (int i= 0; i < (int)(siReenforceWidth.size());i++)
0201 LogDebug("TECGeom") << " SiReenforcement" << i << "'s Width: "
0202 << siReenforceWidth[i] << " SiReenforcement" << i
0203 << "'s Height: " << siReenforceHeight[i]
0204 << " SiReenforcement" << i << "'s y Position: "
0205 <<siReenforceYPos[i];
0206
0207 if(!isStereo){
0208 LogDebug("TECGeom") << "This is a normal module, in ring "<<ringNo<<"!";
0209 }
0210 else {
0211 LogDebug("TECGeom") << "This is a stereo module, in ring "<<ringNo<<"!";
0212 LogDebug("TECGeom") << "Phi Position corrected by " << posCorrectionPhi << "*rad";
0213 LogDebug("TECGeom") << "debug: stereo Top Frame 2nd Part left Heigt "
0214 << topFrame2LHeight << " right Height " << topFrame2RHeight
0215 << " Width " << topFrame2Width ;
0216 LogDebug("TECGeom") << " left Leg's lower Width: " << sideFrameLWidthLow
0217 << " right Leg's lower Width: " << sideFrameRWidthLow;
0218 }
0219
0220
0221
0222 LogDebug("TECGeom") << "==>> Constructing DDTECModuleAlgo: ";
0223
0224 double tmp;
0225
0226 string name;
0227 string tag("Rphi");
0228 if (isStereo) tag = "Stereo";
0229
0230 const double topFrameEndZ = 0.5 * (-waferPosition + fullHeight) + pitchHeight + hybridHeight - topFrameHeight;
0231 string idName = ns.prepend(ns.obj_name(mother.name()));
0232 LogDebug("TECGeom") << "idName: " << idName << " parent " << mother.name() << " namespace " << ns.name;
0233 Solid solid;
0234
0235
0236 Material matter = ns.material(genMat);
0237 double dzdif = fullHeight + topFrameHeight;
0238 if(isStereo) dzdif += 0.5*(topFrame2LHeight+topFrame2RHeight);
0239
0240 double dxbot = 0.5*dlBottom + frameWidth - frameOver;
0241 double dxtop = 0.5*dlHybrid + frameWidth - frameOver;
0242
0243 if (isRing6) {
0244 dxbot = dxtop;
0245 dxtop = 0.5*dlTop + frameWidth - frameOver;
0246
0247 }
0248 double dxdif = dxtop - dxbot;
0249
0250
0251
0252 name = idName + "SideFrameLeft";
0253 double h1 = 0.5 * sideFrameThick;
0254 double dz = 0.5 * sideFrameLHeight;
0255 double bl1 = 0.5 * sideFrameLWidth;
0256 double bl2 = bl1;
0257 double thet = sideFrameLtheta;
0258
0259 if(isStereo) bl1 = 0.5 * sideFrameLWidthLow;
0260 solid = Trap(dz, thet, 0, h1, bl1, bl1, 0, h1, bl2, bl2, 0);
0261 ns.addSolidNS(name,solid);
0262 LogDebug("TECGeom") << "Solid: " << solid.name()
0263 << " Trap made of " << sideFrameMat << " of dimensions "
0264 << dz << ", "<<thet<<", 0, " << h1 << ", " << bl1 << ", "
0265 << bl1 << ", 0, " << h1 << ", " << bl2 << ", " << bl2
0266 << ", 0";
0267 Volume sideFrameLeft(name, solid, ns.material(sideFrameMat));
0268 ns.addVolumeNS(sideFrameLeft);
0269
0270 double xpos = - 0.5*topFrameBotWidth +bl2+ tan(fabs(thet)) * dz;
0271 double ypos = sideFrameZ;
0272 double zpos = topFrameEndZ -dz;
0273
0274 if (isRing6){
0275 zpos *= -1;
0276 xpos -= 2*tan(fabs(thet)) * dz;
0277 }
0278
0279 if(isStereo) {
0280 xpos = - 0.5*topFrameBotWidth + bl2*cos(detTilt) + dz*sin(fabs(thet)+detTilt)/cos(fabs(thet));
0281 xpos = -xpos;
0282 zpos = topFrameEndZ -topFrame2LHeight-
0283 0.5*sin(detTilt)*(topFrameBotWidth - topFrame2Width)-
0284 dz*cos(detTilt+fabs(thet))/cos(fabs(thet))+bl2*sin(detTilt)-0.1*CLHEP::mm;
0285 }
0286
0287 doPos(ctxt,sideFrameLeft, mother, isStereo, rPos, posCorrectionPhi, xpos,ypos,zpos,waferRot);
0288
0289
0290 name = idName + "SideFrameRight";
0291 h1 = 0.5 * sideFrameThick;
0292 dz = 0.5 * sideFrameRHeight;
0293 bl1 = bl2 = 0.5 * sideFrameRWidth;
0294 thet = sideFrameRtheta;
0295 if(isStereo) bl1 = 0.5 * sideFrameRWidthLow;
0296 solid = Trap(dz, thet, 0, h1, bl1, bl1, 0, h1, bl2, bl2, 0);
0297 ns.addSolidNS(name,solid);
0298 LogDebug("TECGeom") << "Solid:\t" << solid.name()
0299 << " Trap made of " << sideFrameMat << " of dimensions "
0300 << dz << ", "<<thet<<", 0, " << h1 << ", " << bl1 << ", "
0301 << bl1 << ", 0, " << h1 << ", " << bl2 << ", " << bl2
0302 << ", 0";
0303 Volume sideFrameRight(name, solid, ns.material(sideFrameMat));
0304 ns.addVolumeNS(sideFrameRight);
0305
0306 xpos = 0.5*topFrameBotWidth -bl2- tan(fabs(thet)) * dz;
0307 ypos = sideFrameZ;
0308 zpos = topFrameEndZ -dz ;
0309 if (isRing6){
0310 zpos *= -1;
0311 xpos += 2*tan(fabs(thet)) * dz;
0312 }
0313 if(isStereo){
0314 xpos = 0.5*topFrameBotWidth - bl2*cos(detTilt) - dz*sin(fabs(detTilt-fabs(thet)))/cos(fabs(thet));
0315 xpos = -xpos;
0316 zpos = topFrameEndZ -topFrame2RHeight+
0317 0.5*sin(detTilt)*(topFrameBotWidth - topFrame2Width)-
0318 dz*cos(detTilt-fabs(thet))/cos(fabs(thet))-bl2*sin(detTilt)-0.1*CLHEP::mm;
0319 }
0320
0321 doPos(ctxt, sideFrameRight, mother, isStereo, rPos, posCorrectionPhi,xpos,ypos,zpos,waferRot);
0322
0323
0324
0325 matter = ns.material(siFrSuppBoxMat);
0326 for (int i= 0; i < (int)(siFrSuppBoxWidth.size());i++){
0327 name = idName + "SuppliesBox" + std::to_string(i);
0328
0329 h1 = 0.5 * siFrSuppBoxThick;
0330 dz = 0.5 * siFrSuppBoxHeight[i];
0331 bl1 = bl2 = 0.5 * siFrSuppBoxWidth[i];
0332 thet = sideFrameRtheta;
0333 if(isStereo) thet = -atan(fabs(sideFrameRWidthLow-sideFrameRWidth)/(2*sideFrameRHeight)-tan(fabs(thet)));
0334
0335
0336 solid = Trap(dz, thet,0, h1, bl1, bl1, 0, h1, bl2, bl2, 0);
0337 LogDebug("TECGeom") << "Solid:\t" << solid.name()
0338 << " Trap made of " << siFrSuppBoxMat << " of dimensions "
0339 << dz << ", 0, 0, " << h1 << ", " << bl1 << ", "
0340 << bl1 << ", 0, " << h1 << ", " << bl2 << ", " << bl2
0341 << ", 0";
0342 Volume siFrSuppBox(name, solid, matter);
0343 ns.addVolumeNS(siFrSuppBox);
0344
0345 xpos = 0.5*topFrameBotWidth -sideFrameRWidth - bl1-siFrSuppBoxYPos[i]*tan(fabs(thet));
0346 ypos = sideFrameZ*(0.5+(siFrSuppBoxThick/sideFrameThick));
0347 zpos = topFrameEndZ - siFrSuppBoxYPos[i];
0348 if (isRing6){
0349 xpos += 2*fabs(tan(thet))* siFrSuppBoxYPos[i];
0350 zpos *= -1;
0351 }
0352 if(isStereo){
0353 xpos = 0.5*topFrameBotWidth - (sideFrameRWidth+bl1)*cos(detTilt) -
0354 sin(fabs(detTilt-fabs(thet)))*(siFrSuppBoxYPos[i]+dz*(1/cos(thet)- cos(detTilt))+bl1*sin(detTilt));
0355 xpos =-xpos;
0356 zpos = topFrameEndZ - topFrame2RHeight -
0357 0.5*sin(detTilt)*(topFrameBotWidth - topFrame2Width) - siFrSuppBoxYPos[i]-sin(detTilt)*sideFrameRWidth;
0358 }
0359
0360 doPos(ctxt, siFrSuppBox, mother, isStereo, rPos, posCorrectionPhi,xpos,ypos,zpos,waferRot);
0361 }
0362
0363
0364 name = idName + "Hybrid";
0365 double dx = 0.5 * hybridWidth;
0366 double dy = 0.5 * hybridThick;
0367 dz = 0.5 * hybridHeight;
0368 solid = Box(dx, dy, dz);
0369 ns.addSolidNS(name, solid);
0370 LogDebug("TECGeom") << "Solid:\t" << solid.name()
0371 << " Box made of " << hybridMat << " of dimensions "
0372 << dx << ", " << dy << ", " << dz;
0373 Volume hybrid(name, solid, ns.material(hybridMat));
0374 ns.addVolumeNS(hybrid);
0375
0376 ypos = hybridZ;
0377 zpos = 0.5 * (-waferPosition + fullHeight + hybridHeight)+pitchHeight;
0378 if (isRing6) zpos *=-1;
0379
0380 doPos(ctxt, hybrid, mother, isStereo, rPos, posCorrectionPhi, 0, ypos, zpos, "NULL");
0381
0382
0383 name = idName + tag +"Wafer";
0384 bl1 = 0.5 * dlBottom;
0385 bl2 = 0.5 * dlTop;
0386 h1 = 0.5 * waferThick;
0387 dz = 0.5 * fullHeight;
0388 solid = Trap(dz, 0, 0, h1, bl1, bl1, 0, h1, bl2, bl2, 0);
0389 ns.addSolidNS(name,solid);
0390 LogDebug("TECGeom") << "Solid:\t" << solid.name()
0391 << " Trap made of " << waferMat << " of dimensions "
0392 << dz << ", 0, 0, " << h1 << ", " << bl1 << ", "
0393 << bl1 << ", 0, " << h1 << ", " << bl2 << ", "
0394 << bl2 << ", 0";
0395 Volume wafer(name, solid, ns.material(waferMat));
0396
0397 ypos = activeZ;
0398 zpos =-0.5 * waferPosition;
0399 if (isRing6) zpos *= -1;
0400
0401 doPos(ctxt, wafer, mother, isStereo, rPos, posCorrectionPhi,0,ypos,zpos,waferRot);
0402
0403
0404 name = idName + tag +"Active";
0405 bl1 -= sideWidthBottom;
0406 bl2 -= sideWidthTop;
0407 dz = 0.5 * (waferThick-backplaneThick);
0408 h1 = 0.5 * activeHeight;
0409 if (isRing6) {
0410 tmp = bl2; bl2 =bl1; bl1 = tmp;
0411 }
0412 solid = Trap(dz, 0, 0, h1, bl2, bl1, 0, h1, bl2, bl1, 0);
0413 ns.addSolidNS(name,solid);
0414 LogDebug("TECGeom") << "Solid:\t" << solid.name()
0415 << " Trap made of " << activeMat << " of dimensions "
0416 << dz << ", 0, 0, " << h1 << ", " << bl2 << ", "
0417 << bl1 << ", 0, " << h1 << ", " << bl2 << ", "
0418 << bl1 << ", 0";
0419 Volume active(name, solid, ns.material(activeMat));
0420 ns.addVolumeNS(active);
0421 doPos(ctxt, active, wafer, 1, -0.5 * backplaneThick,0,0, activeRot);
0422
0423
0424 if(ringNo > 3){
0425 inactivePos -= fullHeight-activeHeight;
0426 name = idName + tag +"Inactive";
0427 bl1 = 0.5*dlBottom-sideWidthBottom
0428 + ((0.5*dlTop-sideWidthTop-0.5*dlBottom+sideWidthBottom)/activeHeight)
0429 *(activeHeight-inactivePos-inactiveDy);
0430 bl2 = 0.5*dlBottom-sideWidthBottom
0431 + ((0.5*dlTop-sideWidthTop-0.5*dlBottom+sideWidthBottom)/activeHeight)
0432 *(activeHeight-inactivePos+inactiveDy);
0433 dz = 0.5 * (waferThick-backplaneThick);
0434 h1 = inactiveDy;
0435 if (isRing6) {
0436 tmp = bl2; bl2 =bl1; bl1 = tmp;
0437 }
0438 solid = Trap(dz, 0, 0, h1, bl2, bl1, 0, h1, bl2, bl1, 0);
0439 ns.addSolidNS(name,solid);
0440 LogDebug("TECGeom") << "Solid:\t" << solid.name()
0441 << " Trap made of " << inactiveMat << " of dimensions "
0442 << dz << ", 0, 0, " << h1 << ", " << bl2 << ", "
0443 << bl1 << ", 0, " << h1 << ", " << bl2 << ", "
0444 << bl1 << ", 0";
0445 Volume inactive(name, solid, ns.material(inactiveMat));
0446 ns.addVolumeNS(inactive);
0447 ypos = inactivePos - 0.5*activeHeight;
0448 doPos(ctxt, inactive, active, 1, ypos, 0, 0, "NULL");
0449 }
0450
0451 name = idName + "PA";
0452 if (!isStereo) {
0453 dx = 0.5 * pitchWidth;
0454 dy = 0.5 * pitchThick;
0455 dz = 0.5 * pitchHeight;
0456 solid = Box(dx, dy, dz);
0457 ns.addSolidNS(name,solid);
0458 LogDebug("TECGeom") << "Solid:\t" << solid.name()
0459 << " Box made of " << pitchMat <<" of dimensions "
0460 << dx << ", " << dy << ", " << dz;
0461 } else {
0462 dz = 0.5 * pitchWidth;
0463 h1 = 0.5 * pitchThick;
0464 bl1 = 0.5 * pitchHeight + 0.5 * dz * sin(detTilt);
0465 bl2 = 0.5 * pitchHeight - 0.5 * dz * sin(detTilt);
0466 thet = atan((bl1-bl2)/(2.*dz));
0467 solid = Trap(dz, thet, 0, h1, bl1, bl1, 0, h1, bl2, bl2, 0);
0468 ns.addSolidNS(name,solid);
0469 LogDebug("TECGeom") << "Solid:\t" << solid.name()
0470 << " Trap made of " << pitchMat
0471 << " of dimensions " << dz << ", " << thet/CLHEP::deg
0472 << ", 0, " << h1 << ", " << bl1 << ", " << bl1
0473 << ", 0, " << h1 << ", " << bl2 << ", " << bl2
0474 << ", 0";
0475 }
0476 xpos = 0;
0477 ypos = pitchZ;
0478 zpos = 0.5 * (-waferPosition + fullHeight + pitchHeight);
0479 if (isRing6) zpos *= -1;
0480 if(isStereo) xpos = 0.5 * fullHeight * sin(detTilt);
0481
0482 Volume pa(name, solid, ns.material(pitchMat));
0483 if(isStereo) doPos(ctxt, pa, mother, isStereo, rPos, posCorrectionPhi, xpos, ypos,zpos, pitchRot);
0484 else doPos(ctxt, pa, mother, isStereo, rPos, posCorrectionPhi, xpos, ypos,zpos, "NULL");
0485
0486
0487 name = idName + "TopFrame";
0488 h1 = 0.5 * topFrameThick;
0489 dz = 0.5 * topFrameHeight;
0490 bl1 = 0.5 * topFrameBotWidth;
0491 bl2 = 0.5 * topFrameTopWidth;
0492 if (isRing6) {
0493 bl1 = 0.5 * topFrameTopWidth;
0494 bl2 = 0.5 * topFrameBotWidth;
0495 }
0496
0497 solid = Trap(dz, 0, 0, h1, bl1, bl1,0, h1, bl2, bl2, 0);
0498 ns.addSolid(name,solid);
0499 LogDebug("TECGeom") << "Solid:\t" << solid.name()
0500 << " Trap made of " << topFrameMat << " of dimensions "
0501 << dz << ", 0, 0, " << h1 << ", " << bl1 << ", "
0502 << bl1 << ", 0, " << h1 << ", " << bl2 << ", " << bl2
0503 << ", 0";
0504 Volume topFrame(name, solid, ns.material(topFrameMat));
0505 ns.addVolumeNS(topFrame);
0506
0507 if(isStereo){
0508 name = idName + "TopFrame2";
0509
0510 dz = 0.5 * topFrame2Width;
0511 h1 = 0.5 * topFrameThick;
0512 bl1 = 0.5 * topFrame2LHeight;
0513 bl2 = 0.5 * topFrame2RHeight;
0514 thet = atan((bl1-bl2)/(2.*dz));
0515
0516 solid = Trap(dz, thet, 0, h1, bl1, bl1, 0, h1, bl2, bl2, 0);
0517 ns.addSolid(name,solid);
0518 LogDebug("TECGeom") << "Solid:\t" << solid.name()
0519 << " Trap made of " << topFrameMat << " of dimensions "
0520 << dz << ", " << thet/CLHEP::deg << ", 0, " << h1
0521 << ", " << bl1 << ", " << bl1 << ", 0, " << h1
0522 << ", " << bl2 << ", " << bl2 << ", 0";
0523 }
0524
0525
0526 ypos = topFrameZ;
0527 zpos = 0.5 * (-waferPosition + fullHeight - topFrameHeight)+ pitchHeight + hybridHeight;
0528 if(isRing6){
0529 zpos *=-1;
0530 }
0531
0532 doPos(ctxt, topFrame, mother, isStereo, rPos, posCorrectionPhi, 0,ypos,zpos,"NULL");
0533 if ( isStereo ) {
0534
0535 Volume topFrame2(name, solid, ns.material(topFrameMat));
0536 zpos -= 0.5*(topFrameHeight + 0.5*(topFrame2LHeight+topFrame2RHeight));
0537 doPos(ctxt, topFrame2, mother, isStereo, rPos, posCorrectionPhi, 0,ypos,zpos,pitchRot);
0538 }
0539
0540
0541 matter = ns.material(siReenforceMat);
0542 for (int i= 0; i < (int)(siReenforceWidth.size());i++){
0543 name = idName + "SiReenforce" + std::to_string(i);
0544 h1 = 0.5 * siReenforceThick;
0545 dz = 0.5 * siReenforceHeight[i];
0546 bl1 = bl2 = 0.5 * siReenforceWidth[i];
0547 solid = Trap(dz, 0, 0, h1, bl1, bl1, 0, h1, bl2, bl2, 0);
0548 LogDebug("TECGeom") << "Solid:\t" << solid.name()
0549 << " Trap made of " << matter.name() << " of dimensions "
0550 << dz << ", 0, 0, " << h1 << ", " << bl1 << ", "
0551 << bl1 << ", 0, " << h1 << ", " << bl2 << ", " << bl2
0552 << ", 0";
0553 Volume siReenforce(name, solid, matter);
0554 ns.addVolumeNS(siReenforce);
0555
0556 xpos =0 ;
0557 ypos = sideFrameZ;
0558 zpos = topFrameEndZ -dz -siReenforceYPos[i];
0559
0560 if (isRing6) zpos *= -1;
0561 if(isStereo){
0562 xpos = (-siReenforceYPos[i]+0.5*fullHeight)*sin(detTilt);
0563
0564
0565
0566 zpos -= topFrame2RHeight + sin (fabs(detTilt))* 0.5*topFrame2Width;
0567 }
0568 doPos(ctxt,siReenforce, mother, isStereo, rPos, posCorrectionPhi,xpos,ypos,zpos,waferRot);
0569 }
0570
0571
0572 if (bridgeMat != "None") {
0573 name = idName + "Bridge";
0574 bl2 = 0.5*bridgeSep + bridgeWidth;
0575 bl1 = bl2 - bridgeHeight * dxdif / dzdif;
0576 h1 = 0.5 * bridgeThick;
0577 dz = 0.5 * bridgeHeight;
0578 solid = Trap(dz, 0, 0, h1, bl1, bl1, 0, h1, bl2, bl2, 0);
0579 LogDebug("TECGeom") << "Solid:\t" << solid.name()
0580 << " Trap made of " << bridgeMat << " of dimensions "
0581 << dz << ", 0, 0, " << h1 << ", " << bl1 << ", "
0582 << bl1 << ", 0, " << h1 << ", " << bl2 << ", " << bl2
0583 << ", 0";
0584 Volume bridge(name, solid, ns.material(bridgeMat));
0585 ns.addVolumeNS(bridge);
0586
0587 name = idName + "BridgeGap";
0588 bl1 = 0.5*bridgeSep;
0589 solid = Box(bl1, h1, dz);
0590 LogDebug("TECGeom") << "Solid:\t" << solid.name()
0591 << " Box made of " << genMat << " of dimensions "
0592 << bl1 << ", " << h1 << ", " << dz;
0593 Volume bridgeGap(name, solid, ns.material(genMat));
0594 ns.addVolumeNS(bridgeGap);
0595 bridge.placeVolume(bridgeGap, 1);
0596 LogDebug("TECGeom") << "Solid: " << bridgeGap.name()
0597 << " number 1 positioned in " << bridge.name()
0598 << " at (0,0,0) with no rotation";
0599 }
0600 LogDebug("TECGeom") << "<<== End of DDTECModuleAlgo construction ...";
0601 return 1;
0602 }
0603
0604
0605 DECLARE_DDCMS_DETELEMENT(DDCMS_track_DDTECModuleAlgo,algorithm)