]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSv11GeomCableFlat.cxx
Fix Coverity
[u/mrichter/AliRoot.git] / ITS / AliITSv11GeomCableFlat.cxx
index ec84df14c2725c7f01417c3675016f677919ebe3..8053822372d570d0b4cde22bb41753f391ccec47 100644 (file)
@@ -13,6 +13,7 @@
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
+// $Id$
 
 //*************************************************************************
 //   Class for flat cables
@@ -54,6 +55,7 @@ AliITSv11GeomCableFlat::AliITSv11GeomCableFlat():
     fLayColor[i]     = 0;
     fLayMedia[i]     = 0;  
  };
+  for(Int_t i=0;i<3;i++)fPreviousX[i]=0.;
 }
 
 //________________________________________________________________________
@@ -71,8 +73,9 @@ AliITSv11GeomCableFlat(const char* name, Double_t width, Double_t thick) :
     fLayColor[i]     = 0;
     fLayMedia[i]     = 0;  
   }; 
+  for(Int_t i=0;i<3;i++)fPreviousX[i]=0.;
 }
-
+/*
 //________________________________________________________________________
 AliITSv11GeomCableFlat::AliITSv11GeomCableFlat(const AliITSv11GeomCableFlat &s) :
   AliITSv11GeomCable(s),fWidth(s.fWidth),fThick(s.fThick),fNlayer(s.fNlayer)
@@ -84,6 +87,8 @@ AliITSv11GeomCableFlat::AliITSv11GeomCableFlat(const AliITSv11GeomCableFlat &s)
     fLayMedia[i] = s.fLayMedia[i];
     fLayColor[i] = s.fLayColor[i];
   }
+  for(Int_t i=0;i<3;i++)fPreviousX[i]=s.fPreviousX[i];
+
 }
 
 //________________________________________________________________________
@@ -105,7 +110,7 @@ operator=(const AliITSv11GeomCableFlat &s) {
   };
   return *this;
 }
-
+*/
 //________________________________________________________________________
 Int_t AliITSv11GeomCableFlat::GetPoint( Int_t iCheckPt, Double_t *coord)
   const {
@@ -711,7 +716,7 @@ TGeoVolume* AliITSv11GeomCableFlat::CreateAndInsertCableCylSegment(Int_t p2,
   Double_t torusPhi1 = TMath::ACos(cosPhi);
   Double_t torusR = (length/2)/TMath::Sin(torusPhi1);
   torusPhi1 = torusPhi1*TMath::RadToDeg();
-  Double_t perpLength = TMath::Sqrt(torusR*torusR-length*length/4);
+  Double_t perpLength = TMath::Sqrt((torusR-0.5*length)*(torusR+0.5*length));
   Double_t localTransT[3] = {-perpLength,0,0};
   Double_t globalTransT[3];
   rotTorus.LocalToMasterVect(localTransT, globalTransT);
@@ -736,10 +741,10 @@ TGeoVolume* AliITSv11GeomCableFlat::CreateAndInsertCableCylSegment(Int_t p2,
 }
 
 //________________________________________________________________________
-TGeoVolume *AliITSv11GeomCableFlat::CreateSegment( Double_t *coord1,
-                                                  Double_t *coord2,
-                                                  Double_t *localVect1,
-                                                  Double_t *localVect2 )
+TGeoVolume *AliITSv11GeomCableFlat::CreateSegment( const Double_t *coord1,
+                                                  const Double_t *coord2,
+                                                  const Double_t *localVect1,
+                                                  const Double_t *localVect2 )
 {
   // Create a segment with arbitrary vertices (general case)
   //=================================================
@@ -789,6 +794,7 @@ TGeoVolume *AliITSv11GeomCableFlat::CreateSegment( Double_t *coord1,
   cableSeg->SetVertex( 7,  fWidth/2, -length/2 + dL1 - dl1);
 
   TGeoVolume *vCableSeg = new TGeoVolume(GetName(), cableSeg, fLayMedia[fNlayer-1]);
+  vCableSeg->SetLineColor(fLayColor[fNlayer-1]);
 
   // add all cable layers but the last
   for (Int_t iLay=0; iLay<fNlayer-1; iLay++) {
@@ -825,8 +831,8 @@ TGeoVolume *AliITSv11GeomCableFlat::CreateSegment( Double_t *coord1,
 }
 
 //________________________________________________________________________
-TGeoVolume *AliITSv11GeomCableFlat::CreateCylSegment(Double_t &phi,
-                                                    Double_t &r)
+TGeoVolume *AliITSv11GeomCableFlat::CreateCylSegment(const Double_t &phi,
+                                                    const Double_t &r)
 {
   // Create a segment in shape of a cylinder, allows to represent
   // a folded flat cable
@@ -842,6 +848,7 @@ TGeoVolume *AliITSv11GeomCableFlat::CreateCylSegment(Double_t &phi,
   TGeoTubeSeg *cableSeg = new TGeoTubeSeg(rMin, rMax, fWidth/2,
                                          phi1, phi2);
   TGeoVolume *vCableSeg = new TGeoVolume(GetName(), cableSeg, fLayMedia[fNlayer-1]);
+  vCableSeg->SetLineColor(fLayColor[fNlayer-1]);
 
   // add all cable layers but the last
   for (Int_t iLay=0; iLay<fNlayer-1; iLay++) {
@@ -865,8 +872,8 @@ TGeoVolume *AliITSv11GeomCableFlat::CreateCylSegment(Double_t &phi,
 }
 
 //________________________________________________________________________
-TGeoVolume *AliITSv11GeomCableFlat::CreateBoxSegment( Double_t *coord1,
-                                                     Double_t *coord2)
+TGeoVolume *AliITSv11GeomCableFlat::CreateBoxSegment( const Double_t *coord1,
+                                                     const Double_t *coord2)
 {
   // Create a segment for the case it is a simple box
   //=================================================
@@ -877,6 +884,7 @@ TGeoVolume *AliITSv11GeomCableFlat::CreateBoxSegment( Double_t *coord1,
 
   TGeoBBox *cableSeg = new  TGeoBBox(fWidth/2, length/2, fThick/2);
   TGeoVolume *vCableSeg = new TGeoVolume(GetName(), cableSeg, fLayMedia[fNlayer-1]);
+  vCableSeg->SetLineColor(fLayColor[fNlayer-1]);
   // This volume is the cable container. It codes also the material for the
   // last layer