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 // Class for the MUON RecPoint
19 // It contains the propeorties of the physics cluters found in the tracking chambers
20 // RawCluster contains also the information from the both cathode of the chambers.
23 #include "AliMUONRawCluster.h"
26 ClassImp(AliMUONRawCluster);
29 AliMUONRawCluster::AliMUONRawCluster() {
31 fTracks[0]=fTracks[1]=fTracks[2]=-1;
32 for (int j=0;j<2;j++) {
40 for (int k=0;k<50;k++) {
47 fNcluster[0]=fNcluster[1]=-1;
50 //____________________________________________________
51 Int_t AliMUONRawCluster::Compare(const TObject *obj) const
54 AliMUONRawCluster *raw=(AliMUONRawCluster *)obj;
55 Float_t r=GetRadius();
56 Float_t ro=raw->GetRadius();
58 else if (r<ro) return -1;
61 AliMUONRawCluster *raw=(AliMUONRawCluster *)obj;
63 Float_t yo=raw->fY[0];
65 else if (y<yo) return -1;
69 //____________________________________________________
70 Int_t AliMUONRawCluster::BinarySearch(Float_t y, TArrayF coord, Int_t from, Int_t upto)
72 // Find object using a binary search. Array must first have been sorted.
73 // Search can be limited by setting upto to desired index.
75 Int_t low=from, high=upto-1, half;
78 if(y>coord[half]) low=half;
83 //____________________________________________________
84 void AliMUONRawCluster::SortMin(Int_t *idx,Float_t *xdarray,Float_t *xarray,Float_t *yarray,Float_t *qarray, Int_t ntr)
87 // Get the 3 closest points(cog) one can find on the second cathode
88 // starting from a given cog on first cathode
92 // Loop over deltax, only 3 times
97 Int_t id[3] = {-2,-2,-2};
98 Float_t jx[3] = {0.,0.,0.};
99 Float_t jy[3] = {0.,0.,0.};
100 Float_t jq[3] = {0.,0.,0.};
101 Int_t jid[3] = {-2,-2,-2};
111 if ((i == 1 && j == id[i-1])
112 ||(i == 2 && (j == id[i-1] || j == id[i-2]))) continue;
113 if (TMath::Abs(xdarray[j]) < xmin) {
114 xmin = TMath::Abs(xdarray[j]);
144 //____________________________________________________
145 Int_t AliMUONRawCluster::PhysicsContribution() const
147 // Evaluate physics contribution to cluster
151 for (Int_t i=0; i<fMultiplicity[0]; i++) {
152 if (fPhysicsMap[i]==2) iPhys++;
153 if (fPhysicsMap[i]==1) iMixed++;
154 if (fPhysicsMap[i]==0) iBg++;
156 if (iMixed==0 && iBg==0) {
158 } else if ((iPhys != 0 && iBg !=0) || iMixed != 0) {
167 //____________________________________________________
168 void AliMUONRawCluster::DumpIndex(void)
171 for (Int_t icat=0;icat<2;icat++) {
172 printf ("Mult %d\n",fMultiplicity[icat]);
173 for (Int_t idig=0;idig<fMultiplicity[icat];idig++){
174 printf("Index %d",fIndexMap[idig][icat]);
180 //____________________________________________________
181 Int_t AliMUONRawCluster::AddCharge(Int_t i, Int_t Q)
189 //____________________________________________________
190 Int_t AliMUONRawCluster::AddX(Int_t i, Float_t X)
198 //____________________________________________________
199 Int_t AliMUONRawCluster::AddY(Int_t i, Float_t Y)
207 //____________________________________________________
208 Int_t AliMUONRawCluster::AddZ(Int_t i, Float_t Z)
216 //____________________________________________________
217 Int_t AliMUONRawCluster::GetCharge(Int_t i) const
219 if (i==0 || i==1) return fQ[i];
222 //____________________________________________________
223 Float_t AliMUONRawCluster::GetX(Int_t i) const
225 if (i==0 || i==1) return fX[i];
228 //____________________________________________________
229 Float_t AliMUONRawCluster::GetY(Int_t i) const
231 if (i==0 || i==1) return fY[i];
234 //____________________________________________________
235 Float_t AliMUONRawCluster::GetZ(Int_t i) const
237 if (i==0 || i==1) return fZ[i];
240 //____________________________________________________
241 Int_t AliMUONRawCluster::SetCharge(Int_t i, Int_t Q)
249 //____________________________________________________
250 Int_t AliMUONRawCluster::SetX(Int_t i, Float_t X)
258 //____________________________________________________
259 Int_t AliMUONRawCluster::SetY(Int_t i, Float_t Y)
267 //____________________________________________________
268 Int_t AliMUONRawCluster::SetZ(Int_t i, Float_t Z)