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