]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSv11GeometrySPD.cxx
This should have been removed a long time ago
[u/mrichter/AliRoot.git] / ITS / AliITSv11GeometrySPD.cxx
index e7cd05847c3231aa13f2a08691641a2e824e23b0..cfb2765f9d9cff79f64479b8c80aa14efdcade4e 100644 (file)
@@ -213,7 +213,7 @@ AliITSv11GeometrySPD& AliITSv11GeometrySPD::operator=(const
 }
 //______________________________________________________________________
 TGeoMedium* AliITSv11GeometrySPD::GetMedium(const char* mediumName,
-                                            TGeoManager *mgr) const
+                                            const TGeoManager *mgr) const
 {
     //
     // This function is used to recovery any medium
@@ -223,7 +223,7 @@ TGeoMedium* AliITSv11GeometrySPD::GetMedium(const char* mediumName,
     //
      Char_t itsMediumName[30];
 
-     sprintf(itsMediumName, "ITS_%s", mediumName);
+     snprintf(itsMediumName, 30, "ITS_%s", mediumName);
      TGeoMedium* medium = mgr->GetMedium(itsMediumName);
      if (!medium) AliError(Form("Medium <%s> not found", mediumName));
 
@@ -592,6 +592,7 @@ void AliITSv11GeometrySPD::CarbonFiberSector(TGeoVolume *moth, Int_t sect,
     const Int_t ksecDipIndex[ksecNCoolingTubeDips] = {2, 5, 8, 11, 14, 17};
     Double_t secAngleStart[ksecNRadii];
     Double_t secAngleEnd[ksecNRadii];
+    for(Int_t i = 0; i < ksecNRadii; i++)secAngleEnd[i] = 0.;
     Double_t secAngleStart2[ksecNRadii];
     Double_t secAngleEnd2[ksecNRadii];
     Double_t secAngleTurbo[ksecNCoolingTubeDips] = {0., 0., 0., 0., 0., 0.0};
@@ -1606,16 +1607,16 @@ TGeoCompositeShape* AliITSv11GeometrySPD::CreateGroundingFoilShape
     } // end if itype==1
     switch (itype) {
     case 0:
-        sprintf(type,"Kap");
+        snprintf(type,10,"Kap");
         break;
     case 1:
-        sprintf(type,"Alu");
+        snprintf(type,10, "Alu");
         break;
     case 2:
-        sprintf(type,"Glue1");
+        snprintf(type,10,"Glue1");
         break;
     case 3:
-        sprintf(type,"Glue2");
+        snprintf(type,10,"Glue2");
         break;
     }
     // we divide the shape in several slices along the horizontal
@@ -1650,6 +1651,8 @@ TGeoCompositeShape* AliITSv11GeometrySPD::CreateGroundingFoilShape
     shGroundFull = new TGeoBBox(Form("ITSSPDSHgFoil%sFull", type),
                                 0.5*length,0.5*width, 0.5*thickness);
 
+    if(GetDebug(5)) shGroundFull->Print(); // Avoid Coverity warning
+
     // create the polygonal shape to be subtracted to give the correct
     // shape to the borders its vertices are defined in sugh a way that
     // this polygonal will be placed in the correct place considered
@@ -1741,9 +1744,8 @@ TGeoCompositeShape* AliITSv11GeometrySPD::CreateGroundingFoilShape
     Double_t holeY = 0.5*(width - holeWidth) - widthMin;
 
     // create a shape for the holes (common)
-    TGeoBBox *shHole = 0;
-    shHole = new TGeoBBox(Form("ITSSPD%sGfoilHole", type),0.5*holeLength,
-                          0.5*holeWidth, thickness);
+    new TGeoBBox(Form("ITSSPD%sGfoilHole", type),0.5*holeLength,
+                       0.5*holeWidth, thickness);
 
     // insert the holes in the XTRU shape:
     // starting from the first value of X, they are simply
@@ -1764,7 +1766,7 @@ TGeoCompositeShape* AliITSv11GeometrySPD::CreateGroundingFoilShape
             holeX += holeSepX2;
         } // end if else if's
         //cout << i << " --> X = " << holeX << endl;
-        sprintf(name,"ITSSPDTRgFoil%sHole%d", type, i);
+        snprintf(name,200,"ITSSPDTRgFoil%sHole%d", type, i);
         transHole[i] = new TGeoTranslation(name, holeX, holeY, 0.0);
         transHole[i]->RegisterYourself();
         strComposite.Append(Form("ITSSPD%sGfoilHole:%s", type, name));
@@ -1807,7 +1809,7 @@ TGeoVolumeAssembly* AliITSv11GeometrySPD::CreateGroundingFoil(Bool_t isRight,
     // create a suffix to be used in the names of all shapes
     //
     char suf[5];
-    if (isRight) strcpy(suf, "R"); else strcpy(suf, "L");
+    if (isRight) strncpy(suf, "R", 5); else strncpy(suf, "L", 5);
     // this volume will be created in order to ease its placement in
     // the half-stave; then, it is added here the small distance of
     // the "central" edge of each volume from the Z=0 plane in the stave
@@ -1982,7 +1984,7 @@ TGeoVolumeAssembly* AliITSv11GeometrySPD::CreateMCM(Bool_t isRight,
 
     // to distinguish the "left" and "right" objects, a suffix is created
     char suf[5];
-    if (isRight) strcpy(suf, "R"); else strcpy(suf, "L");
+    if (isRight) strncpy(suf, "R", 5); else strncpy(suf, "L", 5);
 
     // ** MEDIA **
     TGeoMedium *medBase = GetMedium("SPD KAPTON(POLYCH2)$",mgr);// ??? MCM BASE
@@ -2366,12 +2368,12 @@ TGeoVolumeAssembly* AliITSv11GeometrySPD::CreatePixelBus
                                    0.5*capWidth, 0.5*capLength);
 
     char extname[12];
-    sprintf(extname,"Extender1l%d",ilayer);
+    snprintf(extname,12,"Extender1l%d",ilayer);
     TGeoVolume *ext1 = mgr->MakeBox(extname, medExt, 0.5*extThickness, 0.5*extWidth, 0.5*ext1Length);
-    sprintf(extname,"Extender2l%d",ilayer);
+    snprintf(extname,12,"Extender2l%d",ilayer);
     TGeoVolume *ext2 = mgr->MakeBox(extname, medExt, 0.5*extHeight - 2.*extThickness, 0.5*extWidth, 0.5*extThickness);
     TGeoVolume *ext3=0;
-    sprintf(extname,"Extender3l%d",ilayer);
+    snprintf(extname,12,"Extender3l%d",ilayer);
     if (ilayer==1) {
       Double_t halflen=(0.5*ext2Length + extThickness);
       Double_t xprof[6],yprof[6];
@@ -2574,7 +2576,7 @@ TList* AliITSv11GeometrySPD::CreateConeModule(Bool_t sideC, const Double_t angro
     const Double_t kCollThickness   =  10.0  *fgkmm;
     const Double_t kCollTubeThick   =   1.0  *fgkmm;
     const Double_t kCollTubeRadius  =   7.0  *fgkmm;
-    const Double_t kCollTubeLength  = 190.0  *fgkmm;
+    const Double_t kCollTubeLength  = 205.0  *fgkmm;
 
     const Double_t kOptFibDiamet    =   4.5  *fgkmm;
 
@@ -2584,7 +2586,10 @@ TList* AliITSv11GeometrySPD::CreateConeModule(Bool_t sideC, const Double_t angro
     Int_t kPurple = 6; // Purple (Root does not define it)
 
     TGeoVolumeAssembly* container[5];
-    container[0] = new TGeoVolumeAssembly("ITSSPDConeModule");
+    if (sideC)
+    container[0] = new TGeoVolumeAssembly("ITSSPDConeModuleC");
+    else
+    container[0] = new TGeoVolumeAssembly("ITSSPDConeModuleA");
     container[1] = new TGeoVolumeAssembly("ITSSPDCoolingModuleSideA");
     container[2] = new TGeoVolumeAssembly("ITSSPDCoolingModuleSideC");
     container[3] = new TGeoVolumeAssembly("ITSSPDPatchPanelModule");
@@ -2642,7 +2647,7 @@ TList* AliITSv11GeometrySPD::CreateConeModule(Bool_t sideC, const Double_t angro
                                   0.5*cableW2,
                                   0.5*thickness);
     Char_t string[255];
-    sprintf(string, "%s-%s", shOut->GetName(), shIn->GetName());
+    snprintf(string, 255, "%s-%s", shOut->GetName(), shIn->GetName());
     TGeoCompositeShape *shPlate = new TGeoCompositeShape("ITSSPDPlate_shape",
                                 string);
 
@@ -2659,7 +2664,7 @@ TList* AliITSv11GeometrySPD::CreateConeModule(Bool_t sideC, const Double_t angro
     volCollTube->SetLineColor(kAzure);
 
     // The cooling tube on the cone as a Ctub
-    Double_t tubeLength = shCable->GetX(5) - shCable->GetX(0) + kYtoHalfStave;
+    Double_t tubeLength = shCable->GetX(5) - shCable->GetX(0) + kYtoHalfStave -0.85;
     TGeoCtub *shTube = new TGeoCtub(0, kConeTubeRmax, 0.5*tubeLength, 0, 360,
                                    0, SinD(angrot/2), -CosD(angrot/2),
                                    0,              0,              1);
@@ -2714,7 +2719,7 @@ TList* AliITSv11GeometrySPD::CreateConeModule(Bool_t sideC, const Double_t angro
     volCylGasFr->SetLineColor(kPurple);
 
     // The optical fibers bundle on the cone as a Tube
-    Double_t optLength = shCable->GetX(5) - shCable->GetX(0) + kYtoHalfStave;
+    Double_t optLength = shCable->GetX(5) - shCable->GetX(0) + kYtoHalfStave -0.85;
     TGeoTube *shOptFibs = new TGeoTube(0., 0.5*kOptFibDiamet, 0.5*optLength);
 
     TGeoVolume *volOptFibs = new TGeoVolume("ITSSPDOpticalFibersOnCone",
@@ -2809,7 +2814,7 @@ TList* AliITSv11GeometrySPD::CreateConeModule(Bool_t sideC, const Double_t angro
       container[0]->AddNode(volCollTube, 1, trCollTube);
     }
         
-    Double_t dxPatch = 2.9;
+    Double_t dxPatch = 2.75;
     Double_t dzPatch = 2.8;
     TGeoCombiTrans *tr2 = new TGeoCombiTrans(1.7*ext2Length - dxPatch, 0.0, dzPatch, rot2);
     container[3]->AddNode(volPatch, 0, tr2);
@@ -2885,7 +2890,7 @@ void AliITSv11GeometrySPD::CreateCones(TGeoVolume *moth) const
     const Int_t kNumberOfModules    =  10;
 
     const Double_t kInnerRadius     =  80.775*fgkmm;
-    const Double_t kZTrans          = 452.000*fgkmm;
+    const Double_t kZTrans          = 451.800*fgkmm;
     const Double_t kAlphaRot        =  46.500*fgkDegree;
     const Double_t kAlphaSpaceCool  =   9.200*fgkDegree;
 
@@ -3287,7 +3292,7 @@ Int_t layer,Int_t idxCentral,Int_t idxSide,TArrayD &sizes,TGeoManager *mgr)
     CreateClip(clipSize, kTRUE, mgr);
     // define clip movements (width direction)
     sizes[3] = xBus + 0.5*busThickness;
-    sizes[4] = 0.5 * (fullWidth - busWidth) - clipSize[6] - fgkmm*0.48;
+    sizes[4] = 0.5 * (fullWidth - busWidth) - clipSize[6] - fgkmm*0.26;
     sizes[5] = zBus + busSize[4];
     sizes[6] = zBus + busSize[5];
 
@@ -3690,15 +3695,19 @@ void AliITSv11GeometrySPD::ReadAscii(istream* is)
     //   none.
     //
     Int_t i,j,k,n;
-    Double_t gapLadder,GapHalfStave;
-
-    *is>>gapLadder>>GapHalfStave>>n;
+    Double_t gapLadder,gapHalfStave;
+    const Int_t kLimits = 100;
+    *is>>gapLadder>>gapHalfStave>>n;
     if(n!=6){
-        Warning("ReadAscii","fAddStave Array !=6 n=%d",n);
+      AliError(Form("fAddStave Array !=6 n=%d",n));
         return;
     } // end if
     for(i=0;i<n;i++) *is>>fAddStave[i];
     *is>>n;
+    if(n<0 || n> kLimits){
+      AliError("Anomalous value for parameter n");
+      return;
+    } 
     fSPDsectorX0.Set(n);
     fSPDsectorY0.Set(n);
     fSPDsectorX1.Set(n);