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 // Authors: David Guez, Ivana Hrivnacova; IPN Orsay
13 #include "AliMpVSegmentation.h"
14 #include "AliMpConstants.h"
16 ClassImp(AliMpVSegmentation)
18 //_____________________________________________________________________________
19 AliMpVSegmentation::AliMpVSegmentation()
25 //_____________________________________________________________________________
26 AliMpVSegmentation::~AliMpVSegmentation() {
34 //_____________________________________________________________________________
35 AliMpPadPair AliMpVSegmentation::FindPads(const TVector2& position1,
36 const TVector2& position2) const
38 // Returns a pair of pads with specified position.
39 // If both pads are identical, the second pad in pair is set to invalid.
42 AliMpPad pad1 = PadByPosition(position1, false);
43 AliMpPad pad2 = PadByPosition(position2, false);
45 if (pad1 == pad2) pad2 = AliMpPad::Invalid();
47 return AliMpPadPair(pad1, pad2);
54 //_____________________________________________________________________________
55 AliMpPadPair AliMpVSegmentation::PadsUp(const AliMpPad& pad) const
57 // Returns a pair of pads neighbouring up to the specified pad.
58 // If there is only one neighbouring pad,
59 // the second pad in pair is invalid.
63 = pad.Position()+ TVector2((-1.)*AliMpConstants::LengthStep(),
64 pad.Dimensions().Y()+ AliMpConstants::LengthStep());
66 = pad.Position()+ TVector2(AliMpConstants::LengthStep(),
67 pad.Dimensions().Y()+ AliMpConstants::LengthStep());
69 return FindPads(position1, position2);
72 //_____________________________________________________________________________
73 AliMpPadPair AliMpVSegmentation::PadsDown(const AliMpPad& pad) const
75 // Returns a pair of pads neighbouring down to the specified pad.
76 // If there is only one neighbouring pad,
77 // the second pad in pair is invalid.
81 = pad.Position()- TVector2(AliMpConstants::LengthStep(),
82 pad.Dimensions().Y()+ AliMpConstants::LengthStep());
85 = pad.Position()- TVector2((-1.)*AliMpConstants::LengthStep(),
86 pad.Dimensions().Y()+ AliMpConstants::LengthStep());
88 return FindPads(position1, position2);
91 //_____________________________________________________________________________
92 AliMpPadPair AliMpVSegmentation::PadsLeft(const AliMpPad& pad) const
94 // Returns a pair of pads neighbouring left to the specified pad.
95 // If there is only one neighbouring pad,
96 // the second in pair is invalid.
100 = pad.Position() - TVector2(pad.Dimensions().X() + AliMpConstants::LengthStep(),
101 AliMpConstants::LengthStep());
103 = pad.Position() - TVector2(pad.Dimensions().X() + AliMpConstants::LengthStep(),
104 (-1.)*AliMpConstants::LengthStep());
106 return FindPads(position1, position2);
109 //_____________________________________________________________________________
110 AliMpPadPair AliMpVSegmentation::PadsRight(const AliMpPad& pad) const
112 // Returns a pair of pads neighbouring right to the specified pad.
113 // If there is only one neighbouring pad,
114 // the second in pair is invalid.
118 = pad.Position() + TVector2(pad.Dimensions().X() + AliMpConstants::LengthStep(),
119 (-1.)*AliMpConstants::LengthStep());
121 = pad.Position() + TVector2(pad.Dimensions().X() + AliMpConstants::LengthStep(),
122 AliMpConstants::LengthStep());
124 return FindPads(position1, position2);