Bug fix
[u/mrichter/AliRoot.git] / MUON / AliMUONRawCluster.h
CommitLineData
a9e2aefa 1#ifndef ALIMUONRAWCLUSTER_H
2#define ALIMUONRAWCLUSTER_H
3
4/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
6
7/* $Id$ */
30178c30 8// Revision of includes 07/05/2004
a9e2aefa 9
692de412 10/// \ingroup base
11/// \class AliMUONRawCluster
12/// \brief MUON raw cluster
13///
14/// Class for the MUON RecPoint
585d648a 15/// It contains the properties of the physics cluters found in the tracking chambers
692de412 16/// RawCluster contains also the information from the both cathode of the chambers.
3afdba21 17
18
2060b217 19#include "AliMUONVCluster.h"
ecfa008b 20#include <TMath.h> // because of inline funtion GetRadius
f480df09 21#include <TArrayF.h>
2060b217 22
23class AliMUONRawCluster : public AliMUONVCluster {
3afdba21 24
a9e2aefa 25public:
3afdba21 26 AliMUONRawCluster();
71a2d3aa 27 virtual ~AliMUONRawCluster();
28
2060b217 29 /// Clear method (used by TClonesArray)
30 virtual void Clear(Option_t* = "") {}
31
32 /// Set coordinates (cm)
33 virtual void SetXYZ(Double_t x, Double_t y, Double_t z) {fX[0] = x; fY[0] = y; fZ[0] = z;}
34 /// Return coordinate X (cm)
35 virtual Double_t GetX() const {return fX[0];}
36 /// Return coordinate Y (cm)
37 virtual Double_t GetY() const {return fY[0];}
38 /// Return coordinate Z (cm)
39 virtual Double_t GetZ() const {return fZ[0];}
40
41 /// Set resolution (cm) on coordinates (X,Y)
42 virtual void SetErrXY(Double_t errX, Double_t errY) {fErrXY[0] = errX; fErrXY[1] = errY;}
43 /// Return resolution (cm) on coordinate X
44 virtual Double_t GetErrX() const {return fErrXY[0];}
45 /// Return resolution**2 (cm**2) on coordinate X
46 virtual Double_t GetErrX2() const {return fErrXY[0] * fErrXY[0];}
47 /// Return resolution (cm) on coordinate Y
48 virtual Double_t GetErrY() const {return fErrXY[1];}
49 /// Return resolution**2 (cm**2) on coordinate Y
50 virtual Double_t GetErrY2() const {return fErrXY[1] * fErrXY[1];}
51
52 /// Set the cluster charge
53 virtual void SetCharge(Double_t q) {fQ[0] = q;}
54 /// Set the cluster charge
55 virtual Double_t GetCharge() const {return fQ[0];}
56
57 /// Return chamber Id
58 virtual Int_t GetChamberId() const {return fDetElemId/100 - 1;}
59 /// Set detection element Id
60 void SetDetElemId(Int_t id) {fDetElemId = id;}
61 /// Return detection element Id
62 virtual Int_t GetDetElemId() const {return fDetElemId;}
63
64 virtual void SetDigitsId(Int_t nDigits, const UInt_t *digitsId);
65 /// Add a digit Id to the array of associated digits
66 virtual void AddDigitId(UInt_t id) {fIndexMap[fMultiplicity[0]++][0] = id;}
67
68 /// Return number of associated digits
69 virtual Int_t GetNDigits() const {return fMultiplicity[0];}
70 /// Return Id of digits i
71 virtual UInt_t GetDigitId(Int_t i) const {return (i < fMultiplicity[0] && i < 50) ? (UInt_t)fIndexMap[i][0] : 0;}
72
73 /// Set chi2 of cluster
74 virtual void SetChi2( Double_t chi2) {fChi2[0] = chi2;}
75 /// Return chi2 of cluster
76 virtual Double_t GetChi2() const {return fChi2[0];}
77
71a2d3aa 78 /// Return radius
3afdba21 79 Float_t GetRadius(Int_t i) {return TMath::Sqrt(fX[i]*fX[i]+fY[i]*fY[i]);}
71a2d3aa 80 /// Return true as the function Compare() is implemented
3afdba21 81 Bool_t IsSortable() const {return kTRUE;}
82 Int_t Compare(const TObject *obj) const;
83 Int_t PhysicsContribution() const;
6464217e 84 virtual void Print(Option_t* opt="") const;
3afdba21 85 static Int_t BinarySearch(Float_t r, TArrayF ccord, Int_t from, Int_t upto);
86 static void SortMin(Int_t *idx,Float_t *xdarray, Float_t *xarray, Float_t *yarray, Float_t *qarray,Int_t ntr);
87 void DumpIndex();
a9e2aefa 88
a31c3507 89 Int_t AddCharge(Int_t i, Float_t Q);
3afdba21 90 Int_t AddX(Int_t i, Float_t X);
91 Int_t AddY(Int_t i, Float_t Y);
92 Int_t AddZ(Int_t i, Float_t Z);
93
2060b217 94 Float_t GetCharge(Int_t i) const;
95 Float_t GetX(Int_t i) const;
96 Float_t GetY(Int_t i) const;
97 Float_t GetZ(Int_t i) const;
6464217e 98 Int_t GetTrack(Int_t i=0) const;
2060b217 99 Float_t GetPeakSignal(Int_t i=0) const;
6464217e 100 Int_t GetMultiplicity(Int_t i=0) const;
9e993f2a 101 Int_t GetClusterType() const;
3b5272e3 102 Int_t GetGhost() const;
6464217e 103 Int_t GetNcluster(Int_t i=0) const;
2060b217 104 Float_t GetChi2(Int_t i) const;
0164904a 105 Int_t GetIndex(Int_t i, Int_t j) const;
106 Int_t GetOffset(Int_t i, Int_t j) const;
107 Float_t GetContrib(Int_t i, Int_t j) const;
108 Int_t GetPhysics(Int_t i) const;
3afdba21 109
a31c3507 110 Int_t SetCharge(Int_t i, Float_t Q);
3afdba21 111 Int_t SetX(Int_t i, Float_t X);
112 Int_t SetY(Int_t i, Float_t Y);
113 Int_t SetZ(Int_t i, Float_t Z);
9e993f2a 114 Int_t SetTrack(Int_t i, Int_t track);
a31c3507 115 Int_t SetPeakSignal(Int_t i, Float_t peaksignal);
9e993f2a 116 Int_t SetMultiplicity(Int_t i, Int_t mul);
117 Int_t SetClusterType(Int_t type);
3b5272e3 118 Int_t SetGhost(Int_t ghost);
119 Int_t SetNcluster(Int_t i, Int_t ncluster);
120 Int_t SetChi2(Int_t i, Float_t chi2);
0164904a 121 void SetIndex(Int_t i, Int_t j, Int_t index);
122 void SetOffset(Int_t i, Int_t j, Int_t offset);
123 void SetContrib(Int_t i, Int_t j, Float_t contrib);
124 void SetPhysics(Int_t i, Int_t physics);
3afdba21 125
0164904a 126private:
18b6b8c7 127 Int_t fIndexMap[50][2]; ///< Indices of digits
128 Int_t fOffsetMap[50][2]; ///< Emmanuel special
129 Float_t fContMap[50][2]; ///< Contribution from digit
2060b217 130 Int_t fPhysicsMap[50]; ///< Distinguish signal and background contr.
3b5272e3 131
a31c3507 132 Float_t fQ[2] ; ///< Q of cluster (in ADC counts)
18b6b8c7 133 Float_t fX[2] ; ///< X of cluster
134 Float_t fY[2] ; ///< Y of cluster
135 Float_t fZ[2] ; ///< Z of cluster
136 Int_t fTracks[3]; ///< Labels of overlapped tracks
a31c3507 137 Float_t fPeakSignal[2]; ///< Peak signal
18b6b8c7 138 Int_t fMultiplicity[2]; ///< Cluster multiplicity
139 Int_t fClusterType; ///< Cluster type
140 Int_t fGhost; ///< Ghost info
141 // 0 if not a ghost or ghost problem solved
3b5272e3 142 // >0 if ghost problem remains because
143 // 1 both (true and ghost) satify
144 // charge chi2 compatibility
145 // 2 none give satisfactory chi2
18b6b8c7 146 Int_t fNcluster[2]; ///< Number of clusters
147 Float_t fChi2[2]; ///< Chi**2 of fit
148 Int_t fDetElemId; ///< ID number of the detection element (slat) on which the cluster is found.
149 Float_t fErrXY[2]; ///< coordinate errors
2060b217 150
151 ClassDef(AliMUONRawCluster,3) //Cluster class for MUON
a9e2aefa 152};
0164904a 153
154// inline functions
155
71a2d3aa 156/// Return Indices of digits
0164904a 157inline Int_t AliMUONRawCluster::GetIndex(Int_t i, Int_t j) const
158{ return fIndexMap[i][j]; }
159
71a2d3aa 160/// Return Emmanuel special offset map
0164904a 161inline Int_t AliMUONRawCluster::GetOffset(Int_t i, Int_t j) const
162{ return fOffsetMap[i][j]; }
163
71a2d3aa 164/// Return Contribution from digit
0164904a 165inline Float_t AliMUONRawCluster::GetContrib(Int_t i, Int_t j) const
166{ return fContMap[i][j]; }
167
71a2d3aa 168/// Return Distinguish signal and background contr.
0164904a 169inline Int_t AliMUONRawCluster::GetPhysics(Int_t i) const
170{ return fPhysicsMap[i]; }
171
71a2d3aa 172/// Set Indices of digits
0164904a 173inline void AliMUONRawCluster::SetIndex(Int_t i, Int_t j, Int_t index)
174{ fIndexMap[i][j] = index; }
175
71a2d3aa 176/// Set Emmanuel special offset map
0164904a 177inline void AliMUONRawCluster::SetOffset(Int_t i, Int_t j, Int_t offset)
178{ fOffsetMap[i][j] = offset; }
179
71a2d3aa 180/// Set Contribution from digit
0164904a 181inline void AliMUONRawCluster::SetContrib(Int_t i, Int_t j, Float_t contrib)
182{ fContMap[i][j] = contrib; }
183
71a2d3aa 184/// Set Distinguish signal and background contr.
0164904a 185inline void AliMUONRawCluster::SetPhysics(Int_t i, Int_t physics)
186{ fPhysicsMap[i] = physics; }
187
87e6e2dd 188
a9e2aefa 189#endif
190