1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 Revision 1.5 2000/11/14 14:40:27 cblume
19 Correction for the Sun compiler (kTRUE and kFALSE)
21 Revision 1.4 2000/11/01 14:53:21 cblume
22 Merge with TRD-develop
24 Revision 1.1.4.2 2000/10/04 16:34:58 cblume
25 Replace include files by forward declarations
27 Revision 1.1.4.1 2000/09/22 14:50:39 cblume
28 Adapted to tracking code
30 Revision 1.3 2000/06/09 11:10:07 cblume
31 Compiler warnings and coding conventions, next round
33 Revision 1.2 2000/06/08 18:32:58 cblume
34 Make code compliant to coding conventions
36 Revision 1.1 2000/02/28 19:02:07 cblume
41 ///////////////////////////////////////////////////////////////////////////////
43 // TRD reconstructed point //
45 ///////////////////////////////////////////////////////////////////////////////
49 #include "AliTRDgeometry.h"
50 #include "AliTRDrecPoint.h"
53 ClassImp(AliTRDrecPoint)
55 //_____________________________________________________________________________
56 AliTRDrecPoint::AliTRDrecPoint():AliRecPoint()
59 // Standard constructor
66 (trd = ((AliTRD*) gAlice->GetDetector("TRD")))) {
67 fGeom = trd->GetGeometry();
75 //_____________________________________________________________________________
76 AliTRDrecPoint::~AliTRDrecPoint()
79 // AliTRDrecPoint destructor
84 //_____________________________________________________________________________
85 void AliTRDrecPoint::AddDigit(Int_t digit)
88 // Adds the index of a digit to the digits list
91 // First resize the list
92 // (no clusters with more than 3 digits for the TRD
93 if ((fMulDigit == 0) && (fMaxDigit >= 5)) {
96 fDigitsList = new int[fMaxDigit];
99 // Increase the size of the list if necessary
100 if (fMulDigit >= fMaxDigit) {
102 int *tempo = new (int[fMaxDigit]);
104 for (index = 0; index < fMulDigit; index++)
105 tempo[index] = fDigitsList[index];
110 fDigitsList[fMulDigit++] = digit;
114 //_____________________________________________________________________________
115 void AliTRDrecPoint::SetLocalPosition(TVector3 &pos)
118 // Sets the position of the point in the local coordinate system
119 // (row,col,time) and calculates the error matrix in the same
123 const Float_t kSq12 = 3.464101615;
128 // Set the error matrix
129 // row: pad-size / sqrt(12)
130 // col: not defined yet
131 // time: bin-size / sqrt(12)
132 Int_t plane = ((AliTRDgeometry *) fGeom)->GetPlane(fDetector);
133 Int_t chamber = ((AliTRDgeometry *) fGeom)->GetChamber(fDetector);
134 Int_t sector = ((AliTRDgeometry *) fGeom)->GetSector(fDetector);
135 fLocPosM->operator()(0,0) = ((AliTRDgeometry *) fGeom)->GetRowPadSize(plane
139 fLocPosM->operator()(1,1) = 0.0;
140 fLocPosM->operator()(2,2) = ((AliTRDgeometry *) fGeom)->GetTimeBinSize()
143 // printf("rec. point: row = %f, col = %f, time = %f \n",
144 // fLocPos[0],fLocPos[1],fLocPos[2]);
148 //_____________________________________________________________________________
149 void AliTRDrecPoint::SetTrackingYZ(Float_t sigmaY, Float_t sigmaZ)
152 // Sets the position of the point in the local coordinate system
153 // of tracking sector
156 Int_t plane = ((AliTRDgeometry *) fGeom)->GetPlane(fDetector);
157 Int_t chamber = ((AliTRDgeometry *) fGeom)->GetChamber(fDetector);
158 Int_t sector = ((AliTRDgeometry *) fGeom)->GetSector(fDetector);
163 Float_t padRow = fLocPos[0]; // Pad Row position
164 Float_t padCol = fLocPos[1]; // Pad Column position
166 Float_t col0 = ((AliTRDgeometry *) fGeom)->GetCol0(plane);
167 Float_t row0 = ((AliTRDgeometry *) fGeom)->GetRow0(plane,chamber,sector);
169 // Float_t offset = 0.5 * ((AliTRDgeometry *) fGeom)->GetChamberWidth(plane);
171 fY = - (col0 + padCol * ((AliTRDgeometry *) fGeom)->GetColPadSize(plane));
172 fZ = row0 + padRow * ((AliTRDgeometry *) fGeom)->GetRowPadSize(plane
176 // fSigmaY = sigmaY * sigmaY;
177 // fSigmaZ = sigmaZ * sigmaZ;
179 fSigmaY2 = 0.05 * 0.05;
181 fSigmaZ2 = ((AliTRDgeometry *) fGeom)->GetRowPadSize(plane,chamber,sector)
182 * ((AliTRDgeometry *) fGeom)->GetRowPadSize(plane,chamber,sector)
187 //_____________________________________________________________________________
188 void AliTRDrecPoint::AddTrackIndex(Int_t *track)
190 // Adds track index. Currently assumed that track is an array of
191 // size 9, and up to 3 track indexes are stored in fTracks[3].
192 // Indexes are sorted according to:
193 // 1) index of max number of appearances is stored first
194 // 2) if two or more indexes appear equal number of times, the lowest
195 // ones are stored first;
197 const Int_t size = 9;
199 Int_t entries[size][2], i, j, index;
203 for (i=0; i<size; i++) {
209 for (Int_t k=0; k<size; k++) {
211 index_added=kFALSE; j=0;
213 while ( (!index_added) && ( j < size ) ) {
214 if ((entries[j][0]==index) || (entries[j][1]==0)) {
216 entries[j][1]=entries[j][1]+1;
224 // sort by number of appearances and index value
225 Int_t swap=1, tmp0, tmp1;
228 for(i=0; i<(size-1); i++) {
229 if ((entries[i][0] >= 0) && (entries[i+1][0] >= 0)) {
230 if ((entries[i][1] < entries[i+1][1]) ||
231 ((entries[i][1] == entries[i+1][1]) &&
232 (entries[i][0] > entries[i+1][0]))) {
235 entries[i][0]=entries[i+1][0];
236 entries[i][1]=entries[i+1][1];
237 entries[i+1][0]=tmp0;
238 entries[i+1][1]=tmp1;
248 fTracks[i] = entries[i][0];