]>
Commit | Line | Data |
---|---|---|
dee1d5f1 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
5f91c9e8 | 16 | // $Id$ |
13985652 | 17 | // $MpId: AliMpVSegmentation.cxx,v 1.5 2006/05/24 13:58:29 ivana Exp $ |
5f91c9e8 | 18 | // Category: basic |
19 | // | |
20 | // Class AliMpVSegmentation | |
21 | // ------------------------ | |
22 | // The abstract base class for the segmentation. | |
23 | // Provides methods related to pads: | |
24 | // conversion between pad indices, pad location, pad position; | |
25 | // finding pad neighbour. | |
26 | // | |
dbe945cc | 27 | // Included in AliRoot: 2003/05/02 |
5f91c9e8 | 28 | // Authors: David Guez, Ivana Hrivnacova; IPN Orsay |
29 | ||
30 | #include "AliMpVSegmentation.h" | |
31 | #include "AliMpConstants.h" | |
32 | ||
13985652 | 33 | /// \cond CLASSIMP |
5f91c9e8 | 34 | ClassImp(AliMpVSegmentation) |
13985652 | 35 | /// \endcond |
5f91c9e8 | 36 | |
37 | //_____________________________________________________________________________ | |
38 | AliMpVSegmentation::AliMpVSegmentation() | |
39 | : TObject() | |
40 | { | |
dee1d5f1 | 41 | /// Default constructor |
5f91c9e8 | 42 | } |
43 | ||
44 | //_____________________________________________________________________________ | |
dee1d5f1 | 45 | AliMpVSegmentation::~AliMpVSegmentation() |
46 | { | |
47 | /// Destructor | |
5f91c9e8 | 48 | } |
49 | ||
50 | // | |
51 | // private methods | |
52 | // | |
53 | ||
54 | //_____________________________________________________________________________ | |
55 | AliMpPadPair AliMpVSegmentation::FindPads(const TVector2& position1, | |
56 | const TVector2& position2) const | |
57 | { | |
dee1d5f1 | 58 | /// Return a pair of pads with specified position. |
59 | /// If both pads are identical, the second pad in pair is set to invalid. | |
5f91c9e8 | 60 | |
61 | AliMpPad pad1 = PadByPosition(position1, false); | |
62 | AliMpPad pad2 = PadByPosition(position2, false); | |
63 | ||
64 | if (pad1 == pad2) pad2 = AliMpPad::Invalid(); | |
65 | ||
66 | return AliMpPadPair(pad1, pad2); | |
67 | } | |
68 | ||
69 | // | |
70 | // public methods | |
71 | // | |
72 | ||
73 | //_____________________________________________________________________________ | |
74 | AliMpPadPair AliMpVSegmentation::PadsUp(const AliMpPad& pad) const | |
75 | { | |
dee1d5f1 | 76 | /// Return a pair of pads neighbouring up to the specified pad. |
77 | /// If there is only one neighbouring pad, | |
78 | /// the second pad in pair is invalid. | |
5f91c9e8 | 79 | |
80 | TVector2 position1 | |
81 | = pad.Position()+ TVector2((-1.)*AliMpConstants::LengthStep(), | |
82 | pad.Dimensions().Y()+ AliMpConstants::LengthStep()); | |
83 | TVector2 position2 | |
84 | = pad.Position()+ TVector2(AliMpConstants::LengthStep(), | |
85 | pad.Dimensions().Y()+ AliMpConstants::LengthStep()); | |
86 | ||
87 | return FindPads(position1, position2); | |
88 | } | |
89 | ||
90 | //_____________________________________________________________________________ | |
91 | AliMpPadPair AliMpVSegmentation::PadsDown(const AliMpPad& pad) const | |
92 | { | |
dee1d5f1 | 93 | /// Return a pair of pads neighbouring down to the specified pad. |
94 | /// If there is only one neighbouring pad, | |
95 | /// the second pad in pair is invalid. | |
5f91c9e8 | 96 | |
97 | TVector2 position1 | |
98 | = pad.Position()- TVector2(AliMpConstants::LengthStep(), | |
99 | pad.Dimensions().Y()+ AliMpConstants::LengthStep()); | |
100 | ||
101 | TVector2 position2 | |
102 | = pad.Position()- TVector2((-1.)*AliMpConstants::LengthStep(), | |
103 | pad.Dimensions().Y()+ AliMpConstants::LengthStep()); | |
104 | ||
105 | return FindPads(position1, position2); | |
106 | } | |
107 | ||
108 | //_____________________________________________________________________________ | |
109 | AliMpPadPair AliMpVSegmentation::PadsLeft(const AliMpPad& pad) const | |
110 | { | |
dee1d5f1 | 111 | /// Return a pair of pads neighbouring left to the specified pad. |
112 | /// If there is only one neighbouring pad, | |
113 | /// the second in pair is invalid. | |
5f91c9e8 | 114 | |
115 | TVector2 position1 | |
116 | = pad.Position() - TVector2(pad.Dimensions().X() + AliMpConstants::LengthStep(), | |
117 | AliMpConstants::LengthStep()); | |
118 | TVector2 position2 | |
119 | = pad.Position() - TVector2(pad.Dimensions().X() + AliMpConstants::LengthStep(), | |
120 | (-1.)*AliMpConstants::LengthStep()); | |
121 | ||
122 | return FindPads(position1, position2); | |
123 | } | |
124 | ||
125 | //_____________________________________________________________________________ | |
126 | AliMpPadPair AliMpVSegmentation::PadsRight(const AliMpPad& pad) const | |
127 | { | |
dee1d5f1 | 128 | /// Return a pair of pads neighbouring right to the specified pad. |
129 | /// If there is only one neighbouring pad, | |
130 | /// the second in pair is invalid. | |
5f91c9e8 | 131 | |
132 | TVector2 position1 | |
133 | = pad.Position() + TVector2(pad.Dimensions().X() + AliMpConstants::LengthStep(), | |
134 | (-1.)*AliMpConstants::LengthStep()); | |
135 | TVector2 position2 | |
136 | = pad.Position() + TVector2(pad.Dimensions().X() + AliMpConstants::LengthStep(), | |
137 | AliMpConstants::LengthStep()); | |
138 | ||
139 | return FindPads(position1, position2); | |
140 | } | |
141 |