Replacement of AliMpIntPair object with algoritmic
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpMotifPosition.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: AliMpMotifPosition.cxx,v 1.9 2006/05/24 13:58:41 ivana Exp $
3d1463c8 18
19//-----------------------------------------------------------------------------
dbe945cc 20// Class AliMpMotifPosition
21// ------------------------
22// Class that represents a placed motif.
23// Included in AliRoot: 2003/05/02
24// Authors: David Guez, Ivana Hrivnacova; IPN Orsay
3d1463c8 25//-----------------------------------------------------------------------------
5f91c9e8 26
27#include "AliMpMotifPosition.h"
28#include "AliMpMotifPositionPadIterator.h"
29#include "AliMpMotifType.h"
2c605e66 30#include <Riostream.h>
5f91c9e8 31
13985652 32/// \cond CLASSIMP
5f91c9e8 33ClassImp(AliMpMotifPosition)
13985652 34/// \endcond
5f91c9e8 35
36//______________________________________________________________________________
37AliMpMotifPosition::AliMpMotifPosition(Int_t id, AliMpVMotif* motif,
38 TVector2 position)
39 : AliMpVIndexed(),
40 fID(id),
41 fMotif(motif),
dee1d5f1 42 fPosition(position)
43{
44/// Standard constructor
5f91c9e8 45}
46
47//______________________________________________________________________________
48AliMpMotifPosition::AliMpMotifPosition()
49 : AliMpVIndexed(),
50 fID(0),
51 fMotif(0),
dee1d5f1 52 fPosition(TVector2(0.,0.))
53{
54/// Default constructor
5f91c9e8 55}
56
57//______________________________________________________________________________
586e5d9a 58AliMpMotifPosition::~AliMpMotifPosition()
dee1d5f1 59{
60/// Destructor
5f91c9e8 61}
62
63//______________________________________________________________________________
64AliMpVPadIterator* AliMpMotifPosition::CreateIterator() const
65{
dee1d5f1 66/// Return motif position iterator
5f91c9e8 67
68 return new AliMpMotifPositionPadIterator(this);
69}
70
71//______________________________________________________________________________
168e9c4d 72Bool_t AliMpMotifPosition::HasPadByIndices(MpPair_t indices) const
5f91c9e8 73{
dee1d5f1 74/// Return true if pad with the specified indices exists in
75/// this motif position.
5f91c9e8 76
168e9c4d 77 if ( ! HasIndices(indices) ) return kFALSE;
5f91c9e8 78
79 if (fMotif->GetMotifType()->IsFull()) return kTRUE;
80
168e9c4d 81 return fMotif->GetMotifType()->HasPadByLocalIndices(
82 indices - GetLowIndicesLimit());
3635f34f 83}
84
85//______________________________________________________________________________
86Bool_t AliMpMotifPosition::HasPadByManuChannel(Int_t manuChannel) const
87{
88 /// Return true if pad with the specified manuChannel exists in
89 /// this motif position.
90
91 return fMotif->GetMotifType()->HasPadByManuChannel(manuChannel);
5f91c9e8 92}
93
dee1d5f1 94//_____________________________________________________________________________
95void
96AliMpMotifPosition::SetID(Int_t id)
97{
98/// Set ID
99
100 fID = id;
101}
102
103//_____________________________________________________________________________
104void
105AliMpMotifPosition::SetPosition(const TVector2& pos)
106{
107/// Set position
108
109 fPosition = pos;
110}
111
112//_____________________________________________________________________________
113void
114AliMpMotifPosition::Print(Option_t* option) const
115{
116/// Printing
117
2c605e66 118 cout << "MOTIFPOSITION " << GetID() << " MOTIF "
119 << GetMotif()->GetID()
120 << " at (" << Position().X() << ","
121 << Position().Y() << ") "
168e9c4d 122 << " iMin=(" << GetLowLimitIx()
123 << "," << GetLowLimitIy()
124 << ") iMax=(" << GetHighLimitIx()
125 << "," << GetHighLimitIy()
2c605e66 126 << ")" << std::endl;
dee1d5f1 127
128 if ( option && option[0] == 'M' )
129 {
130 GetMotif()->Print(option+1);
131 }
132}