1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 // -------------------------
19 // Class AliMUONRawCluster
20 // -------------------------
21 // Class for the MUON RecPoint
22 // It contains the properties of the physics cluters found in the tracking chambers
23 // RawCluster contains also the information from the both cathode of the chambers.
26 #include "Riostream.h"
31 #include "AliMUONRawCluster.h"
34 ClassImp(AliMUONRawCluster)
37 //____________________________________________________
38 AliMUONRawCluster::AliMUONRawCluster()
45 fTracks[0]=fTracks[1]=fTracks[2]=-1;
46 for (int j=0;j<2;j++) {
54 for (int k=0;k<50;k++) {
61 fNcluster[0]=fNcluster[1]=-1;
66 //____________________________________________________
67 AliMUONRawCluster::~AliMUONRawCluster()
72 //____________________________________________________
73 Int_t AliMUONRawCluster::Compare(const TObject *obj) const
78 AliMUONRawCluster *raw=(AliMUONRawCluster *)obj;
79 Float_t r=GetRadius();
80 Float_t ro=raw->GetRadius();
82 else if (r<ro) return -1;
86 AliMUONRawCluster *raw=(AliMUONRawCluster *)obj;
88 Float_t yo=raw->fY[0];
90 else if (y<yo) return -1;
94 const AliMUONRawCluster* raw = static_cast<const AliMUONRawCluster*>(obj);
95 if ( GetCharge(0) > raw->GetCharge(0) )
99 else if ( GetCharge(0) < raw->GetCharge(0) )
106 //____________________________________________________
107 Int_t AliMUONRawCluster::BinarySearch(Float_t y, TArrayF coord, Int_t from, Int_t upto)
109 /// Find object using a binary search. Array must first have been sorted.
110 /// Search can be limited by setting upto to desired index.
112 Int_t low=from, high=upto-1, half;
115 if(y>coord[half]) low=half;
120 //____________________________________________________
121 void AliMUONRawCluster::SortMin(Int_t *idx,Float_t *xdarray,Float_t *xarray,Float_t *yarray,Float_t *qarray, Int_t ntr)
123 /// Get the 3 closest points(cog) one can find on the second cathode
124 /// starting from a given cog on first cathode
127 // Loop over deltax, only 3 times
132 Int_t id[3] = {-2,-2,-2};
133 Float_t jx[3] = {0.,0.,0.};
134 Float_t jy[3] = {0.,0.,0.};
135 Float_t jq[3] = {0.,0.,0.};
136 Int_t jid[3] = {-2,-2,-2};
146 if ((i == 1 && j == id[i-1])
147 ||(i == 2 && (j == id[i-1] || j == id[i-2]))) continue;
148 if (TMath::Abs(xdarray[j]) < xmin) {
149 xmin = TMath::Abs(xdarray[j]);
179 //____________________________________________________
180 Int_t AliMUONRawCluster::PhysicsContribution() const
182 /// Evaluate physics contribution to cluster
186 for (Int_t i=0; i<fMultiplicity[0]; i++) {
187 if (fPhysicsMap[i]==2) iPhys++;
188 if (fPhysicsMap[i]==1) iMixed++;
189 if (fPhysicsMap[i]==0) iBg++;
191 if (iMixed==0 && iBg==0) {
193 } else if ((iPhys != 0 && iBg !=0) || iMixed != 0) {
200 //____________________________________________________
201 void AliMUONRawCluster::Print(Option_t* opt) const
204 /// Printing Raw Cluster (Rec Point) information
205 /// "full" option for printing all the information about the raw cluster
210 cout << Form("<AliMUONRawCluster>: DetEle=%4d (x,y,z)=(%7.4f,%7.4f,%7.4f) cm"
211 " Chi2=%7.2f Q=%7.2f",
212 GetDetElemId(),GetX(),GetY(),GetZ(),GetChi2(),
215 if ( sopt.Contains("FULL") )
217 cout << ", Hit=" << setw(4) << GetTrack(0) <<
218 ", Track1=" << setw(4) << GetTrack(1) <<
219 ", Track2=" << setw(4) << GetTrack(2);
224 //____________________________________________________
225 void AliMUONRawCluster::DumpIndex(void)
227 /// Dumping IdexMap of the cluster
229 for (Int_t icat=0;icat<2;icat++) {
230 printf ("Mult %d\n",fMultiplicity[icat]);
231 for (Int_t idig=0;idig<fMultiplicity[icat];idig++){
232 printf("Index %d",fIndexMap[idig][icat]);
237 //____________________________________________________
238 Int_t AliMUONRawCluster::AddCharge(Int_t i, Float_t Q)
240 /// Adding Q to the fQ value
247 //____________________________________________________
248 Int_t AliMUONRawCluster::AddX(Int_t i, Float_t X)
250 /// Adding X to the fX value
257 //____________________________________________________
258 Int_t AliMUONRawCluster::AddY(Int_t i, Float_t Y)
260 /// Adding Y to the fY value
267 //____________________________________________________
268 Int_t AliMUONRawCluster::AddZ(Int_t i, Float_t Z)
270 /// Adding Z to the fZ value
277 //____________________________________________________
278 Float_t AliMUONRawCluster::GetCharge(Int_t i) const
280 /// Getting the charge of the cluster
281 if (i==0 || i==1) return fQ[i];
284 //____________________________________________________
285 Float_t AliMUONRawCluster::GetX(Int_t i) const
287 /// Getting X value of the cluster
288 if (i==0 || i==1) return fX[i];
291 //____________________________________________________
292 Float_t AliMUONRawCluster::GetY(Int_t i) const
294 /// Getting Y value of the cluster
295 if (i==0 || i==1) return fY[i];
298 //____________________________________________________
299 Float_t AliMUONRawCluster::GetZ(Int_t i) const
301 /// Getting Z value of the cluster
302 if (i==0 || i==1) return fZ[i];
305 //____________________________________________________
306 Int_t AliMUONRawCluster::GetTrack(Int_t i) const
308 /// Getting track i contributing to the cluster
309 if (i==0 || i==1 || i==2) return fTracks[i];
312 //____________________________________________________
313 Float_t AliMUONRawCluster::GetPeakSignal(Int_t i) const
315 /// Getting cluster peaksignal
316 if (i==0 || i==1 ) return fPeakSignal[i];
319 //____________________________________________________
320 Int_t AliMUONRawCluster::GetMultiplicity(Int_t i) const
322 /// Getting cluster multiplicity
323 if (i==0 || i==1 ) return fMultiplicity[i];
326 //____________________________________________________
327 Int_t AliMUONRawCluster::GetClusterType() const
329 /// Getting Cluster Type
332 //____________________________________________________
333 Int_t AliMUONRawCluster::GetGhost() const
338 //____________________________________________________
339 Int_t AliMUONRawCluster::GetNcluster(Int_t i) const
341 /// Getting number of clusters
342 if (i==0 || i==1 ) return fNcluster[i];
345 //____________________________________________________
346 Float_t AliMUONRawCluster::GetChi2(Int_t i) const
348 /// Getting chi2 value of the cluster
349 if (i==0 || i==1) return fChi2[i];
352 //____________________________________________________
353 Int_t AliMUONRawCluster::SetCharge(Int_t i, Float_t Q)
355 /// Setting Charge of the cluster
362 //____________________________________________________
363 Int_t AliMUONRawCluster::SetX(Int_t i, Float_t X)
365 /// Setting X value of the cluster
372 //____________________________________________________
373 Int_t AliMUONRawCluster::SetY(Int_t i, Float_t Y)
375 /// Setting Y value of the cluster
382 //____________________________________________________
383 Int_t AliMUONRawCluster::SetZ(Int_t i, Float_t Z)
385 /// Setting Z value of the cluste
392 //____________________________________________________
393 Int_t AliMUONRawCluster::SetTrack(Int_t i, Int_t track)
395 /// Setting tracks contributing to the cluster
396 if (i==0 || i==1 || i==2) {
402 //____________________________________________________
403 Int_t AliMUONRawCluster::SetPeakSignal(Int_t i, Float_t peaksignal)
405 /// Setting PeakSignal of the cluster
407 fPeakSignal[i]=peaksignal;
412 //____________________________________________________
413 Int_t AliMUONRawCluster::SetMultiplicity(Int_t i, Int_t mul)
415 /// Setting multiplicity of the cluster
417 fMultiplicity[i]=mul;
422 //____________________________________________________
423 Int_t AliMUONRawCluster::SetClusterType(Int_t type)
425 /// Setting the cluster type
429 //____________________________________________________
430 Int_t AliMUONRawCluster::SetGhost(Int_t ghost)
432 /// Setting the ghost
436 //____________________________________________________
437 Int_t AliMUONRawCluster::SetNcluster(Int_t i, Int_t ncluster)
439 /// Setting number the cluster
441 fNcluster[i]=ncluster;
446 //____________________________________________________
447 Int_t AliMUONRawCluster::SetChi2(Int_t i, Float_t chi2)
449 /// Setting chi2 of the cluster