- add protection against invalid sector/stack information in on-line track matching
[u/mrichter/AliRoot.git] / TRD / AliTRDgeometry.h
1 #ifndef ALITRDGEOMETRY_H
2 #define ALITRDGEOMETRY_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 /* $Id$ */
7
8 ///////////////////////////////////////////////////////////////////////////////
9 //                                                                           //
10 //  TRD geometry class                                                       //
11 //                                                                           //
12 ///////////////////////////////////////////////////////////////////////////////
13
14 #include "AliGeometry.h"
15
16 class TGeoHMatrix;
17
18 class AliTRDpadPlane;
19
20 class AliTRDgeometry : public AliGeometry {
21
22  public:
23
24   enum { kNlayer  =   6
25        , kNstack  =   5
26        , kNsector =  18
27        , kNdet    = 540 
28        , kNdets   =  30 };
29
30   AliTRDgeometry();
31   virtual ~AliTRDgeometry();
32
33   virtual void             CreateGeometry(Int_t *idtmed);
34   virtual Int_t            IsVersion()                                            { return 1;               }
35   virtual Bool_t           Impact(const TParticle* ) const                        { return kTRUE;           }
36   virtual Bool_t           IsHole(Int_t la, Int_t st, Int_t se) const;
37   virtual Bool_t           IsOnBoundary(Int_t det, Float_t y, Float_t z, Float_t eps = 0.5) const;
38   virtual Bool_t           RotateBack(Int_t det, const Double_t * const loc, Double_t *glb) const;
39
40           Bool_t           ChamberInGeometry(Int_t det);
41
42           void             AssembleChamber(Int_t ilayer, Int_t istack);
43           void             CreateFrame(Int_t *idtmed);
44           void             CreateServices(Int_t *idtmed);
45
46   static  Bool_t           CreateClusterMatrixArray();  
47   static  TGeoHMatrix     *GetClusterMatrix(Int_t det);
48
49           void             SetSMstatus(Int_t sm, Char_t status)                  { fgSMstatus[sm] = status; }
50
51   static  Int_t            GetDetectorSec(Int_t layer, Int_t stack);
52   static  Int_t            GetDetector(Int_t layer, Int_t stack, Int_t sector);
53   static  Int_t            GetLayer(Int_t det);
54   static  Int_t            GetStack(Int_t det);
55           Int_t            GetStack(Double_t z, Int_t layer);
56   static  Int_t            GetSector(Int_t det);
57
58   static  void             CreatePadPlaneArray();
59   static  AliTRDpadPlane  *CreatePadPlane(Int_t layer, Int_t stack);
60   static  AliTRDpadPlane  *GetPadPlane(Int_t layer, Int_t stack);
61   static  AliTRDpadPlane  *GetPadPlane(Int_t det)                                { return GetPadPlane(GetLayer(det)
62                                                                                                      ,GetStack(det)); }
63   static  Int_t            GetRowMax(Int_t layer, Int_t stack, Int_t /*sector*/);
64   static  Int_t            GetColMax(Int_t layer);
65   static  Double_t         GetRow0(Int_t layer, Int_t stack, Int_t /*sector*/);
66   static  Double_t         GetCol0(Int_t layer);
67
68   static  Float_t          GetTime0(Int_t layer)                                 { return fgkTime0[layer];          }
69
70   static  Double_t         GetXtrdBeg()                                          { return fgkXtrdBeg;               }
71   static  Double_t         GetXtrdEnd()                                          { return fgkXtrdEnd;               }
72
73           Char_t           GetSMstatus(Int_t sm) const                           { return fgSMstatus[sm];           }
74   static  Float_t          GetChamberWidth(Int_t layer)                          { return fgkCwidth[layer]      ;   }
75   static  Float_t          GetChamberLength(Int_t layer, Int_t stack)            { return fgkClength[layer][stack]; }
76
77   virtual void             GetGlobal(const AliRecPoint*, TVector3&, TMatrixF& ) const { }; 
78   virtual void             GetGlobal(const AliRecPoint*, TVector3& ) const            { };
79
80   static  Double_t         GetAlpha()                                            { return 2.0 
81                                                                                         * 3.14159265358979324 
82                                                                                         / fgkNsector;          } 
83
84   static  Int_t            Nsector()                                             { return fgkNsector;       }
85   static  Int_t            Nlayer()                                              { return fgkNlayer;        }
86   static  Int_t            Nstack()                                              { return fgkNstack;        }
87   static  Int_t            Ndet()                                                { return fgkNdet;          }
88
89   static  Float_t          Cheight()                                             { return fgkCH;            }
90   static  Float_t          CheightSV()                                           { return fgkCHsv;          }
91   static  Float_t          Cspace()                                              { return fgkVspace;        }
92   static  Float_t          CraHght()                                             { return fgkCraH;          }
93   static  Float_t          CdrHght()                                             { return fgkCdrH;          }
94   static  Float_t          CamHght()                                             { return fgkCamH;          }
95   static  Float_t          CroHght()                                             { return fgkCroH;          }
96   static  Float_t          CsvHght()                                             { return fgkCsvH;          }
97   static  Float_t          CroWid()                                              { return fgkCroW;          }
98
99   static  Float_t          AnodePos()                                            { return fgkAnodePos;      }
100
101   static  Float_t          MyThick()                                             { return fgkRMyThick;      }
102   static  Float_t          DrThick()                                             { return fgkDrThick;       }
103   static  Float_t          AmThick()                                             { return fgkAmThick;       }
104   static  Float_t          DrZpos()                                              { return fgkDrZpos;        }
105   static  Float_t          RpadW()                                               { return fgkRpadW;         }
106   static  Float_t          CpadW()                                               { return fgkCpadW;         }
107
108   static  Float_t          Cwidcha()                                             { return (fgkSwidth2 - fgkSwidth1) 
109                                                                                         / fgkSheight 
110                                                                                         * (fgkCH + fgkVspace);      }
111
112   static  Int_t            MCMmax()                                              { return fgkMCMmax;        }
113   static  Int_t            MCMrow()                                              { return fgkMCMrow;        }
114   static  Int_t            ROBmaxC0()                                            { return fgkROBmaxC0;      }
115   static  Int_t            ROBmaxC1()                                            { return fgkROBmaxC1;      }
116   static  Int_t            ADCmax()                                              { return fgkADCmax;        }
117   static  Int_t            TBmax()                                               { return fgkTBmax;         }            
118   static  Int_t            Padmax()                                              { return fgkPadmax;        }
119   static  Int_t            Colmax()                                              { return fgkColmax;        }
120   static  Int_t            RowmaxC0()                                            { return fgkRowmaxC0;      }
121   static  Int_t            RowmaxC1()                                            { return fgkRowmaxC1;      }
122
123  protected:
124
125   static const Int_t       fgkNsector;                          //  Number of sectors in the full detector (18)
126   static const Int_t       fgkNlayer;                           //  Number of layers of the TRD (6)
127   static const Int_t       fgkNstack;                           //  Number of stacks in z-direction (5)
128   static const Int_t       fgkNdet;                             //  Total number of detectors (18 * 6 * 5 = 540)
129
130   static const Float_t     fgkTlength;                          //  Length of the TRD-volume in spaceframe (BTRD)
131
132   static const Float_t     fgkSheight;                          //  Height of the supermodule
133   static const Float_t     fgkSwidth1;                          //  Lower width of the supermodule
134   static const Float_t     fgkSwidth2;                          //  Upper width of the supermodule
135   static const Float_t     fgkSlength;                          //  Length of the supermodule
136
137   static const Float_t     fgkFlength;                          //  Length of the service space in front of a supermodule
138
139   static const Float_t     fgkSMpltT;                           //  Thickness of the super module side plates
140
141   static const Float_t     fgkCraH;                             //  Height of the radiator part of the chambers
142   static const Float_t     fgkCdrH;                             //  Height of the drift region of the chambers
143   static const Float_t     fgkCamH;                             //  Height of the amplification region of the chambers
144   static const Float_t     fgkCroH;                             //  Height of the readout of the chambers
145   static const Float_t     fgkCsvH;                             //  Height of the services on top of the chambers
146   static const Float_t     fgkCH;                               //  Total height of the chambers (w/o services)
147   static const Float_t     fgkCHsv;                             //  Total height of the chambers (with services)
148
149   static const Float_t     fgkAnodePos;                         //  Distance of anode wire plane relative to alignabl volume
150
151   static const Float_t     fgkVspace;                           //  Vertical spacing of the chambers
152   static const Float_t     fgkHspace;                           //  Horizontal spacing of the chambers
153   static const Float_t     fgkVrocsm;                           //  Radial distance of the first ROC to the outer SM plates
154
155   static const Float_t     fgkCalT;                             //  Thickness of the lower aluminum frame
156   static const Float_t     fgkCalW;                             //  Width of additional aluminum ledge on lower frame
157   static const Float_t     fgkCalH;                             //  Height of additional aluminum ledge on lower frame
158   static const Float_t     fgkCalWmod;                          //  Width of additional aluminum ledge on lower frame
159   static const Float_t     fgkCalHmod;                          //  Height of additional aluminum ledge on lower frame
160   static const Float_t     fgkCwsW;                             //  Width of additional wacosit ledge on lower frame
161   static const Float_t     fgkCwsH;                             //  Height of additional wacosit ledge on lower frame
162   static const Float_t     fgkCclsT;                            //  Thickness of the lower Wacosit frame sides
163   static const Float_t     fgkCclfT;                            //  Thickness of the lower Wacosit frame front
164   static const Float_t     fgkCglT;                             //  Thichness of the glue around the radiator
165   static const Float_t     fgkCcuTa;                            //  Thickness of the upper Wacosit frame around amp. region
166   static const Float_t     fgkCcuTb;                            //  Thickness of the upper Wacosit frame around amp. region
167   static const Float_t     fgkCauT;                             //  Thickness of the aluminum frame of the back panel
168   static const Float_t     fgkCroW;                             //  Additional width of the readout chamber frames
169
170   static const Float_t     fgkCpadW;                            //  Difference of outer chamber width and pad plane width
171   static const Float_t     fgkRpadW;                            //  Difference of outer chamber width and pad plane width
172
173   static const Float_t     fgkXeThick;                          //  Thickness of the gas volume
174   static const Float_t     fgkDrThick;                          //  Thickness of the drift region
175   static const Float_t     fgkAmThick;                          //  Thickness of the amplification region
176   static const Float_t     fgkWrThick;                          //  Thickness of the wire planes
177
178   static const Float_t     fgkPPdThick;                         //  Thickness of copper of the pad plane
179   static const Float_t     fgkPPpThick;                         //  Thickness of PCB board of the pad plane
180   static const Float_t     fgkPGlThick;                         //  Thickness of the glue layer
181   static const Float_t     fgkPCbThick;                         //  Thickness of the carbon layers
182   static const Float_t     fgkPHcThick;                         //  Thickness of the honeycomb support structure
183   static const Float_t     fgkPPcThick;                         //  Thickness of the PCB readout boards
184   static const Float_t     fgkPRbThick;                         //  Thickness of the PCB copper layers
185   static const Float_t     fgkPElThick;                         //  Thickness of all other electronics components (caps, etc.)
186
187   static const Float_t     fgkRFbThick;                         //  Thickness of the fiber layers in the radiator
188   static const Float_t     fgkRRhThick;                         //  Thickness of the rohacell layers in the radiator
189   static const Float_t     fgkRGlThick;                         //  Thickness of the glue layers in the radiator
190   static const Float_t     fgkRCbThick;                         //  Thickness of the carbon layers in the radiator
191   static const Float_t     fgkRMyThick;                         //  Thickness of the mylar layers in the radiator
192
193   static const Float_t     fgkDrZpos;                           //  Position of the drift region
194   static const Float_t     fgkAmZpos;                           //  Position of the amplification region
195   static const Float_t     fgkWrZposA;                          //  Position of the wire planes
196   static const Float_t     fgkWrZposB;                          //  Position of the wire planes
197   static const Float_t     fgkCalZpos;                          //  Position of the additional aluminum ledges
198
199   static const Int_t       fgkMCMmax;                           //  Maximum number of MCMs per ROB
200   static const Int_t       fgkMCMrow;                           //  Maximum number of MCMs per ROB Row
201   static const Int_t       fgkROBmaxC0;                         //  Maximum number of ROBs per C0 chamber
202   static const Int_t       fgkROBmaxC1;                         //  Maximum number of ROBs per C1 chamber
203   static const Int_t       fgkADCmax;                           //  Maximum number of ADC channels per MCM
204   static const Int_t       fgkTBmax;                            //  Maximum number of Time bins
205   static const Int_t       fgkPadmax;                           //  Maximum number of pads per MCM
206   static const Int_t       fgkColmax;                           //  Maximum number of pads per padplane row
207   static const Int_t       fgkRowmaxC0;                         //  Maximum number of Rows per C0 chamber
208   static const Int_t       fgkRowmaxC1;                         //  Maximum number of Rows per C1 chamber
209
210   static const Float_t     fgkCwidth[kNlayer];                  //  Outer widths of the chambers
211   static const Float_t     fgkClength[kNlayer][kNstack];        //  Outer lengths of the chambers
212
213   static const Double_t    fgkTime0Base;                        //  Base value for calculation of Time-position of pad 0
214   static const Float_t     fgkTime0[kNlayer];                   //  Time-position of pad 0
215
216   static const Double_t    fgkXtrdBeg;                          //  X-coordinate in tracking system of begin of TRD mother volume
217   static const Double_t    fgkXtrdEnd;                          //  X-coordinate in tracking system of end of TRD mother volume
218
219   static       TObjArray  *fgClusterMatrixArray;                //! Transformation matrices loc. cluster to tracking cs
220   static       TObjArray  *fgPadPlaneArray;                     //! Array of pad plane objects
221
222   static       Char_t      fgSMstatus[kNsector];                //  Super module status byte
223
224  private:
225
226   AliTRDgeometry(const AliTRDgeometry &g);                      //  Not implemented
227   AliTRDgeometry &operator=(const AliTRDgeometry &g);           //  Not implemented
228
229   ClassDef(AliTRDgeometry,25)                                   //  TRD geometry class
230
231 };
232 #endif