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"
33 #include "AliMUONConstants.h"
36 ClassImp(AliMUONRawCluster)
40 //____________________________________________________
41 AliMUONRawCluster::AliMUONRawCluster()
48 fTracks[0]=fTracks[1]=fTracks[2]=-1;
49 for (int j=0;j<2;j++) {
57 for (int k=0;k<50;k++) {
64 fNcluster[0]=fNcluster[1]=-1;
65 fErrXY[0] = AliMUONConstants::DefaultNonBendingReso();
66 fErrXY[1] = AliMUONConstants::DefaultBendingReso();
69 //____________________________________________________
70 AliMUONRawCluster::~AliMUONRawCluster()
75 //____________________________________________________
76 void AliMUONRawCluster::SetDigitsId(Int_t nDigits, const UInt_t *digitsId)
78 /// Set the array of digit Id
79 /// if digitsId is not given the array is filled with id=0
81 fMultiplicity[0] = (nDigits < 50) ? nDigits : 50;
83 if (fMultiplicity[0] == 0) return;
85 for (Int_t i=0; i<fMultiplicity[0]; i++) fIndexMap[i][0] = 0;
87 for (Int_t i=0; i<fMultiplicity[0]; i++) fIndexMap[i][0] = (Int_t) digitsId[i];
90 //____________________________________________________
91 Int_t AliMUONRawCluster::Compare(const TObject *obj) const
96 AliMUONRawCluster *raw=(AliMUONRawCluster *)obj;
97 Float_t r=GetRadius();
98 Float_t ro=raw->GetRadius();
100 else if (r<ro) return -1;
104 AliMUONRawCluster *raw=(AliMUONRawCluster *)obj;
106 Float_t yo=raw->fY[0];
108 else if (y<yo) return -1;
112 const AliMUONRawCluster* raw = static_cast<const AliMUONRawCluster*>(obj);
113 if ( GetCharge() > raw->GetCharge() )
117 else if ( GetCharge() < raw->GetCharge() )
124 //____________________________________________________
125 Int_t AliMUONRawCluster::BinarySearch(Float_t y, TArrayF coord, Int_t from, Int_t upto)
127 /// Find object using a binary search. Array must first have been sorted.
128 /// Search can be limited by setting upto to desired index.
130 Int_t low=from, high=upto-1, half;
133 if(y>coord[half]) low=half;
138 //____________________________________________________
139 void AliMUONRawCluster::SortMin(Int_t *idx,Float_t *xdarray,Float_t *xarray,Float_t *yarray,Float_t *qarray, Int_t ntr)
141 /// Get the 3 closest points(cog) one can find on the second cathode
142 /// starting from a given cog on first cathode
145 // Loop over deltax, only 3 times
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};
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]);
197 //____________________________________________________
198 Int_t AliMUONRawCluster::PhysicsContribution() const
200 /// Evaluate physics contribution to cluster
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++;
209 if (iMixed==0 && iBg==0) {
211 } else if ((iPhys != 0 && iBg !=0) || iMixed != 0) {
218 //____________________________________________________
219 void AliMUONRawCluster::Print(Option_t* opt) const
222 /// Printing Raw Cluster (Rec Point) information
223 /// "full" option for printing all the information about the raw cluster
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(),
233 if ( sopt.Contains("FULL") )
235 cout << ", Hit=" << setw(4) << GetTrack(0) <<
236 ", Track1=" << setw(4) << GetTrack(1) <<
237 ", Track2=" << setw(4) << GetTrack(2);
242 //____________________________________________________
243 void AliMUONRawCluster::DumpIndex(void)
245 /// Dumping IdexMap of the cluster
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]);
255 //____________________________________________________
256 Int_t AliMUONRawCluster::AddCharge(Int_t i, Float_t Q)
258 /// Adding Q to the fQ value
265 //____________________________________________________
266 Int_t AliMUONRawCluster::AddX(Int_t i, Float_t X)
268 /// Adding X to the fX value
275 //____________________________________________________
276 Int_t AliMUONRawCluster::AddY(Int_t i, Float_t Y)
278 /// Adding Y to the fY value
285 //____________________________________________________
286 Int_t AliMUONRawCluster::AddZ(Int_t i, Float_t Z)
288 /// Adding Z to the fZ value
295 //____________________________________________________
296 Float_t AliMUONRawCluster::GetCharge(Int_t i) const
298 /// Getting the charge of the cluster
299 if (i==0 || i==1) return fQ[i];
302 //____________________________________________________
303 Float_t AliMUONRawCluster::GetX(Int_t i) const
305 /// Getting X value of the cluster
306 if (i==0 || i==1) return fX[i];
309 //____________________________________________________
310 Float_t AliMUONRawCluster::GetY(Int_t i) const
312 /// Getting Y value of the cluster
313 if (i==0 || i==1) return fY[i];
316 //____________________________________________________
317 Float_t AliMUONRawCluster::GetZ(Int_t i) const
319 /// Getting Z value of the cluster
320 if (i==0 || i==1) return fZ[i];
323 //____________________________________________________
324 Int_t AliMUONRawCluster::GetTrack(Int_t i) const
326 /// Getting track i contributing to the cluster
327 if (i==0 || i==1 || i==2) return fTracks[i];
330 //____________________________________________________
331 Float_t AliMUONRawCluster::GetPeakSignal(Int_t i) const
333 /// Getting cluster peaksignal
334 if (i==0 || i==1 ) return fPeakSignal[i];
337 //____________________________________________________
338 Int_t AliMUONRawCluster::GetMultiplicity(Int_t i) const
340 /// Getting cluster multiplicity
341 if (i==0 || i==1 ) return fMultiplicity[i];
344 //____________________________________________________
345 Int_t AliMUONRawCluster::GetClusterType() const
347 /// Getting Cluster Type
350 //____________________________________________________
351 Int_t AliMUONRawCluster::GetGhost() const
356 //____________________________________________________
357 Int_t AliMUONRawCluster::GetNcluster(Int_t i) const
359 /// Getting number of clusters
360 if (i==0 || i==1 ) return fNcluster[i];
363 //____________________________________________________
364 Float_t AliMUONRawCluster::GetChi2(Int_t i) const
366 /// Getting chi2 value of the cluster
367 if (i==0 || i==1) return fChi2[i];
370 //____________________________________________________
371 Int_t AliMUONRawCluster::SetCharge(Int_t i, Float_t Q)
373 /// Setting Charge of the cluster
380 //____________________________________________________
381 Int_t AliMUONRawCluster::SetX(Int_t i, Float_t X)
383 /// Setting X value of the cluster
390 //____________________________________________________
391 Int_t AliMUONRawCluster::SetY(Int_t i, Float_t Y)
393 /// Setting Y value of the cluster
400 //____________________________________________________
401 Int_t AliMUONRawCluster::SetZ(Int_t i, Float_t Z)
403 /// Setting Z value of the cluste
410 //____________________________________________________
411 Int_t AliMUONRawCluster::SetTrack(Int_t i, Int_t track)
413 /// Setting tracks contributing to the cluster
414 if (i==0 || i==1 || i==2) {
420 //____________________________________________________
421 Int_t AliMUONRawCluster::SetPeakSignal(Int_t i, Float_t peaksignal)
423 /// Setting PeakSignal of the cluster
425 fPeakSignal[i]=peaksignal;
430 //____________________________________________________
431 Int_t AliMUONRawCluster::SetMultiplicity(Int_t i, Int_t mul)
433 /// Setting multiplicity of the cluster
435 fMultiplicity[i]=mul;
440 //____________________________________________________
441 Int_t AliMUONRawCluster::SetClusterType(Int_t type)
443 /// Setting the cluster type
447 //____________________________________________________
448 Int_t AliMUONRawCluster::SetGhost(Int_t ghost)
450 /// Setting the ghost
454 //____________________________________________________
455 Int_t AliMUONRawCluster::SetNcluster(Int_t i, Int_t ncluster)
457 /// Setting number the cluster
459 fNcluster[i]=ncluster;
464 //____________________________________________________
465 Int_t AliMUONRawCluster::SetChi2(Int_t i, Float_t chi2)
467 /// Setting chi2 of the cluster