]>
Commit | Line | Data |
---|---|---|
a9e2aefa | 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$ */ |
a9e2aefa | 17 | |
3afdba21 | 18 | // Class for the MUON RecPoint |
19 | // It contains the propeorties of the physics cluters found in the tracking chambers | |
20 | // RawCluster contains also the information from the both cathode of the chambers. | |
21 | ||
22 | ||
a9e2aefa | 23 | #include "AliMUONRawCluster.h" |
a9e2aefa | 24 | #include <TArrayF.h> |
25 | ||
26 | ClassImp(AliMUONRawCluster); | |
27 | ||
28 | ||
29 | AliMUONRawCluster::AliMUONRawCluster() { | |
30 | // Constructor | |
31 | fTracks[0]=fTracks[1]=fTracks[2]=-1; | |
32 | for (int j=0;j<2;j++) { | |
33 | fQ[j]=0; | |
34 | fX[j]=0; | |
35 | fY[j]=0; | |
36 | fMultiplicity[j]=0; | |
37 | fPeakSignal[j]=-1; | |
38 | fChi2[j]=-1; | |
39 | ||
40 | for (int k=0;k<50;k++) { | |
41 | fIndexMap[k][j]=-1; | |
42 | fOffsetMap[k][j]=0; | |
43 | fContMap[k][j]=0; | |
44 | fPhysicsMap[k]=-1; | |
45 | } | |
46 | } | |
47 | fNcluster[0]=fNcluster[1]=-1; | |
07cfabcf | 48 | fGhost=0; |
a9e2aefa | 49 | } |
3afdba21 | 50 | //____________________________________________________ |
2a941f4e | 51 | Int_t AliMUONRawCluster::Compare(const TObject *obj) const |
a9e2aefa | 52 | { |
53 | /* | |
54 | AliMUONRawCluster *raw=(AliMUONRawCluster *)obj; | |
55 | Float_t r=GetRadius(); | |
56 | Float_t ro=raw->GetRadius(); | |
57 | if (r>ro) return 1; | |
58 | else if (r<ro) return -1; | |
59 | else return 0; | |
60 | */ | |
61 | AliMUONRawCluster *raw=(AliMUONRawCluster *)obj; | |
62 | Float_t y=fY[0]; | |
63 | Float_t yo=raw->fY[0]; | |
64 | if (y>yo) return 1; | |
65 | else if (y<yo) return -1; | |
66 | else return 0; | |
67 | ||
68 | } | |
3afdba21 | 69 | //____________________________________________________ |
70 | Int_t AliMUONRawCluster::BinarySearch(Float_t y, TArrayF coord, Int_t from, Int_t upto) | |
a9e2aefa | 71 | { |
72 | // Find object using a binary search. Array must first have been sorted. | |
73 | // Search can be limited by setting upto to desired index. | |
74 | ||
75 | Int_t low=from, high=upto-1, half; | |
76 | while(high-low>1) { | |
77 | half=(high+low)/2; | |
78 | if(y>coord[half]) low=half; | |
79 | else high=half; | |
80 | } | |
81 | return low; | |
82 | } | |
3afdba21 | 83 | //____________________________________________________ |
a9e2aefa | 84 | void AliMUONRawCluster::SortMin(Int_t *idx,Float_t *xdarray,Float_t *xarray,Float_t *yarray,Float_t *qarray, Int_t ntr) |
85 | { | |
86 | // | |
87 | // Get the 3 closest points(cog) one can find on the second cathode | |
88 | // starting from a given cog on first cathode | |
89 | // | |
90 | ||
91 | // | |
92 | // Loop over deltax, only 3 times | |
93 | // | |
94 | ||
95 | Float_t xmin; | |
96 | Int_t jmin; | |
97 | Int_t id[3] = {-2,-2,-2}; | |
98 | Float_t jx[3] = {0.,0.,0.}; | |
99 | Float_t jy[3] = {0.,0.,0.}; | |
100 | Float_t jq[3] = {0.,0.,0.}; | |
101 | Int_t jid[3] = {-2,-2,-2}; | |
102 | Int_t i,j,imax; | |
103 | ||
104 | if (ntr<3) imax=ntr; | |
105 | else imax=3; | |
106 | for(i=0;i<imax;i++){ | |
107 | xmin=1001.; | |
108 | jmin=0; | |
109 | ||
110 | for(j=0;j<ntr;j++){ | |
111 | if ((i == 1 && j == id[i-1]) | |
112 | ||(i == 2 && (j == id[i-1] || j == id[i-2]))) continue; | |
113 | if (TMath::Abs(xdarray[j]) < xmin) { | |
114 | xmin = TMath::Abs(xdarray[j]); | |
115 | jmin=j; | |
116 | } | |
117 | } // j | |
118 | if (xmin != 1001.) { | |
119 | id[i]=jmin; | |
120 | jx[i]=xarray[jmin]; | |
121 | jy[i]=yarray[jmin]; | |
122 | jq[i]=qarray[jmin]; | |
123 | jid[i]=idx[jmin]; | |
124 | } | |
125 | ||
126 | } // i | |
127 | ||
128 | for (i=0;i<3;i++){ | |
129 | if (jid[i] == -2) { | |
130 | xarray[i]=1001.; | |
131 | yarray[i]=1001.; | |
132 | qarray[i]=1001.; | |
133 | idx[i]=-1; | |
134 | } else { | |
135 | xarray[i]=jx[i]; | |
136 | yarray[i]=jy[i]; | |
137 | qarray[i]=jq[i]; | |
138 | idx[i]=jid[i]; | |
139 | } | |
140 | } | |
141 | ||
142 | } | |
143 | ||
3afdba21 | 144 | //____________________________________________________ |
145 | Int_t AliMUONRawCluster::PhysicsContribution() const | |
a9e2aefa | 146 | { |
147 | // Evaluate physics contribution to cluster | |
148 | Int_t iPhys=0; | |
149 | Int_t iBg=0; | |
150 | Int_t iMixed=0; | |
151 | for (Int_t i=0; i<fMultiplicity[0]; i++) { | |
152 | if (fPhysicsMap[i]==2) iPhys++; | |
153 | if (fPhysicsMap[i]==1) iMixed++; | |
154 | if (fPhysicsMap[i]==0) iBg++; | |
155 | } | |
156 | if (iMixed==0 && iBg==0) { | |
157 | return 2; | |
158 | } else if ((iPhys != 0 && iBg !=0) || iMixed != 0) { | |
159 | return 1; | |
160 | } else { | |
161 | return 0; | |
162 | } | |
163 | } | |
07cfabcf | 164 | |
3afdba21 | 165 | |
166 | ||
07cfabcf | 167 | //____________________________________________________ |
168 | void AliMUONRawCluster::DumpIndex(void) | |
169 | { | |
170 | printf ("-----\n"); | |
171 | for (Int_t icat=0;icat<2;icat++) { | |
172 | printf ("Mult %d\n",fMultiplicity[icat]); | |
173 | for (Int_t idig=0;idig<fMultiplicity[icat];idig++){ | |
174 | printf("Index %d",fIndexMap[idig][icat]); | |
175 | } | |
176 | printf("\n"); | |
177 | } | |
178 | } | |
3afdba21 | 179 | |
180 | //____________________________________________________ | |
181 | Int_t AliMUONRawCluster::AddCharge(Int_t i, Int_t Q) | |
182 | { | |
183 | if (i==0 || i==1) { | |
184 | fQ[i]+=Q; | |
185 | return 1; | |
186 | } | |
187 | else return 0; | |
188 | } | |
189 | //____________________________________________________ | |
190 | Int_t AliMUONRawCluster::AddX(Int_t i, Float_t X) | |
191 | { | |
192 | if (i==0 || i==1) { | |
193 | fX[i]+=X; | |
194 | return 1; | |
195 | } | |
196 | else return 0; | |
197 | } | |
198 | //____________________________________________________ | |
199 | Int_t AliMUONRawCluster::AddY(Int_t i, Float_t Y) | |
200 | { | |
201 | if (i==0 || i==1) { | |
202 | fY[i]+=Y; | |
203 | return 1; | |
204 | } | |
205 | else return 0; | |
206 | } | |
207 | //____________________________________________________ | |
208 | Int_t AliMUONRawCluster::AddZ(Int_t i, Float_t Z) | |
209 | { | |
210 | if (i==0 || i==1) { | |
211 | fZ[i]+=Z; | |
212 | return 1; | |
213 | } | |
214 | else return 0; | |
215 | } | |
216 | //____________________________________________________ | |
217 | Int_t AliMUONRawCluster::GetCharge(Int_t i) const | |
218 | { | |
219 | if (i==0 || i==1) return fQ[i]; | |
220 | else return 99999; | |
221 | } | |
222 | //____________________________________________________ | |
223 | Float_t AliMUONRawCluster::GetX(Int_t i) const | |
224 | { | |
225 | if (i==0 || i==1) return fX[i]; | |
226 | else return 99999.; | |
227 | } | |
228 | //____________________________________________________ | |
229 | Float_t AliMUONRawCluster::GetY(Int_t i) const | |
230 | { | |
231 | if (i==0 || i==1) return fY[i]; | |
232 | else return 99999.; | |
233 | } | |
234 | //____________________________________________________ | |
235 | Float_t AliMUONRawCluster::GetZ(Int_t i) const | |
236 | { | |
237 | if (i==0 || i==1) return fZ[i]; | |
238 | else return 99999.; | |
239 | } | |
9e993f2a | 240 | //____________________________________________________ |
241 | Int_t AliMUONRawCluster::GetTrack(Int_t i) const | |
242 | { | |
243 | if (i==0 || i==1 || i==2) return fTracks[i]; | |
244 | else return 99999; | |
245 | } | |
246 | //____________________________________________________ | |
247 | Int_t AliMUONRawCluster::GetPeakSignal(Int_t i) const | |
248 | { | |
249 | if (i==0 || i==1 ) return fPeakSignal[i]; | |
250 | else return 99999; | |
251 | } | |
252 | //____________________________________________________ | |
253 | Int_t AliMUONRawCluster::GetMultiplicity(Int_t i) const | |
254 | { | |
255 | if (i==0 || i==1 ) return fMultiplicity[i]; | |
256 | else return 99999; | |
257 | } | |
258 | //____________________________________________________ | |
259 | Int_t AliMUONRawCluster::GetClusterType() const | |
260 | { | |
261 | return fClusterType; | |
262 | } | |
263 | ||
3afdba21 | 264 | //____________________________________________________ |
265 | Int_t AliMUONRawCluster::SetCharge(Int_t i, Int_t Q) | |
266 | { | |
267 | if (i==0 || i==1) { | |
268 | fQ[i]=Q; | |
269 | return 1; | |
270 | } | |
271 | else return 0; | |
272 | } | |
273 | //____________________________________________________ | |
274 | Int_t AliMUONRawCluster::SetX(Int_t i, Float_t X) | |
275 | { | |
276 | if (i==0 || i==1) { | |
277 | fX[i]=X; | |
278 | return 1; | |
279 | } | |
280 | else return 0; | |
281 | } | |
282 | //____________________________________________________ | |
283 | Int_t AliMUONRawCluster::SetY(Int_t i, Float_t Y) | |
284 | { | |
285 | if (i==0 || i==1) { | |
286 | fY[i]=Y; | |
287 | return 1; | |
288 | } | |
289 | else return 0; | |
290 | } | |
291 | //____________________________________________________ | |
292 | Int_t AliMUONRawCluster::SetZ(Int_t i, Float_t Z) | |
293 | { | |
294 | if (i==0 || i==1) { | |
295 | fZ[i]=Z; | |
296 | return 1; | |
297 | } | |
298 | else return 0; | |
299 | } | |
9e993f2a | 300 | //____________________________________________________ |
301 | Int_t AliMUONRawCluster::SetTrack(Int_t i, Int_t track) | |
302 | { | |
303 | if (i==0 || i==1 || i==2) { | |
304 | fTracks[i]=track; | |
305 | return 1; | |
306 | } | |
307 | else return 0; | |
308 | } | |
309 | //____________________________________________________ | |
310 | Int_t AliMUONRawCluster::SetPeakSignal(Int_t i, Int_t peaksignal) | |
311 | { | |
312 | if (i==0 || i==1 ) { | |
313 | fPeakSignal[i]=peaksignal; | |
314 | return 1; | |
315 | } | |
316 | else return 0; | |
317 | } | |
318 | //____________________________________________________ | |
319 | Int_t AliMUONRawCluster::SetMultiplicity(Int_t i, Int_t mul) | |
320 | { | |
321 | if (i==0 || i==1 ) { | |
322 | fMultiplicity[i]=mul; | |
323 | return 1; | |
324 | } | |
325 | else return 0; | |
326 | } | |
327 | //____________________________________________________ | |
328 | Int_t AliMUONRawCluster::SetClusterType(Int_t type) | |
329 | { | |
330 | fClusterType=type; | |
331 | return 1; | |
332 | } |