Changeset 8966
- Timestamp:
- 06/16/08 23:51:58 (17 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r8965 r8966 20 20 21 21 22 2008/06/1 5Thomas Bretz22 2008/06/17 Thomas Bretz 23 23 24 24 * datacenter/macros/plotdb.C: … … 35 35 - made a sunken border around the canvas 36 36 - SetFrameBorderMode(0) per default 37 38 * mraw/MRawRunHeader.[h,cc]: 39 - added some consistency checks 40 - make the bug fix for the wrong number of events also for 41 V10 and V11 42 - added Getters for RunID and FileID used to idetify 43 the runs more clever than run-number and file-number 37 44 38 45 -
trunk/MagicSoft/Mars/mraw/MRawRunHeader.cc
r8946 r8966 268 268 // -------------------------------------------------------------------------- 269 269 // 270 // Consistency checks. See code for detils. 271 // 272 Bool_t MRawRunHeader::IsConsistent() const 273 { 274 // FIXME: Match first digits of run-number with telescope number 275 276 if (fFormatVersion>10) 277 { 278 if (GetRunID()!=fTelescopeNumber && GetRunID()!=fTelescopeNumber*10U && GetRunID()!=fTelescopeNumber*10U+5U) 279 { 280 *fLog << err << "ERROR - Telscope number " << fTelescopeNumber << " doesn't match the first two digits of the run number " << fRunNumber << "." << endl; 281 return kFALSE; 282 } 283 284 // Old formats can not contain a run number larger 0 285 if (fRunNumber<1000000) 286 { 287 *fLog << err << "ERROR - Run number " << fRunNumber << " smaller than 1000000." << endl; 288 return kFALSE; 289 } 290 } 291 292 // Check for correct number of bytes in data stream 293 if (fFormatVersion>7 && fNumBytesPerSample!=2) 294 { 295 *fLog << err << "ERROR - " << fNumBytesPerSample << " bytes per sample are not supported!" << endl; 296 return kFALSE; 297 } 298 299 // If we have a vlid stop time check its consistency with the start time 300 if (fRunStop!=MTime() && fRunStop<fRunStart) 301 { 302 *fLog << err << "ERROR - Stop time smaller than start time." << endl; 303 return kFALSE; 304 } 305 306 // No file numbers larger than 999 allowed in general 307 if (fFileNumber>999) 308 { 309 *fLog << err << "ERROR - File number " << fFileNumber << " larger than 999." << endl; 310 return kFALSE; 311 } 312 313 // Old formats can not contain a run number larger 0 314 if (fFormatVersion<11 && fFileNumber>0) 315 { 316 *fLog << err << "ERROR - File number " << fFileNumber << " larger than 0." << endl; 317 return kFALSE; 318 } 319 320 if (fFormatVersion>1) 321 { 322 // For most of the formats the start time must be valid 323 if (fRunStart==MTime()) 324 { 325 *fLog << err << "ERROR - Start time invalid." << endl; 326 return kFALSE; 327 } 328 329 // For most of the formats an invalid stop time cannot happen if file closed 330 if (fMagicNumber==kMagicNumber && fRunStop==MTime()) 331 { 332 *fLog << err << "ERROR - File closed but stop time invalid." << endl; 333 return kFALSE; 334 } 335 } 336 return kTRUE; 337 } 338 339 // -------------------------------------------------------------------------- 340 // 270 341 // This implements a fix of the pixel assignment before 25.9.2005 271 342 // … … 398 469 // -------------------------------------------------------------------------- 399 470 // 471 // Fixes to fix bugs in the run header 472 // 473 Bool_t MRawRunHeader::Fixes() 474 { 475 if (fFormatVersion>8) 476 { 477 fNumEvents--; 478 fNumEventsRead--; 479 *fLog << inf << "Format >V8: Stored number of events decreased by 1." << endl; 480 } 481 482 return FixAssignment(); 483 } 484 485 // -------------------------------------------------------------------------- 486 // 400 487 // Reading function to read/interpret the file formats 1-10 401 488 // … … 479 566 fin.read((char*)&fNumEvents, 4); // Total=70 480 567 481 if (fFormatVersion>8)482 {483 fin.read((char*)&fNumEventsRead, 4); // Total=70484 fNumEvents--;485 fNumEventsRead--;486 *fLog << inf << "Format V9: Stored number of events decreased by 1." << endl;487 }488 489 568 // New in general features: (should they be included in new MAGIC1 formats, too?) 490 569 fNumBytesPerSample = 1; // 2 for MUX DATA … … 497 576 fin.read((char*)&fSamplingFrequency, 2); // [MHz], 2000 for MuxFadc 498 577 fin.read((char*)&fFadcResolution, 1); // nominal resolution [# Bits], 10 for MuxFadc 499 500 if (fNumBytesPerSample!=2)501 {502 *fLog << err << "ERROR - " << fNumBytesPerSample << " bytes per sample are not supported!" << endl;503 return kFALSE;504 }505 578 } 506 579 … … 511 584 fRunStop.ReadBinary(fin); // Total += 7 512 585 } 586 587 // ----- Consistency checks ----- 588 if (!IsConsistent()) 589 return kFALSE; 513 590 514 591 // … … 524 601 fin.read(dummy, 16); 525 602 526 return Fix Assignment();603 return Fixes(); 527 604 } 528 605 … … 631 708 fRunStop.SetBinary(Int+91); 632 709 710 // ----- Consistency checks ----- 711 if (!IsConsistent()) 712 return kFALSE; 713 633 714 // ----- 388 bytes so far ----- 634 715 … … 646 727 (*fPixAssignment)[i] = Int[97+i]; 647 728 648 return Fix Assignment();729 return Fixes(); 649 730 } 650 731 -
trunk/MagicSoft/Mars/mraw/MRawRunHeader.h
r8946 r8966 72 72 Bool_t SwapAssignment(Short_t id0, Short_t id1); 73 73 Bool_t FixAssignment(); 74 Bool_t Fixes(); 75 Bool_t IsConsistent() const; 76 74 77 Bool_t ReadEvtOld(istream& fin); 75 78 … … 102 105 UShort_t GetSoftVersion() const { return fSoftVersion; } 103 106 UInt_t GetRunNumber() const { return fRunNumber; } 107 UInt_t GetFileNumber() const { return fFileNumber; } 108 UInt_t GetRunID() const { return (fRunNumber/1000000)%100; } 109 UInt_t GetFileID() const { return fRunNumber>1000000?(fRunNumber%1000000)*1000+(fFileNumber%1000):fRunNumber; } 110 UShort_t GetTelescopeNumber() const { return fRunType; } 104 111 UShort_t GetRunType() const { return fRunType; } 105 112 const Char_t *GetRunTypeStr() const;
Note:
See TracChangeset
for help on using the changeset viewer.