]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/mapping/AliMpVSegmentation.cxx
Updated for modifs in AliMpFiles
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpVSegmentation.cxx
CommitLineData
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$
dee1d5f1 17// $MpId: AliMpVSegmentation.cxx,v 1.4 2005/08/26 15:43:36 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
33ClassImp(AliMpVSegmentation)
34
35//_____________________________________________________________________________
36AliMpVSegmentation::AliMpVSegmentation()
37 : TObject()
38{
dee1d5f1 39/// Default constructor
5f91c9e8 40}
41
42//_____________________________________________________________________________
dee1d5f1 43AliMpVSegmentation::~AliMpVSegmentation()
44{
45/// Destructor
5f91c9e8 46}
47
48//
49// private methods
50//
51
52//_____________________________________________________________________________
53AliMpPadPair AliMpVSegmentation::FindPads(const TVector2& position1,
54 const TVector2& position2) const
55{
dee1d5f1 56/// Return a pair of pads with specified position.
57/// If both pads are identical, the second pad in pair is set to invalid.
5f91c9e8 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//_____________________________________________________________________________
72AliMpPadPair AliMpVSegmentation::PadsUp(const AliMpPad& pad) const
73{
dee1d5f1 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.
5f91c9e8 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//_____________________________________________________________________________
89AliMpPadPair AliMpVSegmentation::PadsDown(const AliMpPad& pad) const
90{
dee1d5f1 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.
5f91c9e8 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//_____________________________________________________________________________
107AliMpPadPair AliMpVSegmentation::PadsLeft(const AliMpPad& pad) const
108{
dee1d5f1 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.
5f91c9e8 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//_____________________________________________________________________________
124AliMpPadPair AliMpVSegmentation::PadsRight(const AliMpPad& pad) const
125{
dee1d5f1 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.
5f91c9e8 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