]>
Commit | Line | Data |
---|---|---|
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 | ||
16 | // $Id$ | |
17 | // $MpId: AliMpVSegmentation.cxx,v 1.4 2005/08/26 15:43:36 ivana Exp $ | |
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 | // | |
27 | // Included in AliRoot: 2003/05/02 | |
28 | // Authors: David Guez, Ivana Hrivnacova; IPN Orsay | |
29 | ||
30 | #include "AliMpVSegmentation.h" | |
31 | #include "AliMpConstants.h" | |
32 | ||
33 | ClassImp(AliMpVSegmentation) | |
34 | ||
35 | //_____________________________________________________________________________ | |
36 | AliMpVSegmentation::AliMpVSegmentation() | |
37 | : TObject() | |
38 | { | |
39 | /// Default constructor | |
40 | } | |
41 | ||
42 | //_____________________________________________________________________________ | |
43 | AliMpVSegmentation::~AliMpVSegmentation() | |
44 | { | |
45 | /// Destructor | |
46 | } | |
47 | ||
48 | // | |
49 | // private methods | |
50 | // | |
51 | ||
52 | //_____________________________________________________________________________ | |
53 | AliMpPadPair AliMpVSegmentation::FindPads(const TVector2& position1, | |
54 | const TVector2& position2) const | |
55 | { | |
56 | /// Return a pair of pads with specified position. | |
57 | /// If both pads are identical, the second pad in pair is set to invalid. | |
58 | ||
59 | AliMpPad pad1 = PadByPosition(position1, false); | |
60 | AliMpPad pad2 = PadByPosition(position2, false); | |
61 | ||
62 | if (pad1 == pad2) pad2 = AliMpPad::Invalid(); | |
63 | ||
64 | return AliMpPadPair(pad1, pad2); | |
65 | } | |
66 | ||
67 | // | |
68 | // public methods | |
69 | // | |
70 | ||
71 | //_____________________________________________________________________________ | |
72 | AliMpPadPair AliMpVSegmentation::PadsUp(const AliMpPad& pad) const | |
73 | { | |
74 | /// Return a pair of pads neighbouring up to the specified pad. | |
75 | /// If there is only one neighbouring pad, | |
76 | /// the second pad in pair is invalid. | |
77 | ||
78 | TVector2 position1 | |
79 | = pad.Position()+ TVector2((-1.)*AliMpConstants::LengthStep(), | |
80 | pad.Dimensions().Y()+ AliMpConstants::LengthStep()); | |
81 | TVector2 position2 | |
82 | = pad.Position()+ TVector2(AliMpConstants::LengthStep(), | |
83 | pad.Dimensions().Y()+ AliMpConstants::LengthStep()); | |
84 | ||
85 | return FindPads(position1, position2); | |
86 | } | |
87 | ||
88 | //_____________________________________________________________________________ | |
89 | AliMpPadPair AliMpVSegmentation::PadsDown(const AliMpPad& pad) const | |
90 | { | |
91 | /// Return a pair of pads neighbouring down to the specified pad. | |
92 | /// If there is only one neighbouring pad, | |
93 | /// the second pad in pair is invalid. | |
94 | ||
95 | TVector2 position1 | |
96 | = pad.Position()- TVector2(AliMpConstants::LengthStep(), | |
97 | pad.Dimensions().Y()+ AliMpConstants::LengthStep()); | |
98 | ||
99 | TVector2 position2 | |
100 | = pad.Position()- TVector2((-1.)*AliMpConstants::LengthStep(), | |
101 | pad.Dimensions().Y()+ AliMpConstants::LengthStep()); | |
102 | ||
103 | return FindPads(position1, position2); | |
104 | } | |
105 | ||
106 | //_____________________________________________________________________________ | |
107 | AliMpPadPair AliMpVSegmentation::PadsLeft(const AliMpPad& pad) const | |
108 | { | |
109 | /// Return a pair of pads neighbouring left to the specified pad. | |
110 | /// If there is only one neighbouring pad, | |
111 | /// the second in pair is invalid. | |
112 | ||
113 | TVector2 position1 | |
114 | = pad.Position() - TVector2(pad.Dimensions().X() + AliMpConstants::LengthStep(), | |
115 | AliMpConstants::LengthStep()); | |
116 | TVector2 position2 | |
117 | = pad.Position() - TVector2(pad.Dimensions().X() + AliMpConstants::LengthStep(), | |
118 | (-1.)*AliMpConstants::LengthStep()); | |
119 | ||
120 | return FindPads(position1, position2); | |
121 | } | |
122 | ||
123 | //_____________________________________________________________________________ | |
124 | AliMpPadPair AliMpVSegmentation::PadsRight(const AliMpPad& pad) const | |
125 | { | |
126 | /// Return a pair of pads neighbouring right to the specified pad. | |
127 | /// If there is only one neighbouring pad, | |
128 | /// the second in pair is invalid. | |
129 | ||
130 | TVector2 position1 | |
131 | = pad.Position() + TVector2(pad.Dimensions().X() + AliMpConstants::LengthStep(), | |
132 | (-1.)*AliMpConstants::LengthStep()); | |
133 | TVector2 position2 | |
134 | = pad.Position() + TVector2(pad.Dimensions().X() + AliMpConstants::LengthStep(), | |
135 | AliMpConstants::LengthStep()); | |
136 | ||
137 | return FindPads(position1, position2); | |
138 | } | |
139 |