]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSgeomMatrix.h
Trigger board object base class
[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
85f1e34a 14#include <TObject.h>
15
8253cd9a 16class AliITSgeomMatrix : public TObject {
df5240ea 17 public:
18 AliITSgeomMatrix(); // Default constructor
85f1e34a 19 // Standard constructor #1
6ba216a4 20 AliITSgeomMatrix(Int_t idt,const Int_t id[3],
df5240ea 21 const Double_t rot[3],const Double_t tran[3]);
85f1e34a 22 // Standard constructor #2
6ba216a4 23 AliITSgeomMatrix(Int_t idt,const Int_t id[3],
d962cab4 24 Double_t matrix[3][3],const Double_t tran[3]);
85f1e34a 25 // Standard constructor #3
26 AliITSgeomMatrix(const Double_t rotd[6]/*degrees GEANT angles*/,
6ba216a4 27 Int_t idt,const Int_t id[3],
df5240ea 28 const Double_t tran[3]);
85f1e34a 29 // Copy operator
df5240ea 30 AliITSgeomMatrix(const AliITSgeomMatrix &source);
85f1e34a 31 // Alignment operator
df5240ea 32 void operator=(const AliITSgeomMatrix &sourse); // copy
85f1e34a 33 virtual ~AliITSgeomMatrix(){}; // default constructor.
34 // Prints a line describing the output format of the function Print.
024a4246 35 void PrintComment(ostream *os) const;
85f1e34a 36 // Prints out the content of this class in ASCII format.
8253cd9a 37 void Print(ostream *os);
85f1e34a 38 // Prints out the content of this class in ASCII format but includes
39 // formating and strings that make it more humanly readable.
024a4246 40 void PrintTitles(ostream *os) const;
85f1e34a 41 // Reads in the content of this class in the format of Print
8253cd9a 42 void Read(istream *is);
d2f55a22 43 virtual void Print(Option_t *option="") const {TObject::Print(option);}
44 virtual Int_t Read(const char *name) {return TObject::Read(name);}
df5240ea 45
85f1e34a 46 // Given the rotation angles [radians] it fills frot and computes
47 // the rotation matrix fm.
df5240ea 48 void SetAngles(const Double_t rot[3]){// [radians]
49 for(Int_t i=0;i<3;i++)frot[i] = rot[i];this->MatrixFromAngle();}
85f1e34a 50 // Sets the translation vector and computes fCylR and fCylPhi.
024a4246 51 void SetTranslation(const Double_t tran[3]);
85f1e34a 52 // sets the rotation matrix and computes the rotation angles [radians]
d962cab4 53 void SetMatrix(Double_t matrix[3][3]){ for(Int_t i=0;i<3;i++)
df5240ea 54 for(Int_t j=0;j<3;j++) fm[i][j]=matrix[i][j];this->AngleFromMatrix();}
85f1e34a 55 // Sets the detector index value
6ba216a4 56 void SetDetectorIndex(Int_t idt) {fDetectorIndex = idt;}
85f1e34a 57 // Sets the detector layer, ladder, detector (id) values.
df5240ea 58 void SetIndex(const Int_t id[3]){
59 for(Int_t i=0;i<3;i++) fid[i] = id[i];}
85f1e34a 60 // Returns the rotation angles [radians]
024a4246 61 void GetAngles(Double_t rot[3]) const {// [radians]
df5240ea 62 for(Int_t i=0;i<3;i++) rot[i] = frot[i];}
85f1e34a 63 // Returns the translation vector [cm]
024a4246 64 void GetTranslation(Double_t tran[3]) const {
df5240ea 65 for(Int_t i=0;i<3;i++) tran[i] = ftran[i];}
85f1e34a 66 // Returns the translation vector in cylindrical
67 // coordinates [cm,radians]
024a4246 68 void GetTranslationCylinderical (Double_t tran[3]) const {
d8cc8493 69 tran[0] = fCylR;
70 tran[1] = fCylPhi;
71 tran[2] = ftran[2];}
85f1e34a 72 // Returns the values of the rotation matrix
024a4246 73 void GetMatrix(Double_t matrix[3][3]) const {for(Int_t i=0;i<3;i++)
df5240ea 74 for(Int_t j=0;j<3;j++) matrix[i][j] = fm[i][j];}
85f1e34a 75 // Returns the detector index value.
76 Int_t GetDetectorIndex() const {return fDetectorIndex;}
77 // returns the modules index layer, ladder, detector
024a4246 78 void GetIndex(Int_t id[3]) const {for(Int_t i=0;i<3;i++) id[i] = fid[i];}
85f1e34a 79 // Sets the rotation matrix based on the 6 GEANT rotation
80 // angles [radian]
df5240ea 81 void MatrixFromSixAngles(const Double_t *ang);
85f1e34a 82 // Returns the 6 GEANT rotation angles [radians] from the
83 // existing rotation matrix.
df5240ea 84 void SixAnglesFromMatrix(Double_t *ang);
85
85f1e34a 86 // Given a position in Cartesian ALICE global coordinates [cm]
87 // returns the position in Cartesian detector/module local
88 //coordinates [cm]
024a4246 89 void GtoLPosition(const Double_t g[3],Double_t l[3]) const;
85f1e34a 90 // Given a position in Cartesian detector/module local coordinates [cm]
91 // returns the position in Cartesian ALICE global
92 //coordinates [cm]
024a4246 93 void LtoGPosition(const Double_t l[3],Double_t g[3]) const;
85f1e34a 94 // Given a momentum in Cartesian ALICE global coordinates
95 // returns the momentum in Cartesian detector/module local
96 //coordinates
024a4246 97 void GtoLMomentum(const Double_t g[3],Double_t l[3]) const;
85f1e34a 98 // Given a momentum in Cartesian detector/module local coordinates
99 // returns the momentum in Cartesian ALICE global coordinates
024a4246 100 void LtoGMomentum(const Double_t l[3],Double_t g[3]) const;
85f1e34a 101 // given a position error matrix in ALICE Cartesian global
102 // coordinates [cm] returns a position error matrix in detector/
103 // module local Cartesian local coordinates [cm]
024a4246 104 void GtoLPositionError(Double_t g[3][3],Double_t l[3][3]) const;
85f1e34a 105 // given a position error matrix in detector/module Cartesian local
106 // coordinates [cm] returns a position error matrix in ALICE
107 // Cartesian global coordinates [cm]
024a4246 108 void LtoGPositionError(Double_t l[3][3],Double_t g[3][3]) const;
df5240ea 109 // Tracking Related Routines
024a4246 110 void GtoLPositionTracking(const Double_t g[3],Double_t l[3]) const;
85f1e34a 111 // Given a position in Cartesian Tracking global coordinates [cm]
112 // returns the position in Cartesian detector/module local
113 // coordinates [cm]
024a4246 114 void LtoGPositionTracking(const Double_t l[3],Double_t g[3]) const;
85f1e34a 115 // Given a position in Cartesian detector/module local coordinates [cm]
116 // returns the position in Cartesian Tracking global
117 //coordinates [cm]
024a4246 118 void GtoLMomentumTracking(const Double_t g[3],Double_t l[3]) const;
85f1e34a 119 // Given a momentum in Cartesian detector/module local coordinates
120 // returns the momentum in Cartesian Tracking global coordinates
024a4246 121 void LtoGMomentumTracking(const Double_t l[3],Double_t g[3]) const;
85f1e34a 122 // given a position error matrix in Tracking Cartesian global
123 // coordinates [cm] returns a position error matrix in detector/
124 // module local Cartesian local coordinates [cm]
8d5bd3f9 125 void GtoLPositionErrorTracking(Double_t g[3][3],
024a4246 126 Double_t l[3][3]) const;
85f1e34a 127 // given a position error matrix in detector/module Cartesian local
128 // coordinates [cm] returns a position error matrix in Tracking
129 // Cartesian global coordinates [cm]
8d5bd3f9 130 void LtoGPositionErrorTracking(Double_t l[3][3],
024a4246 131 Double_t g[3][3]) const;
85f1e34a 132 // Computes the distance squared [cm^2] between a point t[3] and
133 // this module/detector
024a4246 134 Double_t Distance2(const Double_t t[3]) const {Double_t d=0.0,q;
df5240ea 135 for(Int_t i=0;i<3;i++){q = t[i]-ftran[i]; d += q*q;}
136 return d;}
137 private: // private functions
85f1e34a 138 // Given the rotation matrix fm it fills the rotation angles frot
df5240ea 139 void MatrixFromAngle();
85f1e34a 140 // Given the rotation angles frot it fills the rotation matrix fm
df5240ea 141 void AngleFromMatrix();
142 private: // Data members.
143 Int_t fDetectorIndex; // Detector type index (like fShapeIndex was)
144 Int_t fid[3]; // layer, ladder, detector numbers.
8253cd9a 145 Double_t frot[3]; //! vector of rotations about x,y,z [radians].
df5240ea 146 Double_t ftran[3]; // Translation vector of module x,y,z.
85f1e34a 147 Double_t fCylR,fCylPhi; //! Translation vector in Cylindrical coord.
df5240ea 148 Double_t fm[3][3]; // Rotation matrix based on frot.
149
d8cc8493 150 // Note, fCylR and fCylPhi are added as data members because it costs
151 // about a factor of 10 to compute them over looking them up. Since
152 // they are used in some tracking algorithms this can be a large cost
153 // in computing time. They are not written out but computed.
154
df5240ea 155 ClassDef(AliITSgeomMatrix,1) // Matrix class used by AliITSgeom.
156};
157// Input and output function for standard C++ input/output.
158ostream &operator<<(ostream &os,AliITSgeomMatrix &source);
159istream &operator>>(istream &os,AliITSgeomMatrix &source);
160
161#endif