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