6 // Class which encapsuate all informations about a pad
7 // Included in AliRoot: 2003/05/02
8 // Authors: David Guez, Ivana Hrivnacova; IPN Orsay
10 #include <Riostream.h>
16 //////////////////////////////////////////////////////////
18 // This class encapsulate all the information about a pad
20 //////////////////////////////////////////////////////////
26 //_____________________________________________________________________________
27 Bool_t operator==(const TVector2& v1,const TVector2& v2)
29 return v1.X()==v2.X() && v1.Y()==v2.Y();
33 //_____________________________________________________________________________
34 ostream& operator<<(ostream& out,const TVector2& v)
36 out << '(' << v.X() << ',' << v.Y() << ')';
40 //_____________________________________________________________________________
41 AliMpPad::AliMpPad(const AliMpIntPair& location,const AliMpIntPair& indices,
42 const TVector2& position,const TVector2& dimensions,
48 fDimensions(dimensions),
51 // Be carefull : this constructor doesn't check the validity of
52 // the correspondance between location and indices.
53 // By default, validity is set true.
54 // It is aimed to be used by MSegmentation methods, and never from outside....
58 //_____________________________________________________________________________
61 fLocation(AliMpIntPair::Invalid()),
62 fIndices(AliMpIntPair::Invalid()),
67 // Default constructor - creates pad in invalid state
71 //_____________________________________________________________________________
72 AliMpPad::AliMpPad(const AliMpPad& src)
78 //_____________________________________________________________________________
79 AliMpPad::~AliMpPad() {
83 //_____________________________________________________________________________
84 AliMpPad& AliMpPad::operator = (const AliMpPad& src)
86 // check assignement to self
87 if (this == &src) return *this;
89 // base class assignement
90 TObject::operator=(src);
92 // assignement operator
93 fLocation = src.fLocation;
94 fIndices = src.fIndices;
95 fPosition.Set(src.fPosition);
96 fDimensions.Set(src.fDimensions);
97 fValidity = src.fValidity;
102 //_____________________________________________________________________________
103 Bool_t AliMpPad::operator == (const AliMpPad& pos2) const
105 // are this and pos2 equals?
107 // one valid, one invalid
108 if (fValidity != pos2.fValidity) return false;
111 if (!fValidity) return true;
114 return (fLocation==pos2.fLocation) && (fIndices ==pos2.fIndices )
115 && (fPosition==pos2.fPosition) && (fDimensions==pos2.fDimensions);
117 //_____________________________________________________________________________
118 Bool_t AliMpPad::operator!= (const AliMpPad& pos2) const
120 // are this and pos2 equals?
121 return !(*this==pos2);
124 //_____________________________________________________________________________
125 ostream& operator<< (ostream &out, const AliMpPad& op)
128 out << "Pad: Location " << op.GetLocation()
129 << " Indices " << op.GetIndices()
130 << " Position " << op.Position()
131 << " Dimensions " << op.Dimensions();
135 out << "Pad::Invalid";
140 //_____________________________________________________________________________
141 Bool_t operator < (const AliMpPad& left, const AliMpPad& right)
143 return left.GetIndices()<right.GetIndices();
146 //_____________________________________________________________________________
147 void AliMpPad::Print(const char* /*option*/) const
149 // Prints all pad data.
153 cout << "Indices: " << fIndices << "; "
154 << " Location: " << fLocation << "; "
155 << " Position: " << fPosition.X() << " " << fPosition.Y() << "; "
156 << " Dimensions: " << fDimensions.X() << " " << fDimensions.Y()
160 cout << "Pad::Invalid " << endl;