]>
Commit | Line | Data |
---|---|---|
237c933d | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
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 | **************************************************************************/ | |
15 | ||
16 | /* | |
17 | $Log$ | |
8a235e5c | 18 | Revision 1.1 2000/06/12 15:27:26 jbarbosa |
19 | Cleaned up version. | |
20 | ||
237c933d | 21 | */ |
22 | ||
23 | ||
24 | #include "AliRICHRawCluster.h" | |
25 | ||
8a235e5c | 26 | #include <TMath.h> |
27 | #include <TArrayF.h> | |
28 | ||
237c933d | 29 | |
30 | ClassImp(AliRICHRawCluster) | |
8a235e5c | 31 | |
32 | AliRICHRawCluster :: AliRICHRawCluster() | |
33 | { | |
34 | fTracks[0]=fTracks[1]=fTracks[2]=-1; | |
35 | fQ=0; fX=fY=0; fMultiplicity=0; | |
36 | for (int k=0;k<50;k++) { | |
37 | fIndexMap[k]=-1; | |
38 | fOffsetMap[k]=0; | |
39 | fContMap[k]=0; | |
40 | fPhysicsMap[k]=-1; | |
41 | fCtype=-1; | |
42 | } | |
43 | fNcluster[0]=fNcluster[1]=-1; | |
44 | } | |
45 | ||
237c933d | 46 | Int_t AliRICHRawCluster::Compare(TObject *obj) |
47 | { | |
48 | ||
49 | // Compare two clusters | |
50 | ||
51 | AliRICHRawCluster *raw=(AliRICHRawCluster *)obj; | |
52 | Float_t y=fY; | |
53 | Float_t yo=raw->fY; | |
54 | if (y>yo) return 1; | |
55 | else if (y<yo) return -1; | |
56 | else return 0; | |
57 | ||
58 | } | |
59 | ||
60 | Int_t AliRICHRawCluster:: | |
61 | BinarySearch(Float_t y, TArrayF coord, Int_t from, Int_t upto) | |
62 | { | |
63 | // Find object using a binary search. Array must first have been sorted. | |
64 | // Search can be limited by setting upto to desired index. | |
65 | ||
66 | Int_t low=from, high=upto-1, half; | |
67 | while(high-low>1) { | |
68 | half=(high+low)/2; | |
69 | if(y>coord[half]) low=half; | |
70 | else high=half; | |
71 | } | |
72 | return low; | |
73 | } | |
74 | ||
75 | void AliRICHRawCluster::SortMin(Int_t *idx,Float_t *xdarray,Float_t *xarray,Float_t *yarray,Float_t *qarray, Int_t ntr) | |
76 | { | |
77 | // | |
78 | // Get the 3 closest points(cog) one can find on the second cathode | |
79 | // starting from a given cog on first cathode | |
80 | // | |
81 | ||
82 | // | |
83 | // Loop over deltax, only 3 times | |
84 | // | |
85 | ||
86 | Float_t xmin; | |
87 | Int_t jmin; | |
88 | Int_t id[3] = {-2,-2,-2}; | |
89 | Float_t jx[3] = {0.,0.,0.}; | |
90 | Float_t jy[3] = {0.,0.,0.}; | |
91 | Float_t jq[3] = {0.,0.,0.}; | |
92 | Int_t jid[3] = {-2,-2,-2}; | |
93 | Int_t i,j,imax; | |
94 | ||
95 | if (ntr<3) imax=ntr; | |
96 | else imax=3; | |
97 | for(i=0;i<imax;i++){ | |
98 | xmin=1001.; | |
99 | jmin=0; | |
100 | ||
101 | for(j=0;j<ntr;j++){ | |
102 | if ((i == 1 && j == id[i-1]) | |
103 | ||(i == 2 && (j == id[i-1] || j == id[i-2]))) continue; | |
104 | if (TMath::Abs(xdarray[j]) < xmin) { | |
105 | xmin = TMath::Abs(xdarray[j]); | |
106 | jmin=j; | |
107 | } | |
108 | } // j | |
109 | if (xmin != 1001.) { | |
110 | id[i]=jmin; | |
111 | jx[i]=xarray[jmin]; | |
112 | jy[i]=yarray[jmin]; | |
113 | jq[i]=qarray[jmin]; | |
114 | jid[i]=idx[jmin]; | |
115 | } | |
116 | ||
117 | } // i | |
118 | ||
119 | for (i=0;i<3;i++){ | |
120 | if (jid[i] == -2) { | |
121 | xarray[i]=1001.; | |
122 | yarray[i]=1001.; | |
123 | qarray[i]=1001.; | |
124 | idx[i]=-1; | |
125 | } else { | |
126 | xarray[i]=jx[i]; | |
127 | yarray[i]=jy[i]; | |
128 | qarray[i]=jq[i]; | |
129 | idx[i]=jid[i]; | |
130 | } | |
131 | } | |
132 | ||
133 | } | |
134 | ||
135 | ||
136 | Int_t AliRICHRawCluster::PhysicsContribution() | |
137 | { | |
138 | ||
139 | // Type of physics processes | |
140 | ||
141 | Int_t iPhys=0; | |
142 | Int_t iBg=0; | |
143 | Int_t iMixed=0; | |
144 | for (Int_t i=0; i<fMultiplicity; i++) { | |
145 | if (fPhysicsMap[i]==2) iPhys++; | |
146 | if (fPhysicsMap[i]==1) iMixed++; | |
147 | if (fPhysicsMap[i]==0) iBg++; | |
148 | } | |
149 | if (iMixed==0 && iBg==0) { | |
150 | return 2; | |
151 | } else if ((iPhys != 0 && iBg !=0) || iMixed != 0) { | |
152 | return 1; | |
153 | } else { | |
154 | return 0; | |
155 | } | |
156 | } |