]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/AliMpMotifPosition.cxx
AliMUONRecoParam:
[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
31 #include <Riostream.h>
32
33 /// \cond CLASSIMP
34 ClassImp(AliMpMotifPosition)
35 /// \endcond
36
37 //______________________________________________________________________________
38 AliMpMotifPosition::AliMpMotifPosition(Int_t id, AliMpVMotif* motif, 
39                                        TVector2 position)
40   : AliMpVIndexed(),
41     fID(id),
42     fMotif(motif),
43     fPosition(position) 
44 {
45 /// Standard constructor
46 }
47
48 //______________________________________________________________________________
49 AliMpMotifPosition::AliMpMotifPosition()
50   : AliMpVIndexed(), 
51     fID(0),
52     fMotif(0),
53     fPosition(TVector2(0.,0.)) 
54 {
55 /// Default constructor
56 }
57
58 //______________________________________________________________________________
59 AliMpMotifPosition::~AliMpMotifPosition()
60 {
61 /// Destructor 
62 }
63
64 //______________________________________________________________________________
65 AliMpVPadIterator* AliMpMotifPosition::CreateIterator() const
66 {
67 /// Return motif position iterator
68
69   return new AliMpMotifPositionPadIterator(this);
70 }  
71
72 //______________________________________________________________________________
73 Bool_t AliMpMotifPosition::HasPad(const AliMpIntPair& indices) const
74 {
75 /// Return true if pad with the specified indices exists in 
76 /// this motif position.
77
78   if (!HasIndices(indices)) return kFALSE;
79   
80   if (fMotif->GetMotifType()->IsFull()) return kTRUE;
81   
82   return fMotif->GetMotifType()->HasPad(indices-GetLowIndicesLimit());
83 }
84
85 //_____________________________________________________________________________
86 void
87 AliMpMotifPosition::SetID(Int_t id)
88 {
89 /// Set ID
90
91   fID = id;
92 }
93
94 //_____________________________________________________________________________
95 void
96 AliMpMotifPosition::SetPosition(const TVector2& pos)
97 {
98 /// Set position
99
100   fPosition = pos;
101 }
102
103 //_____________________________________________________________________________
104 void
105 AliMpMotifPosition::Print(Option_t* option) const
106 {
107 /// Printing
108
109   cout << "MOTIFPOSITION " << GetID() << " MOTIF " 
110        << GetMotif()->GetID()
111        << " at (" << Position().X() << "," 
112        << Position().Y() << ") "
113        << " iMin=(" << GetLowIndicesLimit().GetFirst()
114        << "," << GetLowIndicesLimit().GetSecond()
115        << ") iMax=(" << GetHighIndicesLimit().GetFirst()
116        << "," << GetHighIndicesLimit().GetSecond()
117        << ")" << std::endl;
118
119   if ( option && option[0] == 'M' )
120     {
121       GetMotif()->Print(option+1);
122     }
123 }