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 ///////////////////////////////////////////////////////////////////////////////
20 // TRD reconstructed point //
22 ///////////////////////////////////////////////////////////////////////////////
26 #include "AliTRDgeometry.h"
27 #include "AliTRDrecPoint.h"
30 ClassImp(AliTRDrecPoint)
32 //_____________________________________________________________________________
33 AliTRDrecPoint::AliTRDrecPoint():AliRecPoint()
36 // Standard constructor
43 (trd = ((AliTRD*) gAlice->GetDetector("TRD")))) {
44 fGeom = trd->GetGeometry();
52 //_____________________________________________________________________________
53 AliTRDrecPoint::AliTRDrecPoint(const char * opt):AliRecPoint(opt)
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 //Int_t plane = ((AliTRDgeometry *) fGeom)->GetPlane(fDetector);
130 //Int_t chamber = ((AliTRDgeometry *) fGeom)->GetChamber(fDetector);
131 //Int_t sector = ((AliTRDgeometry *) fGeom)->GetSector(fDetector);
132 //fLocPosM->operator()(0,0) = ((AliTRDgeometry *) fGeom)->GetRowPadSize(plane
136 //fLocPosM->operator()(1,1) = 0.0;
137 //fLocPosM->operator()(2,2) = ((AliTRDgeometry *) fGeom)->GetTimeBinSize()
140 // printf("rec. point: row = %f, col = %f, time = %f \n",
141 // fLocPos[0],fLocPos[1],fLocPos[2]);
145 //_____________________________________________________________________________
146 void AliTRDrecPoint::SetTrackingYZ(Float_t /*sigmaY*/, Float_t /*sigmaZ*/)
149 // Sets the position of the point in the local coordinate system
150 // of tracking sector
153 //Int_t plane = ((AliTRDgeometry *) fGeom)->GetPlane(fDetector);
154 //Int_t chamber = ((AliTRDgeometry *) fGeom)->GetChamber(fDetector);
155 //Int_t sector = ((AliTRDgeometry *) fGeom)->GetSector(fDetector);
160 //Float_t padRow = fLocPos[0]; // Pad Row position
161 //Float_t padCol = fLocPos[1]; // Pad Column position
163 //Float_t col0 = ((AliTRDgeometry *) fGeom)->GetCol0(plane);
164 //Float_t row0 = ((AliTRDgeometry *) fGeom)->GetRow0(plane,chamber,sector);
166 // Float_t offset = 0.5 * ((AliTRDgeometry *) fGeom)->GetChamberWidth(plane);
168 //fY = - (col0 + padCol * ((AliTRDgeometry *) fGeom)->GetColPadSize(plane));
169 //fZ = row0 + padRow * ((AliTRDgeometry *) fGeom)->GetRowPadSize(plane
173 // fSigmaY = sigmaY * sigmaY;
174 // fSigmaZ = sigmaZ * sigmaZ;
176 //fSigmaY2 = 0.05 * 0.05;
178 //fSigmaZ2 = ((AliTRDgeometry *) fGeom)->GetRowPadSize(plane,chamber,sector)
179 // * ((AliTRDgeometry *) fGeom)->GetRowPadSize(plane,chamber,sector)
184 //_____________________________________________________________________________
185 void AliTRDrecPoint::AddTrackIndex(Int_t *track)
187 // Adds track index. Currently assumed that track is an array of
188 // size 9, and up to 3 track indexes are stored in fTracks[3].
189 // Indexes are sorted according to:
190 // 1) index of max number of appearances is stored first
191 // 2) if two or more indexes appear equal number of times, the lowest
192 // ones are stored first;
194 const Int_t kSize = 9;
196 Int_t entries[kSize][2], i, j, index;
200 for (i=0; i<kSize; i++) {
206 for (Int_t k=0; k<kSize; k++) {
208 indexAdded=kFALSE; j=0;
210 while ( (!indexAdded) && ( j < kSize ) ) {
211 if ((entries[j][0]==index) || (entries[j][1]==0)) {
213 entries[j][1]=entries[j][1]+1;
221 // sort by number of appearances and index value
222 Int_t swap=1, tmp0, tmp1;
225 for(i=0; i<(kSize-1); i++) {
226 if ((entries[i][0] >= 0) && (entries[i+1][0] >= 0)) {
227 if ((entries[i][1] < entries[i+1][1]) ||
228 ((entries[i][1] == entries[i+1][1]) &&
229 (entries[i][0] > entries[i+1][0]))) {
232 entries[i][0]=entries[i+1][0];
233 entries[i][1]=entries[i+1][1];
234 entries[i+1][0]=tmp0;
235 entries[i+1][1]=tmp1;
245 fTracks[i] = entries[i][0];