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.7 2001/12/05 15:04:34 hristov
19 Changes related to the corrections of AliRecPoint
21 Revision 1.6 2001/02/14 18:22:26 cblume
22 Change in the geometry of the padplane
24 Revision 1.5 2000/11/14 14:40:27 cblume
25 Correction for the Sun compiler (kTRUE and kFALSE)
27 Revision 1.4 2000/11/01 14:53:21 cblume
28 Merge with TRD-develop
30 Revision 1.1.4.2 2000/10/04 16:34:58 cblume
31 Replace include files by forward declarations
33 Revision 1.1.4.1 2000/09/22 14:50:39 cblume
34 Adapted to tracking code
36 Revision 1.3 2000/06/09 11:10:07 cblume
37 Compiler warnings and coding conventions, next round
39 Revision 1.2 2000/06/08 18:32:58 cblume
40 Make code compliant to coding conventions
42 Revision 1.1 2000/02/28 19:02:07 cblume
47 ///////////////////////////////////////////////////////////////////////////////
49 // TRD reconstructed point //
51 ///////////////////////////////////////////////////////////////////////////////
55 #include "AliTRDgeometry.h"
56 #include "AliTRDrecPoint.h"
59 ClassImp(AliTRDrecPoint)
61 //_____________________________________________________________________________
62 AliTRDrecPoint::AliTRDrecPoint():AliRecPoint()
65 // Standard constructor
72 (trd = ((AliTRD*) gAlice->GetDetector("TRD")))) {
73 fGeom = trd->GetGeometry();
81 //_____________________________________________________________________________
82 AliTRDrecPoint::AliTRDrecPoint(const char * opt):AliRecPoint(opt)
85 // Standard constructor
92 (trd = ((AliTRD*) gAlice->GetDetector("TRD")))) {
93 fGeom = trd->GetGeometry();
101 //_____________________________________________________________________________
102 AliTRDrecPoint::~AliTRDrecPoint()
105 // AliTRDrecPoint destructor
110 //_____________________________________________________________________________
111 void AliTRDrecPoint::AddDigit(Int_t digit)
114 // Adds the index of a digit to the digits list
117 // First resize the list
118 // (no clusters with more than 3 digits for the TRD
119 if ((fMulDigit == 0) && (fMaxDigit >= 5)) {
122 fDigitsList = new int[fMaxDigit];
125 // Increase the size of the list if necessary
126 if (fMulDigit >= fMaxDigit) {
128 int *tempo = new (int[fMaxDigit]);
130 for (index = 0; index < fMulDigit; index++)
131 tempo[index] = fDigitsList[index];
136 fDigitsList[fMulDigit++] = digit;
140 //_____________________________________________________________________________
141 void AliTRDrecPoint::SetLocalPosition(TVector3 &pos)
144 // Sets the position of the point in the local coordinate system
145 // (row,col,time) and calculates the error matrix in the same
149 const Float_t kSq12 = 3.464101615;
154 // Set the error matrix
155 // row: pad-size / sqrt(12)
156 // col: not defined yet
157 // time: bin-size / sqrt(12)
158 Int_t plane = ((AliTRDgeometry *) fGeom)->GetPlane(fDetector);
159 Int_t chamber = ((AliTRDgeometry *) fGeom)->GetChamber(fDetector);
160 Int_t sector = ((AliTRDgeometry *) fGeom)->GetSector(fDetector);
161 fLocPosM->operator()(0,0) = ((AliTRDgeometry *) fGeom)->GetRowPadSize(plane
165 fLocPosM->operator()(1,1) = 0.0;
166 fLocPosM->operator()(2,2) = ((AliTRDgeometry *) fGeom)->GetTimeBinSize()
169 // printf("rec. point: row = %f, col = %f, time = %f \n",
170 // fLocPos[0],fLocPos[1],fLocPos[2]);
174 //_____________________________________________________________________________
175 void AliTRDrecPoint::SetTrackingYZ(Float_t sigmaY, Float_t sigmaZ)
178 // Sets the position of the point in the local coordinate system
179 // of tracking sector
182 Int_t plane = ((AliTRDgeometry *) fGeom)->GetPlane(fDetector);
183 Int_t chamber = ((AliTRDgeometry *) fGeom)->GetChamber(fDetector);
184 Int_t sector = ((AliTRDgeometry *) fGeom)->GetSector(fDetector);
189 Float_t padRow = fLocPos[0]; // Pad Row position
190 Float_t padCol = fLocPos[1]; // Pad Column position
192 Float_t col0 = ((AliTRDgeometry *) fGeom)->GetCol0(plane);
193 Float_t row0 = ((AliTRDgeometry *) fGeom)->GetRow0(plane,chamber,sector);
195 // Float_t offset = 0.5 * ((AliTRDgeometry *) fGeom)->GetChamberWidth(plane);
197 fY = - (col0 + padCol * ((AliTRDgeometry *) fGeom)->GetColPadSize(plane));
198 fZ = row0 + padRow * ((AliTRDgeometry *) fGeom)->GetRowPadSize(plane
202 // fSigmaY = sigmaY * sigmaY;
203 // fSigmaZ = sigmaZ * sigmaZ;
205 fSigmaY2 = 0.05 * 0.05;
207 fSigmaZ2 = ((AliTRDgeometry *) fGeom)->GetRowPadSize(plane,chamber,sector)
208 * ((AliTRDgeometry *) fGeom)->GetRowPadSize(plane,chamber,sector)
213 //_____________________________________________________________________________
214 void AliTRDrecPoint::AddTrackIndex(Int_t *track)
216 // Adds track index. Currently assumed that track is an array of
217 // size 9, and up to 3 track indexes are stored in fTracks[3].
218 // Indexes are sorted according to:
219 // 1) index of max number of appearances is stored first
220 // 2) if two or more indexes appear equal number of times, the lowest
221 // ones are stored first;
223 const Int_t kSize = 9;
225 Int_t entries[kSize][2], i, j, index;
229 for (i=0; i<kSize; i++) {
235 for (Int_t k=0; k<kSize; k++) {
237 indexAdded=kFALSE; j=0;
239 while ( (!indexAdded) && ( j < kSize ) ) {
240 if ((entries[j][0]==index) || (entries[j][1]==0)) {
242 entries[j][1]=entries[j][1]+1;
250 // sort by number of appearances and index value
251 Int_t swap=1, tmp0, tmp1;
254 for(i=0; i<(kSize-1); i++) {
255 if ((entries[i][0] >= 0) && (entries[i+1][0] >= 0)) {
256 if ((entries[i][1] < entries[i+1][1]) ||
257 ((entries[i][1] == entries[i+1][1]) &&
258 (entries[i][0] > entries[i+1][0]))) {
261 entries[i][0]=entries[i+1][0];
262 entries[i][1]=entries[i+1][1];
263 entries[i+1][0]=tmp0;
264 entries[i+1][1]=tmp1;
274 fTracks[i] = entries[i][0];