]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/AliMpSubZone.cxx
STL=>ROOT for the mapping package. AliMpContainers.h for the compilation option WITH_...
[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
13 #include "AliMpSubZone.h"
14 #include "AliMpVRowSegment.h"
15 #include "AliMpVMotif.h"
16
17 ClassImp(AliMpSubZone)
18
19 //_____________________________________________________________________________
20 AliMpSubZone::AliMpSubZone(AliMpVMotif* motif) 
21   : TObject(),
22     fMotif(motif)
23 {
24 //
25 }
26
27 //_____________________________________________________________________________
28 AliMpSubZone::AliMpSubZone() 
29   : TObject(),
30     fMotif(0)
31 {
32 //
33 }
34
35 //_____________________________________________________________________________
36 AliMpSubZone::~AliMpSubZone() {
37 //  
38 }
39
40 //_____________________________________________________________________________
41 void AliMpSubZone::AddRowSegment(AliMpVRowSegment* rowSegment)
42 {
43 // Adds row segment.
44 // ---
45
46 #ifdef WITH_STL
47   fSegments.push_back(rowSegment);
48 #endif
49
50 #ifdef WITH_ROOT
51   fSegments.Add(rowSegment);
52 #endif
53
54
55
56 //_____________________________________________________________________________
57 void AliMpSubZone::Print(const char* /*option*/) const
58 {
59 // Prints motif position Ids for all row segments.
60 // --
61  
62   for (Int_t i=0; i<GetNofRowSegments(); i++) {
63     AliMpVRowSegment* rowSegment = GetRowSegment(i);
64     
65     cout << rowSegment->GetNofMotifs() << " ";
66
67     for (Int_t j=0; j<rowSegment->GetNofMotifs(); j++)
68       cout << rowSegment->GetMotifPositionId(j) << " ";
69     
70     cout << endl;    
71   }    
72 }
73   
74 //_____________________________________________________________________________
75 Int_t AliMpSubZone::GetNofRowSegments() const 
76 {
77 // Returns number of row segments.
78
79 #ifdef WITH_STL
80   return fSegments.size();
81 #endif
82
83 #ifdef WITH_ROOT
84   return fSegments.GetSize();
85 #endif
86 }  
87
88 //_____________________________________________________________________________
89 AliMpVRowSegment* AliMpSubZone::GetRowSegment(Int_t i) const 
90 {
91   if (i<0 || i>=GetNofRowSegments()) {
92     Warning("GetRowSegment", "Index outside range");
93     return 0;
94   }
95   
96 #ifdef WITH_STL
97   return fSegments[i];  
98 #endif
99
100 #ifdef WITH_ROOT
101   return (AliMpVRowSegment*)fSegments.At(i);  
102 #endif
103 }
104
105 //_____________________________________________________________________________
106 AliMpVMotif*  AliMpSubZone:: GetMotif() const
107 {
108 // Returns the motif.
109 // ---
110
111   return fMotif;
112 }