Changeset 8584 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
06/19/07 12:01:35 (17 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r8583 r8584  
    2929
    3030   * mcalib/MCalibrationRelTimeCalc.cc:
    31      - replaced kDeviatingTimeResolution by new kDeviatingRelTimeResolution
     31     - replaced kDeviatingTimeResolution by new
     32       kDeviatingRelTimeResolution
    3233
    3334   * mhcalib/MHCalibrationPulseTimeCam.cc:
     
    5152       maximum value to fit the FADC range
    5253
    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
    5572     - changed the GetScale from a calculation to a switch
    5673       (faster and easier to understand)
    57 
    58    * msignal/MExtractor.cc:
    59      - get the maximum in case of no lo-gains from the run-header
    6074
    6175
  • trunk/MagicSoft/Mars/NEWS

    r8582 r8584  
    1111     resource file (to check it open it in the TBrowser and choose Print()
    1212     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.
    1318
    1419   - callisto: improved calculation of spline coefficients a lot. This
  • trunk/MagicSoft/Mars/mraw/MRawRunHeader.cc

    r8434 r8584  
    3333//  =======================
    3434//
     35//  Format Version 9:
     36//  -----------------
     37//   + fNumEventsRead;
     38//
    3539//  Format Version 8:
    3640//  -----------------
     
    7377//  MRawRunHeader CLASS VERSION
    7478//  ===========================
     79//
     80//  Format Version 7:
     81//  -----------------
     82//   - added fNumEventsRead;
    7583//
    7684//  Format Version 6:
     
    108116//
    109117////////////////////////////////////////////////////////////////////////////
    110 
    111118#include "MRawRunHeader.h"
    112119
     
    124131
    125132const UShort_t MRawRunHeader::kMagicNumber      = 0xc0c0;
    126 const Byte_t   MRawRunHeader::kMaxFormatVersion =      8;
     133const Byte_t   MRawRunHeader::kMaxFormatVersion =      9;
    127134
    128135// --------------------------------------------------------------------------
     
    430437
    431438    // ----- Source position -----
     439    fin.seekg(fFormatVersion>5 ? 16 : 8, ios::cur);
     440    /*
    432441    if (fFormatVersion>5)
    433442    {
    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
    437450    // Maybe we should set these to something
    438451    // in case of fFormatVersion<6
    439     fin.read((char*)dummy, 4); // F32 TelescopeRA;  (+4)
    440     fin.read((char*)dummy, 4); // F32 TelescopeDEC; (+4)
    441452    fin.read((char*)&fSourceEpochChar,  2);     // Total=56
    442453    fin.read((char*)&fSourceEpochDate,  2);     // Total=58
     
    446457    {
    447458        UShort_t y, m, d;
    448         fin.read((char*)dummy, 4); // Former fMJD[4],
     459        fin.seekg(4, ios::cur);    // Former fMJD[4],
    449460        fin.read((char*)&y,    2); // Former fDateYear[2]
    450461        fin.read((char*)&m,    2); // Former fDateMonth[2]
     
    460471    fin.read((char*)&fNumSamplesHiGain, 2); // MUX: Number of samples per pixel
    461472
     473    if (fFormatVersion>8)
     474        fin.read((char*)dummy, 4); // 2xU16 (NumSamplesRemovedHead and NumSamplesRemovedTail)
     475
    462476    // ----- Number of events -----
    463477    fin.read((char*)&fNumEvents, 4);     // Total=70
     478
     479    if (fFormatVersion>8)
     480        fin.read((char*)&fNumEventsRead, 4);     // Total=70
    464481
    465482    // New in general features: (should they be included in new MAGIC1 formats, too?)
     
    566583        *fLog << "Sampling:     " << fFreqSampling << "MHz with " << (int)fNumSignificantBits << " significant bits" << endl;
    567584    *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;
    569589
    570590    if (TString(t).Contains("header", TString::kIgnoreCase))
  • trunk/MagicSoft/Mars/mraw/MRawRunHeader.h

    r8582 r8584  
    3838private:
    3939    /* ---- 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
    6465
    6566    Bool_t SwapAssignment(Short_t id0, Short_t id1);
     
    106107    UShort_t GetNumBytesPerSample() const { return fNumBytesPerSample; }
    107108    UInt_t   GetNumEvents() const         { return fNumEvents; }
     109    UInt_t   GetNumEventsRead() const     { return fNumEventsRead; }
    108110    UShort_t GetFreqSampling() const      { return fFreqSampling; }
    109111    const MTime &GetRunStart() const      { return fRunStart; }
     
    133135    Bool_t ReadEvt(istream& fin);
    134136
    135     ClassDef(MRawRunHeader, 6)  // storage container for general info
     137    ClassDef(MRawRunHeader, 7)  // storage container for general info
    136138};
    137139#endif
  • trunk/MagicSoft/Mars/msignal/MExtractTimeAndCharge.cc

    r8519 r8584  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MExtractTimeAndCharge.cc,v 1.65 2007-05-16 13:56:17 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MExtractTimeAndCharge.cc,v 1.66 2007-06-19 11:01:34 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    189189// order polynomial interpolation.
    190190//
    191 Double_t MExtractTimeAndCharge::GetSaturationTime(Int_t sat0, const Float_t *sig, Int_t maxpos) const
     191Double_t MExtractTimeAndCharge::GetSaturationTime(Int_t sat0, const Float_t *sig, Int_t maxconthalf) const
    192192{
    193193    const Int_t p = sat0>1 ? sat0-2 : sat0-1;
     
    195195        return 0;
    196196
    197     const Float_t &maxcont = sig[maxpos];
    198197    if (sat0==1)
    199         return sig[0]>maxcont/2 ? 0 : 0.5;
     198        return sig[0]>maxconthalf ? 0 : 0.5;
    200199
    201200    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;
    203202
    204203    // Find the place at which the signal is maxcont/2
     
    206205    const TVector3 vy(p, p+1, p+2);
    207206
    208     return MMath::InterpolParabLin(vx, vy, maxcont/2);
     207    return MMath::InterpolParabLin(vx, vy, maxconthalf);
    209208}
    210209
     
    223222    const Int_t numl = fRunHeader->GetNumSamplesLoGain();
    224223
     224    const UInt_t satlim = fSaturationLimit*fRunHeader->GetMax();
     225
    225226    MRawEvtPixelIter pixel(fRawEvt);
    226227    while (pixel.Next())
     
    230231        const Float_t *sig = fSignal->GetSamples(pixidx);
    231232
    232         const UInt_t maxcont  = fSignal->GetRawMaxVal(pixidx, fHiGainFirst, fHiGainLast);
    233         const  Int_t maxposhi = fSignal->GetMaxPos(pixidx, fHiGainFirst, fHiGainLast);
    234 
    235233        // Would it be better to take lastsat-firstsat?
    236234        Int_t sathi0   = fHiGainFirst;  // First slice to extract and first saturating slice
    237235        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);
    239237
    240238        Float_t sumhi =0., deltasumhi =-1; // Set hi-gain of MExtractedSignalPix valid
     
    246244
    247245        if (numsathi<2)
     246        {
     247            const Int_t maxposhi = fSignal->GetMaxPos(pixidx, fHiGainFirst, fHiGainLast);
    248248            FindTimeAndChargeHiGain2(sig+fHiGainFirst, rangehi,
    249249                                     sumhi, deltasumhi, timehi, deltatimehi,
    250250                                     numsathi, maxposhi);
     251        }
    251252
    252253        // If we have saturating slices try to get a better estimate
    253254        // of the arrival time than timehi or sathi0. This is
    254255        // usefull to know where to start lo-gain extraction.
     256        const UInt_t maxcont = fSignal->GetRawMaxVal(pixidx, fHiGainFirst, fHiGainLast);
    255257        if (numsathi>1)
    256258        {
    257             timehi = GetSaturationTime(sathi0, sig, fHiGainFirst+maxposhi)-fHiGainFirst;
     259            timehi = GetSaturationTime(sathi0, sig, maxcont/2)-fHiGainFirst;
    258260            deltatimehi = 0;
    259261        }
     
    338340             */
    339341            // Would it be better to take lastsat-firstsat?
    340             const Int_t maxposlo = fSignal->GetMaxPos(pixidx, first, last);
    341 
    342342            Int_t satlo0 = first;   // First slice to extract and first saturating slice
    343343            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);
    345345
    346346            //if (satlo0>first && satlo1<last && numsatlo>2)
     
    350350            //}
    351351
    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);
    353354            FindTimeAndChargeLoGain2(sig+first, rangelo,
    354355                                     sumlo, deltasumlo, timelo, deltatimelo,
     
    360361            if (numsatlo>1)
    361362            {
    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;
    363365                deltatimelo = 0;
    364366            }
Note: See TracChangeset for help on using the changeset viewer.