Added copy constructor and assignement operator (I. Hrivnacova)
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpSubZone.cxx
1 // $Id$
2 // Category: sector
3 //
4 // Class AliMpSubZone
5 // ------------------
6 // Class describing a zone segment composed of the 
7 // line segments with the same motif type.
8 //
9 // Authors: David Guez, Ivana Hrivnacova; IPN Orsay
10
11 #include <Riostream.h>
12 #include <TError.h>
13
14 #include "AliMpSubZone.h"
15 #include "AliMpVRowSegment.h"
16 #include "AliMpVMotif.h"
17
18 ClassImp(AliMpSubZone)
19
20 //_____________________________________________________________________________
21 AliMpSubZone::AliMpSubZone(AliMpVMotif* motif) 
22   : TObject(),
23     fMotif(motif)
24 {
25 //
26 }
27
28 //_____________________________________________________________________________
29 AliMpSubZone::AliMpSubZone() 
30   : TObject(),
31     fMotif(0)
32 {
33 //
34 }
35
36 //_____________________________________________________________________________
37 AliMpSubZone::AliMpSubZone(const AliMpSubZone& right) 
38   : TObject(right) {
39 // 
40   Fatal("AliMpSubZone", "Copy constructor not provided.");
41 }
42
43 //_____________________________________________________________________________
44 AliMpSubZone::~AliMpSubZone() {
45 //  
46 }
47
48 //
49 // operators
50 //
51
52 //_____________________________________________________________________________
53 AliMpSubZone& AliMpSubZone::operator=(const AliMpSubZone& right)
54 {
55   // check assignement to self
56   if (this == &right) return *this;
57
58   Fatal("operator =", "Assignement operator not provided.");
59     
60   return *this;  
61 }    
62
63 //
64 // public methods
65 //
66
67 //_____________________________________________________________________________
68 void AliMpSubZone::AddRowSegment(AliMpVRowSegment* rowSegment)
69 {
70 // Adds row segment.
71 // ---
72
73 #ifdef WITH_STL
74   fSegments.push_back(rowSegment);
75 #endif
76
77 #ifdef WITH_ROOT
78   fSegments.Add(rowSegment);
79 #endif
80
81
82
83 //_____________________________________________________________________________
84 void AliMpSubZone::Print(const char* /*option*/) const
85 {
86 // Prints motif position Ids for all row segments.
87 // --
88  
89   for (Int_t i=0; i<GetNofRowSegments(); i++) {
90     AliMpVRowSegment* rowSegment = GetRowSegment(i);
91     
92     cout << rowSegment->GetNofMotifs() << " ";
93
94     for (Int_t j=0; j<rowSegment->GetNofMotifs(); j++)
95       cout << rowSegment->GetMotifPositionId(j) << " ";
96     
97     cout << endl;    
98   }    
99 }
100   
101 //_____________________________________________________________________________
102 Int_t AliMpSubZone::GetNofRowSegments() const 
103 {
104 // Returns number of row segments.
105 // ---
106
107 #ifdef WITH_STL
108   return fSegments.size();
109 #endif
110
111 #ifdef WITH_ROOT
112   return fSegments.GetSize();
113 #endif
114 }  
115
116 //_____________________________________________________________________________
117 AliMpVRowSegment* AliMpSubZone::GetRowSegment(Int_t i) const 
118 {
119 // Returns i-th row segment.
120 // ---
121
122   if (i<0 || i>=GetNofRowSegments()) {
123     Warning("GetRowSegment", "Index outside range");
124     return 0;
125   }
126   
127 #ifdef WITH_STL
128   return fSegments[i];  
129 #endif
130
131 #ifdef WITH_ROOT
132   return (AliMpVRowSegment*)fSegments.At(i);  
133 #endif
134 }
135
136 //_____________________________________________________________________________
137 AliMpVMotif*  AliMpSubZone:: GetMotif() const
138 {
139 // Returns the motif.
140 // ---
141
142   return fMotif;
143 }