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