]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSgeomMatrix.h
Fixed bug with HP and no unget in iostream.h. Now using putback instead.
[u/mrichter/AliRoot.git] / ITS / AliITSgeomMatrix.h
CommitLineData
df5240ea 1#ifndef ALIITSGEOMMATRIX_H
2#define ALIITSGEOMMATRIX_H
3/* Copyright(c) 2000, ALICE Experiment at CERN, All rights reserved. *
4 * see cxx source for full Copyright notice. */
5/* $Id: */
6////////////////////////////////////////////////////////////////////////
7// ITS geometry manipulation routines on the module level. This class is
8// to replace the structure ITS_geom in the class AliITSgeom.
9// Created May 30 2000.
10// version 0.0.0
11// By Bjorn S. Nilsen
12////////////////////////////////////////////////////////////////////////
13
8253cd9a 14class AliITSgeomMatrix : public TObject {
df5240ea 15 public:
16 AliITSgeomMatrix(); // Default constructor
17 AliITSgeomMatrix(const Int_t idt,const Int_t id[3],
18 const Double_t rot[3],const Double_t tran[3]);
19 AliITSgeomMatrix(const Int_t idt,const Int_t id[3],
d962cab4 20 Double_t matrix[3][3],const Double_t tran[3]);
df5240ea 21 AliITSgeomMatrix(const Double_t rotd[6]/*degrees Geant angles*/,
22 const Int_t idt,const Int_t id[3],
23 const Double_t tran[3]);
24 AliITSgeomMatrix(const AliITSgeomMatrix &source);
25 void operator=(const AliITSgeomMatrix &sourse); // copy
26 virtual ~AliITSgeomMatrix(){};
8253cd9a 27 void PrintComment(ostream *os);
28 void Print(ostream *os);
df5240ea 29 void PrintTitles(ostream *os);
8253cd9a 30 void Read(istream *is);
df5240ea 31
32 void SetAngles(const Double_t rot[3]){// [radians]
33 for(Int_t i=0;i<3;i++)frot[i] = rot[i];this->MatrixFromAngle();}
34 void SetTranslation(const Double_t tran[3]){
35 for(Int_t i=0;i<3;i++) ftran[i] = tran[i];}
d962cab4 36 void SetMatrix(Double_t matrix[3][3]){ for(Int_t i=0;i<3;i++)
df5240ea 37 for(Int_t j=0;j<3;j++) fm[i][j]=matrix[i][j];this->AngleFromMatrix();}
38 void SetDetectorIndex(const Int_t idt) {fDetectorIndex = idt;}
39 void SetIndex(const Int_t id[3]){
40 for(Int_t i=0;i<3;i++) fid[i] = id[i];}
41 void GetAngles(Double_t rot[3]){// [radians]
42 for(Int_t i=0;i<3;i++) rot[i] = frot[i];}
43 void GetTranslation(Double_t tran[3]){
44 for(Int_t i=0;i<3;i++) tran[i] = ftran[i];}
45 void GetMatrix(Double_t matrix[3][3]){for(Int_t i=0;i<3;i++)
46 for(Int_t j=0;j<3;j++) matrix[i][j] = fm[i][j];}
47 Int_t GetDetectorIndex() {return fDetectorIndex;}
48 void GetIndex(Int_t id[3]){for(Int_t i=0;i<3;i++) id[i] = fid[i];}
49 void MatrixFromSixAngles(const Double_t *ang);
50 void SixAnglesFromMatrix(Double_t *ang);
51
52 void GtoLPosition(const Double_t g[3],Double_t l[3]);
53 void LtoGPosition(const Double_t l[3],Double_t g[3]);
54 void GtoLMomentum(const Double_t g[3],Double_t l[3]);
55 void LtoGMomentum(const Double_t l[3],Double_t g[3]);
d962cab4 56 void GtoLPositionError(Double_t g[3][3],Double_t l[3][3]);
57 void LtoGPositionError(Double_t l[3][3],Double_t g[3][3]);
df5240ea 58 // Tracking Related Routines
59 void GtoLPositionTracking(const Double_t g[3],Double_t l[3]);
60 void LtoGPositionTracking(const Double_t l[3],Double_t g[3]);
61 void GtoLMomentumTracking(const Double_t g[3],Double_t l[3]);
62 void LtoGMomentumTracking(const Double_t l[3],Double_t g[3]);
d962cab4 63 void GtoLPositionErrorTracking(Double_t g[3][3],
df5240ea 64 Double_t l[3][3]);
d962cab4 65 void LtoGPositionErrorTracking(Double_t l[3][3],
df5240ea 66 Double_t g[3][3]);
67 Double_t Distance2(const Double_t t[3]){Double_t d=0.0,q;
68 for(Int_t i=0;i<3;i++){q = t[i]-ftran[i]; d += q*q;}
69 return d;}
70 private: // private functions
71 void MatrixFromAngle();
72 void AngleFromMatrix();
73 private: // Data members.
74 Int_t fDetectorIndex; // Detector type index (like fShapeIndex was)
75 Int_t fid[3]; // layer, ladder, detector numbers.
8253cd9a 76 Double_t frot[3]; //! vector of rotations about x,y,z [radians].
df5240ea 77 Double_t ftran[3]; // Translation vector of module x,y,z.
78 Double_t fm[3][3]; // Rotation matrix based on frot.
79
80 ClassDef(AliITSgeomMatrix,1) // Matrix class used by AliITSgeom.
81};
82// Input and output function for standard C++ input/output.
83ostream &operator<<(ostream &os,AliITSgeomMatrix &source);
84istream &operator>>(istream &os,AliITSgeomMatrix &source);
85
86#endif