]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/mapping/AliMpZone.cxx
New class - the factory for building mapping segmentations
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpZone.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: AliMpZone.cxx,v 1.6 2005/08/26 15:43:36 ivana Exp $
5f91c9e8 18// Category: sector
19//
20// Class AliMpZone
21// ---------------
22// Class describing a zone composed of the zone segments.
23// The zone contains pads of the same dimensions.
dbe945cc 24// Included in AliRoot: 2003/05/02
5f91c9e8 25// Authors: David Guez, Ivana Hrivnacova; IPN Orsay
26
27#include "AliMpZone.h"
2998a151 28#include "AliMpSubZone.h"
5f91c9e8 29
30ClassImp(AliMpZone)
31
32//_____________________________________________________________________________
33AliMpZone::AliMpZone(Int_t id)
34 : TObject(),
35 fID(id),
36 fPadDimensions(TVector2())
37{
dee1d5f1 38/// Standard constructor
5f91c9e8 39}
40
41//_____________________________________________________________________________
42AliMpZone::AliMpZone()
43 : TObject(),
44 fID(0),
45 fPadDimensions(TVector2())
46{
dee1d5f1 47/// Default constructor
5f91c9e8 48}
49
50//_____________________________________________________________________________
dee1d5f1 51AliMpZone::~AliMpZone()
52{
53/// Destructor
5f91c9e8 54
55 for (Int_t i=0; i<GetNofSubZones(); i++)
56 delete fSubZones[i];
57}
58
59//
60// public methods
61//
62
63//_____________________________________________________________________________
64void AliMpZone::AddSubZone(AliMpSubZone* subZone)
65{
dee1d5f1 66/// Add row segment.
5f91c9e8 67
f79c58a5 68#ifdef WITH_STL
5f91c9e8 69 fSubZones.push_back(subZone);
f79c58a5 70#endif
71
72#ifdef WITH_ROOT
73 fSubZones.Add(subZone);
74#endif
5f91c9e8 75}
76
77//_____________________________________________________________________________
78AliMpSubZone* AliMpZone::FindSubZone(AliMpVMotif* motif) const
79{
dee1d5f1 80/// Find a subzone with a specified motif;
81/// return 0 if not found.
5f91c9e8 82
83 for (Int_t i=0; i<GetNofSubZones(); i++) {
84 AliMpSubZone* subZone = GetSubZone(i);
85 if (subZone->GetMotif() == motif) return subZone;
86 }
87
88 return 0;
89}
90
91//_____________________________________________________________________________
92Int_t AliMpZone::GetNofSubZones() const
93{
dee1d5f1 94/// Return number of row segments.
5f91c9e8 95
f79c58a5 96#ifdef WITH_STL
5f91c9e8 97 return fSubZones.size();
f79c58a5 98#endif
99
100#ifdef WITH_ROOT
101 return fSubZones.GetEntriesFast();
102#endif
5f91c9e8 103}
104
105//_____________________________________________________________________________
106AliMpSubZone* AliMpZone::GetSubZone(Int_t i) const
107{
dee1d5f1 108/// Return i-th sub zone.
31e62cbe 109
5f91c9e8 110 if (i<0 || i>=GetNofSubZones()) {
111 Warning("GetSubZone", "Index outside range");
112 return 0;
113 }
114
f79c58a5 115#ifdef WITH_STL
5f91c9e8 116 return fSubZones[i];
f79c58a5 117#endif
118
119#ifdef WITH_ROOT
120 return (AliMpSubZone*)fSubZones[i];
121#endif
5f91c9e8 122}