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.4 2000/11/01 14:53:21 cblume
19 Merge with TRD-develop
21 Revision 1.1.4.2 2000/10/04 16:34:58 cblume
22 Replace include files by forward declarations
24 Revision 1.1.4.1 2000/09/22 14:50:39 cblume
25 Adapted to tracking code
27 Revision 1.3 2000/06/09 11:10:07 cblume
28 Compiler warnings and coding conventions, next round
30 Revision 1.2 2000/06/08 18:32:58 cblume
31 Make code compliant to coding conventions
33 Revision 1.1 2000/02/28 19:02:07 cblume
38 ///////////////////////////////////////////////////////////////////////////////
40 // TRD reconstructed point //
42 ///////////////////////////////////////////////////////////////////////////////
46 #include "AliTRDgeometry.h"
47 #include "AliTRDrecPoint.h"
50 ClassImp(AliTRDrecPoint)
52 //_____________________________________________________________________________
53 AliTRDrecPoint::AliTRDrecPoint():AliRecPoint()
56 // Standard constructor
63 (trd = ((AliTRD*) gAlice->GetDetector("TRD")))) {
64 fGeom = trd->GetGeometry();
72 //_____________________________________________________________________________
73 AliTRDrecPoint::~AliTRDrecPoint()
76 // AliTRDrecPoint destructor
81 //_____________________________________________________________________________
82 void AliTRDrecPoint::AddDigit(Int_t digit)
85 // Adds the index of a digit to the digits list
88 // First resize the list
89 // (no clusters with more than 3 digits for the TRD
90 if ((fMulDigit == 0) && (fMaxDigit >= 5)) {
93 fDigitsList = new int[fMaxDigit];
96 // Increase the size of the list if necessary
97 if (fMulDigit >= fMaxDigit) {
99 int *tempo = new (int[fMaxDigit]);
101 for (index = 0; index < fMulDigit; index++)
102 tempo[index] = fDigitsList[index];
107 fDigitsList[fMulDigit++] = digit;
111 //_____________________________________________________________________________
112 void AliTRDrecPoint::SetLocalPosition(TVector3 &pos)
115 // Sets the position of the point in the local coordinate system
116 // (row,col,time) and calculates the error matrix in the same
120 const Float_t kSq12 = 3.464101615;
125 // Set the error matrix
126 // row: pad-size / sqrt(12)
127 // col: not defined yet
128 // time: bin-size / sqrt(12)
129 fLocPosM->operator()(0,0) = ((AliTRDgeometry *) fGeom)->GetRowPadSize()
131 fLocPosM->operator()(1,1) = 0.0;
132 fLocPosM->operator()(2,2) = ((AliTRDgeometry *) fGeom)->GetTimeBinSize()
135 // printf("rec. point: row = %f, col = %f, time = %f \n",
136 // fLocPos[0],fLocPos[1],fLocPos[2]);
140 //_____________________________________________________________________________
141 void AliTRDrecPoint::SetTrackingYZ(Float_t sigmaY, Float_t sigmaZ)
144 // Sets the position of the point in the local coordinate system
145 // of tracking sector
148 Int_t plane = ((AliTRDgeometry *) fGeom)->GetPlane(fDetector);
149 Int_t chamber = ((AliTRDgeometry *) fGeom)->GetChamber(fDetector);
150 Int_t sector = ((AliTRDgeometry *) fGeom)->GetSector(fDetector);
155 Float_t padRow = fLocPos[0]; // Pad Row position
156 Float_t padCol = fLocPos[1]; // Pad Column position
158 Float_t col0 = ((AliTRDgeometry *) fGeom)->GetCol0(plane);
159 Float_t row0 = ((AliTRDgeometry *) fGeom)->GetRow0(plane,chamber,sector);
161 // Float_t offset = 0.5 * ((AliTRDgeometry *) fGeom)->GetChamberWidth(plane);
163 fY = - (col0 + padCol * ((AliTRDgeometry *) fGeom)->GetColPadSize());
165 fZ = row0 + padRow * ((AliTRDgeometry *) fGeom)->GetRowPadSize();
167 // fSigmaY = sigmaY * sigmaY;
168 // fSigmaZ = sigmaZ * sigmaZ;
170 fSigmaY2 = 0.05 * 0.05;
172 fSigmaZ2 = ((AliTRDgeometry *) fGeom)->GetRowPadSize() *
173 ((AliTRDgeometry *) fGeom)->GetRowPadSize() / 12.;
176 //_____________________________________________________________________________
177 void AliTRDrecPoint::AddTrackIndex(Int_t *track)
179 // Adds track index. Currently assumed that track is an array of
180 // size 9, and up to 3 track indexes are stored in fTracks[3].
181 // Indexes are sorted according to:
182 // 1) index of max number of appearances is stored first
183 // 2) if two or more indexes appear equal number of times, the lowest
184 // ones are stored first;
186 const Int_t size = 9;
188 Int_t entries[size][2], i, j, index;
192 for (i=0; i<size; i++) {
198 for (Int_t k=0; k<size; k++) {
200 index_added=kFALSE; j=0;
202 while ( (!index_added) && ( j < size ) ) {
203 if ((entries[j][0]==index) || (entries[j][1]==0)) {
205 entries[j][1]=entries[j][1]+1;
213 // sort by number of appearances and index value
214 Int_t swap=1, tmp0, tmp1;
217 for(i=0; i<(size-1); i++) {
218 if ((entries[i][0] >= 0) && (entries[i+1][0] >= 0)) {
219 if ((entries[i][1] < entries[i+1][1]) ||
220 ((entries[i][1] == entries[i+1][1]) &&
221 (entries[i][0] > entries[i+1][0]))) {
224 entries[i][0]=entries[i+1][0];
225 entries[i][1]=entries[i+1][1];
226 entries[i+1][0]=tmp0;
227 entries[i+1][1]=tmp1;
237 fTracks[i] = entries[i][0];