]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/AliMpPadRowSegment.cxx
new class AliMUONLoader
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpPadRowSegment.cxx
1 // $Id$
2 // Category: sector
3 //
4 // Class AliMpPadRowSegment
5 // --------------------
6 // Class describing a pad row segment composed of the 
7 // the identic pads.
8 //
9 // Authors: David Guez, Ivana Hrivnacova; IPN Orsay
10
11 #include <TError.h>
12
13 #include "AliMpPadRowSegment.h"
14 #include "AliMpPadRow.h"
15 #include "AliMpMotif.h"
16 #include "AliMpMotifType.h"
17
18 ClassImp(AliMpPadRowSegment)
19
20 //_____________________________________________________________________________
21 AliMpPadRowSegment::AliMpPadRowSegment(AliMpPadRow* padRow, AliMpMotif* motif, 
22                                        Int_t motifPositionId, Int_t nofPads)
23   : TObject(),
24     fNofPads(nofPads),
25     fOffsetX(0.),
26     fPadRow(padRow),
27     fMotif(motif),
28     fMotifPositionId(motifPositionId)
29 {
30 // 
31 }
32
33 //_____________________________________________________________________________
34 AliMpPadRowSegment::AliMpPadRowSegment() 
35   : TObject(),
36     fNofPads(0),
37     fOffsetX(0.),
38     fPadRow(0),
39     fMotif(0),
40     fMotifPositionId(0)
41 {
42 //
43 }
44
45 //_____________________________________________________________________________
46 AliMpPadRowSegment::~AliMpPadRowSegment() {
47 //  
48 }
49
50 //
51 // private methods  
52 //
53
54 //_____________________________________________________________________________
55 Double_t AliMpPadRowSegment::FirstPadCenterX() const
56 {
57 // Returns the x coordinate of the first (the most right) pad center
58 // in global coordinate system.
59 // ---
60
61   return fOffsetX - fMotif->GetPadDimensions().X();
62 }  
63
64 //_____________________________________________________________________________
65 Double_t AliMpPadRowSegment::LastPadCenterX() const
66 {
67 // Returns the x coordinate of the last (the most left) pad center
68 // in global coordinate system.
69 // !! numbering of pads is in (-x) direction
70 // ---
71
72   return fOffsetX - (2.*fNofPads - 1)*fMotif->GetPadDimensions().X();
73 }
74
75 //_____________________________________________________________________________
76 Double_t AliMpPadRowSegment::FirstPadBorderX() const
77 {
78 // Returns the x coordinate of the right border of the first (the most right) 
79 // pad in global coordinate system.
80 // ---
81
82   return fOffsetX;
83          // Also could be
84          // return FirstPadCenterX() + fMotif->GetPadDimensions().X();
85 }  
86
87 //_____________________________________________________________________________
88 Double_t AliMpPadRowSegment::LastPadBorderX() const
89 {
90 // Returns the x coordinate of the left border of the last (the most left)
91 // pad in global coordinate system.
92 // ---
93
94   return LastPadCenterX() - fMotif->GetPadDimensions().X();
95 }  
96
97 //
98 // public methods  
99 //
100
101 //_____________________________________________________________________________
102 Double_t  AliMpPadRowSegment::LeftBorderX() const
103 {
104 // Returns the x coordinate of the left row segment border
105 // in global coordinate system.
106 // ---
107
108   return LastPadBorderX();
109 }
110
111 //_____________________________________________________________________________
112 Double_t  AliMpPadRowSegment::RightBorderX() const
113 {
114 // Returns the x coordinate of the right row segment border
115 // in global coordinate system.
116 // ---
117
118   return FirstPadBorderX();
119 }
120
121 //_____________________________________________________________________________
122 Double_t  AliMpPadRowSegment::HalfSizeY() const
123 {
124 // Returns the size in y of this row segment.
125 // ---
126
127   return fMotif->GetPadDimensions().Y();
128 }
129
130 //_____________________________________________________________________________
131 AliMpPadRow*  AliMpPadRowSegment::GetPadRow() const
132 {
133 // Returns the pad row.which this pad row segment belongs to.
134 // ---
135
136   return fPadRow;
137 }  
138
139 //_____________________________________________________________________________
140 AliMpMotif*  AliMpPadRowSegment::GetMotif() const
141 {
142 // Returns the motif of this pad row segment. 
143 // ---
144
145   return fMotif;
146 }  
147
148 //_____________________________________________________________________________
149 Int_t  AliMpPadRowSegment::GetMotifPositionId() const
150 {
151 // Returns the motif of this pad row segment. 
152 // ---
153
154   return fMotifPositionId;
155 }  
156
157 //_____________________________________________________________________________
158 void  AliMpPadRowSegment::SetOffsetX(Double_t offsetX)
159 {
160 // Sets the x offset.
161 // ---
162
163   fOffsetX = offsetX;
164 }    
165