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(Int_t det, Float_t q
51 , Float_t *pos, Float_t *sig
52 , Int_t *tracks, Char_t npads, Short_t *signals
53 , UChar_t col, Char_t timebin
54 , Float_t center, UShort_t volid)
55 :AliCluster(volid,pos[2],pos[0],pos[1],sig[0],sig[1],0.0,0x0)
67 for (Int_t i = 0; i < 7; i++) {
68 fSignals[i] = signals[i];
72 AddTrackIndex(tracks);
77 //_____________________________________________________________________________
78 AliTRDcluster::AliTRDcluster(const AliTRDcluster &c)
80 ,fDetector(c.fDetector)
91 SetLabel(c.GetLabel(0),0);
92 SetLabel(c.GetLabel(1),1);
93 SetLabel(c.GetLabel(2),2);
97 SetSigmaY2(c.GetSigmaY2());
98 SetSigmaZ2(c.GetSigmaZ2());
100 for (Int_t i = 0; i < 7; i++) {
101 fSignals[i] = c.fSignals[i];
106 //_____________________________________________________________________________
107 void AliTRDcluster::AddTrackIndex(Int_t *track)
110 // Adds track index. Currently assumed that track is an array of
111 // size 9, and up to 3 track indexes are stored in fTracks[3].
112 // Indexes are sorted according to:
113 // 1) index of max number of appearances is stored first
114 // 2) if two or more indexes appear equal number of times, the lowest
115 // ones are stored first;
118 const Int_t kSize = 9;
119 Int_t entries[kSize][2];
127 for (i = 0; i < kSize; i++) {
132 for (k = 0; k < kSize; k++) {
139 while ((!indexAdded) && (j < kSize)) {
140 if ((entries[j][0] == index) ||
141 (entries[j][1] == 0)) {
142 entries[j][0] = index;
143 entries[j][1] = entries[j][1] + 1;
152 // Sort by number of appearances and index value
158 for (i = 0; i < (kSize - 1); i++) {
159 if ((entries[i][0] >= 0) &&
160 (entries[i+1][0] >= 0)) {
161 if ((entries[i][1] < entries[i+1][1]) ||
162 ((entries[i][1] == entries[i+1][1]) &&
163 (entries[i][0] > entries[i+1][0]))) {
164 tmp0 = entries[i][0];
165 tmp1 = entries[i][1];
166 entries[i][0] = entries[i+1][0];
167 entries[i][1] = entries[i+1][1];
168 entries[i+1][0] = tmp0;
169 entries[i+1][1] = tmp1;
177 for (i = 0; i < 3; i++) {
178 SetLabel(entries[i][0],i);
185 //_____________________________________________________________________________
186 Float_t AliTRDcluster::GetSumS() const
189 // Returns the total charge from a not unfolded cluster
193 for (Int_t i = 0; i < 7; i++) {