]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/mapping/AliMpMotifPosition.cxx
New class - the factory for building mapping segmentations
[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$
dee1d5f1 17// $MpId: AliMpMotifPosition.cxx,v 1.7 2005/08/26 15:43:36 ivana Exp $
5f91c9e8 18//
dbe945cc 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
5f91c9e8 24
fb1bf5c0 25#include <TError.h>
26
5f91c9e8 27#include "AliMpMotifPosition.h"
28#include "AliMpMotifPositionPadIterator.h"
29#include "AliMpMotifType.h"
dee1d5f1 30#include <iostream>
5f91c9e8 31
32ClassImp(AliMpMotifPosition)
33
34//______________________________________________________________________________
35AliMpMotifPosition::AliMpMotifPosition(Int_t id, AliMpVMotif* motif,
36 TVector2 position)
37 : AliMpVIndexed(),
38 fID(id),
39 fMotif(motif),
dee1d5f1 40 fPosition(position)
41{
42/// Standard constructor
5f91c9e8 43}
44
45//______________________________________________________________________________
46AliMpMotifPosition::AliMpMotifPosition()
47 : AliMpVIndexed(),
48 fID(0),
49 fMotif(0),
dee1d5f1 50 fPosition(TVector2(0.,0.))
51{
52/// Default constructor
5f91c9e8 53}
54
fb1bf5c0 55//_____________________________________________________________________________
56AliMpMotifPosition::AliMpMotifPosition(const AliMpMotifPosition& right)
dee1d5f1 57 : AliMpVIndexed(right)
58{
59/// Protected copy constructor (not provided)
60
fb1bf5c0 61 Fatal("AliMpMotifPosition", "Copy constructor not provided.");
62}
63
5f91c9e8 64//______________________________________________________________________________
dee1d5f1 65AliMpMotifPosition::~AliMpMotifPosition()\
66{
67/// Destructor
5f91c9e8 68}
69
fb1bf5c0 70// operators
71
72//_____________________________________________________________________________
73AliMpMotifPosition&
74AliMpMotifPosition::operator=(const AliMpMotifPosition& right)
75{
dee1d5f1 76/// Protected assignment operator (not provided)
77
78 // check assignment to self
fb1bf5c0 79 if (this == &right) return *this;
80
dee1d5f1 81 Fatal("operator =", "Assignment operator not provided.");
fb1bf5c0 82
83 return *this;
84}
85
5f91c9e8 86//______________________________________________________________________________
87AliMpVPadIterator* AliMpMotifPosition::CreateIterator() const
88{
dee1d5f1 89/// Return motif position iterator
5f91c9e8 90
91 return new AliMpMotifPositionPadIterator(this);
92}
93
94//______________________________________________________________________________
95Bool_t AliMpMotifPosition::HasPad(const AliMpIntPair& indices) const
96{
dee1d5f1 97/// Return true if pad with the specified indices exists in
98/// this motif position.
5f91c9e8 99
100 if (!HasIndices(indices)) return kFALSE;
101
102 if (fMotif->GetMotifType()->IsFull()) return kTRUE;
103
104 return fMotif->GetMotifType()->HasPad(indices-GetLowIndicesLimit());
105}
106
dee1d5f1 107//_____________________________________________________________________________
108void
109AliMpMotifPosition::SetID(Int_t id)
110{
111/// Set ID
112
113 fID = id;
114}
115
116//_____________________________________________________________________________
117void
118AliMpMotifPosition::SetPosition(const TVector2& pos)
119{
120/// Set position
121
122 fPosition = pos;
123}
124
125//_____________________________________________________________________________
126void
127AliMpMotifPosition::Print(Option_t* option) const
128{
129/// Printing
130
131 std::cout << "MOTIFPOSITION " << GetID() << " MOTIF "
132 << GetMotif()->GetID()
133 << " at (" << Position().X() << ","
134 << Position().Y() << ") "
135 << " iMin=(" << GetLowIndicesLimit().GetFirst()
136 << "," << GetLowIndicesLimit().GetSecond()
137 << ") iMax=(" << GetHighIndicesLimit().GetFirst()
138 << "," << GetHighIndicesLimit().GetSecond()
139 << ")" << std::endl;
140
141 if ( option && option[0] == 'M' )
142 {
143 GetMotif()->Print(option+1);
144 }
145}