4 // Class AliMpVSegmentation
5 // ------------------------
6 // The abstract base class for the segmentation.
7 // Provides methods related to pads:
8 // conversion between pad indices, pad location, pad position;
9 // finding pad neighbour.
11 // Included in AliRoot: 2003/05/02
12 // Authors: David Guez, Ivana Hrivnacova; IPN Orsay
14 #include "AliMpVSegmentation.h"
15 #include "AliMpConstants.h"
17 ClassImp(AliMpVSegmentation)
19 //_____________________________________________________________________________
20 AliMpVSegmentation::AliMpVSegmentation()
26 //_____________________________________________________________________________
27 AliMpVSegmentation::~AliMpVSegmentation() {
35 //_____________________________________________________________________________
36 AliMpPadPair AliMpVSegmentation::FindPads(const TVector2& position1,
37 const TVector2& position2) const
39 // Returns a pair of pads with specified position.
40 // If both pads are identical, the second pad in pair is set to invalid.
43 AliMpPad pad1 = PadByPosition(position1, false);
44 AliMpPad pad2 = PadByPosition(position2, false);
46 if (pad1 == pad2) pad2 = AliMpPad::Invalid();
48 return AliMpPadPair(pad1, pad2);
55 //_____________________________________________________________________________
56 AliMpPadPair AliMpVSegmentation::PadsUp(const AliMpPad& pad) const
58 // Returns a pair of pads neighbouring up to the specified pad.
59 // If there is only one neighbouring pad,
60 // the second pad in pair is invalid.
64 = pad.Position()+ TVector2((-1.)*AliMpConstants::LengthStep(),
65 pad.Dimensions().Y()+ AliMpConstants::LengthStep());
67 = pad.Position()+ TVector2(AliMpConstants::LengthStep(),
68 pad.Dimensions().Y()+ AliMpConstants::LengthStep());
70 return FindPads(position1, position2);
73 //_____________________________________________________________________________
74 AliMpPadPair AliMpVSegmentation::PadsDown(const AliMpPad& pad) const
76 // Returns a pair of pads neighbouring down to the specified pad.
77 // If there is only one neighbouring pad,
78 // the second pad in pair is invalid.
82 = pad.Position()- TVector2(AliMpConstants::LengthStep(),
83 pad.Dimensions().Y()+ AliMpConstants::LengthStep());
86 = pad.Position()- TVector2((-1.)*AliMpConstants::LengthStep(),
87 pad.Dimensions().Y()+ AliMpConstants::LengthStep());
89 return FindPads(position1, position2);
92 //_____________________________________________________________________________
93 AliMpPadPair AliMpVSegmentation::PadsLeft(const AliMpPad& pad) const
95 // Returns a pair of pads neighbouring left to the specified pad.
96 // If there is only one neighbouring pad,
97 // the second in pair is invalid.
101 = pad.Position() - TVector2(pad.Dimensions().X() + AliMpConstants::LengthStep(),
102 AliMpConstants::LengthStep());
104 = pad.Position() - TVector2(pad.Dimensions().X() + AliMpConstants::LengthStep(),
105 (-1.)*AliMpConstants::LengthStep());
107 return FindPads(position1, position2);
110 //_____________________________________________________________________________
111 AliMpPadPair AliMpVSegmentation::PadsRight(const AliMpPad& pad) const
113 // Returns a pair of pads neighbouring right to the specified pad.
114 // If there is only one neighbouring pad,
115 // the second in pair is invalid.
119 = pad.Position() + TVector2(pad.Dimensions().X() + AliMpConstants::LengthStep(),
120 (-1.)*AliMpConstants::LengthStep());
122 = pad.Position() + TVector2(pad.Dimensions().X() + AliMpConstants::LengthStep(),
123 AliMpConstants::LengthStep());
125 return FindPads(position1, position2);