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