+ if (xx > xxmax4 && xx< xxmax) {
+ TVirtualMC::GetMC()->Gspos("S05E",2*index-1,"SD5B", xx, 0.,-kBframeWidth/2.+ kNulocWidth/2, 0, "ONLY");
+ TVirtualMC::GetMC()->Gspos("S05E",2*index ,"SD5B", xx, 0., kBframeWidth/2.- kNulocWidth/2, 0, "ONLY");
+ TVirtualMC::GetMC()->Gspos("S06E",2*index-1,"SD6B", xx, 0.,-kBframeWidth/2.+ kNulocWidth/2, 0, "ONLY");
+ TVirtualMC::GetMC()->Gspos("S06E",2*index ,"SD6B", xx, 0., kBframeWidth/2.- kNulocWidth/2, 0, "ONLY");
+ }
+ }
+
+ //
+ //Geometry of the support pannel Verticla length 3.62m, horizontal length 1.62m, internal radius dMotherInner of SC05 and SC06 (F. Orsini, Saclay)
+ //Carbon fiber of 0.3 mm thick (2 layers) and a central layer of Nomex of 15mm thick.
+ // Outer excess and inner recess for mother volume radius
+ // with respect to ROuter and RInner
+ Float_t dMotherInner = AliMUONConstants::Rmin(2)-kRframeHeight;
+ Float_t nomexthickness = 1.5;
+ Float_t carbonthickness = 0.03;
+ Float_t supporthlength = 162.; // chamber 5
+ Float_t supporthlengthCh6 = 167.; // chamber 6
+ Float_t supportvlength = 362.;
+
+ // Generating the composite shape of the carbon and nomex pannels
+ new TGeoBBox("shNomexBoxSt3",supporthlength/2., supportvlength/2. ,nomexthickness/2.+carbonthickness+3*kCableWidth);
+ new TGeoBBox("shCarbonBoxSt3",supporthlength/2., supportvlength/2. ,carbonthickness/2.);
+ new TGeoBBox("shNomexBoxSt3Ch6",(supporthlengthCh6)/2., supportvlength/2. ,nomexthickness/2.+carbonthickness+3*kCableWidth);
+ new TGeoBBox("shCarbonBoxSt3Ch6",(supporthlengthCh6)/2., supportvlength/2. ,carbonthickness/2.);
+ new TGeoTubeSeg("shNomexHoleSt3",0., dMotherInner, nomexthickness/2.+carbonthickness+3*kCableWidth+0.001, -90. ,90.);
+ new TGeoTubeSeg("shCarbonHoleSt3",0., dMotherInner, carbonthickness/2.+0.001, -90. ,90.);
+ TGeoTranslation* trHoleSt3 = new TGeoTranslation("trHoleSt3",-supporthlength/2.,0.,0.);
+ trHoleSt3->RegisterYourself();
+ TGeoTranslation* trHoleSt3Ch6 = new TGeoTranslation("trHoleSt3Ch6",-(supporthlengthCh6)/2.,0.,0.);
+ trHoleSt3Ch6->RegisterYourself();
+ TGeoCompositeShape* shNomexSupportSt3 = new TGeoCompositeShape("shNomexSupportSt3","shNomexBoxSt3-shNomexHoleSt3:trHoleSt3");
+ TGeoCompositeShape* shCarbonSupportSt3 = new TGeoCompositeShape("shCarbonSupportSt3","shCarbonBoxSt3-shCarbonHoleSt3:trHoleSt3");
+ TGeoCompositeShape* shNomexSupportSt3Ch6 = new TGeoCompositeShape("shNomexSupportSt3Ch6","shNomexBoxSt3Ch6-shNomexHoleSt3:trHoleSt3Ch6");
+ TGeoCompositeShape* shCarbonSupportSt3Ch6 = new TGeoCompositeShape("shCarbonSupportSt3Ch6","shCarbonBoxSt3Ch6-shCarbonHoleSt3:trHoleSt3Ch6");
+
+ // Generating Nomex and Carbon pannel volumes
+ TGeoVolume * voNomexSupportSt3 = new TGeoVolume("S05S", shNomexSupportSt3, kMedNomex);
+ TGeoVolume * voCarbonSupportSt3 = new TGeoVolume("S05K", shCarbonSupportSt3, kMedCarbon);
+ TGeoVolume * voNomexSupportSt3Ch6 = new TGeoVolume("S06S", shNomexSupportSt3Ch6, kMedNomex);
+ TGeoVolume * voCarbonSupportSt3Ch6 = new TGeoVolume("S06K", shCarbonSupportSt3Ch6, kMedCarbon);
+
+ TGeoTranslation *trCarbon1St3 = new TGeoTranslation("trCarbon1St3",0.,0., -(nomexthickness+carbonthickness)/2.);
+ TGeoTranslation *trCarbon2St3 = new TGeoTranslation("trCarbon2St3",0.,0., (nomexthickness+carbonthickness)/2.);
+ voNomexSupportSt3->AddNode(voCarbonSupportSt3,1,trCarbon1St3);
+ voNomexSupportSt3->AddNode(voCarbonSupportSt3,2,trCarbon2St3);
+ voNomexSupportSt3Ch6->AddNode(voCarbonSupportSt3Ch6,1,trCarbon1St3);
+ voNomexSupportSt3Ch6->AddNode(voCarbonSupportSt3Ch6,2,trCarbon2St3);
+
+
+ // Add readout cables
+ TVirtualMC::GetMC()->Gsvolu("S05L","BOX",kCableMaterial,dum,0);
+ TVirtualMC::GetMC()->Gsvolu("S06L","BOX",kCableMaterial,dum,0);
+
+ ySlat3 = 0.;
+ Float_t lCableX = 0.;
+ Float_t lCableX6 = 0.;
+ Float_t lCableY = 0.;
+ Float_t lCableZ = 0.;
+ Float_t cablepar[3] = {static_cast<Float_t>(supporthlength/2.), static_cast<Float_t>(kCableHeight/2.), static_cast<Float_t>(kCableWidth/2.)};
+ Float_t cablepar6[3] = {static_cast<Float_t>(supporthlengthCh6/2.), static_cast<Float_t>(kCableHeight/2.), static_cast<Float_t>(kCableWidth/2.)};
+ Float_t lCableDY = 0.;
+ Int_t cIndex = 0;
+ Int_t cIndex6 = 0;
+ for (i = 0; i<kNslats3; i++){
+ Int_t iCable = 1;
+ cIndex = 0;
+ cIndex6 = 0;
+ ySlat3 += kYpos3[i];
+ lCableY = ySlat3;
+
+ // Cables going out from the start of slat
+ if(kNPCB3[i]>=4 && i<kNslats3-2){ // Only if 4 or more pcb
+ // First top cables
+ cablepar[0] = supporthlength/2.;
+ lCableX = 0.;
+ cablepar6[0] = supporthlengthCh6/2.;
+ lCableX6 = 0.;
+ lCableDY = (kYpos3[i+1]+kYpos3[i+2])/2.-cablepar[1]; // half way between 2 slats on same side
+ lCableZ = TMath::Power(-1,i)*(nomexthickness/2.+carbonthickness+(-1+iCable++)*kCableWidth+kCableWidth/2.);
+ if(i==0){ // central slat is shorter (rounded)
+ cablepar[0] -= (kPcbLength-csvPcbLength)/2.;
+ lCableX = (kPcbLength-csvPcbLength)/2.;
+ cablepar6[0] -= (kPcbLength-csvPcbLength)/2.;
+ lCableX6 = (kPcbLength-csvPcbLength)/2.;
+ }
+ TVirtualMC::GetMC()->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,lCableY+lCableDY,lCableZ,0,"ONLY",cablepar,3);
+ TVirtualMC::GetMC()->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,-(lCableY+lCableDY),lCableZ,0,"ONLY",cablepar,3);
+ TVirtualMC::GetMC()->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,lCableY+lCableDY,lCableZ,0,"ONLY",cablepar6,3);
+ TVirtualMC::GetMC()->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,-(lCableY+lCableDY),lCableZ,0,"ONLY",cablepar6,3);
+
+ // Then bottom cables
+ if(i>0){
+ if(i==1){ // Rounded slat. Bottom cable starts at dMotherInner (beam pipe)
+ cablepar[0] -= dMotherInner/2.;
+ lCableX += dMotherInner/2.;
+ cablepar6[0] -= dMotherInner/2.;
+ lCableX6 += dMotherInner/2.;
+ lCableDY = (kYpos3[i]+kYpos3[i])/2.-cablepar[1];
+ }
+ if(i>=2){
+ lCableDY = (kYpos3[i]+kYpos3[i-1])/2.-cablepar[1]; // half way between 2 slats on same side
+ if ((lCableY-lCableDY)<(dMotherInner+cablepar[1])){
+ lCableDY = lCableY - dMotherInner - cablepar[1];
+ }
+ }
+ TVirtualMC::GetMC()->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,lCableY-lCableDY,lCableZ,0,"ONLY",cablepar,3);
+ TVirtualMC::GetMC()->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,-(lCableY-lCableDY),lCableZ,0,"ONLY",cablepar,3);
+ TVirtualMC::GetMC()->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,lCableY-lCableDY,lCableZ,0,"ONLY",cablepar6,3);
+ TVirtualMC::GetMC()->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,-(lCableY-lCableDY),lCableZ,0,"ONLY",cablepar6,3);
+ }
+ }
+
+ // Rounded slats have an extra cable starting at second pcb
+ if(i==1){
+ // First top cables
+ cablepar[0] = (supporthlength-kPcbLength-kVframeLength)/2.;
+ lCableX = (kPcbLength+kVframeLength)/2.;
+ cablepar6[0] = (supporthlengthCh6-kPcbLength-kVframeLength)/2.;
+ lCableX6 = (kPcbLength+kVframeLength)/2.;
+ lCableDY = (kYpos3[i+1]+kYpos3[i+2])/2.-cablepar[1]; // half way between 2 slats on same side
+ lCableZ = TMath::Power(-1,i)*(nomexthickness/2.+carbonthickness+(-1+iCable++)*kCableWidth+kCableWidth/2.);
+ TVirtualMC::GetMC()->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,lCableY+lCableDY,lCableZ,0,"ONLY",cablepar,3);
+ TVirtualMC::GetMC()->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,-(lCableY+lCableDY),lCableZ,0,"ONLY",cablepar,3);
+ TVirtualMC::GetMC()->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,lCableY+lCableDY,lCableZ,0,"ONLY",cablepar6,3);
+ TVirtualMC::GetMC()->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,-(lCableY+lCableDY),lCableZ,0,"ONLY",cablepar6,3);
+ // Then bottom cables
+ lCableDY = (kYpos3[i]+kYpos3[i])/2.-cablepar[1];
+ TVirtualMC::GetMC()->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,lCableY-lCableDY,lCableZ,0,"ONLY",cablepar,3);
+ TVirtualMC::GetMC()->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,-(lCableY-lCableDY),lCableZ,0,"ONLY",cablepar,3);
+ TVirtualMC::GetMC()->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,lCableY-lCableDY,lCableZ,0,"ONLY",cablepar6,3);
+ TVirtualMC::GetMC()->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,-(lCableY-lCableDY),lCableZ,0,"ONLY",cablepar6,3);
+ }
+
+ // Cables going out from the end of the slats
+ // First top cables
+ cablepar[0] = (supporthlength-(slatLength3[i]+kDslatLength)+kVframeLength)/2.;
+ lCableX = slatLength3[i]-kVframeLength+kDslatLength+cablepar[0]-supporthlength/2.;
+ cablepar6[0] = (supporthlengthCh6-(slatLength3[i]+kDslatLength)+kVframeLength)/2.;
+ lCableX6 = slatLength3[i]-kVframeLength+kDslatLength+cablepar6[0]-supporthlengthCh6/2.;
+ if(i+1>=kNslats3 || i+2>=kNslats3){ // If no more higher slats, then use distance to lower slat
+ lCableDY = kPcbHeight/2.+cablepar[1];
+ }
+ else {
+ lCableDY = (kYpos3[i+1]+kYpos3[i+2])/2.-cablepar[1];
+ }
+ lCableZ = TMath::Power(-1,i)*(nomexthickness/2.+carbonthickness+(-1+iCable++)*kCableWidth+kCableWidth/2.);
+
+ if (i<=2){ // shortened pcb
+ cablepar[0] += pcbDLength3/2.;
+ lCableX -= pcbDLength3/2.;
+ }
+ TVirtualMC::GetMC()->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,lCableY+lCableDY,lCableZ,0,"ONLY",cablepar,3);
+ TVirtualMC::GetMC()->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,-(lCableY+lCableDY),lCableZ,0,"ONLY",cablepar,3);
+ TVirtualMC::GetMC()->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,lCableY+lCableDY,lCableZ,0,"ONLY",cablepar6,3);
+ TVirtualMC::GetMC()->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,-(lCableY+lCableDY),lCableZ,0,"ONLY",cablepar6,3);
+ // Then bottom cables
+ if(i>0){ // Loop is over top half of slats, lower half are symmetric
+ if (i==1) {
+ lCableDY = (kYpos3[i]+kYpos3[i])/2.-cablepar[1];
+ }
+ else{
+ lCableDY = (kYpos3[i]+kYpos3[i-1])/2.-cablepar[1]; // half way between 2 slats on same side
+ }
+ TVirtualMC::GetMC()->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,lCableY-lCableDY,lCableZ,0,"ONLY",cablepar,3);
+ TVirtualMC::GetMC()->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,-(lCableY-lCableDY),lCableZ,0,"ONLY",cablepar,3);
+ TVirtualMC::GetMC()->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,lCableY-lCableDY,lCableZ,0,"ONLY",cablepar6,3);
+ TVirtualMC::GetMC()->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,-(lCableY-lCableDY),lCableZ,0,"ONLY",cablepar6,3);