]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/AliTRDrecPoint.cxx
Adding MUON HLT code to the repository.
[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 /* $Id$ */
17
18 ///////////////////////////////////////////////////////////////////////////////
19 //                                                                           //
20 //  TRD reconstructed point                                                  //
21 //                                                                           //
22 ///////////////////////////////////////////////////////////////////////////////
23
24 #include "AliRun.h"
25
26 #include "AliTRDgeometry.h"
27 #include "AliTRDrecPoint.h"
28
29 ClassImp(AliTRDrecPoint)
30
31 //_____________________________________________________________________________
32 AliTRDrecPoint::AliTRDrecPoint():AliRecPoint()
33 {
34   //
35   // Standard constructor
36   //
37
38   fDetector = 0;
39
40   fGeom = AliTRDgeometry::GetGeometry();
41
42 }
43
44 //_____________________________________________________________________________
45 AliTRDrecPoint::AliTRDrecPoint(const char * opt):AliRecPoint(opt)
46 {
47   //
48   // Standard constructor
49   //
50
51   fDetector = 0;
52
53   fGeom = AliTRDgeometry::GetGeometry();
54
55 }
56
57 //_____________________________________________________________________________
58 AliTRDrecPoint::~AliTRDrecPoint()
59 {
60   //
61   // AliTRDrecPoint destructor
62   //
63
64 }
65
66 //_____________________________________________________________________________
67 void AliTRDrecPoint::AddDigit(Int_t digit)
68 {
69   //
70   // Adds the index of a digit to the digits list
71   //
72
73   // First resize the list 
74   // (no clusters with more than 3 digits for the TRD
75   if ((fMulDigit == 0) && (fMaxDigit >= 5)) {
76     fMaxDigit = 5;
77     delete fDigitsList;
78     fDigitsList = new int[fMaxDigit];
79   }
80
81   // Increase the size of the list if necessary
82   if (fMulDigit >= fMaxDigit) { 
83     fMaxDigit *= 2;
84     int *tempo = new int[fMaxDigit]; 
85     Int_t index; 
86     for (index = 0; index < fMulDigit; index++)
87       tempo[index] = fDigitsList[index]; 
88     delete fDigitsList; 
89     fDigitsList = tempo; 
90   }
91   
92   fDigitsList[fMulDigit++] = digit;
93
94 }
95
96 //_____________________________________________________________________________
97 void AliTRDrecPoint::SetLocalPosition(TVector3 & /*pos*/)
98 {
99   //
100   // Sets the position of the point in the local coordinate system
101   // (row,col,time) and calculates the error matrix in the same
102   // system.
103   //
104
105   //const Float_t kSq12 = 3.464101615;
106
107   // Set the position
108   //fLocPos = pos;
109
110   // Set the error matrix
111   // row:  pad-size / sqrt(12)
112   // col:  not defined yet
113   // time: bin-size / sqrt(12)
114   //Int_t plane   = ((AliTRDgeometry *) fGeom)->GetPlane(fDetector);
115   //Int_t chamber = ((AliTRDgeometry *) fGeom)->GetChamber(fDetector);
116   //Int_t sector  = ((AliTRDgeometry *) fGeom)->GetSector(fDetector);
117   //fLocPosM->operator()(0,0) = ((AliTRDgeometry *) fGeom)->GetRowPadSize(plane
118   //                                                                     ,chamber
119   //                                                                     ,sector) 
120   //                          / kSq12;
121   //fLocPosM->operator()(1,1) = 0.0;
122   //fLocPosM->operator()(2,2) = ((AliTRDgeometry *) fGeom)->GetTimeBinSize() 
123   //                          / kSq12;
124
125   //  printf("rec. point: row = %f, col = %f, time = %f \n",
126   //           fLocPos[0],fLocPos[1],fLocPos[2]); 
127
128 }
129
130 //_____________________________________________________________________________
131 void AliTRDrecPoint::SetTrackingYZ(Float_t /*sigmaY*/, Float_t /*sigmaZ*/)
132 {
133  //
134  // Sets the position of the point in the local coordinate system
135  // of tracking sector
136  //
137
138   //Int_t plane = ((AliTRDgeometry *) fGeom)->GetPlane(fDetector);
139   //Int_t chamber = ((AliTRDgeometry *) fGeom)->GetChamber(fDetector);
140   //Int_t sector = ((AliTRDgeometry *) fGeom)->GetSector(fDetector);
141
142
143  // Set the position
144
145   //Float_t   padRow    = fLocPos[0];             // Pad Row position
146   //Float_t   padCol    = fLocPos[1];             // Pad Column position
147
148   //Float_t   col0 = ((AliTRDgeometry *) fGeom)->GetCol0(plane);
149   //Float_t   row0 = ((AliTRDgeometry *) fGeom)->GetRow0(plane,chamber,sector);
150
151   //  Float_t   offset = 0.5 * ((AliTRDgeometry *) fGeom)->GetChamberWidth(plane);
152
153   //fY = - (col0 + padCol * ((AliTRDgeometry *) fGeom)->GetColPadSize(plane));
154   //fZ =    row0 + padRow * ((AliTRDgeometry *) fGeom)->GetRowPadSize(plane
155   //                                                                   ,chamber
156   //                                                                 ,sector);
157
158   //  fSigmaY = sigmaY * sigmaY;
159   //  fSigmaZ = sigmaZ * sigmaZ;
160
161 //fSigmaY2 = 0.05 * 0.05;
162
163 //fSigmaZ2 = ((AliTRDgeometry *) fGeom)->GetRowPadSize(plane,chamber,sector)
164 //         * ((AliTRDgeometry *) fGeom)->GetRowPadSize(plane,chamber,sector) 
165 //         / 12.;
166
167 }                                    
168
169 //_____________________________________________________________________________
170 void AliTRDrecPoint::AddTrackIndex(Int_t *track)
171 {
172  // Adds track index. Currently assumed that track is an array of
173  // size 9, and up to 3 track indexes are stored in fTracks[3].
174  // Indexes are sorted according to:
175  //  1) index of max number of appearances is stored first
176  //  2) if two or more indexes appear equal number of times, the lowest
177  //     ones are stored first;
178
179   const Int_t kSize = 9;
180
181   Int_t entries[kSize][2], i, j, index;
182
183   Bool_t indexAdded;
184
185   for (i=0; i<kSize; i++) {
186     entries[i][0]=-1;
187     entries[i][1]=0;
188   }
189
190
191   for (Int_t k=0; k<kSize; k++) {
192     index=track[k];
193     indexAdded=kFALSE; j=0;
194     if (index >= 0) {
195       while ( (!indexAdded) && ( j < kSize ) ) {
196         if ((entries[j][0]==index) || (entries[j][1]==0)) {
197           entries[j][0]=index;
198           entries[j][1]=entries[j][1]+1;
199           indexAdded=kTRUE;
200         }
201         j++;
202       }
203     }
204   }                   
205
206   // sort by number of appearances and index value
207   Int_t swap=1, tmp0, tmp1;
208   while ( swap > 0) {
209     swap=0;
210     for(i=0; i<(kSize-1); i++) {
211       if ((entries[i][0] >= 0) && (entries[i+1][0] >= 0)) {
212         if ((entries[i][1] < entries[i+1][1]) ||
213             ((entries[i][1] == entries[i+1][1]) &&
214              (entries[i][0] > entries[i+1][0]))) {
215                tmp0=entries[i][0];
216                tmp1=entries[i][1];
217                entries[i][0]=entries[i+1][0];
218                entries[i][1]=entries[i+1][1];
219                entries[i+1][0]=tmp0;
220                entries[i+1][1]=tmp1;
221                swap++;
222         }
223       }
224     }
225   }
226
227   // set track indexes
228
229   for(i=0; i<3; i++) {
230     fTracks[i] = entries[i][0];
231   }
232
233   return;
234
235 }                    
236
237
238
239
240
241
242