]>
Commit | Line | Data |
---|---|---|
5f91c9e8 | 1 | // $Id$ |
2 | // Category: basic | |
3 | // | |
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. | |
10 | // | |
dbe945cc | 11 | // Included in AliRoot: 2003/05/02 |
5f91c9e8 | 12 | // Authors: David Guez, Ivana Hrivnacova; IPN Orsay |
13 | ||
14 | #include "AliMpVSegmentation.h" | |
15 | #include "AliMpConstants.h" | |
16 | ||
17 | ClassImp(AliMpVSegmentation) | |
18 | ||
19 | //_____________________________________________________________________________ | |
20 | AliMpVSegmentation::AliMpVSegmentation() | |
21 | : TObject() | |
22 | { | |
23 | // | |
24 | } | |
25 | ||
26 | //_____________________________________________________________________________ | |
27 | AliMpVSegmentation::~AliMpVSegmentation() { | |
28 | // | |
29 | } | |
30 | ||
31 | // | |
32 | // private methods | |
33 | // | |
34 | ||
35 | //_____________________________________________________________________________ | |
36 | AliMpPadPair AliMpVSegmentation::FindPads(const TVector2& position1, | |
37 | const TVector2& position2) const | |
38 | { | |
39 | // Returns a pair of pads with specified position. | |
40 | // If both pads are identical, the second pad in pair is set to invalid. | |
41 | // --- | |
42 | ||
43 | AliMpPad pad1 = PadByPosition(position1, false); | |
44 | AliMpPad pad2 = PadByPosition(position2, false); | |
45 | ||
46 | if (pad1 == pad2) pad2 = AliMpPad::Invalid(); | |
47 | ||
48 | return AliMpPadPair(pad1, pad2); | |
49 | } | |
50 | ||
51 | // | |
52 | // public methods | |
53 | // | |
54 | ||
55 | //_____________________________________________________________________________ | |
56 | AliMpPadPair AliMpVSegmentation::PadsUp(const AliMpPad& pad) const | |
57 | { | |
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. | |
61 | // --- | |
62 | ||
63 | TVector2 position1 | |
64 | = pad.Position()+ TVector2((-1.)*AliMpConstants::LengthStep(), | |
65 | pad.Dimensions().Y()+ AliMpConstants::LengthStep()); | |
66 | TVector2 position2 | |
67 | = pad.Position()+ TVector2(AliMpConstants::LengthStep(), | |
68 | pad.Dimensions().Y()+ AliMpConstants::LengthStep()); | |
69 | ||
70 | return FindPads(position1, position2); | |
71 | } | |
72 | ||
73 | //_____________________________________________________________________________ | |
74 | AliMpPadPair AliMpVSegmentation::PadsDown(const AliMpPad& pad) const | |
75 | { | |
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. | |
79 | // --- | |
80 | ||
81 | TVector2 position1 | |
82 | = pad.Position()- TVector2(AliMpConstants::LengthStep(), | |
83 | pad.Dimensions().Y()+ AliMpConstants::LengthStep()); | |
84 | ||
85 | TVector2 position2 | |
86 | = pad.Position()- TVector2((-1.)*AliMpConstants::LengthStep(), | |
87 | pad.Dimensions().Y()+ AliMpConstants::LengthStep()); | |
88 | ||
89 | return FindPads(position1, position2); | |
90 | } | |
91 | ||
92 | //_____________________________________________________________________________ | |
93 | AliMpPadPair AliMpVSegmentation::PadsLeft(const AliMpPad& pad) const | |
94 | { | |
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. | |
98 | // --- | |
99 | ||
100 | TVector2 position1 | |
101 | = pad.Position() - TVector2(pad.Dimensions().X() + AliMpConstants::LengthStep(), | |
102 | AliMpConstants::LengthStep()); | |
103 | TVector2 position2 | |
104 | = pad.Position() - TVector2(pad.Dimensions().X() + AliMpConstants::LengthStep(), | |
105 | (-1.)*AliMpConstants::LengthStep()); | |
106 | ||
107 | return FindPads(position1, position2); | |
108 | } | |
109 | ||
110 | //_____________________________________________________________________________ | |
111 | AliMpPadPair AliMpVSegmentation::PadsRight(const AliMpPad& pad) const | |
112 | { | |
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. | |
116 | // --- | |
117 | ||
118 | TVector2 position1 | |
119 | = pad.Position() + TVector2(pad.Dimensions().X() + AliMpConstants::LengthStep(), | |
120 | (-1.)*AliMpConstants::LengthStep()); | |
121 | TVector2 position2 | |
122 | = pad.Position() + TVector2(pad.Dimensions().X() + AliMpConstants::LengthStep(), | |
123 | AliMpConstants::LengthStep()); | |
124 | ||
125 | return FindPads(position1, position2); | |
126 | } | |
127 |