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 **************************************************************************/
19 ///////////////////////////////////////////////////////////////////////////////
23 ///////////////////////////////////////////////////////////////////////////////
25 #include "AliTRDcluster.h"
26 #include "AliTRDrecPoint.h"
28 ClassImp(AliTRDcluster)
30 //___________________________________________________________________________
31 AliTRDcluster::AliTRDcluster()
41 // Default constructor
44 for (Int_t i = 0; i < 7; i++) {
50 //_____________________________________________________________________________
51 AliTRDcluster::AliTRDcluster(const AliTRDrecPoint &p)
53 ,fDetector(p.GetDetector())
54 ,fTimeBin(p.GetLocalTimeBin())
61 // Constructor from AliTRDrecPoint
64 SetLabel(p.GetTrackIndex(0),0);
65 SetLabel(p.GetTrackIndex(1),1);
66 SetLabel(p.GetTrackIndex(2),2);
70 //fSigmaY2 = p.GetSigmaY2();
71 //fSigmaZ2 = p.GetSigmaZ2();
78 //_____________________________________________________________________________
79 AliTRDcluster::AliTRDcluster(const AliTRDcluster &c)
81 ,fDetector(c.fDetector)
92 SetLabel(c.GetLabel(0),0);
93 SetLabel(c.GetLabel(1),1);
94 SetLabel(c.GetLabel(2),2);
98 SetSigmaY2(c.GetSigmaY2());
99 SetSigmaZ2(c.GetSigmaZ2());
101 for (Int_t i = 0; i < 7; i++) {
102 fSignals[i] = c.fSignals[i];
107 //_____________________________________________________________________________
108 void AliTRDcluster::AddTrackIndex(Int_t *track)
111 // Adds track index. Currently assumed that track is an array of
112 // size 9, and up to 3 track indexes are stored in fTracks[3].
113 // Indexes are sorted according to:
114 // 1) index of max number of appearances is stored first
115 // 2) if two or more indexes appear equal number of times, the lowest
116 // ones are stored first;
119 const Int_t kSize = 9;
120 Int_t entries[kSize][2];
128 for (i = 0; i < kSize; i++) {
133 for (k = 0; k < kSize; k++) {
140 while ((!indexAdded) && (j < kSize)) {
141 if ((entries[j][0] == index) ||
142 (entries[j][1] == 0)) {
143 entries[j][0] = index;
144 entries[j][1] = entries[j][1] + 1;
153 // Sort by number of appearances and index value
159 for (i = 0; i < (kSize - 1); i++) {
160 if ((entries[i][0] >= 0) &&
161 (entries[i+1][0] >= 0)) {
162 if ((entries[i][1] < entries[i+1][1]) ||
163 ((entries[i][1] == entries[i+1][1]) &&
164 (entries[i][0] > entries[i+1][0]))) {
165 tmp0 = entries[i][0];
166 tmp1 = entries[i][1];
167 entries[i][0] = entries[i+1][0];
168 entries[i][1] = entries[i+1][1];
169 entries[i+1][0] = tmp0;
170 entries[i+1][1] = tmp1;
178 for (i = 0; i < 3; i++) {
179 SetLabel(entries[i][0],i);
186 //_____________________________________________________________________________
187 void AliTRDcluster::SetSignals(Short_t *signals)
190 // Write signals in the cluster
193 for (Int_t i = 0; i < 7; i++) {
194 fSignals[i] = signals[i];
199 //_____________________________________________________________________________
200 Float_t AliTRDcluster::GetSumS() const
203 // Returns the total charge from a not unfolded cluster
207 for (Int_t i = 0; i < 7; i++) {