]>
Commit | Line | Data |
---|---|---|
197883c2 | 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 | ||
5f91c9e8 | 16 | // $Id$ |
13985652 | 17 | // $MpId: AliMpSectorReader.cxx,v 1.9 2006/05/24 13:58:46 ivana Exp $ |
5f91c9e8 | 18 | // Category: sector |
3d1463c8 | 19 | |
20 | //----------------------------------------------------------------------------- | |
197883c2 | 21 | // Class AliMpSectorReader |
22 | // ----------------------- | |
5f91c9e8 | 23 | // Class that takes care of reading the sector data. |
dbe945cc | 24 | // Included in AliRoot: 2003/05/02 |
5f91c9e8 | 25 | // Authors: David Guez, Ivana Hrivnacova; IPN Orsay |
3d1463c8 | 26 | //----------------------------------------------------------------------------- |
5f91c9e8 | 27 | |
197883c2 | 28 | #include "AliMpSectorReader.h" |
5f91c9e8 | 29 | #include "AliMpSector.h" |
30 | #include "AliMpFiles.h" | |
228fd720 | 31 | #include "AliMpDataStreams.h" |
5f91c9e8 | 32 | #include "AliMpZone.h" |
33 | #include "AliMpSubZone.h" | |
34 | #include "AliMpRow.h" | |
35 | #include "AliMpVRowSegment.h" | |
36 | #include "AliMpRowSegment.h" | |
4139354b | 37 | #include "AliMpRowSegmentLSpecial.h" |
38 | #include "AliMpRowSegmentRSpecial.h" | |
5f91c9e8 | 39 | #include "AliMpPadRow.h" |
197883c2 | 40 | #include "AliMpMotifReader.h" |
5f91c9e8 | 41 | #include "AliMpMotifMap.h" |
42 | #include "AliMpMotif.h" | |
43 | #include "AliMpMotifSpecial.h" | |
44 | #include "AliMpMotifType.h" | |
45 | #include "AliMpConnection.h" | |
5f91c9e8 | 46 | #include "AliMpDirection.h" |
f0eac1a3 | 47 | #include "AliMpConstants.h" |
5f91c9e8 | 48 | |
2c605e66 | 49 | #include "AliLog.h" |
50 | ||
f0eac1a3 | 51 | #include <Riostream.h> |
52 | #include <Rstrstream.h> | |
53 | #include <TSystem.h> | |
f0eac1a3 | 54 | #include <TMath.h> |
55 | ||
ca954646 | 56 | #include <limits> |
57 | ||
f0eac1a3 | 58 | #if !defined(__HP_aCC) && !defined(__alpha) |
59 | #include <sstream> | |
60 | #endif | |
f79c58a5 | 61 | |
13985652 | 62 | /// \cond CLASSIMP |
63 | ClassImp(AliMpSectorReader) | |
64 | /// \endcond | |
65 | ||
197883c2 | 66 | const TString AliMpSectorReader::fgkSectorKeyword = "SECTOR_DATA"; |
67 | const TString AliMpSectorReader::fgkZoneKeyword = "ZONE"; | |
68 | const TString AliMpSectorReader::fgkSubZoneKeyword = "SUBZONE"; | |
69 | const TString AliMpSectorReader::fgkRowKeyword = "ROW_SEGMENT"; | |
70 | const TString AliMpSectorReader::fgkEofKeyword = "EOF"; | |
71 | const TString AliMpSectorReader::fgkSectorSpecialKeyword = "SECTOR_SPECIAL_DATA"; | |
72 | const TString AliMpSectorReader::fgkMotifKeyword = "MOTIF"; | |
73 | const TString AliMpSectorReader::fgkRowSpecialKeyword = "ROW"; | |
74 | const TString AliMpSectorReader::fgkPadRowsKeyword = "PAD_ROWS"; | |
75 | const TString AliMpSectorReader::fgkPadRowSegmentKeyword = "PAD_ROW_SEGMENT"; | |
5f91c9e8 | 76 | |
77 | //_____________________________________________________________________________ | |
ab167304 | 78 | AliMpSectorReader::AliMpSectorReader(const AliMpDataStreams& dataStreams, |
4e51cfd2 | 79 | AliMq::Station12Type station, |
cddd101e | 80 | AliMp::PlaneType plane) |
5f91c9e8 | 81 | : TObject(), |
7d5d0cc5 | 82 | fkDataStreams(dataStreams), |
4139354b | 83 | fStationType(station), |
5f91c9e8 | 84 | fPlaneType(plane), |
85 | fSector(0), | |
4e51cfd2 | 86 | fMotifReader(new AliMpMotifReader(dataStreams, AliMp::kStation12, station, plane)) |
228fd720 | 87 | |
5f91c9e8 | 88 | { |
f5671fc3 | 89 | /// Standard constructor |
5f91c9e8 | 90 | } |
91 | ||
5f91c9e8 | 92 | //_____________________________________________________________________________ |
197883c2 | 93 | AliMpSectorReader::~AliMpSectorReader() |
94 | { | |
95 | /// Destructor | |
96 | ||
97 | delete fMotifReader; | |
5f91c9e8 | 98 | } |
99 | ||
100 | // | |
101 | // private methods | |
102 | // | |
103 | ||
f79c58a5 | 104 | //_____________________________________________________________________________ |
228fd720 | 105 | void AliMpSectorReader::ReadSectorData(istream& in) |
f79c58a5 | 106 | { |
197883c2 | 107 | /// Read sector input data; |
108 | /// prepare zones and rows vectors to be filled in. | |
5f91c9e8 | 109 | |
110 | TString keyword; | |
111 | in >> keyword; | |
112 | ||
da3a1bb2 | 113 | AliDebugStream(2) << keyword << endl; |
5f91c9e8 | 114 | |
115 | if (keyword != fgkSectorKeyword) { | |
2ca8e354 | 116 | AliErrorStream() << "Wrong file format." << endl; |
5f91c9e8 | 117 | return; |
118 | } | |
119 | ||
120 | Int_t nofZones, nofRows; | |
121 | TString directionStr; | |
14b7b896 | 122 | Double_t offsetX, offsetY; |
5f91c9e8 | 123 | in >> nofZones; |
124 | in >> nofRows; | |
125 | in >> directionStr; | |
14b7b896 | 126 | in >> offsetX; |
127 | in >> offsetY; | |
5f91c9e8 | 128 | |
cddd101e | 129 | AliMp::Direction direction; |
130 | direction = (directionStr == "Y") ? AliMp::kY : AliMp::kX; | |
2c605e66 | 131 | |
da3a1bb2 | 132 | AliDebugStream(2) << nofZones << " " << nofRows << endl; |
2ca8e354 | 133 | |
ca954646 | 134 | if ( nofZones < 0 || nofZones >= std::numeric_limits<Int_t>::max() || |
135 | nofRows < 0 || nofRows >= std::numeric_limits<Int_t>::max() ) { | |
2ca8e354 | 136 | AliErrorStream() << "Wrong nofZones/nofRows value." << endl; |
137 | return; | |
138 | } | |
5f91c9e8 | 139 | |
14b7b896 | 140 | fSector = new AliMpSector("Not defined", nofZones, nofRows,direction, |
6e97fbb8 | 141 | offsetX, offsetY); |
5f91c9e8 | 142 | |
143 | TString nextKeyword; | |
144 | in >> nextKeyword; | |
145 | ||
146 | if (nextKeyword != fgkZoneKeyword) { | |
2ca8e354 | 147 | AliErrorStream() << "Wrong file format." << endl; |
5f91c9e8 | 148 | return; |
149 | } | |
150 | ||
151 | ReadZoneData(in); | |
152 | } | |
153 | ||
154 | //_____________________________________________________________________________ | |
228fd720 | 155 | void AliMpSectorReader::ReadZoneData(istream& in) |
5f91c9e8 | 156 | { |
197883c2 | 157 | /// Read zone input data; |
158 | /// create zone and adds it to zones vector. | |
5f91c9e8 | 159 | |
160 | Int_t zoneID; | |
161 | Double_t sizex, sizey; | |
162 | in >> zoneID; | |
163 | in >> sizex; | |
164 | in >> sizey; | |
da3a1bb2 | 165 | AliDebugStream(2) |
2c605e66 | 166 | << fgkZoneKeyword << " " << zoneID << " " |
167 | << sizex << " " << sizey << endl; | |
5f91c9e8 | 168 | |
169 | AliMpZone* zone = fSector->GetZone(zoneID); | |
6e97fbb8 | 170 | zone->SetPadDimensions(sizex/2.,sizey/2.); |
5f91c9e8 | 171 | |
172 | TString nextKeyword; | |
173 | in >> nextKeyword; | |
174 | ||
175 | if (nextKeyword != fgkSubZoneKeyword) { | |
2ca8e354 | 176 | AliErrorStream() << "Wrong file format." << endl; |
5f91c9e8 | 177 | return; |
178 | } | |
179 | ||
180 | ReadSubZoneData(in, zone); | |
181 | } | |
182 | ||
183 | //_____________________________________________________________________________ | |
228fd720 | 184 | void AliMpSectorReader::ReadSubZoneData(istream& in, AliMpZone* zone) |
5f91c9e8 | 185 | { |
197883c2 | 186 | /// Read subzone input data; |
187 | /// create subzone and its to the specified zone. | |
5f91c9e8 | 188 | |
da3a1bb2 | 189 | AliDebugStream(2) << fgkSubZoneKeyword << endl; |
5f91c9e8 | 190 | |
191 | AliMpVMotif* motif = ReadMotifData(in, zone); | |
192 | AliMpSubZone* subZone = new AliMpSubZone(motif); | |
193 | zone->AddSubZone(subZone); | |
194 | ||
195 | TString nextKeyword; | |
196 | in >> nextKeyword; | |
197 | ||
198 | if (nextKeyword != fgkRowKeyword) { | |
2ca8e354 | 199 | AliErrorStream() << "Wrong file format." << endl; |
5f91c9e8 | 200 | return; |
201 | } | |
202 | ||
203 | ReadRowSegmentsData(in, zone, subZone); | |
204 | } | |
205 | ||
206 | //_____________________________________________________________________________ | |
228fd720 | 207 | AliMpVMotif* AliMpSectorReader::ReadMotifData(istream& in, AliMpZone* zone) |
5f91c9e8 | 208 | { |
197883c2 | 209 | /// Read the motif input data. |
5f91c9e8 | 210 | |
211 | TString motifID; | |
212 | TString motifTypeID; | |
213 | in >> motifID; | |
214 | in >> motifTypeID; | |
2c605e66 | 215 | |
da3a1bb2 | 216 | AliDebugStream(2) << motifID << " " << motifTypeID << endl; |
5f91c9e8 | 217 | |
218 | AliMpMotifMap* motifMap = fSector->GetMotifMap(); | |
219 | ||
220 | AliMpMotifType* motifType = 0; | |
221 | AliMpVMotif* motif | |
6e97fbb8 | 222 | = motifMap->FindMotif(motifID, motifTypeID, |
223 | zone->GetPadDimensionX(), zone->GetPadDimensionY()); | |
5f91c9e8 | 224 | if (!motif) { |
225 | motifType = motifMap->FindMotifType(motifTypeID); | |
226 | if (!motifType) { | |
197883c2 | 227 | motifType = fMotifReader->BuildMotifType(motifTypeID); |
5f91c9e8 | 228 | motifMap->AddMotifType(motifType); |
229 | } | |
230 | ||
6e97fbb8 | 231 | if (zone->GetPadDimensionX() != 0. && zone->GetPadDimensionY() != 0.) |
232 | motif = new AliMpMotif(motifID, motifType, | |
233 | zone->GetPadDimensionX(), zone->GetPadDimensionY()); | |
5f91c9e8 | 234 | else |
197883c2 | 235 | motif = fMotifReader->BuildMotifSpecial(motifID, motifType); |
5f91c9e8 | 236 | |
237 | if (motif) | |
238 | motifMap->AddMotif(motif); | |
239 | ||
240 | } | |
241 | ||
242 | return motif; | |
243 | } | |
244 | ||
245 | //_____________________________________________________________________________ | |
228fd720 | 246 | void AliMpSectorReader::ReadRowSegmentsData(istream& in, |
5f91c9e8 | 247 | AliMpZone* zone, AliMpSubZone* subZone) |
248 | { | |
197883c2 | 249 | /// Read row segments input data of a specified zone and subzone; |
250 | /// creates row segment and add it to the specified subzone | |
251 | /// and a corresponding row in the rows vector. | |
5f91c9e8 | 252 | |
253 | TString nextKeyword; | |
254 | do { | |
255 | // | |
256 | // Read data from file | |
257 | // | |
258 | Int_t offX, offY, inRow, nofMotifs, firstMotifPositionId, firstMotifPositionDId; | |
259 | in >> offX; | |
260 | in >> offY; | |
261 | in >> inRow; | |
262 | in >> nofMotifs; | |
263 | in >> firstMotifPositionId; | |
264 | in >> firstMotifPositionDId; | |
f0eac1a3 | 265 | |
266 | firstMotifPositionId |= AliMpConstants::ManuMask(fPlaneType); | |
267 | ||
da3a1bb2 | 268 | AliDebugStream(2) |
2c605e66 | 269 | << fgkRowKeyword << " " |
270 | << offX << " " << offY << " " << inRow << " " << nofMotifs << " " | |
271 | << firstMotifPositionId << " " << firstMotifPositionDId | |
272 | << endl; | |
5f91c9e8 | 273 | |
274 | in >> nextKeyword; | |
275 | ||
276 | // | |
277 | // Process data | |
278 | // | |
279 | AliMpRow* row = fSector->GetRow(inRow); | |
280 | AliMpVMotif* motif = subZone->GetMotif(); | |
281 | ||
282 | // Create row segment and add it to its zone, row | |
283 | AliMpVRowSegment* rowSegment | |
168e9c4d | 284 | = new AliMpRowSegment(row, motif, offX, offY, nofMotifs, |
5f91c9e8 | 285 | firstMotifPositionId, firstMotifPositionDId); |
286 | ||
287 | subZone->AddRowSegment(rowSegment); | |
288 | row->AddRowSegment(rowSegment); | |
289 | } | |
290 | while (!in.eof() && (nextKeyword == fgkRowKeyword)); | |
291 | ||
292 | if (in.eof()) return; | |
293 | ||
294 | if (nextKeyword == fgkZoneKeyword) { | |
295 | ReadZoneData(in); | |
296 | } | |
297 | else if (nextKeyword == fgkSubZoneKeyword) { | |
298 | ReadSubZoneData(in, zone); | |
299 | } | |
300 | else { | |
2ca8e354 | 301 | AliErrorStream() << "Wrong file format." << endl; |
5f91c9e8 | 302 | } |
303 | } | |
304 | ||
305 | //_____________________________________________________________________________ | |
228fd720 | 306 | void AliMpSectorReader::ReadSectorSpecialData(istream& in, AliMp::XDirection direction) |
5f91c9e8 | 307 | { |
197883c2 | 308 | /// Read sector input data |
309 | /// with a special (irregular) motifs. | |
5f91c9e8 | 310 | |
311 | TString keyword; | |
312 | in >> keyword; | |
2c605e66 | 313 | |
da3a1bb2 | 314 | AliDebugStream(2) << keyword << endl; |
5f91c9e8 | 315 | |
316 | if (keyword != fgkSectorSpecialKeyword) { | |
2ca8e354 | 317 | AliErrorStream() << "Wrong file format." << endl; |
5f91c9e8 | 318 | return; |
319 | } | |
320 | ||
321 | TString nextKeyword; | |
322 | in >> nextKeyword; | |
2c605e66 | 323 | |
da3a1bb2 | 324 | AliDebugStream(2) << keyword << endl; |
5f91c9e8 | 325 | |
326 | if (nextKeyword != fgkMotifKeyword) { | |
2ca8e354 | 327 | AliErrorStream() << "Wrong file format." << endl; |
5f91c9e8 | 328 | return; |
329 | } | |
330 | ||
331 | ReadMotifsSpecialData(in); | |
4139354b | 332 | ReadRowSpecialData(in, direction); |
5f91c9e8 | 333 | } |
334 | ||
335 | //_____________________________________________________________________________ | |
228fd720 | 336 | void AliMpSectorReader::ReadMotifsSpecialData(istream& in) |
5f91c9e8 | 337 | { |
197883c2 | 338 | /// Read the special (irregular) motifs input data. |
5f91c9e8 | 339 | |
da3a1bb2 | 340 | AliDebugStream(2) << fgkMotifKeyword << endl; |
5f91c9e8 | 341 | |
342 | TString nextKeyword; | |
343 | do { | |
4139354b | 344 | Int_t zone; |
345 | in >> zone; | |
346 | AliMpVMotif* motif = ReadMotifData(in, fSector->GetZone(zone)); | |
5f91c9e8 | 347 | AliMpSubZone* subZone = new AliMpSubZone(motif); |
4139354b | 348 | fSector->GetZone(zone)->AddSubZone(subZone); |
5f91c9e8 | 349 | |
350 | in >> nextKeyword; | |
2c605e66 | 351 | |
da3a1bb2 | 352 | AliDebugStream(2) << nextKeyword << endl; |
5f91c9e8 | 353 | } |
354 | while (nextKeyword == fgkMotifKeyword); | |
355 | ||
356 | if (nextKeyword != fgkRowSpecialKeyword) { | |
2ca8e354 | 357 | AliErrorStream() << "Wrong file format." << endl; |
5f91c9e8 | 358 | return; |
359 | } | |
360 | } | |
361 | ||
362 | //_____________________________________________________________________________ | |
228fd720 | 363 | void AliMpSectorReader::ReadRowSpecialData(istream& in, AliMp::XDirection direction) |
5f91c9e8 | 364 | { |
197883c2 | 365 | /// Read row input data |
366 | /// with a special (irregular) motifs. | |
5f91c9e8 | 367 | |
368 | Int_t id; | |
369 | in >> id; | |
2c605e66 | 370 | |
da3a1bb2 | 371 | AliDebugStream(2) << id << endl; |
5f91c9e8 | 372 | |
373 | // Get the row and its border | |
374 | AliMpRow* row = fSector->GetRow(id); | |
4139354b | 375 | |
376 | AliMpVRowSegmentSpecial* segment = 0; | |
cddd101e | 377 | if (direction == AliMp::kLeft) { |
4139354b | 378 | AliMpVRowSegment* firstNormalSeg = row->GetRowSegment(0); |
379 | Double_t offsetX = firstNormalSeg->LeftBorderX(); | |
5f91c9e8 | 380 | |
4139354b | 381 | // Create a special row segment |
382 | segment = new AliMpRowSegmentLSpecial(row, offsetX); | |
383 | row->AddRowSegmentInFront(segment); | |
384 | } | |
385 | else { | |
386 | AliMpVRowSegment* precedentNormalSeg | |
387 | = row->GetRowSegment(row->GetNofRowSegments()-1); | |
388 | Double_t offsetX = precedentNormalSeg->RightBorderX(); | |
5f91c9e8 | 389 | |
4139354b | 390 | // Create a special row segment |
391 | segment = new AliMpRowSegmentRSpecial(row, offsetX); | |
392 | row->AddRowSegment(segment); | |
393 | } | |
394 | ||
5f91c9e8 | 395 | TString nextKeyword; |
396 | in >> nextKeyword; | |
2c605e66 | 397 | |
da3a1bb2 | 398 | AliDebugStream(2) << nextKeyword << endl; |
5f91c9e8 | 399 | |
400 | if (nextKeyword != fgkPadRowsKeyword) { | |
2ca8e354 | 401 | AliErrorStream() << "Wrong file format." << endl; |
5f91c9e8 | 402 | return; |
403 | } | |
404 | ||
4139354b | 405 | ReadRowSegmentSpecialData(in, segment, direction); |
5f91c9e8 | 406 | |
407 | // Update row segment and set it to all subzones associated with | |
408 | // contained motifs | |
409 | ||
410 | segment->UpdateMotifVector(); | |
411 | segment->UpdatePadsOffset(); | |
412 | ||
4139354b | 413 | for (Int_t i=0; i<segment->GetNofMotifs(); i++) { |
414 | AliMpSubZone* subZone = 0; | |
415 | Int_t j = 0; | |
416 | while (!subZone && j<fSector->GetNofZones()) | |
417 | subZone = fSector->GetZone(++j)->FindSubZone(segment->GetMotif(i)); | |
418 | ||
419 | subZone->AddRowSegment(segment); | |
420 | } | |
5f91c9e8 | 421 | } |
422 | ||
423 | //_____________________________________________________________________________ | |
228fd720 | 424 | void AliMpSectorReader::ReadRowSegmentSpecialData(istream& in, |
4139354b | 425 | AliMpVRowSegmentSpecial* segment, |
cddd101e | 426 | AliMp::XDirection direction) |
5f91c9e8 | 427 | { |
197883c2 | 428 | /// Read row segment input data |
429 | /// with a special (irregular) motifs. | |
5f91c9e8 | 430 | |
431 | Int_t nofPadRows; | |
432 | in >> nofPadRows; | |
2c605e66 | 433 | |
da3a1bb2 | 434 | AliDebugStream(2) << nofPadRows << endl; |
5f91c9e8 | 435 | |
d76df0d8 | 436 | if ( nofPadRows < 0 || nofPadRows >= std::numeric_limits<Int_t>::max()) { |
2ca8e354 | 437 | AliErrorStream() << "Wrong nofPadRows value." << endl; |
438 | return; | |
439 | } | |
440 | ||
5f91c9e8 | 441 | TString keyword; |
442 | in >> keyword; | |
2c605e66 | 443 | |
da3a1bb2 | 444 | AliDebugStream(2) << keyword << endl; |
5f91c9e8 | 445 | |
446 | if (keyword != fgkPadRowSegmentKeyword) { | |
2ca8e354 | 447 | AliErrorStream() << "Wrong file format." << endl; |
5f91c9e8 | 448 | return; |
449 | } | |
450 | ||
451 | // | |
452 | // Process data | |
453 | // | |
454 | ||
2294822d | 455 | TObjArray newPadRows; |
5f91c9e8 | 456 | for (Int_t i=0; i<nofPadRows; i++) { |
457 | ||
458 | // Create pad row | |
4139354b | 459 | AliMpPadRow* padRow = new AliMpPadRow(direction); |
5f91c9e8 | 460 | segment->AddPadRow(padRow); |
461 | ||
462 | // Keep the new rows in a temporary vector | |
f79c58a5 | 463 | newPadRows.Add(padRow); |
5f91c9e8 | 464 | } |
465 | ||
466 | TString nextKeyword; | |
467 | do { | |
468 | // | |
469 | // Read data from file | |
470 | // | |
471 | Int_t nofPadsInRow, motifPositionId; | |
472 | TString motifId, motifTypeId; | |
473 | in >> nofPadsInRow; | |
474 | in >> motifId; | |
475 | in >> motifPositionId; | |
476 | ||
f0eac1a3 | 477 | motifPositionId |= AliMpConstants::ManuMask(fPlaneType); |
478 | ||
da3a1bb2 | 479 | AliDebugStream(2) |
2c605e66 | 480 | << nofPadsInRow << " " << motifId << " " << motifPositionId << endl; |
5f91c9e8 | 481 | |
482 | in >> nextKeyword; | |
2c605e66 | 483 | |
da3a1bb2 | 484 | AliDebugStream(2) << nextKeyword << endl; |
5f91c9e8 | 485 | |
486 | // | |
487 | // Process data | |
488 | // | |
489 | ||
490 | for (Int_t i=0; i<nofPadRows; i++) { | |
491 | ||
492 | // Get pad row from the temporary vector | |
f79c58a5 | 493 | AliMpPadRow* padRow = (AliMpPadRow*)newPadRows[i]; |
5f91c9e8 | 494 | |
495 | // Find motif | |
496 | AliMpVMotif* motif = fSector->GetMotifMap()->FindMotif(motifId); | |
497 | ||
498 | if (!motif) { | |
2ca8e354 | 499 | AliErrorStream() << "Unknown motif" << endl; |
5f91c9e8 | 500 | return; |
501 | } | |
502 | ||
503 | // Create pad row segment | |
4139354b | 504 | padRow->AddPadRowSegment(dynamic_cast<AliMpMotif *>(motif), |
505 | motifPositionId, nofPadsInRow); | |
5f91c9e8 | 506 | } |
507 | } | |
508 | while (!in.eof() && (nextKeyword == fgkPadRowSegmentKeyword)); | |
509 | ||
510 | if (in.eof()) return; | |
511 | ||
512 | if (nextKeyword == fgkPadRowsKeyword) { | |
4139354b | 513 | ReadRowSegmentSpecialData(in, segment, direction); |
5f91c9e8 | 514 | } |
515 | else if (nextKeyword == fgkRowSpecialKeyword) { | |
4139354b | 516 | ReadRowSpecialData(in, direction); |
5f91c9e8 | 517 | } |
518 | else { | |
2ca8e354 | 519 | AliErrorStream() << "Wrong file format." << endl; |
5f91c9e8 | 520 | } |
521 | } | |
522 | ||
523 | // | |
524 | // public methods | |
525 | // | |
526 | ||
527 | //_____________________________________________________________________________ | |
197883c2 | 528 | AliMpSector* AliMpSectorReader::BuildSector() |
5f91c9e8 | 529 | { |
228fd720 | 530 | /// Read the mapping data from stream and create the basic objects: \n |
197883c2 | 531 | /// zones, subzones, rows, row segments, motifs. |
5f91c9e8 | 532 | |
228fd720 | 533 | // Open input stream |
534 | // | |
535 | istream& in | |
7d5d0cc5 | 536 | = fkDataStreams. |
ab167304 | 537 | CreateDataStream(AliMpFiles::SectorFilePath(fStationType,fPlaneType)); |
228fd720 | 538 | |
5f91c9e8 | 539 | ReadSectorData(in); |
228fd720 | 540 | delete ∈ |
541 | ||
5f91c9e8 | 542 | fSector->SetRowSegmentOffsets(); |
543 | ||
228fd720 | 544 | // Open input stream for special inner zone |
545 | ||
546 | // add is data function | |
547 | ||
5f91c9e8 | 548 | TString sectorSpecialFileName |
3d16af90 | 549 | = AliMpFiles::SectorSpecialFilePath(fStationType, fPlaneType); |
7d5d0cc5 | 550 | if ( fkDataStreams.IsDataStream(sectorSpecialFileName) ) { |
228fd720 | 551 | istream& in2 |
7d5d0cc5 | 552 | = fkDataStreams. |
ab167304 | 553 | CreateDataStream(sectorSpecialFileName); |
228fd720 | 554 | |
cddd101e | 555 | ReadSectorSpecialData(in2, AliMp::kLeft); |
228fd720 | 556 | |
557 | delete &in2; | |
558 | } | |
4139354b | 559 | |
560 | // Open input file for special outer zone | |
561 | TString sectorSpecialFileName2 | |
3d16af90 | 562 | = AliMpFiles::SectorSpecialFilePath2(fStationType, fPlaneType); |
7d5d0cc5 | 563 | if ( fkDataStreams.IsDataStream(sectorSpecialFileName2) ) { |
228fd720 | 564 | istream& in3 |
7d5d0cc5 | 565 | = fkDataStreams. |
ab167304 | 566 | CreateDataStream(sectorSpecialFileName2); |
4139354b | 567 | |
cddd101e | 568 | ReadSectorSpecialData(in3, AliMp::kRight); |
228fd720 | 569 | |
570 | delete &in3; | |
5f91c9e8 | 571 | } |
572 | ||
573 | fSector->Initialize(); | |
574 | ||
575 | return fSector; | |
576 | } | |
577 |