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 SetBit(1, c.IsInChamber());
98 SetLabel(c.GetLabel(0),0);
99 SetLabel(c.GetLabel(1),1);
100 SetLabel(c.GetLabel(2),2);
104 SetSigmaY2(c.GetSigmaY2());
105 SetSigmaZ2(c.GetSigmaZ2());
107 for (Int_t i = 0; i < 7; i++) {
108 fSignals[i] = c.fSignals[i];
113 //_____________________________________________________________________________
114 void AliTRDcluster::AddTrackIndex(Int_t *track)
117 // Adds track index. Currently assumed that track is an array of
118 // size 9, and up to 3 track indexes are stored in fTracks[3].
119 // Indexes are sorted according to:
120 // 1) index of max number of appearances is stored first
121 // 2) if two or more indexes appear equal number of times, the lowest
122 // ones are stored first;
125 const Int_t kSize = 9;
126 Int_t entries[kSize][2];
134 for (i = 0; i < kSize; i++) {
139 for (k = 0; k < kSize; k++) {
146 while ((!indexAdded) && (j < kSize)) {
147 if ((entries[j][0] == index) ||
148 (entries[j][1] == 0)) {
149 entries[j][0] = index;
150 entries[j][1] = entries[j][1] + 1;
159 // Sort by number of appearances and index value
165 for (i = 0; i < (kSize - 1); i++) {
166 if ((entries[i][0] >= 0) &&
167 (entries[i+1][0] >= 0)) {
168 if ((entries[i][1] < entries[i+1][1]) ||
169 ((entries[i][1] == entries[i+1][1]) &&
170 (entries[i][0] > entries[i+1][0]))) {
171 tmp0 = entries[i][0];
172 tmp1 = entries[i][1];
173 entries[i][0] = entries[i+1][0];
174 entries[i][1] = entries[i+1][1];
175 entries[i+1][0] = tmp0;
176 entries[i+1][1] = tmp1;
184 for (i = 0; i < 3; i++) {
185 SetLabel(entries[i][0],i);
192 //_____________________________________________________________________________
193 Float_t AliTRDcluster::GetSumS() const
196 // Returns the total charge from a not unfolded cluster
200 for (Int_t i = 0; i < 7; i++) {