1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
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 //-----------------------------------------------------------------------------
27 #include "Riostream.h"
32 #include "AliMUONRawCluster.h"
38 ClassImp(AliMUONRawCluster)
42 //____________________________________________________
43 AliMUONRawCluster::AliMUONRawCluster()
50 fTracks[0]=fTracks[1]=fTracks[2]=-1;
51 for (int j=0;j<2;j++) {
60 for (int k=0;k<50;k++) {
67 fNcluster[0]=fNcluster[1]=-1;
72 //____________________________________________________
73 AliMUONRawCluster::~AliMUONRawCluster()
78 //____________________________________________________
79 void AliMUONRawCluster::SetDigitsId(Int_t nDigits, const UInt_t *digitsId)
81 /// Set the array of digit Id
82 /// if digitsId is not given the array is filled with id=0
84 fMultiplicity[0] = (nDigits < 50) ? nDigits : 50;
86 if (fMultiplicity[0] == 0) return;
88 for (Int_t i=0; i<fMultiplicity[0]; i++) fIndexMap[i][0] = 0;
90 for (Int_t i=0; i<fMultiplicity[0]; i++) fIndexMap[i][0] = (Int_t) digitsId[i];
93 //____________________________________________________
94 Int_t AliMUONRawCluster::Compare(const TObject *obj) const
99 AliMUONRawCluster *raw=(AliMUONRawCluster *)obj;
100 Float_t r=GetRadius();
101 Float_t ro=raw->GetRadius();
103 else if (r<ro) return -1;
107 AliMUONRawCluster *raw=(AliMUONRawCluster *)obj;
109 Float_t yo=raw->fY[0];
111 else if (y<yo) return -1;
115 const AliMUONRawCluster* raw = static_cast<const AliMUONRawCluster*>(obj);
116 if ( GetCharge() > raw->GetCharge() )
120 else if ( GetCharge() < raw->GetCharge() )
127 //____________________________________________________
128 Int_t AliMUONRawCluster::BinarySearch(Float_t y, TArrayF coord, Int_t from, Int_t upto)
130 /// Find object using a binary search. Array must first have been sorted.
131 /// Search can be limited by setting upto to desired index.
133 Int_t low=from, high=upto-1, half;
136 if(y>coord[half]) low=half;
141 //____________________________________________________
142 void AliMUONRawCluster::SortMin(Int_t *idx,Float_t *xdarray,Float_t *xarray,Float_t *yarray,Float_t *qarray, Int_t ntr)
144 /// Get the 3 closest points(cog) one can find on the second cathode
145 /// starting from a given cog on first cathode
148 // Loop over deltax, only 3 times
153 Int_t id[3] = {-2,-2,-2};
154 Float_t jx[3] = {0.,0.,0.};
155 Float_t jy[3] = {0.,0.,0.};
156 Float_t jq[3] = {0.,0.,0.};
157 Int_t jid[3] = {-2,-2,-2};
167 if ((i == 1 && j == id[i-1])
168 ||(i == 2 && (j == id[i-1] || j == id[i-2]))) continue;
169 if (TMath::Abs(xdarray[j]) < xmin) {
170 xmin = TMath::Abs(xdarray[j]);
200 //____________________________________________________
201 Int_t AliMUONRawCluster::PhysicsContribution() const
203 /// Evaluate physics contribution to cluster
207 for (Int_t i=0; i<fMultiplicity[0]; i++) {
208 if (fPhysicsMap[i]==2) iPhys++;
209 if (fPhysicsMap[i]==1) iMixed++;
210 if (fPhysicsMap[i]==0) iBg++;
212 if (iMixed==0 && iBg==0) {
214 } else if ((iPhys != 0 && iBg !=0) || iMixed != 0) {
221 //____________________________________________________
222 void AliMUONRawCluster::Print(Option_t* opt) const
225 /// Printing Raw Cluster (Rec Point) information
226 /// "full" option for printing all the information about the raw cluster
231 cout << Form("<AliMUONRawCluster>: DetEle=%4d (x,y,z)=(%7.4f,%7.4f,%7.4f) cm"
232 " Chi2=%7.2f Q=%7.2f",
233 GetDetElemId(),GetX(),GetY(),GetZ(),GetChi2(),
236 if ( sopt.Contains("FULL") )
238 cout << ", Hit=" << setw(4) << GetTrack(0) <<
239 ", Track1=" << setw(4) << GetTrack(1) <<
240 ", Track2=" << setw(4) << GetTrack(2);
245 //____________________________________________________
246 void AliMUONRawCluster::DumpIndex(void)
248 /// Dumping IdexMap of the cluster
250 for (Int_t icat=0;icat<2;icat++) {
251 printf ("Mult %d\n",fMultiplicity[icat]);
252 for (Int_t idig=0;idig<fMultiplicity[icat];idig++){
253 printf("Index %d",fIndexMap[idig][icat]);
258 //____________________________________________________
259 Int_t AliMUONRawCluster::AddCharge(Int_t i, Float_t Q)
261 /// Adding Q to the fQ value
268 //____________________________________________________
269 Int_t AliMUONRawCluster::AddX(Int_t i, Float_t X)
271 /// Adding X to the fX value
278 //____________________________________________________
279 Int_t AliMUONRawCluster::AddY(Int_t i, Float_t Y)
281 /// Adding Y to the fY value
288 //____________________________________________________
289 Int_t AliMUONRawCluster::AddZ(Int_t i, Float_t Z)
291 /// Adding Z to the fZ value
298 //____________________________________________________
299 Float_t AliMUONRawCluster::GetCharge(Int_t i) const
301 /// Getting the charge of the cluster
302 if (i==0 || i==1) return fQ[i];
305 //____________________________________________________
306 Float_t AliMUONRawCluster::GetX(Int_t i) const
308 /// Getting X value of the cluster
309 if (i==0 || i==1) return fX[i];
312 //____________________________________________________
313 Float_t AliMUONRawCluster::GetY(Int_t i) const
315 /// Getting Y value of the cluster
316 if (i==0 || i==1) return fY[i];
319 //____________________________________________________
320 Float_t AliMUONRawCluster::GetZ(Int_t i) const
322 /// Getting Z value of the cluster
323 if (i==0 || i==1) return fZ[i];
326 //____________________________________________________
327 Int_t AliMUONRawCluster::GetTrack(Int_t i) const
329 /// Getting track i contributing to the cluster
330 if (i==0 || i==1 || i==2) return fTracks[i];
333 //____________________________________________________
334 Float_t AliMUONRawCluster::GetPeakSignal(Int_t i) const
336 /// Getting cluster peaksignal
337 if (i==0 || i==1 ) return fPeakSignal[i];
340 //____________________________________________________
341 Int_t AliMUONRawCluster::GetMultiplicity(Int_t i) const
343 /// Getting cluster multiplicity
344 if (i==0 || i==1 ) return fMultiplicity[i];
347 //____________________________________________________
348 Int_t AliMUONRawCluster::GetClusterType() const
350 /// Getting Cluster Type
353 //____________________________________________________
354 Int_t AliMUONRawCluster::GetGhost() const
359 //____________________________________________________
360 Int_t AliMUONRawCluster::GetNcluster(Int_t i) const
362 /// Getting number of clusters
363 if (i==0 || i==1 ) return fNcluster[i];
366 //____________________________________________________
367 Float_t AliMUONRawCluster::GetChi2(Int_t i) const
369 /// Getting chi2 value of the cluster
370 if (i==0 || i==1) return fChi2[i];
373 //____________________________________________________
374 Int_t AliMUONRawCluster::SetCharge(Int_t i, Float_t Q)
376 /// Setting Charge of the cluster
383 //____________________________________________________
384 Int_t AliMUONRawCluster::SetX(Int_t i, Float_t X)
386 /// Setting X value of the cluster
393 //____________________________________________________
394 Int_t AliMUONRawCluster::SetY(Int_t i, Float_t Y)
396 /// Setting Y value of the cluster
403 //____________________________________________________
404 Int_t AliMUONRawCluster::SetZ(Int_t i, Float_t Z)
406 /// Setting Z value of the cluste
413 //____________________________________________________
414 Int_t AliMUONRawCluster::SetTrack(Int_t i, Int_t track)
416 /// Setting tracks contributing to the cluster
417 if (i==0 || i==1 || i==2) {
423 //____________________________________________________
424 Int_t AliMUONRawCluster::SetPeakSignal(Int_t i, Float_t peaksignal)
426 /// Setting PeakSignal of the cluster
428 fPeakSignal[i]=peaksignal;
433 //____________________________________________________
434 Int_t AliMUONRawCluster::SetMultiplicity(Int_t i, Int_t mul)
436 /// Setting multiplicity of the cluster
438 fMultiplicity[i]=mul;
443 //____________________________________________________
444 Int_t AliMUONRawCluster::SetClusterType(Int_t type)
446 /// Setting the cluster type
450 //____________________________________________________
451 Int_t AliMUONRawCluster::SetGhost(Int_t ghost)
453 /// Setting the ghost
457 //____________________________________________________
458 Int_t AliMUONRawCluster::SetNcluster(Int_t i, Int_t ncluster)
460 /// Setting number the cluster
462 fNcluster[i]=ncluster;
467 //____________________________________________________
468 Int_t AliMUONRawCluster::SetChi2(Int_t i, Float_t chi2)
470 /// Setting chi2 of the cluster