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