]>
Commit | Line | Data |
---|---|---|
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 |
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 | |
13985652 | 30 | /// \cond CLASSIMP |
5f91c9e8 | 31 | ClassImp(AliMpZone) |
13985652 | 32 | /// \endcond |
5f91c9e8 | 33 | |
34 | //_____________________________________________________________________________ | |
35 | AliMpZone::AliMpZone(Int_t id) | |
36 | : TObject(), | |
37 | fID(id), | |
38 | fPadDimensions(TVector2()) | |
39 | { | |
dee1d5f1 | 40 | /// Standard constructor |
5f91c9e8 | 41 | } |
42 | ||
43 | //_____________________________________________________________________________ | |
44 | AliMpZone::AliMpZone() | |
45 | : TObject(), | |
46 | fID(0), | |
47 | fPadDimensions(TVector2()) | |
48 | { | |
dee1d5f1 | 49 | /// Default constructor |
5f91c9e8 | 50 | } |
51 | ||
52 | //_____________________________________________________________________________ | |
dee1d5f1 | 53 | AliMpZone::~AliMpZone() |
54 | { | |
55 | /// Destructor | |
5f91c9e8 | 56 | |
57 | for (Int_t i=0; i<GetNofSubZones(); i++) | |
58 | delete fSubZones[i]; | |
59 | } | |
60 | ||
61 | // | |
62 | // public methods | |
63 | // | |
64 | ||
65 | //_____________________________________________________________________________ | |
66 | void AliMpZone::AddSubZone(AliMpSubZone* subZone) | |
67 | { | |
dee1d5f1 | 68 | /// Add row segment. |
5f91c9e8 | 69 | |
f79c58a5 | 70 | #ifdef WITH_STL |
5f91c9e8 | 71 | fSubZones.push_back(subZone); |
f79c58a5 | 72 | #endif |
73 | ||
74 | #ifdef WITH_ROOT | |
75 | fSubZones.Add(subZone); | |
76 | #endif | |
5f91c9e8 | 77 | } |
78 | ||
79 | //_____________________________________________________________________________ | |
80 | AliMpSubZone* AliMpZone::FindSubZone(AliMpVMotif* motif) const | |
81 | { | |
dee1d5f1 | 82 | /// Find a subzone with a specified motif; |
83 | /// return 0 if not found. | |
5f91c9e8 | 84 | |
85 | for (Int_t i=0; i<GetNofSubZones(); i++) { | |
86 | AliMpSubZone* subZone = GetSubZone(i); | |
87 | if (subZone->GetMotif() == motif) return subZone; | |
88 | } | |
89 | ||
90 | return 0; | |
91 | } | |
92 | ||
93 | //_____________________________________________________________________________ | |
94 | Int_t AliMpZone::GetNofSubZones() const | |
95 | { | |
dee1d5f1 | 96 | /// Return number of row segments. |
5f91c9e8 | 97 | |
f79c58a5 | 98 | #ifdef WITH_STL |
5f91c9e8 | 99 | return fSubZones.size(); |
f79c58a5 | 100 | #endif |
101 | ||
102 | #ifdef WITH_ROOT | |
103 | return fSubZones.GetEntriesFast(); | |
104 | #endif | |
5f91c9e8 | 105 | } |
106 | ||
107 | //_____________________________________________________________________________ | |
108 | AliMpSubZone* AliMpZone::GetSubZone(Int_t i) const | |
109 | { | |
dee1d5f1 | 110 | /// Return i-th sub zone. |
31e62cbe | 111 | |
5f91c9e8 | 112 | if (i<0 || i>=GetNofSubZones()) { |
113 | Warning("GetSubZone", "Index outside range"); | |
114 | return 0; | |
115 | } | |
116 | ||
f79c58a5 | 117 | #ifdef WITH_STL |
5f91c9e8 | 118 | return fSubZones[i]; |
f79c58a5 | 119 | #endif |
120 | ||
121 | #ifdef WITH_ROOT | |
122 | return (AliMpSubZone*)fSubZones[i]; | |
123 | #endif | |
5f91c9e8 | 124 | } |