]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSv11GeomCableFlat.cxx
Remove AliTRDv2
[u/mrichter/AliRoot.git] / ITS / AliITSv11GeomCableFlat.cxx
CommitLineData
b7943f00 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16
17//*************************************************************************
18// Class for flat cables
19//
20// Ludovic Gaudichet gaudichet@to.infn.it
21//*************************************************************************
22
23
24
25// General Root includes
26//#include <Riostream.h>
27#include <TMath.h>
28#include <TVectorD.h>
29
30// Root Geometry includes
31#include <TGeoManager.h>
32#include <TGeoVolume.h>
33#include <TGeoArb8.h>
34#include <TGeoMatrix.h>
35#include <TGeoNode.h>
36
37#include "AliITSv11GeomCableFlat.h"
38
39
40ClassImp(AliITSv11GeomCableFlat)
41
42//________________________________________________________________________
33ddec7d 43AliITSv11GeomCableFlat::AliITSv11GeomCableFlat():
44 AliITSv11GeomCable(),
45 fWidth(0),
46 fThick(0),
47 fNlayer(0)
b7943f00 48{
49 // constructor
b7943f00 50 for (Int_t i=0; i<fgkCableMaxLayer ; i++) {
51 fLayThickness[i] = 0;
52 fTranslation[i] = 0;
53 fLayColor[i] = 0;
54 fLayMedia[i] = 0;
55 };
5d7a6c6d 56}
b7943f00 57
58//________________________________________________________________________
59AliITSv11GeomCableFlat::
60AliITSv11GeomCableFlat(const char* name, Double_t width, Double_t thick) :
33ddec7d 61 AliITSv11GeomCable(name),
62 fWidth(width),
63 fThick(thick),
64 fNlayer(0)
65 {
b7943f00 66 // standard constructor
b7943f00 67 for (Int_t i=0; i<fgkCableMaxLayer ; i++) {
68 fLayThickness[i] = 0;
69 fTranslation[i] = 0;
70 fLayColor[i] = 0;
71 fLayMedia[i] = 0;
72 };
5d7a6c6d 73}
b7943f00 74
75//________________________________________________________________________
76AliITSv11GeomCableFlat::AliITSv11GeomCableFlat(const AliITSv11GeomCableFlat &s) :
77 AliITSv11GeomCable(s),fWidth(s.fWidth),fThick(s.fThick),fNlayer(s.fNlayer)
78{
79 // Copy Constructor
80 for (Int_t i=0; i<s.fNlayer; i++) {
81 fLayThickness[i] = s.fLayThickness[i];
82 fTranslation[i] = s.fTranslation[i];
83 fLayMedia[i] = s.fLayMedia[i];
84 fLayColor[i] = s.fLayColor[i];
85 }
86}
87
88//________________________________________________________________________
89AliITSv11GeomCableFlat& AliITSv11GeomCableFlat::
90operator=(const AliITSv11GeomCableFlat &s) {
91 // Assignment operator
92 // Not fully inplemented yet !!!
93
94 if(&s == this) return *this;
95 *this = s;
96 fWidth = s.fWidth;
97 fThick = s.fThick;
98 fNlayer = s.fNlayer;
99 for (Int_t i=0; i<s.fNlayer; i++) {
100 fLayThickness[i] = s.fLayThickness[i];
101 fTranslation[i] = s.fTranslation[i];
102 fLayMedia[i] = s.fLayMedia[i];
103 fLayColor[i] = s.fLayColor[i];
104 };
105 return *this;
106}
107
108//________________________________________________________________________
109Int_t AliITSv11GeomCableFlat::GetPoint( Int_t iCheckPt, Double_t *coord)
110 const {
111 // Get the correct point #iCheckPt
112 TVectorD *coordVector =(TVectorD *)fPointArray.At(2*iCheckPt);
113 if (coordVector) {
5d7a6c6d 114#if ROOT_VERSION_CODE < ROOT_VERSION(4,0,0)
115 CopyFrom(coord, coordVector->GetElements());
116#else
b7943f00 117 CopyFrom(coord, coordVector->GetMatrixArray());
5d7a6c6d 118#endif
b7943f00 119 return kTRUE;
120 } else {
121 return kFALSE;
122 };
5d7a6c6d 123}
b7943f00 124
125
126//________________________________________________________________________
127Int_t AliITSv11GeomCableFlat::GetVect( Int_t iCheckPt, Double_t *coord)
128 const {
129 // Get the correct vect corresponding to point #iCheckPt
130
131 TVectorD *coordVector =(TVectorD *)fPointArray.At(2*iCheckPt+1);
132 if (coordVector) {
5d7a6c6d 133#if ROOT_VERSION_CODE < ROOT_VERSION(4,0,0)
134 CopyFrom(coord, coordVector->GetElements());
135#else
b7943f00 136 CopyFrom(coord, coordVector->GetMatrixArray());
5d7a6c6d 137#endif
b7943f00 138 return kTRUE;
139 } else {
140 return kFALSE;
141 };
5d7a6c6d 142}
b7943f00 143
144
145//________________________________________________________________________
146void AliITSv11GeomCableFlat::AddCheckPoint( TGeoVolume *vol, Int_t iCheckPt,
147 Double_t *coord, Double_t *orthVect)
148{
149 //
150 // Add a check point. In the fPointArray, the point is at i and its vector
151 // is at i+1.
152 //
153
154// if (iCheckPt>=fVolumeArray.GetEntriesFast()) {
155// fVolumeArray.AddLast(vol);
156// TVectorD *point = new TVectorD(3,coord);
157// TVectorD *vect = new TVectorD(3,orthVect);
158// fPointArray.AddLast(point);
159// fPointArray.AddLast(vect);
160
161// } else if ((iCheckPt >= 0)&&(iCheckPt < fVolumeArray.GetEntriesFast())) {
162// fVolumeArray.AddAt(vol, iCheckPt);
163// TVectorD *point = new TVectorD(3,coord);
164// TVectorD *vect = new TVectorD(3,orthVect);
165// fPointArray.AddAt(point, iCheckPt*2 );
166// fPointArray.AddAt(vect, iCheckPt*2+1);
167// };
168 fVolumeArray.AddAtAndExpand(vol, iCheckPt);
169 TVectorD *point = new TVectorD(3,coord);
170 TVectorD *vect = new TVectorD(3,orthVect);
171 fPointArray.AddAtAndExpand(point, iCheckPt*2 );
172 fPointArray.AddAtAndExpand(vect, iCheckPt*2+1);
5d7a6c6d 173}
b7943f00 174
175//________________________________________________________________________
176void AliITSv11GeomCableFlat::PrintCheckPoints() const {
177 // print all check points of the cable
178 printf(" ---\n Printing all check points of the flat cable\n");
179 for (Int_t i = 0; i<fVolumeArray.GetEntriesFast(); i++) {
180 Double_t coord[3];
181 if (GetPoint( i, coord))
182 printf(" ( %.2f, %.2f, %.2f )\n", coord[0], coord[1], coord[2]);
183 };
5d7a6c6d 184}
b7943f00 185
186//________________________________________________________________________
187Int_t AliITSv11GeomCableFlat::CreateAndInsertCableSegment(Int_t p2,
188 Double_t rotation)
189{
190// Creates a cable segment between points p1 and p2.
191// Rotation is the eventual rotation of the flat cable
192// along its length axis
193//
194// The segment volume is created inside the volume containing point2
195// Therefore this segment should be defined in this volume only.
196// I mean here that, if the previous point is in another volume,
197// it should be just at the border between the 2 volumes. Also the
198// orientation vector of the previous point should be orthogonal to
199// the surface between the 2 volumes.
200
201 TGeoNode *mainNode;
202 if (fInitialNode==0) {
203 TObjArray *nodes = gGeoManager->GetListOfNodes();
204 if (nodes->GetEntriesFast()==0) return kFALSE;
205 mainNode = (TGeoNode *) nodes->UncheckedAt(0);
206 } else {
207 mainNode = fInitialNode;
208 };
209
210 Int_t p1 = p2 - 1;
211 TGeoVolume *p2Vol = GetVolume(p2);
212 TGeoVolume *p1Vol = GetVolume(p1);
213
214 ResetCheckDaughter();
215 fCurrentVol = p1Vol;
216 if (! CheckDaughter(mainNode)) {
217 printf("Error::volume containing point is not visible in node tree!\n");
218 return kFALSE;
219 };
220
221 Double_t coord1[3], coord2[3], vect1[3], vect2[3];
222 //=================================================
223 // Get p1 position in the systeme of p2
224 if (p1Vol!=p2Vol) {
225
226 Int_t p1nodeInd[fgkCableMaxNodeLevel];
227 for (Int_t i=0; i<fgkCableMaxNodeLevel; i++) p1nodeInd[i]=fNodeInd[i];
228 Int_t p1volLevel = 0;
229 while (p1nodeInd[p1volLevel]!=-1) p1volLevel++;
230 p1volLevel--;
231
232 ResetCheckDaughter();
233 fCurrentVol = p2Vol;
234 if (! CheckDaughter(mainNode)) {
235 printf("Error::volume containing point is not visible in node tree!\n");
236 return kFALSE;
237 };
238 Int_t p2nodeInd[fgkCableMaxNodeLevel];
239 for (Int_t i=0; i<fgkCableMaxNodeLevel; i++) p2nodeInd[i]=fNodeInd[i];
240 Int_t commonMotherLevel = 0;
241 while (p1nodeInd[commonMotherLevel]==fNodeInd[commonMotherLevel])
242 commonMotherLevel++;
243 commonMotherLevel--;
244 Int_t p2volLevel = 0;
245 while (fNodeInd[p2volLevel]!=-1) p2volLevel++;
246 p2volLevel--;
247
248 // Get coord and vect of p1 in the common mother reference system
249 if (! GetCheckPoint(p1, 0, p1volLevel-commonMotherLevel, coord1) )
250 return kFALSE;
251 if (! GetCheckVect( p1, 0, p1volLevel-commonMotherLevel, vect1) )
252 return kFALSE;
253
254 // Translate them in the reference system of the volume containing p2
255 TGeoNode *pathNode[fgkCableMaxNodeLevel];
256 pathNode[0] = mainNode;
257 for (Int_t i=0; i<=p2volLevel; i++) {
258 pathNode[i+1] = pathNode[i]->GetDaughter(p2nodeInd[i]);
259 };
260 Double_t globalCoord1[3] = {coord1[0], coord1[1], coord1[2]};
261 Double_t globalVect1[3] = {vect1[0], vect1[1], vect1[2]};
262
263 for (Int_t i = commonMotherLevel+1; i <= p2volLevel; i++) {
264 pathNode[i+1]->GetMatrix()->MasterToLocal(globalCoord1, coord1);
265 pathNode[i+1]->GetMatrix()->MasterToLocalVect(globalVect1, vect1);
266 CopyFrom(globalCoord1, coord1);
267 CopyFrom(globalVect1, vect1);
268 };
269 } else {
270 if (! GetCheckPoint(p1, 0, 0, coord1) ) return kFALSE;
271 if (! GetCheckVect(p1, 0, 0, vect1) ) return kFALSE;
272 };
273
274 //=================================================
275 // Get p2 position in the systeme of p2
276 if (! GetCheckPoint(p2, 0, 0, coord2) ) return kFALSE;
277 if (! GetCheckVect(p2, 0, 0, vect2) ) return kFALSE;
278
279 Double_t cx = (coord1[0]+coord2[0])/2;
280 Double_t cy = (coord1[1]+coord2[1])/2;
281 Double_t cz = (coord1[2]+coord2[2])/2;
282 Double_t dx = coord2[0]-coord1[0];
283 Double_t dy = coord2[1]-coord1[1];
284 Double_t dz = coord2[2]-coord1[2];
285
286 //=================================================
287 // Positionning of the segment between the 2 points
288 if (TMath::Abs(dy)<1e-231) dy = 1e-231;
289 if (TMath::Abs(dz)<1e-231) dz = 1e-231;
290 //Double_t angleRot1 = -TMath::ATan(dx/dy);
291 //Double_t planDiagL = -TMath::Sqrt(dy*dy+dx*dx);
292 //if (dy<0) planDiagL = -planDiagL;
293 //Double_t angleRotDiag = TMath::ATan(planDiagL/dz);
294
295 Double_t angleRot1 = -TMath::ATan2(dx,dy);
296 Double_t planDiagL = TMath::Sqrt(dy*dy+dx*dx);
297 Double_t angleRotDiag = -TMath::ATan2(planDiagL,dz);
298 //--- (Calculate rotation of segment on the Z axis)
299 //-- Here I'm trying to calculate the rotation to be applied in
300 //-- order to match as closer as possible this segment and the
301 //-- previous one.
302 //-- It seems that some times it doesn't work ...
303 Double_t angleRotZ = 0;
304 TGeoRotation rotTemp("",angleRot1*TMath::RadToDeg(),
305 angleRotDiag*TMath::RadToDeg(), rotation);
306 Double_t localX[3] = {0,1,0};
307 Double_t globalX[3];
308 rotTemp.LocalToMasterVect(localX, globalX);
309 CopyFrom(localX, globalX);
310 GetCheckVect(localX, p2Vol, 0, fgkCableMaxNodeLevel+1, globalX);
311 Double_t orthVect[3];
312 GetCheckVect(vect1, p2Vol, 0, fgkCableMaxNodeLevel+1, orthVect);
313 if (p2>1) {
314 Double_t orthVectNorm2 = ScalProd(orthVect,orthVect);
315 Double_t alpha1 = ScalProd(fPreviousX,orthVect)/orthVectNorm2;
316 Double_t alpha2 = ScalProd(globalX,orthVect)/orthVectNorm2;
317 Double_t globalX1p[3], globalX2p[3];
318 globalX1p[0] = fPreviousX[0] - alpha1*orthVect[0];
319 globalX1p[1] = fPreviousX[1] - alpha1*orthVect[1];
320 globalX1p[2] = fPreviousX[2] - alpha1*orthVect[2];
321 globalX2p[0] = globalX[0] - alpha2*orthVect[0];
322 globalX2p[1] = globalX[1] - alpha2*orthVect[1];
323 globalX2p[2] = globalX[2] - alpha2*orthVect[2];
324 //-- now I'm searching the 3th vect which makes an orthogonal base
325 //-- with orthVect and globalX1p ...
326 Double_t nulVect[3] = {0,0,0};
327 Double_t axis3[3];
328 TMath::Normal2Plane(nulVect, orthVect, globalX1p, axis3);
329 Double_t globalX1pNorm2 = ScalProd(globalX1p, globalX1p);
330 Double_t beta = ScalProd(globalX2p, globalX1p)/globalX1pNorm2;
331 Double_t gamma = ScalProd(globalX2p, axis3);
332 angleRotZ = (TMath::ATan2(1,0) - TMath::ATan2(beta, gamma))
333 *TMath::RadToDeg();
334 };
335 // cout << "!!!!!!!!!!!!!!!!!!! angle = " <<angleRotZ << endl;
336 CopyFrom(fPreviousX, globalX);
337 //---
338 Double_t localVect1[3], localVect2[3];
339 TGeoRotation rot("",angleRot1*TMath::RadToDeg(),
340 angleRotDiag*TMath::RadToDeg(),
341 rotation);
342// rotation-angleRotZ);
343// since angleRotZ doesn't always work, I won't use it ...
344
345 rot.MasterToLocalVect(vect1, localVect1);
346 rot.MasterToLocalVect(vect2, localVect2);
347
348 //=================================================
349 // Create the segment and add it to the mother volume
350 TGeoVolume *vCableSegB = CreateSegment(coord1, coord2,
351 localVect1, localVect2);
352
353 TGeoRotation rotArbSeg("", 0, 90, 0);
354 rotArbSeg.MultiplyBy(&rot, kFALSE);
355 TGeoTranslation trans("",cx, cy, cz);
356 TGeoCombiTrans *combiB = new TGeoCombiTrans(trans, rotArbSeg);
357 p2Vol->AddNode(vCableSegB, p2, combiB);
358 //=================================================;
359
360 if (fDebug) {
361 printf("---\n Cable segment points : ");
362 printf("%f, %f, %f\n",coord1[0], coord1[1], coord1[2]);
363 printf("%f, %f, %f\n",coord2[0], coord2[1], coord2[2]);
364 };
365
366// #include <TGeoSphere.h>
531d6cdc 367// TGeoMedium *airSDD = gGeoManager->GetMedium("ITS_ITSsddAir");
b7943f00 368// TGeoSphere *sphere = new TGeoSphere(0, 0.05);
369// TGeoVolume *vSphere = new TGeoVolume("", sphere, airSDD);
370// TGeoTranslation *trC = new TGeoTranslation("", cx, cy, cz);
371// TGeoTranslation *tr1 = new TGeoTranslation("",coord1[0],
372// coord1[1],coord1[2]);
373// TGeoTranslation *tr2 = new TGeoTranslation("",coord2[0],
374// coord2[1],coord2[2]);
375// p2Vol->AddNode(vSphere, p2*3-2, trC);
376// p2Vol->AddNode(vSphere, p2*3-1, tr1);
377// p2Vol->AddNode(vSphere, p2*3 , tr2);
378
379 return kTRUE;
5d7a6c6d 380}
b7943f00 381
382//________________________________________________________________________
383TGeoVolume *AliITSv11GeomCableFlat::CreateSegment( Double_t *coord1,
384 Double_t *coord2,
385 Double_t *localVect1,
386 Double_t *localVect2 )
387{
388
389 //=================================================
390 // Calculate segment "deformation"
391 Double_t dx = coord2[0]-coord1[0];
392 Double_t dy = coord2[1]-coord1[1];
393 Double_t dz = coord2[2]-coord1[2];
394 Double_t length = TMath::Sqrt(dx*dx+dy*dy+dz*dz);
395
396 Double_t cosTheta1 = -1./TMath::Sqrt( 1 + localVect1[0]*localVect1[0]
397 /localVect1[2]/localVect1[2] );
398 Double_t cosTheta2 = 1./TMath::Sqrt( 1 + localVect2[0]*localVect2[0]
399 /localVect2[2]/localVect2[2] );
400 if (localVect1[2]<0) cosTheta1 = -cosTheta1;
401 if (localVect2[2]<0) cosTheta2 = -cosTheta2;
402
403 Double_t dL1 = 0.5*fWidth*TMath::Tan(TMath::ACos(cosTheta1));
404 Double_t dL2 = 0.5*fWidth*TMath::Tan(TMath::ACos(cosTheta2));
405 if (localVect1[0]<0) dL1 = - dL1;
406 if (localVect2[0]<0) dL2 = - dL2;
407 //---
408 Double_t cosPhi1 = -1./TMath::Sqrt( 1 + localVect1[1]*localVect1[1]
409 /localVect1[2]/localVect1[2] );
410 Double_t cosPhi2 = 1./TMath::Sqrt( 1 + localVect2[1]*localVect2[1]
411 /localVect2[2]/localVect2[2] );
412 if (localVect1[2]<0) cosPhi1 = -cosPhi1;
413 if (localVect2[2]<0) cosPhi2 = -cosPhi2;
414
415 Double_t tanACosCosPhi1 = TMath::Tan(TMath::ACos(cosPhi1));
416 Double_t tanACosCosPhi2 = TMath::Tan(TMath::ACos(cosPhi2));
417 if (localVect1[1]<0) tanACosCosPhi1 = -tanACosCosPhi1;
418 if (localVect2[1]<0) tanACosCosPhi2 = -tanACosCosPhi2;
419
420 Double_t dl1 = 0.5*fThick*tanACosCosPhi1;
421 Double_t dl2 = 0.5*fThick*tanACosCosPhi2;
422
423 //=================================================
424 // Create the segment
425 TGeoArb8 *cableSeg = new TGeoArb8(fThick/2);
426 cableSeg->SetVertex( 0, -fWidth/2, -length/2 - dL1 + dl1);
531d6cdc 427 cableSeg->SetVertex( 1, -fWidth/2, length/2 + dL2 - dl2);
b7943f00 428 cableSeg->SetVertex( 2, fWidth/2, length/2 - dL2 - dl2);
531d6cdc 429 cableSeg->SetVertex( 3, fWidth/2, -length/2 + dL1 + dl1);
b7943f00 430 cableSeg->SetVertex( 4, -fWidth/2, -length/2 - dL1 - dl1);
531d6cdc 431 cableSeg->SetVertex( 5, -fWidth/2, length/2 + dL2 + dl2);
b7943f00 432 cableSeg->SetVertex( 6, fWidth/2, length/2 - dL2 + dl2);
531d6cdc 433 cableSeg->SetVertex( 7, fWidth/2, -length/2 + dL1 - dl1);
b7943f00 434
531d6cdc 435 TGeoMedium *airSDD = gGeoManager->GetMedium("ITS_ITSair");
b7943f00 436 TGeoVolume *vCableSeg = new TGeoVolume(GetName(), cableSeg, airSDD);
437
438 // add all cable layers
439 for (Int_t iLay=0; iLay<fNlayer; iLay++) {
440
441 Double_t dl1Lay = 0.5*fLayThickness[iLay]*tanACosCosPhi1;
442 Double_t dl2Lay = 0.5*fLayThickness[iLay]*tanACosCosPhi2;
443
444 Double_t ztr = -fThick/2;
445 for (Int_t i=0;i<iLay; i++) ztr+= fLayThickness[i];
446 ztr+= fLayThickness[iLay]/2;
447
448 Double_t dl1LayS = ztr*tanACosCosPhi1;
449 Double_t dl2LayS = ztr*tanACosCosPhi2;
450
451 TGeoArb8 *lay = new TGeoArb8(fLayThickness[iLay]/2);
452 lay->SetVertex( 0, -fWidth/2, -length/2 - dL1 + dl1Lay - dl1LayS);
531d6cdc 453 lay->SetVertex( 1, -fWidth/2, length/2 + dL2 - dl2Lay + dl2LayS);
b7943f00 454 lay->SetVertex( 2, fWidth/2, length/2 - dL2 - dl2Lay + dl2LayS);
531d6cdc 455 lay->SetVertex( 3, fWidth/2, -length/2 + dL1 + dl1Lay - dl1LayS);
b7943f00 456 lay->SetVertex( 4, -fWidth/2, -length/2 - dL1 - dl1Lay - dl1LayS);
531d6cdc 457 lay->SetVertex( 5, -fWidth/2, length/2 + dL2 + dl2Lay + dl2LayS);
b7943f00 458 lay->SetVertex( 6, fWidth/2, length/2 - dL2 + dl2Lay + dl2LayS);
531d6cdc 459 lay->SetVertex( 7, fWidth/2, -length/2 + dL1 - dl1Lay - dl1LayS);
b7943f00 460 TGeoVolume *vLay = new TGeoVolume("vCableSegLay", lay, fLayMedia[iLay]);
461 vLay->SetLineColor(fLayColor[iLay]);
462
463 if (fTranslation[iLay]==0)
464 fTranslation[iLay] = new TGeoTranslation(0, 0, ztr);
465 vCableSeg->AddNode(vLay, iLay+1, fTranslation[iLay]);
466 };
467
531d6cdc 468 //vCableSeg->SetVisibility(kFALSE);
b7943f00 469 return vCableSeg;
5d7a6c6d 470}
b7943f00 471
472
473//________________________________________________________________________
474void AliITSv11GeomCableFlat::SetNLayers(Int_t nLayers) {
475 // Set the number of layers
476 if((nLayers>0) &&(nLayers<=fgkCableMaxLayer)) {
477
478 fNlayer = nLayers;
479 for (Int_t i=0; i<fgkCableMaxLayer ; i++) {
480 fLayThickness[i] = 0;
481 fTranslation[i] = 0;
482 fLayColor[i] = 0;
483 fLayMedia[i] = 0;
484 };
485 };
5d7a6c6d 486}
b7943f00 487
488//________________________________________________________________________
489Int_t AliITSv11GeomCableFlat::SetLayer(Int_t nLayer, Double_t thick,
490 TGeoMedium *medium, Int_t color) {
491 // Set the layer number nLayer
492 if ((nLayer<0)||(nLayer>=fNlayer)) {
493 printf("Set wrong layer number of the cable\n");
494 return kFALSE;
495 };
496 if (nLayer>0)
497 if (fLayThickness[nLayer-1]<=0) {
498 printf("AliITSv11GeomCableFlat::SetLayer():"
499 " You must define cable layer %i first !",nLayer-1);
500 return kFALSE;
501 };
502
503 Double_t thickTot = 0;
504 for (Int_t i=0; i<nLayer; i++) thickTot += fLayThickness[i];
505 thickTot += thick;
506 if (thickTot-1e-10>fThick) {
507 printf("Can't add this layer, cable thickness would be higher than total\n");
508 return kFALSE;
509 };
510
511 fLayThickness[nLayer] = thick;
512 fLayMedia[nLayer] = medium;
513 fLayColor[nLayer] = color;
514 fTranslation[nLayer] = 0;
515 return kTRUE;
5d7a6c6d 516}