]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/TPCbase/AliTPCROC.cxx
CMake: Retrieve Git information
[u/mrichter/AliRoot.git] / TPC / TPCbase / AliTPCROC.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16
17 /// \class AliTPCROC
18 /// \brief Geometry class for a single ROC
19
20 #include "AliTPCROC.h"
21 #include "TMath.h"
22
23 /// \cond CLASSIMP
24 ClassImp(AliTPCROC)
25 /// \endcond
26
27
28 AliTPCROC* AliTPCROC::fgInstance = 0;
29
30
31
32
33 //_ singleton implementation __________________________________________________
34 AliTPCROC* AliTPCROC::Instance()
35 {
36   /// Singleton implementation
37   /// Returns an instance of this class, it is created if neccessary
38
39   if (fgInstance == 0){
40     fgInstance = new AliTPCROC();
41     fgInstance->Init();
42   }
43   return fgInstance;
44 }
45
46
47
48
49 void AliTPCROC::Init(){
50   /// initialize static variables
51
52   if (AliTPCROC::fNSectorsAll>0) return;
53   fNSectorsAll =72;
54   fNSectors[0] =36;
55   fNSectors[1] =36;
56   //
57   fNRows[0]= 63;
58   fNRows[1]= 96;
59   //
60   // number of pads in padrow
61   fNPads[0] = new UInt_t[fNRows[0]];
62   fNPads[1] = new UInt_t[fNRows[1]];
63   //
64   // padrow index in array
65   //
66   fRowPosIndex[0] = new UInt_t[fNRows[0]];
67   fRowPosIndex[1] = new UInt_t[fNRows[1]];
68   //
69   // inner sectors
70   //
71   UInt_t index =0;
72   for (UInt_t irow=0; irow<fNRows[0];irow++){
73     UInt_t npads = (irow==0) ? 68 : 2 *Int_t(Double_t(irow)/3. +33.67);
74     fNPads[0][irow] = npads;
75     fRowPosIndex[0][irow] = index;
76     index+=npads;
77   }
78   fNChannels[0] = index;
79   //
80   index =0;
81   Double_t k1 = 10.*TMath::Tan(10*TMath::DegToRad())/6.;
82   Double_t k2 = 15.*TMath::Tan(10*TMath::DegToRad())/6.;
83   for (UInt_t irow=0; irow<fNRows[1];irow++){
84     UInt_t npads = (irow<64) ?
85       2*Int_t(k1*Double_t(irow)+37.75):
86       2*Int_t(k2*Double_t(irow-64)+56.66);
87     fNPads[1][irow] = npads;
88     fRowPosIndex[1][irow] = index;
89     index+=npads;
90   }
91   fNChannels[1] = index;
92   SetGeometry();
93 }
94
95
96
97
98 void AliTPCROC::SetGeometry()
99 {
100   /// set ROC geometry parameters
101
102   const  Float_t kInnerRadiusLow = 83.65;
103   const  Float_t kInnerRadiusUp  = 133.3;
104   const  Float_t kOuterRadiusLow = 133.5;
105   const  Float_t kOuterRadiusUp  = 247.7;
106   const  Float_t kInnerFrameSpace = 1.5;
107   const  Float_t kOuterFrameSpace = 1.5;
108   const  Float_t kInnerWireMount = 1.2;
109   const  Float_t kOuterWireMount = 1.4;
110   const  Float_t kZLength =250.;
111   const  UInt_t   kNRowLow = 63;
112   const  UInt_t   kNRowUp1 = 64;
113   const  UInt_t   kNRowUp2 = 32;
114   const  UInt_t   kNRowUp  = 96;
115   const  Float_t kInnerAngle = 20; // 20 degrees
116   const  Float_t kOuterAngle = 20; // 20 degrees
117   //
118   //  pad     parameters
119   //
120   const Float_t  kInnerPadPitchLength = 0.75;
121   const Float_t  kInnerPadPitchWidth = 0.40;
122   const Float_t  kInnerPadLength = 0.75;
123   const Float_t  kInnerPadWidth = 0.40;
124   const Float_t  kOuter1PadPitchLength = 1.0;
125   const Float_t  kOuterPadPitchWidth = 0.6;
126   const Float_t  kOuter1PadLength = 1.0;
127   const Float_t  kOuterPadWidth = 0.6;
128   const Float_t  kOuter2PadPitchLength = 1.5;
129   const Float_t  kOuter2PadLength = 1.5;
130
131   //
132   //wires default parameters
133   //
134 //   const UInt_t    kNInnerWiresPerPad = 3;
135 //   const UInt_t    kInnerDummyWire = 2;
136 //   const Float_t  kInnerWWPitch = 0.25;
137 //   const Float_t  kRInnerFirstWire = 84.475;
138 //   const Float_t  kRInnerLastWire = 132.475;
139 //   const Float_t  kInnerOffWire = 0.5;
140 //   const UInt_t    kNOuter1WiresPerPad = 4;
141 //   const UInt_t    kNOuter2WiresPerPad = 6;
142 //   const Float_t  kOuterWWPitch = 0.25;
143 //   const Float_t  kROuterFirstWire = 134.225;
144 //   const Float_t  kROuterLastWire = 246.975;
145 //   const UInt_t    kOuterDummyWire = 2;
146 //   const Float_t  kOuterOffWire = 0.5;
147   //
148   //set sector parameters
149   //
150   fInnerRadiusLow = kInnerRadiusLow;
151   fOuterRadiusLow = kOuterRadiusLow;
152   fInnerRadiusUp  = kInnerRadiusUp;
153   fOuterRadiusUp  = kOuterRadiusUp;
154   fInnerFrameSpace = kInnerFrameSpace;
155   fOuterFrameSpace = kOuterFrameSpace;
156   fInnerWireMount  = kInnerWireMount;
157   fOuterWireMount  = kOuterWireMount;
158   fZLength         = kZLength;
159   fInnerAngle      =  TMath::DegToRad()*kInnerAngle;
160   fOuterAngle      =  TMath::DegToRad()*kOuterAngle;
161
162   fNRowLow       = kNRowLow;
163   fNRowUp1      = kNRowUp1;
164   fNRowUp2       = kNRowUp2;
165   fNRowUp        = kNRowUp;
166   //
167   //set pad parameter
168   //
169   fInnerPadPitchLength = kInnerPadPitchLength;
170   fInnerPadPitchWidth  = kInnerPadPitchWidth;
171   fInnerPadLength      = kInnerPadLength;
172   fInnerPadWidth       = kInnerPadWidth;
173   fOuter1PadPitchLength = kOuter1PadPitchLength;
174   fOuter2PadPitchLength = kOuter2PadPitchLength;
175   fOuterPadPitchWidth   = kOuterPadPitchWidth;
176   fOuter1PadLength      = kOuter1PadLength;
177   fOuter2PadLength      = kOuter2PadLength;
178   fOuterPadWidth        = kOuterPadWidth;
179
180   //
181   //set wire parameters
182   //
183   // SetInnerNWires(kNInnerWiresPerPad);
184   //   SetInnerDummyWire(kInnerDummyWire);
185   //   SetInnerOffWire(kInnerOffWire);
186   //   SetOuter1NWires(kNOuter1WiresPerPad);
187   //   SetOuter2NWire(kNOuter2WiresPerPad);
188   //   SetOuterDummyWire(kOuterDummyWire);
189   //   SetOuterOffWire(kOuterOffWire);
190   //   SetInnerWWPitch(kInnerWWPitch);
191   //   SetRInnerFirstWire(kRInnerFirstWire);
192   //   SetRInnerLastWire(kRInnerLastWire);
193   //   SetOuterWWPitch(kOuterWWPitch);
194   //   SetROuterFirstWire(kROuterFirstWire);
195   //   SetROuterLastWire(kROuterLastWire);
196
197   UInt_t i=0;
198   Float_t firstrow = fInnerRadiusLow + 1.575;
199   for( i= 0;i<fNRowLow;i++)
200     {
201       Float_t x = firstrow + fInnerPadPitchLength*(Float_t)i;
202       fPadRowLow[i]=x;
203       fYInner[i+1]  = x*TMath::Tan(fInnerAngle/2.)-fInnerWireMount;
204       fNPadsLow[i] = GetNPads(0,i) ;     // ROC implement
205     }
206   // cross talk rows
207   fYInner[0]=(fPadRowLow[0]-fInnerPadPitchLength)*TMath::Tan(fInnerAngle/2.)-fInnerWireMount;
208   fYInner[fNRowLow+1]=(fPadRowLow[fNRowLow-1]+fInnerPadPitchLength)*TMath::Tan(fInnerAngle/2.)-fInnerWireMount;
209   firstrow = fOuterRadiusLow + 1.6;
210   for(i=0;i<fNRowUp;i++)
211     {
212       if(i<fNRowUp1){
213         Float_t x = firstrow + fOuter1PadPitchLength*(Float_t)i;
214         fPadRowUp[i]=x;
215         fYOuter[i+1]= x*TMath::Tan(fOuterAngle/2.)-fOuterWireMount;
216         fNPadsUp[i] =  GetNPads(36,i) ;     // ROC implement
217         if(i==fNRowUp1-1) {
218           fLastWireUp1=fPadRowUp[i] +0.625;
219           firstrow = fPadRowUp[i] + 0.5*(fOuter1PadPitchLength+fOuter2PadPitchLength);
220         }
221       }
222       else
223         {
224           Float_t x = firstrow + fOuter2PadPitchLength*(Float_t)(i-64);
225           fPadRowUp[i]=x;
226           fNPadsUp[i] =  GetNPads(36,i) ;     // ROC implement
227         }
228       fYOuter[i+1]  = fPadRowUp[i]*TMath::Tan(fOuterAngle/2.)-fOuterWireMount;
229     }
230
231
232
233 }
234
235
236
237
238 //_____________________________________________________________________________
239 AliTPCROC::AliTPCROC()
240           :TObject(),
241            fNSectorsAll(0),
242            fInnerRadiusLow(0.),
243            fInnerRadiusUp(0.),
244            fOuterRadiusUp(0.),
245            fOuterRadiusLow(0.),
246            fInnerFrameSpace(0.),
247            fOuterFrameSpace(0.),
248            fInnerWireMount(0.),
249            fOuterWireMount(0.),
250            fZLength(0.),
251            fInnerAngle(0.),
252            fOuterAngle(0.),
253            fNInnerWiresPerPad(0),
254            fInnerWWPitch(0.),
255            fInnerDummyWire(0),
256            fInnerOffWire(0.),
257            fRInnerFirstWire(0.),
258            fRInnerLastWire(0.),
259            fLastWireUp1(0.),
260            fNOuter1WiresPerPad(0),
261            fNOuter2WiresPerPad(0),
262            fOuterWWPitch(0.),
263            fOuterDummyWire(0),
264            fOuterOffWire(0),
265            fROuterFirstWire(0.),
266            fROuterLastWire(0),
267            fInnerPadPitchLength(0.),
268            fInnerPadPitchWidth(0.),
269            fInnerPadLength(0.),
270            fInnerPadWidth(0.),
271            fOuter1PadPitchLength(0.),
272            fOuter2PadPitchLength(0),
273            fOuterPadPitchWidth(0),
274            fOuter1PadLength(0.),
275            fOuter2PadLength(0),
276            fOuterPadWidth(0),
277            fNRowLow(0),
278            fNRowUp1(0),
279            fNRowUp2(0),
280            fNRowUp(0),
281            fNtRows(0)
282 {
283   /// Default constructor
284
285   for (UInt_t i=0;i<2;i++){
286     fNSectors[i]  = 0;
287     fNRows[i]     = 0;
288     fNChannels[i] = 0;
289     fNPads[i]     = 0;
290     fRowPosIndex[i]= 0;
291   }
292
293   for (UInt_t i=0;i<100;++i){
294     fPadRowLow[i]=0.;
295     fPadRowUp[i]=0.;
296     fNPadsLow[i]=0;
297     fNPadsUp[i]=0;
298     fYInner[i]=0.;
299     fYOuter[i]=0.;
300   }
301 }
302
303
304 //_____________________________________________________________________________
305 AliTPCROC::AliTPCROC(const AliTPCROC &roc)
306           :TObject(roc),
307            fNSectorsAll(0),
308            fInnerRadiusLow(0.),
309            fInnerRadiusUp(0.),
310            fOuterRadiusUp(0.),
311            fOuterRadiusLow(0.),
312            fInnerFrameSpace(0.),
313            fOuterFrameSpace(0.),
314            fInnerWireMount(0.),
315            fOuterWireMount(0.),
316            fZLength(0.),
317            fInnerAngle(0.),
318            fOuterAngle(0.),
319            fNInnerWiresPerPad(0),
320            fInnerWWPitch(0.),
321            fInnerDummyWire(0),
322            fInnerOffWire(0.),
323            fRInnerFirstWire(0.),
324            fRInnerLastWire(0.),
325            fLastWireUp1(0.),
326            fNOuter1WiresPerPad(0),
327            fNOuter2WiresPerPad(0),
328            fOuterWWPitch(0.),
329            fOuterDummyWire(0),
330            fOuterOffWire(0),
331            fROuterFirstWire(0.),
332            fROuterLastWire(0),
333            fInnerPadPitchLength(0.),
334            fInnerPadPitchWidth(0.),
335            fInnerPadLength(0.),
336            fInnerPadWidth(0.),
337            fOuter1PadPitchLength(0.),
338            fOuter2PadPitchLength(0),
339            fOuterPadPitchWidth(0),
340            fOuter1PadLength(0.),
341            fOuter2PadLength(0),
342            fOuterPadWidth(0),
343            fNRowLow(0),
344            fNRowUp1(0),
345            fNRowUp2(0),
346            fNRowUp(0),
347            fNtRows(0)
348
349 {
350   /// AliTPCROC copy constructor
351
352   fNSectorsAll = roc.fNSectorsAll;
353   fNSectors[0] = roc.fNSectors[0];
354   fNSectors[1] = roc.fNSectors[1];
355   fNRows[0]    = roc.fNRows[0];
356   fNRows[1]    = roc.fNRows[1];
357   fNChannels[0]= roc.fNChannels[0];
358   fNChannels[1]= roc.fNChannels[1];
359   //
360   // number of pads in padrow
361   fNPads[0] = new UInt_t[fNRows[0]];
362   fNPads[1] = new UInt_t[fNRows[1]];
363   //
364   // padrow index in array
365   //
366   fRowPosIndex[0] = new UInt_t[fNRows[0]];
367   fRowPosIndex[1] = new UInt_t[fNRows[1]];
368   //
369   for (UInt_t irow =0; irow<fNRows[0];irow++){
370     fNPads[0][irow]       = roc.fNPads[0][irow];
371     fRowPosIndex[0][irow] = roc.fRowPosIndex[0][irow];
372   }
373   for (UInt_t irow =0; irow<fNRows[1];irow++){
374     fNPads[1][irow]       = roc.fNPads[1][irow];
375     fRowPosIndex[1][irow] = roc.fRowPosIndex[1][irow];
376   }
377
378   for (UInt_t i=0;i<100;++i){
379     fPadRowLow[i]=roc.fPadRowLow[i];
380     fPadRowUp[i]=roc.fPadRowUp[i];
381     fNPadsLow[i]=roc.fNPadsLow[i];
382     fNPadsUp[i]=roc.fNPadsUp[i];
383     fYInner[i]=roc.fYInner[i];
384     fYOuter[i]=roc.fYOuter[i];
385   }
386
387 }
388 //____________________________________________________________________________
389 AliTPCROC & AliTPCROC::operator =(const AliTPCROC & roc)
390 {
391   /// assignment operator - dummy
392
393   if (this == &roc) return (*this);
394
395   fZLength = roc.fZLength;
396   return (*this);
397 }
398 //_____________________________________________________________________________
399 AliTPCROC::~AliTPCROC()
400 {
401   /// AliTPCROC destructor
402
403   delete [] fNPads[0];
404   delete [] fNPads[1];
405   delete [] fRowPosIndex[0];
406   delete [] fRowPosIndex[1];
407   fgInstance = 0x0;
408
409 }
410
411
412
413
414 void AliTPCROC::GetPositionLocal(UInt_t sector, UInt_t row, UInt_t pad, Float_t *pos){
415   /// get position of center of pad - ideal frame used
416
417   pos[2]=fZLength;
418   if (sector<36){
419    pos[0] = fPadRowLow[row];
420    pos[1] = fInnerPadPitchWidth*(Int_t(pad)+0.5-Int_t(fNPads[0][row])/2);
421   }else{
422     pos[0] = fPadRowUp[row];
423     pos[1] = fOuterPadPitchWidth*(Int_t(pad)+0.5-Int_t(fNPads[1][row])/2);
424   }
425   if ((sector%36)>=18){
426     pos[2] *= -1.;
427     pos[1] *= -1.;
428   }
429 }
430
431
432 void AliTPCROC::GetPositionGlobal(UInt_t sector, UInt_t row, UInt_t pad, Float_t *pos){
433   /// get position of center of pad - ideal frame used
434
435   GetPositionLocal(sector,row,pad,pos);
436   Double_t alpha = TMath::DegToRad()*(10.+20.*(sector%18));
437   Float_t gx = pos[0]*TMath::Cos(alpha)-pos[1]*TMath::Sin(alpha);
438   Float_t gy = pos[1]*TMath::Cos(alpha)+pos[0]*TMath::Sin(alpha);
439   pos[0] = gx;
440   pos[1] = gy;
441 }