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