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