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 ///////////////////////////////////////////////////////////////////////////////
36 ///////////////////////////////////////////////////////////////////////////////
38 #include "AliTRDcluster.h"
39 #include "AliTRDrecPoint.h"
41 ClassImp(AliTRDcluster)
43 //_____________________________________________________________________________
44 AliTRDcluster::AliTRDcluster()
47 // Default constructor
63 //_____________________________________________________________________________
64 AliTRDcluster::AliTRDcluster(const AliTRDrecPoint &p)
67 // Constructor from AliTRDrecPoint
70 fDetector = p.GetDetector();
71 fTimeBin = p.GetLocalTimeBin();
73 fTracks[0] = p.GetTrackIndex(0);
74 fTracks[1] = p.GetTrackIndex(1);
75 fTracks[2] = p.GetTrackIndex(2);
81 fSigmaY2 = p.GetSigmaY2();
82 fSigmaZ2 = p.GetSigmaZ2();
89 //_____________________________________________________________________________
90 AliTRDcluster::AliTRDcluster(const AliTRDcluster &c)
96 ((AliTRDcluster &) c).Copy(*this);
100 //_____________________________________________________________________________
101 AliTRDcluster::~AliTRDcluster()
104 // AliTRDcluster destructor
109 //_____________________________________________________________________________
110 AliTRDcluster &AliTRDcluster::operator=(const AliTRDcluster &c)
113 // Assignment operator
116 if (this != &c) ((AliTRDcluster &) c).Copy(*this);
121 //_____________________________________________________________________________
122 void AliTRDcluster::Copy(TObject &c)
128 ((AliTRDcluster &) c).fDetector = fDetector;
129 ((AliTRDcluster &) c).fTimeBin = fTimeBin;
131 ((AliTRDcluster &) c).fTracks[0] = fTracks[0];
132 ((AliTRDcluster &) c).fTracks[1] = fTracks[1];
133 ((AliTRDcluster &) c).fTracks[2] = fTracks[2];
135 ((AliTRDcluster &) c).fQ = fQ;
137 ((AliTRDcluster &) c).fY = fY;
138 ((AliTRDcluster &) c).fZ = fZ;
139 ((AliTRDcluster &) c).fSigmaY2 = fSigmaY2;
140 ((AliTRDcluster &) c).fSigmaZ2 = fSigmaZ2;
145 //_____________________________________________________________________________
146 void AliTRDcluster::AddTrackIndex(Int_t *track)
149 // Adds track index. Currently assumed that track is an array of
150 // size 9, and up to 3 track indexes are stored in fTracks[3].
151 // Indexes are sorted according to:
152 // 1) index of max number of appearances is stored first
153 // 2) if two or more indexes appear equal number of times, the lowest
154 // ones are stored first;
157 const Int_t kSize = 9;
159 Int_t entries[kSize][2], i, j, index;
163 for (i=0; i<kSize; i++) {
168 for (Int_t k=0; k<kSize; k++) {
173 while ( (!indexAdded) && ( j < kSize ) ) {
174 if ((entries[j][0]==index) || (entries[j][1]==0)) {
176 entries[j][1]=entries[j][1]+1;
184 // sort by number of appearances and index value
185 Int_t swap=1, tmp0, tmp1;
188 for(i=0; i<(kSize-1); i++) {
189 if ((entries[i][0] >= 0) && (entries[i+1][0] >= 0)) {
190 if ((entries[i][1] < entries[i+1][1]) ||
191 ((entries[i][1] == entries[i+1][1]) &&
192 (entries[i][0] > entries[i+1][0]))) {
195 entries[i][0]=entries[i+1][0];
196 entries[i][1]=entries[i+1][1];
197 entries[i+1][0]=tmp0;
198 entries[i+1][1]=tmp1;
207 fTracks[i] = entries[i][0];