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