4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
11 /// \brief Combination of digit and mppad informations.
13 // Author Laurent Aphecetche
19 # include "TVector2.h"
22 # include "AliMpArea.h"
25 class AliMUONPad : public TObject
29 AliMUONPad(Double_t x, Double_t y,
30 Double_t dx, Double_t dy, Double_t charge);
31 AliMUONPad(const TVector2& position, const TVector2& dimensions,
33 AliMUONPad(Int_t detElemId, Int_t cathode,
34 Int_t ix, Int_t iy, Double_t x, Double_t y,
35 Double_t dx, Double_t dy, Double_t charge);
36 virtual ~AliMUONPad();
38 /// \brief Backup charge
39 /// Usefull if clustering somehow plays with the charge, this one is the "original" one
40 void BackupCharge() { fChargeBackup = fCharge; }
42 /// Return cathode number
43 Int_t Cathode() const { return fCathode; }
45 Double_t Coord(Int_t ixy) const;
48 Double_t Charge() const { return fCharge; }
49 /// Return backup charge
50 Double_t ChargeBackup() const { return fChargeBackup; }
52 /// Return detection element id
53 Int_t DetElemId() const { return fDetElemId; }
55 /// Return half dimensions in x and y (cm)
56 TVector2 Dimensions() const { return fDimensions; }
58 /// Return half dimensions in x (cm)
59 Double_t DX() const { return fDimensions.X(); }
60 /// Return half dimensions in y (cm)
61 Double_t DY() const { return fDimensions.Y(); }
63 /// Return info whether this is a real pad or a virtual one
64 Bool_t IsReal() const { return fIsReal; }
66 /// Return info whether this pad is saturated or not
67 Bool_t IsSaturated() const { return fIsSaturated; }
69 /// Return true as the function Compare is implemented
70 Bool_t IsSortable() const { return kTRUE; }
72 virtual Int_t Compare(const TObject* obj) const;
74 /// Return true if is used
75 Bool_t IsUsed() const { return fClusterId >= 0; }
78 Int_t Ix() const { return fIx; }
80 Int_t Iy() const { return fIy; }
82 virtual void Paint(Option_t* opt="");
84 /// Return positions in x and y (cm)
85 TVector2 Position() const { return fPosition; }
87 void Print(Option_t* opt = "") const;
89 /// Detach this pad from a cluster
90 void Release() { fClusterId = -1; }
92 /// Set charge to value in backup charge
93 void RevertCharge() { fCharge = fChargeBackup; }
96 void SetCharge(Double_t charge) { fCharge = charge; }
99 void SetChargeBackup(Double_t charge) { fChargeBackup = charge; }
101 void SetCoord(Int_t ixy, Double_t Coord);
104 void SetStatus(Int_t status) { fStatus = status; }
106 /// \brief Set cluster id this pad belongs to
107 /// -1 if not attached to a cluster
108 void SetClusterId(Int_t id) { fClusterId = id; }
110 /// Set info whether this pad is saturated or not
111 void SetSaturated(Bool_t val) { fIsSaturated = val; }
113 void SetSize(Int_t ixy, Double_t Size);
115 /// Set info whether this is a real pad or a virtual one
116 void SetReal(Bool_t val) { fIsReal = val; }
118 void Shift(Int_t ixy, Double_t shift);
120 Double_t Size(Int_t ixy) const;
122 /// Return status word
123 Int_t Status() const { return fStatus; }
125 /// Return position in x (cm)
126 Double_t X() const { return fPosition.X(); }
127 /// Return position in y (cm)
128 Double_t Y() const { return fPosition.Y(); }
130 static AliMpArea Overlap(const AliMUONPad& d1, const AliMUONPad& d2);
132 static Bool_t AreOverlapping(const AliMUONPad& d1, const AliMUONPad& d2,
133 const TVector2& precision,
134 AliMpArea& overlapArea);
136 static Bool_t AreOverlapping(const AliMUONPad& d1, const AliMUONPad& d2,
137 const TVector2& precision);
139 static Bool_t AreNeighbours(const AliMUONPad& d1, const AliMUONPad& d2);
143 void Init(Int_t detElemId, Int_t cathode,
145 const TVector2& position,
146 const TVector2& dimensions,
150 Bool_t fIsSaturated; ///< whether this pad is saturated or not
151 Bool_t fIsReal; ///< whether this is a real pad or a virtual one
152 Int_t fClusterId; ///< cluster id this pad belongs to (-1 if not attached to a cluster)
153 Int_t fCathode; ///< cathode number
154 Int_t fDetElemId; ///< detection element id
155 Int_t fIx; ///< x-index
156 Int_t fIy; ///< y-index
157 Int_t fStatus; ///< status word
158 TVector2 fDimensions; ///< half dimensions in x and y (cm)
159 TVector2 fPosition; ///< positions in x and y (cm)
160 Double_t fCharge; ///< pad charge
161 Double_t fChargeBackup; ///< backup charge (usefull if clustering somehow plays with the charge, this one is the "original" one)
163 ClassDef(AliMUONPad,2) // A full grown pad