]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/AliMpZone.cxx
STL=>ROOT for the mapping package. AliMpContainers.h for the compilation option WITH_...
[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 //
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 #ifdef WITH_STL
82   return fSubZones.size();
83 #endif
84
85 #ifdef WITH_ROOT
86   return fSubZones.GetEntriesFast();
87 #endif
88 }  
89
90 //_____________________________________________________________________________
91 AliMpSubZone* AliMpZone::GetSubZone(Int_t i) const 
92 {
93   if (i<0 || i>=GetNofSubZones()) {
94     Warning("GetSubZone", "Index outside range");
95     return 0;
96   }
97   
98 #ifdef WITH_STL
99   return fSubZones[i];  
100 #endif
101
102 #ifdef WITH_ROOT
103   return (AliMpSubZone*)fSubZones[i];  
104 #endif
105 }