Changeset 8344
- Timestamp:
- 03/01/07 21:31:23 (18 years ago)
- Location:
- trunk/MagicSoft/Mars/mraw
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mraw/MRawCrateData.cc
r4601 r8344 56 56 void MRawCrateData::ReadEvt(istream& fin, UShort_t ver) 57 57 { 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 } 63 99 } 64 100 -
trunk/MagicSoft/Mars/mraw/MRawEvtHeader.cc
r6014 r8344 202 202 *fLog << "NumLvl2=" << fNumTrigLvl2 << " "; 203 203 *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; 206 206 207 207 *fLog << "Type="; … … 358 358 fin.read((char*)fTrigPattern, 8); // Total=28 359 359 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 } 370 379 371 380 return fin.eof() ? kFALSE : rc; -
trunk/MagicSoft/Mars/mraw/MRawRunHeader.cc
r8326 r8344 33 33 // ======================= 34 34 // 35 // Format Version 8: 36 // ----------------- 37 // + fNumBytesPerSample; 38 // + fFreqSampling; 39 // + fNumSignificantBits; 40 // * changes in MRawCrateHeader 41 // 42 // Format Version 7: 43 // ----------------- 44 // - unused 45 // 35 46 // Format Version 6: 36 47 // ----------------- … … 62 73 // MRawRunHeader CLASS VERSION 63 74 // =========================== 75 // 76 // Format Version 6: 77 // ----------------- 78 // - added fNumBytesPerSample; 79 // - added fFreqSampling; 80 // - added fNumSignificantBits; 64 81 // 65 82 // Class Version 5: … … 107 124 108 125 const UShort_t MRawRunHeader::kMagicNumber = 0xc0c0; 109 const Byte_t MRawRunHeader::kMaxFormatVersion = 6;126 const Byte_t MRawRunHeader::kMaxFormatVersion = 8; 110 127 111 128 // -------------------------------------------------------------------------- … … 125 142 fTelescopeNumber=0; 126 143 fCameraVersion=0; 144 fFadcType = 0; 127 145 fRunType=kRTNone; // use 0xffff for invalidation, 0 means: Data run 128 146 fRunNumber=0; … … 363 381 } 364 382 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 365 389 // ----- DAQ software format version ----- 366 390 fin.read((char*)&fSoftVersion, 2); // Total=6 367 391 392 393 fFadcType = 0; 394 if (fFormatVersion>7) 395 fin.read((char*)&fFadcType, 2); 396 368 397 // ----- Camera geometry and telescope number ----- 398 fCameraVersion = 1; 399 fTelescopeNumber = 1; 369 400 if (fFormatVersion>5) 370 401 { … … 372 403 fin.read((char*)&fTelescopeNumber, 2); // (+2) 373 404 } 374 // Maybe we should set fCameraVersion and fTelescopeNumber to 1375 // in case of fFormatVersion<6376 405 377 406 // ----- Run information ----- 378 407 fin.read((char*)&fRunType, 2); // Total=8 408 379 409 fin.read((char*)&fRunNumber, 4); // Total=12 380 410 fin.read((char*)&fProjectName, fFormatVersion>5?100:22); // Total=34 (+78) … … 411 441 412 442 // ----- 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 417 448 418 449 // ----- 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 } 420 468 421 469 // ----- Start/Stop time ----- … … 429 477 // calculate size of array, create it and fill it 430 478 // 431 Int_t nPixel = fNumCrates*fNumPixInCrate;479 const Int_t nPixel = fNumCrates*fNumPixInCrate; 432 480 fPixAssignment->Set(nPixel); 433 481 434 482 // ----- Pixel Assignement ----- 435 483 fin.read((char*)fPixAssignment->GetArray(), nPixel*2); 436 fin.read((char*)&dummy, 16); 484 485 if (fFormatVersion<7) 486 fin.read((char*)&dummy, 16); 437 487 438 488 return FixAssignment(); … … 488 538 if (fFormatVersion>5) 489 539 *fLog << "Telescope: " << fTelescopeNumber << endl; 540 if (fFormatVersion>7) 541 *fLog << "FadcType: " << fFadcType << endl; 490 542 *fLog << "RunNumber: " << fRunNumber << " (Type=" << GetRunTypeStr() << ")" << endl; 491 543 *fLog << "ProjectName: '" << fProjectName << "'" << endl; … … 498 550 *fLog << "Crates: " << fNumCrates << " x " << fNumPixInCrate << " Pixel/Crate = " << fNumCrates*fNumPixInCrate << " Pixel/Evt" << endl; 499 551 *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; 501 555 *fLog << "Evt Counter: " << fNumEvents << endl; 502 556 … … 640 694 case 6: 641 695 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; 642 698 } 643 699 return 0; -
trunk/MagicSoft/Mars/mraw/MRawRunHeader.h
r8342 r8344 41 41 UShort_t fFormatVersion; 42 42 UShort_t fSoftVersion; 43 UShort_t fFadcType; 43 44 UShort_t fCameraVersion; 44 45 UShort_t fTelescopeNumber; … … 54 55 UShort_t fNumSamplesLoGain; 55 56 UShort_t fNumSamplesHiGain; 57 UShort_t fNumBytesPerSample; 56 58 UInt_t fNumEvents; 59 UShort_t fFreqSampling; 60 Byte_t fNumSignificantBits; 57 61 MTime fRunStart; 58 62 MTime fRunStop; … … 125 129 Bool_t ReadEvt(istream& fin); 126 130 127 ClassDef(MRawRunHeader, 5) // storage container for general info131 ClassDef(MRawRunHeader, 6) // storage container for general info 128 132 }; 129 133 #endif
Note:
See TracChangeset
for help on using the changeset viewer.