]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/AliMpMotifPosition.cxx
Compatibility with ROOT trunk
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpMotifPosition.cxx
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
16 // $Id$
17 // $MpId: AliMpMotifPosition.cxx,v 1.9 2006/05/24 13:58:41 ivana Exp $
18
19 //-----------------------------------------------------------------------------
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
25 //-----------------------------------------------------------------------------
26
27 #include "AliMpMotifPosition.h"
28 #include "AliMpMotifPositionPadIterator.h"
29 #include "AliMpMotifType.h"
30 #include <Riostream.h>
31
32 using std::cout;
33 /// \cond CLASSIMP
34 ClassImp(AliMpMotifPosition)
35 /// \endcond
36
37 //______________________________________________________________________________
38 AliMpMotifPosition::AliMpMotifPosition(Int_t id, AliMpVMotif* motif, 
39                                        Double_t x, Double_t y)
40   : AliMpVIndexed(),
41     fID(id),
42     fMotif(motif),
43     fPositionX(x), 
44     fPositionY(y) 
45 {
46 /// Standard constructor
47 }
48
49 //______________________________________________________________________________
50 AliMpMotifPosition::AliMpMotifPosition()
51   : AliMpVIndexed(), 
52     fID(0),
53     fMotif(0),
54     fPositionX(0.), 
55     fPositionY(0.) 
56 {
57 /// Default constructor
58 }
59
60 //______________________________________________________________________________
61 AliMpMotifPosition::~AliMpMotifPosition()
62 {
63 /// Destructor 
64 }
65
66 //______________________________________________________________________________
67 AliMpVPadIterator* AliMpMotifPosition::CreateIterator() const
68 {
69 /// Return motif position iterator
70
71   return new AliMpMotifPositionPadIterator(this);
72 }  
73
74 //______________________________________________________________________________
75 Bool_t AliMpMotifPosition::HasPadByIndices(MpPair_t indices) const
76 {
77 /// Return true if pad with the specified indices exists in 
78 /// this motif position.
79
80   if ( ! HasIndices(indices) ) return kFALSE;
81   
82   if (fMotif->GetMotifType()->IsFull()) return kTRUE;
83   
84   return fMotif->GetMotifType()->HasPadByLocalIndices(
85                                     indices - GetLowIndicesLimit());
86 }
87
88 //______________________________________________________________________________
89 Bool_t AliMpMotifPosition::HasPadByManuChannel(Int_t manuChannel) const
90 {
91   /// Return true if pad with the specified manuChannel exists in 
92   /// this motif position.
93
94   return fMotif->GetMotifType()->HasPadByManuChannel(manuChannel);
95 }
96
97 //_____________________________________________________________________________
98 void
99 AliMpMotifPosition::SetID(Int_t id)
100 {
101 /// Set ID
102
103   fID = id;
104 }
105
106 //_____________________________________________________________________________
107 void
108 AliMpMotifPosition::SetPosition(Double_t x, Double_t y)
109 {
110 /// Set position
111
112   fPositionX = x;
113   fPositionY = y;
114 }
115
116 //_____________________________________________________________________________
117 void
118 AliMpMotifPosition::Print(Option_t* option) const
119 {
120 /// Printing
121
122   cout << "MOTIFPOSITION " << GetID() << " MOTIF " 
123        << GetMotif()->GetID()
124        << " at (" << GetPositionX() << "," 
125        << GetPositionY() << ") "
126        << " iMin=(" << GetLowLimitIx()
127        << "," << GetLowLimitIy()
128        << ") iMax=(" << GetHighLimitIx()
129        << "," << GetHighLimitIy()
130        << ")" << std::endl;
131
132   if ( option && option[0] == 'M' )
133     {
134       GetMotif()->Print(option+1);
135     }
136 }