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