]>
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) | |
af26ce80 | 33 | ,fLocalTimeBin(0) |
6d50f529 | 34 | ,fQ(0) |
35 | ,fNPads(0) | |
36 | ,fCenter(0) | |
af26ce80 | 37 | ,fPadCol(0) |
38 | ,fPadRow(0) | |
39 | ,fPadTime(0) | |
6d50f529 | 40 | { |
bdb68f8c | 41 | // |
a6dd11e9 | 42 | // Default constructor |
bdb68f8c | 43 | // |
6d50f529 | 44 | |
45 | for (Int_t i = 0; i < 7; i++) { | |
46 | fSignals[i] = 0; | |
47 | } | |
48 | ||
bdb68f8c | 49 | } |
6d50f529 | 50 | |
34eaaa7e | 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 | |
af26ce80 | 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) | |
34eaaa7e | 58 | ,fDetector(det) |
af26ce80 | 59 | ,fLocalTimeBin(timebin) |
34eaaa7e | 60 | ,fQ(q) |
61 | ,fNPads(npads) | |
62 | ,fCenter(center) | |
af26ce80 | 63 | ,fPadCol(col) |
64 | ,fPadRow(row) | |
65 | ,fPadTime(time) | |
34eaaa7e | 66 | { |
67 | // | |
68 | // Constructor | |
69 | // | |
70 | ||
71 | for (Int_t i = 0; i < 7; i++) { | |
72 | fSignals[i] = signals[i]; | |
73 | } | |
74 | ||
75 | if (tracks) { | |
76 | AddTrackIndex(tracks); | |
77 | } | |
78 | ||
79 | } | |
80 | ||
bbf92647 | 81 | //_____________________________________________________________________________ |
6d50f529 | 82 | AliTRDcluster::AliTRDcluster(const AliTRDcluster &c) |
34eaaa7e | 83 | :AliCluster(c) |
6d50f529 | 84 | ,fDetector(c.fDetector) |
af26ce80 | 85 | ,fLocalTimeBin(c.fLocalTimeBin) |
6d50f529 | 86 | ,fQ(c.fQ) |
87 | ,fNPads(c.fNPads) | |
88 | ,fCenter(c.fCenter) | |
af26ce80 | 89 | ,fPadCol(c.fPadCol) |
90 | ,fPadRow(c.fPadRow) | |
91 | ,fPadTime(c.fPadTime) | |
bbf92647 | 92 | { |
93 | // | |
94 | // Copy constructor | |
95 | // | |
96 | ||
eb38ed55 | 97 | SetBit(1, c.IsInChamber()); |
75fb37cc | 98 | SetLabel(c.GetLabel(0),0); |
99 | SetLabel(c.GetLabel(1),1); | |
100 | SetLabel(c.GetLabel(2),2); | |
6d50f529 | 101 | |
75fb37cc | 102 | SetY(c.GetY()); |
103 | SetZ(c.GetZ()); | |
104 | SetSigmaY2(c.GetSigmaY2()); | |
105 | SetSigmaZ2(c.GetSigmaZ2()); | |
6d50f529 | 106 | |
107 | for (Int_t i = 0; i < 7; i++) { | |
108 | fSignals[i] = c.fSignals[i]; | |
109 | } | |
110 | ||
a2b90f83 | 111 | } |
112 | ||
a2b90f83 | 113 | //_____________________________________________________________________________ |
114 | void AliTRDcluster::AddTrackIndex(Int_t *track) | |
115 | { | |
116 | // | |
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; | |
123 | // | |
bbf92647 | 124 | |
88cb7938 | 125 | const Int_t kSize = 9; |
6d50f529 | 126 | Int_t entries[kSize][2]; |
a2b90f83 | 127 | |
6d50f529 | 128 | Int_t i = 0; |
129 | Int_t j = 0; | |
130 | Int_t k = 0; | |
131 | Int_t index; | |
88cb7938 | 132 | Bool_t indexAdded; |
a2b90f83 | 133 | |
6d50f529 | 134 | for (i = 0; i < kSize; i++) { |
135 | entries[i][0] = -1; | |
136 | entries[i][1] = 0; | |
5443e65e | 137 | } |
a2b90f83 | 138 | |
6d50f529 | 139 | for (k = 0; k < kSize; k++) { |
140 | ||
141 | index = track[k]; | |
142 | indexAdded = kFALSE; | |
143 | ||
144 | j = 0; | |
a2b90f83 | 145 | if (index >= 0) { |
6d50f529 | 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; | |
151 | indexAdded = kTRUE; | |
a2b90f83 | 152 | } |
153 | j++; | |
154 | } | |
155 | } | |
6d50f529 | 156 | |
157 | } | |
158 | ||
159 | // Sort by number of appearances and index value | |
160 | Int_t swap = 1; | |
161 | Int_t tmp0; | |
162 | Int_t tmp1; | |
163 | while (swap > 0) { | |
164 | swap = 0; | |
165 | for (i = 0; i < (kSize - 1); i++) { | |
166 | if ((entries[i][0] >= 0) && | |
167 | (entries[i+1][0] >= 0)) { | |
a2b90f83 | 168 | if ((entries[i][1] < entries[i+1][1]) || |
169 | ((entries[i][1] == entries[i+1][1]) && | |
6d50f529 | 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; | |
177 | swap++; | |
a2b90f83 | 178 | } |
179 | } | |
180 | } | |
5443e65e | 181 | } |
a2b90f83 | 182 | |
6d50f529 | 183 | // Set track indexes |
184 | for (i = 0; i < 3; i++) { | |
185 | SetLabel(entries[i][0],i); | |
186 | } | |
a2b90f83 | 187 | |
188 | return; | |
46d29e70 | 189 | |
5443e65e | 190 | } |
46d29e70 | 191 | |
6d50f529 | 192 | //_____________________________________________________________________________ |
bdb68f8c | 193 | Float_t AliTRDcluster::GetSumS() const |
194 | { | |
195 | // | |
6d50f529 | 196 | // Returns the total charge from a not unfolded cluster |
bdb68f8c | 197 | // |
6d50f529 | 198 | |
199 | Float_t sum = 0.0; | |
200 | for (Int_t i = 0; i < 7; i++) { | |
201 | sum += fSignals[i]; | |
bdb68f8c | 202 | } |
6d50f529 | 203 | |
204 | return sum; | |
bdb68f8c | 205 | |
206 | } |