1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
17 // $MpId: AliMpVSegmentation.cxx,v 1.5 2006/05/24 13:58:29 ivana Exp $
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.
27 // Included in AliRoot: 2003/05/02
28 // Authors: David Guez, Ivana Hrivnacova; IPN Orsay
30 #include "AliMpVSegmentation.h"
31 #include "AliMpConstants.h"
34 ClassImp(AliMpVSegmentation)
37 //_____________________________________________________________________________
38 AliMpVSegmentation::AliMpVSegmentation()
41 /// Default constructor
44 //_____________________________________________________________________________
45 AliMpVSegmentation::~AliMpVSegmentation()
54 //_____________________________________________________________________________
55 AliMpPadPair AliMpVSegmentation::FindPads(const TVector2& position1,
56 const TVector2& position2) const
58 /// Return a pair of pads with specified position.
59 /// If both pads are identical, the second pad in pair is set to invalid.
61 AliMpPad pad1 = PadByPosition(position1, false);
62 AliMpPad pad2 = PadByPosition(position2, false);
64 if (pad1 == pad2) pad2 = AliMpPad::Invalid();
66 return AliMpPadPair(pad1, pad2);
73 //_____________________________________________________________________________
74 AliMpPadPair AliMpVSegmentation::PadsUp(const AliMpPad& pad) const
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.
81 = pad.Position()+ TVector2((-1.)*AliMpConstants::LengthStep(),
82 pad.Dimensions().Y()+ AliMpConstants::LengthStep());
84 = pad.Position()+ TVector2(AliMpConstants::LengthStep(),
85 pad.Dimensions().Y()+ AliMpConstants::LengthStep());
87 return FindPads(position1, position2);
90 //_____________________________________________________________________________
91 AliMpPadPair AliMpVSegmentation::PadsDown(const AliMpPad& pad) const
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.
98 = pad.Position()- TVector2(AliMpConstants::LengthStep(),
99 pad.Dimensions().Y()+ AliMpConstants::LengthStep());
102 = pad.Position()- TVector2((-1.)*AliMpConstants::LengthStep(),
103 pad.Dimensions().Y()+ AliMpConstants::LengthStep());
105 return FindPads(position1, position2);
108 //_____________________________________________________________________________
109 AliMpPadPair AliMpVSegmentation::PadsLeft(const AliMpPad& pad) const
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.
116 = pad.Position() - TVector2(pad.Dimensions().X() + AliMpConstants::LengthStep(),
117 AliMpConstants::LengthStep());
119 = pad.Position() - TVector2(pad.Dimensions().X() + AliMpConstants::LengthStep(),
120 (-1.)*AliMpConstants::LengthStep());
122 return FindPads(position1, position2);
125 //_____________________________________________________________________________
126 AliMpPadPair AliMpVSegmentation::PadsRight(const AliMpPad& pad) const
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.
133 = pad.Position() + TVector2(pad.Dimensions().X() + AliMpConstants::LengthStep(),
134 (-1.)*AliMpConstants::LengthStep());
136 = pad.Position() + TVector2(pad.Dimensions().X() + AliMpConstants::LengthStep(),
137 AliMpConstants::LengthStep());
139 return FindPads(position1, position2);