]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/AliMpZone.cxx
Update for station2:
[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   fSubZones.push_back(subZone);
53 }  
54   
55 //_____________________________________________________________________________
56 AliMpSubZone* AliMpZone::FindSubZone(AliMpVMotif* motif) const
57 {
58 // Finds a subzone with a specified motif;
59 // returns 0 if not found.
60 // ---
61
62   for (Int_t i=0; i<GetNofSubZones(); i++) {
63     AliMpSubZone* subZone = GetSubZone(i);
64     if (subZone->GetMotif() == motif) return subZone;
65   }
66   
67   return 0;  
68 }
69
70 //_____________________________________________________________________________
71 Int_t AliMpZone::GetNofSubZones() const 
72 {
73 // Returns number of row segments.
74
75   return fSubZones.size();
76 }  
77
78 //_____________________________________________________________________________
79 AliMpSubZone* AliMpZone::GetSubZone(Int_t i) const 
80 {
81   if (i<0 || i>=GetNofSubZones()) {
82     Warning("GetSubZone", "Index outside range");
83     return 0;
84   }
85   
86   return fSubZones[i];  
87 }