zero misalignment object with symbolic names
[u/mrichter/AliRoot.git] / ITS / AliITSgeomMatrix.cxx
CommitLineData
df5240ea 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
023ae34b 16/*
17$Id$
18*/
6b0f3880 19////////////////////////////////////////////////////////////////////////
20// This is the implementation file for AliITSgeomMatrix class. It
21// contains the routines to manipulate, setup, and queary the geometry
22// of a given ITS module. An ITS module may be one of at least three
23// ITS detector technologies, Silicon Pixel, Drift, or Strip Detectors,
24// and variations of these in size and/or layout. These routines let
25// one go between ALICE global coordiantes (cm) to a given modules
26// specific local coordinates (cm).
27////////////////////////////////////////////////////////////////////////
28
4ae5bbc4 29#include <Riostream.h>
df5240ea 30#include <TMath.h>
31#include <TBuffer.h>
023ae34b 32#include <TCanvas.h>
33#include <TView.h>
34#include <TPolyLine3D.h>
023ae34b 35#include <TNode.h>
36#include <TPCON.h>
37#include <TBRIK.h>
38#include <TXTRU.h>
df5240ea 39
40#include "AliITSgeomMatrix.h"
41
42ClassImp(AliITSgeomMatrix)
43//----------------------------------------------------------------------
023ae34b 44AliITSgeomMatrix::AliITSgeomMatrix():
45TObject(),
46fDetectorIndex(0), // Detector type index (like fShapeIndex was)
47fid(), // layer, ladder, detector numbers.
48frot(), //! vector of rotations about x,y,z [radians].
49ftran(), // Translation vector of module x,y,z.
50fCylR(0.0), //! R Translation in Cylinderical coordinates
51fCylPhi(0.0),//! Phi Translation vector in Cylindrical coord.
52fm(), // Rotation matrix based on frot.
53fPath(){ // Path in geometry to this module
54 // The Default constructor for the AliITSgeomMatrix class. By Default
55 // the angles of rotations are set to zero, meaning that the rotation
56 // matrix is the unit matrix. The translation vector is also set to
57 // zero as are the module id number. The detector type is set to -1
58 // (an undefined value). The full rotation matrix is kept so that
59 // the evaluation of a coordinate transformation can be done
60 // quickly and with a minimum of CPU overhead. The basic coordinate
61 // systems are the ALICE global coordinate system and the detector
62 // local coordinate system. In general this structure is not limited
63 // to just those two coordinate systems.
64 //Begin_Html
65 /*
66 <img src="picts/ITS/AliITSgeomMatrix_L1.gif">
67 */
68 //End_Html
69 // Inputs:
70 // none.
71 // Outputs:
72 // none.
73 // Return:
74 // A default constructes AliITSgeomMatrix class.
df5240ea 75 Int_t i,j;
76
77 fDetectorIndex = -1; // a value never defined.
78 for(i=0;i<3;i++){
79 fid[i] = 0;
80 frot[i] = ftran[i] = 0.0;
81 for(j=0;j<3;j++) fm[i][j] = 0.0;
d8cc8493 82 fCylR = fCylPhi = 0.0;
df5240ea 83 }// end for i
84 fm[0][0] = fm[1][1] = fm[2][2] = 1.0;
85}
e56160b8 86
df5240ea 87//----------------------------------------------------------------------
e56160b8 88AliITSgeomMatrix::AliITSgeomMatrix(const AliITSgeomMatrix &source) :
89 TObject(source),
90fDetectorIndex(source.fDetectorIndex),
91fCylR(source.fCylR),
92fCylPhi(source.fCylPhi),
93fPath(source.fPath){
023ae34b 94 // The standard Copy constructor. This make a full / proper copy of
95 // this class.
96 // Inputs:
97 // AliITSgeomMatrix &source The source of this copy
98 // Outputs:
99 // none.
100 // Return:
101 // A copy constructes AliITSgeomMatrix class.
df5240ea 102 Int_t i,j;
df5240ea 103 for(i=0;i<3;i++){
e56160b8 104 this->fid[i] = source.fid[i];
105 this->frot[i] = source.frot[i];
106 this->ftran[i] = source.ftran[i];
107 for(j=0;j<3;j++) this->fm[i][j] = source.fm[i][j];
df5240ea 108 }// end for i
109}
110//----------------------------------------------------------------------
e56160b8 111AliITSgeomMatrix& AliITSgeomMatrix::operator=(const AliITSgeomMatrix &source){
023ae34b 112 // The standard = operator. This make a full / proper copy of
113 // this class.
114 // The standard Copy constructor. This make a full / proper copy of
115 // this class.
116 // Inputs:
117 // AliITSgeomMatrix &source The source of this copy
118 // Outputs:
119 // none.
120 // Return:
121 // A copy of the source AliITSgeomMatrix class.
e56160b8 122 if(this == &source)return *this;
123 Int_t i,j;
df5240ea 124
e56160b8 125 this->fDetectorIndex = source.fDetectorIndex;
126 this->fCylR = source.fCylR;
127 this->fCylPhi = source.fCylPhi;
128 for(i=0;i<3;i++){
129 this->fid[i] = source.fid[i];
130 this->frot[i] = source.frot[i];
131 this->ftran[i] = source.ftran[i];
132
133 for(j=0;j<3;j++) this->fm[i][j] = source.fm[i][j];
134 }
135 this->fPath = source.fPath;
136 return *this;
df5240ea 137}
e56160b8 138
df5240ea 139//----------------------------------------------------------------------
6ba216a4 140AliITSgeomMatrix::AliITSgeomMatrix(Int_t idt,const Int_t id[3],
023ae34b 141 const Double_t rot[3],const Double_t tran[3]):
142TObject(),
4bfbde86 143fDetectorIndex(idt), // Detector type index (like fShapeIndex was)
023ae34b 144fid(), // layer, ladder, detector numbers.
145frot(), //! vector of rotations about x,y,z [radians].
146ftran(), // Translation vector of module x,y,z.
147fCylR(0.0), //! R Translation in Cylinderical coordinates
148fCylPhi(0.0),//! Phi Translation vector in Cylindrical coord.
149fm(), // Rotation matrix based on frot.
150fPath(){ // Path in geometry to this moduel
151 // This is a constructor for the AliITSgeomMatrix class. The matrix is
152 // defined by 3 standard rotation angles [radians], and the translation
153 // vector tran [cm]. In addition the layer, ladder, and detector number
154 // for this particular module and the type of module must be given.
155 // The full rotation matrix is kept so that the evaluation
156 // of a coordinate transformation can be done quickly and with a minimum
157 // of CPU overhead. The basic coordinate systems are the ALICE global
158 // coordinate system and the detector local coordinate system. In general
159 // this structure is not limited to just those two coordinate systems.
160 //Begin_Html
161 /*
162 <img src="picts/ITS/AliITSgeomMatrix_L1.gif">
163 */
164 //End_Html
165 // Inputs:
166 // Int_t idt The detector index value
167 // Int_t id[3] The layer, ladder, and detector numbers
168 // Double_t rot[3] The 3 Cartician rotaion angles [radians]
169 // Double_t tran[3] The 3 Cartician translation distnaces
170 // Outputs:
171 // none.
172 // Return:
173 // A properly inilized AliITSgeomMatrix class.
d8cc8493 174 Int_t i;
df5240ea 175
d8cc8493 176 for(i=0;i<3;i++){
177 fid[i] = id[i];
178 frot[i] = rot[i];
179 ftran[i] = tran[i];
180 }// end for i
181 fCylR = TMath::Sqrt(ftran[0]*ftran[0]+ftran[1]*ftran[1]);
182 fCylPhi = TMath::ATan2(ftran[1],ftran[0]);
183 if(fCylPhi<0.0) fCylPhi += TMath::Pi();
184 this->MatrixFromAngle();
df5240ea 185}
186//----------------------------------------------------------------------
6ba216a4 187AliITSgeomMatrix::AliITSgeomMatrix(Int_t idt, const Int_t id[3],
d962cab4 188 Double_t matrix[3][3],
023ae34b 189 const Double_t tran[3]):
190TObject(),
4bfbde86 191fDetectorIndex(idt), // Detector type index (like fShapeIndex was)
023ae34b 192fid(), // layer, ladder, detector numbers.
193frot(), //! vector of rotations about x,y,z [radians].
194ftran(), // Translation vector of module x,y,z.
195fCylR(0.0), //! R Translation in Cylinderical coordinates
196fCylPhi(0.0),//! Phi Translation vector in Cylindrical coord.
197fm(), // Rotation matrix based on frot.
198fPath(){ // Path in geometry to this module
199 // This is a constructor for the AliITSgeomMatrix class. The
200 // rotation matrix is given as one of the inputs, and the
201 // translation vector tran [cm]. In addition the layer, ladder,
202 // and detector number for this particular module and the type of
203 // module must be given. The full rotation matrix is kept so that
204 // the evaluation of a coordinate transformation can be done quickly
205 // and with a minimum of CPU overhead. The basic coordinate systems
206 // are the ALICE global coordinate system and the detector local
207 // coordinate system. In general this structure is not limited to just
208 // those two coordinate systems.
209 //Begin_Html
210 /*
211 <img src="picts/ITS/AliITSgeomMatrix_L1.gif">
212 */
213 //End_Html
214 // Inputs:
215 // Int_t idt The detector index value
216 // Int_t id[3] The layer, ladder, and detector numbers
217 // Double_t rot[3][3] The 3x3 Cartician rotaion matrix
218 // Double_t tran[3] The 3 Cartician translation distnaces
219 // Outputs:
220 // none.
221 // Return:
222 // A properly inilized AliITSgeomMatrix class.
d8cc8493 223 Int_t i,j;
df5240ea 224
d8cc8493 225 for(i=0;i<3;i++){
226 fid[i] = id[i];
227 ftran[i] = tran[i];
228 for(j=0;j<3;j++) fm[i][j] = matrix[i][j];
229 }// end for i
230 fCylR = TMath::Sqrt(ftran[0]*ftran[0]+ftran[1]*ftran[1]);
231 fCylPhi = TMath::ATan2(ftran[1],ftran[0]);
232 if(fCylPhi<0.0) fCylPhi += TMath::Pi();
233 this->AngleFromMatrix();
df5240ea 234}
235//----------------------------------------------------------------------
5cf690c1 236void AliITSgeomMatrix::SixAnglesFromMatrix(Double_t *ang)const{
023ae34b 237 // This function returns the 6 GEANT 3.21 rotation angles [degrees] in
238 // the array ang which must be at least [6] long.
239 // Inputs:
240 // none.
241 // Outputs:
242 // Double_t ang[6] The 6 Geant3.21 rotation angles. [degrees]
243 // Return:
244 // noting
df5240ea 245 Double_t si,c=180./TMath::Pi();
246
247 ang[1] = TMath::ATan2(fm[0][1],fm[0][0]);
248 if(TMath::Cos(ang[1])!=0.0) si = fm[0][0]/TMath::Cos(ang[1]);
249 else si = fm[0][1]/TMath::Sin(ang[1]);
250 ang[0] = TMath::ATan2(si,fm[0][2]);
251
252 ang[3] = TMath::ATan2(fm[1][1],fm[1][0]);
253 if(TMath::Cos(ang[3])!=0.0) si = fm[1][0]/TMath::Cos(ang[3]);
254 else si = fm[1][1]/TMath::Sin(ang[3]);
3f616de1 255 ang[2] = TMath::ATan2(si,fm[1][2]);
df5240ea 256
3f616de1 257 ang[5] = TMath::ATan2(fm[2][1],fm[2][0]);
258 if(TMath::Cos(ang[5])!=0.0) si = fm[2][0]/TMath::Cos(ang[5]);
259 else si = fm[2][1]/TMath::Sin(ang[5]);
260 ang[4] = TMath::ATan2(si,fm[2][2]);
df5240ea 261
262 for(Int_t i=0;i<6;i++) {ang[i] *= c; if(ang[i]<0.0) ang[i] += 360.;}
263}
264//----------------------------------------------------------------------
265void AliITSgeomMatrix::MatrixFromSixAngles(const Double_t *ang){
023ae34b 266 // Given the 6 GEANT 3.21 rotation angles [degree], this will compute and
267 // set the rotations matrix and 3 standard rotation angles [radians].
268 // These angles and rotation matrix are overwrite the existing values in
269 // this class.
270 // Inputs:
271 // Double_t ang[6] The 6 Geant3.21 rotation angles. [degrees]
272 // Outputs:
273 // none.
274 // Return:
275 // noting
df5240ea 276 Int_t i,j;
277 Double_t si,lr[9],c=TMath::Pi()/180.;
278
279 si = TMath::Sin(c*ang[0]);
280 if(ang[0]== 90.0) si = +1.0;
281 if(ang[0]==270.0) si = -1.0;
282 if(ang[0]== 0.0||ang[0]==180.) si = 0.0;
283 lr[0] = si * TMath::Cos(c*ang[1]);
284 lr[1] = si * TMath::Sin(c*ang[1]);
285 lr[2] = TMath::Cos(c*ang[0]);
286 if(ang[0]== 90.0||ang[0]==270.) lr[2] = 0.0;
287 if(ang[0]== 0.0) lr[2] = +1.0;
288 if(ang[0]==180.0) lr[2] = -1.0;
289//
290 si = TMath::Sin(c*ang[2]);
291 if(ang[2]== 90.0) si = +1.0;
292 if(ang[2]==270.0) si = -1.0;
293 if(ang[2]== 0.0||ang[2]==180.) si = 0.0;
294 lr[3] = si * TMath::Cos(c*ang[3]);
295 lr[4] = si * TMath::Sin(c*ang[3]);
296 lr[5] = TMath::Cos(c*ang[2]);
297 if(ang[2]== 90.0||ang[2]==270.) lr[5] = 0.0;
298 if(ang[2]== 0.0) lr[5] = +1.0;
299 if(ang[2]==180.0) lr[5] = -1.0;
300//
301 si = TMath::Sin(c*ang[4]);
302 if(ang[4]== 90.0) si = +1.0;
303 if(ang[4]==270.0) si = -1.0;
304 if(ang[4]== 0.0||ang[4]==180.) si = 0.0;
305 lr[6] = si * TMath::Cos(c*ang[5]);
306 lr[7] = si * TMath::Sin(c*ang[5]);
307 lr[8] = TMath::Cos(c*ang[4]);
308 if(ang[4]== 90.0||ang[4]==270.0) lr[8] = 0.0;
309 if(ang[4]== 0.0) lr[8] = +1.0;
310 if(ang[4]==180.0) lr[8] = -1.0;
311 // Normalize these elements and fill matrix fm.
312 for(i=0;i<3;i++){// reuse si.
313 si = 0.0;
314 for(j=0;j<3;j++) si += lr[3*i+j]*lr[3*i+j];
315 si = TMath::Sqrt(1./si);
316 for(j=0;j<3;j++) fm[i][j] = si*lr[3*i+j];
317 } // end for i
318 this->AngleFromMatrix();
319}
320//----------------------------------------------------------------------
321AliITSgeomMatrix::AliITSgeomMatrix(const Double_t rotd[6]/*degrees*/,
6ba216a4 322 Int_t idt,const Int_t id[3],
4bfbde86 323 const Double_t tran[3]):
324TObject(),
325fDetectorIndex(idt),
326fCylR(0.),
327fCylPhi(0.),
328fPath(){
023ae34b 329 // This is a constructor for the AliITSgeomMatrix class. The matrix
330 // is defined by the 6 GEANT 3.21 rotation angles [degrees], and
331 // the translation vector tran [cm]. In addition the layer, ladder,
332 // and detector number for this particular module and the type of
333 // module must be given. The full rotation matrix is kept so that
334 // the evaluation of a coordinate transformation can be done
335 // quickly and with a minimum of CPU overhead. The basic coordinate
336 // systems are the ALICE global coordinate system and the detector
337 // local coordinate system. In general this structure is not limited
338 // to just those two coordinate systems.
339 //Begin_Html
340 /*
341 <img src="picts/ITS/AliITSgeomMatrix_L1.gif">
342 */
343 //End_Html
344 // Inputs:
345 // Double_t rotd[6] The 6 Geant 3.21 rotation angles [degrees]
346 // Int_t idt The module Id number
347 // Int_t id[3] The layer, ladder and detector number
348 // Double_t tran[3] The translation vector
df5240ea 349 Int_t i;
350
df5240ea 351 for(i=0;i<3;i++){
352 fid[i] = id[i];
353 ftran[i] = tran[i];
354 }// end for i
d8cc8493 355 fCylR = TMath::Sqrt(ftran[0]*ftran[0]+ftran[1]*ftran[1]);
356 fCylPhi = TMath::ATan2(ftran[1],ftran[0]);
357 if(fCylPhi<0.0) fCylPhi += TMath::Pi();
df5240ea 358 this->MatrixFromSixAngles(rotd);
359}
360//----------------------------------------------------------------------
361void AliITSgeomMatrix::AngleFromMatrix(){
023ae34b 362 // Computes the angles from the rotation matrix up to a phase of
e16acbad 363 // 180 degrees. The matrix used in AliITSgeomMatrix::MatrixFromAngle()
364 // and its inverse AliITSgeomMatrix::AngleFromMatrix() are defined in
365 // the following ways, R = Rz*Ry*Rx (M=R*L+T) where
366 // 1 0 0 Cy 0 -Sy Cz -Sz 0
367 // Rx= 0 Cx -Sx Ry= 0 1 0 Rz= Sz Cz 0
368 // 0 Sx Cx Sy 0 Cy 0 0 1
369 // The choice of the since of S, comes from the choice between
370 // the rotation of the object or the coordinate system (view). I think
371 // that this choice is the first, the rotation of the object.
023ae34b 372 // Inputs:
373 // none
374 // Outputs:
375 // none
376 // Return:
377 // none
df5240ea 378 Double_t rx,ry,rz;
379 // get angles from matrix up to a phase of 180 degrees.
380
381 rx = TMath::ATan2(fm[2][1],fm[2][2]);if(rx<0.0) rx += 2.0*TMath::Pi();
382 ry = TMath::ASin(fm[0][2]); if(ry<0.0) ry += 2.0*TMath::Pi();
e16acbad 383 rz = TMath::ATan2(fm[1][0],fm[0][0]);if(rz<0.0) rz += 2.0*TMath::Pi();
df5240ea 384 frot[0] = rx;
385 frot[1] = ry;
386 frot[2] = rz;
387 return;
388}
389//----------------------------------------------------------------------
390void AliITSgeomMatrix::MatrixFromAngle(){
023ae34b 391 // Computes the Rotation matrix from the angles [radians] kept in this
e16acbad 392 // class. The matrix used in AliITSgeomMatrix::MatrixFromAngle() and
393 // its inverse AliITSgeomMatrix::AngleFromMatrix() are defined in
394 // the following ways, R = Rz*Ry*Rx (M=R*L+T) where
395 // 1 0 0 Cy 0 -Sy Cz -Sz 0
396 // Rx= 0 Cx -Sx Ry= 0 1 0 Rz= Sz Cz 0
397 // 0 Sx Cx Sy 0 Cy 0 0 1
398 // The choice of the since of S, comes from the choice between
399 // the rotation of the object or the coordinate system (view). I think
400 // that this choice is the first, the rotation of the object.
023ae34b 401 // Inputs:
402 // none
403 // Outputs:
404 // none
405 // Return:
406 // none
df5240ea 407 Double_t sx,sy,sz,cx,cy,cz;
408
409 sx = TMath::Sin(frot[0]); cx = TMath::Cos(frot[0]);
410 sy = TMath::Sin(frot[1]); cy = TMath::Cos(frot[1]);
411 sz = TMath::Sin(frot[2]); cz = TMath::Cos(frot[2]);
412 fm[0][0] = cz*cy; // fr[0]
413 fm[0][1] = -cz*sy*sx - sz*cx; // fr[1]
414 fm[0][2] = -cz*sy*cx + sz*sx; // fr[2]
415 fm[1][0] = sz*cy; // fr[3]
416 fm[1][1] = -sz*sy*sx + cz*cx; // fr[4]
417 fm[1][2] = -sz*sy*cx - cz*sx; // fr[5]
418 fm[2][0] = sy; // fr[6]
419 fm[2][1] = cy*sx; // fr[7]
420 fm[2][2] = cy*cx; // fr[8]
421
422}
423//----------------------------------------------------------------------
024a4246 424void AliITSgeomMatrix::GtoLPosition(const Double_t g0[3],Double_t l[3]) const {
023ae34b 425 // Returns the local coordinates given the global coordinates [cm].
426 // Inputs:
427 // Double_t g[3] The position represented in the ALICE
428 // global coordinate system
429 // Outputs:
430 // Double_t l[3] The poistion represented in the local
431 // detector coordiante system
432 // Return:
433 // none
df5240ea 434 Int_t i,j;
435 Double_t g[3];
436
437 for(i=0;i<3;i++) g[i] = g0[i] - ftran[i];
438 for(i=0;i<3;i++){
439 l[i] = 0.0;
440 for(j=0;j<3;j++) l[i] += fm[i][j]*g[j];
441 // g = R l + translation
442 } // end for i
443 return;
444}
445//----------------------------------------------------------------------
024a4246 446void AliITSgeomMatrix::LtoGPosition(const Double_t l[3],Double_t g[3]) const {
023ae34b 447 // Returns the global coordinates given the local coordinates [cm].
448 // Inputs:
449 // Double_t l[3] The poistion represented in the detector
450 // local coordinate system
451 // Outputs:
452 // Double_t g[3] The poistion represented in the ALICE
453 // Global coordinate system
454 // Return:
455 // none.
df5240ea 456 Int_t i,j;
457
458 for(i=0;i<3;i++){
459 g[i] = 0.0;
460 for(j=0;j<3;j++) g[i] += fm[j][i]*l[j];
461 g[i] += ftran[i];
462 // g = R^t l + translation
463 } // end for i
464 return;
465}
466//----------------------------------------------------------------------
024a4246 467void AliITSgeomMatrix::GtoLMomentum(const Double_t g[3],Double_t l[3]) const{
023ae34b 468 // Returns the local coordinates of the momentum given the global
469 // coordinates of the momentum. It transforms just like GtoLPosition
470 // except that the translation vector is zero.
471 // Inputs:
472 // Double_t g[3] The momentum represented in the ALICE global
473 // coordinate system
474 // Outputs:
475 // Double_t l[3] the momentum represented in the detector
476 // local coordinate system
477 // Return:
478 // none.
df5240ea 479 Int_t i,j;
480
481 for(i=0;i<3;i++){
482 l[i] = 0.0;
483 for(j=0;j<3;j++) l[i] += fm[i][j]*g[j];
484 // g = R l
485 } // end for i
486 return;
487}
488//----------------------------------------------------------------------
024a4246 489void AliITSgeomMatrix::LtoGMomentum(const Double_t l[3],Double_t g[3]) const {
023ae34b 490 // Returns the Global coordinates of the momentum given the local
491 // coordinates of the momentum. It transforms just like LtoGPosition
492 // except that the translation vector is zero.
493 // Inputs:
494 // Double_t l[3] the momentum represented in the detector
495 // local coordinate system
496 // Outputs:
497 // Double_t g[3] The momentum represented in the ALICE global
498 // coordinate system
499 // Return:
500 // none.
df5240ea 501 Int_t i,j;
502
503 for(i=0;i<3;i++){
504 g[i] = 0.0;
505 for(j=0;j<3;j++) g[i] += fm[j][i]*l[j];
506 // g = R^t l
507 } // end for i
508 return;
509}
510//----------------------------------------------------------------------
023ae34b 511void AliITSgeomMatrix::GtoLPositionError(const Double_t g[3][3],
512 Double_t l[3][3]) const {
513 // Given an Uncertainty matrix in Global coordinates it is
514 // rotated so that its representation in local coordinates can
515 // be returned. There is no effect due to the translation vector
516 // or its uncertainty.
517 // Inputs:
518 // Double_t g[3][3] The error matrix represented in the ALICE global
519 // coordinate system
520 // Outputs:
521 // Double_t l[3][3] the error matrix represented in the detector
522 // local coordinate system
523 // Return:
524 // none.
df5240ea 525 Int_t i,j,k,m;
526
ecb0c8bc 527 for(i=0;i<3;i++)for(m=0;m<3;m++){
528 l[i][m] = 0.0;
529 for(j=0;j<3;j++)for(k=0;k<3;k++)
530 l[i][m] += fm[j][i]*g[j][k]*fm[k][m];
531 } // end for i,m
532 // g = R^t l R
df5240ea 533 return;
534}
535//----------------------------------------------------------------------
023ae34b 536void AliITSgeomMatrix::LtoGPositionError(const Double_t l[3][3],
024a4246 537 Double_t g[3][3]) const {
023ae34b 538 // Given an Uncertainty matrix in Local coordinates it is rotated so that
539 // its representation in global coordinates can be returned. There is no
540 // effect due to the translation vector or its uncertainty.
541 // Inputs:
542 // Double_t l[3][3] the error matrix represented in the detector
543 // local coordinate system
544 // Outputs:
545 // Double_t g[3][3] The error matrix represented in the ALICE global
546 // coordinate system
547 // Return:
548 // none.
df5240ea 549 Int_t i,j,k,m;
550
ecb0c8bc 551 for(i=0;i<3;i++)for(m=0;m<3;m++){
552 g[i][m] = 0.0;
553 for(j=0;j<3;j++)for(k=0;k<3;k++)
554 g[i][m] += fm[i][j]*l[j][k]*fm[m][k];
555 } // end for i,m
556 // g = R l R^t
df5240ea 557 return;
558}
559//----------------------------------------------------------------------
023ae34b 560void AliITSgeomMatrix::GtoLPositionTracking(const Double_t g[3],
561 Double_t l[3]) const {
562 // A slightly different coordinate system is used when tracking.
563 // This coordinate system is only relevant when the geometry represents
564 // the cylindrical ALICE ITS geometry. For tracking the Z axis is left
565 // alone but X -> -Y and Y -> X such that X always points out of the
566 // ITS Cylinder for every layer including layer 1 (where the detector
567 // are mounted upside down).
568 //Begin_Html
569 /*
570 <img src="picts/ITS/AliITSgeomMatrix_T1.gif">
571 */
572 //End_Html
573 // Inputs:
574 // Double_t g[3] The position represented in the ALICE
575 // global coordinate system
576 // Outputs:
577 // Double_t l[3] The poistion represented in the local
578 // detector coordiante system
579 // Return:
580 // none
df5240ea 581 Double_t l0[3];
582
023ae34b 583 this->GtoLPosition(g,l0);
df5240ea 584 if(fid[0]==1){ // for layer 1 the detector are flipped upside down
585 // with respect to the others.
586 l[0] = +l0[1];
587 l[1] = -l0[0];
588 l[2] = +l0[2];
589 }else{
590 l[0] = -l0[1];
591 l[1] = +l0[0];
592 l[2] = +l0[2];
593 } // end if
594 return;
595}
596//----------------------------------------------------------------------
597void AliITSgeomMatrix::LtoGPositionTracking(const Double_t l[3],
023ae34b 598 Double_t g[3]) const {
599 // A slightly different coordinate system is used when tracking.
600 // This coordinate system is only relevant when the geometry represents
601 // the cylindrical ALICE ITS geometry. For tracking the Z axis is left
602 // alone but X -> -Y and Y -> X such that X always points out of the
603 // ITS Cylinder for every layer including layer 1 (where the detector
604 // are mounted upside down).
605 //Begin_Html
606 /*
607 <img src="picts/ITS/AliITSgeomMatrix_T1.gif">
608 */
609 //End_Html
610 // Inputs:
611 // Double_t l[3] The poistion represented in the detector
612 // local coordinate system
613 // Outputs:
614 // Double_t g[3] The poistion represented in the ALICE
615 // Global coordinate system
616 // Return:
617 // none.
df5240ea 618 Double_t l0[3];
619
620 if(fid[0]==1){ // for layer 1 the detector are flipped upside down
621 // with respect to the others.
622 l0[0] = -l[1];
623 l0[1] = +l[0];
624 l0[2] = +l[2];
625 }else{
626 l0[0] = +l[1];
627 l0[1] = -l[0];
628 l0[2] = +l[2];
629 } // end if
630 this->LtoGPosition(l0,g);
631 return;
632}
633//----------------------------------------------------------------------
634void AliITSgeomMatrix::GtoLMomentumTracking(const Double_t g[3],
023ae34b 635 Double_t l[3]) const {
636 // A slightly different coordinate system is used when tracking.
637 // This coordinate system is only relevant when the geometry represents
638 // the cylindrical ALICE ITS geometry. For tracking the Z axis is left
639 // alone but X -> -Y and Y -> X such that X always points out of the
640 // ITS Cylinder for every layer including layer 1 (where the detector
641 // are mounted upside down).
642 //Begin_Html
643 /*
644 <img src="picts/ITS/AliITSgeomMatrix_T1.gif">
645 */
646 //End_Html
647 // Inputs:
648 // Double_t g[3] The momentum represented in the ALICE global
649 // coordinate system
650 // Outputs:
651 // Double_t l[3] the momentum represented in the detector
652 // local coordinate system
653 // Return:
654 // none.
df5240ea 655 Double_t l0[3];
656
657 this->GtoLMomentum(g,l0);
658 if(fid[0]==1){ // for layer 1 the detector are flipped upside down
659 // with respect to the others.
660 l[0] = +l0[1];
661 l[1] = -l0[0];
662 l[2] = +l0[2];
663 }else{
664 l[0] = -l0[1];
665 l[1] = +l0[0];
666 l[2] = +l0[2];
667 } // end if
668 return;
df5240ea 669}
670//----------------------------------------------------------------------
671void AliITSgeomMatrix::LtoGMomentumTracking(const Double_t l[3],
023ae34b 672 Double_t g[3]) const {
673 // A slightly different coordinate system is used when tracking.
674 // This coordinate system is only relevant when the geometry represents
675 // the cylindrical ALICE ITS geometry. For tracking the Z axis is left
676 // alone but X -> -Y and Y -> X such that X always points out of the
677 // ITS Cylinder for every layer including layer 1 (where the detector
678 // are mounted upside down).
679 //Begin_Html
680 /*
681 <img src="picts/ITS/AliITSgeomMatrix_T1.gif">
682 */
683 //End_Html
684 // Inputs:
685 // Double_t l[3] the momentum represented in the detector
686 // local coordinate system
687 // Outputs:
688 // Double_t g[3] The momentum represented in the ALICE global
689 // coordinate system
690 // Return:
691 // none.
df5240ea 692 Double_t l0[3];
693
694 if(fid[0]==1){ // for layer 1 the detector are flipped upside down
695 // with respect to the others.
696 l0[0] = -l[1];
697 l0[1] = +l[0];
698 l0[2] = +l[2];
699 }else{
700 l0[0] = +l[1];
701 l0[1] = -l[0];
702 l0[2] = +l[2];
703 } // end if
704 this->LtoGMomentum(l0,g);
705 return;
706}
707//----------------------------------------------------------------------
023ae34b 708void AliITSgeomMatrix::GtoLPositionErrorTracking(const Double_t g[3][3],
709 Double_t l[3][3]) const {
710 // A slightly different coordinate system is used when tracking.
711 // This coordinate system is only relevant when the geometry represents
712 // the cylindrical ALICE ITS geometry. For tracking the Z axis is left
713 // alone but X -> -Y and Y -> X such that X always points out of the
714 // ITS Cylinder for every layer including layer 1 (where the detector
715 // are mounted upside down).
716 //Begin_Html
717 /*
718 <img src="picts/ITS/AliITSgeomMatrix_TE1.gif">
719 */
720 //End_Html
721 // Inputs:
722 // Double_t g[3][3] The error matrix represented in the ALICE global
723 // coordinate system
724 // Outputs:
725 // Double_t l[3][3] the error matrix represented in the detector
726 // local coordinate system
727 // Return:
df5240ea 728 Int_t i,j,k,m;
85f1e34a 729 Double_t rt[3][3];
730 Double_t a0[3][3] = {{0.,+1.,0.},{-1.,0.,0.},{0.,0.,+1.}};
731 Double_t a1[3][3] = {{0.,-1.,0.},{+1.,0.,0.},{0.,0.,+1.}};
df5240ea 732
733 if(fid[0]==1) for(i=0;i<3;i++)for(j=0;j<3;j++)for(k=0;k<3;k++)
85f1e34a 734 rt[i][k] = a0[i][j]*fm[j][k];
df5240ea 735 else for(i=0;i<3;i++)for(j=0;j<3;j++)for(k=0;k<3;k++)
85f1e34a 736 rt[i][k] = a1[i][j]*fm[j][k];
ecb0c8bc 737 for(i=0;i<3;i++)for(m=0;m<3;m++){
738 l[i][m] = 0.0;
739 for(j=0;j<3;j++)for(k=0;k<3;k++)
740 l[i][m] += rt[j][i]*g[j][k]*rt[k][m];
741 } // end for i,m
742 // g = R^t l R
df5240ea 743 return;
744}
745//----------------------------------------------------------------------
023ae34b 746void AliITSgeomMatrix::LtoGPositionErrorTracking(const Double_t l[3][3],
747 Double_t g[3][3]) const {
748 // A slightly different coordinate system is used when tracking.
749 // This coordinate system is only relevant when the geometry represents
750 // the cylindrical ALICE ITS geometry. For tracking the Z axis is left
751 // alone but X -> -Y and Y -> X such that X always points out of the
752 // ITS Cylinder for every layer including layer 1 (where the detector
753 // are mounted upside down).
754 //Begin_Html
755 /*
756 <img src="picts/ITS/AliITSgeomMatrix_TE1.gif">
757 */
758 //End_Html
759 // Inputs:
760 // Double_t l[3][3] the error matrix represented in the detector
761 // local coordinate system
762 // Outputs:
763 // Double_t g[3][3] The error matrix represented in the ALICE global
764 // coordinate system
765 // Return:
766 // none.
df5240ea 767 Int_t i,j,k,m;
85f1e34a 768 Double_t rt[3][3];
769 Double_t a0[3][3] = {{0.,+1.,0.},{-1.,0.,0.},{0.,0.,+1.}};
770 Double_t a1[3][3] = {{0.,-1.,0.},{+1.,0.,0.},{0.,0.,+1.}};
df5240ea 771
772 if(fid[0]==1) for(i=0;i<3;i++)for(j=0;j<3;j++)for(k=0;k<3;k++)
85f1e34a 773 rt[i][k] = a0[i][j]*fm[j][k];
df5240ea 774 else for(i=0;i<3;i++)for(j=0;j<3;j++)for(k=0;k<3;k++)
85f1e34a 775 rt[i][k] = a1[i][j]*fm[j][k];
ecb0c8bc 776 for(i=0;i<3;i++)for(m=0;m<3;m++){
777 g[i][m] = 0.0;
778 for(j=0;j<3;j++)for(k=0;k<3;k++)
779 g[i][m] += rt[i][j]*l[j][k]*rt[m][k];
780 } // end for i,m
781 // g = R l R^t
df5240ea 782 return;
783}
784//----------------------------------------------------------------------
024a4246 785void AliITSgeomMatrix::PrintTitles(ostream *os) const {
023ae34b 786 // Standard output format for this class but it includes variable
787 // names and formatting that makes it easer to read.
788 // Inputs:
789 // ostream *os The output stream to print the title on
790 // Outputs:
791 // none.
792 // Return:
793 // none.
df5240ea 794 Int_t i,j;
795
796 *os << "fDetectorIndex=" << fDetectorIndex << " fid[3]={";
797 for(i=0;i<3;i++) *os << fid[i] << " ";
798 *os << "} frot[3]={";
799 for(i=0;i<3;i++) *os << frot[i] << " ";
800 *os << "} ftran[3]={";
801 for(i=0;i<3;i++) *os << ftran[i] << " ";
802 *os << "} fm[3][3]={";
803 for(i=0;i<3;i++){for(j=0;j<3;j++){ *os << fm[i][j] << " ";} *os <<"}{";}
804 *os << "}" << endl;
805 return;
806}
807//----------------------------------------------------------------------
024a4246 808void AliITSgeomMatrix::PrintComment(ostream *os) const {
023ae34b 809 // output format used by Print.
810 // Inputs:
811 // ostream *os The output stream to print the comments on
812 // Outputs:
813 // none.
814 // Return:
815 // none.
8253cd9a 816 *os << "fDetectorIndex fid[0] fid[1] fid[2] ftran[0] ftran[1] ftran[2] ";
817 *os << "fm[0][0] fm[0][1] fm[0][2] fm[1][0] fm[1][1] fm[1][2] ";
818 *os << "fm[2][0] fm[2][1] fm[2][2] ";
819 return;
820}
821//----------------------------------------------------------------------
5cf690c1 822void AliITSgeomMatrix::Print(ostream *os)const{
023ae34b 823 // Standard output format for this class.
824 // Inputs:
825 // ostream *os The output stream to print the class data on
826 // Outputs:
827 // none.
828 // Return:
829 // none.
df5240ea 830 Int_t i,j;
431a7819 831#if defined __GNUC__
832#if __GNUC__ > 2
833 ios::fmtflags fmt;
834#else
835 Int_t fmt;
836#endif
837#else
9f69211c 838#if defined __ICC || defined __ECC || defined __xlC__
94831058 839 ios::fmtflags fmt;
840#else
31b8cd63 841 Int_t fmt;
431a7819 842#endif
94831058 843#endif
df5240ea 844
8253cd9a 845 fmt = os->setf(ios::scientific); // set scientific floating point output
df5240ea 846 *os << fDetectorIndex << " ";
847 for(i=0;i<3;i++) *os << fid[i] << " ";
8253cd9a 848// for(i=0;i<3;i++) *os << frot[i] << " "; // Redundant with fm[][].
849 for(i=0;i<3;i++) *os << setprecision(16) << ftran[i] << " ";
850 for(i=0;i<3;i++)for(j=0;j<3;j++) *os << setprecision(16) <<
851 fm[i][j] << " ";
023ae34b 852 *os << fPath.Length()<< " ";
853 for(i=0;i<fPath.Length();i++) *os << fPath[i];
df5240ea 854 *os << endl;
8253cd9a 855 os->flags(fmt); // reset back to old formating.
df5240ea 856 return;
857}
858//----------------------------------------------------------------------
8253cd9a 859void AliITSgeomMatrix::Read(istream *is){
023ae34b 860 // Standard input format for this class.
861 // Inputs:
862 // istream *is The input stream to read on
863 // Outputs:
864 // none.
865 // Return:
866 // none.
df5240ea 867 Int_t i,j;
868
869 *is >> fDetectorIndex;
870 for(i=0;i<3;i++) *is >> fid[i];
8253cd9a 871// for(i=0;i<3;i++) *is >> frot[i]; // Redundant with fm[][].
df5240ea 872 for(i=0;i<3;i++) *is >> ftran[i];
873 for(i=0;i<3;i++)for(j=0;j<3;j++) *is >> fm[i][j];
5cf690c1 874 while(is->peek()==' ')is->get(); // skip white spaces
875 if(isprint(is->peek())){ // old format did not have path.
876 *is >> j; // string length
877 fPath.Resize(j);
878 for(i=0;i<j;i++) {*is >> fPath[i];}
879 } // end if
8253cd9a 880 AngleFromMatrix(); // compute angles frot[].
d8cc8493 881 fCylR = TMath::Sqrt(ftran[0]*ftran[0]+ftran[1]*ftran[1]);
882 fCylPhi = TMath::ATan2(ftran[1],ftran[0]);
883 if(fCylPhi<0.0) fCylPhi += TMath::Pi();
df5240ea 884 return;
885}
d8cc8493 886//______________________________________________________________________
887void AliITSgeomMatrix::Streamer(TBuffer &R__b){
888 // Stream an object of class AliITSgeomMatrix.
023ae34b 889 // Inputs:
890 // TBuffer &R__b The output buffer to stream data on.
891 // Outputs:
892 // none.
893 // Return:
894 // none.
d8cc8493 895
023ae34b 896 if (R__b.IsReading()) {
897 AliITSgeomMatrix::Class()->ReadBuffer(R__b, this);
898 fCylR = TMath::Sqrt(ftran[0]*ftran[0]+ftran[1]*ftran[1]);
899 fCylPhi = TMath::ATan2(ftran[1],ftran[0]);
900 this->AngleFromMatrix();
901 if(fCylPhi<0.0) fCylPhi += TMath::Pi();
902 } else {
903 AliITSgeomMatrix::Class()->WriteBuffer(R__b, this);
904 } // end if
d8cc8493 905}
024a4246 906//______________________________________________________________________
907void AliITSgeomMatrix::SetTranslation(const Double_t tran[3]){
023ae34b 908 // Sets the translation vector and computes fCylR and fCylPhi.
909 // Inputs:
910 // Double_t trans[3] The translation vector to be used
911 // Outputs:
912 // none.
913 // Return:
914 // none.
915 for(Int_t i=0;i<3;i++) ftran[i] = tran[i];
916 fCylR = TMath::Sqrt(ftran[0]*ftran[0]+ftran[1]*ftran[1]);
917 fCylPhi = TMath::ATan2(ftran[1],ftran[0]);
918 if(fCylPhi<0.0) fCylPhi += TMath::Pi();
919}
920//----------------------------------------------------------------------
6b0f3880 921TPolyLine3D* AliITSgeomMatrix::CreateLocalAxis() const {
023ae34b 922 // This class is used as part of the documentation of this class
923 // Inputs:
924 // none.
925 // Outputs:
926 // none.
927 // Return:
928 // A pointer to a new TPolyLine3D object showing the 3 line
929 // segments that make up the this local axis in the global
930 // reference system.
931 Float_t gf[15];
932 Double_t g[5][3];
933 Double_t l[5][3]={{1.0,0.0,0.0},{0.0,0.0,0.0},{0.0,1.0,0.0},{0.0,0.0,0.0},
934 {0.0,0.0,1.0}};
935 Int_t i;
936
937 for(i=0;i<5;i++) {
938 LtoGPosition(l[i],g[i]);
939 gf[3*i]=(Float_t)g[i][0];
940 gf[3*i+1]=(Float_t)g[i][1];
941 gf[3*i+2]=(Float_t)g[i][2];
942 } // end for i
943 return new TPolyLine3D(5,gf);
944}
945//----------------------------------------------------------------------
6b0f3880 946TPolyLine3D* AliITSgeomMatrix::CreateLocalAxisTracking() const {
023ae34b 947 // This class is used as part of the documentation of this class
948 // Inputs:
949 // none.
950 // Outputs:
951 // none.
952 // Return:
953 // A pointer to a new TPolyLine3D object showing the 3 line
954 // segments that make up the this local axis in the global
955 // reference system.
956 Float_t gf[15];
957 Double_t g[5][3];
958 Double_t l[5][3]={{1.0,0.0,0.0},{0.0,0.0,0.0},{0.0,1.0,0.0},{0.0,0.0,0.0},
959 {0.0,0.0,1.0}};
960 Int_t i;
961
962 for(i=0;i<5;i++) {
963 LtoGPositionTracking(l[i],g[i]);
964 gf[3*i]=(Float_t)g[i][0];
965 gf[3*i+1]=(Float_t)g[i][1];
966 gf[3*i+2]=(Float_t)g[i][2];
967 } // end for i
968 return new TPolyLine3D(5,gf);
969}
970//----------------------------------------------------------------------
971TNode* AliITSgeomMatrix::CreateNode(const Char_t *nodeName,
972 const Char_t *nodeTitle,TNode *mother,
6b0f3880 973 TShape *shape,Bool_t axis) const {
023ae34b 974 // Creates a node inside of the node mother out of the shape shape
975 // in the position, with respect to mother, indecated by "this". If axis
976 // is ture, it will insert an axis within this node/shape.
977 // Inputs:
978 // Char_t *nodeName This name of this node
979 // Char_t *nodeTitle This node title
980 // TNode *mother The node this node will be inside of/with respect to
981 // TShape *shape The shape of this node
982 // Bool_t axis If ture, a set of x,y,z axis will be included
983 // Outputs:
984 // none.
985 // Return:
986 // A pointer to "this" node.
987 Double_t trans[3],matrix[3][3],*matr;
988 TRotMatrix *rot = new TRotMatrix();
989 TString name,title;
990
991 matr = &(matrix[0][0]);
992 this->GetTranslation(trans);
993 this->GetMatrix(matrix);
994 rot->SetMatrix(matr);
995 //
996 name = nodeName;
997 title = nodeTitle;
998 //
999 mother->cd();
1000 TNode *node1 = new TNode(name.Data(),title.Data(),shape,trans[0],trans[1],trans[2],rot);
1001 if(axis){
1002 Int_t i,j;
6b0f3880 1003 const Float_t kScale=0.5,kLw=0.2;
1004 Float_t xchar[13][2]={{0.5*kLw,1.},{0.,0.5*kLw},{0.5-0.5*kLw,0.5},
1005 {0.,0.5*kLw},{0.5*kLw,0.},{0.5,0.5-0.5*kLw},
1006 {1-0.5*kLw,0.},{1.,0.5*kLw},{0.5+0.5*kLw,0.5},
1007 {1.,1.-0.5*kLw},{1.-0.5*kLw,1.},{0.5,0.5+0.5*kLw},
1008 {0.5*kLw,1.}};
1009 Float_t ychar[10][2]={{.5-0.5*kLw,0.},{.5+0.5*kLw,0.},{.5+0.5*kLw,0.5-0.5*kLw},
1010 {1.,1.-0.5*kLw},{1.-0.5*kLw,1.},{0.5+0.5*kLw,0.5},
1011 {0.5*kLw,1.} ,{0.,1-0.5*kLw} ,{0.5-0.5*kLw,0.5},
1012 {.5-0.5*kLw,0.}};
1013 Float_t zchar[11][2]={{0.,1.},{0,1.-kLw},{1.-kLw,1.-kLw},{0.,kLw} ,{0.,0.},
1014 {1.,0.},{1.,kLw} ,{kLw,kLw} ,{1.,1.-kLw},{1.,1.},
023ae34b 1015 {0.,1.}};
1016 for(i=0;i<13;i++)for(j=0;j<2;j++){
6b0f3880 1017 if(i<13) xchar[i][j] = kScale*xchar[i][j];
1018 if(i<10) ychar[i][j] = kScale*ychar[i][j];
1019 if(i<11) zchar[i][j] = kScale*zchar[i][j];
023ae34b 1020 } // end for i,j
1021 TXTRU *axisxl = new TXTRU("x","x","text",12,2);
1022 for(i=0;i<12;i++) axisxl->DefineVertex(i,xchar[i][0],xchar[i][1]);
6b0f3880 1023 axisxl->DefineSection(0,-0.5*kLw);axisxl->DefineSection(1,0.5*kLw);
023ae34b 1024 TXTRU *axisyl = new TXTRU("y","y","text",9,2);
1025 for(i=0;i<9;i++) axisyl->DefineVertex(i,ychar[i][0],ychar[i][1]);
6b0f3880 1026 axisyl->DefineSection(0,-0.5*kLw);axisyl->DefineSection(1,0.5*kLw);
023ae34b 1027 TXTRU *axiszl = new TXTRU("z","z","text",10,2);
1028 for(i=0;i<10;i++) axiszl->DefineVertex(i,zchar[i][0],zchar[i][1]);
6b0f3880 1029 axiszl->DefineSection(0,-0.5*kLw);axiszl->DefineSection(1,0.5*kLw);
1030 Float_t lxy[13][2]={{-0.5*kLw,-0.5*kLw},{0.8,-0.5*kLw},{0.8,-0.1},{1.0,0.0},
1031 {0.8,0.1},{0.8,0.5*kLw},{0.5*kLw,0.5*kLw},{0.5*kLw,0.8},
1032 {0.1,0.8},{0.0,1.0},{-0.1,0.8},{-0.5*kLw,0.8},
1033 {-0.5*kLw,-0.5*kLw}};
023ae34b 1034 TXTRU *axisxy = new TXTRU("axisxy","axisxy","text",13,2);
1035 for(i=0;i<13;i++) axisxy->DefineVertex(i,lxy[i][0],lxy[i][1]);
6b0f3880 1036 axisxy->DefineSection(0,-0.5*kLw);axisxy->DefineSection(1,0.5*kLw);
1037 Float_t lz[8][2]={{0.5*kLw,-0.5*kLw},{0.8,-0.5*kLw},{0.8,-0.1},{1.0,0.0},
1038 {0.8,0.1},{0.8,0.5*kLw},{0.5*kLw,0.5*kLw},
1039 {0.5*kLw,-0.5*kLw}};
023ae34b 1040 TXTRU *axisz = new TXTRU("axisz","axisz","text",8,2);
1041 for(i=0;i<8;i++) axisz->DefineVertex(i,lz[i][0],lz[i][1]);
6b0f3880 1042 axisz->DefineSection(0,-0.5*kLw);axisz->DefineSection(1,0.5*kLw);
023ae34b 1043 //TRotMatrix *xaxis90= new TRotMatrix("xaixis90","",90.0, 0.0, 0.0);
1044 TRotMatrix *yaxis90= new TRotMatrix("yaixis90","", 0.0,90.0, 0.0);
1045 TRotMatrix *zaxis90= new TRotMatrix("zaixis90","", 0.0, 0.0,90.0);
1046 //
1047 node1->cd();
1048 title = name.Append("axisxy");
1049 TNode *nodeaxy = new TNode(title.Data(),title.Data(),axisxy);
1050 title = name.Append("axisz");
1051 TNode *nodeaz = new TNode(title.Data(),title.Data(),axisz,0.,0.,0.,yaxis90);
1052 TNode *textboxX0 = new TNode("textboxX0","textboxX0",axisxl,
1053 lxy[3][0],lxy[3][1],0.0);
1054 TNode *textboxX1 = new TNode("textboxX1","textboxX1",axisxl,
1055 lxy[3][0],lxy[3][1],0.0,yaxis90);
1056 TNode *textboxX2 = new TNode("textboxX2","textboxX2",axisxl,
1057 lxy[3][0],lxy[3][1],0.0,zaxis90);
1058 TNode *textboxY0 = new TNode("textboxY0","textboxY0",axisyl,
1059 lxy[9][0],lxy[9][1],0.0);
1060 TNode *textboxY1 = new TNode("textboxY1","textboxY1",axisyl,
1061 lxy[9][0],lxy[9][1],0.0,yaxis90);
1062 TNode *textboxY2 = new TNode("textboxY2","textboxY2",axisyl,
1063 lxy[9][0],lxy[9][1],0.0,zaxis90);
1064 TNode *textboxZ0 = new TNode("textboxZ0","textboxZ0",axiszl,
1065 0.0,0.0,lz[3][0]);
1066 TNode *textboxZ1 = new TNode("textboxZ1","textboxZ1",axiszl,
1067 0.0,0.0,lz[3][0],yaxis90);
1068 TNode *textboxZ2 = new TNode("textboxZ2","textboxZ2",axiszl,
1069 0.0,0.0,lz[3][0],zaxis90);
1070 nodeaxy->Draw();
1071 nodeaz->Draw();
1072 textboxX0->Draw();
1073 textboxX1->Draw();
1074 textboxX2->Draw();
1075 textboxY0->Draw();
1076 textboxY1->Draw();
1077 textboxY2->Draw();
1078 textboxZ0->Draw();
1079 textboxZ1->Draw();
1080 textboxZ2->Draw();
1081 } // end if
1082 mother->cd();
1083 return node1;
024a4246 1084}
023ae34b 1085//----------------------------------------------------------------------
6b0f3880 1086void AliITSgeomMatrix::MakeFigures() const {
023ae34b 1087 // make figures to help document this class
1088 // Inputs:
1089 // none.
1090 // Outputs:
1091 // none.
1092 // Return:
1093 // none.
6b0f3880 1094 const Double_t kDx0=550.,kDy0=550.,kDz0=550.; // cm
1095 const Double_t kDx=1.0,kDy=0.300,kDz=3.0,kRmax=0.1; // cm
023ae34b 1096 Float_t l[5][3]={{1.0,0.0,0.0},{0.0,0.0,0.0},{0.0,1.0,0.0},{0.0,0.0,0.0},
1097 {0.0,0.0,1.0}};
1098 TCanvas *c = new TCanvas(kFALSE);// create a batch mode canvas.
1099 TView *view = new TView(1); // Create Cartesian coordiante view
6b0f3880 1100 TBRIK *mother = new TBRIK("Mother","Mother","void",kDx0,kDy0,kDz0);
1101 TBRIK *det = new TBRIK("Detector","","Si",kDx,kDy,kDz);
023ae34b 1102 TPolyLine3D *axis = new TPolyLine3D(5,&(l[0][0]));
1103 TPCON *arrow = new TPCON("arrow","","air",0.0,360.,2);
1104 TRotMatrix *xarrow= new TRotMatrix("xarrow","",90.,0.0,0.0);
1105 TRotMatrix *yarrow= new TRotMatrix("yarrow","",0.0,90.,0.0);
024a4246 1106
023ae34b 1107 det->SetLineColor(0); // black
1108 det->SetLineStyle(1); // solid line
1109 det->SetLineWidth(2); // pixel units
1110 det->SetFillColor(1); // black
1111 det->SetFillStyle(4010); // window is 90% transparent
1112 arrow->SetLineColor(det->GetLineColor());
1113 arrow->SetLineWidth(det->GetLineWidth());
1114 arrow->SetLineStyle(det->GetLineStyle());
1115 arrow->SetFillColor(1); // black
1116 arrow->SetFillStyle(4100); // window is 100% opaque
6b0f3880 1117 arrow->DefineSection(0,0.0,0.0,kRmax);
1118 arrow->DefineSection(1,2.*kRmax,0.0,0.0);
1119 view->SetRange(-kDx0,-kDy0,-kDz0,kDx0,kDy0,kDz0);
023ae34b 1120 //
1121 TNode *node0 = new TNode("NODE0","NODE0",mother);
1122 node0->cd();
1123 TNode *node1 = new TNode("NODE1","NODE1",det);
1124 node1->cd();
1125 TNode *nodex = new TNode("NODEx","NODEx",arrow,l[0][0],l[0][1],l[0][2],xarrow);
1126 TNode *nodey = new TNode("NODEy","NODEy",arrow,l[2][0],l[2][1],l[2][2],yarrow);
1127 TNode *nodez = new TNode("NODEz","NODEz",arrow,l[4][0],l[4][1],l[4][2]);
1128 //
1129 axis->Draw();
1130 nodex->Draw();
1131 nodey->Draw();
1132 nodez->Draw();
1133
1134 //
1135 node0->cd();
1136 node0->Draw();
1137 c->Update();
1138 c->SaveAs("AliITSgeomMatrix_L1.gif");
1139}
df5240ea 1140//----------------------------------------------------------------------
1141ostream &operator<<(ostream &os,AliITSgeomMatrix &p){
023ae34b 1142 // Standard output streaming function.
1143 // Inputs:
1144 // ostream &os The output stream to print the class data on
1145 // AliITSgeomMatrix &p This class
1146 // Outputs:
1147 // none.
1148 // Return:
1149 // none.
df5240ea 1150
8253cd9a 1151 p.Print(&os);
df5240ea 1152 return os;
1153}
1154//----------------------------------------------------------------------
1155istream &operator>>(istream &is,AliITSgeomMatrix &r){
023ae34b 1156 // Standard input streaming function.
1157 // Inputs:
1158 // ostream &os The input stream to print the class data on
1159 // AliITSgeomMatrix &p This class
1160 // Outputs:
1161 // none.
1162 // Return:
1163 // none.
df5240ea 1164
8253cd9a 1165 r.Read(&is);
df5240ea 1166 return is;
1167}
8253cd9a 1168//----------------------------------------------------------------------