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