]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONRawCluster.cxx
Managed the 234 local boards inside the class & simplified the code
[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
d19b6003 18// -------------------------
19// Class AliMUONRawCluster
20// -------------------------
3afdba21 21// Class for the MUON RecPoint
3b5272e3 22// It contains the properties of the physics cluters found in the tracking chambers
3afdba21 23// RawCluster contains also the information from the both cathode of the chambers.
3afdba21 24
6464217e 25
26#include "Riostream.h"
27
a9e2aefa 28#include <TArrayF.h>
6464217e 29#include <TString.h>
a9e2aefa 30
30178c30 31#include "AliMUONRawCluster.h"
32
5398f946 33/// \cond CLASSIMP
925e6570 34ClassImp(AliMUONRawCluster)
5398f946 35/// \endcond
a9e2aefa 36
71a2d3aa 37//____________________________________________________
30178c30 38AliMUONRawCluster::AliMUONRawCluster()
5398f946 39 : TObject(),
40 fClusterType(0),
41 fGhost(0),
42 fDetElemId(0)
30178c30 43{
d19b6003 44/// Constructor
a9e2aefa 45 fTracks[0]=fTracks[1]=fTracks[2]=-1;
46 for (int j=0;j<2;j++) {
47 fQ[j]=0;
48 fX[j]=0;
49 fY[j]=0;
50 fMultiplicity[j]=0;
51 fPeakSignal[j]=-1;
52 fChi2[j]=-1;
53
54 for (int k=0;k<50;k++) {
55 fIndexMap[k][j]=-1;
56 fOffsetMap[k][j]=0;
57 fContMap[k][j]=0;
58 fPhysicsMap[k]=-1;
59 }
60 }
61 fNcluster[0]=fNcluster[1]=-1;
87e6e2dd 62 fErrXY[0] = 0.144;
63 fErrXY[1] = 0.01;
a9e2aefa 64}
71a2d3aa 65
66//____________________________________________________
67AliMUONRawCluster::~AliMUONRawCluster()
68{
69/// Destructor
70}
71
3afdba21 72//____________________________________________________
2a941f4e 73Int_t AliMUONRawCluster::Compare(const TObject *obj) const
a9e2aefa 74{
d19b6003 75/// Compare
76
a9e2aefa 77 /*
78 AliMUONRawCluster *raw=(AliMUONRawCluster *)obj;
79 Float_t r=GetRadius();
80 Float_t ro=raw->GetRadius();
81 if (r>ro) return 1;
82 else if (r<ro) return -1;
83 else return 0;
84 */
85 AliMUONRawCluster *raw=(AliMUONRawCluster *)obj;
86 Float_t y=fY[0];
87 Float_t yo=raw->fY[0];
88 if (y>yo) return 1;
89 else if (y<yo) return -1;
90 else return 0;
91
92}
3afdba21 93//____________________________________________________
94Int_t AliMUONRawCluster::BinarySearch(Float_t y, TArrayF coord, Int_t from, Int_t upto)
a9e2aefa 95{
d19b6003 96/// Find object using a binary search. Array must first have been sorted.
97/// Search can be limited by setting upto to desired index.
a9e2aefa 98
99 Int_t low=from, high=upto-1, half;
100 while(high-low>1) {
101 half=(high+low)/2;
102 if(y>coord[half]) low=half;
103 else high=half;
104 }
105 return low;
106}
3afdba21 107//____________________________________________________
a9e2aefa 108void AliMUONRawCluster::SortMin(Int_t *idx,Float_t *xdarray,Float_t *xarray,Float_t *yarray,Float_t *qarray, Int_t ntr)
109{
d19b6003 110/// Get the 3 closest points(cog) one can find on the second cathode
111/// starting from a given cog on first cathode
a9e2aefa 112
113 //
114 // Loop over deltax, only 3 times
115 //
116
117 Float_t xmin;
118 Int_t jmin;
119 Int_t id[3] = {-2,-2,-2};
120 Float_t jx[3] = {0.,0.,0.};
121 Float_t jy[3] = {0.,0.,0.};
122 Float_t jq[3] = {0.,0.,0.};
123 Int_t jid[3] = {-2,-2,-2};
124 Int_t i,j,imax;
125
126 if (ntr<3) imax=ntr;
127 else imax=3;
128 for(i=0;i<imax;i++){
129 xmin=1001.;
130 jmin=0;
131
132 for(j=0;j<ntr;j++){
133 if ((i == 1 && j == id[i-1])
134 ||(i == 2 && (j == id[i-1] || j == id[i-2]))) continue;
135 if (TMath::Abs(xdarray[j]) < xmin) {
136 xmin = TMath::Abs(xdarray[j]);
137 jmin=j;
138 }
139 } // j
140 if (xmin != 1001.) {
141 id[i]=jmin;
142 jx[i]=xarray[jmin];
143 jy[i]=yarray[jmin];
144 jq[i]=qarray[jmin];
145 jid[i]=idx[jmin];
146 }
147
148 } // i
149
150 for (i=0;i<3;i++){
151 if (jid[i] == -2) {
152 xarray[i]=1001.;
153 yarray[i]=1001.;
154 qarray[i]=1001.;
155 idx[i]=-1;
156 } else {
157 xarray[i]=jx[i];
158 yarray[i]=jy[i];
159 qarray[i]=jq[i];
160 idx[i]=jid[i];
161 }
162 }
163
164}
165
3afdba21 166//____________________________________________________
167Int_t AliMUONRawCluster::PhysicsContribution() const
a9e2aefa 168{
d19b6003 169/// Evaluate physics contribution to cluster
a9e2aefa 170 Int_t iPhys=0;
171 Int_t iBg=0;
172 Int_t iMixed=0;
173 for (Int_t i=0; i<fMultiplicity[0]; i++) {
174 if (fPhysicsMap[i]==2) iPhys++;
175 if (fPhysicsMap[i]==1) iMixed++;
176 if (fPhysicsMap[i]==0) iBg++;
177 }
178 if (iMixed==0 && iBg==0) {
179 return 2;
180 } else if ((iPhys != 0 && iBg !=0) || iMixed != 0) {
181 return 1;
182 } else {
183 return 0;
184 }
185}
6464217e 186
187//____________________________________________________
188void AliMUONRawCluster::Print(Option_t* opt) const
189{
71a2d3aa 190 ///
191 /// Printing Raw Cluster (Rec Point) information
192 /// "full" option for printing all the information about the raw cluster
193 ///
6464217e 194 TString sopt(opt);
195 sopt.ToUpper();
196
af344e5a 197 cout << "<AliMUONRawCluster>: DetEle=" << setw(4) << GetDetElemId() <<
198 ", (x,y,z)=(" << setw(8) << setprecision(5) << GetX() << "," << setw(8)
199 << setprecision(5) << GetY() << "," << setw(8) << setprecision(5) << GetZ() <<
200 ") cm, Chi2=" << setw(8) << setprecision(3) << GetChi2() <<
201 ", Q=" << setw(4) << GetCharge();
202 if ( sopt.Contains("FULL") )
203 {
204 cout << ", Hit=" << setw(4) << GetTrack(0) <<
205 ", Track1=" << setw(4) << GetTrack(1) <<
206 ", Track2=" << setw(4) << GetTrack(2);
6464217e 207 }
af344e5a 208 cout << endl;
6464217e 209}
af344e5a 210
07cfabcf 211//____________________________________________________
212void AliMUONRawCluster::DumpIndex(void)
213{
d19b6003 214/// Dumping IdexMap of the cluster
07cfabcf 215 printf ("-----\n");
216 for (Int_t icat=0;icat<2;icat++) {
217 printf ("Mult %d\n",fMultiplicity[icat]);
218 for (Int_t idig=0;idig<fMultiplicity[icat];idig++){
219 printf("Index %d",fIndexMap[idig][icat]);
220 }
221 printf("\n");
222 }
223}
3afdba21 224//____________________________________________________
45dd3605 225Int_t AliMUONRawCluster::AddCharge(Int_t i, Float_t Q)
3afdba21 226{
d19b6003 227/// Adding Q to the fQ value
3afdba21 228 if (i==0 || i==1) {
229 fQ[i]+=Q;
230 return 1;
231 }
232 else return 0;
233}
234//____________________________________________________
235Int_t AliMUONRawCluster::AddX(Int_t i, Float_t X)
236{
d19b6003 237/// Adding X to the fX value
3afdba21 238 if (i==0 || i==1) {
239 fX[i]+=X;
240 return 1;
241 }
242 else return 0;
243}
244//____________________________________________________
245Int_t AliMUONRawCluster::AddY(Int_t i, Float_t Y)
246{
d19b6003 247/// Adding Y to the fY value
3afdba21 248 if (i==0 || i==1) {
249 fY[i]+=Y;
250 return 1;
251 }
252 else return 0;
253}
254//____________________________________________________
255Int_t AliMUONRawCluster::AddZ(Int_t i, Float_t Z)
256{
d19b6003 257/// Adding Z to the fZ value
3afdba21 258 if (i==0 || i==1) {
259 fZ[i]+=Z;
260 return 1;
261 }
262 else return 0;
263}
264//____________________________________________________
45dd3605 265Float_t AliMUONRawCluster::GetCharge(Int_t i) const
3afdba21 266{
d19b6003 267/// Getting the charge of the cluster
3afdba21 268 if (i==0 || i==1) return fQ[i];
269 else return 99999;
270}
271//____________________________________________________
272Float_t AliMUONRawCluster::GetX(Int_t i) const
273{
d19b6003 274/// Getting X value of the cluster
3afdba21 275 if (i==0 || i==1) return fX[i];
276 else return 99999.;
277}
278//____________________________________________________
279Float_t AliMUONRawCluster::GetY(Int_t i) const
280{
d19b6003 281/// Getting Y value of the cluster
3afdba21 282 if (i==0 || i==1) return fY[i];
283 else return 99999.;
284}
285//____________________________________________________
286Float_t AliMUONRawCluster::GetZ(Int_t i) const
287{
d19b6003 288/// Getting Z value of the cluster
3afdba21 289 if (i==0 || i==1) return fZ[i];
290 else return 99999.;
291}
9e993f2a 292//____________________________________________________
293Int_t AliMUONRawCluster::GetTrack(Int_t i) const
294{
d19b6003 295/// Getting track i contributing to the cluster
9e993f2a 296 if (i==0 || i==1 || i==2) return fTracks[i];
297 else return 99999;
298}
299//____________________________________________________
45dd3605 300Float_t AliMUONRawCluster::GetPeakSignal(Int_t i) const
9e993f2a 301{
d19b6003 302/// Getting cluster peaksignal
9e993f2a 303 if (i==0 || i==1 ) return fPeakSignal[i];
304 else return 99999;
305}
306//____________________________________________________
307Int_t AliMUONRawCluster::GetMultiplicity(Int_t i) const
308{
d19b6003 309/// Getting cluster multiplicity
9e993f2a 310 if (i==0 || i==1 ) return fMultiplicity[i];
311 else return 99999;
312}
313//____________________________________________________
314Int_t AliMUONRawCluster::GetClusterType() const
315{
d19b6003 316/// Getting Cluster Type
9e993f2a 317 return fClusterType;
318}
3b5272e3 319//____________________________________________________
320Int_t AliMUONRawCluster::GetGhost() const
321{
d19b6003 322/// Getting Ghost
3b5272e3 323 return fGhost;
324}
325//____________________________________________________
326Int_t AliMUONRawCluster::GetNcluster(Int_t i) const
327{
d19b6003 328/// Getting number of clusters
3b5272e3 329 if (i==0 || i==1 ) return fNcluster[i];
330 else return 99999;
331}
332//____________________________________________________
333Float_t AliMUONRawCluster::GetChi2(Int_t i) const
334{
d19b6003 335/// Getting chi2 value of the cluster
3b5272e3 336 if (i==0 || i==1) return fChi2[i];
337 else return 99999.;
338}
3afdba21 339//____________________________________________________
45dd3605 340Int_t AliMUONRawCluster::SetCharge(Int_t i, Float_t Q)
3afdba21 341{
d19b6003 342/// Setting Charge of the cluster
3afdba21 343 if (i==0 || i==1) {
344 fQ[i]=Q;
345 return 1;
346 }
347 else return 0;
348}
349//____________________________________________________
350Int_t AliMUONRawCluster::SetX(Int_t i, Float_t X)
351{
d19b6003 352/// Setting X value of the cluster
3afdba21 353 if (i==0 || i==1) {
354 fX[i]=X;
355 return 1;
356 }
357 else return 0;
358}
359//____________________________________________________
360Int_t AliMUONRawCluster::SetY(Int_t i, Float_t Y)
361{
d19b6003 362/// Setting Y value of the cluster
3afdba21 363 if (i==0 || i==1) {
364 fY[i]=Y;
365 return 1;
366 }
367 else return 0;
368}
369//____________________________________________________
370Int_t AliMUONRawCluster::SetZ(Int_t i, Float_t Z)
371{
d19b6003 372/// Setting Z value of the cluste
3afdba21 373 if (i==0 || i==1) {
374 fZ[i]=Z;
375 return 1;
376 }
377 else return 0;
378}
9e993f2a 379//____________________________________________________
380Int_t AliMUONRawCluster::SetTrack(Int_t i, Int_t track)
381{
d19b6003 382/// Setting tracks contributing to the cluster
9e993f2a 383 if (i==0 || i==1 || i==2) {
384 fTracks[i]=track;
385 return 1;
386 }
387 else return 0;
388}
389//____________________________________________________
45dd3605 390Int_t AliMUONRawCluster::SetPeakSignal(Int_t i, Float_t peaksignal)
9e993f2a 391{
d19b6003 392/// Setting PeakSignal of the cluster
9e993f2a 393 if (i==0 || i==1 ) {
394 fPeakSignal[i]=peaksignal;
395 return 1;
396 }
397 else return 0;
398}
399//____________________________________________________
400Int_t AliMUONRawCluster::SetMultiplicity(Int_t i, Int_t mul)
401{
d19b6003 402/// Setting multiplicity of the cluster
9e993f2a 403 if (i==0 || i==1 ) {
404 fMultiplicity[i]=mul;
405 return 1;
406 }
407 else return 0;
408}
409//____________________________________________________
410Int_t AliMUONRawCluster::SetClusterType(Int_t type)
411{
d19b6003 412/// Setting the cluster type
9e993f2a 413 fClusterType=type;
414 return 1;
415}
3b5272e3 416//____________________________________________________
417Int_t AliMUONRawCluster::SetGhost(Int_t ghost)
418{
d19b6003 419/// Setting the ghost
3b5272e3 420 fGhost=ghost;
421 return 1;
422}
423//____________________________________________________
424Int_t AliMUONRawCluster::SetNcluster(Int_t i, Int_t ncluster)
425{
d19b6003 426/// Setting number the cluster
3b5272e3 427 if (i==0 || i==1 ) {
428 fNcluster[i]=ncluster;
429 return 1;
430 }
431 else return 0;
432}
433//____________________________________________________
434Int_t AliMUONRawCluster::SetChi2(Int_t i, Float_t chi2)
435{
d19b6003 436/// Setting chi2 of the cluster
3b5272e3 437 if (i==0 || i==1) {
438 fChi2[i]=chi2;
439 return 1;
440 }
441 else return 0;
442}
b137f8b9 443