]>
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> | |
19 | ||
20 | #include "AliMpPlane.h" | |
21 | #include "AliMpReader.h" | |
22 | #include "AliMpSector.h" | |
23 | #include "AliMpSectorPosition.h" | |
874eaf96 | 24 | #include "AliMpIntPair.h" |
5f91c9e8 | 25 | |
26 | ClassImp(AliMpPlane) | |
27 | ||
28 | // | |
29 | // static methods | |
30 | // | |
31 | ||
32 | //______________________________________________________________________________ | |
33 | AliMpPlane* | |
874eaf96 | 34 | AliMpPlane::Create(AliMpStationType station, AliMpPlaneType type, |
5f91c9e8 | 35 | const TVector2& q1Position, const TVector2& q2Position, |
36 | const TVector2& q3Position, const TVector2& q4Position) | |
37 | { | |
38 | // Factory method for creating planes. | |
39 | // --- | |
40 | ||
41 | // Build sectors | |
874eaf96 | 42 | AliMpReader bReader(station, kBendingPlane); |
5f91c9e8 | 43 | // bReader.SetVerboseLevel(1); |
44 | AliMpSector* bSector = bReader.BuildSector(); | |
45 | cout << "bending sector is built" << endl; | |
46 | ||
874eaf96 | 47 | AliMpReader nbReader(station, kNonBendingPlane); |
5f91c9e8 | 48 | // nbReader.SetVerboseLevel(1); |
49 | AliMpSector* nbSector = nbReader.BuildSector(); | |
50 | cout << "non-bending sector is built" << endl; | |
51 | ||
52 | if (type == kBendingPlane) | |
53 | return new AliMpPlane(bSector, nbSector, | |
54 | q1Position, q2Position, q3Position, q4Position ); | |
55 | else | |
56 | return new AliMpPlane(nbSector, bSector, | |
57 | q1Position, q2Position, q3Position, q4Position ); | |
58 | } | |
59 | ||
60 | //______________________________________________________________________________ | |
874eaf96 | 61 | AliMpPlane* AliMpPlane::Create(AliMpStationType station, AliMpPlaneType type) |
5f91c9e8 | 62 | { |
63 | // Factory method for creating planes with | |
64 | // not shifted qudrants. | |
65 | // --- | |
66 | ||
874eaf96 | 67 | return Create(station, type, TVector2(), TVector2(), TVector2(), TVector2()); |
5f91c9e8 | 68 | } |
69 | ||
70 | // | |
71 | // constructors, destructors | |
72 | // | |
73 | ||
74 | //______________________________________________________________________________ | |
75 | AliMpPlane::AliMpPlane(AliMpSector* frontSector, AliMpSector* backSector, | |
76 | const TVector2& q1Position, const TVector2& q2Position, | |
77 | const TVector2& q3Position, const TVector2& q4Position) | |
78 | : TObject(), | |
79 | fkFrontSector(frontSector), | |
80 | fkBackSector(backSector), | |
81 | fSectorPositions() | |
82 | { | |
83 | // | |
84 | ||
f79c58a5 | 85 | #ifdef WITH_STL |
5f91c9e8 | 86 | // Create sector positions |
87 | fSectorPositions.push_back( | |
88 | new AliMpSectorPosition(fkFrontSector, q1Position, AliMpIntPair( 1, 1))); | |
89 | fSectorPositions.push_back( | |
90 | new AliMpSectorPosition(fkBackSector, q2Position, AliMpIntPair(-1, 1))); | |
91 | fSectorPositions.push_back( | |
92 | new AliMpSectorPosition(fkFrontSector, q3Position, AliMpIntPair(-1,-1))); | |
93 | fSectorPositions.push_back( | |
94 | new AliMpSectorPosition(fkBackSector, q4Position, AliMpIntPair( 1,-1))); | |
f79c58a5 | 95 | #endif |
96 | ||
97 | #ifdef WITH_ROOT | |
98 | // Create sector positions | |
99 | fSectorPositions.Add( | |
100 | new AliMpSectorPosition(fkFrontSector, q1Position, AliMpIntPair( 1, 1))); | |
101 | fSectorPositions.Add( | |
102 | new AliMpSectorPosition(fkBackSector, q2Position, AliMpIntPair(-1, 1))); | |
103 | fSectorPositions.Add( | |
104 | new AliMpSectorPosition(fkFrontSector, q3Position, AliMpIntPair(-1,-1))); | |
105 | fSectorPositions.Add( | |
106 | new AliMpSectorPosition(fkBackSector, q4Position, AliMpIntPair( 1,-1))); | |
107 | #endif | |
5f91c9e8 | 108 | } |
109 | ||
110 | ||
111 | //______________________________________________________________________________ | |
112 | AliMpPlane::AliMpPlane() | |
113 | : TObject(), | |
114 | fkFrontSector(0), | |
115 | fkBackSector(0), | |
116 | fSectorPositions() | |
117 | { | |
118 | // | |
119 | } | |
120 | ||
121 | //______________________________________________________________________________ | |
122 | AliMpPlane::~AliMpPlane() { | |
123 | // | |
124 | ||
125 | delete fkFrontSector; | |
126 | delete fkBackSector; | |
127 | ||
128 | for (Int_t i=0; i<GetNofSectorPositions(); i++) | |
129 | delete GetSectorPosition(i); | |
130 | } | |
131 | ||
132 | // | |
133 | // public methods | |
134 | // | |
135 | ||
136 | //______________________________________________________________________________ | |
137 | const AliMpSectorPosition* | |
138 | AliMpPlane::SectorPosition(const AliMpIntPair& scale) const | |
139 | { | |
140 | // Returns the sector position specified by scale. | |
141 | // --- | |
142 | ||
f79c58a5 | 143 | for (Int_t i=0; i<GetNofSectorPositions(); i++) |
144 | if (GetSectorPosition(i)->GetScale() == scale) return GetSectorPosition(i); | |
5f91c9e8 | 145 | |
146 | Fatal("SectorPosition", "Wrong scale"); | |
147 | return 0; | |
148 | } | |
149 | ||
150 | //______________________________________________________________________________ | |
151 | Int_t AliMpPlane::GetNofSectorPositions() const | |
152 | { | |
153 | // Returns number of sector positions. | |
154 | // --- | |
155 | ||
f79c58a5 | 156 | #ifdef WITH_STL |
5f91c9e8 | 157 | return fSectorPositions.size(); |
f79c58a5 | 158 | #endif |
159 | ||
160 | #ifdef WITH_ROOT | |
161 | return fSectorPositions.GetEntriesFast(); | |
162 | #endif | |
5f91c9e8 | 163 | } |
164 | ||
165 | ||
166 | //______________________________________________________________________________ | |
167 | AliMpSectorPosition* AliMpPlane::GetSectorPosition(Int_t i) const | |
168 | { | |
169 | // Returns i-th sector position. | |
170 | // --- | |
171 | ||
f79c58a5 | 172 | #ifdef WITH_STL |
5f91c9e8 | 173 | return fSectorPositions[i]; |
f79c58a5 | 174 | #endif |
175 | ||
176 | #ifdef WITH_ROOT | |
177 | return (AliMpSectorPosition*)fSectorPositions[i]; | |
178 | #endif | |
5f91c9e8 | 179 | } |
180 | ||
181 |