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