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.6 2001/02/14 18:22:26 cblume
19 Change in the geometry of the padplane
21 Revision 1.5 2000/11/14 14:40:27 cblume
22 Correction for the Sun compiler (kTRUE and kFALSE)
24 Revision 1.4 2000/11/01 14:53:21 cblume
25 Merge with TRD-develop
27 Revision 1.1.4.2 2000/10/04 16:34:58 cblume
28 Replace include files by forward declarations
30 Revision 1.1.4.1 2000/09/22 14:50:39 cblume
31 Adapted to tracking code
33 Revision 1.3 2000/06/09 11:10:07 cblume
34 Compiler warnings and coding conventions, next round
36 Revision 1.2 2000/06/08 18:32:58 cblume
37 Make code compliant to coding conventions
39 Revision 1.1 2000/02/28 19:02:07 cblume
44 ///////////////////////////////////////////////////////////////////////////////
46 // TRD reconstructed point //
48 ///////////////////////////////////////////////////////////////////////////////
52 #include "AliTRDgeometry.h"
53 #include "AliTRDrecPoint.h"
56 ClassImp(AliTRDrecPoint)
58 //_____________________________________________________________________________
59 AliTRDrecPoint::AliTRDrecPoint():AliRecPoint()
62 // Standard constructor
69 (trd = ((AliTRD*) gAlice->GetDetector("TRD")))) {
70 fGeom = trd->GetGeometry();
78 //_____________________________________________________________________________
79 AliTRDrecPoint::AliTRDrecPoint(const char * opt):AliRecPoint(opt)
82 // Standard constructor
89 (trd = ((AliTRD*) gAlice->GetDetector("TRD")))) {
90 fGeom = trd->GetGeometry();
98 //_____________________________________________________________________________
99 AliTRDrecPoint::~AliTRDrecPoint()
102 // AliTRDrecPoint destructor
107 //_____________________________________________________________________________
108 void AliTRDrecPoint::AddDigit(Int_t digit)
111 // Adds the index of a digit to the digits list
114 // First resize the list
115 // (no clusters with more than 3 digits for the TRD
116 if ((fMulDigit == 0) && (fMaxDigit >= 5)) {
119 fDigitsList = new int[fMaxDigit];
122 // Increase the size of the list if necessary
123 if (fMulDigit >= fMaxDigit) {
125 int *tempo = new (int[fMaxDigit]);
127 for (index = 0; index < fMulDigit; index++)
128 tempo[index] = fDigitsList[index];
133 fDigitsList[fMulDigit++] = digit;
137 //_____________________________________________________________________________
138 void AliTRDrecPoint::SetLocalPosition(TVector3 &pos)
141 // Sets the position of the point in the local coordinate system
142 // (row,col,time) and calculates the error matrix in the same
146 const Float_t kSq12 = 3.464101615;
151 // Set the error matrix
152 // row: pad-size / sqrt(12)
153 // col: not defined yet
154 // time: bin-size / sqrt(12)
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
162 fLocPosM->operator()(1,1) = 0.0;
163 fLocPosM->operator()(2,2) = ((AliTRDgeometry *) fGeom)->GetTimeBinSize()
166 // printf("rec. point: row = %f, col = %f, time = %f \n",
167 // fLocPos[0],fLocPos[1],fLocPos[2]);
171 //_____________________________________________________________________________
172 void AliTRDrecPoint::SetTrackingYZ(Float_t sigmaY, Float_t sigmaZ)
175 // Sets the position of the point in the local coordinate system
176 // of tracking sector
179 Int_t plane = ((AliTRDgeometry *) fGeom)->GetPlane(fDetector);
180 Int_t chamber = ((AliTRDgeometry *) fGeom)->GetChamber(fDetector);
181 Int_t sector = ((AliTRDgeometry *) fGeom)->GetSector(fDetector);
186 Float_t padRow = fLocPos[0]; // Pad Row position
187 Float_t padCol = fLocPos[1]; // Pad Column position
189 Float_t col0 = ((AliTRDgeometry *) fGeom)->GetCol0(plane);
190 Float_t row0 = ((AliTRDgeometry *) fGeom)->GetRow0(plane,chamber,sector);
192 // Float_t offset = 0.5 * ((AliTRDgeometry *) fGeom)->GetChamberWidth(plane);
194 fY = - (col0 + padCol * ((AliTRDgeometry *) fGeom)->GetColPadSize(plane));
195 fZ = row0 + padRow * ((AliTRDgeometry *) fGeom)->GetRowPadSize(plane
199 // fSigmaY = sigmaY * sigmaY;
200 // fSigmaZ = sigmaZ * sigmaZ;
202 fSigmaY2 = 0.05 * 0.05;
204 fSigmaZ2 = ((AliTRDgeometry *) fGeom)->GetRowPadSize(plane,chamber,sector)
205 * ((AliTRDgeometry *) fGeom)->GetRowPadSize(plane,chamber,sector)
210 //_____________________________________________________________________________
211 void AliTRDrecPoint::AddTrackIndex(Int_t *track)
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;
220 const Int_t size = 9;
222 Int_t entries[size][2], i, j, index;
226 for (i=0; i<size; i++) {
232 for (Int_t k=0; k<size; k++) {
234 index_added=kFALSE; j=0;
236 while ( (!index_added) && ( j < size ) ) {
237 if ((entries[j][0]==index) || (entries[j][1]==0)) {
239 entries[j][1]=entries[j][1]+1;
247 // sort by number of appearances and index value
248 Int_t swap=1, tmp0, tmp1;
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]))) {
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;
271 fTracks[i] = entries[i][0];