]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/AliTRDrecPoint.cxx
Removed a compilation warning
[u/mrichter/AliRoot.git] / TRD / AliTRDrecPoint.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 $Log$
18 Revision 1.8  2002/03/28 14:59:07  cblume
19 Coding conventions
20
21 Revision 1.7  2001/12/05 15:04:34  hristov
22 Changes related to the corrections of AliRecPoint
23
24 Revision 1.6  2001/02/14 18:22:26  cblume
25 Change in the geometry of the padplane
26
27 Revision 1.5  2000/11/14 14:40:27  cblume
28 Correction for the Sun compiler (kTRUE and kFALSE)
29
30 Revision 1.4  2000/11/01 14:53:21  cblume
31 Merge with TRD-develop
32
33 Revision 1.1.4.2  2000/10/04 16:34:58  cblume
34 Replace include files by forward declarations
35
36 Revision 1.1.4.1  2000/09/22 14:50:39  cblume
37 Adapted to tracking code
38
39 Revision 1.3  2000/06/09 11:10:07  cblume
40 Compiler warnings and coding conventions, next round
41
42 Revision 1.2  2000/06/08 18:32:58  cblume
43 Make code compliant to coding conventions
44
45 Revision 1.1  2000/02/28 19:02:07  cblume
46 Add new TRD classes
47
48 */
49
50 ///////////////////////////////////////////////////////////////////////////////
51 //                                                                           //
52 //  TRD reconstructed point                                                  //
53 //                                                                           //
54 ///////////////////////////////////////////////////////////////////////////////
55
56 #include "AliRun.h"
57
58 #include "AliTRDgeometry.h"
59 #include "AliTRDrecPoint.h"
60 #include "AliTRD.h"
61
62 ClassImp(AliTRDrecPoint)
63
64 //_____________________________________________________________________________
65 AliTRDrecPoint::AliTRDrecPoint():AliRecPoint()
66 {
67   //
68   // Standard constructor
69   //
70
71   fDetector = 0;
72
73   AliTRD *trd;
74   if ((gAlice) &&
75       (trd = ((AliTRD*) gAlice->GetDetector("TRD")))) {
76     fGeom = trd->GetGeometry();
77   }
78   else {
79     fGeom = NULL;
80   }
81
82 }
83
84 //_____________________________________________________________________________
85 AliTRDrecPoint::AliTRDrecPoint(const char * opt):AliRecPoint(opt)
86 {
87   //
88   // Standard constructor
89   //
90
91   fDetector = 0;
92
93   AliTRD *trd;
94   if ((gAlice) &&
95       (trd = ((AliTRD*) gAlice->GetDetector("TRD")))) {
96     fGeom = trd->GetGeometry();
97   }
98   else {
99     fGeom = NULL;
100   }
101
102 }
103
104 //_____________________________________________________________________________
105 AliTRDrecPoint::~AliTRDrecPoint()
106 {
107   //
108   // AliTRDrecPoint destructor
109   //
110
111 }
112
113 //_____________________________________________________________________________
114 void AliTRDrecPoint::AddDigit(Int_t digit)
115 {
116   //
117   // Adds the index of a digit to the digits list
118   //
119
120   // First resize the list 
121   // (no clusters with more than 3 digits for the TRD
122   if ((fMulDigit == 0) && (fMaxDigit >= 5)) {
123     fMaxDigit = 5;
124     delete fDigitsList;
125     fDigitsList = new int[fMaxDigit];
126   }
127
128   // Increase the size of the list if necessary
129   if (fMulDigit >= fMaxDigit) { 
130     fMaxDigit *= 2;
131     int *tempo = new (int[fMaxDigit]); 
132     Int_t index; 
133     for (index = 0; index < fMulDigit; index++)
134       tempo[index] = fDigitsList[index]; 
135     delete fDigitsList; 
136     fDigitsList = tempo; 
137   }
138   
139   fDigitsList[fMulDigit++] = digit;
140
141 }
142
143 //_____________________________________________________________________________
144 void AliTRDrecPoint::SetLocalPosition(TVector3 &pos)
145 {
146   //
147   // Sets the position of the point in the local coordinate system
148   // (row,col,time) and calculates the error matrix in the same
149   // system.
150   //
151
152   //const Float_t kSq12 = 3.464101615;
153
154   // Set the position
155   //fLocPos = pos;
156
157   // Set the error matrix
158   // row:  pad-size / sqrt(12)
159   // col:  not defined yet
160   // time: bin-size / sqrt(12)
161   //Int_t plane   = ((AliTRDgeometry *) fGeom)->GetPlane(fDetector);
162   //Int_t chamber = ((AliTRDgeometry *) fGeom)->GetChamber(fDetector);
163   //Int_t sector  = ((AliTRDgeometry *) fGeom)->GetSector(fDetector);
164   //fLocPosM->operator()(0,0) = ((AliTRDgeometry *) fGeom)->GetRowPadSize(plane
165   //                                                                     ,chamber
166   //                                                                     ,sector) 
167   //                          / kSq12;
168   //fLocPosM->operator()(1,1) = 0.0;
169   //fLocPosM->operator()(2,2) = ((AliTRDgeometry *) fGeom)->GetTimeBinSize() 
170   //                          / kSq12;
171
172   //  printf("rec. point: row = %f, col = %f, time = %f \n",
173   //           fLocPos[0],fLocPos[1],fLocPos[2]); 
174
175 }
176
177 //_____________________________________________________________________________
178 void AliTRDrecPoint::SetTrackingYZ(Float_t sigmaY, Float_t sigmaZ)
179 {
180  //
181  // Sets the position of the point in the local coordinate system
182  // of tracking sector
183  //
184
185   //Int_t plane = ((AliTRDgeometry *) fGeom)->GetPlane(fDetector);
186   //Int_t chamber = ((AliTRDgeometry *) fGeom)->GetChamber(fDetector);
187   //Int_t sector = ((AliTRDgeometry *) fGeom)->GetSector(fDetector);
188
189
190  // Set the position
191
192   //Float_t   padRow    = fLocPos[0];             // Pad Row position
193   //Float_t   padCol    = fLocPos[1];             // Pad Column position
194
195   //Float_t   col0 = ((AliTRDgeometry *) fGeom)->GetCol0(plane);
196   //Float_t   row0 = ((AliTRDgeometry *) fGeom)->GetRow0(plane,chamber,sector);
197
198   //  Float_t   offset = 0.5 * ((AliTRDgeometry *) fGeom)->GetChamberWidth(plane);
199
200   //fY = - (col0 + padCol * ((AliTRDgeometry *) fGeom)->GetColPadSize(plane));
201   //fZ =    row0 + padRow * ((AliTRDgeometry *) fGeom)->GetRowPadSize(plane
202   //                                                                   ,chamber
203   //                                                                 ,sector);
204
205   //  fSigmaY = sigmaY * sigmaY;
206   //  fSigmaZ = sigmaZ * sigmaZ;
207
208 //fSigmaY2 = 0.05 * 0.05;
209
210 //fSigmaZ2 = ((AliTRDgeometry *) fGeom)->GetRowPadSize(plane,chamber,sector)
211 //         * ((AliTRDgeometry *) fGeom)->GetRowPadSize(plane,chamber,sector) 
212 //         / 12.;
213
214 }                                    
215
216 //_____________________________________________________________________________
217 void AliTRDrecPoint::AddTrackIndex(Int_t *track)
218 {
219  // Adds track index. Currently assumed that track is an array of
220  // size 9, and up to 3 track indexes are stored in fTracks[3].
221  // Indexes are sorted according to:
222  //  1) index of max number of appearances is stored first
223  //  2) if two or more indexes appear equal number of times, the lowest
224  //     ones are stored first;
225
226   const Int_t kSize = 9;
227
228   Int_t entries[kSize][2], i, j, index;
229
230   Bool_t indexAdded;
231
232   for (i=0; i<kSize; i++) {
233     entries[i][0]=-1;
234     entries[i][1]=0;
235   }
236
237
238   for (Int_t k=0; k<kSize; k++) {
239     index=track[k];
240     indexAdded=kFALSE; j=0;
241     if (index >= 0) {
242       while ( (!indexAdded) && ( j < kSize ) ) {
243         if ((entries[j][0]==index) || (entries[j][1]==0)) {
244           entries[j][0]=index;
245           entries[j][1]=entries[j][1]+1;
246           indexAdded=kTRUE;
247         }
248         j++;
249       }
250     }
251   }                   
252
253   // sort by number of appearances and index value
254   Int_t swap=1, tmp0, tmp1;
255   while ( swap > 0) {
256     swap=0;
257     for(i=0; i<(kSize-1); i++) {
258       if ((entries[i][0] >= 0) && (entries[i+1][0] >= 0)) {
259         if ((entries[i][1] < entries[i+1][1]) ||
260             ((entries[i][1] == entries[i+1][1]) &&
261              (entries[i][0] > entries[i+1][0]))) {
262                tmp0=entries[i][0];
263                tmp1=entries[i][1];
264                entries[i][0]=entries[i+1][0];
265                entries[i][1]=entries[i+1][1];
266                entries[i+1][0]=tmp0;
267                entries[i+1][1]=tmp1;
268                swap++;
269         }
270       }
271     }
272   }
273
274   // set track indexes
275
276   for(i=0; i<3; i++) {
277     fTracks[i] = entries[i][0];
278   }
279
280   return;
281
282 }                    
283
284
285
286
287
288
289