]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDrecPoint.cxx
Additional protection (Yu.Belikov)
[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
88cb7938 16/* $Id$ */
f7336fa3 17
18///////////////////////////////////////////////////////////////////////////////
19// //
20// TRD reconstructed point //
21// //
22///////////////////////////////////////////////////////////////////////////////
23
793ff80c 24#include "AliRun.h"
25
f7336fa3 26#include "AliTRDgeometry.h"
27#include "AliTRDrecPoint.h"
f7336fa3 28
29ClassImp(AliTRDrecPoint)
30
31//_____________________________________________________________________________
32AliTRDrecPoint::AliTRDrecPoint():AliRecPoint()
33{
34 //
35 // Standard constructor
36 //
37
38 fDetector = 0;
39
bdbb05bb 40 fGeom = AliTRDgeometry::GetGeometry();
f7336fa3 41
42}
43
11432582 44//_____________________________________________________________________________
45AliTRDrecPoint::AliTRDrecPoint(const char * opt):AliRecPoint(opt)
46{
47 //
48 // Standard constructor
49 //
50
51 fDetector = 0;
52
bdbb05bb 53 fGeom = AliTRDgeometry::GetGeometry();
11432582 54
55}
56
8230f242 57//_____________________________________________________________________________
58AliTRDrecPoint::~AliTRDrecPoint()
59{
60 //
61 // AliTRDrecPoint destructor
62 //
63
64}
65
f7336fa3 66//_____________________________________________________________________________
67void 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) {
dd9a6ee3 83 fMaxDigit *= 2;
c9eca3d7 84 int *tempo = new int[fMaxDigit];
f7336fa3 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//_____________________________________________________________________________
73ae7b59 97void AliTRDrecPoint::SetLocalPosition(TVector3 & /*pos*/)
f7336fa3 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
5443e65e 105 //const Float_t kSq12 = 3.464101615;
f7336fa3 106
107 // Set the position
5443e65e 108 //fLocPos = pos;
f7336fa3 109
110 // Set the error matrix
111 // row: pad-size / sqrt(12)
112 // col: not defined yet
113 // time: bin-size / sqrt(12)
5443e65e 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;
f7336fa3 124
793ff80c 125 // printf("rec. point: row = %f, col = %f, time = %f \n",
126 // fLocPos[0],fLocPos[1],fLocPos[2]);
127
f7336fa3 128}
793ff80c 129
130//_____________________________________________________________________________
73ae7b59 131void AliTRDrecPoint::SetTrackingYZ(Float_t /*sigmaY*/, Float_t /*sigmaZ*/)
793ff80c 132{
133 //
134 // Sets the position of the point in the local coordinate system
135 // of tracking sector
136 //
137
5443e65e 138 //Int_t plane = ((AliTRDgeometry *) fGeom)->GetPlane(fDetector);
139 //Int_t chamber = ((AliTRDgeometry *) fGeom)->GetChamber(fDetector);
140 //Int_t sector = ((AliTRDgeometry *) fGeom)->GetSector(fDetector);
793ff80c 141
142
143 // Set the position
144
5443e65e 145 //Float_t padRow = fLocPos[0]; // Pad Row position
146 //Float_t padCol = fLocPos[1]; // Pad Column position
793ff80c 147
5443e65e 148 //Float_t col0 = ((AliTRDgeometry *) fGeom)->GetCol0(plane);
149 //Float_t row0 = ((AliTRDgeometry *) fGeom)->GetRow0(plane,chamber,sector);
793ff80c 150
151 // Float_t offset = 0.5 * ((AliTRDgeometry *) fGeom)->GetChamberWidth(plane);
152
5443e65e 153 //fY = - (col0 + padCol * ((AliTRDgeometry *) fGeom)->GetColPadSize(plane));
154 //fZ = row0 + padRow * ((AliTRDgeometry *) fGeom)->GetRowPadSize(plane
155 // ,chamber
156 // ,sector);
793ff80c 157
158 // fSigmaY = sigmaY * sigmaY;
159 // fSigmaZ = sigmaZ * sigmaZ;
160
5443e65e 161//fSigmaY2 = 0.05 * 0.05;
793ff80c 162
5443e65e 163//fSigmaZ2 = ((AliTRDgeometry *) fGeom)->GetRowPadSize(plane,chamber,sector)
164// * ((AliTRDgeometry *) fGeom)->GetRowPadSize(plane,chamber,sector)
165// / 12.;
71d9fa7b 166
793ff80c 167}
168
169//_____________________________________________________________________________
170void 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
0a29d0f1 179 const Int_t kSize = 9;
793ff80c 180
0a29d0f1 181 Int_t entries[kSize][2], i, j, index;
793ff80c 182
0a29d0f1 183 Bool_t indexAdded;
793ff80c 184
0a29d0f1 185 for (i=0; i<kSize; i++) {
793ff80c 186 entries[i][0]=-1;
187 entries[i][1]=0;
188 }
189
190
0a29d0f1 191 for (Int_t k=0; k<kSize; k++) {
793ff80c 192 index=track[k];
0a29d0f1 193 indexAdded=kFALSE; j=0;
793ff80c 194 if (index >= 0) {
0a29d0f1 195 while ( (!indexAdded) && ( j < kSize ) ) {
793ff80c 196 if ((entries[j][0]==index) || (entries[j][1]==0)) {
197 entries[j][0]=index;
198 entries[j][1]=entries[j][1]+1;
0a29d0f1 199 indexAdded=kTRUE;
793ff80c 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;
0a29d0f1 210 for(i=0; i<(kSize-1); i++) {
793ff80c 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}
5443e65e 236
237
238
239
240
241
242