]>
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 |
3d1463c8 | 19 | |
20 | //----------------------------------------------------------------------------- | |
5f91c9e8 | 21 | // Class AliMpVSegmentation |
22 | // ------------------------ | |
23 | // The abstract base class for the segmentation. | |
24 | // Provides methods related to pads: | |
25 | // conversion between pad indices, pad location, pad position; | |
26 | // finding pad neighbour. | |
27 | // | |
dbe945cc | 28 | // Included in AliRoot: 2003/05/02 |
5f91c9e8 | 29 | // Authors: David Guez, Ivana Hrivnacova; IPN Orsay |
c49cb542 | 30 | // Laurent Aphecetche, SUBATECH |
3d1463c8 | 31 | //----------------------------------------------------------------------------- |
32 | ||
5f91c9e8 | 33 | |
34 | #include "AliMpVSegmentation.h" | |
c49cb542 | 35 | #include "AliMpArea.h" |
5f91c9e8 | 36 | #include "AliMpConstants.h" |
37 | ||
c49cb542 | 38 | #include "AliLog.h" |
39 | ||
c49cb542 | 40 | #include "TObjArray.h" |
41 | ||
13985652 | 42 | /// \cond CLASSIMP |
5f91c9e8 | 43 | ClassImp(AliMpVSegmentation) |
13985652 | 44 | /// \endcond |
5f91c9e8 | 45 | |
46 | //_____________________________________________________________________________ | |
47 | AliMpVSegmentation::AliMpVSegmentation() | |
48 | : TObject() | |
49 | { | |
dee1d5f1 | 50 | /// Default constructor |
5f91c9e8 | 51 | } |
52 | ||
53 | //_____________________________________________________________________________ | |
dee1d5f1 | 54 | AliMpVSegmentation::~AliMpVSegmentation() |
55 | { | |
56 | /// Destructor | |
5f91c9e8 | 57 | } |
58 | ||
c49cb542 | 59 | //_____________________________________________________________________________ |
60 | Int_t | |
61 | AliMpVSegmentation::GetNeighbours(const AliMpPad& pad, | |
62 | TObjArray& neighbours, | |
63 | Bool_t includeSelf, | |
64 | Bool_t includeVoid) const | |
65 | { | |
66 | /// Returns the list of neighbours of pad | |
6e97fbb8 | 67 | /// testPositions are the positions (L,T,R,B) relative to pad's center (O) |
68 | /// were we'll try to get a neighbouring pad, by getting a little | |
69 | /// bit outside the pad itself. | |
47b3bec5 | 70 | /// The pad density can only decrease when going from left to right except |
71 | /// for round slates where it is the opposite. | |
72 | /// The pad density can only decrease when going from bottom to top but | |
73 | /// to be symmetric we also consider the opposite. | |
6e97fbb8 | 74 | /// The order in which we actually test the positions has some importance, |
75 | /// i.e. when using this information to compute status map later on. Here's | |
76 | /// the sequence : | |
77 | /// <pre> | |
47b3bec5 | 78 | /// 4- 5- 6-7 |
6e97fbb8 | 79 | /// | | |
47b3bec5 | 80 | /// 3 8 |
81 | /// | 0 | | |
82 | /// 2 9 | |
6e97fbb8 | 83 | /// | | |
47b3bec5 | 84 | /// 1-12-11-10 |
6e97fbb8 | 85 | /// </pre> |
86 | ||
47b3bec5 | 87 | static const Int_t kNofTestPositions(12); |
88 | static Double_t shiftx[12] = {-1., -1., -1., -1., -1./3., 1./3., 1., 1., 1., 1., 1./3., -1./3.}; | |
89 | static Double_t shifty[12] = {-1., -1./3., 1./3., 1., 1., 1., 1., 1./3., -1./3., -1., -1., -1.}; | |
6e97fbb8 | 90 | |
c49cb542 | 91 | static const Double_t kEpsilon(AliMpConstants::LengthTolerance()*2.0); |
c49cb542 | 92 | |
93 | neighbours.Delete(); | |
94 | neighbours.SetOwner(kTRUE); | |
95 | ||
6e97fbb8 | 96 | if ( ! pad.IsValid() ) return 0; |
47b3bec5 | 97 | |
98 | AliMpPad invalid(AliMpPad::Invalid()); | |
99 | AliMpPad *previous = &invalid; | |
c49cb542 | 100 | Int_t n(0); |
101 | ||
47b3bec5 | 102 | // consider adding the pad itself |
103 | if ( includeSelf ) | |
104 | { | |
105 | neighbours.Add(new AliMpPad(pad)); | |
106 | ++n; | |
107 | } | |
108 | else if ( includeVoid ) | |
109 | { | |
110 | neighbours.Add(new AliMpPad(invalid)); | |
111 | ++n; | |
112 | } | |
c49cb542 | 113 | |
47b3bec5 | 114 | // add the neighbours (only once) |
115 | for ( Int_t i = 0; i < kNofTestPositions; ++i ) | |
c49cb542 | 116 | { |
c49cb542 | 117 | |
47b3bec5 | 118 | AliMpPad p |
6e97fbb8 | 119 | = PadByPosition(pad.GetPositionX() + ( pad.GetDimensionX() + kEpsilon )*shiftx[i], |
120 | pad.GetPositionY() + ( pad.GetDimensionY() + kEpsilon )*shifty[i], | |
121 | kFALSE); | |
c49cb542 | 122 | |
47b3bec5 | 123 | if ( p.IsValid() && p != *previous ) |
c49cb542 | 124 | { |
47b3bec5 | 125 | previous = new AliMpPad(p); |
126 | neighbours.Add(previous); | |
c49cb542 | 127 | ++n; |
128 | } | |
47b3bec5 | 129 | else if ( includeVoid ) |
130 | { | |
131 | neighbours.Add(new AliMpPad(invalid)); | |
132 | ++n; | |
133 | } | |
134 | ||
c49cb542 | 135 | } |
47b3bec5 | 136 | |
c49cb542 | 137 | return n; |
47b3bec5 | 138 | |
c49cb542 | 139 | } |
140 | ||
5f91c9e8 | 141 | // |
142 | // public methods | |
143 | // | |
144 | ||
3635f34f | 145 | //_____________________________________________________________________________ |
146 | Bool_t | |
168e9c4d | 147 | AliMpVSegmentation::HasPadByIndices(Int_t ix, Int_t iy) const |
3635f34f | 148 | { |
149 | /// Default implementation. Must be overwritten if can be made more | |
150 | /// efficient in the child class | |
151 | ||
168e9c4d | 152 | return ( PadByIndices(ix, iy, kFALSE) != AliMpPad::Invalid() ); |
3635f34f | 153 | } |
154 | ||
155 | //_____________________________________________________________________________ | |
156 | Bool_t | |
168e9c4d | 157 | AliMpVSegmentation::HasPadByLocation(Int_t manuId, Int_t manuChannel) const |
3635f34f | 158 | { |
159 | /// Default implementation. Must be overwritten if can be made more | |
160 | /// efficient in the child class | |
161 | ||
168e9c4d | 162 | return (PadByLocation(manuId, manuChannel, kFALSE) != AliMpPad::Invalid()); |
3635f34f | 163 | } |
164 | ||
165 | //_____________________________________________________________________________ | |
166 | Bool_t | |
167 | AliMpVSegmentation::HasMotifPosition(Int_t manuId) const | |
168 | { | |
169 | /// Default implementation to know if we hold a given manu | |
170 | return ( MotifPosition(manuId) != 0x0 ); | |
171 | } | |
172 | ||
173 |