]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/mapping/AliMpZone.cxx
Slats mapping files in Bending
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpZone.cxx
CommitLineData
5f91c9e8 1// $Id$
2// Category: sector
3//
4// Class AliMpZone
5// ---------------
6// Class describing a zone composed of the zone segments.
7// The zone contains pads of the same dimensions.
dbe945cc 8// Included in AliRoot: 2003/05/02
5f91c9e8 9// Authors: David Guez, Ivana Hrivnacova; IPN Orsay
10
11#include "AliMpZone.h"
2998a151 12#include "AliMpSubZone.h"
5f91c9e8 13
14ClassImp(AliMpZone)
15
16//_____________________________________________________________________________
17AliMpZone::AliMpZone(Int_t id)
18 : TObject(),
19 fID(id),
20 fPadDimensions(TVector2())
21{
22//
23}
24
25//_____________________________________________________________________________
26AliMpZone::AliMpZone()
27 : TObject(),
28 fID(0),
29 fPadDimensions(TVector2())
30{
31//
32}
33
34//_____________________________________________________________________________
35AliMpZone::~AliMpZone() {
36//
37
38 for (Int_t i=0; i<GetNofSubZones(); i++)
39 delete fSubZones[i];
40}
41
42//
43// public methods
44//
45
46//_____________________________________________________________________________
47void AliMpZone::AddSubZone(AliMpSubZone* subZone)
48{
49// Adds row segment.
50// ---
51
f79c58a5 52#ifdef WITH_STL
5f91c9e8 53 fSubZones.push_back(subZone);
f79c58a5 54#endif
55
56#ifdef WITH_ROOT
57 fSubZones.Add(subZone);
58#endif
5f91c9e8 59}
60
61//_____________________________________________________________________________
62AliMpSubZone* AliMpZone::FindSubZone(AliMpVMotif* motif) const
63{
64// Finds a subzone with a specified motif;
65// returns 0 if not found.
66// ---
67
68 for (Int_t i=0; i<GetNofSubZones(); i++) {
69 AliMpSubZone* subZone = GetSubZone(i);
70 if (subZone->GetMotif() == motif) return subZone;
71 }
72
73 return 0;
74}
75
76//_____________________________________________________________________________
77Int_t AliMpZone::GetNofSubZones() const
78{
79// Returns number of row segments.
31e62cbe 80// ---
5f91c9e8 81
f79c58a5 82#ifdef WITH_STL
5f91c9e8 83 return fSubZones.size();
f79c58a5 84#endif
85
86#ifdef WITH_ROOT
87 return fSubZones.GetEntriesFast();
88#endif
5f91c9e8 89}
90
91//_____________________________________________________________________________
92AliMpSubZone* AliMpZone::GetSubZone(Int_t i) const
93{
31e62cbe 94// Returns i-th sub zone.
95// ---
96
5f91c9e8 97 if (i<0 || i>=GetNofSubZones()) {
98 Warning("GetSubZone", "Index outside range");
99 return 0;
100 }
101
f79c58a5 102#ifdef WITH_STL
5f91c9e8 103 return fSubZones[i];
f79c58a5 104#endif
105
106#ifdef WITH_ROOT
107 return (AliMpSubZone*)fSubZones[i];
108#endif
5f91c9e8 109}