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 Revision 1.8 2001/02/09 00:00:57 nilsen
19 Fixed compatibility problem with HP unix {ios::fmtflags -> Int_t}. Fixed
20 bugs in iostream based streamers used to read and write .det files. Fixed
21 some detector sizes. Fixed bugs in some default-special constructors.
23 Revision 1.7 2001/02/03 00:00:30 nilsen
24 New version of AliITSgeom and related files. Now uses automatic streamers,
25 set up for new formatted .det file which includes detector information.
26 Additional smaller modifications are still to come.
28 Revision 1.5 2000/10/02 16:32:35 barbera
29 Forward declaration added
31 Revision 1.1.2.6 2000/10/02 15:52:05 barbera
32 Forward declaration added
34 Revision 1.4 2000/09/07 17:30:45 nilsen
35 fixed a bug in SixAnglesFromMatrix.
37 Revision 1.3 2000/09/05 14:25:50 nilsen
38 Made fixes for HP compiler. All function parameter default values placed
39 in .h file. Fixed the usual problem with HP comilers and the "for(Int_t i..."
40 business. Replaced casting (Double_t [3][3]) to (Double_t (*)[3]) for HP.
41 Lastly removed all "const" before function parameters which were 2 dim. arrays,
42 because on HP root generates some strange code (?). Thanks Peter for the
45 Revision 1.2 2000/08/29 20:16:50 nilsen
46 New class for ITS coordiante transformations used by AliITSgeom nearly
49 Revision 1.1.2.1 2000/06/04 16:32:31 Nilsen
50 A new class to hold the matrix information needed by AliITSgeom.
59 #include "AliITSgeomMatrix.h"
61 ClassImp(AliITSgeomMatrix)
62 //----------------------------------------------------------------------
63 AliITSgeomMatrix::AliITSgeomMatrix(){
64 ////////////////////////////////////////////////////////////////////////
65 // The Default constructor for the AliITSgeomMatrix class. By Default
66 // the angles of rotations are set to zero, meaning that the rotation
67 // matrix is the unit matrix. The translation vector is also set to zero
68 // as are the module id number. The detector type is set to -1 (an undefined
69 // value). The full rotation matrix is kept so that the evaluation
70 // of a coordinate transformation can be done quickly and with a minimum
71 // of CPU overhead. The basic coordinate systems are the ALICE global
72 // coordinate system and the detector local coordinate system. In general
73 // this structure is not limited to just those two coordinate systems.
76 <img src="picts/ITS/AliISgeomMatrix_L1.gif">
79 ////////////////////////////////////////////////////////////////////////
82 fDetectorIndex = -1; // a value never defined.
85 frot[i] = ftran[i] = 0.0;
86 for(j=0;j<3;j++) fm[i][j] = 0.0;
87 fCylR = fCylPhi = 0.0;
89 fm[0][0] = fm[1][1] = fm[2][2] = 1.0;
91 //----------------------------------------------------------------------
92 AliITSgeomMatrix::AliITSgeomMatrix(const AliITSgeomMatrix &sourse){
93 ////////////////////////////////////////////////////////////////////////
94 // The standard copy constructor. This make a full / proper copy of
96 ////////////////////////////////////////////////////////////////////////
99 this->fDetectorIndex = sourse.fDetectorIndex;
101 this->fid[i] = sourse.fid[i];
102 this->frot[i] = sourse.frot[i];
103 this->ftran[i] = sourse.ftran[i];
104 this->fCylR = sourse.fCylR;
105 this->fCylPhi = sourse.fCylPhi;
106 for(j=0;j<3;j++) this->fm[i][j] = sourse.fm[i][j];
109 //----------------------------------------------------------------------
110 void AliITSgeomMatrix::operator=(const AliITSgeomMatrix &sourse){
111 ////////////////////////////////////////////////////////////////////////
112 // The standard = operator. This make a full / proper copy of
114 ////////////////////////////////////////////////////////////////////////
117 this->fDetectorIndex = sourse.fDetectorIndex;
119 this->fid[i] = sourse.fid[i];
120 this->frot[i] = sourse.frot[i];
121 this->ftran[i] = sourse.ftran[i];
122 this->fCylR = sourse.fCylR;
123 this->fCylPhi = sourse.fCylPhi;
124 for(j=0;j<3;j++) this->fm[i][j] = sourse.fm[i][j];
127 //----------------------------------------------------------------------
128 AliITSgeomMatrix::AliITSgeomMatrix(const Int_t idt,const Int_t id[3],
129 const Double_t rot[3],const Double_t tran[3]){
130 ////////////////////////////////////////////////////////////////////////
131 // This is a constructor for the AliITSgeomMatrix class. The matrix is
132 // defined by 3 standard rotation angles [radians], and the translation
133 // vector tran [cm]. In addition the layer, ladder, and detector number
134 // for this particular module and the type of module must be given.
135 // The full rotation matrix is kept so that the evaluation
136 // of a coordinate transformation can be done quickly and with a minimum
137 // of CPU overhead. The basic coordinate systems are the ALICE global
138 // coordinate system and the detector local coordinate system. In general
139 // this structure is not limited to just those two coordinate systems.
142 <img src="picts/ITS/AliISgeomMatrix_L1.gif">
145 ////////////////////////////////////////////////////////////////////////
148 fDetectorIndex = idt; // a value never defined.
154 fCylR = TMath::Sqrt(ftran[0]*ftran[0]+ftran[1]*ftran[1]);
155 fCylPhi = TMath::ATan2(ftran[1],ftran[0]);
156 if(fCylPhi<0.0) fCylPhi += TMath::Pi();
157 this->MatrixFromAngle();
159 //----------------------------------------------------------------------
160 AliITSgeomMatrix::AliITSgeomMatrix(const Int_t idt, const Int_t id[3],
161 Double_t matrix[3][3],
162 const Double_t tran[3]){
163 ////////////////////////////////////////////////////////////////////////
164 // This is a constructor for the AliITSgeomMatrix class. The rotation matrix
165 // is given as one of the inputs, and the translation vector tran [cm]. In
166 // addition the layer, ladder, and detector number for this particular
167 // module and the type of module must be given. The full rotation matrix
168 // is kept so that the evaluation of a coordinate transformation can be
169 // done quickly and with a minimum of CPU overhead. The basic coordinate
170 // systems are the ALICE global coordinate system and the detector local
171 // coordinate system. In general this structure is not limited to just
172 // those two coordinate systems.
175 <img src="picts/ITS/AliISgeomMatrix_L1.gif">
178 ////////////////////////////////////////////////////////////////////////
181 fDetectorIndex = idt; // a value never defined.
185 for(j=0;j<3;j++) fm[i][j] = matrix[i][j];
187 fCylR = TMath::Sqrt(ftran[0]*ftran[0]+ftran[1]*ftran[1]);
188 fCylPhi = TMath::ATan2(ftran[1],ftran[0]);
189 if(fCylPhi<0.0) fCylPhi += TMath::Pi();
190 this->AngleFromMatrix();
192 //----------------------------------------------------------------------
193 void AliITSgeomMatrix::SixAnglesFromMatrix(Double_t *ang){
194 ////////////////////////////////////////////////////////////////////////
195 // This function returns the 6 GEANT 3.21 rotation angles [degrees] in
196 // the array ang which must be at least [6] long.
197 ////////////////////////////////////////////////////////////////////////
198 Double_t si,c=180./TMath::Pi();
200 ang[1] = TMath::ATan2(fm[0][1],fm[0][0]);
201 if(TMath::Cos(ang[1])!=0.0) si = fm[0][0]/TMath::Cos(ang[1]);
202 else si = fm[0][1]/TMath::Sin(ang[1]);
203 ang[0] = TMath::ATan2(si,fm[0][2]);
205 ang[3] = TMath::ATan2(fm[1][1],fm[1][0]);
206 if(TMath::Cos(ang[3])!=0.0) si = fm[1][0]/TMath::Cos(ang[3]);
207 else si = fm[1][1]/TMath::Sin(ang[3]);
208 ang[2] = TMath::ATan2(si,fm[1][2]);
210 ang[5] = TMath::ATan2(fm[2][1],fm[2][0]);
211 if(TMath::Cos(ang[5])!=0.0) si = fm[2][0]/TMath::Cos(ang[5]);
212 else si = fm[2][1]/TMath::Sin(ang[5]);
213 ang[4] = TMath::ATan2(si,fm[2][2]);
215 for(Int_t i=0;i<6;i++) {ang[i] *= c; if(ang[i]<0.0) ang[i] += 360.;}
217 //----------------------------------------------------------------------
218 void AliITSgeomMatrix::MatrixFromSixAngles(const Double_t *ang){
219 ////////////////////////////////////////////////////////////////////////
220 // Given the 6 GEANT 3.21 rotation angles [degree], this will compute and
221 // set the rotations matrix and 3 standard rotation angles [radians].
222 // These angles and rotation matrix are overwrite the existing values in
224 ////////////////////////////////////////////////////////////////////////
226 Double_t si,lr[9],c=TMath::Pi()/180.;
228 si = TMath::Sin(c*ang[0]);
229 if(ang[0]== 90.0) si = +1.0;
230 if(ang[0]==270.0) si = -1.0;
231 if(ang[0]== 0.0||ang[0]==180.) si = 0.0;
232 lr[0] = si * TMath::Cos(c*ang[1]);
233 lr[1] = si * TMath::Sin(c*ang[1]);
234 lr[2] = TMath::Cos(c*ang[0]);
235 if(ang[0]== 90.0||ang[0]==270.) lr[2] = 0.0;
236 if(ang[0]== 0.0) lr[2] = +1.0;
237 if(ang[0]==180.0) lr[2] = -1.0;
239 si = TMath::Sin(c*ang[2]);
240 if(ang[2]== 90.0) si = +1.0;
241 if(ang[2]==270.0) si = -1.0;
242 if(ang[2]== 0.0||ang[2]==180.) si = 0.0;
243 lr[3] = si * TMath::Cos(c*ang[3]);
244 lr[4] = si * TMath::Sin(c*ang[3]);
245 lr[5] = TMath::Cos(c*ang[2]);
246 if(ang[2]== 90.0||ang[2]==270.) lr[5] = 0.0;
247 if(ang[2]== 0.0) lr[5] = +1.0;
248 if(ang[2]==180.0) lr[5] = -1.0;
250 si = TMath::Sin(c*ang[4]);
251 if(ang[4]== 90.0) si = +1.0;
252 if(ang[4]==270.0) si = -1.0;
253 if(ang[4]== 0.0||ang[4]==180.) si = 0.0;
254 lr[6] = si * TMath::Cos(c*ang[5]);
255 lr[7] = si * TMath::Sin(c*ang[5]);
256 lr[8] = TMath::Cos(c*ang[4]);
257 if(ang[4]== 90.0||ang[4]==270.0) lr[8] = 0.0;
258 if(ang[4]== 0.0) lr[8] = +1.0;
259 if(ang[4]==180.0) lr[8] = -1.0;
260 // Normalize these elements and fill matrix fm.
261 for(i=0;i<3;i++){// reuse si.
263 for(j=0;j<3;j++) si += lr[3*i+j]*lr[3*i+j];
264 si = TMath::Sqrt(1./si);
265 for(j=0;j<3;j++) fm[i][j] = si*lr[3*i+j];
267 this->AngleFromMatrix();
269 //----------------------------------------------------------------------
270 AliITSgeomMatrix::AliITSgeomMatrix(const Double_t rotd[6]/*degrees*/,
271 const Int_t idt,const Int_t id[3],
272 const Double_t tran[3]){
273 ////////////////////////////////////////////////////////////////////////
274 // This is a constructor for the AliITSgeomMatrix class. The matrix is
275 // defined by the 6 GEANT 3.21 rotation angles [degrees], and the translation
276 // vector tran [cm]. In addition the layer, ladder, and detector number
277 // for this particular module and the type of module must be given.
278 // The full rotation matrix is kept so that the evaluation
279 // of a coordinate transformation can be done quickly and with a minimum
280 // of CPU overhead. The basic coordinate systems are the ALICE global
281 // coordinate system and the detector local coordinate system. In general
282 // this structure is not limited to just those two coordinate systems.
285 <img src="picts/ITS/AliISgeomMatrix_L1.gif">
288 ////////////////////////////////////////////////////////////////////////
291 fDetectorIndex = idt; // a value never defined.
296 fCylR = TMath::Sqrt(ftran[0]*ftran[0]+ftran[1]*ftran[1]);
297 fCylPhi = TMath::ATan2(ftran[1],ftran[0]);
298 if(fCylPhi<0.0) fCylPhi += TMath::Pi();
299 this->MatrixFromSixAngles(rotd);
301 //----------------------------------------------------------------------
302 void AliITSgeomMatrix::AngleFromMatrix(){
303 ////////////////////////////////////////////////////////////////////////
304 // Computes the angles from the rotation matrix up to a phase of 180 degrees.
305 ////////////////////////////////////////////////////////////////////////
307 // get angles from matrix up to a phase of 180 degrees.
309 rx = TMath::ATan2(fm[2][1],fm[2][2]);if(rx<0.0) rx += 2.0*TMath::Pi();
310 ry = TMath::ASin(fm[0][2]); if(ry<0.0) ry += 2.0*TMath::Pi();
311 rz = TMath::ATan2(fm[1][1],fm[0][0]);if(rz<0.0) rz += 2.0*TMath::Pi();
317 //----------------------------------------------------------------------
318 void AliITSgeomMatrix::MatrixFromAngle(){
319 ////////////////////////////////////////////////////////////////////////
320 // Computes the Rotation matrix from the angles [radians] kept in this
322 ////////////////////////////////////////////////////////////////////////
323 Double_t sx,sy,sz,cx,cy,cz;
325 sx = TMath::Sin(frot[0]); cx = TMath::Cos(frot[0]);
326 sy = TMath::Sin(frot[1]); cy = TMath::Cos(frot[1]);
327 sz = TMath::Sin(frot[2]); cz = TMath::Cos(frot[2]);
328 fm[0][0] = cz*cy; // fr[0]
329 fm[0][1] = -cz*sy*sx - sz*cx; // fr[1]
330 fm[0][2] = -cz*sy*cx + sz*sx; // fr[2]
331 fm[1][0] = sz*cy; // fr[3]
332 fm[1][1] = -sz*sy*sx + cz*cx; // fr[4]
333 fm[1][2] = -sz*sy*cx - cz*sx; // fr[5]
334 fm[2][0] = sy; // fr[6]
335 fm[2][1] = cy*sx; // fr[7]
336 fm[2][2] = cy*cx; // fr[8]
339 //----------------------------------------------------------------------
340 void AliITSgeomMatrix::GtoLPosition(const Double_t g0[3],Double_t l[3]){
341 ////////////////////////////////////////////////////////////////////////
342 // Returns the local coordinates given the global coordinates [cm].
343 ////////////////////////////////////////////////////////////////////////
347 for(i=0;i<3;i++) g[i] = g0[i] - ftran[i];
350 for(j=0;j<3;j++) l[i] += fm[i][j]*g[j];
351 // g = R l + translation
355 //----------------------------------------------------------------------
356 void AliITSgeomMatrix::LtoGPosition(const Double_t l[3],Double_t g[3]){
357 ////////////////////////////////////////////////////////////////////////
358 // Returns the global coordinates given the local coordinates [cm].
359 ////////////////////////////////////////////////////////////////////////
364 for(j=0;j<3;j++) g[i] += fm[j][i]*l[j];
366 // g = R^t l + translation
370 //----------------------------------------------------------------------
371 void AliITSgeomMatrix::GtoLMomentum(const Double_t g[3],Double_t l[3]){
372 ////////////////////////////////////////////////////////////////////////
373 // Returns the local coordinates of the momentum given the global
374 // coordinates of the momentum. It transforms just like GtoLPosition
375 // except that the translation vector is zero.
376 ////////////////////////////////////////////////////////////////////////
381 for(j=0;j<3;j++) l[i] += fm[i][j]*g[j];
386 //----------------------------------------------------------------------
387 void AliITSgeomMatrix::LtoGMomentum(const Double_t l[3],Double_t g[3]){
388 ////////////////////////////////////////////////////////////////////////
389 // Returns the Global coordinates of the momentum given the local
390 // coordinates of the momentum. It transforms just like LtoGPosition
391 // except that the translation vector is zero.
392 ////////////////////////////////////////////////////////////////////////
397 for(j=0;j<3;j++) g[i] += fm[j][i]*l[j];
402 //----------------------------------------------------------------------
403 void AliITSgeomMatrix::GtoLPositionError(Double_t g[3][3],
405 ////////////////////////////////////////////////////////////////////////
406 // Given an Uncertainty matrix in Global coordinates it is rotated so that
407 // its representation in local coordinates can be returned. There is no
408 // effect due to the translation vector or its uncertainty.
409 ////////////////////////////////////////////////////////////////////////
412 for(i=0;i<3;i++)for(j=0;j<3;j++)for(k=0;k<3;k++)for(m=0;m<3;m++)
413 l[i][m] = fm[j][i]*g[j][k]*fm[k][m];
417 //----------------------------------------------------------------------
418 void AliITSgeomMatrix::LtoGPositionError(Double_t l[3][3],
420 ////////////////////////////////////////////////////////////////////////
421 // Given an Uncertainty matrix in Local coordinates it is rotated so that
422 // its representation in global coordinates can be returned. There is no
423 // effect due to the translation vector or its uncertainty.
424 ////////////////////////////////////////////////////////////////////////
427 for(i=0;i<3;i++)for(j=0;j<3;j++)for(k=0;k<3;k++)for(m=0;m<3;m++)
428 g[i][m] = fm[i][j]*l[j][k]*fm[m][k];
432 //----------------------------------------------------------------------
433 void AliITSgeomMatrix::GtoLPositionTracking(const Double_t g0[3],
435 ////////////////////////////////////////////////////////////////////////
436 // A slightly different coordinate system is used when tracking.
437 // This coordinate system is only relevant when the geometry represents
438 // the cylindrical ALICE ITS geometry. For tracking the Z axis is left
439 // alone but X -> -Y and Y -> X such that X always points out of the
440 // ITS Cylinder for every layer including layer 1 (where the detector
441 // are mounted upside down).
444 <img src="picts/ITS/AliITSgeomMatrix_T1.gif">
447 ////////////////////////////////////////////////////////////////////////
450 this->GtoLPosition(g0,l0);
451 if(fid[0]==1){ // for layer 1 the detector are flipped upside down
452 // with respect to the others.
463 //----------------------------------------------------------------------
464 void AliITSgeomMatrix::LtoGPositionTracking(const Double_t l[3],
466 ////////////////////////////////////////////////////////////////////////
467 // A slightly different coordinate system is used when tracking.
468 // This coordinate system is only relevant when the geometry represents
469 // the cylindrical ALICE ITS geometry. For tracking the Z axis is left
470 // alone but X -> -Y and Y -> X such that X always points out of the
471 // ITS Cylinder for every layer including layer 1 (where the detector
472 // are mounted upside down).
475 <img src="picts/ITS/AliITSgeomMatrix_T1.gif">
478 ////////////////////////////////////////////////////////////////////////
481 if(fid[0]==1){ // for layer 1 the detector are flipped upside down
482 // with respect to the others.
491 this->LtoGPosition(l0,g);
494 //----------------------------------------------------------------------
495 void AliITSgeomMatrix::GtoLMomentumTracking(const Double_t g[3],
497 ////////////////////////////////////////////////////////////////////////
498 // A slightly different coordinate system is used when tracking.
499 // This coordinate system is only relevant when the geometry represents
500 // the cylindrical ALICE ITS geometry. For tracking the Z axis is left
501 // alone but X -> -Y and Y -> X such that X always points out of the
502 // ITS Cylinder for every layer including layer 1 (where the detector
503 // are mounted upside down).
506 <img src="picts/ITS/AliITSgeomMatrix_T1.gif">
509 ////////////////////////////////////////////////////////////////////////
512 this->GtoLMomentum(g,l0);
513 if(fid[0]==1){ // for layer 1 the detector are flipped upside down
514 // with respect to the others.
526 //----------------------------------------------------------------------
527 void AliITSgeomMatrix::LtoGMomentumTracking(const Double_t l[3],
529 ////////////////////////////////////////////////////////////////////////
530 // A slightly different coordinate system is used when tracking.
531 // This coordinate system is only relevant when the geometry represents
532 // the cylindrical ALICE ITS geometry. For tracking the Z axis is left
533 // alone but X -> -Y and Y -> X such that X always points out of the
534 // ITS Cylinder for every layer including layer 1 (where the detector
535 // are mounted upside down).
538 <img src="picts/ITS/AliITSgeomMatrix_T1.gif">
541 ////////////////////////////////////////////////////////////////////////
544 if(fid[0]==1){ // for layer 1 the detector are flipped upside down
545 // with respect to the others.
554 this->LtoGMomentum(l0,g);
557 //----------------------------------------------------------------------
558 void AliITSgeomMatrix::GtoLPositionErrorTracking(Double_t g[3][3],
560 ////////////////////////////////////////////////////////////////////////
561 // A slightly different coordinate system is used when tracking.
562 // This coordinate system is only relevant when the geometry represents
563 // the cylindrical ALICE ITS geometry. For tracking the Z axis is left
564 // alone but X -> -Y and Y -> X such that X always points out of the
565 // ITS Cylinder for every layer including layer 1 (where the detector
566 // are mounted upside down).
569 <img src="picts/ITS/AliITSgeomMatrix_T1.gif">
572 ////////////////////////////////////////////////////////////////////////
575 Double_t A0[3][3] = {{0.,+1.,0.},{-1.,0.,0.},{0.,0.,+1.}};
576 Double_t A1[3][3] = {{0.,-1.,0.},{+1.,0.,0.},{0.,0.,+1.}};
578 if(fid[0]==1) for(i=0;i<3;i++)for(j=0;j<3;j++)for(k=0;k<3;k++)
579 Rt[i][k] = A0[i][j]*fm[j][k];
580 else for(i=0;i<3;i++)for(j=0;j<3;j++)for(k=0;k<3;k++)
581 Rt[i][k] = A1[i][j]*fm[j][k];
582 for(i=0;i<3;i++)for(j=0;j<3;j++)for(k=0;k<3;k++)for(m=0;m<3;m++)
583 l[i][m] = Rt[j][i]*g[j][k]*Rt[k][m];
587 //----------------------------------------------------------------------
588 void AliITSgeomMatrix::LtoGPositionErrorTracking(Double_t l[3][3],
590 ////////////////////////////////////////////////////////////////////////
591 // A slightly different coordinate system is used when tracking.
592 // This coordinate system is only relevant when the geometry represents
593 // the cylindrical ALICE ITS geometry. For tracking the Z axis is left
594 // alone but X -> -Y and Y -> X such that X always points out of the
595 // ITS Cylinder for every layer including layer 1 (where the detector
596 // are mounted upside down).
599 <img src="picts/ITS/AliITSgeomMatrix_T1.gif">
602 ////////////////////////////////////////////////////////////////////////
605 Double_t A0[3][3] = {{0.,+1.,0.},{-1.,0.,0.},{0.,0.,+1.}};
606 Double_t A1[3][3] = {{0.,-1.,0.},{+1.,0.,0.},{0.,0.,+1.}};
608 if(fid[0]==1) for(i=0;i<3;i++)for(j=0;j<3;j++)for(k=0;k<3;k++)
609 Rt[i][k] = A0[i][j]*fm[j][k];
610 else for(i=0;i<3;i++)for(j=0;j<3;j++)for(k=0;k<3;k++)
611 Rt[i][k] = A1[i][j]*fm[j][k];
612 for(i=0;i<3;i++)for(j=0;j<3;j++)for(k=0;k<3;k++)for(m=0;m<3;m++)
613 g[i][m] = Rt[i][j]*l[j][k]*Rt[m][k];
617 //----------------------------------------------------------------------
618 void AliITSgeomMatrix::PrintTitles(ostream *os){
619 ////////////////////////////////////////////////////////////////////////
620 // Standard output format for this class but it includes variable
621 // names and formatting that makes it easer to read.
622 ////////////////////////////////////////////////////////////////////////
625 *os << "fDetectorIndex=" << fDetectorIndex << " fid[3]={";
626 for(i=0;i<3;i++) *os << fid[i] << " ";
627 *os << "} frot[3]={";
628 for(i=0;i<3;i++) *os << frot[i] << " ";
629 *os << "} ftran[3]={";
630 for(i=0;i<3;i++) *os << ftran[i] << " ";
631 *os << "} fm[3][3]={";
632 for(i=0;i<3;i++){for(j=0;j<3;j++){ *os << fm[i][j] << " ";} *os <<"}{";}
636 //----------------------------------------------------------------------
637 void AliITSgeomMatrix::PrintComment(ostream *os){
638 ////////////////////////////////////////////////////////////////////////
639 // output format used by Print..
640 ////////////////////////////////////////////////////////////////////////
641 *os << "fDetectorIndex fid[0] fid[1] fid[2] ftran[0] ftran[1] ftran[2] ";
642 *os << "fm[0][0] fm[0][1] fm[0][2] fm[1][0] fm[1][1] fm[1][2] ";
643 *os << "fm[2][0] fm[2][1] fm[2][2] ";
646 //----------------------------------------------------------------------
647 void AliITSgeomMatrix::Print(ostream *os){
648 ////////////////////////////////////////////////////////////////////////
649 // Standard output format for this class.
650 ////////////////////////////////////////////////////////////////////////
654 fmt = os->setf(ios::scientific); // set scientific floating point output
655 *os << fDetectorIndex << " ";
656 for(i=0;i<3;i++) *os << fid[i] << " ";
657 // for(i=0;i<3;i++) *os << frot[i] << " "; // Redundant with fm[][].
658 for(i=0;i<3;i++) *os << setprecision(16) << ftran[i] << " ";
659 for(i=0;i<3;i++)for(j=0;j<3;j++) *os << setprecision(16) <<
662 os->flags(fmt); // reset back to old formating.
665 //----------------------------------------------------------------------
666 void AliITSgeomMatrix::Read(istream *is){
667 ////////////////////////////////////////////////////////////////////////
668 // Standard input format for this class.
669 ////////////////////////////////////////////////////////////////////////
672 *is >> fDetectorIndex;
673 for(i=0;i<3;i++) *is >> fid[i];
674 // for(i=0;i<3;i++) *is >> frot[i]; // Redundant with fm[][].
675 for(i=0;i<3;i++) *is >> ftran[i];
676 for(i=0;i<3;i++)for(j=0;j<3;j++) *is >> fm[i][j];
677 AngleFromMatrix(); // compute angles frot[].
678 fCylR = TMath::Sqrt(ftran[0]*ftran[0]+ftran[1]*ftran[1]);
679 fCylPhi = TMath::ATan2(ftran[1],ftran[0]);
680 if(fCylPhi<0.0) fCylPhi += TMath::Pi();
683 //______________________________________________________________________
684 void AliITSgeomMatrix::Streamer(TBuffer &R__b){
685 // Stream an object of class AliITSgeomMatrix.
687 if (R__b.IsReading()) {
688 AliITSgeomMatrix::Class()->ReadBuffer(R__b, this);
689 fCylR = TMath::Sqrt(ftran[0]*ftran[0]+ftran[1]*ftran[1]);
690 fCylPhi = TMath::ATan2(ftran[1],ftran[0]);
691 this->AngleFromMatrix();
692 if(fCylPhi<0.0) fCylPhi += TMath::Pi();
694 AliITSgeomMatrix::Class()->WriteBuffer(R__b, this);
697 //----------------------------------------------------------------------
698 ostream &operator<<(ostream &os,AliITSgeomMatrix &p){
699 ////////////////////////////////////////////////////////////////////////
700 // Standard output streaming function.
701 ////////////////////////////////////////////////////////////////////////
706 //----------------------------------------------------------------------
707 istream &operator>>(istream &is,AliITSgeomMatrix &r){
708 ////////////////////////////////////////////////////////////////////////
709 // Standard input streaming function.
710 ////////////////////////////////////////////////////////////////////////
715 //----------------------------------------------------------------------