]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDrecPoint.cxx
Add the number of local boards
[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//_____________________________________________________________________________
6d50f529 32AliTRDrecPoint::AliTRDrecPoint()
33 :AliRecPoint()
34 ,fDetector(0)
35 ,fTimeBin(0)
36 ,fUsed(0)
37 ,fY(0)
38 ,fZ(0)
39 ,fSigmaY2(0)
40 ,fSigmaZ2(0)
f7336fa3 41{
42 //
6d50f529 43 // Default constructor
f7336fa3 44 //
45
6d50f529 46 for (Int_t i = 0; i < 3; i++) {
47 fTracks[i] = 0;
48 }
bdbb05bb 49 fGeom = AliTRDgeometry::GetGeometry();
f7336fa3 50
51}
52
11432582 53//_____________________________________________________________________________
6d50f529 54AliTRDrecPoint::AliTRDrecPoint(const char * opt)
55 :AliRecPoint(opt)
56 ,fDetector(0)
57 ,fTimeBin(0)
58 ,fUsed(0)
59 ,fY(0)
60 ,fZ(0)
61 ,fSigmaY2(0)
62 ,fSigmaZ2(0)
11432582 63{
64 //
65 // Standard constructor
66 //
67
6d50f529 68 for (Int_t i = 0; i < 3; i++) {
69 fTracks[i] = 0;
70 }
bdbb05bb 71 fGeom = AliTRDgeometry::GetGeometry();
11432582 72
73}
74
8230f242 75//_____________________________________________________________________________
76AliTRDrecPoint::~AliTRDrecPoint()
77{
78 //
79 // AliTRDrecPoint destructor
80 //
81
82}
83
f7336fa3 84//_____________________________________________________________________________
85void AliTRDrecPoint::AddDigit(Int_t digit)
86{
87 //
88 // Adds the index of a digit to the digits list
89 //
90
91 // First resize the list
92 // (no clusters with more than 3 digits for the TRD
6d50f529 93 if ((fMulDigit == 0) &&
94 (fMaxDigit >= 5)) {
f7336fa3 95 fMaxDigit = 5;
96 delete fDigitsList;
97 fDigitsList = new int[fMaxDigit];
98 }
99
100 // Increase the size of the list if necessary
101 if (fMulDigit >= fMaxDigit) {
dd9a6ee3 102 fMaxDigit *= 2;
e3e1266c 103 Int_t *tempo = new Int_t[fMaxDigit];
6d50f529 104 Int_t index;
105 for (index = 0; index < fMulDigit; index++) {
f7336fa3 106 tempo[index] = fDigitsList[index];
6d50f529 107 }
f7336fa3 108 delete fDigitsList;
109 fDigitsList = tempo;
110 }
111
112 fDigitsList[fMulDigit++] = digit;
113
114}
115
116//_____________________________________________________________________________
73ae7b59 117void AliTRDrecPoint::SetLocalPosition(TVector3 & /*pos*/)
f7336fa3 118{
119 //
120 // Sets the position of the point in the local coordinate system
121 // (row,col,time) and calculates the error matrix in the same
122 // system.
123 //
124
6d50f529 125 AliFatal("Not implemented");
793ff80c 126
f7336fa3 127}
793ff80c 128
129//_____________________________________________________________________________
73ae7b59 130void AliTRDrecPoint::SetTrackingYZ(Float_t /*sigmaY*/, Float_t /*sigmaZ*/)
793ff80c 131{
6d50f529 132 //
133 // Sets the position of the point in the local coordinate system
134 // of tracking sector
135 //
136
137 AliFatal("Not implemented");
71d9fa7b 138
793ff80c 139}
140
141//_____________________________________________________________________________
142void AliTRDrecPoint::AddTrackIndex(Int_t *track)
143{
6d50f529 144 //
145 // Adds track index. Currently assumed that track is an array of
146 // size 9, and up to 3 track indexes are stored in fTracks[3].
147 // Indexes are sorted according to:
148 // 1) index of max number of appearances is stored first
149 // 2) if two or more indexes appear equal number of times, the lowest
150 // ones are stored first;
151 //
793ff80c 152
0a29d0f1 153 const Int_t kSize = 9;
6d50f529 154 Int_t entries[kSize][2];
793ff80c 155
6d50f529 156 Int_t i = 0;
157 Int_t j = 0;
158 Int_t k = 0;
159 Int_t index;
793ff80c 160
0a29d0f1 161 Bool_t indexAdded;
793ff80c 162
6d50f529 163 for (i = 0; i < kSize; i++) {
164 entries[i][0] = -1;
165 entries[i][1] = 0;
793ff80c 166 }
167
6d50f529 168 for (k = 0; k < kSize; k++) {
169 index = track[k];
170 indexAdded = kFALSE;
171 j = 0;
793ff80c 172 if (index >= 0) {
6d50f529 173 while ((!indexAdded) && (j < kSize)) {
174 if ((entries[j][0] == index) ||
175 (entries[j][1] == 0)) {
176 entries[j][0] = index;
177 entries[j][1] = entries[j][1]+1;
178 indexAdded = kTRUE;
793ff80c 179 }
180 j++;
181 }
182 }
6d50f529 183 }
184
185 // Sort by number of appearances and index value
186 Int_t swap = 1;
187 Int_t tmp0;
188 Int_t tmp1;
189 while (swap > 0) {
190 swap = 0;
191 for (i = 0; i < (kSize - 1); i++) {
192 if ((entries[i][0] >= 0) &&
193 (entries[i+1][0] >= 0)) {
793ff80c 194 if ((entries[i][1] < entries[i+1][1]) ||
195 ((entries[i][1] == entries[i+1][1]) &&
6d50f529 196 (entries[i][0] > entries[i+1][0]))) {
197 tmp0 = entries[i][0];
198 tmp1 = entries[i][1];
199 entries[i][0] = entries[i+1][0];
200 entries[i][1] = entries[i+1][1];
201 entries[i+1][0] = tmp0;
202 entries[i+1][1] = tmp1;
793ff80c 203 swap++;
204 }
205 }
206 }
207 }
208
6d50f529 209 // Set track indexes
210 for(i = 0; i < 3; i++) {
793ff80c 211 fTracks[i] = entries[i][0];
212 }
213
214 return;
215
216}
5443e65e 217
218
219
220
221
222
223