]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/AliMpSubZone.cxx
Removing useless ifs
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpSubZone.cxx
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
16 // $Id$
17 // $MpId: AliMpSubZone.cxx,v 1.6 2005/08/26 15:43:36 ivana Exp $
18 // Category: sector
19 //
20 // Class AliMpSubZone
21 // ------------------
22 // Class describing a zone segment composed of the 
23 // line segments with the same motif type.
24 // Included in AliRoot: 2003/05/02
25 // Authors: David Guez, Ivana Hrivnacova; IPN Orsay
26
27 #include <Riostream.h>
28 #include <TError.h>
29
30 #include "AliMpSubZone.h"
31 #include "AliMpVRowSegment.h"
32 #include "AliMpVMotif.h"
33
34 ClassImp(AliMpSubZone)
35
36 //_____________________________________________________________________________
37 AliMpSubZone::AliMpSubZone(AliMpVMotif* motif) 
38   : TObject(),
39     fMotif(motif)
40 {
41 /// Standard constructor
42 }
43
44 //_____________________________________________________________________________
45 AliMpSubZone::AliMpSubZone() 
46   : TObject(),
47     fMotif(0)
48 {
49 /// Default constructor
50 }
51
52 //_____________________________________________________________________________
53 AliMpSubZone::AliMpSubZone(const AliMpSubZone& right) 
54   : TObject(right) 
55 {
56 /// Protected copy constructor (not provided) 
57
58   Fatal("AliMpSubZone", "Copy constructor not provided.");
59 }
60
61 //_____________________________________________________________________________
62 AliMpSubZone::~AliMpSubZone() 
63 {
64 // Destructor 
65 }
66
67 //
68 // operators
69 //
70
71 //_____________________________________________________________________________
72 AliMpSubZone& AliMpSubZone::operator=(const AliMpSubZone& right)
73 {
74 /// Protected assignment operator (not provided)
75
76   // check assignment to self
77   if (this == &right) return *this;
78
79   Fatal("operator =", "Assignment operator not provided.");
80     
81   return *this;  
82 }    
83
84 //
85 // public methods
86 //
87
88 //_____________________________________________________________________________
89 void AliMpSubZone::AddRowSegment(AliMpVRowSegment* rowSegment)
90 {
91 /// Add row segment.
92
93 #ifdef WITH_STL
94   fSegments.push_back(rowSegment);
95 #endif
96
97 #ifdef WITH_ROOT
98   fSegments.Add(rowSegment);
99 #endif
100
101
102
103 //_____________________________________________________________________________
104 void AliMpSubZone::Print(const char* /*option*/) const
105 {
106 /// Print motif position Ids for all row segments.
107  
108   for (Int_t i=0; i<GetNofRowSegments(); i++) {
109     AliMpVRowSegment* rowSegment = GetRowSegment(i);
110     
111     cout << rowSegment->GetNofMotifs() << " ";
112
113     for (Int_t j=0; j<rowSegment->GetNofMotifs(); j++)
114       cout << rowSegment->GetMotifPositionId(j) << " ";
115     
116     cout << endl;    
117   }    
118 }
119   
120 //_____________________________________________________________________________
121 Int_t AliMpSubZone::GetNofRowSegments() const 
122 {
123 /// Return number of row segments.
124
125 #ifdef WITH_STL
126   return fSegments.size();
127 #endif
128
129 #ifdef WITH_ROOT
130   return fSegments.GetSize();
131 #endif
132 }  
133
134 //_____________________________________________________________________________
135 AliMpVRowSegment* AliMpSubZone::GetRowSegment(Int_t i) const 
136 {
137 /// Return i-th row segment.
138
139   if (i<0 || i>=GetNofRowSegments()) {
140     Warning("GetRowSegment", "Index outside range");
141     return 0;
142   }
143   
144 #ifdef WITH_STL
145   return fSegments[i];  
146 #endif
147
148 #ifdef WITH_ROOT
149   return (AliMpVRowSegment*)fSegments.At(i);  
150 #endif
151 }
152
153 //_____________________________________________________________________________
154 AliMpVMotif*  AliMpSubZone:: GetMotif() const
155 {
156 /// Return the motif.
157
158   return fMotif;
159 }