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