]>
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: AliMpSectorSegmentation.cxx,v 1.15 2006/05/24 13:58:46 ivana Exp $ |
5f91c9e8 | 18 | // Category: sector |
3d1463c8 | 19 | |
20 | //----------------------------------------------------------------------------- | |
5f91c9e8 | 21 | // Class AliMpSectorSegmentation |
22 | // ----------------------------- | |
23 | // Class describing the segmentation of the sector. | |
24 | // Provides methods related to pads: | |
25 | // conversion between pad indices, pad location, pad position; | |
26 | // finding pad neighbour. | |
27 | // | |
28 | // Authors: David Guez, Ivana Hrivnacova; IPN Orsay | |
3d1463c8 | 29 | //----------------------------------------------------------------------------- |
5f91c9e8 | 30 | |
5f91c9e8 | 31 | #include "AliMpSectorSegmentation.h" |
32 | #include "AliMpSector.h" | |
33 | #include "AliMpZone.h" | |
2998a151 | 34 | #include "AliMpSubZone.h" |
5f91c9e8 | 35 | #include "AliMpRow.h" |
36 | #include "AliMpVRowSegment.h" | |
37 | #include "AliMpMotifMap.h" | |
38 | #include "AliMpVMotif.h" | |
39 | #include "AliMpMotifPosition.h" | |
40 | #include "AliMpConnection.h" | |
5f91c9e8 | 41 | #include "AliMpSectorAreaHPadIterator.h" |
42 | #include "AliMpSectorAreaVPadIterator.h" | |
dbea2959 | 43 | #include "AliMpSectorPadIterator.h" |
2998a151 | 44 | #include "AliMpArea.h" |
5f91c9e8 | 45 | #include "AliMpConstants.h" |
168e9c4d | 46 | #include "AliMpEncodePair.h" |
5f91c9e8 | 47 | |
63bcb3c3 | 48 | #include "AliLog.h" |
49 | ||
50 | #include <Riostream.h> | |
51 | #include <TMath.h> | |
5f91c9e8 | 52 | |
b80faac0 | 53 | using std::cout; |
54 | using std::endl; | |
13985652 | 55 | /// \cond CLASSIMP |
56 | ClassImp(AliMpSectorSegmentation) | |
57 | /// \endcond | |
58 | ||
5f91c9e8 | 59 | //______________________________________________________________________________ |
d79286ca | 60 | AliMpSectorSegmentation::AliMpSectorSegmentation( |
61 | const AliMpSector* sector, Bool_t own) | |
5f91c9e8 | 62 | : AliMpVSegmentation(), |
580c28fd | 63 | fkSector(sector), |
d79286ca | 64 | fIsOwner(own), |
13e7956b | 65 | fPadBuffer(0), |
580c28fd | 66 | fMaxIndexInX(0), |
67 | fMaxIndexInY(0) | |
5f91c9e8 | 68 | { |
dee1d5f1 | 69 | /// Standard constructor |
70 | ||
d79286ca | 71 | AliDebugStream(1) << "this = " << this << endl; |
72 | ||
5f91c9e8 | 73 | fPadBuffer = new AliMpPad(AliMpPad::Invalid()); |
74 | ||
6e97fbb8 | 75 | //FillPadDimensionsMap(); |
5f91c9e8 | 76 | } |
77 | ||
78 | //______________________________________________________________________________ | |
79 | AliMpSectorSegmentation::AliMpSectorSegmentation() | |
80 | : AliMpVSegmentation(), | |
81 | fkSector(0), | |
d79286ca | 82 | fIsOwner(false), |
5f91c9e8 | 83 | fPadBuffer(0), |
580c28fd | 84 | fMaxIndexInX(0), |
85 | fMaxIndexInY(0) | |
5f91c9e8 | 86 | { |
dee1d5f1 | 87 | /// Default constructor |
d79286ca | 88 | |
89 | AliDebugStream(1) << "this = " << this << endl; | |
5f91c9e8 | 90 | } |
91 | ||
92 | //______________________________________________________________________________ | |
dee1d5f1 | 93 | AliMpSectorSegmentation::~AliMpSectorSegmentation() |
94 | { | |
95 | /// Destructor | |
96 | ||
d79286ca | 97 | AliDebugStream(1) << "this = " << this << endl; |
98 | ||
99 | if ( fIsOwner ) delete fkSector; | |
100 | ||
5f91c9e8 | 101 | delete fPadBuffer; |
d79286ca | 102 | |
5f91c9e8 | 103 | } |
104 | ||
105 | // | |
106 | // private methods | |
107 | // | |
108 | ||
5f91c9e8 | 109 | //______________________________________________________________________________ |
110 | AliMpMotifPosition* | |
168e9c4d | 111 | AliMpSectorSegmentation::FindMotifPosition(Int_t ix, Int_t iy) const |
5f91c9e8 | 112 | { |
dee1d5f1 | 113 | /// Find the motif position which contains the given pad indices |
114 | /// return 0 if not found | |
5f91c9e8 | 115 | |
168e9c4d | 116 | switch ( fkSector->GetDirection() ) { |
cddd101e | 117 | case AliMp::kX : { |
5f91c9e8 | 118 | // Case where all the pads have the same size along X direction |
119 | ||
168e9c4d | 120 | for ( Int_t irow=0; irow<fkSector->GetNofRows(); ++irow ) { |
5f91c9e8 | 121 | AliMpRow* row = fkSector->GetRow(irow); |
168e9c4d | 122 | if ( row->GetLowLimitIx() <= ix && |
123 | row->GetHighLimitIx()>= ix ) { | |
5f91c9e8 | 124 | |
168e9c4d | 125 | for ( Int_t iseg=0;iseg<row->GetNofRowSegments();++iseg ) { |
5f91c9e8 | 126 | AliMpVRowSegment* seg = row->GetRowSegment(iseg); |
168e9c4d | 127 | if ( seg->GetLowLimitIx() <= ix && |
128 | seg->GetHighLimitIx() >= ix ) { | |
5f91c9e8 | 129 | |
130 | AliMpMotifPosition* motifPos; | |
168e9c4d | 131 | for ( Int_t imot=0;imot<seg->GetNofMotifs();++imot ) { |
5f91c9e8 | 132 | motifPos |
133 | = fkSector->GetMotifMap() | |
134 | ->FindMotifPosition(seg->GetMotifPositionId(imot)); | |
168e9c4d | 135 | if (motifPos && motifPos->HasPadByIndices(AliMp::Pair(ix,iy))) return motifPos; |
5f91c9e8 | 136 | } |
137 | } | |
138 | } | |
139 | } | |
140 | } | |
141 | return 0; | |
142 | } | |
dee1d5f1 | 143 | break; |
5f91c9e8 | 144 | //////////////////////////////////////////////////////////////////////////////// |
cddd101e | 145 | case AliMp::kY : { |
5f91c9e8 | 146 | // Case where all the pads have the same size along Y direction |
147 | // look for the row which contains the indices | |
148 | AliMpRow* row=0; | |
149 | Int_t irow; | |
168e9c4d | 150 | for ( irow=0; irow<fkSector->GetNofRows(); ++irow ) { |
5f91c9e8 | 151 | row = fkSector->GetRow(irow); |
152 | AliMpVRowSegment* lastSeg = row->GetRowSegment(row->GetNofRowSegments()-1); | |
168e9c4d | 153 | if ( lastSeg->GetLowLimitIy() <= iy && |
154 | lastSeg->GetHighLimitIy() >= iy ) break; | |
5f91c9e8 | 155 | // NOTE : We use the last row segment in order to ensure that |
156 | // we are not on a special motif | |
157 | } | |
168e9c4d | 158 | if ( irow==fkSector->GetNofRows() ) return 0; |
5f91c9e8 | 159 | // look for the row segment, in the found row, which contains the indices |
160 | AliMpVRowSegment* seg=0; | |
161 | Int_t iseg; | |
168e9c4d | 162 | for ( iseg=0;iseg<row->GetNofRowSegments();++iseg ) { |
5f91c9e8 | 163 | seg = row->GetRowSegment(iseg); |
168e9c4d | 164 | if (seg->HasIndices(AliMp::Pair(ix, iy))) break; |
5f91c9e8 | 165 | } |
168e9c4d | 166 | if ( iseg==row->GetNofRowSegments() ) return 0; |
5f91c9e8 | 167 | |
168 | // look for the motif position which contains the indices | |
169 | AliMpMotifPosition* motifPos=0; | |
170 | Int_t imot=0; | |
168e9c4d | 171 | for ( imot=0;imot<seg->GetNofMotifs();++imot ) { |
5f91c9e8 | 172 | motifPos |
173 | = fkSector->GetMotifMap() | |
174 | ->FindMotifPosition(seg->GetMotifPositionId(imot)); | |
168e9c4d | 175 | if (motifPos && motifPos->HasPadByIndices(AliMp::Pair(ix, iy))) break; |
5f91c9e8 | 176 | } |
177 | if (imot==seg->GetNofMotifs()) return 0; | |
178 | ||
179 | return motifPos; | |
180 | } | |
181 | default: return 0; | |
182 | } | |
183 | } | |
184 | ||
185 | //______________________________________________________________________________ | |
186 | AliMpPad | |
6e97fbb8 | 187 | AliMpSectorSegmentation::PadByXDirection(Double_t startx, Double_t starty, |
5f91c9e8 | 188 | Double_t maxX) const |
189 | { | |
dee1d5f1 | 190 | /// Find the first valid pad from starting position in the |
191 | /// direction of pad lines up to distance dx. | |
5f91c9e8 | 192 | |
193 | // Define step limits | |
6e97fbb8 | 194 | Double_t stepX = fkSector->GetMinPadDimensionX(); |
5f91c9e8 | 195 | |
196 | // Search in X direction | |
197 | AliMpPad pad; | |
6e97fbb8 | 198 | Double_t posx = startx; |
5f91c9e8 | 199 | do { |
6e97fbb8 | 200 | pad = PadByPosition(posx, starty, false); |
201 | posx += stepX; | |
5f91c9e8 | 202 | } |
6e97fbb8 | 203 | while ( ! pad.IsValid() && |
204 | posx - fkSector->GetMaxPadDimensionX() < maxX ); | |
5f91c9e8 | 205 | |
206 | // Invalidate pad if it is outside limits | |
6e97fbb8 | 207 | if ( ( pad.GetPositionX() - pad.GetDimensionX()) > maxX ) |
5f91c9e8 | 208 | pad = AliMpPad::Invalid(); |
209 | ||
210 | return pad; | |
211 | } | |
212 | ||
213 | //______________________________________________________________________________ | |
214 | AliMpPad | |
6e97fbb8 | 215 | AliMpSectorSegmentation::PadByYDirection(Double_t startx, Double_t starty, |
5f91c9e8 | 216 | Double_t maxY) const |
217 | { | |
dee1d5f1 | 218 | /// Find the first valid pad from starting position in the |
219 | /// direction of pad columns up to distance dx. | |
5f91c9e8 | 220 | |
221 | // Define step limits | |
6e97fbb8 | 222 | Double_t stepY = fkSector->GetMinPadDimensionY(); |
5f91c9e8 | 223 | |
224 | // Search in Y direction | |
225 | AliMpPad pad; | |
6e97fbb8 | 226 | Double_t posy = starty; |
5f91c9e8 | 227 | do { |
6e97fbb8 | 228 | pad = PadByPosition(startx, posy, false); |
229 | posy += stepY; | |
5f91c9e8 | 230 | } |
6e97fbb8 | 231 | while ( ! pad.IsValid() && |
232 | posy - fkSector->GetMaxPadDimensionY()< maxY ); | |
5f91c9e8 | 233 | |
234 | // Invalidate pad if it is outside limits | |
6e97fbb8 | 235 | if (( pad.GetPositionY() - pad.GetDimensionY()) > maxY ) |
5f91c9e8 | 236 | pad = AliMpPad::Invalid(); |
237 | ||
238 | return pad; | |
239 | } | |
240 | ||
5f91c9e8 | 241 | // |
242 | // public methods | |
243 | // | |
244 | ||
245 | //______________________________________________________________________________ | |
246 | AliMpVPadIterator* | |
247 | AliMpSectorSegmentation::CreateIterator(const AliMpArea& area) const | |
248 | { | |
dee1d5f1 | 249 | /// Create the area iterator. |
5f91c9e8 | 250 | |
251 | switch (fkSector->GetDirection()) { | |
252 | ||
cddd101e | 253 | case AliMp::kX: return new AliMpSectorAreaVPadIterator(this, area); |
5f91c9e8 | 254 | ;; |
cddd101e | 255 | case AliMp::kY: return new AliMpSectorAreaHPadIterator(this, area); |
5f91c9e8 | 256 | ;; |
257 | } | |
258 | ||
259 | Fatal("CreateIterator", "Incomplete switch on Sector direction"); | |
260 | return 0; | |
261 | } | |
262 | ||
984a565f | 263 | //______________________________________________________________________________ |
3635f34f | 264 | AliMpVPadIterator* |
265 | AliMpSectorSegmentation::CreateIterator() const | |
984a565f | 266 | { |
3635f34f | 267 | /// Create the sector iterator |
268 | ||
269 | return new AliMpSectorPadIterator(fkSector); | |
984a565f | 270 | } |
271 | ||
63bcb3c3 | 272 | //______________________________________________________________________________ |
3635f34f | 273 | Int_t |
274 | AliMpSectorSegmentation::GetNeighbours(const AliMpPad& pad, TObjArray& neighbours, | |
275 | Bool_t includeSelf, | |
276 | Bool_t includeVoid) const | |
63bcb3c3 | 277 | { |
3635f34f | 278 | /// Uses default implementation |
279 | return AliMpVSegmentation::GetNeighbours(pad,neighbours,includeSelf,includeVoid); | |
63bcb3c3 | 280 | } |
281 | ||
5f91c9e8 | 282 | //______________________________________________________________________________ |
283 | AliMpPad | |
168e9c4d | 284 | AliMpSectorSegmentation::PadByLocation(Int_t manuId, Int_t manuChannel, |
5f91c9e8 | 285 | Bool_t warning) const |
286 | { | |
dee1d5f1 | 287 | /// Find the pad which corresponds to the given location |
6e97fbb8 | 288 | |
168e9c4d | 289 | if ( fPadBuffer->GetManuId() == manuId && |
290 | fPadBuffer->GetManuChannel() == manuChannel ) return (*fPadBuffer); | |
5f91c9e8 | 291 | |
292 | AliMpMotifPosition* motifPos = | |
168e9c4d | 293 | fkSector->GetMotifMap()->FindMotifPosition(manuId); |
5f91c9e8 | 294 | if (!motifPos){ |
295 | if (warning) Warning("PadByLocation","The pad motif position ID doesn't exists"); | |
296 | return AliMpPad::Invalid(); | |
297 | } | |
298 | ||
299 | AliMpVMotif* motif = motifPos->GetMotif(); | |
168e9c4d | 300 | MpPair_t localIndices = |
301 | motif->GetMotifType()->FindLocalIndicesByGassiNum(manuChannel); | |
302 | if ( localIndices < 0 ) { | |
5f91c9e8 | 303 | if (warning) Warning("PadByLocation","The pad number doesn't exists"); |
304 | return AliMpPad::Invalid(); | |
305 | } | |
6e97fbb8 | 306 | |
307 | Double_t posx, posy; | |
308 | motif->PadPositionLocal(localIndices, posx, posy); | |
309 | posx += motifPos->GetPositionX(); | |
310 | posy += motifPos->GetPositionY(); | |
311 | ||
312 | Double_t dx, dy; | |
313 | motif->GetPadDimensionsByIndices(localIndices, dx, dy); | |
168e9c4d | 314 | |
315 | return (*fPadBuffer) = AliMpPad(manuId, manuChannel, | |
5f91c9e8 | 316 | motifPos->GlobalIndices(localIndices), |
6e97fbb8 | 317 | posx, posy, dx, dy); |
5f91c9e8 | 318 | } |
319 | //______________________________________________________________________________ | |
320 | AliMpPad | |
168e9c4d | 321 | AliMpSectorSegmentation::PadByIndices(Int_t ix, Int_t iy, Bool_t warning ) const |
5f91c9e8 | 322 | { |
dee1d5f1 | 323 | /// Find the pad which corresponds to the given indices |
5f91c9e8 | 324 | |
168e9c4d | 325 | if ( fPadBuffer->GetIx() == ix && |
326 | fPadBuffer->GetIy() == iy ) return (*fPadBuffer); | |
327 | ||
328 | MpPair_t indices = AliMp::Pair(ix, iy); | |
329 | AliMpMotifPosition* motifPos = FindMotifPosition(ix, iy); | |
5f91c9e8 | 330 | if (!motifPos) { |
073fe42a | 331 | if (warning) |
580c28fd | 332 | Warning("PadByIndices","Pad indices not contained in any motif!"); |
5f91c9e8 | 333 | return AliMpPad::Invalid(); |
334 | } | |
335 | ||
336 | // retrieve the local indices in the found motif | |
337 | AliMpVMotif* motif = motifPos->GetMotif(); | |
168e9c4d | 338 | MpPair_t localIndices = indices - motifPos->GetLowIndicesLimit(); |
5f91c9e8 | 339 | |
340 | AliMpConnection* connection= | |
341 | motif->GetMotifType()->FindConnectionByLocalIndices(localIndices); | |
342 | ||
343 | if (!connection){ | |
344 | if (warning) Warning("PadByIndices","No connection with the given indices!"); | |
345 | return AliMpPad::Invalid(); | |
346 | } | |
347 | ||
6e97fbb8 | 348 | Double_t posx, posy; |
349 | motif->PadPositionLocal(localIndices, posx, posy); | |
350 | posx += motifPos->GetPositionX(); | |
351 | posy += motifPos->GetPositionY(); | |
352 | ||
353 | Double_t dx, dy; | |
354 | motif->GetPadDimensionsByIndices(localIndices, dx, dy); | |
5f91c9e8 | 355 | |
356 | return (*fPadBuffer) | |
168e9c4d | 357 | = AliMpPad(motifPos->GetID(),connection->GetManuChannel(), |
6e97fbb8 | 358 | ix, iy, posx, posy, dx, dy); |
5f91c9e8 | 359 | } |
6e97fbb8 | 360 | |
5f91c9e8 | 361 | //______________________________________________________________________________ |
362 | AliMpPad | |
6e97fbb8 | 363 | AliMpSectorSegmentation::PadByPosition(Double_t x, Double_t y, |
5f91c9e8 | 364 | Bool_t warning) const |
365 | { | |
dee1d5f1 | 366 | /// Find the pad which corresponds to the given position |
5f91c9e8 | 367 | |
6e97fbb8 | 368 | if (fPadBuffer->GetPositionX()==x && |
369 | fPadBuffer->GetPositionY()==y) return (*fPadBuffer); | |
5f91c9e8 | 370 | |
6e97fbb8 | 371 | Int_t motifPosID = fkSector->FindMotifPositionId(x,y); |
5f91c9e8 | 372 | AliMpMotifPosition* motifPos |
373 | = fkSector->GetMotifMap() | |
374 | ->FindMotifPosition(motifPosID); | |
375 | ||
376 | if (!motifPos){ | |
377 | if (warning) Warning("PadByPosition","Position outside limits"); | |
378 | return AliMpPad::Invalid(); | |
379 | } | |
380 | ||
381 | AliMpVMotif* motif = motifPos->GetMotif(); | |
168e9c4d | 382 | MpPair_t localIndices |
6e97fbb8 | 383 | = motif->PadIndicesLocal(x-motifPos->GetPositionX(), |
384 | y-motifPos->GetPositionY()); | |
168e9c4d | 385 | |
386 | if ( localIndices < 0 ) { | |
654f27d4 | 387 | if (warning) Warning("PadByPosition","Position outside motif limits"); |
388 | return AliMpPad::Invalid(); | |
389 | } | |
390 | ||
5f91c9e8 | 391 | AliMpConnection* connect = |
392 | motif->GetMotifType()->FindConnectionByLocalIndices(localIndices); | |
393 | ||
654f27d4 | 394 | if ( ! connect ) { |
5f91c9e8 | 395 | if (warning) Warning("PadByPosition","Position outside motif limits"); |
396 | return AliMpPad::Invalid(); | |
397 | } | |
6e97fbb8 | 398 | |
399 | Double_t posx, posy; | |
400 | motif->PadPositionLocal(localIndices, posx, posy); | |
401 | posx += motifPos->GetPositionX(); | |
402 | posy += motifPos->GetPositionY(); | |
403 | ||
404 | Double_t dx, dy; | |
405 | motif->GetPadDimensionsByIndices(localIndices, dx, dy); | |
5f91c9e8 | 406 | |
407 | return (*fPadBuffer) | |
168e9c4d | 408 | = AliMpPad(motifPosID, connect->GetManuChannel(), |
5f91c9e8 | 409 | motifPos->GlobalIndices(localIndices), |
6e97fbb8 | 410 | posx, posy, dx, dy); |
5f91c9e8 | 411 | } |
412 | ||
413 | //______________________________________________________________________________ | |
414 | AliMpPad | |
6e97fbb8 | 415 | AliMpSectorSegmentation::PadByDirection(Double_t startx, Double_t starty, |
5f91c9e8 | 416 | Double_t distance) const |
417 | { | |
dee1d5f1 | 418 | /// Find the first valid pad from starting position in the |
419 | /// direction of pad lines/columns up to the specified distance. | |
420 | /// Pad lines are the lines of pads in the sector with constant pad y size, | |
421 | /// pad columns are the columns of pads in the sector with constant pad x size. | |
5f91c9e8 | 422 | |
423 | switch (fkSector->GetDirection()) { | |
424 | ||
6e97fbb8 | 425 | case AliMp::kX: return PadByYDirection(startx, starty, distance); |
5f91c9e8 | 426 | ;; |
6e97fbb8 | 427 | case AliMp::kY: return PadByXDirection(startx, starty, distance); |
5f91c9e8 | 428 | ;; |
429 | } | |
430 | ||
431 | Fatal("PadByDirection", "Incomplete switch on Sector direction"); | |
432 | return AliMpPad::Invalid(); | |
433 | } | |
434 | ||
3635f34f | 435 | //_____________________________________________________________________________ |
436 | Bool_t | |
168e9c4d | 437 | AliMpSectorSegmentation::HasPadByIndices(Int_t ix, Int_t iy) const |
3635f34f | 438 | { |
439 | /// Whether or not we have a pad at indices=(ix,iy) | |
440 | ||
168e9c4d | 441 | MpPair_t indices = AliMp::Pair(ix, iy); |
442 | ||
443 | AliMpMotifPosition* motifPos = FindMotifPosition(ix, iy); | |
3635f34f | 444 | |
445 | if (motifPos) return motifPos->HasPadByIndices(indices); | |
446 | ||
447 | return kFALSE; | |
448 | } | |
449 | ||
450 | //_____________________________________________________________________________ | |
451 | Bool_t | |
168e9c4d | 452 | AliMpSectorSegmentation::HasPadByLocation(Int_t manuId, Int_t manuChannel) const |
3635f34f | 453 | { |
454 | /// Whether or not we have a pad at location=(manuId,manuChannel) | |
455 | ||
168e9c4d | 456 | AliMpMotifPosition* motifPos |
457 | = fkSector->GetMotifMap()->FindMotifPosition(manuId); | |
3635f34f | 458 | |
168e9c4d | 459 | if ( motifPos ) return motifPos->HasPadByManuChannel(manuChannel); |
3635f34f | 460 | |
461 | return kFALSE; | |
462 | } | |
463 | ||
580c28fd | 464 | //______________________________________________________________________________ |
bd984e15 | 465 | Int_t AliMpSectorSegmentation::MaxPadIndexX() const |
580c28fd | 466 | { |
dee1d5f1 | 467 | /// Return maximum pad index in x |
580c28fd | 468 | |
168e9c4d | 469 | return AliMp::PairFirst(fkSector->GetMaxPadIndices()); |
580c28fd | 470 | } |
471 | ||
472 | //______________________________________________________________________________ | |
bd984e15 | 473 | Int_t AliMpSectorSegmentation::MaxPadIndexY() const |
580c28fd | 474 | { |
dee1d5f1 | 475 | /// Return maximum pad index in y |
580c28fd | 476 | |
168e9c4d | 477 | return AliMp::PairSecond(fkSector->GetMaxPadIndices()); |
bd984e15 | 478 | } |
479 | ||
480 | //______________________________________________________________________________ | |
481 | Int_t AliMpSectorSegmentation::NofPads() const | |
482 | { | |
483 | /// Return number of pads defined in the sector | |
484 | ||
485 | return fkSector->GetNofPads(); | |
580c28fd | 486 | } |
487 | ||
3635f34f | 488 | //_____________________________________________________________________________ |
489 | void | |
490 | AliMpSectorSegmentation::GetAllElectronicCardIDs(TArrayI& ecn) const | |
5f91c9e8 | 491 | { |
3635f34f | 492 | /// Fill the array ecn with all manuIds |
5f91c9e8 | 493 | |
3635f34f | 494 | GetSector()->GetAllMotifPositionsIDs(ecn); |
495 | } | |
496 | ||
497 | //_____________________________________________________________________________ | |
498 | Int_t | |
499 | AliMpSectorSegmentation::GetNofElectronicCards() const | |
500 | { | |
501 | /// Get the number of manus of this sector | |
502 | ||
503 | return fkSector->GetNofMotifPositions(); | |
504 | } | |
505 | ||
506 | //_____________________________________________________________________________ | |
507 | Bool_t | |
508 | AliMpSectorSegmentation::HasMotifPosition(Int_t manuId) const | |
509 | { | |
510 | /// Whether we get a given manu. Uses default implementation | |
511 | return (AliMpVSegmentation::HasMotifPosition(manuId) != 0x0); | |
512 | } | |
513 | ||
514 | //_____________________________________________________________________________ | |
515 | AliMpMotifPosition* | |
516 | AliMpSectorSegmentation::MotifPosition(Int_t manuId) const | |
517 | { | |
518 | /// Return a given manu | |
519 | return fkSector->GetMotifMap()->FindMotifPosition(manuId); | |
5f91c9e8 | 520 | } |
521 | ||
522 | //______________________________________________________________________________ | |
3635f34f | 523 | AliMp::PlaneType |
524 | AliMpSectorSegmentation::PlaneType() const | |
525 | { | |
526 | return GetSector()->GetPlaneType(); | |
527 | } | |
528 | ||
6e97fbb8 | 529 | //_____________________________________________________________________________ |
530 | Double_t | |
531 | AliMpSectorSegmentation::GetDimensionX() const | |
5f91c9e8 | 532 | { |
6e97fbb8 | 533 | /// Return sector x dimensions |
534 | return GetSector()->GetDimensionX(); | |
535 | } | |
5f91c9e8 | 536 | |
6e97fbb8 | 537 | //_____________________________________________________________________________ |
538 | Double_t | |
539 | AliMpSectorSegmentation::GetDimensionY() const | |
540 | { | |
541 | /// Return sector y dimensions | |
542 | return GetSector()->GetDimensionY(); | |
5f91c9e8 | 543 | } |
544 | ||
6e97fbb8 | 545 | //_____________________________________________________________________________ |
546 | Double_t | |
547 | AliMpSectorSegmentation::GetPositionX() const | |
548 | { | |
549 | /// Return x position | |
550 | return 0.; | |
551 | } | |
3635f34f | 552 | |
6e97fbb8 | 553 | //_____________________________________________________________________________ |
554 | Double_t | |
555 | AliMpSectorSegmentation::GetPositionY() const | |
556 | { | |
557 | /// Return y position | |
558 | return 0.; | |
3635f34f | 559 | } |
560 | ||
561 | //______________________________________________________________________________ | |
562 | void | |
563 | AliMpSectorSegmentation::Print(Option_t* opt) const | |
5f91c9e8 | 564 | { |
3635f34f | 565 | /// Print the sector |
5f91c9e8 | 566 | |
3635f34f | 567 | fkSector->Print(opt); |
568 | } | |
5f91c9e8 | 569 | |
570 | //______________________________________________________________________________ | |
6e97fbb8 | 571 | Double_t AliMpSectorSegmentation::GetMinPadDimensionX() const |
5f91c9e8 | 572 | { |
6e97fbb8 | 573 | /// Return the x dimension of the smallest pad. |
5f91c9e8 | 574 | |
6e97fbb8 | 575 | return fkSector->GetMinPadDimensionX(); |
5f91c9e8 | 576 | } |
577 | ||
5f91c9e8 | 578 | |
3635f34f | 579 | //______________________________________________________________________________ |
6e97fbb8 | 580 | Double_t AliMpSectorSegmentation::GetMinPadDimensionY() const |
3635f34f | 581 | { |
6e97fbb8 | 582 | /// Return the y dimension of the smallest pad. |
3635f34f | 583 | |
6e97fbb8 | 584 | return fkSector->GetMinPadDimensionY(); |
3635f34f | 585 | } |
586 | ||
6e97fbb8 | 587 | |
5f91c9e8 | 588 | //______________________________________________________________________________ |
168e9c4d | 589 | Bool_t AliMpSectorSegmentation::CircleTest(Int_t ix, Int_t iy) const |
5f91c9e8 | 590 | { |
dee1d5f1 | 591 | /// Verify that all methods for retrieving pads are consistents between them. |
592 | /// Return true if the pad with specified indices was found and verified, | |
593 | /// false otherwise. | |
5f91c9e8 | 594 | |
168e9c4d | 595 | if ( ! HasPadByIndices(ix, iy) ) return false; |
5f91c9e8 | 596 | |
597 | // Verify the indice->location->position->indice way | |
168e9c4d | 598 | AliMpPad pad1 = PadByIndices(ix, iy); |
599 | AliMpPad pad2 = PadByLocation(pad1.GetManuId(), pad1.GetManuChannel()); | |
6e97fbb8 | 600 | AliMpPad pad3 = PadByPosition(pad2.GetPositionX(),pad2.GetPositionY()); |
168e9c4d | 601 | |
602 | MpPair_t retIndices = pad3.GetIndices(); | |
5f91c9e8 | 603 | |
168e9c4d | 604 | if ( retIndices != AliMp::Pair(ix, iy) ) { |
605 | cout << "Pad (" << ix << ',' << iy << ") lead to inconsistency" << endl; | |
5f91c9e8 | 606 | cout << "in indice->location->position->indice way..." << endl; |
168e9c4d | 607 | cout << "starting from indices " << pad1 << endl |
608 | << "--> location " << pad2 << endl | |
609 | << "--> position " | |
6e97fbb8 | 610 | << '(' << pad3.GetPositionX() << ',' << pad3.GetPositionY() << ')' |
168e9c4d | 611 | << endl << endl; |
5f91c9e8 | 612 | } |
613 | ||
168e9c4d | 614 | // Verify the indice->position->location->indice way |
6e97fbb8 | 615 | AliMpPad pad2bis = PadByPosition(pad1.GetPositionX(),pad1.GetPositionY()); |
168e9c4d | 616 | AliMpPad pad3bis = PadByLocation(pad2bis.GetManuId(), pad2bis.GetManuChannel()); |
617 | ||
618 | retIndices = pad3bis.GetIndices(); | |
619 | ||
620 | if ( retIndices != AliMp::Pair(ix, iy) ) { | |
621 | cout << "Pad (" << ix << ',' << iy << ") lead to inconsistency" << endl; | |
622 | cout << "in indice->position->location->indice way..." << endl; | |
623 | cout << "starting from indices " << pad1 << endl | |
624 | << "--> position " | |
6e97fbb8 | 625 | << '(' << pad2bis.GetPositionX() << ',' << pad2bis.GetPositionY() << ')' << endl |
168e9c4d | 626 | << "--> location " << pad3bis |
627 | << endl << endl; | |
5f91c9e8 | 628 | } |
629 | ||
630 | return true; | |
631 | } |