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