]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/AliMpSubZone.cxx
Corrected access to the data file
[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     fSegments()
44 {
45 /// Standard constructor
46 }
47
48 //_____________________________________________________________________________
49 AliMpSubZone::AliMpSubZone() 
50   : TObject(),
51     fMotif(0),
52     fSegments()
53 {
54 /// Default constructor
55 }
56
57 //_____________________________________________________________________________
58 AliMpSubZone::~AliMpSubZone() 
59 {
60 /// Destructor 
61 }
62
63 //
64 // public methods
65 //
66
67 //_____________________________________________________________________________
68 void AliMpSubZone::AddRowSegment(AliMpVRowSegment* rowSegment)
69 {
70 /// Add row segment.
71
72 #ifdef WITH_STL
73   fSegments.push_back(rowSegment);
74 #endif
75
76 #ifdef WITH_ROOT
77   fSegments.Add(rowSegment);
78 #endif
79
80
81
82 //_____________________________________________________________________________
83 void AliMpSubZone::Print(const char* /*option*/) const
84 {
85 /// Print motif position Ids for all row segments.
86  
87   for (Int_t i=0; i<GetNofRowSegments(); i++) {
88     AliMpVRowSegment* rowSegment = GetRowSegment(i);
89     
90     cout << rowSegment->GetNofMotifs() << " ";
91
92     for (Int_t j=0; j<rowSegment->GetNofMotifs(); j++)
93       cout << rowSegment->GetMotifPositionId(j) << " ";
94     
95     cout << endl;    
96   }    
97 }
98   
99 //_____________________________________________________________________________
100 Int_t AliMpSubZone::GetNofRowSegments() const 
101 {
102 /// Return number of row segments.
103
104 #ifdef WITH_STL
105   return fSegments.size();
106 #endif
107
108 #ifdef WITH_ROOT
109   return fSegments.GetSize();
110 #endif
111 }  
112
113 //_____________________________________________________________________________
114 AliMpVRowSegment* AliMpSubZone::GetRowSegment(Int_t i) const 
115 {
116 /// Return i-th row segment.
117
118   if (i<0 || i>=GetNofRowSegments()) {
119     AliErrorStream() << "Index outside range" << endl;
120     return 0;
121   }
122   
123 #ifdef WITH_STL
124   return fSegments[i];  
125 #endif
126
127 #ifdef WITH_ROOT
128   return (AliMpVRowSegment*)fSegments.At(i);  
129 #endif
130 }
131
132 //_____________________________________________________________________________
133 AliMpVMotif*  AliMpSubZone:: GetMotif() const
134 {
135 /// Return the motif.
136
137   return fMotif;
138 }