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"
35 ClassImp(AliMUONRawCluster)
39 //____________________________________________________
40 AliMUONRawCluster::AliMUONRawCluster()
47 fTracks[0]=fTracks[1]=fTracks[2]=-1;
48 for (int j=0;j<2;j++) {
56 for (int k=0;k<50;k++) {
63 fNcluster[0]=fNcluster[1]=-1;
68 //____________________________________________________
69 AliMUONRawCluster::~AliMUONRawCluster()
74 //____________________________________________________
75 void AliMUONRawCluster::SetDigitsId(Int_t nDigits, const UInt_t *digitsId)
77 /// Set the array of digit Id
78 /// if digitsId is not given the array is filled with id=0
80 fMultiplicity[0] = (nDigits < 50) ? nDigits : 50;
82 if (fMultiplicity[0] == 0) return;
84 for (Int_t i=0; i<fMultiplicity[0]; i++) fIndexMap[i][0] = 0;
86 for (Int_t i=0; i<fMultiplicity[0]; i++) fIndexMap[i][0] = (Int_t) digitsId[i];
89 //____________________________________________________
90 Int_t AliMUONRawCluster::Compare(const TObject *obj) const
95 AliMUONRawCluster *raw=(AliMUONRawCluster *)obj;
96 Float_t r=GetRadius();
97 Float_t ro=raw->GetRadius();
99 else if (r<ro) return -1;
103 AliMUONRawCluster *raw=(AliMUONRawCluster *)obj;
105 Float_t yo=raw->fY[0];
107 else if (y<yo) return -1;
111 const AliMUONRawCluster* raw = static_cast<const AliMUONRawCluster*>(obj);
112 if ( GetCharge() > raw->GetCharge() )
116 else if ( GetCharge() < raw->GetCharge() )
123 //____________________________________________________
124 Int_t AliMUONRawCluster::BinarySearch(Float_t y, TArrayF coord, Int_t from, Int_t upto)
126 /// Find object using a binary search. Array must first have been sorted.
127 /// Search can be limited by setting upto to desired index.
129 Int_t low=from, high=upto-1, half;
132 if(y>coord[half]) low=half;
137 //____________________________________________________
138 void AliMUONRawCluster::SortMin(Int_t *idx,Float_t *xdarray,Float_t *xarray,Float_t *yarray,Float_t *qarray, Int_t ntr)
140 /// Get the 3 closest points(cog) one can find on the second cathode
141 /// starting from a given cog on first cathode
144 // Loop over deltax, only 3 times
149 Int_t id[3] = {-2,-2,-2};
150 Float_t jx[3] = {0.,0.,0.};
151 Float_t jy[3] = {0.,0.,0.};
152 Float_t jq[3] = {0.,0.,0.};
153 Int_t jid[3] = {-2,-2,-2};
163 if ((i == 1 && j == id[i-1])
164 ||(i == 2 && (j == id[i-1] || j == id[i-2]))) continue;
165 if (TMath::Abs(xdarray[j]) < xmin) {
166 xmin = TMath::Abs(xdarray[j]);
196 //____________________________________________________
197 Int_t AliMUONRawCluster::PhysicsContribution() const
199 /// Evaluate physics contribution to cluster
203 for (Int_t i=0; i<fMultiplicity[0]; i++) {
204 if (fPhysicsMap[i]==2) iPhys++;
205 if (fPhysicsMap[i]==1) iMixed++;
206 if (fPhysicsMap[i]==0) iBg++;
208 if (iMixed==0 && iBg==0) {
210 } else if ((iPhys != 0 && iBg !=0) || iMixed != 0) {
217 //____________________________________________________
218 void AliMUONRawCluster::Print(Option_t* opt) const
221 /// Printing Raw Cluster (Rec Point) information
222 /// "full" option for printing all the information about the raw cluster
227 cout << Form("<AliMUONRawCluster>: DetEle=%4d (x,y,z)=(%7.4f,%7.4f,%7.4f) cm"
228 " Chi2=%7.2f Q=%7.2f",
229 GetDetElemId(),GetX(),GetY(),GetZ(),GetChi2(),
232 if ( sopt.Contains("FULL") )
234 cout << ", Hit=" << setw(4) << GetTrack(0) <<
235 ", Track1=" << setw(4) << GetTrack(1) <<
236 ", Track2=" << setw(4) << GetTrack(2);
241 //____________________________________________________
242 void AliMUONRawCluster::DumpIndex(void)
244 /// Dumping IdexMap of the cluster
246 for (Int_t icat=0;icat<2;icat++) {
247 printf ("Mult %d\n",fMultiplicity[icat]);
248 for (Int_t idig=0;idig<fMultiplicity[icat];idig++){
249 printf("Index %d",fIndexMap[idig][icat]);
254 //____________________________________________________
255 Int_t AliMUONRawCluster::AddCharge(Int_t i, Float_t Q)
257 /// Adding Q to the fQ value
264 //____________________________________________________
265 Int_t AliMUONRawCluster::AddX(Int_t i, Float_t X)
267 /// Adding X to the fX value
274 //____________________________________________________
275 Int_t AliMUONRawCluster::AddY(Int_t i, Float_t Y)
277 /// Adding Y to the fY value
284 //____________________________________________________
285 Int_t AliMUONRawCluster::AddZ(Int_t i, Float_t Z)
287 /// Adding Z to the fZ value
294 //____________________________________________________
295 Float_t AliMUONRawCluster::GetCharge(Int_t i) const
297 /// Getting the charge of the cluster
298 if (i==0 || i==1) return fQ[i];
301 //____________________________________________________
302 Float_t AliMUONRawCluster::GetX(Int_t i) const
304 /// Getting X value of the cluster
305 if (i==0 || i==1) return fX[i];
308 //____________________________________________________
309 Float_t AliMUONRawCluster::GetY(Int_t i) const
311 /// Getting Y value of the cluster
312 if (i==0 || i==1) return fY[i];
315 //____________________________________________________
316 Float_t AliMUONRawCluster::GetZ(Int_t i) const
318 /// Getting Z value of the cluster
319 if (i==0 || i==1) return fZ[i];
322 //____________________________________________________
323 Int_t AliMUONRawCluster::GetTrack(Int_t i) const
325 /// Getting track i contributing to the cluster
326 if (i==0 || i==1 || i==2) return fTracks[i];
329 //____________________________________________________
330 Float_t AliMUONRawCluster::GetPeakSignal(Int_t i) const
332 /// Getting cluster peaksignal
333 if (i==0 || i==1 ) return fPeakSignal[i];
336 //____________________________________________________
337 Int_t AliMUONRawCluster::GetMultiplicity(Int_t i) const
339 /// Getting cluster multiplicity
340 if (i==0 || i==1 ) return fMultiplicity[i];
343 //____________________________________________________
344 Int_t AliMUONRawCluster::GetClusterType() const
346 /// Getting Cluster Type
349 //____________________________________________________
350 Int_t AliMUONRawCluster::GetGhost() const
355 //____________________________________________________
356 Int_t AliMUONRawCluster::GetNcluster(Int_t i) const
358 /// Getting number of clusters
359 if (i==0 || i==1 ) return fNcluster[i];
362 //____________________________________________________
363 Float_t AliMUONRawCluster::GetChi2(Int_t i) const
365 /// Getting chi2 value of the cluster
366 if (i==0 || i==1) return fChi2[i];
369 //____________________________________________________
370 Int_t AliMUONRawCluster::SetCharge(Int_t i, Float_t Q)
372 /// Setting Charge of the cluster
379 //____________________________________________________
380 Int_t AliMUONRawCluster::SetX(Int_t i, Float_t X)
382 /// Setting X value of the cluster
389 //____________________________________________________
390 Int_t AliMUONRawCluster::SetY(Int_t i, Float_t Y)
392 /// Setting Y value of the cluster
399 //____________________________________________________
400 Int_t AliMUONRawCluster::SetZ(Int_t i, Float_t Z)
402 /// Setting Z value of the cluste
409 //____________________________________________________
410 Int_t AliMUONRawCluster::SetTrack(Int_t i, Int_t track)
412 /// Setting tracks contributing to the cluster
413 if (i==0 || i==1 || i==2) {
419 //____________________________________________________
420 Int_t AliMUONRawCluster::SetPeakSignal(Int_t i, Float_t peaksignal)
422 /// Setting PeakSignal of the cluster
424 fPeakSignal[i]=peaksignal;
429 //____________________________________________________
430 Int_t AliMUONRawCluster::SetMultiplicity(Int_t i, Int_t mul)
432 /// Setting multiplicity of the cluster
434 fMultiplicity[i]=mul;
439 //____________________________________________________
440 Int_t AliMUONRawCluster::SetClusterType(Int_t type)
442 /// Setting the cluster type
446 //____________________________________________________
447 Int_t AliMUONRawCluster::SetGhost(Int_t ghost)
449 /// Setting the ghost
453 //____________________________________________________
454 Int_t AliMUONRawCluster::SetNcluster(Int_t i, Int_t ncluster)
456 /// Setting number the cluster
458 fNcluster[i]=ncluster;
463 //____________________________________________________
464 Int_t AliMUONRawCluster::SetChi2(Int_t i, Float_t chi2)
466 /// Setting chi2 of the cluster