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