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