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