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