]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSgeomTGeo.h
small correction for error calculation
[u/mrichter/AliRoot.git] / ITS / AliITSgeomTGeo.h
1 #ifndef ALIITSGEOMTGEO_H
2 #define ALIITSGEOMTGEO_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 /////////////////////////////////////////////////////////////////////////
7 //  AliITSgeomTGeo is a simple interface class to TGeoManager          //
8 //  It is used in the simulation and reconstruction in order to        //
9 //  query the TGeo ITS geometry                                        //
10 //                                                                     //
11 //  author - cvetan.cheshkov@cern.ch                                   //
12 //  15/02/2007                                                         //
13 /////////////////////////////////////////////////////////////////////////
14
15 #include <TObject.h>
16 #include <TGeoMatrix.h>
17
18 class TGeoPNEntry;
19
20 class AliITSgeomTGeo : public TObject {
21
22  public:
23
24   AliITSgeomTGeo() { } // Default constructor
25   virtual ~AliITSgeomTGeo() { } // Destructor
26
27   // This function returns the total number of ITS modules 
28   static Int_t GetNModules() {return fgkNModules;}
29   // This function returns the number of detectors/ladder for a given layer 
30   static Int_t GetNDetectors(Int_t lay) {return fgkNDetectors[lay-1];}
31   // This function returns the number of ladders for a given layer
32   static Int_t GetNLadders(Int_t lay)   {return fgkNLadders[lay-1];}
33   // This function returns the number of layers
34   static Int_t GetNLayers()             {return kNLayers;}
35
36   // Two methods to map module index to layer,ladder,detector indeces
37   static Int_t  GetModuleIndex(Int_t lay,Int_t lad,Int_t det);
38   static Bool_t GetModuleId(Int_t index,Int_t &lay,Int_t &lad,Int_t &det);
39
40   static const char *GetSymName(Int_t index); // Get TGeoPNEntry symbolic name
41   static const char *GetSymName(Int_t lay,Int_t lad,Int_t det)
42     { return GetSymName(GetModuleIndex(lay,lad,det)); }
43  
44   // This function returns a pointer to the TGeoHMatrix (local->global)
45   // of a given module index
46   static TGeoHMatrix* GetMatrix(Int_t index);
47   static TGeoHMatrix* GetMatrix(Int_t lay,Int_t lad,Int_t det)
48     { return GetMatrix(GetModuleIndex(lay,lad,det)); }
49
50   static Bool_t GetTranslation(Int_t index, Double_t t[3]);
51   static Bool_t GetTranslation(Int_t lay,Int_t lad,Int_t det, Double_t t[3])
52     { return GetTranslation(GetModuleIndex(lay,lad,det),t); }
53
54   static Bool_t GetRotation(Int_t index, Double_t r[9]);
55   static Bool_t GetRotation(Int_t lay,Int_t lad,Int_t det, Double_t r[9])
56     { return GetRotation(GetModuleIndex(lay,lad,det),r); }
57
58   // This function returns a pointer to the original TGeoHMatrix (local->global)
59   // for a specific module index
60   static Bool_t GetOrigMatrix(Int_t index, TGeoHMatrix &m);
61   static Bool_t GetOrigMatrix(Int_t lay,Int_t lad,Int_t det, TGeoHMatrix &m)
62     { return GetOrigMatrix(GetModuleIndex(lay,lad,det),m); }
63
64   static Bool_t GetOrigTranslation(Int_t index, Double_t t[3]);
65   static Bool_t GetOrigTranslation(Int_t lay,Int_t lad,Int_t det, Double_t t[3])
66     { return GetOrigTranslation(GetModuleIndex(lay,lad,det),t); }
67
68   static Bool_t GetOrigRotation(Int_t index, Double_t r[9]);
69   static Bool_t GetOrigRotation(Int_t lay,Int_t lad,Int_t det, Double_t r[9])
70     { return GetOrigRotation(GetModuleIndex(lay,lad,det),r); }
71
72   static const TGeoHMatrix* GetTracking2LocalMatrix(Int_t index);
73   static const TGeoHMatrix* GetTracking2LocalMatrix(Int_t lay,Int_t lad,Int_t det)
74     { return GetTracking2LocalMatrix(GetModuleIndex(lay,lad,det)); }
75
76   static Bool_t GetTrackingMatrix(Int_t index, TGeoHMatrix &m);
77   static Bool_t GetTrackingMatrix(Int_t lay,Int_t lad,Int_t det, TGeoHMatrix &m)
78     { return GetTrackingMatrix(GetModuleIndex(lay,lad,det),m); }
79
80   static Bool_t LocalToGlobal(Int_t index, const Double_t *loc, Double_t *glob);
81   static Bool_t LocalToGlobal(Int_t lay, Int_t lad, Int_t det,
82                               const Double_t *loc, Double_t *glob)
83     { return LocalToGlobal(GetModuleIndex(lay,lad,det), loc, glob);}
84
85   static Bool_t GlobalToLocal(Int_t index, const Double_t *glob, Double_t *loc);
86   static Bool_t GlobalToLocal(Int_t lay, Int_t lad, Int_t det,
87                               const Double_t *glob, Double_t *loc)
88     { return GlobalToLocal(GetModuleIndex(lay,lad,det), glob, loc);}
89
90   static Bool_t LocalToGlobalVect(Int_t index, const Double_t *loc, Double_t *glob);
91   static Bool_t GlobalToLocalVect(Int_t index, const Double_t *glob, Double_t *loc);
92
93   enum {kNLayers = 6}; // The number of layers.
94
95  private:
96
97   static Bool_t       GetLayer(Int_t index,Int_t &lay,Int_t &index2);
98   static TGeoPNEntry* GetPNEntry(Int_t index);
99
100   AliITSgeomTGeo(const AliITSgeomTGeo &geom);     // Copy constructor
101   AliITSgeomTGeo& operator=(const AliITSgeomTGeo &geom);// Assignment operator
102
103   static const Int_t  fgkNModules;            // The total number of modules
104   static const Int_t  fgkNLadders[kNLayers];  // Array of the number of ladders/layer(layer)
105   static const Int_t  fgkNDetectors[kNLayers];// Array of the number of detector/ladder(layer)
106
107   ClassDef(AliITSgeomTGeo, 0) // ITS geometry based on TGeo
108 };
109
110 #endif