]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONCluster.h
bugfix: corrected defines to use right default algorithms
[u/mrichter/AliRoot.git] / MUON / AliMUONCluster.h
1 #ifndef ALIMUONCLUSTER_H
2 #define ALIMUONCLUSTER_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
9 /// \ingroup rec
10 /// \class AliMUONCluster
11 /// \brief A group of adjacent pads
12 /// 
13 // Author Laurent Aphecetche
14
15 #ifndef ROOT_TObject
16 #  include "TObject.h"
17 #endif
18 #ifndef ROOT_TVector2
19 #  include "TVector2.h"
20 #endif
21 #ifndef ROOT_TString
22 #  include "TString.h"
23 #endif
24 #ifndef ALI_MP_AREA_H
25 #  include "AliMpArea.h"
26 #endif
27 #ifndef ALI_MP_DIRECTION_H
28 #  include "AliMpDirection.h"
29 #endif
30 #ifndef ALI_MP_INT_PAIR_H
31 #  include "AliMpIntPair.h"
32 #endif
33
34 class AliMUONPad;
35 class TObjArray;
36
37 class AliMUONCluster : public TObject
38 {
39 public:
40   AliMUONCluster();
41   AliMUONCluster(const AliMUONCluster& rhs);
42   AliMUONCluster& operator=(const AliMUONCluster& rhs);
43   
44   virtual ~AliMUONCluster();
45   
46   Bool_t Contains(const AliMUONPad& pad) const;
47   
48   TString AsString() const;
49   
50   static Bool_t AreOverlapping(const AliMUONCluster& c1, const AliMUONCluster& c2);
51   
52   AliMUONPad* AddPad(const AliMUONPad& pad);
53
54   /// Area that contains all the pads (whatever the cathode)
55   AliMpArea Area() const;
56
57   /// Area that contains all the pads of a given cathode
58   AliMpArea Area(Int_t cathode) const;
59
60   Float_t Charge() const;
61   Float_t Charge(Int_t cathode) const;
62
63   /// Return the cathode's charges asymmetry
64   Float_t ChargeAsymmetry() const;
65
66   /// Return chi2 of the RawCharge fit (if any)
67   Float_t Chi2() const { return fChi2; }
68
69   virtual void Copy(TObject& obj) const;
70
71   /// Return false for pre-cluster
72   Bool_t HasPosition() const { return fHasPosition; }
73
74   /// Whether we have at least one saturated pad in a given cathode 
75   Bool_t IsSaturated(Int_t cathode) const { return fIsSaturated[cathode]; }
76   
77   /// Whether we have one saturated pad on *each* cathode
78   Bool_t IsSaturated() const { return IsSaturated(0) && IsSaturated(1); }
79   
80   /// Return the max charge on the chathod
81   Int_t MaxChargeCathode() const { return Charge(0) > Charge(1) ? 0:1; }
82
83   /// Return the max raw charge on the chathod
84   Int_t MaxRawChargeCathode() const { return RawCharge(0) > RawCharge(1) ? 0:1; }
85
86   /// Return the biggest pad dimensions for a given cathode
87   TVector2 MaxPadDimensions(Int_t cathode, Int_t statusMask, Bool_t matchMask) const;
88   
89   /// Return the biggest pad dimensions
90   TVector2 MaxPadDimensions(Int_t statusMask, Bool_t matchMask) const;
91   
92   /// Return the smallest pad dimensions for a given cathode
93   TVector2 MinPadDimensions(Int_t cathode, Int_t statusMask, Bool_t matchMask) const;
94   
95   /// Return the smallest pad dimensions
96   TVector2 MinPadDimensions(Int_t statusMask, Bool_t matchMask) const;
97   
98   Int_t Multiplicity() const;
99   Int_t Multiplicity(Int_t cathode) const;
100
101   /// Compute number of pads in X and Y direction for a given cathode.  
102   AliMpIntPair NofPads(Int_t cathode, Int_t statusMask, Bool_t matchMask) const;
103   
104   /// Number of pads in (X,Y) direction, whatever the cathode.
105   AliMpIntPair NofPads(Int_t statusMask, Bool_t matchMask=kTRUE) const;
106   
107   /// Return true as the function Compare is implemented
108   Bool_t IsSortable() const { return kTRUE; }
109   
110 //  Bool_t IsEqual(const TObject* obj) const;
111   
112   virtual Int_t Compare(const TObject* obj) const;
113   
114   AliMUONPad* Pad(Int_t index) const;
115   
116   virtual void Paint(Option_t* opt="");
117   
118   /// Return (x,y) of that cluster
119   TVector2 Position() const { return fPosition; }
120   /// Return errors on (x,y)
121   TVector2 PositionError() const { return fPositionError; }
122
123   virtual void Print(Option_t* opt="") const;
124       
125   /// By default, return the average of both cathode RawCharges.
126   Float_t RawCharge() const;
127   
128   /// Returns the RawCharge on the given cathode.
129   Float_t RawCharge(Int_t cathode) const;
130     
131   /// Return the cathode's raw charges asymmetry
132   Float_t RawChargeAsymmetry() const;
133   
134   void RemovePad(AliMUONPad* pad);
135
136   /// Set cathode (re)computed charges  
137   void SetCharge(Float_t chargeCath0, Float_t chargeCath1)
138   { fHasCharge = kTRUE; fCharge[0]=chargeCath0; fCharge[1]=chargeCath1; }
139
140   /// Set chi2 of the RawCharge fit   
141   void SetChi2(Float_t chi2) { fChi2 = chi2; }
142
143   /// Set (x,y) of that cluster and errors   
144   void SetPosition(const TVector2& pos, const TVector2& errorOnPos) 
145   { fHasPosition = kTRUE; fPosition = pos; fPositionError = errorOnPos; }
146   
147   Int_t Cathode() const;
148   
149   void AddCluster(const AliMUONCluster& cluster);
150
151   void Clear(Option_t* opt="");
152   
153 private:
154     void DumpMe() const;
155   
156 private:
157   TObjArray* fPads; ///< AliMUONPad(s) composing this cluster
158   Bool_t fHasPosition; ///< false for pre-cluster (i.e. not yet computed)
159   TVector2 fPosition; ///< (x,y) of that cluster (only valid if fHasPosition is kTRUE)
160   TVector2 fPositionError; ///< errors on (x,y)
161   Int_t fMultiplicity[2]; ///< number of pads in each cathode
162   Float_t fRawCharge[2]; ///< cathode RawCharges
163   Bool_t fHasCharge; ///< false if SetCharge has not been called
164   Float_t fCharge[2]; ///< cathode (re)computed charges
165   Float_t fChi2; ///< chi2 of the RawCharge fit (if any)
166   Bool_t fIsSaturated[2]; ///< saturation status of cathodes
167   
168   ClassDef(AliMUONCluster,2) // A cluster of AliMUONPad
169 };
170
171 #endif