]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/mapping/AliMpVSegmentation.cxx
Fix for the problem during PbPb run of Nov 2010 (Indra)
[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$
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 43ClassImp(AliMpVSegmentation)
13985652 44/// \endcond
5f91c9e8 45
46//_____________________________________________________________________________
47AliMpVSegmentation::AliMpVSegmentation()
48 : TObject()
49{
dee1d5f1 50/// Default constructor
5f91c9e8 51}
52
53//_____________________________________________________________________________
dee1d5f1 54AliMpVSegmentation::~AliMpVSegmentation()
55{
56/// Destructor
5f91c9e8 57}
58
c49cb542 59//_____________________________________________________________________________
60Int_t
61AliMpVSegmentation::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.
70 /// Note that it's not symmetric as we assume that pad density
71 /// can always decrease when going from left to right (or from bottom to top)
72 /// <pre>
73 /// L--T--R
74 /// | |
75 /// L |
76 /// | O R
77 /// L |
78 /// | |
79 /// L-B-B-R
80 /// </pre>
81 /// The order in which we actually test the positions has some importance,
82 /// i.e. when using this information to compute status map later on. Here's
83 /// the sequence :
84 /// <pre>
85 /// 4-- 5-- 6
86 /// | |
87 /// 3 |
88 /// | 0 7
89 /// 2 |
90 /// | |
91 /// 1-10- 9-8
92 /// </pre>
93
94 static Double_t shiftx[11] = { 0, -1, -1, -1, -1, 0, 1, 1, 1, 1/3.0, -1/3.0 };
95 static Double_t shifty[11] = { 0, -1, -1/3.0, 1/3.0, 1, 1, 1, 0, -1, -1, -1 };
96
c49cb542 97 static const Int_t kNofTestPositions(11);
98 static const Double_t kEpsilon(AliMpConstants::LengthTolerance()*2.0);
99 static Int_t centerIndex(-1);
100
c49cb542 101
102 neighbours.Delete();
103 neighbours.SetOwner(kTRUE);
104
6e97fbb8 105 if ( ! pad.IsValid() ) return 0;
106
c49cb542 107 Int_t n(0);
108
109 AliMpPad previous(AliMpPad::Invalid());
110
111 for ( Int_t i = 0; i < kNofTestPositions; ++i )
112 {
113 if ( i == centerIndex && !includeSelf )
114 {
115 if ( includeVoid )
116 {
117 previous = AliMpPad::Invalid();
118 neighbours.Add(new AliMpPad(previous));
119 ++n;
120 }
121 continue;
122 }
123
6e97fbb8 124 AliMpPad p
125 = PadByPosition(pad.GetPositionX() + ( pad.GetDimensionX() + kEpsilon )*shiftx[i],
126 pad.GetPositionY() + ( pad.GetDimensionY() + kEpsilon )*shifty[i],
127 kFALSE);
c49cb542 128
6e97fbb8 129 if ( ! p.IsValid() && ! includeVoid ) continue;
c49cb542 130
6e97fbb8 131 if ( p != previous || ! previous.IsValid() )
c49cb542 132 {
133 previous = p;
134 neighbours.Add(new AliMpPad(p));
135 ++n;
136 }
137 }
138 return n;
139}
140
5f91c9e8 141//
142// public methods
143//
144
3635f34f 145//_____________________________________________________________________________
146Bool_t
168e9c4d 147AliMpVSegmentation::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//_____________________________________________________________________________
156Bool_t
168e9c4d 157AliMpVSegmentation::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//_____________________________________________________________________________
166Bool_t
167AliMpVSegmentation::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