Changeset 8344


Ignore:
Timestamp:
03/01/07 21:31:23 (18 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mraw
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mraw/MRawCrateData.cc

    r4601 r8344  
    5656void MRawCrateData::ReadEvt(istream& fin, UShort_t ver)
    5757{
    58     fin.read((char*)&fDAQCrateNumber, 2);
    59     fin.read((char*)&fFADCEvtNumber,  4);
    60     fin.read((char*)&fFADCClockTick,  4);
    61     if (ver>1)
    62        fin.read((char*)&fABFlags, 1);
     58    if (ver<7)
     59    {
     60        fin.read((char*)&fDAQCrateNumber, 2);
     61        fin.read((char*)&fFADCEvtNumber,  4);
     62        fin.read((char*)&fFADCClockTick,  4);
     63        if (ver>1)
     64            fin.read((char*)&fABFlags, 1);
     65    }
     66    else
     67    {
     68        //  U8  CrateNumber;    // 0-4
     69        //  U8  BoardNumber;    // 0-1
     70        //  U8  ChannelNumber;  // 0-3
     71        fDAQCrateNumber = 0;
     72        fin.read((char*)&fDAQCrateNumber, 1); // U8: CrateNumber 0-4
     73
     74        Byte_t dummyb;
     75        fin.read((char*)&dummyb, 1); // U8 Board   number 0-1
     76        fin.read((char*)&dummyb, 1); // U8 Channel number 0-3
     77
     78        fin.read((char*)&fFADCEvtNumber, 4); // U32 CrateEvtNumber
     79
     80        // Clock count. The Clock is synchronized with the 10 MHz external clock,
     81        //  which is feed to for all FADC channels.
     82        // The units are [psec], which is obviously much smaller than the real accuracy.
     83        // The ClockTick should be identical for all channels of the same board.
     84        //  Still keep it for debugging purposes.
     85        // Like in the 300MHz system this number is extremely useful to check the
     86        //  integrity of the data.
     87        UInt_t dummyi;
     88        fin.read((char*)&dummyi, 4); //  U32 FadcClockTickHi;  // high significant bits
     89        fin.read((char*)&dummyi, 4); //  U32 FadcClockTickLo;  // low significant bits
     90
     91        // Trigger Time Interpolation in [psec] (originally it is a double
     92        // in Acqiris software). Again this number should be identical for
     93        // all channels in the same board. It is not clear at the moment
     94        // if this number will be useful in the end, but I propose to keep
     95        // it. The data volume is increase by <0.1%
     96        UInt_t dummys;
     97        fin.read((char*)&dummys, 2); //   U16 TrigTimeInterpol;
     98    }
    6399}
    64100
  • trunk/MagicSoft/Mars/mraw/MRawEvtHeader.cc

    r6014 r8344  
    202202    *fLog << "NumLvl2=" << fNumTrigLvl2 << " ";
    203203    *fLog << "Pattern=" << hex << setfill('0');
    204     *fLog << setw(2) << fTrigPattern[0];
    205     *fLog << setw(2) << fTrigPattern[1] << " " << dec;
     204    *fLog << setw(8) << fTrigPattern[0];
     205    *fLog << setw(8) << fTrigPattern[1] << " " << dec;
    206206
    207207    *fLog << "Type=";
     
    358358    fin.read((char*)fTrigPattern,   8);  // Total=28
    359359    fin.read((char*)&fTrigType,     2);  // Total=30
    360     fin.read((char*)dummy,          2);  // Total=32, was fAllLoGainOn
    361     fin.read((char*)fPixLoGainOn->GetArray(), fPixLoGainOn->GetSize());
    362 
    363     fNumLoGainOn = 0;
    364     for (unsigned int i=0; i<fPixLoGainOn->GetSize(); i++)
    365         for (int j=0; j<8; j++)
    366             if ((*fPixLoGainOn)[i] & (1<<j))
    367                 fNumLoGainOn++;
    368 
    369     fin.read((char*)&dummy, 4);
     360    if (ver<=6)
     361    {
     362        fin.read((char*)dummy,          2);  // Total=32, was fAllLoGainOn
     363        fin.read((char*)fPixLoGainOn->GetArray(), fPixLoGainOn->GetSize());
     364
     365        fNumLoGainOn = 0;
     366        for (unsigned int i=0; i<fPixLoGainOn->GetSize(); i++)
     367            for (int j=0; j<8; j++)
     368                if ((*fPixLoGainOn)[i] & (1<<j))
     369                    fNumLoGainOn++;
     370
     371        fin.read((char*)&dummy, 4);
     372    }
     373    else
     374    {
     375        // No LoGains for version 7 data
     376        fPixLoGainOn->Reset();
     377        fNumLoGainOn = 0;
     378    }
    370379
    371380    return fin.eof() ? kFALSE : rc;
  • trunk/MagicSoft/Mars/mraw/MRawRunHeader.cc

    r8326 r8344  
    3333//  =======================
    3434//
     35//  Format Version 8:
     36//  -----------------
     37//   + fNumBytesPerSample;
     38//   + fFreqSampling;
     39//   + fNumSignificantBits;
     40//   * changes in MRawCrateHeader
     41//
     42//  Format Version 7:
     43//  -----------------
     44//   - unused
     45//
    3546//  Format Version 6:
    3647//  -----------------
     
    6273//  MRawRunHeader CLASS VERSION
    6374//  ===========================
     75//
     76//  Format Version 6:
     77//  -----------------
     78//   - added fNumBytesPerSample;
     79//   - added fFreqSampling;
     80//   - added fNumSignificantBits;
    6481//
    6582//  Class Version 5:
     
    107124
    108125const UShort_t MRawRunHeader::kMagicNumber      = 0xc0c0;
    109 const Byte_t   MRawRunHeader::kMaxFormatVersion =      6;
     126const Byte_t   MRawRunHeader::kMaxFormatVersion =      8;
    110127
    111128// --------------------------------------------------------------------------
     
    125142    fTelescopeNumber=0;
    126143    fCameraVersion=0;
     144    fFadcType = 0;
    127145    fRunType=kRTNone;  // use 0xffff for invalidation, 0 means: Data run
    128146    fRunNumber=0;
     
    363381    }
    364382
     383    if (fFormatVersion==7)
     384    {
     385        *fLog << err << "ERROR - File format V7 was for testing only and is not correctly implemented!" << endl;
     386        return kFALSE;
     387    }
     388
    365389    // ----- DAQ software format version -----
    366390    fin.read((char*)&fSoftVersion, 2);     // Total=6
    367391
     392
     393    fFadcType = 0;
     394    if (fFormatVersion>7)
     395        fin.read((char*)&fFadcType, 2);
     396
    368397    // ----- Camera geometry and telescope number -----
     398    fCameraVersion   = 1;
     399    fTelescopeNumber = 1;
    369400    if (fFormatVersion>5)
    370401    {
     
    372403        fin.read((char*)&fTelescopeNumber, 2); // (+2)
    373404    }
    374     // Maybe we should set fCameraVersion and fTelescopeNumber to 1
    375     // in case of fFormatVersion<6
    376405
    377406    // ----- Run information -----
    378407    fin.read((char*)&fRunType,     2); // Total=8
     408
    379409    fin.read((char*)&fRunNumber,   4); // Total=12
    380410    fin.read((char*)&fProjectName, fFormatVersion>5?100:22); // Total=34  (+78)
     
    411441
    412442    // ----- Data Geometry -----
    413     fin.read((char*)&fNumCrates,        2);     // Total=60
    414     fin.read((char*)&fNumPixInCrate,    2);     // Total=62
    415     fin.read((char*)&fNumSamplesLoGain, 2);     // Total=64
    416     fin.read((char*)&fNumSamplesHiGain, 2);     // Total=66
     443
     444    fin.read((char*)&fNumCrates,        2); // MUX: number of channels
     445    fin.read((char*)&fNumPixInCrate,    2); // MUX: number of pix in channel
     446    fin.read((char*)&fNumSamplesLoGain, 2); // MUX: dummy (must be 0 for MUX data)
     447    fin.read((char*)&fNumSamplesHiGain, 2); // MUX: Number of samples per pixel
    417448
    418449    // ----- Number of events -----
    419     fin.read((char*)&fNumEvents,        4);     // Total=70
     450    fin.read((char*)&fNumEvents, 4);     // Total=70
     451
     452    // New in general features: (should they be included in new MAGIC1 formats, too?)
     453    fNumBytesPerSample  = 1;      // 2 for MUX DATA
     454    fFreqSampling       = 300;
     455    fNumSignificantBits = 8;
     456    if (fFormatVersion>7)
     457    {
     458        fin.read((char*)&fNumBytesPerSample,  2);
     459        fin.read((char*)&fFreqSampling,       2); // [MHz], 2000 for MuxFadc
     460        fin.read((char*)&fNumSignificantBits, 1); // nominal resolution [# Bits], 10 for MuxFadc
     461
     462        if (fNumBytesPerSample!=2)
     463        {
     464            *fLog << err << "ERROR - " << fNumBytesPerSample << " bytes per sample are not supported!" << endl;
     465            return kFALSE;
     466        }
     467    }
    420468
    421469    // ----- Start/Stop time -----
     
    429477    // calculate size of array, create it and fill it
    430478    //
    431     Int_t nPixel = fNumCrates*fNumPixInCrate;
     479    const Int_t nPixel = fNumCrates*fNumPixInCrate;
    432480    fPixAssignment->Set(nPixel);
    433481
    434482    // ----- Pixel Assignement -----
    435483    fin.read((char*)fPixAssignment->GetArray(), nPixel*2);
    436     fin.read((char*)&dummy, 16);
     484
     485    if (fFormatVersion<7)
     486        fin.read((char*)&dummy, 16);
    437487
    438488    return FixAssignment();
     
    488538    if (fFormatVersion>5)
    489539        *fLog << "Telescope:    " << fTelescopeNumber << endl;
     540    if (fFormatVersion>7)
     541        *fLog << "FadcType:     " << fFadcType << endl;
    490542    *fLog << "RunNumber:    " << fRunNumber << " (Type=" << GetRunTypeStr() << ")" << endl;
    491543    *fLog << "ProjectName: '" << fProjectName << "'" << endl;
     
    498550    *fLog << "Crates:       " << fNumCrates << " x " << fNumPixInCrate << " Pixel/Crate = " << fNumCrates*fNumPixInCrate << " Pixel/Evt" << endl;
    499551    *fLog << "Num Pixels:   " << GetNumNormalPixels() << " (normal) + " << GetNumSpecialPixels() << " (special) = " << GetNumConnectedPixels() << " (total)" << endl;
    500     *fLog << "Samples:      " << fNumSamplesHiGain << "/" << fNumSamplesLoGain << " (hi/lo) = " << (fNumSamplesLoGain+fNumSamplesHiGain) * fNumCrates * fNumPixInCrate /1024 << "kiB/Evt" << endl;
     552    if (fFormatVersion>6)
     553        *fLog << "Sampling:     " << fFreqSampling << "MHz with " << (int)fNumSignificantBits << " significant bits" << endl;
     554    *fLog << "Samples:      " << fNumSamplesHiGain << "/" << fNumSamplesLoGain << " (hi/lo) * " << fNumBytesPerSample << "B/sample = " << (fNumSamplesLoGain+fNumSamplesHiGain) * fNumCrates * fNumPixInCrate * fNumBytesPerSample/1000 << "kB/Evt" << endl;
    501555    *fLog << "Evt Counter:  " << fNumEvents << endl;
    502556
     
    640694    case 6:
    641695        return 84+fNumCrates*fNumPixInCrate*2+16 +4+78+58+60+8;
     696    case 7:
     697        return 84+fNumCrates*fNumPixInCrate*2+16 +4+78+58+60+8 +3-16;
    642698    }
    643699    return 0;
  • trunk/MagicSoft/Mars/mraw/MRawRunHeader.h

    r8342 r8344  
    4141    UShort_t  fFormatVersion;
    4242    UShort_t  fSoftVersion;
     43    UShort_t  fFadcType;
    4344    UShort_t  fCameraVersion;
    4445    UShort_t  fTelescopeNumber;
     
    5455    UShort_t  fNumSamplesLoGain;
    5556    UShort_t  fNumSamplesHiGain;
     57    UShort_t  fNumBytesPerSample;
    5658    UInt_t    fNumEvents;
     59    UShort_t  fFreqSampling;
     60    Byte_t    fNumSignificantBits;
    5761    MTime     fRunStart;
    5862    MTime     fRunStop;
     
    125129    Bool_t ReadEvt(istream& fin);
    126130
    127     ClassDef(MRawRunHeader, 5)  // storage container for general info
     131    ClassDef(MRawRunHeader, 6)  // storage container for general info
    128132};
    129133#endif
Note: See TracChangeset for help on using the changeset viewer.