]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/AliMpZone.cxx
Mapping test macros (D. Guez, I. Hrivnacova)
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpZone.cxx
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.
8 // Included in AliRoot: 2003/05/02
9 // Authors: David Guez, Ivana Hrivnacova; IPN Orsay
10
11 #include "AliMpZone.h"
12 #include "AliMpSubZone.h"
13
14 ClassImp(AliMpZone)
15
16 //_____________________________________________________________________________
17 AliMpZone::AliMpZone(Int_t id) 
18   : TObject(),
19     fID(id),
20     fPadDimensions(TVector2())
21 {
22 //
23 }
24
25 //_____________________________________________________________________________
26 AliMpZone::AliMpZone() 
27   : TObject(),
28     fID(0),
29     fPadDimensions(TVector2())
30 {
31 //
32 }
33
34 //_____________________________________________________________________________
35 AliMpZone::~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 //_____________________________________________________________________________
47 void AliMpZone::AddSubZone(AliMpSubZone* subZone)
48 {
49 // Adds row segment.
50 // ---
51
52 #ifdef WITH_STL
53   fSubZones.push_back(subZone);
54 #endif
55
56 #ifdef WITH_ROOT
57   fSubZones.Add(subZone);
58 #endif
59 }  
60   
61 //_____________________________________________________________________________
62 AliMpSubZone* 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 //_____________________________________________________________________________
77 Int_t AliMpZone::GetNofSubZones() const 
78 {
79 // Returns number of row segments.
80 // ---
81
82 #ifdef WITH_STL
83   return fSubZones.size();
84 #endif
85
86 #ifdef WITH_ROOT
87   return fSubZones.GetEntriesFast();
88 #endif
89 }  
90
91 //_____________________________________________________________________________
92 AliMpSubZone* AliMpZone::GetSubZone(Int_t i) const 
93 {
94 // Returns i-th sub zone.
95 // ---
96
97   if (i<0 || i>=GetNofSubZones()) {
98     Warning("GetSubZone", "Index outside range");
99     return 0;
100   }
101   
102 #ifdef WITH_STL
103   return fSubZones[i];  
104 #endif
105
106 #ifdef WITH_ROOT
107   return (AliMpSubZone*)fSubZones[i];  
108 #endif
109 }