]>
Commit | Line | Data |
---|---|---|
5f91c9e8 | 1 | // $Id$ |
2 | // Category: plane | |
3 | // | |
4 | // Class AliMpPlane | |
5 | // ---------------- | |
6 | // Class represents the plane composed of 4 sector positions: | |
7 | // | |
8 | // I. FS II. | I. | |
9 | // II. BS inverted in x _____ | ____ | |
10 | // III. FS inverted in x, y | | |
11 | // IV. BS inverted in y III. | IV. | |
12 | // | |
13 | // FS - front sector | |
14 | // BS - back sector | |
15 | // | |
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 | |
27 | ClassImp(AliMpPlane) | |
28 | ||
29 | // | |
30 | // static methods | |
31 | // | |
32 | ||
33 | //______________________________________________________________________________ | |
34 | AliMpPlane* | |
874eaf96 | 35 | AliMpPlane::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 | 62 | AliMpPlane* 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 | //______________________________________________________________________________ | |
76 | AliMpPlane::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 | //_____________________________________________________________________________ |
112 | AliMpPlane::AliMpPlane(const AliMpPlane& right) | |
113 | : TObject(right) { | |
114 | // | |
115 | Fatal("AliMpPlane", "Copy constructor not provided."); | |
116 | } | |
5f91c9e8 | 117 | |
118 | //______________________________________________________________________________ | |
119 | AliMpPlane::AliMpPlane() | |
120 | : TObject(), | |
121 | fkFrontSector(0), | |
122 | fkBackSector(0), | |
123 | fSectorPositions() | |
124 | { | |
125 | // | |
126 | } | |
127 | ||
128 | //______________________________________________________________________________ | |
129 | AliMpPlane::~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 | //_____________________________________________________________________________ | |
144 | AliMpPlane& 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 | //______________________________________________________________________________ | |
159 | const AliMpSectorPosition* | |
160 | AliMpPlane::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 | //______________________________________________________________________________ | |
173 | Int_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 | //______________________________________________________________________________ | |
189 | AliMpSectorPosition* 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 |