Changeset 8149 for trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCam.cc
- Timestamp:
- 10/23/06 15:39:30 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCam.cc
r8147 r8149 150 150 InitSize(n); 151 151 152 if ( n!=GetSize())152 if (GetSize()<n) 153 153 { 154 154 *fLog << warn << "MBadPixelsCam::Merge: Size mismatch (" << n << "," << GetSize() << ")... ignored." << endl; … … 559 559 // 560 560 // Read from an ascii file of the format: 561 // pixel1 pixel2 pixel3 pixel4 561 // pixel1 562 // pixel2 563 // pixel3 564 // pixel4 562 565 // while pixel1,2,3,4 are the pixel indices used in the software. 563 566 // 564 // To read the pixels corresponding to a given run you can give run!=0 565 // and a file of the format: 566 // 1234: 17 193 292 567 // 1235: 17 193 292 293 568 // 569 void MBadPixelsCam::AsciiRead(istream &fin, UInt_t run=0) 570 { 571 572 Int_t len; 567 void MBadPixelsCam::AsciiRead(istream &fin) 568 { 573 569 TString str; 574 570 … … 576 572 { 577 573 str.ReadLine(fin); 578 579 if (str.IsNull()) 580 { 581 *fLog << warn << GetDescriptor() 582 << ": Cannot apply AsciiRead from istream pointer. " 583 << "Either file does not exist or file is empty! " << endl; 584 return; 585 } 586 587 Int_t r; 588 589 const Int_t n = sscanf(str.Data(), " %d : %n", &r, &len); 590 if (n!=1) 591 return; 592 593 if (run==0 || run && (UInt_t)r==run) 574 if (!fin) 594 575 break; 595 } 596 597 str.Remove(0, len); 598 599 while (1) 600 { 601 Int_t idx; 602 const Int_t n = sscanf(str.Data(), " %d %n", &idx, &len); 603 604 if (n!=1) 605 break; 606 607 str.Remove(0, len); 576 577 if (str[0]=='#') 578 continue; 579 580 const Int_t idx = str.Atoi(); 608 581 609 582 if (idx>=GetSize()) … … 617 590 // -------------------------------------------------------------------------- 618 591 // 619 // Write the information into an ascii file. If a run-number is given the 620 // run-number will lead the line. 621 // 622 Bool_t MBadPixelsCam::AsciiWrite(ostream &fout, UInt_t run=0) const 623 { 624 if (run) 625 fout << run << ":"; 626 592 // Write the information into an ascii file. 593 // 594 Bool_t MBadPixelsCam::AsciiWrite(ostream &fout) const 595 { 627 596 for (int i=0; i<GetSize(); i++) 628 597 if ((*this)[i].IsUnsuitable(MBadPixelsPix::kUnsuitableRun)) 629 fout << " " << i; 630 631 if (run && GetSize()) 632 fout << endl; 598 fout << i << endl; 633 599 634 600 return kTRUE;
Note:
See TracChangeset
for help on using the changeset viewer.