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()
42 // Default constructor
45 for (Int_t i = 0; i < 7; i++) {
51 //___________________________________________________________________________
52 AliTRDcluster::AliTRDcluster(Int_t det, Float_t q
53 , Float_t *pos, Float_t *sig
54 , Int_t *tracks, Char_t npads, Short_t *signals
55 , UChar_t col, UChar_t row, UChar_t time
56 , Char_t timebin, Float_t center, UShort_t volid)
57 :AliCluster(volid,pos[0],pos[1],pos[2],sig[0],sig[1],0.0,0x0)
59 ,fLocalTimeBin(timebin)
71 for (Int_t i = 0; i < 7; i++) {
72 fSignals[i] = signals[i];
76 AddTrackIndex(tracks);
81 //_____________________________________________________________________________
82 AliTRDcluster::AliTRDcluster(const AliTRDcluster &c)
84 ,fDetector(c.fDetector)
85 ,fLocalTimeBin(c.fLocalTimeBin)
97 SetLabel(c.GetLabel(0),0);
98 SetLabel(c.GetLabel(1),1);
99 SetLabel(c.GetLabel(2),2);
103 SetSigmaY2(c.GetSigmaY2());
104 SetSigmaZ2(c.GetSigmaZ2());
106 for (Int_t i = 0; i < 7; i++) {
107 fSignals[i] = c.fSignals[i];
112 //_____________________________________________________________________________
113 void AliTRDcluster::AddTrackIndex(Int_t *track)
116 // Adds track index. Currently assumed that track is an array of
117 // size 9, and up to 3 track indexes are stored in fTracks[3].
118 // Indexes are sorted according to:
119 // 1) index of max number of appearances is stored first
120 // 2) if two or more indexes appear equal number of times, the lowest
121 // ones are stored first;
124 const Int_t kSize = 9;
125 Int_t entries[kSize][2];
133 for (i = 0; i < kSize; i++) {
138 for (k = 0; k < kSize; k++) {
145 while ((!indexAdded) && (j < kSize)) {
146 if ((entries[j][0] == index) ||
147 (entries[j][1] == 0)) {
148 entries[j][0] = index;
149 entries[j][1] = entries[j][1] + 1;
158 // Sort by number of appearances and index value
164 for (i = 0; i < (kSize - 1); i++) {
165 if ((entries[i][0] >= 0) &&
166 (entries[i+1][0] >= 0)) {
167 if ((entries[i][1] < entries[i+1][1]) ||
168 ((entries[i][1] == entries[i+1][1]) &&
169 (entries[i][0] > entries[i+1][0]))) {
170 tmp0 = entries[i][0];
171 tmp1 = entries[i][1];
172 entries[i][0] = entries[i+1][0];
173 entries[i][1] = entries[i+1][1];
174 entries[i+1][0] = tmp0;
175 entries[i+1][1] = tmp1;
183 for (i = 0; i < 3; i++) {
184 SetLabel(entries[i][0],i);
191 //_____________________________________________________________________________
192 Float_t AliTRDcluster::GetSumS() const
195 // Returns the total charge from a not unfolded cluster
199 for (Int_t i = 0; i < 7; i++) {