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