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