Transformations for rotated geometry of st345 (Gines)
[u/mrichter/AliRoot.git] / STEER / AliAlignObj.h
CommitLineData
c18195b9 1#ifndef ALIALIGNOBJ_H
2#define ALIALIGNOBJ_H
3
fdf65bb5 4//************************************************************************
5// AliAlignObj: alignment base class for the storage of alignment *
6// information for a single volume, that is a translation, a rotation *
7// and a the identity of the volume itself in form of a TGeo path and *
8// as a unique integer identifier *
befe2c08 9//************************************************************************
c18195b9 10#include "TObject.h"
11#include "TString.h"
12#include "TGeoMatrix.h"
13
03b18860 14class AliTrackPoint;
15class AliTrackPointArray;
16
c18195b9 17class AliAlignObj : public TObject {
18
19 public:
20
21 AliAlignObj();
22 AliAlignObj(const AliAlignObj& theAlignObj);
23 AliAlignObj& operator= (const AliAlignObj& theAlignObj);
24 virtual ~AliAlignObj();
877c3816 25 enum ELayerID{kInvalidLayer=0,
26 kFirstLayer=1,
98937d93 27 kSPD1=1, kSPD2=2,
befe2c08 28 kSDD1=3, kSDD2=4,
29 kSSD1=5, kSSD2=6,
30 kTPC1=7, kTPC2=8,
31 kTRD1=9, kTRD2=10, kTRD3=11, kTRD4=12, kTRD5=13, kTRD6=14,
32 kTOF=15,
33 kPHOS1=16, kPHOS2=17,
34 kRICH=18,
98937d93 35 kMUON=19,
36 kLastLayer=20};
c18195b9 37
38 //Setters
39 virtual void SetTranslation(Double_t x, Double_t y, Double_t z) = 0;
40 virtual void SetTranslation(const TGeoMatrix& m) = 0;
41 virtual void SetRotation(Double_t psi, Double_t theta, Double_t phi) = 0;
42 virtual Bool_t SetRotation(const TGeoMatrix& m) = 0;
43 virtual void SetPars(Double_t x, Double_t y, Double_t z, Double_t psi,
44 Double_t theta, Double_t phi) = 0;
45 virtual void SetMatrix(const TGeoMatrix& m) = 0;
46 void SetVolPath(const TString& volpath) {fVolPath=volpath;}
cab6c0d0 47 void SetVolUID(UShort_t voluid) {fVolUID=voluid;}
befe2c08 48 void SetVolUID(ELayerID layerId, Int_t modId);
c18195b9 49
50 //Getters
51 const char *GetVolPath() const {return fVolPath.Data();}
52 UShort_t GetVolUID() const {return fVolUID;}
befe2c08 53 void GetVolUID(ELayerID &layerId, Int_t &modId) const;
c18195b9 54 virtual void GetTranslation(Double_t* tr) const=0;
55 virtual Bool_t GetAngles(Double_t* angles) const=0;
56 virtual void GetPars(Double_t transl[], Double_t rot[]) const=0;
57 virtual void GetMatrix(TGeoHMatrix& m) const=0;
58
03b18860 59 virtual AliAlignObj& Inverse() const=0;
60
61 void Transform(AliTrackPoint &p) const;
62 void Transform(AliTrackPointArray &array) const;
63
c18195b9 64 void Print(Option_t *) const;
65
98937d93 66 static Int_t LayerSize(Int_t layer) { return fgLayerSize[layer]; }
67 static const char* LayerName(Int_t layer) { return fgLayerName[layer]; }
68
befe2c08 69 static UShort_t LayerToVolUID(ELayerID layerId, Int_t modId);
70 static ELayerID VolUIDToLayer(UShort_t voluid, Int_t &modId);
71 static ELayerID VolUIDToLayer(UShort_t voluid);
03b18860 72
73 static const char* GetVolPath(UShort_t voluid) {
74 Int_t modId;
75 ELayerID layerId = VolUIDToLayer(voluid,modId);
76 return GetVolPath(layerId,modId);
77 }
7604a026 78 static const char* GetVolPath(ELayerID layerId, Int_t modId) { return fgVolPath[layerId-kFirstLayer][modId].Data(); }
03b18860 79
995ad051 80 Bool_t ApplyToGeometry();
81 static Bool_t GetFromGeometry(const char *path, AliAlignObj &alobj);
82
c18195b9 83 protected:
84
85 void AnglesToMatrix(const Double_t *angles, Double_t *rot) const;
86 Bool_t MatrixToAngles(const Double_t *rot, Double_t *angles) const;
87
03b18860 88 void InitVolPaths();
89
c18195b9 90 //Volume identifiers
98937d93 91 TString fVolPath; // Volume path inside TGeo geometry
92 UShort_t fVolUID; // Unique volume ID
93
94 static Int_t fgLayerSize[kLastLayer - kFirstLayer];
95 static const char* fgLayerName[kLastLayer - kFirstLayer];
03b18860 96
7604a026 97 static TString* fgVolPath[kLastLayer - kFirstLayer];
03b18860 98
99 ClassDef(AliAlignObj, 2)
c18195b9 100};
101
c18195b9 102#endif