]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONRawCluster.cxx
readers updated (mini header -> data header)
[u/mrichter/AliRoot.git] / MUON / AliMUONRawCluster.cxx
CommitLineData
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
88cb7938 16/* $Id$ */
a9e2aefa 17
3afdba21 18// Class for the MUON RecPoint
3b5272e3 19// It contains the properties of the physics cluters found in the tracking chambers
3afdba21 20// RawCluster contains also the information from the both cathode of the chambers.
3b5272e3 21//
22//
3afdba21 23
a9e2aefa 24#include "AliMUONRawCluster.h"
a9e2aefa 25#include <TArrayF.h>
26
27ClassImp(AliMUONRawCluster);
28
29
30AliMUONRawCluster::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;
07cfabcf 49 fGhost=0;
a9e2aefa 50}
3afdba21 51//____________________________________________________
2a941f4e 52Int_t AliMUONRawCluster::Compare(const TObject *obj) const
a9e2aefa 53{
54 /*
55 AliMUONRawCluster *raw=(AliMUONRawCluster *)obj;
56 Float_t r=GetRadius();
57 Float_t ro=raw->GetRadius();
58 if (r>ro) return 1;
59 else if (r<ro) return -1;
60 else return 0;
61 */
62 AliMUONRawCluster *raw=(AliMUONRawCluster *)obj;
63 Float_t y=fY[0];
64 Float_t yo=raw->fY[0];
65 if (y>yo) return 1;
66 else if (y<yo) return -1;
67 else return 0;
68
69}
3afdba21 70//____________________________________________________
71Int_t AliMUONRawCluster::BinarySearch(Float_t y, TArrayF coord, Int_t from, Int_t upto)
a9e2aefa 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}
3afdba21 84//____________________________________________________
a9e2aefa 85void 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
3afdba21 145//____________________________________________________
146Int_t AliMUONRawCluster::PhysicsContribution() const
a9e2aefa 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}
07cfabcf 165//____________________________________________________
166void AliMUONRawCluster::DumpIndex(void)
167{
3b5272e3 168 // Dumping IdexMap of the cluster
07cfabcf 169 printf ("-----\n");
170 for (Int_t icat=0;icat<2;icat++) {
171 printf ("Mult %d\n",fMultiplicity[icat]);
172 for (Int_t idig=0;idig<fMultiplicity[icat];idig++){
173 printf("Index %d",fIndexMap[idig][icat]);
174 }
175 printf("\n");
176 }
177}
3afdba21 178//____________________________________________________
179Int_t AliMUONRawCluster::AddCharge(Int_t i, Int_t Q)
180{
3b5272e3 181 // Adding Q to the fQ value
3afdba21 182 if (i==0 || i==1) {
183 fQ[i]+=Q;
184 return 1;
185 }
186 else return 0;
187}
188//____________________________________________________
189Int_t AliMUONRawCluster::AddX(Int_t i, Float_t X)
190{
3b5272e3 191 // Adding X to the fX value
3afdba21 192 if (i==0 || i==1) {
193 fX[i]+=X;
194 return 1;
195 }
196 else return 0;
197}
198//____________________________________________________
199Int_t AliMUONRawCluster::AddY(Int_t i, Float_t Y)
200{
3b5272e3 201 // Adding Y to the fY value
3afdba21 202 if (i==0 || i==1) {
203 fY[i]+=Y;
204 return 1;
205 }
206 else return 0;
207}
208//____________________________________________________
209Int_t AliMUONRawCluster::AddZ(Int_t i, Float_t Z)
210{
3b5272e3 211 // Adding Z to the fZ value
3afdba21 212 if (i==0 || i==1) {
213 fZ[i]+=Z;
214 return 1;
215 }
216 else return 0;
217}
218//____________________________________________________
219Int_t AliMUONRawCluster::GetCharge(Int_t i) const
220{
3b5272e3 221 // Getting the charge of the cluster
3afdba21 222 if (i==0 || i==1) return fQ[i];
223 else return 99999;
224}
225//____________________________________________________
226Float_t AliMUONRawCluster::GetX(Int_t i) const
227{
3b5272e3 228 // Getting X value of the cluster
3afdba21 229 if (i==0 || i==1) return fX[i];
230 else return 99999.;
231}
232//____________________________________________________
233Float_t AliMUONRawCluster::GetY(Int_t i) const
234{
3b5272e3 235 // Getting Y value of the cluster
3afdba21 236 if (i==0 || i==1) return fY[i];
237 else return 99999.;
238}
239//____________________________________________________
240Float_t AliMUONRawCluster::GetZ(Int_t i) const
241{
3b5272e3 242 // Getting Z value of the cluster
3afdba21 243 if (i==0 || i==1) return fZ[i];
244 else return 99999.;
245}
9e993f2a 246//____________________________________________________
247Int_t AliMUONRawCluster::GetTrack(Int_t i) const
248{
3b5272e3 249 // Getting track i contributing to the cluster
9e993f2a 250 if (i==0 || i==1 || i==2) return fTracks[i];
251 else return 99999;
252}
253//____________________________________________________
254Int_t AliMUONRawCluster::GetPeakSignal(Int_t i) const
255{
3b5272e3 256 // Getting cluster peaksignal
9e993f2a 257 if (i==0 || i==1 ) return fPeakSignal[i];
258 else return 99999;
259}
260//____________________________________________________
261Int_t AliMUONRawCluster::GetMultiplicity(Int_t i) const
262{
3b5272e3 263 // Getting cluster multiplicity
9e993f2a 264 if (i==0 || i==1 ) return fMultiplicity[i];
265 else return 99999;
266}
267//____________________________________________________
268Int_t AliMUONRawCluster::GetClusterType() const
269{
3b5272e3 270 // Getting Cluster Type
9e993f2a 271 return fClusterType;
272}
3b5272e3 273//____________________________________________________
274Int_t AliMUONRawCluster::GetGhost() const
275{
276 // Getting Ghost
277 return fGhost;
278}
279//____________________________________________________
280Int_t AliMUONRawCluster::GetNcluster(Int_t i) const
281{
282 // Getting number of clusters
283 if (i==0 || i==1 ) return fNcluster[i];
284 else return 99999;
285}
286//____________________________________________________
287Float_t AliMUONRawCluster::GetChi2(Int_t i) const
288{
289 // Getting chi2 value of the cluster
290 if (i==0 || i==1) return fChi2[i];
291 else return 99999.;
292}
3afdba21 293//____________________________________________________
294Int_t AliMUONRawCluster::SetCharge(Int_t i, Int_t Q)
295{
3b5272e3 296 // Setting Charge of the cluster
3afdba21 297 if (i==0 || i==1) {
298 fQ[i]=Q;
299 return 1;
300 }
301 else return 0;
302}
303//____________________________________________________
304Int_t AliMUONRawCluster::SetX(Int_t i, Float_t X)
305{
3b5272e3 306 // Setting X value of the cluster
3afdba21 307 if (i==0 || i==1) {
308 fX[i]=X;
309 return 1;
310 }
311 else return 0;
312}
313//____________________________________________________
314Int_t AliMUONRawCluster::SetY(Int_t i, Float_t Y)
315{
3b5272e3 316 // Setting Y value of the cluster
3afdba21 317 if (i==0 || i==1) {
318 fY[i]=Y;
319 return 1;
320 }
321 else return 0;
322}
323//____________________________________________________
324Int_t AliMUONRawCluster::SetZ(Int_t i, Float_t Z)
325{
3b5272e3 326 // Setting Z value of the cluste
3afdba21 327 if (i==0 || i==1) {
328 fZ[i]=Z;
329 return 1;
330 }
331 else return 0;
332}
9e993f2a 333//____________________________________________________
334Int_t AliMUONRawCluster::SetTrack(Int_t i, Int_t track)
335{
3b5272e3 336 // Setting tracks contributing to the cluster
9e993f2a 337 if (i==0 || i==1 || i==2) {
338 fTracks[i]=track;
339 return 1;
340 }
341 else return 0;
342}
343//____________________________________________________
344Int_t AliMUONRawCluster::SetPeakSignal(Int_t i, Int_t peaksignal)
345{
3b5272e3 346 // Setting PeakSignal of the cluster
9e993f2a 347 if (i==0 || i==1 ) {
348 fPeakSignal[i]=peaksignal;
349 return 1;
350 }
351 else return 0;
352}
353//____________________________________________________
354Int_t AliMUONRawCluster::SetMultiplicity(Int_t i, Int_t mul)
355{
3b5272e3 356 // Setting multiplicity of the cluster
9e993f2a 357 if (i==0 || i==1 ) {
358 fMultiplicity[i]=mul;
359 return 1;
360 }
361 else return 0;
362}
363//____________________________________________________
364Int_t AliMUONRawCluster::SetClusterType(Int_t type)
365{
3b5272e3 366 // Setting the cluster type
9e993f2a 367 fClusterType=type;
368 return 1;
369}
3b5272e3 370//____________________________________________________
371Int_t AliMUONRawCluster::SetGhost(Int_t ghost)
372{
373 // Setting the ghost
374 fGhost=ghost;
375 return 1;
376}
377//____________________________________________________
378Int_t AliMUONRawCluster::SetNcluster(Int_t i, Int_t ncluster)
379{
380 // Setting number the cluster
381 if (i==0 || i==1 ) {
382 fNcluster[i]=ncluster;
383 return 1;
384 }
385 else return 0;
386}
387//____________________________________________________
388Int_t AliMUONRawCluster::SetChi2(Int_t i, Float_t chi2)
389{
390 // Setting chi2 of the cluster
391 if (i==0 || i==1) {
392 fChi2[i]=chi2;
393 return 1;
394 }
395 else return 0;
396}