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"
27 ClassImp(AliTRDcluster)
29 //___________________________________________________________________________
30 AliTRDcluster::AliTRDcluster()
40 // Default constructor
43 for (Int_t i = 0; i < 7; i++) {
49 //_____________________________________________________________________________
50 AliTRDcluster::AliTRDcluster(const AliTRDcluster &c)
52 ,fDetector(c.fDetector)
63 SetLabel(c.GetLabel(0),0);
64 SetLabel(c.GetLabel(1),1);
65 SetLabel(c.GetLabel(2),2);
69 SetSigmaY2(c.GetSigmaY2());
70 SetSigmaZ2(c.GetSigmaZ2());
72 for (Int_t i = 0; i < 7; i++) {
73 fSignals[i] = c.fSignals[i];
78 //_____________________________________________________________________________
79 void AliTRDcluster::AddTrackIndex(Int_t *track)
82 // Adds track index. Currently assumed that track is an array of
83 // size 9, and up to 3 track indexes are stored in fTracks[3].
84 // Indexes are sorted according to:
85 // 1) index of max number of appearances is stored first
86 // 2) if two or more indexes appear equal number of times, the lowest
87 // ones are stored first;
90 const Int_t kSize = 9;
91 Int_t entries[kSize][2];
99 for (i = 0; i < kSize; i++) {
104 for (k = 0; k < kSize; k++) {
111 while ((!indexAdded) && (j < kSize)) {
112 if ((entries[j][0] == index) ||
113 (entries[j][1] == 0)) {
114 entries[j][0] = index;
115 entries[j][1] = entries[j][1] + 1;
124 // Sort by number of appearances and index value
130 for (i = 0; i < (kSize - 1); i++) {
131 if ((entries[i][0] >= 0) &&
132 (entries[i+1][0] >= 0)) {
133 if ((entries[i][1] < entries[i+1][1]) ||
134 ((entries[i][1] == entries[i+1][1]) &&
135 (entries[i][0] > entries[i+1][0]))) {
136 tmp0 = entries[i][0];
137 tmp1 = entries[i][1];
138 entries[i][0] = entries[i+1][0];
139 entries[i][1] = entries[i+1][1];
140 entries[i+1][0] = tmp0;
141 entries[i+1][1] = tmp1;
149 for (i = 0; i < 3; i++) {
150 SetLabel(entries[i][0],i);
157 //_____________________________________________________________________________
158 void AliTRDcluster::SetSignals(Short_t *signals)
161 // Write signals in the cluster
164 for (Int_t i = 0; i < 7; i++) {
165 fSignals[i] = signals[i];
170 //_____________________________________________________________________________
171 Float_t AliTRDcluster::GetSumS() const
174 // Returns the total charge from a not unfolded cluster
178 for (Int_t i = 0; i < 7; i++) {