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