Ignore:
Timestamp:
08/24/16 18:12:23 (8 years ago)
Author:
tbretz
Message:
Added case 1203 and 1212 for convenience and to simplify reading eventio files. handle case of data in Version 1000, it seems this is the compact format.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Mars/mcorsika/MCorsikaRead.cc

    r18533 r18542  
    393393    gLog << " identifier=" << fBlockIdentifier << " length=" << fBlockLength;
    394394    gLog << " readState= " << fReadState << endl;
    395 */   
     395*/
    396396   if (fReadState == 3 && fBlockType != 1210)
    397397      // fReadState == 3    means we have read the event end
     
    499499               break;
    500500
    501             case 1201:       // telescope position
     501            case 1201:       // telescope positions
    502502               status = ReadTelescopePosition();
    503503               break;
     
    525525               fReadState = 2;
    526526               break;
     527
     528            case 1203: // 16 bytes
     529                fInFormat->Seek(fBlockLength);
     530                break;
     531
     532            case 1212:
     533                {
     534                    char *buf = new char[fBlockLength];
     535                    fInFormat->Read(buf, fBlockLength);
     536                    status = kTRUE;
     537
     538                    char *ptr = buf;
     539
     540                    unsigned int n = ((int*)ptr)[0];
     541                    ptr += 4;
     542
     543                    cout << endl;
     544
     545                    for (unsigned int i=0; i<n && ptr<buf+fBlockLength; i++)
     546                    {
     547                        unsigned short s = ((unsigned short*)ptr)[0];
     548                        ptr += 2;
     549
     550                        cout << string(ptr, ptr+s) << '\n';
     551                        ptr += s;
     552                    }
     553                    cout << '\n' << endl;
     554
     555                    delete [] buf;
     556                }
     557                break;
     558
    527559
    528560            case 1204: // top level block for one array (only for eventio data)
     
    542574               {
    543575               Int_t telIdx   = fBlockIdentifier % 1000;
    544                if (fBlockVersion == 0                               &&
     576               if ((fBlockVersion == 0 || fBlockVersion == 1000)                              &&
    545577                     (fTelescopeIdx < 0 || fTelescopeIdx ==  telIdx)     )
    546578                  {
    547                   status = fEvent->ReadEventIoEvt(fInFormat);
     579                  status = fBlockVersion==0 ? fEvent->ReadEventIoEvt(fInFormat) : fEvent->ReadEventIoEvtCompact(fInFormat);
    548580
    549581                  Int_t arrayIdx = fBlockIdentifier / 1000;
     
    566598            case 1209:  // the event end
    567599               status = fEvtHeader->ReadEvtEnd(fInFormat);
    568                
     600
    569601               if (fReadState == 10 || fReadState == 2)
    570602                  {
Note: See TracChangeset for help on using the changeset viewer.