Class version updated
[u/mrichter/AliRoot.git] / MUON / AliMUONCluster.h
CommitLineData
99ccb7f7 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 ALI_MP_AREA_H
22# include "AliMpArea.h"
23#endif
24#ifndef ALI_MP_DIRECTION_H
25# include "AliMpDirection.h"
26#endif
27#ifndef ALI_MP_INT_PAIR_H
28# include "AliMpIntPair.h"
29#endif
30
31class AliMUONPad;
32class TObjArray;
33
34class AliMUONCluster : public TObject
35{
36public:
37 AliMUONCluster();
38 AliMUONCluster(const AliMUONCluster& rhs);
39 AliMUONCluster& operator=(const AliMUONCluster& rhs);
40
41 virtual ~AliMUONCluster();
42
43 void AddPad(const AliMUONPad& pad);
44
45 /// Area that contains all the pads.
46 AliMpArea Area() const;
47
48 Float_t Charge() const;
49 Float_t Charge(Int_t cathode) const;
50
51 /// Return the cathode's charges asymmetry
52 Float_t ChargeAsymmetry() const;
53
71a2d3aa 54 /// Return chi2 of the RawCharge fit (if any)
99ccb7f7 55 Float_t Chi2() const { return fChi2; }
56
57 virtual void Copy(TObject& obj) const;
58
71a2d3aa 59 /// Return false for pre-cluster
99ccb7f7 60 Bool_t HasPosition() const { return fHasPosition; }
61
62 /// Whether we have at least one saturated pad in a given cathode
63 Bool_t IsSaturated(Int_t cathode) const { return fIsSaturated[cathode]; }
64
65 /// Whether we have one saturated pad on *each* cathode
66 Bool_t IsSaturated() const { return IsSaturated(0) && IsSaturated(1); }
67
71a2d3aa 68 /// Return the max charge on the chathod
99ccb7f7 69 Int_t MaxChargeCathode() const { return Charge(0) > Charge(1) ? 0:1; }
70
71a2d3aa 71 /// Return the max raw charge on the chathod
99ccb7f7 72 Int_t MaxRawChargeCathode() const { return RawCharge(0) > RawCharge(1) ? 0:1; }
73
74 /// Return the smallest pad dimensions for a given cathode
75 TVector2 MinPadDimensions(Int_t cathode, Int_t statusMask, Bool_t matchMask) const;
76
77 /// Return the smallest pad dimensions
78 TVector2 MinPadDimensions( Int_t statusMask, Bool_t matchMask) const;
79
80 Int_t Multiplicity() const;
81 Int_t Multiplicity(Int_t cathode) const;
82
83 /// Compute number of pads in X and Y direction for a given cathode.
84 AliMpIntPair NofPads(Int_t cathode, Int_t statusMask, Bool_t matchMask) const;
85
86 /// Number of pads in (X,Y) direction, whatever the cathode.
87 AliMpIntPair NofPads(Int_t statusMask, Bool_t matchMask=kTRUE) const;
88
89 AliMUONPad* Pad(Int_t index) const;
90
91 virtual void Paint(Option_t* opt="");
92
71a2d3aa 93 /// Return (x,y) of that cluster
99ccb7f7 94 TVector2 Position() const { return fPosition; }
71a2d3aa 95 /// Return errors on (x,y)
99ccb7f7 96 TVector2 PositionError() const { return fPositionError; }
97
98 virtual void Print(Option_t* opt="") const;
99
100 /// By default, return the average of both cathode RawCharges.
101 Float_t RawCharge() const;
102
103 /// Returns the RawCharge on the given cathode.
104 Float_t RawCharge(Int_t cathode) const;
105
106 /// Return the cathode's raw charges asymmetry
107 Float_t RawChargeAsymmetry() const;
108
109 void RemovePad(AliMUONPad* pad);
71a2d3aa 110
111 /// Set cathode (re)computed charges
99ccb7f7 112 void SetCharge(Float_t chargeCath0, Float_t chargeCath1)
113 { fHasCharge = kTRUE; fCharge[0]=chargeCath0; fCharge[1]=chargeCath1; }
71a2d3aa 114
115 /// Set chi2 of the RawCharge fit
99ccb7f7 116 void SetChi2(Float_t chi2) { fChi2 = chi2; }
117
71a2d3aa 118 /// Set (x,y) of that cluster and errors
99ccb7f7 119 void SetPosition(const TVector2& pos, const TVector2& errorOnPos)
120 { fHasPosition = kTRUE; fPosition = pos; fPositionError = errorOnPos; }
121
122 void Sort();
123
124private:
125 TObjArray* fPads; ///< AliMUONPad(s) composing this cluster
126 Bool_t fHasPosition; ///< false for pre-cluster (i.e. not yet computed)
127 TVector2 fPosition; ///< (x,y) of that cluster (only valid if fHasPosition is kTRUE)
128 TVector2 fPositionError; ///< errors on (x,y)
129 Int_t fMultiplicity[2]; ///< number of pads in each cathode
130 Float_t fRawCharge[2]; ///< cathode RawCharges
131 Bool_t fHasCharge; ///< false if SetCharge has not been called
132 Float_t fCharge[2]; ///< cathode (re)computed charges
133 Float_t fChi2; ///< chi2 of the RawCharge fit (if any)
134 Bool_t fIsSaturated[2]; ///< saturation status of cathodes
135 Bool_t fIsSorted; ///< whether pads are sorted or not
136 ClassDef(AliMUONCluster,1) // A cluster of AliMUONPad
137};
138
139#endif