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 2001/05/07 08:08:05 cblume
21 Revision 1.3 2000/12/08 16:07:02 cblume
22 Update of the tracking by Sergei
24 Revision 1.2 2000/10/06 16:49:46 cblume
27 Revision 1.1.2.1 2000/09/22 14:47:52 cblume
32 #include "AliTRDcluster.h"
33 #include "AliTRDgeometry.h"
34 #include "AliTRDrecPoint.h"
36 ClassImp(AliTRDcluster)
39 //_____________________________________________________________________________
40 AliTRDcluster::AliTRDcluster(const AliTRDrecPoint &p):AliCluster()
43 // Constructor from AliTRDrecPoint
46 fDetector = p.GetDetector();
47 fTimeBin = p.GetLocalTimeBin();
49 fTracks[0] = p.GetTrackIndex(0);
50 fTracks[1] = p.GetTrackIndex(1);
51 fTracks[2] = p.GetTrackIndex(2);
57 fSigmaY2 = p.GetSigmaY2();
58 fSigmaZ2 = p.GetSigmaZ2();
65 //_____________________________________________________________________________
66 AliTRDcluster::AliTRDcluster(const AliTRDcluster &c):AliCluster()
72 fTracks[0] = c.GetLabel(0);
73 fTracks[1] = c.GetLabel(1);
74 fTracks[2] = c.GetLabel(2);
78 fSigmaY2 = c.GetSigmaY2();
79 fSigmaZ2 = c.GetSigmaZ2();
81 fDetector = c.GetDetector();
82 fTimeBin = c.GetLocalTimeBin();
87 //_____________________________________________________________________________
88 void AliTRDcluster::AddTrackIndex(Int_t *track)
91 // Adds track index. Currently assumed that track is an array of
92 // size 9, and up to 3 track indexes are stored in fTracks[3].
93 // Indexes are sorted according to:
94 // 1) index of max number of appearances is stored first
95 // 2) if two or more indexes appear equal number of times, the lowest
96 // ones are stored first;
101 Int_t entries[size][2], i, j, index;
105 for (i=0; i<size; i++) {
110 for (Int_t k=0; k<size; k++) {
112 index_added=kFALSE; j=0;
114 while ( (!index_added) && ( j < size ) ) {
115 if ((entries[j][0]==index) || (entries[j][1]==0)) {
117 entries[j][1]=entries[j][1]+1;
125 // sort by number of appearances and index value
126 Int_t swap=1, tmp0, tmp1;
129 for(i=0; i<(size-1); i++) {
130 if ((entries[i][0] >= 0) && (entries[i+1][0] >= 0)) {
131 if ((entries[i][1] < entries[i+1][1]) ||
132 ((entries[i][1] == entries[i+1][1]) &&
133 (entries[i][0] > entries[i+1][0]))) {
136 entries[i][0]=entries[i+1][0];
137 entries[i][1]=entries[i+1][1];
138 entries[i+1][0]=tmp0;
139 entries[i+1][1]=tmp1;
147 for(i=0; i<3; i++) SetLabel(entries[i][0],i);