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)
38 //____________________________________________________
39 AliMUONRawCluster::AliMUONRawCluster()
46 fTracks[0]=fTracks[1]=fTracks[2]=-1;
47 for (int j=0;j<2;j++) {
55 for (int k=0;k<50;k++) {
62 fNcluster[0]=fNcluster[1]=-1;
67 //____________________________________________________
68 AliMUONRawCluster::~AliMUONRawCluster()
73 //____________________________________________________
74 Int_t AliMUONRawCluster::Compare(const TObject *obj) const
79 AliMUONRawCluster *raw=(AliMUONRawCluster *)obj;
80 Float_t r=GetRadius();
81 Float_t ro=raw->GetRadius();
83 else if (r<ro) return -1;
87 AliMUONRawCluster *raw=(AliMUONRawCluster *)obj;
89 Float_t yo=raw->fY[0];
91 else if (y<yo) return -1;
95 const AliMUONRawCluster* raw = static_cast<const AliMUONRawCluster*>(obj);
96 if ( GetCharge(0) > raw->GetCharge(0) )
100 else if ( GetCharge(0) < raw->GetCharge(0) )
107 //____________________________________________________
108 Int_t AliMUONRawCluster::BinarySearch(Float_t y, TArrayF coord, Int_t from, Int_t upto)
110 /// Find object using a binary search. Array must first have been sorted.
111 /// Search can be limited by setting upto to desired index.
113 Int_t low=from, high=upto-1, half;
116 if(y>coord[half]) low=half;
121 //____________________________________________________
122 void AliMUONRawCluster::SortMin(Int_t *idx,Float_t *xdarray,Float_t *xarray,Float_t *yarray,Float_t *qarray, Int_t ntr)
124 /// Get the 3 closest points(cog) one can find on the second cathode
125 /// starting from a given cog on first cathode
128 // Loop over deltax, only 3 times
133 Int_t id[3] = {-2,-2,-2};
134 Float_t jx[3] = {0.,0.,0.};
135 Float_t jy[3] = {0.,0.,0.};
136 Float_t jq[3] = {0.,0.,0.};
137 Int_t jid[3] = {-2,-2,-2};
147 if ((i == 1 && j == id[i-1])
148 ||(i == 2 && (j == id[i-1] || j == id[i-2]))) continue;
149 if (TMath::Abs(xdarray[j]) < xmin) {
150 xmin = TMath::Abs(xdarray[j]);
180 //____________________________________________________
181 Int_t AliMUONRawCluster::PhysicsContribution() const
183 /// Evaluate physics contribution to cluster
187 for (Int_t i=0; i<fMultiplicity[0]; i++) {
188 if (fPhysicsMap[i]==2) iPhys++;
189 if (fPhysicsMap[i]==1) iMixed++;
190 if (fPhysicsMap[i]==0) iBg++;
192 if (iMixed==0 && iBg==0) {
194 } else if ((iPhys != 0 && iBg !=0) || iMixed != 0) {
201 //____________________________________________________
202 void AliMUONRawCluster::Print(Option_t* opt) const
205 /// Printing Raw Cluster (Rec Point) information
206 /// "full" option for printing all the information about the raw cluster
211 cout << Form("<AliMUONRawCluster>: DetEle=%4d (x,y,z)=(%7.4f,%7.4f,%7.4f) cm"
212 " Chi2=%7.2f Q=%7.2f",
213 GetDetElemId(),GetX(),GetY(),GetZ(),GetChi2(),
216 if ( sopt.Contains("FULL") )
218 cout << ", Hit=" << setw(4) << GetTrack(0) <<
219 ", Track1=" << setw(4) << GetTrack(1) <<
220 ", Track2=" << setw(4) << GetTrack(2);
225 //____________________________________________________
226 void AliMUONRawCluster::DumpIndex(void)
228 /// Dumping IdexMap of the cluster
230 for (Int_t icat=0;icat<2;icat++) {
231 printf ("Mult %d\n",fMultiplicity[icat]);
232 for (Int_t idig=0;idig<fMultiplicity[icat];idig++){
233 printf("Index %d",fIndexMap[idig][icat]);
238 //____________________________________________________
239 Int_t AliMUONRawCluster::AddCharge(Int_t i, Float_t Q)
241 /// Adding Q to the fQ value
248 //____________________________________________________
249 Int_t AliMUONRawCluster::AddX(Int_t i, Float_t X)
251 /// Adding X to the fX value
258 //____________________________________________________
259 Int_t AliMUONRawCluster::AddY(Int_t i, Float_t Y)
261 /// Adding Y to the fY value
268 //____________________________________________________
269 Int_t AliMUONRawCluster::AddZ(Int_t i, Float_t Z)
271 /// Adding Z to the fZ value
278 //____________________________________________________
279 Float_t AliMUONRawCluster::GetCharge(Int_t i) const
281 /// Getting the charge of the cluster
282 if (i==0 || i==1) return fQ[i];
285 //____________________________________________________
286 Float_t AliMUONRawCluster::GetX(Int_t i) const
288 /// Getting X value of the cluster
289 if (i==0 || i==1) return fX[i];
292 //____________________________________________________
293 Float_t AliMUONRawCluster::GetY(Int_t i) const
295 /// Getting Y value of the cluster
296 if (i==0 || i==1) return fY[i];
299 //____________________________________________________
300 Float_t AliMUONRawCluster::GetZ(Int_t i) const
302 /// Getting Z value of the cluster
303 if (i==0 || i==1) return fZ[i];
306 //____________________________________________________
307 Int_t AliMUONRawCluster::GetTrack(Int_t i) const
309 /// Getting track i contributing to the cluster
310 if (i==0 || i==1 || i==2) return fTracks[i];
313 //____________________________________________________
314 Float_t AliMUONRawCluster::GetPeakSignal(Int_t i) const
316 /// Getting cluster peaksignal
317 if (i==0 || i==1 ) return fPeakSignal[i];
320 //____________________________________________________
321 Int_t AliMUONRawCluster::GetMultiplicity(Int_t i) const
323 /// Getting cluster multiplicity
324 if (i==0 || i==1 ) return fMultiplicity[i];
327 //____________________________________________________
328 Int_t AliMUONRawCluster::GetClusterType() const
330 /// Getting Cluster Type
333 //____________________________________________________
334 Int_t AliMUONRawCluster::GetGhost() const
339 //____________________________________________________
340 Int_t AliMUONRawCluster::GetNcluster(Int_t i) const
342 /// Getting number of clusters
343 if (i==0 || i==1 ) return fNcluster[i];
346 //____________________________________________________
347 Float_t AliMUONRawCluster::GetChi2(Int_t i) const
349 /// Getting chi2 value of the cluster
350 if (i==0 || i==1) return fChi2[i];
353 //____________________________________________________
354 Int_t AliMUONRawCluster::SetCharge(Int_t i, Float_t Q)
356 /// Setting Charge of the cluster
363 //____________________________________________________
364 Int_t AliMUONRawCluster::SetX(Int_t i, Float_t X)
366 /// Setting X value of the cluster
373 //____________________________________________________
374 Int_t AliMUONRawCluster::SetY(Int_t i, Float_t Y)
376 /// Setting Y value of the cluster
383 //____________________________________________________
384 Int_t AliMUONRawCluster::SetZ(Int_t i, Float_t Z)
386 /// Setting Z value of the cluste
393 //____________________________________________________
394 Int_t AliMUONRawCluster::SetTrack(Int_t i, Int_t track)
396 /// Setting tracks contributing to the cluster
397 if (i==0 || i==1 || i==2) {
403 //____________________________________________________
404 Int_t AliMUONRawCluster::SetPeakSignal(Int_t i, Float_t peaksignal)
406 /// Setting PeakSignal of the cluster
408 fPeakSignal[i]=peaksignal;
413 //____________________________________________________
414 Int_t AliMUONRawCluster::SetMultiplicity(Int_t i, Int_t mul)
416 /// Setting multiplicity of the cluster
418 fMultiplicity[i]=mul;
423 //____________________________________________________
424 Int_t AliMUONRawCluster::SetClusterType(Int_t type)
426 /// Setting the cluster type
430 //____________________________________________________
431 Int_t AliMUONRawCluster::SetGhost(Int_t ghost)
433 /// Setting the ghost
437 //____________________________________________________
438 Int_t AliMUONRawCluster::SetNcluster(Int_t i, Int_t ncluster)
440 /// Setting number the cluster
442 fNcluster[i]=ncluster;
447 //____________________________________________________
448 Int_t AliMUONRawCluster::SetChi2(Int_t i, Float_t chi2)
450 /// Setting chi2 of the cluster