- Timestamp:
- 06/12/08 17:56:54 (16 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r8942 r8946 22 22 2008/06/12 Thomas Bretz 23 23 24 * mraw/MRawCrateData.[h,cc], mraw/MRawEvtHeader.[h,cc], 25 mraw/MRawRunHeader.[h,cc]: 26 - renamed reading the old format to ReadEvtOld 27 - implemented reading format>10 28 - added the header size as new argument to ReadEvt 29 30 * mraw/MRawEvtHeader.cc: 31 - made the argument to DecodeTime const 32 - fixed the return value in ReadEvtOld. kCONTINUE could 33 never be returned 34 35 * mraw/MRawRead.cc: 36 - gives header size for format>10 to ReadEvt 37 - if EvtHeader could not be read correctly return kFALSE 38 - let MRawCrateData::ReadEvt check end-of-file 39 40 * merpp.cc: 41 - improved explanation for -ff option 42 43 * readdaq.cc: 44 - added -ff option 45 - added an option to call MReadRawFiles::SetForceMode 46 47 * mbase/MTime.[h,cc]: 48 - added new member function SetBinary to easy processing 49 of the time from the new run header 50 51 * mhflux/MHEffectiveOnTime.cc: 52 - for the integral (Nm) we have to count also events in under and 53 overflow bins 54 55 * mjobs/MJCalibrateSignal.cc, mjobs/MJCalibration.cc, 56 mjobs/MJPedestal.cc: 57 - call MRawFileRead::SetForceMode to get the (corrected) 58 old behaviour back (not to stop if an event time is 59 broken but to skip the event) 60 61 * mraw/MRawRunHeader.[h,cc]: 62 - the number of events in format version V9 seems to be 63 to high by one. We correct for this. 64 - added new data members for the header sizes 65 - new data member for the file number 66 - increased cize of fSourceEpochChar 67 - consequently increased class version number by 1 68 24 69 * datacenter/macros/plotdb.C: 25 70 - improved some titles … … 85 130 This ensures that no task can crash due to this 86 131 when processing MCs 87 88 * mraw/MRawRunHeader.cc:89 - the number of events in format version V9 seems to be90 to high by one. We correct for this.91 132 92 133 * msql/MSQLMagic.[h,cc]: -
trunk/MagicSoft/Mars/NEWS
r8942 r8946 70 70 71 71 * Implemented cc file version 2008-20-02/0 72 73 * Implemented raw data format 11 (the most important change, except 74 from plenty of changes in the format definition, is the addition 75 of the file-number in the header) If nobody makes a mistake this 76 format should have the advantage that it is by definition forward 77 compatible, so old programs will be able to read newer formats. 72 78 73 79 * Added Pyrometer information to output (stored in a new Tree -
trunk/MagicSoft/Mars/mbase/MTime.cc
r8907 r8946 827 827 } 828 828 829 Bool_t MTime::SetBinary(const UInt_t t[6]) 830 { 831 return Set(t[0], t[1], t[2], t[3], t[4], t[5], 0); 832 } 833 829 834 istream &MTime::ReadBinary(istream &fin) 830 835 { -
trunk/MagicSoft/Mars/mbase/MTime.h
r8907 r8946 98 98 void SetCorsikaTime(Float_t time); 99 99 Bool_t SetStringFmt(const char *time, const char *fmt, const char *loc=0); 100 Bool_t SetBinary(const UInt_t t[6]); 100 101 Bool_t UpdMagicTime(Byte_t h, Byte_t m, Byte_t s, UInt_t ns); 101 102 Bool_t SetMjd(UInt_t mjd, ULong_t ms, UInt_t ns=0); -
trunk/MagicSoft/Mars/merpp.cc
r8933 r8946 79 79 gLog << " -u, --update Update an existing file." << endl << endl; 80 80 gLog << " Raw Data Options:" << endl; 81 gLog << " -ff Force merpp to ignore broken events " << endl;81 gLog << " -ff Force merpp to ignore broken events and don't stop" << endl; 82 82 gLog << " --interleave=# Process only each i-th event [default=1]" << endl << endl; 83 83 // gLog << " --sql=mysql://user:password@url Insert run into database" << endl << endl; -
trunk/MagicSoft/Mars/mhflux/MHEffectiveOnTime.cc
r8932 r8946 501 501 Bool_t MHEffectiveOnTime::FitH(TH1D *h, Double_t *res, Bool_t paint) const 502 502 { 503 const Double_t Nm = h->Integral(); 503 // Count also events in under-/overflowbins 504 const Double_t Nm = h->Integral(0, h->GetNbinsX()+1); 504 505 505 506 // FIXME: Do fit only if contents of bin has changed -
trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc
r8938 r8946 369 369 370 370 MRawFileRead rawread(NULL); 371 reawread.SetForceMode(); // Ignore broken time-stamps 371 372 372 373 MRead *read = fSequence.IsMonteCarlo() ? (MRead*)&readmc : (MRead*)&rawread; -
trunk/MagicSoft/Mars/mjobs/MJCalibration.cc
r8898 r8946 1693 1693 MReadMarsFile read("Events"); 1694 1694 MRawFileRead rawread(NULL); 1695 reawread.SetForceMode(); // Ignore broken time-stamps 1695 1696 1696 1697 if (!fSequence.IsMonteCarlo()) -
trunk/MagicSoft/Mars/mjobs/MJPedestal.cc
r8898 r8946 1015 1015 MReadMarsFile read("Events"); 1016 1016 MRawFileRead rawread(NULL); 1017 reawread.SetForceMode(); // Ignore broken time-stamps 1017 1018 1018 1019 MDirIter iter; -
trunk/MagicSoft/Mars/mraw/MRawRunHeader.cc
r8941 r8946 18 18 ! Author(s): Thomas Bretz 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2000-200 720 ! Copyright: MAGIC Software Development, 2000-2008 21 21 ! 22 22 ! … … 32 32 // RAW DATA FORMAT VERSION 33 33 // ======================= 34 // 35 // Format Version 11: 36 // ----------------- 37 // * all variables got four bytes 38 // * header sizes allow to make the format backward compatible 39 // + fHeaderSizeRun 40 // + fHeaderSizeEvt 41 // + fHeaderSizeCrate 42 // + fFileNumber 43 // + fNumSamplesRemovedHead 44 // + fNumSamplesRemovedTail 45 // 46 // Format Version 10: 47 // ----------------- 48 // ? 34 49 // 35 50 // Format Version 9: … … 81 96 // MRawRunHeader CLASS VERSION 82 97 // =========================== 98 // 99 // Format Version 10: 100 // ----------------- 101 // - added fHeaderSizeRun 102 // - added fHeaderSizeEvt 103 // - added fHeaderSizeCrate 104 // - added fFileNumber 105 // - increased fSourceEpochChar 83 106 // 84 107 // Format Version 7: … … 127 150 #include <iomanip> 128 151 152 #include <TArrayC.h> 153 129 154 #include "MLog.h" 130 155 #include "MLogManip.h" … … 137 162 138 163 const UShort_t MRawRunHeader::kMagicNumber = 0xc0c0; 139 const Byte_t MRawRunHeader::kMaxFormatVersion = 9;164 const Byte_t MRawRunHeader::kMaxFormatVersion = 11; 140 165 141 166 // -------------------------------------------------------------------------- … … 162 187 fRunType=kRTNone; // use 0xffff for invalidation, 0 means: Data run 163 188 fRunNumber=0; 189 fFileNumber=0; 164 190 memset(fProjectName, 0, 101); 165 191 memset(fSourceName, 0, 81); … … 329 355 // "corrected" also in the signal. Hence signal swapped since 99354 330 356 // 331 // --------------------------------------------------------------------------332 333 357 Bool_t MRawRunHeader::FixAssignment() 334 358 { … … 374 398 // -------------------------------------------------------------------------- 375 399 // 376 // Read in one run header from the binary file 377 // 378 Bool_t MRawRunHeader::ReadEvt(istream& fin) 379 { 380 // 381 // read one RUN HEADER from the input stream 382 // 383 fMagicNumber = 0; 384 385 fin.read((char*)&fMagicNumber, 2); // Total=2 386 387 // 388 // check whether the the file has the right file type or not 389 // 390 if (fMagicNumber != kMagicNumber && fMagicNumber != kMagicNumber+1) 391 { 392 *fLog << err << "ERROR - Wrong Magic Number (0x" << hex << fMagicNumber << "): Not a Magic File!" << endl; 393 return kFALSE; 394 } 395 396 if (fMagicNumber == kMagicNumber+1) 397 *fLog << warn << "WARNING - This file maybe broken (0xc0c1) - DAQ didn't close it correctly!" << endl; 398 399 Byte_t dummy[16]; 400 401 // ----- File format version ----- 402 fin.read((char*)&fFormatVersion, 2); // Total=4 403 if (fFormatVersion>kMaxFormatVersion) 404 { 405 *fLog << err << "ERROR - File format V" << fFormatVersion << " not implemented!" << endl; 406 return kFALSE; 407 } 408 400 // Reading function to read/interpret the file formats 1-10 401 // 402 Bool_t MRawRunHeader::ReadEvtOld(istream& fin) 403 { 409 404 if (fFormatVersion==7) 410 405 { … … 477 472 fin.read((char*)&fNumSamplesHiGain, 2); // MUX: Number of samples per pixel 478 473 474 char dummy[16]; 479 475 if (fFormatVersion>8) 480 fin.read( (char*)dummy, 4); // 2xU16 (NumSamplesRemovedHead and NumSamplesRemovedTail)476 fin.read(dummy, 4); // 2xU16 (NumSamplesRemovedHead and NumSamplesRemovedTail) 481 477 482 478 // ----- Number of events ----- … … 526 522 527 523 if (fFormatVersion<7) 528 fin.read((char*)&dummy, 16); 524 fin.read(dummy, 16); 525 526 return FixAssignment(); 527 } 528 529 // -------------------------------------------------------------------------- 530 // 531 // Read in one run header from the binary file 532 // 533 Bool_t MRawRunHeader::ReadEvt(istream& fin) 534 { 535 // 536 // read one RUN HEADER from the input stream 537 // 538 fMagicNumber = 0; 539 540 fin.read((char*)&fMagicNumber, 2); // Total=2 541 542 // 543 // check whether the the file has the right file type or not 544 // 545 if (fMagicNumber != kMagicNumber && fMagicNumber != kMagicNumber+1) 546 { 547 *fLog << err << "ERROR - Wrong Magic Number (0x" << hex << fMagicNumber << "): Not a Magic File!" << endl; 548 return kFALSE; 549 } 550 551 if (fMagicNumber == kMagicNumber+1) 552 *fLog << warn << "WARNING - This file maybe broken (0xc0c1) - DAQ didn't close it correctly!" << endl; 553 554 // ----- File format version ----- 555 fin.read((char*)&fFormatVersion, 2); // Total=4 556 if (fFormatVersion==10 || fFormatVersion>kMaxFormatVersion) 557 { 558 *fLog << err << "ERROR - File format V" << fFormatVersion << " not implemented!" << endl; 559 return kFALSE; 560 } 561 562 // ----- Process old file formats ----- 563 if (fFormatVersion<10) 564 return ReadEvtOld(fin); 565 566 // ----- Overwrite format version for format 11 ----- 567 fin.read((char*)&fFormatVersion, 4); 568 if (fFormatVersion<11) 569 { 570 *fLog << err << "ERROR - Format Version <11." << endl; 571 return kFALSE; 572 } 573 574 // ----- Read Header by size as written in the header ----- 575 fin.read((char*)&fHeaderSizeRun, 4); 576 if (fHeaderSizeRun<346) 577 { 578 *fLog << err << "ERROR - Event header too small (<388b)." << endl; 579 return kFALSE; 580 } 581 582 TArrayC h(fHeaderSizeRun-12); 583 fin.read(h.GetArray(), h.GetSize()); 584 if (!fin) 585 return kFALSE; 586 587 // ----- convert ----- 588 const Byte_t *Char = reinterpret_cast<Byte_t* >(h.GetArray()); 589 const UInt_t *Int = reinterpret_cast<UInt_t* >(h.GetArray()); 590 //const Float_t *Float = reinterpret_cast<Float_t*>(h.GetArray()); 591 592 // ----- Start interpretation ----- 593 594 fHeaderSizeEvt = Int[0]; 595 fHeaderSizeCrate = Int[1]; 596 fSoftVersion = Int[2]; 597 fFadcType = Int[3]; 598 fCameraVersion = Int[4]; 599 fTelescopeNumber = Int[5]; 600 fRunType = Int[6]; 601 fRunNumber = Int[7]; 602 fFileNumber = Int[8]; 603 604 memcpy(fProjectName, Char+ 36, 100); // 25 605 memcpy(fSourceName, Char+136, 80); // 20 606 memcpy(fObservationMode, Char+216, 60); // 15 607 608 //F32 fSourceRA = Float[69]; 609 //F32 fSourceDEC = Float[70]; 610 //F32 fTelescopeRA = Float[71]; 611 //F32 fTelescopeDEC = Float[72]; 612 613 memcpy(fSourceEpochChar, Char+232, 4); 614 615 fSourceEpochDate = Int[74]; 616 fNumCrates = Int[75]; 617 fNumPixInCrate = Int[76]; 618 fNumSamplesHiGain = Int[77]; 619 fNumSamplesLoGain = 0; 620 621 //fNumSamplesRemovedHead = Int[78]; 622 //fNumSamplesRemovedTail = Int[79]; 623 624 fNumEvents = Int[80]; 625 fNumEventsRead = Int[81]; 626 fNumBytesPerSample = Int[82]; 627 fSamplingFrequency = Int[83]; 628 fFadcResolution = Int[84]; 629 630 fRunStart.SetBinary(Int+85); 631 fRunStop.SetBinary(Int+91); 632 633 // ----- 388 bytes so far ----- 634 635 const UInt_t n = fNumCrates*fNumPixInCrate; 636 if (fHeaderSizeRun<388+n*4) 637 { 638 *fLog << err << "ERROR - Event header too small to contain pix assignment." << endl; 639 return kFALSE; 640 } 641 642 // ----- Pixel Assignment ----- 643 fPixAssignment->Set(n); 644 645 for (UInt_t i=0; i<n; i++) 646 (*fPixAssignment)[i] = Int[97+i]; 529 647 530 648 return FixAssignment(); … … 578 696 *fLog << "Camera=" << fCameraVersion; 579 697 *fLog << endl; 698 if (fFormatVersion>10) 699 *fLog << "Header sizes: " << fHeaderSizeRun << "b (run), " << fHeaderSizeEvt << "b (evt), " << fHeaderSizeCrate << "b (crate)" << endl; 580 700 if (fFormatVersion>5) 581 701 *fLog << "Telescope: " << fTelescopeNumber << endl; -
trunk/MagicSoft/Mars/mraw/MRawRunHeader.h
r8892 r8946 39 39 /* ---- Run Header Informations ---- */ 40 40 UShort_t fMagicNumber; // File type identifier 41 42 UInt_t fHeaderSizeRun; // Size of run header 43 UInt_t fHeaderSizeEvt; // Size of evt header 44 UInt_t fHeaderSizeCrate; // Size of crate header 45 41 46 UShort_t fFormatVersion; // File format version 42 47 UShort_t fSoftVersion; // DAQ software version … … 46 51 UShort_t fRunType; // Run Type 47 52 UInt_t fRunNumber; // Run number 53 UInt_t fFileNumber; // File number 48 54 Char_t fProjectName[101]; // Project name 49 55 Char_t fSourceName[81]; // Source name 50 56 Char_t fObservationMode[61]; // observation mode 51 Char_t fSourceEpochChar[ 2]; // epoch char of the source57 Char_t fSourceEpochChar[4]; // epoch char of the source 52 58 UShort_t fSourceEpochDate; // epoch date of the source 53 59 UShort_t fNumCrates; // number of electronic boards … … 66 72 Bool_t SwapAssignment(Short_t id0, Short_t id1); 67 73 Bool_t FixAssignment(); 74 Bool_t ReadEvtOld(istream& fin); 68 75 69 76 public: … … 90 97 // This is to get the numbers... 91 98 UShort_t GetMagicNumber() const { return fMagicNumber; } 99 UInt_t GetHeaderSizeEvt() const { return fHeaderSizeEvt; } 100 UInt_t GetHeaderSizeCrate() const { return fHeaderSizeCrate; } 92 101 UShort_t GetFormatVersion() const { return fFormatVersion; } 93 102 UShort_t GetSoftVersion() const { return fSoftVersion; } … … 136 145 Bool_t ReadEvt(istream& fin); 137 146 138 ClassDef(MRawRunHeader, 9) // storage container for general info147 ClassDef(MRawRunHeader, 10) // storage container for general info 139 148 }; 140 149 #endif -
trunk/MagicSoft/Mars/readdaq.cc
r8088 r8946 53 53 gLog << " -d1: print data in decimal values" << endl; 54 54 gLog << " -c1: print MRawCrateArray data" << endl; 55 gLog << " -f: force reading of runheader" << endl; 55 gLog << " -ff: force reading of broken runheader" << endl; 56 gLog << " -f: force reading of files with problems" << endl; 56 57 gLog << " -?, -h, --help: This help" << endl << endl; 57 58 } … … 81 82 // Set verbosity to highest level. 82 83 // 83 const bool kDecimal = arg.HasOption("-d") && arg.GetIntAndRemove("-d")==1; 84 const bool kPrintArray = arg.HasOption("-c") && arg.GetIntAndRemove("-c")==1; 85 const bool kForce = arg.HasOnlyAndRemove("-f"); 84 const Bool_t kDecimal = arg.HasOption("-d") && arg.GetIntAndRemove("-d")==1; 85 const Bool_t kPrintArray = arg.HasOption("-c") && arg.GetIntAndRemove("-c")==1; 86 const Bool_t kForce = arg.HasOnlyAndRemove("-ff"); 87 const Bool_t kForceMode = arg.HasOnlyAndRemove("-f"); 86 88 87 89 // … … 160 162 MRawFileRead read(kNamein); 161 163 read.SetForce(kForce); 164 read.SetForceMode(kForceMode); 162 165 tasks.AddToList(&read); 163 166
Note:
See TracChangeset
for help on using the changeset viewer.