+
+ dm[2] = 1.2;
+
+ gMC->Gsposp("TRCE",nsLow+5,"TIC1",0.,1.05,zz-2.1,0,"ONLY",dm,4);
+
+ rr += 0.4;
+ dm[0] = rr*tanAlpha - space;
+ zz += (0.4+9.525);
+
+ }
+
+ dm[0]= 12.472;
+ // dm[1] - this is the dm[1] from the previous TRCE
+ dm[2]= 1.05;
+ dm[3]= 19.65;
+
+ gMC->Gsposp("TRCE",9,"TIC1",0.,-1.2,0.,0,"ONLY",dm,4);
+
+ //
+ // TPc Space for Connectors
+ //
+
+ dm[0]= .3;
+ dm[1]= .3;
+ dm[2]= 4.5;
+
+ gMC->Gsvolu("TPSC","BOX ",idtmed[0],dm,3);
+
+ // TPC Connectors
+
+ dm[0]= .25;
+ dm[1]= .15;
+ dm[2]= 3.75;
+
+ gMC->Gsvolu("TPCC","BOX ",idtmed[13],dm,3);
+
+ gMC->Gspos("TPCC",1,"TPSC",0.,0.15,0.,0,"ONLY");
+
+ zz = -12.7875;
+
+
+ Float_t alpha;
+ Float_t astep;
+
+ // inner part of the inner sector - 2 x 20 holes
+
+ astep = 20.00096874/19.;
+
+ alpha = 10.00048437-astep;
+
+ Float_t x1,x2;
+
+ x1 = 13.31175725;
+ x1 -= 0.996357832;
+
+ x2 = 15.06180253;
+ x2 -= 1.163028812;
+
+ Int_t ncon;
+
+ for(ncon=0;ncon<20;ncon++){
+
+ phi1 = 0.;
+ theta1 = 90.+alpha;
+ phi2=90.;
+ theta2 = 90.;
+ phi3 = (alpha>0) ? 0. : 180.;
+ theta3 = TMath::Abs(alpha);
+
+ AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
+
+
+
+ gMC->Gspos("TPSC",ncon+1,"TIRC",x1,0.3,-12.7875,idrotm[nRotMat],"ONLY");
+ gMC->Gspos("TPSC",ncon+21,"TIRC",x2,0.3,-2.8625,idrotm[nRotMat],"ONLY");
+
+
+ x1 -= 1.296357833;
+ x2 -= 1.463028812;
+
+ alpha -= astep;
+ nRotMat++;
+
+ }
+
+ // outer part of the inner sector - 2 x 25 holes
+
+ astep = 20.00096874/24.;
+ alpha = 10.00048437-astep;
+
+ x1 = 16.81184781;
+ x1 -= 1.016295986;
+
+ x2 = 18.5618931;
+ x2 -= 1.150914854;
+
+ for(ncon=0;ncon<25;ncon++){
+
+ phi1 = 0.;
+ theta1 = 90.+alpha;
+ phi2=90.;
+ theta2 = 90.;
+ phi3 = (alpha>0) ? 0. : 180.;
+ theta3 = TMath::Abs(alpha);
+
+ AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
+
+
+
+ gMC->Gspos("TPSC",ncon+41,"TIRC",x1,0.3,7.0625,idrotm[nRotMat],"ONLY");
+ gMC->Gspos("TPSC",ncon+66,"TIRC",x2,0.3,16.9875,idrotm[nRotMat],"ONLY");
+
+
+ x1 -= 1.316295986;
+ x2 -= 1.450914854;
+
+ alpha -= astep;
+ nRotMat++;
+
+ }
+
+ //--------------------------------------------------------------------------
+ // TPC Outer Readout Chambers
+ // this is NOT a final design
+ //--------------------------------------------------------------------------
+
+ dm[0]= 23.3875;
+ dm[1]= 43.524;
+ dm[2]= 1.5; //thickness
+ dm[3]= 57.1;
+
+ gMC->Gsvolu("TORC","TRD1",idtmed[4],dm,4);
+
+ //------------------------------------------------
+ // Tpc Outer readout chamber Pad Plane
+ //------------------------------------------------
+
+ dm[2]= 0.5;
+
+ gMC->Gsvolu("TOPP","TRD1",idtmed[12],dm,4);
+
+ dm[0] -= 1.218511934;
+ dm[1] -= 1.218511934;
+ dm[2] = 0.35;
+
+ gMC->Gsvolu("TOC3","TRD1",idtmed[1],dm,4);
+
+ gMC->Gspos("TOC3",1,"TOPP",0.,0.15,0.,0,"ONLY");
+
+ gMC->Gspos("TOPP",1,"TORC",0.,1.0,0.,0,"ONLY");
+
+ // empty space
+
+ dm[0]= 21.035;
+ dm[1]= 38.7205;
+ dm[2]= 0.7;
+ dm[3]= 50.15;
+
+ gMC->Gsposp("TRCE",10,"TORC",0.,-0.8,-2.15,0,"ONLY",dm,4);
+
+ dm[0]= 22.2935;
+ dm[1]= 40.5085;
+ dm[2]= 2.25;
+ dm[3]= 51.65;
+
+ gMC->Gsvolu("TOC1","TRD1",idtmed[4],dm,4);
+
+ dm[0]= 21.35;
+ dm[1]= 38.7205;
+ dm[2]= 2.25;
+ dm[3]= 50.15;
+
+ gMC->Gsposp("TRCE",11,"TOC1",0.,0.,0.,0,"ONLY",dm,4);
+
+ //-----------------------------------------------
+ // Tpc Services Support Wheel
+ //-----------------------------------------------
+
+ dm[0]=0.;
+ dm[1]=360.;
+ dm[2]=18.;
+ dm[3]=2.;
+
+ dm[4]= -5.;
+ dm[5]= 77.017;
+ dm[6]= 255.267;
+
+ dm[7]= 5.;
+ dm[8]= dm[5];
+ dm[9]= dm[6];
+
+ gMC->Gsvolu("TSSW","PGON",idtmed[4],dm,10);
+
+ // Tpc Services Wheel Cover
+
+ dm[4]= -0.5;
+ dm[7]= 0.5;
+
+ gMC->Gsvolu("TSWC","PGON",idtmed[4],dm,10);
+
+ // Tpc Service wheel Cover Empty space
+
+ dm[0]= 10.99;
+ dm[1]= 39.599;
+ dm[2]= .5;
+ dm[3]= 81.125;
+
+ gMC->Gsvolu("TSCE","TRD1",idtmed[0],dm,4);
+
+ // Tpc services Wheel Empty Spaces
+
+ dm[0]= 13.18017507;
+ dm[1]= 44.61045938;
+ dm[2]= 4.;
+ dm[3]= 89.125;
+
+ gMC->Gsvolu("TWES","TRD1",idtmed[0],dm,4);
+
+ // Tpc Services Wheel Bars
+
+ gMC->Gsvolu("TSWB","TRD1",idtmed[4],dm,0);
+
+ // bars-> TWES
+
+ dm[2]= 4.;
+ dm[3]= .4;
+
+ dm[0]= 13.8149522;
+ dm[1]= 13.95601379;
+
+ gMC->Gsposp("TSWB",1,"TWES",0.,0.,-85.125,0,"ONLY",dm,4);
+
+ dm[0]= 43.83462067;
+ dm[1]= 43.97568225;
+
+ gMC->Gsposp("TSWB",2,"TWES",0.,0.,85.125,0,"ONLY",dm,4);
+
+ // TPc ELectronics - right now 30% X0 Si
+
+ dm[0]= 14.03813696;
+ dm[1]= 43.3524075;
+ dm[2]= 1.404;
+ dm[3]= 83.125;
+
+ gMC->Gsvolu("TPEL","TRD1",idtmed[11],dm,4);
+ gMC->Gspos("TPEL",1,"TWES",0.,0.,0.,0,"ONLY");
+
+ //--------------------------------------------------------------------------
+ // End caps
+ //--------------------------------------------------------------------------
+
+ // TPc Main Wheel - Al
+
+ dm[0]= 74.9;
+ dm[1]= 264.4;
+ dm[2]= 3.0;
+
+ gMC->Gsvolu("TPMW","TUBE",idtmed[4],dm,3);
+
+ //--------------------------------------------------------------------------
+ // Tpc Empty Space for the Readout chambers
+ //--------------------------------------------------------------------------
+
+ Float_t rLow= 86.2;
+ Float_t rUp= 243.5;
+ Float_t dR = 0.5*(rUp-rLow);
+
+ space= 1.5/cosAlpha; // wheel ribs are 3.0 cm wide
+
+ dm[0]= rLow*tanAlpha-space;
+ dm[1]= rUp*tanAlpha-space;
+ dm[2] = 3.0;
+ dm[3]= dR;
+
+ gMC->Gsvolu("TESR","TRD1",idtmed[0],dm,4);
+
+ // TIC1->TESR
+
+ gMC->Gspos("TIC1",1,"TESR",0.,0.75,-dR+23.97,0,"ONLY");
+
+ // TOC1->TESR
+
+ gMC->Gspos("TOC1",1,"TESR",0.,0.75,dR-55.02,0,"ONLY");
+
+ // Tpc Empty Space Bars - Al (daughters of TESR)
+
+ Float_t zBar;
+
+ gMC->Gsvolu("TESB","TRD1",idtmed[4],dm,0);
+
+ // lower bar
+
+ dm[0]= rLow*tanAlpha-space;
+ dm[1]= 88.7*tanAlpha-space;
+ dm[2]= 2.25;
+ dm[3]= 1.275;
+
+ zBar = -dR+dm[3];
+
+ gMC->Gsposp("TESB",1,"TESR",0.,0.75,zBar,0,"ONLY",dm,4);
+
+ // middle bar
+
+ dm[0]= 131.65*tanAlpha-space;
+ dm[1]= 136.5*tanAlpha-space;
+ dm[3]= 2.425;
+
+ zBar = -dR +131.65+dm[3]-rLow;
+
+ gMC->Gsposp("TESB",2,"TESR",0.,0.75,zBar,0,"ONLY",dm,4);
+
+ // upper bar
+
+ dm[0]= 240.4*tanAlpha-space;
+ dm[1]= rUp*tanAlpha-space;
+ dm[3]= 1.55;
+
+ zBar = dR-dm[3];
+
+ gMC->Gsposp("TESB",3,"TESR",0.,0.75,zBar,0,"ONLY",dm,4);
+
+
+ //------------------------------------------------------
+ // TPc Lower "S" Sectors
+ //------------------------------------------------------
+
+ Float_t deadSpace;
+
+
+ Float_t inSecLowEdge = fTPCParam->GetInnerRadiusLow();
+ Float_t inSecUpEdge = fTPCParam->GetInnerRadiusUp();
+
+ dm[0] = inSecLowEdge*TMath::Tan(0.5*innerOpenAngle)-0.01;
+ dm[1] = inSecUpEdge*TMath::Tan(0.5*innerOpenAngle)-0.01;
+ dm[2] = 0.5*(250. - 5.e-3);
+ dm[3] = 0.5*(inSecUpEdge-inSecLowEdge);
+
+ gMC->Gsvolu("TPLS", "TRD1", idtmed[1], dm, 4); // nonsensitive
+
+ //----------------------------------------------------------
+ // TPc Upper Sectors
+ //----------------------------------------------------------
+
+ Float_t ouSecLowEdge = fTPCParam->GetOuterRadiusLow();
+ Float_t ouSecUpEdge = fTPCParam->GetOuterRadiusUp();
+
+ dm[0] = ouSecLowEdge*TMath::Tan(0.5*outerOpenAngle)-0.01;
+ dm[1] = ouSecUpEdge*TMath::Tan(0.5*outerOpenAngle)-0.01;
+ dm[2] = 0.5*(250. - 5.e-3);
+ dm[3] = 0.5*(ouSecUpEdge-ouSecLowEdge);
+
+ gMC->Gsvolu("TPUS", "TRD1", idtmed[1], dm, 4); // nonsensitive
+
+ //--------------------------------------------------------
+ // TPc Sensitive Strips, the same for S and L sectors
+ //--------------------------------------------------------
+
+ gMC->Gsvolu("TPSS","TRD1",idtmed[2],dm,0); // sensitive
+
+ Int_t nofStrips,nstr;
+ Float_t r1,r2,zs;
+ Float_t stripThick = 0.01; // 100 microns
+
+ // inner sector
+
+ nofStrips = fTPCParam->GetNRowLow();
+ deadSpace = fTPCParam->GetInnerWireMount();
+
+ dm[2] = 0.5*(250. - 5.e-3);
+ dm[3] = 0.5 * stripThick;
+
+ for(nstr=0;nstr<nofStrips;nstr++){
+
+ r1 = fTPCParam->GetPadRowRadiiLow(nstr);
+ r2 = r1 + stripThick;
+ dm[0] = r1 * TMath::Tan(0.5*innerOpenAngle) - deadSpace;
+ dm[1] = r2 * TMath::Tan(0.5*innerOpenAngle) - deadSpace;
+ zs = -inSecLowEdge -0.5*(inSecUpEdge-inSecLowEdge);
+ zs += r1;
+ zs += dm[3];
+
+ gMC->Gsposp("TPSS", nstr+1, "TPLS", 0., 0., zs, 0, "ONLY", dm, 4);
+
+ }
+
+ Int_t nsSave = nofStrips;
+
+ // outer sector
+
+ nofStrips = fTPCParam->GetNRowUp();
+ deadSpace = fTPCParam->GetOuterWireMount();
+
+ dm[2] = 0.5*(250. - 5.e-3);
+ dm[3] = 0.5 * stripThick;
+
+ for(nstr=0;nstr<nofStrips;nstr++){
+
+ r1 = fTPCParam->GetPadRowRadiiUp(nstr);
+ r2 = r1 + stripThick;
+ dm[0] = r1 * TMath::Tan(0.5*outerOpenAngle) - deadSpace;
+ dm[1] = r2 * TMath::Tan(0.5*outerOpenAngle) - deadSpace;
+ zs = -ouSecLowEdge -0.5*(ouSecUpEdge-ouSecLowEdge);
+ zs += r1;
+ zs += dm[3];
+
+ gMC->Gsposp("TPSS", nstr+1+nsSave, "TPUS", 0., 0., zs, 0, "ONLY", dm, 4);
+
+ }
+
+ //-------------------------------------------------------
+ // positioning of the empty spaces into the main wheel
+ // and readout chambers and sectors into the drift gas
+ //-------------------------------------------------------
+
+
+ Float_t rCenter,xc,yc;
+ Float_t rInner,rOuter; // center of the inner and outer chamber
+
+ rCenter = rLow+dR;
+
+ rInner = 108.07;
+ rOuter = 190.68;
+
+
+ for(Int_t ns=0; ns<nInnerSector;ns++){
+
+ phi1 = ns * innerOpenAngle + innerAngleShift;
+ phi1 *= kRaddeg; // in degrees
+
+ phi1 = (Float_t)TMath::Nint(phi1) + 270.;
+
+ if (phi1 > 360.) phi1 -= 360.;
+
+ theta1 = 90.;
+ phi2 = 90.;
+ theta2 = 180.;
+ phi3 = ns * innerOpenAngle + innerAngleShift;
+ phi3 *= kRaddeg; // in degrees
+
+ phi3 = (Float_t)TMath::Nint(phi3);
+
+ if(phi3 > 360.) phi3 -= 360.;
+
+ theta3 = 90.;
+
+ // "holes"->End plate
+
+ xc = rCenter*TMath::Cos(phi3*kDegrad);
+ yc = rCenter*TMath::Sin(phi3*kDegrad);
+
+ AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
+
+ gMC->Gspos("TESR",ns+1,"TPMW",xc,yc,0.,idrotm[nRotMat],"ONLY");
+
+ // TSCE->TSWC (services wheel volumes)
+
+ xc = 166.142*TMath::Cos(phi3*kDegrad);
+ yc = 166.142*TMath::Sin(phi3*kDegrad);
+
+ gMC->Gspos("TSCE",ns+1,"TSWC",xc,yc,0.,idrotm[nRotMat],"ONLY");
+ gMC->Gspos("TWES",ns+1,"TSSW",xc,yc,0.,idrotm[nRotMat],"ONLY");
+
+
+ // readout chambers->TDGN (drift gas)
+
+ xc = rInner*TMath::Cos(phi3*kDegrad);
+ yc = rInner*TMath::Sin(phi3*kDegrad);
+
+ gMC->Gspos("TIRC",ns+1,"TDGN",xc,yc,252.,idrotm[nRotMat],"ONLY");
+
+ // here lower sectors
+
+ gMC->Gspos("TPLS",ns+1,"TDGN",xc,yc,125.0025,idrotm[nRotMat],"ONLY");
+ gMC->Gspos("TPLS",ns+nInnerSector+1,"TDGN",xc,yc,-125.0025,idrotm[nRotMat],"ONLY");
+
+
+
+ xc = rOuter*TMath::Cos(phi3*kDegrad);
+ yc = rOuter*TMath::Sin(phi3*kDegrad);
+
+ gMC->Gspos("TORC",ns+1,"TDGN",xc,yc,252.1,idrotm[nRotMat],"ONLY");
+
+ // here upper sectors
+
+ gMC->Gspos("TPUS",ns+1,"TDGN",xc,yc,125.0025,idrotm[nRotMat],"ONLY");
+ gMC->Gspos("TPUS",ns+nOuterSector+1,"TDGN",xc,yc,-125.0025,idrotm[nRotMat],"ONLY");
+
+
+ nRotMat++;
+
+ theta2 = 0.; // reflection
+
+ AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
+
+ xc = rInner*TMath::Cos(phi3*kDegrad);
+ yc = rInner*TMath::Sin(phi3*kDegrad);
+
+ gMC->Gspos("TIRC",ns+nInnerSector+1,"TDGN",xc,yc,-252.,idrotm[nRotMat],"ONLY");
+
+ xc = rOuter*TMath::Cos(phi3*kDegrad);
+ yc = rOuter*TMath::Sin(phi3*kDegrad);
+
+ gMC->Gspos("TORC",ns+nOuterSector+1,"TDGN",xc,yc,-252.1,idrotm[nRotMat],"ONLY");
+
+ nRotMat++;
+
+ }
+ // TPMW->TPC
+
+ gMC->Gspos("TPMW",1,"TPC ",0.,0.,256.6,0,"ONLY");
+ gMC->Gspos("TPMW",2,"TPC ",0.,0.,-256.6,idrotm[0],"ONLY");
+
+ //---------------------------------------------------------
+ // Tpc High Voltage Membrane - 100 microns of mylar
+ //---------------------------------------------------------
+
+ dm[0]=82.8;
+ dm[1]=252.;
+ dm[2]=0.005;
+
+ gMC->Gsvolu("THVM","TUBE",idtmed[8],dm,3);
+
+ gMC->Gspos("THVM",1,"TDGN",0.,0.,0.,0,"ONLY");
+
+ // Tpc High Voltage membrane Holders
+
+ gMC->Gsvolu("THVH","TUBE",idtmed[4],dm,0);
+
+
+
+ // inner
+
+ dm[0]=79.3;
+ dm[1]=82.8;
+ dm[2]=0.2;
+
+ gMC->Gsposp("THVH",1,"TDGN",0.,0.,0.,0,"ONLY",dm,3);
+
+ // outer
+
+ dm[0]= 252.;
+ dm[1]= 257.9;
+ dm[2]= 0.4;
+
+ gMC->Gsposp("THVH",2,"TDGN",0.,0.,0.,0,"ONLY",dm,3);
+
+ //----------------------------------------------------------
+ // TPc Support Rods - MAKROLON
+ //----------------------------------------------------------
+
+ dm[0]= 0.9;
+ dm[1]= 1.2;
+
+ gMC->Gsvolu("TPSR","TUBE",idtmed[7],dm,0); // inner and outer rods differ
+
+
+ for(Int_t nrod=0;nrod<18;nrod++){
+ Float_t angle=innerOpenAngle*(Float_t)nrod;
+
+ xc=81.5*TMath::Cos(angle);
+ yc=81.5*TMath::Sin(angle);
+
+ dm[2]=126.7;
+
+ gMC->Gsposp("TPSR",nrod+1,"TDGN",xc,yc,126.9,0,"ONLY",dm,3);
+ gMC->Gsposp("TPSR",nrod+19,"TDGN",xc,yc,-126.9,0,"ONLY",dm,3);
+
+ dm[2]=126.6;
+
+ xc=254.25*TMath::Cos(angle);
+ yc=254.25*TMath::Sin(angle);
+
+ // rod number 54 contans the HV cable
+
+ if(nrod<17) {
+ gMC->Gsposp("TPSR",nrod+37,"TDGN",xc,yc,127.,0,"ONLY",dm,3);
+ gMC->Gsposp("TPSR",nrod+54,"TDGN",xc,yc,-127.,0,"ONLY",dm,3);
+ }
+