Ignore:
Timestamp:
10/23/06 15:39:30 (18 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mbadpixels
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCam.cc

    r8147 r8149  
    150150        InitSize(n);
    151151
    152     if (n!=GetSize())
     152    if (GetSize()<n)
    153153    {
    154154        *fLog << warn << "MBadPixelsCam::Merge: Size mismatch (" << n << "," << GetSize() << ")... ignored." << endl;
     
    559559//
    560560// Read from an ascii file of the format:
    561 //    pixel1 pixel2 pixel3 pixel4
     561//    pixel1
     562//    pixel2
     563//    pixel3
     564//    pixel4
    562565// while pixel1,2,3,4 are the pixel indices used in the software.
    563566//
    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;
     567void MBadPixelsCam::AsciiRead(istream &fin)
     568{
    573569    TString str;
    574570
     
    576572    {
    577573        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)
    594575            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();
    608581
    609582        if (idx>=GetSize())
     
    617590// --------------------------------------------------------------------------
    618591//
    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//
     594Bool_t MBadPixelsCam::AsciiWrite(ostream &fout) const
     595{
    627596    for (int i=0; i<GetSize(); i++)
    628597        if ((*this)[i].IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
    629             fout << " " << i;
    630 
    631     if (run && GetSize())
    632         fout << endl;
     598            fout << i << endl;
    633599
    634600    return kTRUE;
  • trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCam.h

    r7903 r8149  
    5050    Short_t GetNumMaxCluster(const MGeomCam &geom, Int_t aidx=-1) { return GetNumMaxCluster(MBadPixelsPix::kUnsuitableRun, geom, aidx); }
    5151
    52     void   AsciiRead(istream &fin, UInt_t run);
    53     void   AsciiRead(istream &fin) { AsciiRead(fin, 0); }
    54     Bool_t AsciiWrite(ostream &out, UInt_t run) const;
    55     Bool_t AsciiWrite(ostream &out) const { return AsciiWrite(out, 0); }
     52    void   AsciiRead(istream &fin);
     53    Bool_t AsciiWrite(ostream &out) const;
    5654
    5755    Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const;
  • trunk/MagicSoft/Mars/mbadpixels/MBadPixelsIntensityCam.h

    r8140 r8149  
    7171        { return GetCam()->GetNumMaxCluster(geom, aidx); }
    7272 
    73   void   AsciiRead(istream &fin, UInt_t run)
    74         { GetCam()->AsciiRead(fin,run); }
    75   void   AsciiRead(istream &fin)
    76         {GetCam()->AsciiRead(fin); }
    77   Bool_t AsciiWrite(ostream &out, UInt_t run)
    78         const { return GetCam()->AsciiWrite(out,run); }
    79   Bool_t AsciiWrite(ostream &out)
    80         const { return GetCam()->AsciiWrite(out); }
     73  void   AsciiRead(istream &fin) { GetCam()->AsciiRead(fin); }
     74  Bool_t AsciiWrite(ostream &out) const { return GetCam()->AsciiWrite(out); }
    8175 
    8276  // Inits
Note: See TracChangeset for help on using the changeset viewer.