1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 ////////////////////////////////////////////////////////////////////////
19 // This is the implementation file for AliITSgeomMatrix class. It
20 // contains the routines to manipulate, setup, and queary the geometry
21 // of a given ITS module. An ITS module may be one of at least three
22 // ITS detector technologies, Silicon Pixel, Drift, or Strip Detectors,
23 // and variations of these in size and/or layout. These routines let
24 // one go between ALICE global coordiantes (cm) to a given modules
25 // specific local coordinates (cm).
26 ////////////////////////////////////////////////////////////////////////
28 #include <Riostream.h>
33 #include "AliITSgeomMatrix.h"
35 ClassImp(AliITSgeomMatrix)
36 //----------------------------------------------------------------------
37 AliITSgeomMatrix::AliITSgeomMatrix(){
38 ////////////////////////////////////////////////////////////////////////
39 // The Default constructor for the AliITSgeomMatrix class. By Default
40 // the angles of rotations are set to zero, meaning that the rotation
41 // matrix is the unit matrix. The translation vector is also set to zero
42 // as are the module id number. The detector type is set to -1 (an undefined
43 // value). The full rotation matrix is kept so that the evaluation
44 // of a coordinate transformation can be done quickly and with a minimum
45 // of CPU overhead. The basic coordinate systems are the ALICE global
46 // coordinate system and the detector local coordinate system. In general
47 // this structure is not limited to just those two coordinate systems.
50 <img src="picts/ITS/AliISgeomMatrix_L1.gif">
53 ////////////////////////////////////////////////////////////////////////
56 fDetectorIndex = -1; // a value never defined.
59 frot[i] = ftran[i] = 0.0;
60 for(j=0;j<3;j++) fm[i][j] = 0.0;
61 fCylR = fCylPhi = 0.0;
63 fm[0][0] = fm[1][1] = fm[2][2] = 1.0;
65 //----------------------------------------------------------------------
66 AliITSgeomMatrix::AliITSgeomMatrix(const AliITSgeomMatrix &sourse){
67 ////////////////////////////////////////////////////////////////////////
68 // The standard copy constructor. This make a full / proper copy of
70 ////////////////////////////////////////////////////////////////////////
73 this->fDetectorIndex = sourse.fDetectorIndex;
75 this->fid[i] = sourse.fid[i];
76 this->frot[i] = sourse.frot[i];
77 this->ftran[i] = sourse.ftran[i];
78 this->fCylR = sourse.fCylR;
79 this->fCylPhi = sourse.fCylPhi;
80 for(j=0;j<3;j++) this->fm[i][j] = sourse.fm[i][j];
83 //----------------------------------------------------------------------
84 void AliITSgeomMatrix::operator=(const AliITSgeomMatrix &sourse){
85 ////////////////////////////////////////////////////////////////////////
86 // The standard = operator. This make a full / proper copy of
88 ////////////////////////////////////////////////////////////////////////
91 this->fDetectorIndex = sourse.fDetectorIndex;
93 this->fid[i] = sourse.fid[i];
94 this->frot[i] = sourse.frot[i];
95 this->ftran[i] = sourse.ftran[i];
96 this->fCylR = sourse.fCylR;
97 this->fCylPhi = sourse.fCylPhi;
98 for(j=0;j<3;j++) this->fm[i][j] = sourse.fm[i][j];
101 //----------------------------------------------------------------------
102 AliITSgeomMatrix::AliITSgeomMatrix(const Int_t idt,const Int_t id[3],
103 const Double_t rot[3],const Double_t tran[3]){
104 ////////////////////////////////////////////////////////////////////////
105 // This is a constructor for the AliITSgeomMatrix class. The matrix is
106 // defined by 3 standard rotation angles [radians], and the translation
107 // vector tran [cm]. In addition the layer, ladder, and detector number
108 // for this particular module and the type of module must be given.
109 // The full rotation matrix is kept so that the evaluation
110 // of a coordinate transformation can be done quickly and with a minimum
111 // of CPU overhead. The basic coordinate systems are the ALICE global
112 // coordinate system and the detector local coordinate system. In general
113 // this structure is not limited to just those two coordinate systems.
116 <img src="picts/ITS/AliISgeomMatrix_L1.gif">
119 ////////////////////////////////////////////////////////////////////////
122 fDetectorIndex = idt; // a value never defined.
128 fCylR = TMath::Sqrt(ftran[0]*ftran[0]+ftran[1]*ftran[1]);
129 fCylPhi = TMath::ATan2(ftran[1],ftran[0]);
130 if(fCylPhi<0.0) fCylPhi += TMath::Pi();
131 this->MatrixFromAngle();
133 //----------------------------------------------------------------------
134 AliITSgeomMatrix::AliITSgeomMatrix(const Int_t idt, const Int_t id[3],
135 Double_t matrix[3][3],
136 const Double_t tran[3]){
137 ////////////////////////////////////////////////////////////////////////
138 // This is a constructor for the AliITSgeomMatrix class. The rotation matrix
139 // is given as one of the inputs, and the translation vector tran [cm]. In
140 // addition the layer, ladder, and detector number for this particular
141 // module and the type of module must be given. The full rotation matrix
142 // is kept so that the evaluation of a coordinate transformation can be
143 // done quickly and with a minimum of CPU overhead. The basic coordinate
144 // systems are the ALICE global coordinate system and the detector local
145 // coordinate system. In general this structure is not limited to just
146 // those two coordinate systems.
149 <img src="picts/ITS/AliISgeomMatrix_L1.gif">
152 ////////////////////////////////////////////////////////////////////////
155 fDetectorIndex = idt; // a value never defined.
159 for(j=0;j<3;j++) fm[i][j] = matrix[i][j];
161 fCylR = TMath::Sqrt(ftran[0]*ftran[0]+ftran[1]*ftran[1]);
162 fCylPhi = TMath::ATan2(ftran[1],ftran[0]);
163 if(fCylPhi<0.0) fCylPhi += TMath::Pi();
164 this->AngleFromMatrix();
166 //----------------------------------------------------------------------
167 void AliITSgeomMatrix::SixAnglesFromMatrix(Double_t *ang){
168 ////////////////////////////////////////////////////////////////////////
169 // This function returns the 6 GEANT 3.21 rotation angles [degrees] in
170 // the array ang which must be at least [6] long.
171 ////////////////////////////////////////////////////////////////////////
172 Double_t si,c=180./TMath::Pi();
174 ang[1] = TMath::ATan2(fm[0][1],fm[0][0]);
175 if(TMath::Cos(ang[1])!=0.0) si = fm[0][0]/TMath::Cos(ang[1]);
176 else si = fm[0][1]/TMath::Sin(ang[1]);
177 ang[0] = TMath::ATan2(si,fm[0][2]);
179 ang[3] = TMath::ATan2(fm[1][1],fm[1][0]);
180 if(TMath::Cos(ang[3])!=0.0) si = fm[1][0]/TMath::Cos(ang[3]);
181 else si = fm[1][1]/TMath::Sin(ang[3]);
182 ang[2] = TMath::ATan2(si,fm[1][2]);
184 ang[5] = TMath::ATan2(fm[2][1],fm[2][0]);
185 if(TMath::Cos(ang[5])!=0.0) si = fm[2][0]/TMath::Cos(ang[5]);
186 else si = fm[2][1]/TMath::Sin(ang[5]);
187 ang[4] = TMath::ATan2(si,fm[2][2]);
189 for(Int_t i=0;i<6;i++) {ang[i] *= c; if(ang[i]<0.0) ang[i] += 360.;}
191 //----------------------------------------------------------------------
192 void AliITSgeomMatrix::MatrixFromSixAngles(const Double_t *ang){
193 ////////////////////////////////////////////////////////////////////////
194 // Given the 6 GEANT 3.21 rotation angles [degree], this will compute and
195 // set the rotations matrix and 3 standard rotation angles [radians].
196 // These angles and rotation matrix are overwrite the existing values in
198 ////////////////////////////////////////////////////////////////////////
200 Double_t si,lr[9],c=TMath::Pi()/180.;
202 si = TMath::Sin(c*ang[0]);
203 if(ang[0]== 90.0) si = +1.0;
204 if(ang[0]==270.0) si = -1.0;
205 if(ang[0]== 0.0||ang[0]==180.) si = 0.0;
206 lr[0] = si * TMath::Cos(c*ang[1]);
207 lr[1] = si * TMath::Sin(c*ang[1]);
208 lr[2] = TMath::Cos(c*ang[0]);
209 if(ang[0]== 90.0||ang[0]==270.) lr[2] = 0.0;
210 if(ang[0]== 0.0) lr[2] = +1.0;
211 if(ang[0]==180.0) lr[2] = -1.0;
213 si = TMath::Sin(c*ang[2]);
214 if(ang[2]== 90.0) si = +1.0;
215 if(ang[2]==270.0) si = -1.0;
216 if(ang[2]== 0.0||ang[2]==180.) si = 0.0;
217 lr[3] = si * TMath::Cos(c*ang[3]);
218 lr[4] = si * TMath::Sin(c*ang[3]);
219 lr[5] = TMath::Cos(c*ang[2]);
220 if(ang[2]== 90.0||ang[2]==270.) lr[5] = 0.0;
221 if(ang[2]== 0.0) lr[5] = +1.0;
222 if(ang[2]==180.0) lr[5] = -1.0;
224 si = TMath::Sin(c*ang[4]);
225 if(ang[4]== 90.0) si = +1.0;
226 if(ang[4]==270.0) si = -1.0;
227 if(ang[4]== 0.0||ang[4]==180.) si = 0.0;
228 lr[6] = si * TMath::Cos(c*ang[5]);
229 lr[7] = si * TMath::Sin(c*ang[5]);
230 lr[8] = TMath::Cos(c*ang[4]);
231 if(ang[4]== 90.0||ang[4]==270.0) lr[8] = 0.0;
232 if(ang[4]== 0.0) lr[8] = +1.0;
233 if(ang[4]==180.0) lr[8] = -1.0;
234 // Normalize these elements and fill matrix fm.
235 for(i=0;i<3;i++){// reuse si.
237 for(j=0;j<3;j++) si += lr[3*i+j]*lr[3*i+j];
238 si = TMath::Sqrt(1./si);
239 for(j=0;j<3;j++) fm[i][j] = si*lr[3*i+j];
241 this->AngleFromMatrix();
243 //----------------------------------------------------------------------
244 AliITSgeomMatrix::AliITSgeomMatrix(const Double_t rotd[6]/*degrees*/,
245 const Int_t idt,const Int_t id[3],
246 const Double_t tran[3]){
247 ////////////////////////////////////////////////////////////////////////
248 // This is a constructor for the AliITSgeomMatrix class. The matrix is
249 // defined by the 6 GEANT 3.21 rotation angles [degrees], and the translation
250 // vector tran [cm]. In addition the layer, ladder, and detector number
251 // for this particular module and the type of module must be given.
252 // The full rotation matrix is kept so that the evaluation
253 // of a coordinate transformation can be done quickly and with a minimum
254 // of CPU overhead. The basic coordinate systems are the ALICE global
255 // coordinate system and the detector local coordinate system. In general
256 // this structure is not limited to just those two coordinate systems.
259 <img src="picts/ITS/AliISgeomMatrix_L1.gif">
262 ////////////////////////////////////////////////////////////////////////
265 fDetectorIndex = idt; // a value never defined.
270 fCylR = TMath::Sqrt(ftran[0]*ftran[0]+ftran[1]*ftran[1]);
271 fCylPhi = TMath::ATan2(ftran[1],ftran[0]);
272 if(fCylPhi<0.0) fCylPhi += TMath::Pi();
273 this->MatrixFromSixAngles(rotd);
275 //----------------------------------------------------------------------
276 void AliITSgeomMatrix::AngleFromMatrix(){
277 ////////////////////////////////////////////////////////////////////////
278 // Computes the angles from the rotation matrix up to a phase of 180 degrees.
279 ////////////////////////////////////////////////////////////////////////
281 // get angles from matrix up to a phase of 180 degrees.
283 rx = TMath::ATan2(fm[2][1],fm[2][2]);if(rx<0.0) rx += 2.0*TMath::Pi();
284 ry = TMath::ASin(fm[0][2]); if(ry<0.0) ry += 2.0*TMath::Pi();
285 rz = TMath::ATan2(fm[1][1],fm[0][0]);if(rz<0.0) rz += 2.0*TMath::Pi();
291 //----------------------------------------------------------------------
292 void AliITSgeomMatrix::MatrixFromAngle(){
293 ////////////////////////////////////////////////////////////////////////
294 // Computes the Rotation matrix from the angles [radians] kept in this
296 ////////////////////////////////////////////////////////////////////////
297 Double_t sx,sy,sz,cx,cy,cz;
299 sx = TMath::Sin(frot[0]); cx = TMath::Cos(frot[0]);
300 sy = TMath::Sin(frot[1]); cy = TMath::Cos(frot[1]);
301 sz = TMath::Sin(frot[2]); cz = TMath::Cos(frot[2]);
302 fm[0][0] = cz*cy; // fr[0]
303 fm[0][1] = -cz*sy*sx - sz*cx; // fr[1]
304 fm[0][2] = -cz*sy*cx + sz*sx; // fr[2]
305 fm[1][0] = sz*cy; // fr[3]
306 fm[1][1] = -sz*sy*sx + cz*cx; // fr[4]
307 fm[1][2] = -sz*sy*cx - cz*sx; // fr[5]
308 fm[2][0] = sy; // fr[6]
309 fm[2][1] = cy*sx; // fr[7]
310 fm[2][2] = cy*cx; // fr[8]
313 //----------------------------------------------------------------------
314 void AliITSgeomMatrix::GtoLPosition(const Double_t g0[3],Double_t l[3]){
315 ////////////////////////////////////////////////////////////////////////
316 // Returns the local coordinates given the global coordinates [cm].
317 ////////////////////////////////////////////////////////////////////////
321 for(i=0;i<3;i++) g[i] = g0[i] - ftran[i];
324 for(j=0;j<3;j++) l[i] += fm[i][j]*g[j];
325 // g = R l + translation
329 //----------------------------------------------------------------------
330 void AliITSgeomMatrix::LtoGPosition(const Double_t l[3],Double_t g[3]){
331 ////////////////////////////////////////////////////////////////////////
332 // Returns the global coordinates given the local coordinates [cm].
333 ////////////////////////////////////////////////////////////////////////
338 for(j=0;j<3;j++) g[i] += fm[j][i]*l[j];
340 // g = R^t l + translation
344 //----------------------------------------------------------------------
345 void AliITSgeomMatrix::GtoLMomentum(const Double_t g[3],Double_t l[3]){
346 ////////////////////////////////////////////////////////////////////////
347 // Returns the local coordinates of the momentum given the global
348 // coordinates of the momentum. It transforms just like GtoLPosition
349 // except that the translation vector is zero.
350 ////////////////////////////////////////////////////////////////////////
355 for(j=0;j<3;j++) l[i] += fm[i][j]*g[j];
360 //----------------------------------------------------------------------
361 void AliITSgeomMatrix::LtoGMomentum(const Double_t l[3],Double_t g[3]){
362 ////////////////////////////////////////////////////////////////////////
363 // Returns the Global coordinates of the momentum given the local
364 // coordinates of the momentum. It transforms just like LtoGPosition
365 // except that the translation vector is zero.
366 ////////////////////////////////////////////////////////////////////////
371 for(j=0;j<3;j++) g[i] += fm[j][i]*l[j];
376 //----------------------------------------------------------------------
377 void AliITSgeomMatrix::GtoLPositionError( Double_t g[3][3],
379 ////////////////////////////////////////////////////////////////////////
380 // Given an Uncertainty matrix in Global coordinates it is rotated so that
381 // its representation in local coordinates can be returned. There is no
382 // effect due to the translation vector or its uncertainty.
383 ////////////////////////////////////////////////////////////////////////
386 for(i=0;i<3;i++)for(m=0;m<3;m++){
388 for(j=0;j<3;j++)for(k=0;k<3;k++)
389 l[i][m] += fm[j][i]*g[j][k]*fm[k][m];
394 //----------------------------------------------------------------------
395 void AliITSgeomMatrix::LtoGPositionError( Double_t l[3][3],
397 ////////////////////////////////////////////////////////////////////////
398 // Given an Uncertainty matrix in Local coordinates it is rotated so that
399 // its representation in global coordinates can be returned. There is no
400 // effect due to the translation vector or its uncertainty.
401 ////////////////////////////////////////////////////////////////////////
404 for(i=0;i<3;i++)for(m=0;m<3;m++){
406 for(j=0;j<3;j++)for(k=0;k<3;k++)
407 g[i][m] += fm[i][j]*l[j][k]*fm[m][k];
412 //----------------------------------------------------------------------
413 void AliITSgeomMatrix::GtoLPositionTracking(const Double_t g0[3],
415 ////////////////////////////////////////////////////////////////////////
416 // A slightly different coordinate system is used when tracking.
417 // This coordinate system is only relevant when the geometry represents
418 // the cylindrical ALICE ITS geometry. For tracking the Z axis is left
419 // alone but X -> -Y and Y -> X such that X always points out of the
420 // ITS Cylinder for every layer including layer 1 (where the detector
421 // are mounted upside down).
424 <img src="picts/ITS/AliITSgeomMatrix_T1.gif">
427 ////////////////////////////////////////////////////////////////////////
430 this->GtoLPosition(g0,l0);
431 if(fid[0]==1){ // for layer 1 the detector are flipped upside down
432 // with respect to the others.
443 //----------------------------------------------------------------------
444 void AliITSgeomMatrix::LtoGPositionTracking(const Double_t l[3],
446 ////////////////////////////////////////////////////////////////////////
447 // A slightly different coordinate system is used when tracking.
448 // This coordinate system is only relevant when the geometry represents
449 // the cylindrical ALICE ITS geometry. For tracking the Z axis is left
450 // alone but X -> -Y and Y -> X such that X always points out of the
451 // ITS Cylinder for every layer including layer 1 (where the detector
452 // are mounted upside down).
455 <img src="picts/ITS/AliITSgeomMatrix_T1.gif">
458 ////////////////////////////////////////////////////////////////////////
461 if(fid[0]==1){ // for layer 1 the detector are flipped upside down
462 // with respect to the others.
471 this->LtoGPosition(l0,g);
474 //----------------------------------------------------------------------
475 void AliITSgeomMatrix::GtoLMomentumTracking(const Double_t g[3],
477 ////////////////////////////////////////////////////////////////////////
478 // A slightly different coordinate system is used when tracking.
479 // This coordinate system is only relevant when the geometry represents
480 // the cylindrical ALICE ITS geometry. For tracking the Z axis is left
481 // alone but X -> -Y and Y -> X such that X always points out of the
482 // ITS Cylinder for every layer including layer 1 (where the detector
483 // are mounted upside down).
486 <img src="picts/ITS/AliITSgeomMatrix_T1.gif">
489 ////////////////////////////////////////////////////////////////////////
492 this->GtoLMomentum(g,l0);
493 if(fid[0]==1){ // for layer 1 the detector are flipped upside down
494 // with respect to the others.
505 //----------------------------------------------------------------------
506 void AliITSgeomMatrix::LtoGMomentumTracking(const Double_t l[3],
508 ////////////////////////////////////////////////////////////////////////
509 // A slightly different coordinate system is used when tracking.
510 // This coordinate system is only relevant when the geometry represents
511 // the cylindrical ALICE ITS geometry. For tracking the Z axis is left
512 // alone but X -> -Y and Y -> X such that X always points out of the
513 // ITS Cylinder for every layer including layer 1 (where the detector
514 // are mounted upside down).
517 <img src="picts/ITS/AliITSgeomMatrix_T1.gif">
520 ////////////////////////////////////////////////////////////////////////
523 if(fid[0]==1){ // for layer 1 the detector are flipped upside down
524 // with respect to the others.
533 this->LtoGMomentum(l0,g);
536 //----------------------------------------------------------------------
537 void AliITSgeomMatrix::GtoLPositionErrorTracking( Double_t g[3][3],
539 ////////////////////////////////////////////////////////////////////////
540 // A slightly different coordinate system is used when tracking.
541 // This coordinate system is only relevant when the geometry represents
542 // the cylindrical ALICE ITS geometry. For tracking the Z axis is left
543 // alone but X -> -Y and Y -> X such that X always points out of the
544 // ITS Cylinder for every layer including layer 1 (where the detector
545 // are mounted upside down).
548 <img src="picts/ITS/AliITSgeomMatrix_T1.gif">
551 ////////////////////////////////////////////////////////////////////////
554 Double_t a0[3][3] = {{0.,+1.,0.},{-1.,0.,0.},{0.,0.,+1.}};
555 Double_t a1[3][3] = {{0.,-1.,0.},{+1.,0.,0.},{0.,0.,+1.}};
557 if(fid[0]==1) for(i=0;i<3;i++)for(j=0;j<3;j++)for(k=0;k<3;k++)
558 rt[i][k] = a0[i][j]*fm[j][k];
559 else for(i=0;i<3;i++)for(j=0;j<3;j++)for(k=0;k<3;k++)
560 rt[i][k] = a1[i][j]*fm[j][k];
561 for(i=0;i<3;i++)for(m=0;m<3;m++){
563 for(j=0;j<3;j++)for(k=0;k<3;k++)
564 l[i][m] += rt[j][i]*g[j][k]*rt[k][m];
569 //----------------------------------------------------------------------
570 void AliITSgeomMatrix::LtoGPositionErrorTracking( Double_t l[3][3],
572 ////////////////////////////////////////////////////////////////////////
573 // A slightly different coordinate system is used when tracking.
574 // This coordinate system is only relevant when the geometry represents
575 // the cylindrical ALICE ITS geometry. For tracking the Z axis is left
576 // alone but X -> -Y and Y -> X such that X always points out of the
577 // ITS Cylinder for every layer including layer 1 (where the detector
578 // are mounted upside down).
581 <img src="picts/ITS/AliITSgeomMatrix_T1.gif">
584 ////////////////////////////////////////////////////////////////////////
587 Double_t a0[3][3] = {{0.,+1.,0.},{-1.,0.,0.},{0.,0.,+1.}};
588 Double_t a1[3][3] = {{0.,-1.,0.},{+1.,0.,0.},{0.,0.,+1.}};
590 if(fid[0]==1) for(i=0;i<3;i++)for(j=0;j<3;j++)for(k=0;k<3;k++)
591 rt[i][k] = a0[i][j]*fm[j][k];
592 else for(i=0;i<3;i++)for(j=0;j<3;j++)for(k=0;k<3;k++)
593 rt[i][k] = a1[i][j]*fm[j][k];
594 for(i=0;i<3;i++)for(m=0;m<3;m++){
596 for(j=0;j<3;j++)for(k=0;k<3;k++)
597 g[i][m] += rt[i][j]*l[j][k]*rt[m][k];
602 //----------------------------------------------------------------------
603 void AliITSgeomMatrix::PrintTitles(ostream *os){
604 ////////////////////////////////////////////////////////////////////////
605 // Standard output format for this class but it includes variable
606 // names and formatting that makes it easer to read.
607 ////////////////////////////////////////////////////////////////////////
610 *os << "fDetectorIndex=" << fDetectorIndex << " fid[3]={";
611 for(i=0;i<3;i++) *os << fid[i] << " ";
612 *os << "} frot[3]={";
613 for(i=0;i<3;i++) *os << frot[i] << " ";
614 *os << "} ftran[3]={";
615 for(i=0;i<3;i++) *os << ftran[i] << " ";
616 *os << "} fm[3][3]={";
617 for(i=0;i<3;i++){for(j=0;j<3;j++){ *os << fm[i][j] << " ";} *os <<"}{";}
621 //----------------------------------------------------------------------
622 void AliITSgeomMatrix::PrintComment(ostream *os){
623 ////////////////////////////////////////////////////////////////////////
624 // output format used by Print..
625 ////////////////////////////////////////////////////////////////////////
626 *os << "fDetectorIndex fid[0] fid[1] fid[2] ftran[0] ftran[1] ftran[2] ";
627 *os << "fm[0][0] fm[0][1] fm[0][2] fm[1][0] fm[1][1] fm[1][2] ";
628 *os << "fm[2][0] fm[2][1] fm[2][2] ";
631 //----------------------------------------------------------------------
632 void AliITSgeomMatrix::Print(ostream *os){
633 ////////////////////////////////////////////////////////////////////////
634 // Standard output format for this class.
635 ////////////////////////////////////////////////////////////////////////
644 #if defined __ICC || defined __ECC
651 fmt = os->setf(ios::scientific); // set scientific floating point output
652 *os << fDetectorIndex << " ";
653 for(i=0;i<3;i++) *os << fid[i] << " ";
654 // for(i=0;i<3;i++) *os << frot[i] << " "; // Redundant with fm[][].
655 for(i=0;i<3;i++) *os << setprecision(16) << ftran[i] << " ";
656 for(i=0;i<3;i++)for(j=0;j<3;j++) *os << setprecision(16) <<
659 os->flags(fmt); // reset back to old formating.
662 //----------------------------------------------------------------------
663 void AliITSgeomMatrix::Read(istream *is){
664 ////////////////////////////////////////////////////////////////////////
665 // Standard input format for this class.
666 ////////////////////////////////////////////////////////////////////////
669 *is >> fDetectorIndex;
670 for(i=0;i<3;i++) *is >> fid[i];
671 // for(i=0;i<3;i++) *is >> frot[i]; // Redundant with fm[][].
672 for(i=0;i<3;i++) *is >> ftran[i];
673 for(i=0;i<3;i++)for(j=0;j<3;j++) *is >> fm[i][j];
674 AngleFromMatrix(); // compute angles frot[].
675 fCylR = TMath::Sqrt(ftran[0]*ftran[0]+ftran[1]*ftran[1]);
676 fCylPhi = TMath::ATan2(ftran[1],ftran[0]);
677 if(fCylPhi<0.0) fCylPhi += TMath::Pi();
680 //______________________________________________________________________
681 void AliITSgeomMatrix::Streamer(TBuffer &R__b){
682 // Stream an object of class AliITSgeomMatrix.
684 if (R__b.IsReading()) {
685 AliITSgeomMatrix::Class()->ReadBuffer(R__b, this);
686 fCylR = TMath::Sqrt(ftran[0]*ftran[0]+ftran[1]*ftran[1]);
687 fCylPhi = TMath::ATan2(ftran[1],ftran[0]);
688 this->AngleFromMatrix();
689 if(fCylPhi<0.0) fCylPhi += TMath::Pi();
691 AliITSgeomMatrix::Class()->WriteBuffer(R__b, this);
694 //----------------------------------------------------------------------
695 ostream &operator<<(ostream &os,AliITSgeomMatrix &p){
696 ////////////////////////////////////////////////////////////////////////
697 // Standard output streaming function.
698 ////////////////////////////////////////////////////////////////////////
703 //----------------------------------------------------------------------
704 istream &operator>>(istream &is,AliITSgeomMatrix &r){
705 ////////////////////////////////////////////////////////////////////////
706 // Standard input streaming function.
707 ////////////////////////////////////////////////////////////////////////
712 //----------------------------------------------------------------------