+ for (Int_t icham = 0; icham < kNcham; icham++) {
+ for (Int_t iplan = 0; iplan < kNplan; iplan++) {
+
+ Int_t iDet = GetDetectorSec(iplan,icham);
+
+ // The lower part of the readout chambers (gas volume + radiator)
+ // The aluminum frames
+ sprintf(cTagV,"UA%02d",iDet);
+ parCha[0] = fCwidth[iplan]/2.;
+ parCha[1] = fClength[iplan][icham]/2. - fgkHspace/2.;
+ parCha[2] = fgkCraH/2. + fgkCdrH/2.;
+ gMC->Gsvolu(cTagV,"BOX ",idtmed[1301-1],parCha,kNparCha);
+ // The G10 frames
+ sprintf(cTagV,"UB%02d",iDet);
+ parCha[0] = fCwidth[iplan]/2. - fgkCalT;
+ parCha[1] = -1.;
+ parCha[2] = -1.;
+ gMC->Gsvolu(cTagV,"BOX ",idtmed[1307-1],parCha,kNparCha);
+ // The inner part (air)
+ sprintf(cTagV,"UC%02d",iDet);
+ parCha[0] = fCwidth[iplan]/2. - fgkCalT - fgkCclsT;
+ parCha[1] = fClength[iplan][icham]/2. - fgkHspace/2.- fgkCclfT;
+ parCha[2] = -1.;
+ gMC->Gsvolu(cTagV,"BOX ",idtmed[1302-1],parCha,kNparCha);
+ if (fPHOShole) {
+ if (fClengthPH[iplan][icham] > 0.0) {
+ // The aluminum frames
+ sprintf(cTagV,"UA%02d",iDet+kNdet);
+ parCha[0] = fCwidth[iplan]/2.;
+ parCha[1] = fClengthPH[iplan][icham]/2. - fgkHspace/2.;
+ parCha[2] = fgkCraH/2. + fgkCdrH/2.;
+ gMC->Gsvolu(cTagV,"BOX ",idtmed[1301-1],parCha,kNparCha);
+ // The G10 frames
+ sprintf(cTagV,"UB%02d",iDet+kNdet);
+ parCha[0] = fCwidth[iplan]/2. - fgkCalT;
+ parCha[1] = -1.;
+ parCha[2] = -1.;
+ gMC->Gsvolu(cTagV,"BOX ",idtmed[1307-1],parCha,kNparCha);
+ // The inner part (air)
+ sprintf(cTagV,"UC%02d",iDet+kNdet);
+ parCha[0] = fCwidth[iplan]/2. - fgkCalT - fgkCclsT;
+ parCha[1] = fClengthPH[iplan][icham]/2. - fgkHspace/2.- fgkCclfT;
+ parCha[2] = -1.;
+ gMC->Gsvolu(cTagV,"BOX ",idtmed[1302-1],parCha,kNparCha);
+ }
+ }
+ if (fRICHhole) {
+ if (fClengthRH[iplan][icham] > 0.0) {
+ // The aluminum frames
+ sprintf(cTagV,"UA%02d",iDet+2*kNdet);
+ parCha[0] = fCwidth[iplan]/2.;
+ parCha[1] = fClengthRH[iplan][icham]/2. - fgkHspace/2.;
+ parCha[2] = fgkCraH/2. + fgkCdrH/2.;
+ gMC->Gsvolu(cTagV,"BOX ",idtmed[1301-1],parCha,kNparCha);
+ // The G10 frames
+ sprintf(cTagV,"UB%02d",iDet+2*kNdet);
+ parCha[0] = fCwidth[iplan]/2. - fgkCalT;
+ parCha[1] = -1.;
+ parCha[2] = -1.;
+ gMC->Gsvolu(cTagV,"BOX ",idtmed[1307-1],parCha,kNparCha);
+ // The inner part (air)
+ sprintf(cTagV,"UC%02d",iDet+2*kNdet);
+ parCha[0] = fCwidth[iplan]/2. - fgkCalT - fgkCclsT;
+ parCha[1] = fClengthRH[iplan][icham]/2. - fgkHspace/2.- fgkCclfT;
+ parCha[2] = -1.;
+ gMC->Gsvolu(cTagV,"BOX ",idtmed[1302-1],parCha,kNparCha);
+ }
+ }
+
+ // The upper part of the readout chambers (readout plane)
+ // The G10 frames
+ sprintf(cTagV,"UD%02d",iDet);
+ parCha[0] = fCwidth[iplan]/2. + fgkCroW;
+ parCha[1] = fClength[iplan][icham]/2. - fgkHspace/2.;
+ parCha[2] = fgkCamH/2.;
+ gMC->Gsvolu(cTagV,"BOX ",idtmed[1307-1],parCha,kNparCha);
+ // The inner part of the G10 frame (air)
+ sprintf(cTagV,"UE%02d",iDet);
+ parCha[0] = fCwidth[iplan]/2. + fgkCroW - fgkCcuT;
+ parCha[1] = fClength[iplan][icham]/2. - fgkHspace/2.- fgkCcuT;
+ parCha[2] = -1.;
+ gMC->Gsvolu(cTagV,"BOX ",idtmed[1302-1],parCha,kNparCha);
+ // The aluminum frames
+ sprintf(cTagV,"UF%02d",iDet);
+ parCha[0] = fCwidth[iplan]/2. + fgkCroW;
+ parCha[1] = fClength[iplan][icham]/2. - fgkHspace/2.;
+ parCha[2] = fgkCroH/2.;
+ gMC->Gsvolu(cTagV,"BOX ",idtmed[1301-1],parCha,kNparCha);
+ // The inner part of the aluminum frames
+ sprintf(cTagV,"UG%02d",iDet);
+ parCha[0] = fCwidth[iplan]/2. + fgkCroW - fgkCauT;
+ parCha[1] = fClength[iplan][icham]/2. - fgkHspace/2.- fgkCauT;
+ parCha[2] = -1.;
+ gMC->Gsvolu(cTagV,"BOX ",idtmed[1302-1],parCha,kNparCha);
+ if (fPHOShole) {
+ if (fClengthPH[iplan][icham] > 0.0) {
+ sprintf(cTagV,"UD%02d",iDet+kNdet);
+ parCha[0] = fCwidth[iplan]/2. + fgkCroW;
+ parCha[1] = fClengthPH[iplan][icham]/2. - fgkHspace/2.;
+ parCha[2] = fgkCamH/2.;
+ gMC->Gsvolu(cTagV,"BOX ",idtmed[1307-1],parCha,kNparCha);
+ // The inner part of the G10 frame (air)
+ sprintf(cTagV,"UE%02d",iDet+kNdet);
+ parCha[0] = fCwidth[iplan]/2. + fgkCroW - fgkCcuT;
+ parCha[1] = fClengthPH[iplan][icham]/2. - fgkHspace/2.- fgkCcuT;
+ parCha[2] = -1.;
+ gMC->Gsvolu(cTagV,"BOX ",idtmed[1302-1],parCha,kNparCha);
+ // The aluminum frames
+ sprintf(cTagV,"UF%02d",iDet+kNdet);
+ parCha[0] = fCwidth[iplan]/2. + fgkCroW;
+ parCha[1] = fClengthPH[iplan][icham]/2. - fgkHspace/2.;
+ parCha[2] = fgkCroH/2.;
+ gMC->Gsvolu(cTagV,"BOX ",idtmed[1301-1],parCha,kNparCha);
+ // The inner part of the aluminum frames
+ sprintf(cTagV,"UG%02d",iDet+kNdet);
+ parCha[0] = fCwidth[iplan]/2. + fgkCroW - fgkCauT;
+ parCha[1] = fClengthPH[iplan][icham]/2. - fgkHspace/2.- fgkCauT;
+ parCha[2] = -1.;
+ gMC->Gsvolu(cTagV,"BOX ",idtmed[1302-1],parCha,kNparCha);
+ }
+ }
+ if (fRICHhole) {
+ if (fClengthRH[iplan][icham] > 0.0) {
+ sprintf(cTagV,"UD%02d",iDet+2*kNdet);
+ parCha[0] = fCwidth[iplan]/2. + fgkCroW;
+ parCha[1] = fClengthRH[iplan][icham]/2. - fgkHspace/2.;
+ parCha[2] = fgkCamH/2.;
+ gMC->Gsvolu(cTagV,"BOX ",idtmed[1307-1],parCha,kNparCha);
+ // The inner part of the G10 frame (air)
+ sprintf(cTagV,"UE%02d",iDet+2*kNdet);
+ parCha[0] = fCwidth[iplan]/2. + fgkCroW - fgkCcuT;
+ parCha[1] = fClengthRH[iplan][icham]/2. - fgkHspace/2.- fgkCcuT;
+ parCha[2] = -1.;
+ gMC->Gsvolu(cTagV,"BOX ",idtmed[1302-1],parCha,kNparCha);
+ // The aluminum frames
+ sprintf(cTagV,"UF%02d",iDet+2*kNdet);
+ parCha[0] = fCwidth[iplan]/2. + fgkCroW;
+ parCha[1] = fClengthRH[iplan][icham]/2. - fgkHspace/2.;
+ parCha[2] = fgkCroH/2.;
+ gMC->Gsvolu(cTagV,"BOX ",idtmed[1301-1],parCha,kNparCha);
+ // The inner part of the aluminum frames
+ sprintf(cTagV,"UG%02d",iDet+2*kNdet);
+ parCha[0] = fCwidth[iplan]/2. + fgkCroW - fgkCauT;
+ parCha[1] = fClengthRH[iplan][icham]/2. - fgkHspace/2.- fgkCauT;
+ parCha[2] = -1.;
+ gMC->Gsvolu(cTagV,"BOX ",idtmed[1302-1],parCha,kNparCha);
+ }
+ }
+
+ // The material layers inside the chambers
+ parCha[0] = -1.;
+ parCha[1] = -1.;
+ // Rohacell layer (radiator)
+ parCha[2] = fgkRaThick/2;
+ sprintf(cTagV,"UH%02d",iDet);
+ gMC->Gsvolu(cTagV,"BOX ",idtmed[1315-1],parCha,kNparCha);
+ // Mylar layer (entrance window + HV cathode)
+ parCha[2] = fgkMyThick/2;
+ sprintf(cTagV,"UI%02d",iDet);
+ gMC->Gsvolu(cTagV,"BOX ",idtmed[1308-1],parCha,kNparCha);
+ // Xe/Isobutane layer (drift volume)
+ parCha[2] = fgkDrThick/2.;
+ sprintf(cTagV,"UJ%02d",iDet);
+ gMC->Gsvolu(cTagV,"BOX ",idtmed[1309-1],parCha,kNparCha);
+ // Xe/Isobutane layer (amplification volume)
+ parCha[2] = fgkAmThick/2.;
+ sprintf(cTagV,"UK%02d",iDet);
+ gMC->Gsvolu(cTagV,"BOX ",idtmed[1309-1],parCha,kNparCha);
+ // Cu layer (pad plane)
+ parCha[2] = fgkCuThick/2;
+ sprintf(cTagV,"UL%02d",iDet);
+ gMC->Gsvolu(cTagV,"BOX ",idtmed[1305-1],parCha,kNparCha);
+ // G10 layer (support structure / honeycomb)
+ parCha[2] = fgkSuThick/2;
+ sprintf(cTagV,"UM%02d",iDet);
+ gMC->Gsvolu(cTagV,"BOX ",idtmed[1313-1],parCha,kNparCha);
+ if (fPHOShole) {
+ if (fClengthPH[iplan][icham] > 0.0) {
+ // Rohacell layer (radiator)
+ parCha[2] = fgkRaThick/2;
+ sprintf(cTagV,"UH%02d",iDet+kNdet);
+ gMC->Gsvolu(cTagV,"BOX ",idtmed[1315-1],parCha,kNparCha);
+ // Mylar layer (entrance window + HV cathode)
+ parCha[2] = fgkMyThick/2;
+ sprintf(cTagV,"UI%02d",iDet+kNdet);
+ gMC->Gsvolu(cTagV,"BOX ",idtmed[1308-1],parCha,kNparCha);
+ // Xe/Isobutane layer (drift volume)
+ parCha[2] = fgkDrThick/2.;
+ sprintf(cTagV,"UJ%02d",iDet+kNdet);
+ gMC->Gsvolu(cTagV,"BOX ",idtmed[1309-1],parCha,kNparCha);
+ // Xe/Isobutane layer (amplification volume)
+ parCha[2] = fgkAmThick/2.;
+ sprintf(cTagV,"UK%02d",iDet+kNdet);
+ gMC->Gsvolu(cTagV,"BOX ",idtmed[1309-1],parCha,kNparCha);
+ // Cu layer (pad plane)
+ parCha[2] = fgkCuThick/2;
+ sprintf(cTagV,"UL%02d",iDet+kNdet);
+ gMC->Gsvolu(cTagV,"BOX ",idtmed[1305-1],parCha,kNparCha);
+ // G10 layer (support structure / honeycomb)
+ parCha[2] = fgkSuThick/2;
+ sprintf(cTagV,"UM%02d",iDet+kNdet);
+ gMC->Gsvolu(cTagV,"BOX ",idtmed[1313-1],parCha,kNparCha);
+ }
+ }
+ if (fRICHhole) {
+ if (fClengthRH[iplan][icham] > 0.0) {
+ // Rohacell layer (radiator)
+ parCha[2] = fgkRaThick/2;
+ sprintf(cTagV,"UH%02d",iDet+2*kNdet);
+ gMC->Gsvolu(cTagV,"BOX ",idtmed[1315-1],parCha,kNparCha);
+ // Mylar layer (entrance window + HV cathode)
+ parCha[2] = fgkMyThick/2;
+ sprintf(cTagV,"UI%02d",iDet+2*kNdet);
+ gMC->Gsvolu(cTagV,"BOX ",idtmed[1308-1],parCha,kNparCha);
+ // Xe/Isobutane layer (drift volume)
+ parCha[2] = fgkDrThick/2.;
+ sprintf(cTagV,"UJ%02d",iDet+2*kNdet);
+ gMC->Gsvolu(cTagV,"BOX ",idtmed[1309-1],parCha,kNparCha);
+ // Xe/Isobutane layer (amplification volume)
+ parCha[2] = fgkAmThick/2.;
+ sprintf(cTagV,"UK%02d",iDet+2*kNdet);
+ gMC->Gsvolu(cTagV,"BOX ",idtmed[1309-1],parCha,kNparCha);
+ // Cu layer (pad plane)
+ parCha[2] = fgkCuThick/2;
+ sprintf(cTagV,"UL%02d",iDet+2*kNdet);
+ gMC->Gsvolu(cTagV,"BOX ",idtmed[1305-1],parCha,kNparCha);
+ // G10 layer (support structure / honeycomb)
+ parCha[2] = fgkSuThick/2;
+ sprintf(cTagV,"UM%02d",iDet+2*kNdet);
+ gMC->Gsvolu(cTagV,"BOX ",idtmed[1313-1],parCha,kNparCha);
+ }
+ }
+
+ // Position the layers in the chambers
+ xpos = 0;
+ ypos = 0;
+ // Lower part
+ // Rohacell layer (radiator)
+ zpos = fgkRaZpos;
+ sprintf(cTagV,"UH%02d",iDet);
+ sprintf(cTagM,"UC%02d",iDet);
+ gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
+ // Mylar layer (entrance window + HV cathode)
+ zpos = fgkMyZpos;
+ sprintf(cTagV,"UI%02d",iDet);
+ sprintf(cTagM,"UC%02d",iDet);
+ gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
+ // Xe/Isobutane layer (drift volume)
+ zpos = fgkDrZpos;
+ sprintf(cTagV,"UJ%02d",iDet);
+ sprintf(cTagM,"UC%02d",iDet);
+ gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
+ // Upper part
+ // Xe/Isobutane layer (amplification volume)
+ zpos = fgkAmZpos;
+ sprintf(cTagV,"UK%02d",iDet);
+ sprintf(cTagM,"UE%02d",iDet);
+ gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
+ // Readout part
+ // Cu layer (pad plane)
+ zpos = fgkCuZpos;
+ sprintf(cTagV,"UL%02d",iDet);
+ sprintf(cTagM,"UG%02d",iDet);
+ gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
+ // G10 layer (support structure)
+ zpos = fgkSuZpos;
+ sprintf(cTagV,"UM%02d",iDet);
+ sprintf(cTagM,"UG%02d",iDet);
+ gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
+ if (fPHOShole) {
+ if (fClengthPH[iplan][icham] > 0.0) {
+ // Lower part
+ // Rohacell layer (radiator)
+ zpos = fgkRaZpos;
+ sprintf(cTagV,"UH%02d",iDet+kNdet);
+ sprintf(cTagM,"UC%02d",iDet+kNdet);
+ gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
+ // Mylar layer (entrance window + HV cathode)
+ zpos = fgkMyZpos;
+ sprintf(cTagV,"UI%02d",iDet+kNdet);
+ sprintf(cTagM,"UC%02d",iDet+kNdet);
+ gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
+ // Xe/Isobutane layer (drift volume)
+ zpos = fgkDrZpos;
+ sprintf(cTagV,"UJ%02d",iDet+kNdet);
+ sprintf(cTagM,"UC%02d",iDet+kNdet);
+ gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
+ // Upper part
+ // Xe/Isobutane layer (amplification volume)
+ zpos = fgkAmZpos;
+ sprintf(cTagV,"UK%02d",iDet+kNdet);
+ sprintf(cTagM,"UE%02d",iDet+kNdet);
+ gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
+ // Readout part
+ // Cu layer (pad plane)
+ zpos = fgkCuZpos;
+ sprintf(cTagV,"UL%02d",iDet+kNdet);
+ sprintf(cTagM,"UG%02d",iDet+kNdet);
+ gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
+ // G10 layer (support structure)
+ zpos = fgkSuZpos;
+ sprintf(cTagV,"UM%02d",iDet+kNdet);
+ sprintf(cTagM,"UG%02d",iDet+kNdet);
+ gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
+ }
+ }
+ if (fRICHhole) {
+ if (fClengthRH[iplan][icham] > 0.0) {
+ // Lower part
+ // Rohacell layer (radiator)
+ zpos = fgkRaZpos;
+ sprintf(cTagV,"UH%02d",iDet+2*kNdet);
+ sprintf(cTagM,"UC%02d",iDet+2*kNdet);
+ gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
+ // Mylar layer (entrance window + HV cathode)
+ zpos = fgkMyZpos;
+ sprintf(cTagV,"UI%02d",iDet+2*kNdet);
+ sprintf(cTagM,"UC%02d",iDet+2*kNdet);
+ gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
+ // Xe/Isobutane layer (drift volume)
+ zpos = fgkDrZpos;
+ sprintf(cTagV,"UJ%02d",iDet+2*kNdet);
+ sprintf(cTagM,"UC%02d",iDet+2*kNdet);
+ gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
+ // Upper part
+ // Xe/Isobutane layer (amplification volume)
+ zpos = fgkAmZpos;
+ sprintf(cTagV,"UK%02d",iDet+2*kNdet);
+ sprintf(cTagM,"UE%02d",iDet+2*kNdet);
+ gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
+ // Readout part
+ // Cu layer (pad plane)
+ zpos = fgkCuZpos;
+ sprintf(cTagV,"UL%02d",iDet+2*kNdet);
+ sprintf(cTagM,"UG%02d",iDet+2*kNdet);
+ gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
+ // G10 layer (support structure)
+ zpos = fgkSuZpos;
+ sprintf(cTagV,"UM%02d",iDet+2*kNdet);
+ sprintf(cTagM,"UG%02d",iDet+2*kNdet);
+ gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
+ }
+ }
+
+ // Position the inner volumes of the chambers in the frames
+ xpos = 0.0;
+ ypos = 0.0;
+ zpos = 0.0;
+ // The inside of the lower G10 frame
+ sprintf(cTagV,"UC%02d",iDet);
+ sprintf(cTagM,"UB%02d",iDet);
+ gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
+ // The lower G10 frame inside the aluminum frame
+ sprintf(cTagV,"UB%02d",iDet);
+ sprintf(cTagM,"UA%02d",iDet);
+ gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
+ // The inside of the upper G10 frame
+ sprintf(cTagV,"UE%02d",iDet);
+ sprintf(cTagM,"UD%02d",iDet);
+ gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
+ // The inside of the upper aluminum frame
+ sprintf(cTagV,"UG%02d",iDet);
+ sprintf(cTagM,"UF%02d",iDet);
+ gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
+ if (fPHOShole) {
+ if (fClengthPH[iplan][icham] > 0.0) {
+ // The inside of the lower G10 frame
+ sprintf(cTagV,"UC%02d",iDet+kNdet);
+ sprintf(cTagM,"UB%02d",iDet+kNdet);
+ gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
+ // The lower G10 frame inside the aluminum frame
+ sprintf(cTagV,"UB%02d",iDet+kNdet);
+ sprintf(cTagM,"UA%02d",iDet+kNdet);
+ gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
+ // The inside of the upper G10 frame
+ sprintf(cTagV,"UE%02d",iDet+kNdet);
+ sprintf(cTagM,"UD%02d",iDet+kNdet);
+ gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
+ // The inside of the upper aluminum frame
+ sprintf(cTagV,"UG%02d",iDet+kNdet);
+ sprintf(cTagM,"UF%02d",iDet+kNdet);
+ gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
+ }
+ }
+ if (fRICHhole) {
+ if (fClengthRH[iplan][icham] > 0.0) {
+ // The inside of the lower G10 frame
+ sprintf(cTagV,"UC%02d",iDet+2*kNdet);
+ sprintf(cTagM,"UB%02d",iDet+2*kNdet);
+ gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
+ // The lower G10 frame inside the aluminum frame
+ sprintf(cTagV,"UB%02d",iDet+2*kNdet);
+ sprintf(cTagM,"UA%02d",iDet+2*kNdet);
+ gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
+ // The inside of the upper G10 frame
+ sprintf(cTagV,"UE%02d",iDet+2*kNdet);
+ sprintf(cTagM,"UD%02d",iDet+2*kNdet);
+ gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
+ // The inside of the upper aluminum frame
+ sprintf(cTagV,"UG%02d",iDet+2*kNdet);
+ sprintf(cTagM,"UF%02d",iDet+2*kNdet);
+ gMC->Gspos(cTagV,1,cTagM,xpos,ypos,zpos,0,"ONLY");
+ }
+ }
+
+ // Position the frames of the chambers in the TRD mother volume
+ xpos = 0.;
+ ypos = - fClength[iplan][0] - fClength[iplan][1] - fClength[iplan][2]/2.;
+ for (Int_t ic = 0; ic < icham; ic++) {
+ ypos += fClength[iplan][ic];
+ }
+ ypos += fClength[iplan][icham]/2.;
+ zpos = fgkCraH/2. + fgkCdrH/2. - fgkSheight/2. + iplan * (fgkCH + fgkVspace);
+ // The lower aluminum frame, radiator + drift region
+ sprintf(cTagV,"UA%02d",iDet);
+ gMC->Gspos(cTagV,1,"UTI1",xpos,ypos,zpos,0,"ONLY");
+ // The upper G10 frame, amplification region
+ sprintf(cTagV,"UD%02d",iDet);
+ zpos += fgkCamH/2. + fgkCraH/2. + fgkCdrH/2.;
+ gMC->Gspos(cTagV,1,"UTI1",xpos,ypos,zpos,0,"ONLY");
+ // The upper aluminum frame
+ sprintf(cTagV,"UF%02d",iDet);
+ zpos += fgkCroH/2. + fgkCamH/2.;
+ gMC->Gspos(cTagV,1,"UTI1",xpos,ypos,zpos,0,"ONLY");
+ if (fPHOShole) {
+ if (fClengthPH[iplan][icham] > 0.0) {
+ xpos = 0.;
+ ypos = - fClength[iplan][0] - fClength[iplan][1] - fClength[iplan][2]/2.;
+ for (Int_t ic = 0; ic < icham; ic++) {
+ ypos += fClength[iplan][ic];
+ }
+ if (icham > 2) {
+ ypos += fClength[iplan][icham];
+ ypos -= fClengthPH[iplan][icham]/2.;
+ }
+ else {
+ ypos += fClengthPH[iplan][icham]/2.;
+ }
+ zpos = fgkCraH/2. + fgkCdrH/2. - fgkSheight/2. + iplan * (fgkCH + fgkVspace);
+ // The lower aluminum frame, radiator + drift region
+ sprintf(cTagV,"UA%02d",iDet+kNdet);
+ gMC->Gspos(cTagV,1,"UTI2",xpos,ypos,zpos,0,"ONLY");
+ // The upper G10 frame, amplification region
+ sprintf(cTagV,"UD%02d",iDet+kNdet);
+ zpos += fgkCamH/2. + fgkCraH/2. + fgkCdrH/2.;
+ gMC->Gspos(cTagV,1,"UTI2",xpos,ypos,zpos,0,"ONLY");
+ // The upper aluminum frame
+ sprintf(cTagV,"UF%02d",iDet+kNdet);
+ zpos += fgkCroH/2. + fgkCamH/2.;
+ gMC->Gspos(cTagV,1,"UTI2",xpos,ypos,zpos,0,"ONLY");
+ }
+ }
+ if (fRICHhole) {
+ if (fClengthRH[iplan][icham] > 0.0) {
+ xpos = 0.;
+ ypos = - fClength[iplan][0] - fClength[iplan][1] - fClength[iplan][2]/2.;
+ for (Int_t ic = 0; ic < icham; ic++) {
+ ypos += fClength[iplan][ic];
+ }
+ if (icham > 2) {
+ ypos += fClength[iplan][icham];
+ ypos -= fClengthRH[iplan][icham]/2.;
+ }
+ else {
+ ypos += fClengthRH[iplan][icham]/2.;
+ }
+ zpos = fgkCraH/2. + fgkCdrH/2. - fgkSheight/2. + iplan * (fgkCH + fgkVspace);
+ // The lower aluminum frame, radiator + drift region
+ sprintf(cTagV,"UA%02d",iDet+2*kNdet);
+ gMC->Gspos(cTagV,1,"UTI3",xpos,ypos,zpos,0,"ONLY");
+ // The upper G10 frame, amplification region
+ sprintf(cTagV,"UD%02d",iDet+2*kNdet);
+ zpos += fgkCamH/2. + fgkCraH/2. + fgkCdrH/2.;
+ gMC->Gspos(cTagV,1,"UTI3",xpos,ypos,zpos,0,"ONLY");
+ // The upper aluminum frame
+ sprintf(cTagV,"UF%02d",iDet+2*kNdet);
+ zpos += fgkCroH/2. + fgkCamH/2.;
+ gMC->Gspos(cTagV,1,"UTI3",xpos,ypos,zpos,0,"ONLY");
+ }
+ }
+
+ }
+ }
+
+ xpos = 0.;
+ ypos = 0.;
+ zpos = 0.;
+ gMC->Gspos("UTI1",1,"UTS1",xpos,ypos,zpos,0,"ONLY");
+ if (fPHOShole) {
+ gMC->Gspos("UTI2",2,"UTS2",xpos,ypos,zpos,0,"ONLY");
+ }
+ if (fRICHhole) {
+ gMC->Gspos("UTI3",3,"UTS3",xpos,ypos,zpos,0,"ONLY");
+ }
+
+ xpos = 0.;
+ ypos = 0.;
+ zpos = 0.;
+ gMC->Gspos("UTS1",1,"UTR1",xpos,ypos,zpos,0,"ONLY");
+ if (fPHOShole) {
+ gMC->Gspos("UTS2",2,"UTR2",xpos,ypos,zpos,0,"ONLY");
+ }
+ if (fRICHhole) {
+ gMC->Gspos("UTS3",3,"UTR3",xpos,ypos,zpos,0,"ONLY");
+ }
+
+ xpos = 0.;
+ ypos = 0.;
+ zpos = 0.;
+ gMC->Gspos("UTR1",1,"BTR1",xpos,ypos,zpos,0,"ONLY");
+ if (fPHOShole) {
+ gMC->Gspos("UTR2",2,"BTR2",xpos,ypos,zpos,0,"ONLY");
+ }
+ else {
+ gMC->Gspos("UTR1",2,"BTR2",xpos,ypos,zpos,0,"ONLY");
+ }
+ if (fRICHhole) {
+ gMC->Gspos("UTR3",3,"BTR3",xpos,ypos,zpos,0,"ONLY");
+ }
+ else {
+ gMC->Gspos("UTR1",3,"BTR3",xpos,ypos,zpos,0,"ONLY");
+ }
+
+ // Create the volumes of the super module frame
+ CreateFrame(idtmed);
+
+ // Create the volumes of the services
+ CreateServices(idtmed);
+
+}
+
+//_____________________________________________________________________________
+void AliTRDgeometryFull::CreateFrame(Int_t *idtmed)
+{
+ //
+ // Create the geometry of the frame of the supermodule
+ //
+ // Names of the TRD services volumina
+ //
+ // USRL Support rails for the chambers (Al)
+ // USxx Support cross bars between the chambers (Al)
+ //
+
+ Int_t iplan = 0;
+
+ Float_t xpos = 0.0;
+ Float_t ypos = 0.0;
+ Float_t zpos = 0.0;
+
+ Char_t cTagV[5];
+
+ //
+ // The chamber support rails
+ //
+
+ const Float_t kSRLwid = 2.0;
+ const Float_t kSRLhgt = 2.3;
+ const Float_t kSRLdst = 0.6;
+ const Int_t kNparSRL = 3;
+ Float_t parSRL[kNparSRL];
+ parSRL[0] = kSRLwid/2.;
+ parSRL[1] = fgkSlenTR1/2.;
+ parSRL[2] = kSRLhgt/2.;
+ gMC->Gsvolu("USRL","BOX ",idtmed[1301-1],parSRL,kNparSRL);
+
+ xpos = 0.0;
+ ypos = 0.0;
+ zpos = 0.0;
+ for (iplan = 0; iplan < kNplan; iplan++) {
+
+ xpos = fCwidth[iplan]/2. + kSRLwid/2. + kSRLdst;
+ ypos = 0.0;
+ zpos = fgkCraH + fgkCdrH - fgkSheight/2. - kSRLhgt/2.
+ + iplan * (fgkCH + fgkVspace);
+ gMC->Gspos("USRL",iplan+1 ,"UTI1", xpos,ypos,zpos,0,"ONLY");
+ gMC->Gspos("USRL",iplan+1+ kNplan,"UTI1",-xpos,ypos,zpos,0,"ONLY");
+ if (fPHOShole) {
+ gMC->Gspos("USRL",iplan+1+2*kNplan,"UTI2", xpos,ypos,zpos,0,"ONLY");
+ gMC->Gspos("USRL",iplan+1+3*kNplan,"UTI2",-xpos,ypos,zpos,0,"ONLY");
+ }
+ if (fRICHhole) {
+ gMC->Gspos("USRL",iplan+1+4*kNplan,"UTI3", xpos,ypos,zpos,0,"ONLY");
+ gMC->Gspos("USRL",iplan+1+5*kNplan,"UTI3",-xpos,ypos,zpos,0,"ONLY");
+ }
+
+ }
+
+ //
+ // The cross bars between the chambers
+ //
+
+ const Float_t kSCBwid = 1.0;
+ const Int_t kNparSCB = 3;
+ Float_t parSCB[kNparSCB];
+ parSCB[1] = kSCBwid/2.;
+ parSCB[2] = fgkCH/2.;
+
+ xpos = 0.0;
+ ypos = 0.0;
+ zpos = 0.0;
+ for (iplan = 0; iplan < kNplan; iplan++) {
+
+ parSCB[0] = fCwidth[iplan]/2. + kSRLdst/2.;
+
+ sprintf(cTagV,"US0%01d",iplan);
+ gMC->Gsvolu(cTagV,"BOX ",idtmed[1301-1],parSCB,kNparSCB);
+ xpos = 0.0;
+ ypos = fgkSlenTR1/2. - kSCBwid/2.;
+ zpos = fgkCH/2. - fgkSheight/2. + iplan * (fgkCH + fgkVspace);
+ gMC->Gspos(cTagV,1,"UTI1", xpos,ypos,zpos,0,"ONLY");