]>
Commit | Line | Data |
---|---|---|
46d29e70 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
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 | **************************************************************************/ | |
15 | ||
88cb7938 | 16 | /* $Id$ */ |
b9d0a01d | 17 | |
88cb7938 | 18 | |
19 | /////////////////////////////////////////////////////////////////////////////// | |
20 | // // | |
21 | // TRD cluster // | |
22 | // // | |
23 | /////////////////////////////////////////////////////////////////////////////// | |
46d29e70 | 24 | |
25 | #include "AliTRDcluster.h" | |
46d29e70 | 26 | |
46d29e70 | 27 | ClassImp(AliTRDcluster) |
bdb68f8c | 28 | |
6d50f529 | 29 | //___________________________________________________________________________ |
30 | AliTRDcluster::AliTRDcluster() | |
31 | :AliCluster() | |
32 | ,fDetector(0) | |
6d50f529 | 33 | ,fTimeBin(0) |
34 | ,fQ(0) | |
35 | ,fNPads(0) | |
36 | ,fCenter(0) | |
524fc8fa | 37 | ,fPad(0) |
6d50f529 | 38 | { |
bdb68f8c | 39 | // |
a6dd11e9 | 40 | // Default constructor |
bdb68f8c | 41 | // |
6d50f529 | 42 | |
43 | for (Int_t i = 0; i < 7; i++) { | |
44 | fSignals[i] = 0; | |
45 | } | |
46 | ||
bdb68f8c | 47 | } |
6d50f529 | 48 | |
34eaaa7e | 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) | |
56 | ,fDetector(det) | |
57 | ,fTimeBin(timebin) | |
58 | ,fQ(q) | |
59 | ,fNPads(npads) | |
60 | ,fCenter(center) | |
61 | ,fPad(col) | |
62 | { | |
63 | // | |
64 | // Constructor | |
65 | // | |
66 | ||
67 | for (Int_t i = 0; i < 7; i++) { | |
68 | fSignals[i] = signals[i]; | |
69 | } | |
70 | ||
71 | if (tracks) { | |
72 | AddTrackIndex(tracks); | |
73 | } | |
74 | ||
75 | } | |
76 | ||
bbf92647 | 77 | //_____________________________________________________________________________ |
6d50f529 | 78 | AliTRDcluster::AliTRDcluster(const AliTRDcluster &c) |
34eaaa7e | 79 | :AliCluster(c) |
6d50f529 | 80 | ,fDetector(c.fDetector) |
6d50f529 | 81 | ,fTimeBin(c.fTimeBin) |
82 | ,fQ(c.fQ) | |
83 | ,fNPads(c.fNPads) | |
84 | ,fCenter(c.fCenter) | |
524fc8fa | 85 | ,fPad(c.fPad) |
bbf92647 | 86 | { |
87 | // | |
88 | // Copy constructor | |
89 | // | |
90 | ||
75fb37cc | 91 | SetLabel(c.GetLabel(0),0); |
92 | SetLabel(c.GetLabel(1),1); | |
93 | SetLabel(c.GetLabel(2),2); | |
6d50f529 | 94 | |
75fb37cc | 95 | SetY(c.GetY()); |
96 | SetZ(c.GetZ()); | |
97 | SetSigmaY2(c.GetSigmaY2()); | |
98 | SetSigmaZ2(c.GetSigmaZ2()); | |
6d50f529 | 99 | |
100 | for (Int_t i = 0; i < 7; i++) { | |
101 | fSignals[i] = c.fSignals[i]; | |
102 | } | |
103 | ||
a2b90f83 | 104 | } |
105 | ||
a2b90f83 | 106 | //_____________________________________________________________________________ |
107 | void AliTRDcluster::AddTrackIndex(Int_t *track) | |
108 | { | |
109 | // | |
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; | |
116 | // | |
bbf92647 | 117 | |
88cb7938 | 118 | const Int_t kSize = 9; |
6d50f529 | 119 | Int_t entries[kSize][2]; |
a2b90f83 | 120 | |
6d50f529 | 121 | Int_t i = 0; |
122 | Int_t j = 0; | |
123 | Int_t k = 0; | |
124 | Int_t index; | |
88cb7938 | 125 | Bool_t indexAdded; |
a2b90f83 | 126 | |
6d50f529 | 127 | for (i = 0; i < kSize; i++) { |
128 | entries[i][0] = -1; | |
129 | entries[i][1] = 0; | |
5443e65e | 130 | } |
a2b90f83 | 131 | |
6d50f529 | 132 | for (k = 0; k < kSize; k++) { |
133 | ||
134 | index = track[k]; | |
135 | indexAdded = kFALSE; | |
136 | ||
137 | j = 0; | |
a2b90f83 | 138 | if (index >= 0) { |
6d50f529 | 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; | |
144 | indexAdded = kTRUE; | |
a2b90f83 | 145 | } |
146 | j++; | |
147 | } | |
148 | } | |
6d50f529 | 149 | |
150 | } | |
151 | ||
152 | // Sort by number of appearances and index value | |
153 | Int_t swap = 1; | |
154 | Int_t tmp0; | |
155 | Int_t tmp1; | |
156 | while (swap > 0) { | |
157 | swap = 0; | |
158 | for (i = 0; i < (kSize - 1); i++) { | |
159 | if ((entries[i][0] >= 0) && | |
160 | (entries[i+1][0] >= 0)) { | |
a2b90f83 | 161 | if ((entries[i][1] < entries[i+1][1]) || |
162 | ((entries[i][1] == entries[i+1][1]) && | |
6d50f529 | 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; | |
170 | swap++; | |
a2b90f83 | 171 | } |
172 | } | |
173 | } | |
5443e65e | 174 | } |
a2b90f83 | 175 | |
6d50f529 | 176 | // Set track indexes |
177 | for (i = 0; i < 3; i++) { | |
178 | SetLabel(entries[i][0],i); | |
179 | } | |
a2b90f83 | 180 | |
181 | return; | |
46d29e70 | 182 | |
5443e65e | 183 | } |
46d29e70 | 184 | |
6d50f529 | 185 | //_____________________________________________________________________________ |
bdb68f8c | 186 | Float_t AliTRDcluster::GetSumS() const |
187 | { | |
188 | // | |
6d50f529 | 189 | // Returns the total charge from a not unfolded cluster |
bdb68f8c | 190 | // |
6d50f529 | 191 | |
192 | Float_t sum = 0.0; | |
193 | for (Int_t i = 0; i < 7; i++) { | |
194 | sum += fSignals[i]; | |
bdb68f8c | 195 | } |
6d50f529 | 196 | |
197 | return sum; | |
bdb68f8c | 198 | |
199 | } |