]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSgeomMatrix.h
Corrections for memory leaks, random numbers, hit number; also some data members...
[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]){
d8cc8493 35 for(Int_t i=0;i<3;i++) ftran[i] = tran[i];
36 fCylR = TMath::Sqrt(ftran[0]*ftran[0]+
37 ftran[1]*ftran[1]);
38 fCylPhi = TMath::ATan2(ftran[1],ftran[0]);
39 if(fCylPhi<0.0) fCylPhi += TMath::Pi();}
d962cab4 40 void SetMatrix(Double_t matrix[3][3]){ for(Int_t i=0;i<3;i++)
df5240ea 41 for(Int_t j=0;j<3;j++) fm[i][j]=matrix[i][j];this->AngleFromMatrix();}
42 void SetDetectorIndex(const Int_t idt) {fDetectorIndex = idt;}
43 void SetIndex(const Int_t id[3]){
44 for(Int_t i=0;i<3;i++) fid[i] = id[i];}
45 void GetAngles(Double_t rot[3]){// [radians]
46 for(Int_t i=0;i<3;i++) rot[i] = frot[i];}
47 void GetTranslation(Double_t tran[3]){
48 for(Int_t i=0;i<3;i++) tran[i] = ftran[i];}
d8cc8493 49 void GetTranslationCylinderical(Double_t tran[3]){
50 tran[0] = fCylR;
51 tran[1] = fCylPhi;
52 tran[2] = ftran[2];}
df5240ea 53 void GetMatrix(Double_t matrix[3][3]){for(Int_t i=0;i<3;i++)
54 for(Int_t j=0;j<3;j++) matrix[i][j] = fm[i][j];}
55 Int_t GetDetectorIndex() {return fDetectorIndex;}
56 void GetIndex(Int_t id[3]){for(Int_t i=0;i<3;i++) id[i] = fid[i];}
57 void MatrixFromSixAngles(const Double_t *ang);
58 void SixAnglesFromMatrix(Double_t *ang);
59
60 void GtoLPosition(const Double_t g[3],Double_t l[3]);
61 void LtoGPosition(const Double_t l[3],Double_t g[3]);
62 void GtoLMomentum(const Double_t g[3],Double_t l[3]);
63 void LtoGMomentum(const Double_t l[3],Double_t g[3]);
d962cab4 64 void GtoLPositionError(Double_t g[3][3],Double_t l[3][3]);
65 void LtoGPositionError(Double_t l[3][3],Double_t g[3][3]);
df5240ea 66 // Tracking Related Routines
67 void GtoLPositionTracking(const Double_t g[3],Double_t l[3]);
68 void LtoGPositionTracking(const Double_t l[3],Double_t g[3]);
69 void GtoLMomentumTracking(const Double_t g[3],Double_t l[3]);
70 void LtoGMomentumTracking(const Double_t l[3],Double_t g[3]);
d962cab4 71 void GtoLPositionErrorTracking(Double_t g[3][3],
df5240ea 72 Double_t l[3][3]);
d962cab4 73 void LtoGPositionErrorTracking(Double_t l[3][3],
df5240ea 74 Double_t g[3][3]);
75 Double_t Distance2(const Double_t t[3]){Double_t d=0.0,q;
76 for(Int_t i=0;i<3;i++){q = t[i]-ftran[i]; d += q*q;}
77 return d;}
78 private: // private functions
79 void MatrixFromAngle();
80 void AngleFromMatrix();
81 private: // Data members.
82 Int_t fDetectorIndex; // Detector type index (like fShapeIndex was)
83 Int_t fid[3]; // layer, ladder, detector numbers.
8253cd9a 84 Double_t frot[3]; //! vector of rotations about x,y,z [radians].
df5240ea 85 Double_t ftran[3]; // Translation vector of module x,y,z.
d8cc8493 86 Double_t fCylR,fCylPhi; //! Translation vector in Cylinderical coord.
df5240ea 87 Double_t fm[3][3]; // Rotation matrix based on frot.
88
d8cc8493 89 // Note, fCylR and fCylPhi are added as data members because it costs
90 // about a factor of 10 to compute them over looking them up. Since
91 // they are used in some tracking algorithms this can be a large cost
92 // in computing time. They are not written out but computed.
93
df5240ea 94 ClassDef(AliITSgeomMatrix,1) // Matrix class used by AliITSgeom.
95};
96// Input and output function for standard C++ input/output.
97ostream &operator<<(ostream &os,AliITSgeomMatrix &source);
98istream &operator>>(istream &os,AliITSgeomMatrix &source);
99
100#endif