]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/mapping/AliMpPlane.cxx
Extendened class description to include at least 5 subsequent lines required by rule...
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpPlane.cxx
CommitLineData
5f91c9e8 1// $Id$
2// Category: plane
3//
4// Class AliMpPlane
5// ----------------
6// Class represents the plane composed of 4 sector positions:
5f91c9e8 7// I. FS II. | I.
8// II. BS inverted in x _____ | ____
9// III. FS inverted in x, y |
10// IV. BS inverted in y III. | IV.
11//
12// FS - front sector
13// BS - back sector
14//
dbe945cc 15// Included in AliRoot: 2003/05/02
5f91c9e8 16// Authors: David Guez, Ivana Hrivnacova; IPN Orsay
17
18#include <Riostream.h>
fb1bf5c0 19#include <TError.h>
5f91c9e8 20
21#include "AliMpPlane.h"
22#include "AliMpReader.h"
23#include "AliMpSector.h"
24#include "AliMpSectorPosition.h"
874eaf96 25#include "AliMpIntPair.h"
5f91c9e8 26
27ClassImp(AliMpPlane)
28
29//
30// static methods
31//
32
33//______________________________________________________________________________
34AliMpPlane*
874eaf96 35AliMpPlane::Create(AliMpStationType station, AliMpPlaneType type,
5f91c9e8 36 const TVector2& q1Position, const TVector2& q2Position,
37 const TVector2& q3Position, const TVector2& q4Position)
38{
39// Factory method for creating planes.
40// ---
41
42 // Build sectors
874eaf96 43 AliMpReader bReader(station, kBendingPlane);
5f91c9e8 44 // bReader.SetVerboseLevel(1);
45 AliMpSector* bSector = bReader.BuildSector();
46 cout << "bending sector is built" << endl;
47
874eaf96 48 AliMpReader nbReader(station, kNonBendingPlane);
5f91c9e8 49 // nbReader.SetVerboseLevel(1);
50 AliMpSector* nbSector = nbReader.BuildSector();
51 cout << "non-bending sector is built" << endl;
52
53 if (type == kBendingPlane)
54 return new AliMpPlane(bSector, nbSector,
55 q1Position, q2Position, q3Position, q4Position );
56 else
57 return new AliMpPlane(nbSector, bSector,
58 q1Position, q2Position, q3Position, q4Position );
59}
60
61//______________________________________________________________________________
874eaf96 62AliMpPlane* AliMpPlane::Create(AliMpStationType station, AliMpPlaneType type)
5f91c9e8 63{
64// Factory method for creating planes with
65// not shifted qudrants.
66// ---
67
874eaf96 68 return Create(station, type, TVector2(), TVector2(), TVector2(), TVector2());
5f91c9e8 69}
70
71//
72// constructors, destructors
73//
74
75//______________________________________________________________________________
76AliMpPlane::AliMpPlane(AliMpSector* frontSector, AliMpSector* backSector,
77 const TVector2& q1Position, const TVector2& q2Position,
78 const TVector2& q3Position, const TVector2& q4Position)
79 : TObject(),
80 fkFrontSector(frontSector),
81 fkBackSector(backSector),
82 fSectorPositions()
83{
84//
85
f79c58a5 86#ifdef WITH_STL
5f91c9e8 87 // Create sector positions
88 fSectorPositions.push_back(
89 new AliMpSectorPosition(fkFrontSector, q1Position, AliMpIntPair( 1, 1)));
90 fSectorPositions.push_back(
91 new AliMpSectorPosition(fkBackSector, q2Position, AliMpIntPair(-1, 1)));
92 fSectorPositions.push_back(
93 new AliMpSectorPosition(fkFrontSector, q3Position, AliMpIntPair(-1,-1)));
94 fSectorPositions.push_back(
95 new AliMpSectorPosition(fkBackSector, q4Position, AliMpIntPair( 1,-1)));
f79c58a5 96#endif
97
98#ifdef WITH_ROOT
99 // Create sector positions
100 fSectorPositions.Add(
101 new AliMpSectorPosition(fkFrontSector, q1Position, AliMpIntPair( 1, 1)));
102 fSectorPositions.Add(
103 new AliMpSectorPosition(fkBackSector, q2Position, AliMpIntPair(-1, 1)));
104 fSectorPositions.Add(
105 new AliMpSectorPosition(fkFrontSector, q3Position, AliMpIntPair(-1,-1)));
106 fSectorPositions.Add(
107 new AliMpSectorPosition(fkBackSector, q4Position, AliMpIntPair( 1,-1)));
108#endif
5f91c9e8 109}
110
fb1bf5c0 111//_____________________________________________________________________________
112AliMpPlane::AliMpPlane(const AliMpPlane& right)
113 : TObject(right) {
114//
115 Fatal("AliMpPlane", "Copy constructor not provided.");
116}
5f91c9e8 117
118//______________________________________________________________________________
119AliMpPlane::AliMpPlane()
120 : TObject(),
121 fkFrontSector(0),
122 fkBackSector(0),
123 fSectorPositions()
124{
125//
126}
127
128//______________________________________________________________________________
129AliMpPlane::~AliMpPlane() {
130//
131
132 delete fkFrontSector;
133 delete fkBackSector;
134
135 for (Int_t i=0; i<GetNofSectorPositions(); i++)
136 delete GetSectorPosition(i);
137}
138
fb1bf5c0 139//
140// operators
141//
142
143//_____________________________________________________________________________
144AliMpPlane& AliMpPlane::operator=(const AliMpPlane& right)
145{
146 // check assignement to self
147 if (this == &right) return *this;
148
149 Fatal("operator =", "Assignement operator not provided.");
150
151 return *this;
152}
153
5f91c9e8 154//
155// public methods
156//
157
158//______________________________________________________________________________
159const AliMpSectorPosition*
160AliMpPlane::SectorPosition(const AliMpIntPair& scale) const
161{
162// Returns the sector position specified by scale.
163// ---
164
f79c58a5 165 for (Int_t i=0; i<GetNofSectorPositions(); i++)
166 if (GetSectorPosition(i)->GetScale() == scale) return GetSectorPosition(i);
5f91c9e8 167
168 Fatal("SectorPosition", "Wrong scale");
169 return 0;
170}
171
172//______________________________________________________________________________
173Int_t AliMpPlane::GetNofSectorPositions() const
174{
175// Returns number of sector positions.
176// ---
177
f79c58a5 178#ifdef WITH_STL
5f91c9e8 179 return fSectorPositions.size();
f79c58a5 180#endif
181
182#ifdef WITH_ROOT
183 return fSectorPositions.GetEntriesFast();
184#endif
5f91c9e8 185}
186
187
188//______________________________________________________________________________
189AliMpSectorPosition* AliMpPlane::GetSectorPosition(Int_t i) const
190{
191// Returns i-th sector position.
192// ---
193
f79c58a5 194#ifdef WITH_STL
5f91c9e8 195 return fSectorPositions[i];
f79c58a5 196#endif
197
198#ifdef WITH_ROOT
199 return (AliMpSectorPosition*)fSectorPositions[i];
200#endif
5f91c9e8 201}
202
203