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