Changeset 8584 for trunk/MagicSoft/Mars
- Timestamp:
- 06/19/07 12:01:35 (17 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r8583 r8584 29 29 30 30 * mcalib/MCalibrationRelTimeCalc.cc: 31 - replaced kDeviatingTimeResolution by new kDeviatingRelTimeResolution 31 - replaced kDeviatingTimeResolution by new 32 kDeviatingRelTimeResolution 32 33 33 34 * mhcalib/MHCalibrationPulseTimeCam.cc: … … 51 52 maximum value to fit the FADC range 52 53 53 * mraw/MRawRunHeader.h: 54 - added a function returnung the maximum value of the FADC 54 * msignal/MExtractor.cc: 55 - removed the reset of the saturation limit. Maybe the user 56 wants to switch off saturation detection. 57 - removed a lot of old code (in comments) 58 59 * msignal/MExtractTimeAndCharge.cc: 60 - scale the saturation limit from the maximum of 61 the FADC range to 256 62 - use the maximum value of the raw position as the input for 63 half the signal height in GetSaturationTime again 64 - calculate maxposhi only if needed 65 - calculate maxrawlo only if needed 66 67 * mraw/MRawRunHeader.[h,cc]: 68 - implemented new format version 9 69 - increased version number by one 70 - added some comments in the header 71 - added a function returning the maximum value of the FADC 55 72 - changed the GetScale from a calculation to a switch 56 73 (faster and easier to understand) 57 58 * msignal/MExtractor.cc:59 - get the maximum in case of no lo-gains from the run-header60 74 61 75 -
trunk/MagicSoft/Mars/NEWS
r8582 r8584 11 11 resource file (to check it open it in the TBrowser and choose Print() 12 12 from the context menu) 13 14 - merpp: Merpp can read file format version 9 now. Please realize 15 that for file format version 9 the extraction range is different 16 and must be set to 0/49 instead of 15/64 in callisto_mux.rc until 17 the first and last 15 slices have been removed from all MUX data. 13 18 14 19 - callisto: improved calculation of spline coefficients a lot. This -
trunk/MagicSoft/Mars/mraw/MRawRunHeader.cc
r8434 r8584 33 33 // ======================= 34 34 // 35 // Format Version 9: 36 // ----------------- 37 // + fNumEventsRead; 38 // 35 39 // Format Version 8: 36 40 // ----------------- … … 73 77 // MRawRunHeader CLASS VERSION 74 78 // =========================== 79 // 80 // Format Version 7: 81 // ----------------- 82 // - added fNumEventsRead; 75 83 // 76 84 // Format Version 6: … … 108 116 // 109 117 //////////////////////////////////////////////////////////////////////////// 110 111 118 #include "MRawRunHeader.h" 112 119 … … 124 131 125 132 const UShort_t MRawRunHeader::kMagicNumber = 0xc0c0; 126 const Byte_t MRawRunHeader::kMaxFormatVersion = 8;133 const Byte_t MRawRunHeader::kMaxFormatVersion = 9; 127 134 128 135 // -------------------------------------------------------------------------- … … 430 437 431 438 // ----- Source position ----- 439 fin.seekg(fFormatVersion>5 ? 16 : 8, ios::cur); 440 /* 432 441 if (fFormatVersion>5) 433 442 { 434 fin.read((char*)dummy, 4); // F32 SourceRA; Total=48 435 fin.read((char*)dummy, 4); // F32 SourceDEC; Total=52 436 } 443 fin.read((char*)&fSourceRa, 4); // F32 SourceRA; Total=48 444 fin.read((char*)&fSourceDec, 4); // F32 SourceDEC; Total=52 445 } 446 fin.read((char*)&fTelescopeRa, 4); // F32 TelescopeRA; (+4) 447 fin.read((char*)&fTelescopeDec, 4); // F32 TelescopeDEC; (+4) 448 */ 449 437 450 // Maybe we should set these to something 438 451 // in case of fFormatVersion<6 439 fin.read((char*)dummy, 4); // F32 TelescopeRA; (+4)440 fin.read((char*)dummy, 4); // F32 TelescopeDEC; (+4)441 452 fin.read((char*)&fSourceEpochChar, 2); // Total=56 442 453 fin.read((char*)&fSourceEpochDate, 2); // Total=58 … … 446 457 { 447 458 UShort_t y, m, d; 448 fin. read((char*)dummy, 4);// Former fMJD[4],459 fin.seekg(4, ios::cur); // Former fMJD[4], 449 460 fin.read((char*)&y, 2); // Former fDateYear[2] 450 461 fin.read((char*)&m, 2); // Former fDateMonth[2] … … 460 471 fin.read((char*)&fNumSamplesHiGain, 2); // MUX: Number of samples per pixel 461 472 473 if (fFormatVersion>8) 474 fin.read((char*)dummy, 4); // 2xU16 (NumSamplesRemovedHead and NumSamplesRemovedTail) 475 462 476 // ----- Number of events ----- 463 477 fin.read((char*)&fNumEvents, 4); // Total=70 478 479 if (fFormatVersion>8) 480 fin.read((char*)&fNumEventsRead, 4); // Total=70 464 481 465 482 // New in general features: (should they be included in new MAGIC1 formats, too?) … … 566 583 *fLog << "Sampling: " << fFreqSampling << "MHz with " << (int)fNumSignificantBits << " significant bits" << endl; 567 584 *fLog << "Samples: " << fNumSamplesHiGain << "/" << fNumSamplesLoGain << " (hi/lo) * " << fNumBytesPerSample << "B/sample = " << (fNumSamplesLoGain+fNumSamplesHiGain) * fNumCrates * fNumPixInCrate * fNumBytesPerSample/1000 << "kB/Evt" << endl; 568 *fLog << "Evt Counter: " << fNumEvents << endl; 585 *fLog << "Evt Counter: " << fNumEvents; 586 if (fFormatVersion>8) 587 *fLog << " (read=" << fNumEventsRead << ")"; 588 *fLog << endl; 569 589 570 590 if (TString(t).Contains("header", TString::kIgnoreCase)) -
trunk/MagicSoft/Mars/mraw/MRawRunHeader.h
r8582 r8584 38 38 private: 39 39 /* ---- Run Header Informations ---- */ 40 UShort_t fMagicNumber; 41 UShort_t fFormatVersion; 42 UShort_t fSoftVersion; 43 UShort_t fFadcType; 44 UShort_t fCameraVersion; 45 UShort_t fTelescopeNumber; 46 UShort_t fRunType; 47 UInt_t fRunNumber; 48 Char_t fProjectName[101];//23]; 49 Char_t fSourceName[81]; //13]; 50 Char_t fObservationMode[61]; 51 Char_t fSourceEpochChar[2]; 52 UShort_t fSourceEpochDate; 53 UShort_t fNumCrates; 54 UShort_t fNumPixInCrate; 55 UShort_t fNumSamplesLoGain; 56 UShort_t fNumSamplesHiGain; 57 UShort_t fNumBytesPerSample; 58 UInt_t fNumEvents; 59 UShort_t fFreqSampling; 60 Byte_t fNumSignificantBits; 61 MTime fRunStart; 62 MTime fRunStop; 63 MArrayS *fPixAssignment; 40 UShort_t fMagicNumber; // File type identifier 41 UShort_t fFormatVersion; // File format version 42 UShort_t fSoftVersion; // DAQ software version 43 UShort_t fFadcType; // FADC type (0=Siegen, 1=MUX) 44 UShort_t fCameraVersion; // Camera Version (1=MAGIC I) 45 UShort_t fTelescopeNumber; // Telescope number (1=Magic I) 46 UShort_t fRunType; // Run Type 47 UInt_t fRunNumber; // Run number 48 Char_t fProjectName[101]; // Project name 49 Char_t fSourceName[81]; // Source name 50 Char_t fObservationMode[61]; // observation mode 51 Char_t fSourceEpochChar[2]; // epoch char of the source 52 UShort_t fSourceEpochDate; // epoch date of the source 53 UShort_t fNumCrates; // number of electronic boards 54 UShort_t fNumPixInCrate; // number of pixels in crate 55 UShort_t fNumSamplesLoGain; // number of logain samples stored 56 UShort_t fNumSamplesHiGain; // number of higain samples stored 57 UShort_t fNumBytesPerSample; // number of bytes per sample 58 UInt_t fNumEvents; // number of events stored 59 UInt_t fNumEventsRead; // number of events read by the electronics 60 UShort_t fFreqSampling; // Sampling Frequency [MHz] 61 Byte_t fNumSignificantBits; // number of significant bits 62 MTime fRunStart; // time of run start 63 MTime fRunStop; // time of run stop 64 MArrayS *fPixAssignment; //-> pixel assignment table 64 65 65 66 Bool_t SwapAssignment(Short_t id0, Short_t id1); … … 106 107 UShort_t GetNumBytesPerSample() const { return fNumBytesPerSample; } 107 108 UInt_t GetNumEvents() const { return fNumEvents; } 109 UInt_t GetNumEventsRead() const { return fNumEventsRead; } 108 110 UShort_t GetFreqSampling() const { return fFreqSampling; } 109 111 const MTime &GetRunStart() const { return fRunStart; } … … 133 135 Bool_t ReadEvt(istream& fin); 134 136 135 ClassDef(MRawRunHeader, 6) // storage container for general info137 ClassDef(MRawRunHeader, 7) // storage container for general info 136 138 }; 137 139 #endif -
trunk/MagicSoft/Mars/msignal/MExtractTimeAndCharge.cc
r8519 r8584 1 1 /* ======================================================================== *\ 2 ! $Name: not supported by cvs2svn $:$Id: MExtractTimeAndCharge.cc,v 1.6 5 2007-05-16 13:56:17tbretz Exp $2 ! $Name: not supported by cvs2svn $:$Id: MExtractTimeAndCharge.cc,v 1.66 2007-06-19 11:01:34 tbretz Exp $ 3 3 ! -------------------------------------------------------------------------- 4 4 ! … … 189 189 // order polynomial interpolation. 190 190 // 191 Double_t MExtractTimeAndCharge::GetSaturationTime(Int_t sat0, const Float_t *sig, Int_t max pos) const191 Double_t MExtractTimeAndCharge::GetSaturationTime(Int_t sat0, const Float_t *sig, Int_t maxconthalf) const 192 192 { 193 193 const Int_t p = sat0>1 ? sat0-2 : sat0-1; … … 195 195 return 0; 196 196 197 const Float_t &maxcont = sig[maxpos];198 197 if (sat0==1) 199 return sig[0]>maxcont /2? 0 : 0.5;198 return sig[0]>maxconthalf ? 0 : 0.5; 200 199 201 200 if (sig[p]>sig[p+1] || sig[p+1]>sig[p+2]) 202 return sig[p+1]>maxcont /2? sat0-1 : sat0-0.5;201 return sig[p+1]>maxconthalf ? sat0-1 : sat0-0.5; 203 202 204 203 // Find the place at which the signal is maxcont/2 … … 206 205 const TVector3 vy(p, p+1, p+2); 207 206 208 return MMath::InterpolParabLin(vx, vy, maxcont /2);207 return MMath::InterpolParabLin(vx, vy, maxconthalf); 209 208 } 210 209 … … 223 222 const Int_t numl = fRunHeader->GetNumSamplesLoGain(); 224 223 224 const UInt_t satlim = fSaturationLimit*fRunHeader->GetMax(); 225 225 226 MRawEvtPixelIter pixel(fRawEvt); 226 227 while (pixel.Next()) … … 230 231 const Float_t *sig = fSignal->GetSamples(pixidx); 231 232 232 const UInt_t maxcont = fSignal->GetRawMaxVal(pixidx, fHiGainFirst, fHiGainLast);233 const Int_t maxposhi = fSignal->GetMaxPos(pixidx, fHiGainFirst, fHiGainLast);234 235 233 // Would it be better to take lastsat-firstsat? 236 234 Int_t sathi0 = fHiGainFirst; // First slice to extract and first saturating slice 237 235 Int_t sathi1 = fHiGainLast; // Last slice to extract and last saturating slice 238 Int_t numsathi = fSignal->GetSaturation(pixidx, fSaturationLimit, sathi0, sathi1);236 Int_t numsathi = fSignal->GetSaturation(pixidx, satlim, sathi0, sathi1); 239 237 240 238 Float_t sumhi =0., deltasumhi =-1; // Set hi-gain of MExtractedSignalPix valid … … 246 244 247 245 if (numsathi<2) 246 { 247 const Int_t maxposhi = fSignal->GetMaxPos(pixidx, fHiGainFirst, fHiGainLast); 248 248 FindTimeAndChargeHiGain2(sig+fHiGainFirst, rangehi, 249 249 sumhi, deltasumhi, timehi, deltatimehi, 250 250 numsathi, maxposhi); 251 } 251 252 252 253 // If we have saturating slices try to get a better estimate 253 254 // of the arrival time than timehi or sathi0. This is 254 255 // usefull to know where to start lo-gain extraction. 256 const UInt_t maxcont = fSignal->GetRawMaxVal(pixidx, fHiGainFirst, fHiGainLast); 255 257 if (numsathi>1) 256 258 { 257 timehi = GetSaturationTime(sathi0, sig, fHiGainFirst+maxposhi)-fHiGainFirst;259 timehi = GetSaturationTime(sathi0, sig, maxcont/2)-fHiGainFirst; 258 260 deltatimehi = 0; 259 261 } … … 338 340 */ 339 341 // Would it be better to take lastsat-firstsat? 340 const Int_t maxposlo = fSignal->GetMaxPos(pixidx, first, last);341 342 342 Int_t satlo0 = first; // First slice to extract and first saturating slice 343 343 Int_t satlo1 = last; // Last slice to extract and last saturating slice 344 numsatlo = fSignal->GetSaturation(pixidx, fSaturationLimit, satlo0, satlo1);344 numsatlo = fSignal->GetSaturation(pixidx, satlim, satlo0, satlo1); 345 345 346 346 //if (satlo0>first && satlo1<last && numsatlo>2) … … 350 350 //} 351 351 352 const Int_t rangelo = last-first+1; 352 const Int_t rangelo = last-first+1; 353 const Int_t maxposlo = fSignal->GetMaxPos(pixidx, first, last); 353 354 FindTimeAndChargeLoGain2(sig+first, rangelo, 354 355 sumlo, deltasumlo, timelo, deltatimelo, … … 360 361 if (numsatlo>1) 361 362 { 362 timelo = GetSaturationTime(satlo0, sig, first+maxposlo)-numh-first; 363 const UInt_t maxrawlo = fSignal->GetRawMaxPos(pixidx, fHiGainFirst, fHiGainLast); 364 timelo = GetSaturationTime(satlo0, sig, first+maxrawlo)-numh-first; 363 365 deltatimelo = 0; 364 366 }
Note:
See TracChangeset
for help on using the changeset viewer.