]>
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 | |
3d1463c8 | 18 | //----------------------------------------------------------------------------- |
d19b6003 | 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. |
3d1463c8 | 24 | //----------------------------------------------------------------------------- |
3afdba21 | 25 | |
6464217e | 26 | |
27 | #include "Riostream.h" | |
28 | ||
a9e2aefa | 29 | #include <TArrayF.h> |
6464217e | 30 | #include <TString.h> |
a9e2aefa | 31 | |
30178c30 | 32 | #include "AliMUONRawCluster.h" |
33 | ||
5398f946 | 34 | /// \cond CLASSIMP |
925e6570 | 35 | ClassImp(AliMUONRawCluster) |
5398f946 | 36 | /// \endcond |
a9e2aefa | 37 | |
2060b217 | 38 | |
71a2d3aa | 39 | //____________________________________________________ |
30178c30 | 40 | AliMUONRawCluster::AliMUONRawCluster() |
2060b217 | 41 | : AliMUONVCluster(), |
5398f946 | 42 | fClusterType(0), |
43 | fGhost(0), | |
44 | fDetElemId(0) | |
30178c30 | 45 | { |
d19b6003 | 46 | /// Constructor |
a9e2aefa | 47 | fTracks[0]=fTracks[1]=fTracks[2]=-1; |
48 | for (int j=0;j<2;j++) { | |
49 | fQ[j]=0; | |
50 | fX[j]=0; | |
51 | fY[j]=0; | |
492ee96b | 52 | fZ[j]=0; |
a9e2aefa | 53 | fMultiplicity[j]=0; |
54 | fPeakSignal[j]=-1; | |
55 | fChi2[j]=-1; | |
56 | ||
57 | for (int k=0;k<50;k++) { | |
58 | fIndexMap[k][j]=-1; | |
59 | fOffsetMap[k][j]=0; | |
60 | fContMap[k][j]=0; | |
61 | fPhysicsMap[k]=-1; | |
62 | } | |
63 | } | |
64 | fNcluster[0]=fNcluster[1]=-1; | |
35be7ed7 | 65 | fErrXY[0] = FLT_MAX; |
66 | fErrXY[1] = FLT_MAX; | |
a9e2aefa | 67 | } |
71a2d3aa | 68 | |
69 | //____________________________________________________ | |
70 | AliMUONRawCluster::~AliMUONRawCluster() | |
71 | { | |
72 | /// Destructor | |
73 | } | |
74 | ||
2060b217 | 75 | //____________________________________________________ |
76 | void AliMUONRawCluster::SetDigitsId(Int_t nDigits, const UInt_t *digitsId) | |
77 | { | |
78 | /// Set the array of digit Id | |
79 | /// if digitsId is not given the array is filled with id=0 | |
80 | ||
81 | fMultiplicity[0] = (nDigits < 50) ? nDigits : 50; | |
82 | ||
83 | if (fMultiplicity[0] == 0) return; | |
84 | if (digitsId == 0) | |
85 | for (Int_t i=0; i<fMultiplicity[0]; i++) fIndexMap[i][0] = 0; | |
86 | else | |
87 | for (Int_t i=0; i<fMultiplicity[0]; i++) fIndexMap[i][0] = (Int_t) digitsId[i]; | |
88 | } | |
89 | ||
3afdba21 | 90 | //____________________________________________________ |
2a941f4e | 91 | Int_t AliMUONRawCluster::Compare(const TObject *obj) const |
a9e2aefa | 92 | { |
d19b6003 | 93 | /// Compare |
94 | ||
a9e2aefa | 95 | /* |
96 | AliMUONRawCluster *raw=(AliMUONRawCluster *)obj; | |
97 | Float_t r=GetRadius(); | |
98 | Float_t ro=raw->GetRadius(); | |
99 | if (r>ro) return 1; | |
100 | else if (r<ro) return -1; | |
101 | else return 0; | |
102 | */ | |
deca4734 | 103 | /* |
a9e2aefa | 104 | AliMUONRawCluster *raw=(AliMUONRawCluster *)obj; |
105 | Float_t y=fY[0]; | |
106 | Float_t yo=raw->fY[0]; | |
107 | if (y>yo) return 1; | |
108 | else if (y<yo) return -1; | |
109 | else return 0; | |
deca4734 | 110 | */ |
111 | ||
112 | const AliMUONRawCluster* raw = static_cast<const AliMUONRawCluster*>(obj); | |
2060b217 | 113 | if ( GetCharge() > raw->GetCharge() ) |
deca4734 | 114 | { |
115 | return 1; | |
116 | } | |
2060b217 | 117 | else if ( GetCharge() < raw->GetCharge() ) |
deca4734 | 118 | { |
119 | return -1; | |
120 | } | |
121 | return 0; | |
a9e2aefa | 122 | } |
deca4734 | 123 | |
3afdba21 | 124 | //____________________________________________________ |
125 | Int_t AliMUONRawCluster::BinarySearch(Float_t y, TArrayF coord, Int_t from, Int_t upto) | |
a9e2aefa | 126 | { |
d19b6003 | 127 | /// Find object using a binary search. Array must first have been sorted. |
128 | /// Search can be limited by setting upto to desired index. | |
a9e2aefa | 129 | |
130 | Int_t low=from, high=upto-1, half; | |
131 | while(high-low>1) { | |
132 | half=(high+low)/2; | |
133 | if(y>coord[half]) low=half; | |
134 | else high=half; | |
135 | } | |
136 | return low; | |
137 | } | |
3afdba21 | 138 | //____________________________________________________ |
a9e2aefa | 139 | void AliMUONRawCluster::SortMin(Int_t *idx,Float_t *xdarray,Float_t *xarray,Float_t *yarray,Float_t *qarray, Int_t ntr) |
140 | { | |
d19b6003 | 141 | /// Get the 3 closest points(cog) one can find on the second cathode |
142 | /// starting from a given cog on first cathode | |
a9e2aefa | 143 | |
144 | // | |
145 | // Loop over deltax, only 3 times | |
146 | // | |
147 | ||
148 | Float_t xmin; | |
149 | Int_t jmin; | |
150 | Int_t id[3] = {-2,-2,-2}; | |
151 | Float_t jx[3] = {0.,0.,0.}; | |
152 | Float_t jy[3] = {0.,0.,0.}; | |
153 | Float_t jq[3] = {0.,0.,0.}; | |
154 | Int_t jid[3] = {-2,-2,-2}; | |
155 | Int_t i,j,imax; | |
156 | ||
157 | if (ntr<3) imax=ntr; | |
158 | else imax=3; | |
159 | for(i=0;i<imax;i++){ | |
160 | xmin=1001.; | |
161 | jmin=0; | |
162 | ||
163 | for(j=0;j<ntr;j++){ | |
164 | if ((i == 1 && j == id[i-1]) | |
165 | ||(i == 2 && (j == id[i-1] || j == id[i-2]))) continue; | |
166 | if (TMath::Abs(xdarray[j]) < xmin) { | |
167 | xmin = TMath::Abs(xdarray[j]); | |
168 | jmin=j; | |
169 | } | |
170 | } // j | |
171 | if (xmin != 1001.) { | |
172 | id[i]=jmin; | |
173 | jx[i]=xarray[jmin]; | |
174 | jy[i]=yarray[jmin]; | |
175 | jq[i]=qarray[jmin]; | |
176 | jid[i]=idx[jmin]; | |
177 | } | |
178 | ||
179 | } // i | |
180 | ||
181 | for (i=0;i<3;i++){ | |
182 | if (jid[i] == -2) { | |
183 | xarray[i]=1001.; | |
184 | yarray[i]=1001.; | |
185 | qarray[i]=1001.; | |
186 | idx[i]=-1; | |
187 | } else { | |
188 | xarray[i]=jx[i]; | |
189 | yarray[i]=jy[i]; | |
190 | qarray[i]=jq[i]; | |
191 | idx[i]=jid[i]; | |
192 | } | |
193 | } | |
194 | ||
195 | } | |
196 | ||
3afdba21 | 197 | //____________________________________________________ |
198 | Int_t AliMUONRawCluster::PhysicsContribution() const | |
a9e2aefa | 199 | { |
d19b6003 | 200 | /// Evaluate physics contribution to cluster |
a9e2aefa | 201 | Int_t iPhys=0; |
202 | Int_t iBg=0; | |
203 | Int_t iMixed=0; | |
204 | for (Int_t i=0; i<fMultiplicity[0]; i++) { | |
205 | if (fPhysicsMap[i]==2) iPhys++; | |
206 | if (fPhysicsMap[i]==1) iMixed++; | |
207 | if (fPhysicsMap[i]==0) iBg++; | |
208 | } | |
209 | if (iMixed==0 && iBg==0) { | |
210 | return 2; | |
211 | } else if ((iPhys != 0 && iBg !=0) || iMixed != 0) { | |
212 | return 1; | |
213 | } else { | |
214 | return 0; | |
215 | } | |
216 | } | |
6464217e | 217 | |
218 | //____________________________________________________ | |
219 | void AliMUONRawCluster::Print(Option_t* opt) const | |
220 | { | |
71a2d3aa | 221 | /// |
222 | /// Printing Raw Cluster (Rec Point) information | |
223 | /// "full" option for printing all the information about the raw cluster | |
224 | /// | |
6464217e | 225 | TString sopt(opt); |
226 | sopt.ToUpper(); | |
227 | ||
deca4734 | 228 | cout << Form("<AliMUONRawCluster>: DetEle=%4d (x,y,z)=(%7.4f,%7.4f,%7.4f) cm" |
229 | " Chi2=%7.2f Q=%7.2f", | |
230 | GetDetElemId(),GetX(),GetY(),GetZ(),GetChi2(), | |
231 | GetCharge()); | |
232 | ||
af344e5a | 233 | if ( sopt.Contains("FULL") ) |
234 | { | |
235 | cout << ", Hit=" << setw(4) << GetTrack(0) << | |
236 | ", Track1=" << setw(4) << GetTrack(1) << | |
237 | ", Track2=" << setw(4) << GetTrack(2); | |
6464217e | 238 | } |
af344e5a | 239 | cout << endl; |
6464217e | 240 | } |
af344e5a | 241 | |
07cfabcf | 242 | //____________________________________________________ |
243 | void AliMUONRawCluster::DumpIndex(void) | |
244 | { | |
d19b6003 | 245 | /// Dumping IdexMap of the cluster |
07cfabcf | 246 | printf ("-----\n"); |
247 | for (Int_t icat=0;icat<2;icat++) { | |
248 | printf ("Mult %d\n",fMultiplicity[icat]); | |
249 | for (Int_t idig=0;idig<fMultiplicity[icat];idig++){ | |
250 | printf("Index %d",fIndexMap[idig][icat]); | |
251 | } | |
252 | printf("\n"); | |
253 | } | |
254 | } | |
3afdba21 | 255 | //____________________________________________________ |
45dd3605 | 256 | Int_t AliMUONRawCluster::AddCharge(Int_t i, Float_t Q) |
3afdba21 | 257 | { |
d19b6003 | 258 | /// Adding Q to the fQ value |
3afdba21 | 259 | if (i==0 || i==1) { |
260 | fQ[i]+=Q; | |
261 | return 1; | |
262 | } | |
263 | else return 0; | |
264 | } | |
265 | //____________________________________________________ | |
266 | Int_t AliMUONRawCluster::AddX(Int_t i, Float_t X) | |
267 | { | |
d19b6003 | 268 | /// Adding X to the fX value |
3afdba21 | 269 | if (i==0 || i==1) { |
270 | fX[i]+=X; | |
271 | return 1; | |
272 | } | |
273 | else return 0; | |
274 | } | |
275 | //____________________________________________________ | |
276 | Int_t AliMUONRawCluster::AddY(Int_t i, Float_t Y) | |
277 | { | |
d19b6003 | 278 | /// Adding Y to the fY value |
3afdba21 | 279 | if (i==0 || i==1) { |
280 | fY[i]+=Y; | |
281 | return 1; | |
282 | } | |
283 | else return 0; | |
284 | } | |
285 | //____________________________________________________ | |
286 | Int_t AliMUONRawCluster::AddZ(Int_t i, Float_t Z) | |
287 | { | |
d19b6003 | 288 | /// Adding Z to the fZ value |
3afdba21 | 289 | if (i==0 || i==1) { |
290 | fZ[i]+=Z; | |
291 | return 1; | |
292 | } | |
293 | else return 0; | |
294 | } | |
295 | //____________________________________________________ | |
45dd3605 | 296 | Float_t AliMUONRawCluster::GetCharge(Int_t i) const |
3afdba21 | 297 | { |
d19b6003 | 298 | /// Getting the charge of the cluster |
3afdba21 | 299 | if (i==0 || i==1) return fQ[i]; |
300 | else return 99999; | |
301 | } | |
302 | //____________________________________________________ | |
303 | Float_t AliMUONRawCluster::GetX(Int_t i) const | |
304 | { | |
d19b6003 | 305 | /// Getting X value of the cluster |
3afdba21 | 306 | if (i==0 || i==1) return fX[i]; |
307 | else return 99999.; | |
308 | } | |
309 | //____________________________________________________ | |
310 | Float_t AliMUONRawCluster::GetY(Int_t i) const | |
311 | { | |
d19b6003 | 312 | /// Getting Y value of the cluster |
3afdba21 | 313 | if (i==0 || i==1) return fY[i]; |
314 | else return 99999.; | |
315 | } | |
316 | //____________________________________________________ | |
317 | Float_t AliMUONRawCluster::GetZ(Int_t i) const | |
318 | { | |
d19b6003 | 319 | /// Getting Z value of the cluster |
3afdba21 | 320 | if (i==0 || i==1) return fZ[i]; |
321 | else return 99999.; | |
322 | } | |
9e993f2a | 323 | //____________________________________________________ |
324 | Int_t AliMUONRawCluster::GetTrack(Int_t i) const | |
325 | { | |
d19b6003 | 326 | /// Getting track i contributing to the cluster |
9e993f2a | 327 | if (i==0 || i==1 || i==2) return fTracks[i]; |
328 | else return 99999; | |
329 | } | |
330 | //____________________________________________________ | |
45dd3605 | 331 | Float_t AliMUONRawCluster::GetPeakSignal(Int_t i) const |
9e993f2a | 332 | { |
d19b6003 | 333 | /// Getting cluster peaksignal |
9e993f2a | 334 | if (i==0 || i==1 ) return fPeakSignal[i]; |
335 | else return 99999; | |
336 | } | |
337 | //____________________________________________________ | |
338 | Int_t AliMUONRawCluster::GetMultiplicity(Int_t i) const | |
339 | { | |
d19b6003 | 340 | /// Getting cluster multiplicity |
9e993f2a | 341 | if (i==0 || i==1 ) return fMultiplicity[i]; |
342 | else return 99999; | |
343 | } | |
344 | //____________________________________________________ | |
345 | Int_t AliMUONRawCluster::GetClusterType() const | |
346 | { | |
d19b6003 | 347 | /// Getting Cluster Type |
9e993f2a | 348 | return fClusterType; |
349 | } | |
3b5272e3 | 350 | //____________________________________________________ |
351 | Int_t AliMUONRawCluster::GetGhost() const | |
352 | { | |
d19b6003 | 353 | /// Getting Ghost |
3b5272e3 | 354 | return fGhost; |
355 | } | |
356 | //____________________________________________________ | |
357 | Int_t AliMUONRawCluster::GetNcluster(Int_t i) const | |
358 | { | |
d19b6003 | 359 | /// Getting number of clusters |
3b5272e3 | 360 | if (i==0 || i==1 ) return fNcluster[i]; |
361 | else return 99999; | |
362 | } | |
363 | //____________________________________________________ | |
364 | Float_t AliMUONRawCluster::GetChi2(Int_t i) const | |
365 | { | |
d19b6003 | 366 | /// Getting chi2 value of the cluster |
3b5272e3 | 367 | if (i==0 || i==1) return fChi2[i]; |
368 | else return 99999.; | |
369 | } | |
3afdba21 | 370 | //____________________________________________________ |
45dd3605 | 371 | Int_t AliMUONRawCluster::SetCharge(Int_t i, Float_t Q) |
3afdba21 | 372 | { |
d19b6003 | 373 | /// Setting Charge of the cluster |
3afdba21 | 374 | if (i==0 || i==1) { |
375 | fQ[i]=Q; | |
376 | return 1; | |
377 | } | |
378 | else return 0; | |
379 | } | |
380 | //____________________________________________________ | |
381 | Int_t AliMUONRawCluster::SetX(Int_t i, Float_t X) | |
382 | { | |
d19b6003 | 383 | /// Setting X value of the cluster |
3afdba21 | 384 | if (i==0 || i==1) { |
385 | fX[i]=X; | |
386 | return 1; | |
387 | } | |
388 | else return 0; | |
389 | } | |
390 | //____________________________________________________ | |
391 | Int_t AliMUONRawCluster::SetY(Int_t i, Float_t Y) | |
392 | { | |
d19b6003 | 393 | /// Setting Y value of the cluster |
3afdba21 | 394 | if (i==0 || i==1) { |
395 | fY[i]=Y; | |
396 | return 1; | |
397 | } | |
398 | else return 0; | |
399 | } | |
400 | //____________________________________________________ | |
401 | Int_t AliMUONRawCluster::SetZ(Int_t i, Float_t Z) | |
402 | { | |
d19b6003 | 403 | /// Setting Z value of the cluste |
3afdba21 | 404 | if (i==0 || i==1) { |
405 | fZ[i]=Z; | |
406 | return 1; | |
407 | } | |
408 | else return 0; | |
409 | } | |
9e993f2a | 410 | //____________________________________________________ |
411 | Int_t AliMUONRawCluster::SetTrack(Int_t i, Int_t track) | |
412 | { | |
d19b6003 | 413 | /// Setting tracks contributing to the cluster |
9e993f2a | 414 | if (i==0 || i==1 || i==2) { |
415 | fTracks[i]=track; | |
416 | return 1; | |
417 | } | |
418 | else return 0; | |
419 | } | |
420 | //____________________________________________________ | |
45dd3605 | 421 | Int_t AliMUONRawCluster::SetPeakSignal(Int_t i, Float_t peaksignal) |
9e993f2a | 422 | { |
d19b6003 | 423 | /// Setting PeakSignal of the cluster |
9e993f2a | 424 | if (i==0 || i==1 ) { |
425 | fPeakSignal[i]=peaksignal; | |
426 | return 1; | |
427 | } | |
428 | else return 0; | |
429 | } | |
430 | //____________________________________________________ | |
431 | Int_t AliMUONRawCluster::SetMultiplicity(Int_t i, Int_t mul) | |
432 | { | |
d19b6003 | 433 | /// Setting multiplicity of the cluster |
9e993f2a | 434 | if (i==0 || i==1 ) { |
435 | fMultiplicity[i]=mul; | |
436 | return 1; | |
437 | } | |
438 | else return 0; | |
439 | } | |
440 | //____________________________________________________ | |
441 | Int_t AliMUONRawCluster::SetClusterType(Int_t type) | |
442 | { | |
d19b6003 | 443 | /// Setting the cluster type |
9e993f2a | 444 | fClusterType=type; |
445 | return 1; | |
446 | } | |
3b5272e3 | 447 | //____________________________________________________ |
448 | Int_t AliMUONRawCluster::SetGhost(Int_t ghost) | |
449 | { | |
d19b6003 | 450 | /// Setting the ghost |
3b5272e3 | 451 | fGhost=ghost; |
452 | return 1; | |
453 | } | |
454 | //____________________________________________________ | |
455 | Int_t AliMUONRawCluster::SetNcluster(Int_t i, Int_t ncluster) | |
456 | { | |
d19b6003 | 457 | /// Setting number the cluster |
3b5272e3 | 458 | if (i==0 || i==1 ) { |
459 | fNcluster[i]=ncluster; | |
460 | return 1; | |
461 | } | |
462 | else return 0; | |
463 | } | |
464 | //____________________________________________________ | |
465 | Int_t AliMUONRawCluster::SetChi2(Int_t i, Float_t chi2) | |
466 | { | |
d19b6003 | 467 | /// Setting chi2 of the cluster |
3b5272e3 | 468 | if (i==0 || i==1) { |
469 | fChi2[i]=chi2; | |
470 | return 1; | |
471 | } | |
472 | else return 0; | |
473 | } | |
b137f8b9 | 474 | |
2060b217 | 475 |