Changeset 8346


Ignore:
Timestamp:
03/01/07 21:49:15 (18 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r8345 r8346  
    6161     - increased file format version from 5 to 6
    6262
     63   * mraw/MRawEvtPixelIter.[h,cc]:
     64     - made aware of handling the new and old format
     65     - added range to GetIdxMax*
     66
    6367
    6468
  • trunk/MagicSoft/Mars/NEWS

    r8340 r8346  
    22
    33 *** <cvs>
     4
     5   - merpp: Implemented file format version 8 (MUX FADC data). The 16-bit
     6     data containing only 10-bit information is still cooked down to
     7     8-bit, by cutting away the lowest 8-bit.
     8
     9   - merpp: When reading raw data the data is now stored in a single
     10     array. The lo-gain array is obsolete. The interface stays the same.
    411
    512   - callisto: Improved binning for the pulse position check histogram
  • trunk/MagicSoft/Mars/mraw/MRawEvtPixelIter.cc

    r6253 r8346  
    7171// --------------------------------------------------------------------------
    7272//
    73 // return kTRUE  the lo gains exist for the actual pixel, else return kFALSE
    74 //
    75 Bool_t MRawEvtPixelIter::HasLoGain() const
    76 {
    77     // We have no lo-gain at all
    78     if (!fLoGainId)
    79         return kFALSE;
    80 
    81     // This is to make the first call of this function in Next()
    82     // work properly! NEVER call this function before Next()
    83     if (fNumLoGainEntry==0)
    84         return kTRUE;
    85 
    86     if (fNumLoGainEntry>fData->fLoGainPixId->GetSize())
    87         return kFALSE;
    88 
    89     Bool_t rc = *fHiGainId!=*fLoGainId;
    90 
    91     if (rc)
    92         return kFALSE;
    93 
    94     return kTRUE;
    95 }
    96 
    97 // --------------------------------------------------------------------------
    98 //
    9973// It steps to the next pixel. If there is no next pixel NULL is returned.
    10074// If a next pixel where found, a pointer to the primary given (constructor)
     
    11084
    11185    //
    112     // if we are already at the last entry there is no 'next' entry anymore
    113     //
    114     if (HasLoGain())
     86    // For old MC data which stores hi- and lo-gain in two arrays
     87    // we have to use the old algorithm
     88    //
     89    if (fData->fLoGainPixId->GetSize())
    11590    {
    116         //
    117         // if higainpixid and logainpixid of the actual pixel are
    118         // identical then we have to move the pointer to the next
    119         // entry in the lo gains
    120         //
     91        fNumHiGainEntry++;
     92        fHiGainId++;
     93        fHiGainPos += fNumHiGainSamples;
     94
    12195        fNumLoGainEntry++;
    12296        fLoGainId++;
    12397        fLoGainPos += fNumLoGainSamples;
    12498    }
    125 
    126     //
    127     // here we have to move the pointer to the next entry in the hi gains
    128     //
    129     fNumHiGainEntry++;
    130     fHiGainId++;
    131     fHiGainPos += fNumHiGainSamples;
     99    else
     100    {
     101        fNumLoGainEntry = ++fNumHiGainEntry;
     102        fLoGainId       = ++fHiGainId;
     103
     104        fHiGainPos     += fNumHiGainSamples+fNumLoGainSamples;
     105        fLoGainPos      = fHiGainPos + fNumHiGainSamples;
     106    }
    132107
    133108    //
     
    152127    // set pointer to first entry of arrays
    153128    //
    154     fHiGainId   = fData->fHiGainPixId->GetArray()-1;
    155     fLoGainId   = fData->fLoGainPixId->GetArray();
    156     fHiGainPos  = fData->fHiGainFadcSamples->GetArray()-fNumHiGainSamples;
    157     fLoGainPos  = fData->fLoGainFadcSamples->GetArray()-fNumLoGainSamples;
    158     fABFlags    = fData->fABFlags->GetSize()==0 ? 0 : fData->fABFlags->GetArray();
     129    fHiGainId = fData->fHiGainPixId->GetArray()-1;
     130    fABFlags  = fData->fABFlags->GetSize()==0 ? 0 : fData->fABFlags->GetArray();
     131
     132    //
     133    // For old MC data which stores hi- and lo-gain in two arrays
     134    // we have to use the old algorithm
     135    //
     136    if (fData->fLoGainPixId->GetSize())
     137    {
     138        fLoGainId  = fData->fLoGainPixId->GetArray();
     139        fHiGainPos = fData->fHiGainFadcSamples->GetArray()-fNumHiGainSamples;
     140        fLoGainPos = fData->fLoGainFadcSamples->GetArray()-fNumLoGainSamples;
     141    }
     142    else
     143    {
     144        fLoGainId  = fHiGainId;
     145        fLoGainPos = fHiGainPos+fNumHiGainSamples;
     146        fHiGainPos = fData->fHiGainFadcSamples->GetArray()-(fNumHiGainSamples+fNumLoGainSamples);
     147    }
    159148
    160149    //
     
    175164}
    176165
     166// --------------------------------------------------------------------------
     167//
     168// Returns the index of the FADC slice the maximum signal in. If the highest
     169// slices have the same value the last one is returned.
     170//
     171Byte_t MRawEvtPixelIter::GetIdxMaxHiGainSample(const Byte_t hifirst, const Byte_t hilast) const
     172{
     173    const Int_t l = hilast>fNumHiGainSamples  ? fNumHiGainSamples : hilast+1;
     174
     175    Byte_t *beg = fHiGainPos+hifirst;
     176
     177    Byte_t *ptr = beg+1;
     178    Byte_t *max = beg;
     179    const Byte_t *end = fHiGainPos + l;
     180
     181    do if (*ptr>*max) max = ptr;
     182    while (++ptr != end);
     183
     184    return max-fHiGainPos;
     185}
     186
     187// --------------------------------------------------------------------------
     188//
     189// Returns the index of the FADC slice the maximum signal in. If no lo-gains
     190// are available -1 is returned. If the highest slices have the same value the
     191// last one is returned.
     192//
     193Short_t MRawEvtPixelIter::GetIdxMaxLoGainSample(const Byte_t lofirst, const Byte_t lolast) const
     194{
     195    if (!HasLoGain())
     196        return -1; // means: not found
     197
     198    const Int_t l = lolast>fNumLoGainSamples  ? fNumLoGainSamples : lolast+1;
     199
     200    Byte_t *beg = fLoGainPos+lofirst;
     201
     202    Byte_t *ptr = beg+1;
     203    Byte_t *max = beg;
     204    const Byte_t *end = fLoGainPos + l;
     205
     206    do if (*ptr>*max) max = ptr;
     207    while (++ptr != end);
     208
     209    return max-fLoGainPos;
     210}
     211
     212// --------------------------------------------------------------------------
     213//
     214// Returns the maximum signal of all sliced in the hi gain samples
     215//
     216Byte_t MRawEvtPixelIter::GetMaxHiGainSample(const Byte_t hifirst, const Byte_t hilast) const
     217{
     218    Byte_t max = 0;
     219
     220    const Int_t f = hifirst;
     221    const Int_t l = hilast>fNumHiGainSamples  ? fNumHiGainSamples : hilast+1;
     222
     223    for (int i=f; i<l; i++)
     224        if (fHiGainPos[i]>max)
     225            max = fHiGainPos[i];
     226
     227    return max;
     228}
     229
     230/*
    177231// --------------------------------------------------------------------------
    178232//
     
    233287
    234288    return (sqsum-(Float_t)sum*sum/fNumHiGainSamples)/(fNumHiGainSamples-1);
    235 }
    236 
    237 // --------------------------------------------------------------------------
    238 //
    239 // Returns the index of the FADC slice the maximum signal in. If the highest
    240 // slices have the same value the last one is returned.
    241 //
    242 Byte_t MRawEvtPixelIter::GetIdxMaxHiGainSample() const
    243 {
    244     Byte_t *ptr = fHiGainPos+1;
    245     Byte_t *max = fHiGainPos;
    246     const Byte_t *end = fHiGainPos + fNumHiGainSamples;
    247 
    248     do if (*ptr>*max) max = ptr;
    249     while (++ptr != end);
    250 
    251     return max-fHiGainPos;
    252 }
    253 
    254 // --------------------------------------------------------------------------
    255 //
    256 // Returns the index of the FADC slice the maximum signal in. If no lo-gains
    257 // are available -1 is returned. If the highest slices have the same value the
    258 // last one is returned.
    259 //
    260 Short_t MRawEvtPixelIter::GetIdxMaxLoGainSample(const Byte_t lofirst) const
    261 {
    262     if (!HasLoGain())
    263         return -1; // means: not found
    264 
    265     Byte_t *ptr = fLoGainPos+lofirst+1;
    266     Byte_t *max = fLoGainPos+lofirst;
    267     const Byte_t *end = fLoGainPos + fNumLoGainSamples;
    268 
    269     do if (*ptr>*max) max = ptr;
    270     while (++ptr != end);
    271 
    272     return max-fLoGainPos;
    273289}
    274290
     
    299315// Returns the maximum signal of all sliced in the hi gain samples
    300316//
    301 Byte_t MRawEvtPixelIter::GetMaxHiGainSample() const
    302 {
    303     Byte_t max = 0;
    304 
    305     for (int i=0; i<fNumHiGainSamples; i++)
    306         if (fHiGainPos[i]>max)
    307             max = fHiGainPos[i];
    308 
    309     return max;
    310 }
    311 
    312 // --------------------------------------------------------------------------
    313 //
    314 // Returns the maximum signal of all sliced in the hi gain samples
    315 //
    316317Byte_t MRawEvtPixelIter::GetMaxLoGainSample() const
    317318{
     
    371372    return sum;
    372373}
     374*/
  • trunk/MagicSoft/Mars/mraw/MRawEvtPixelIter.h

    r6253 r8346  
    7474        //          belong to the actual pixel
    7575        //
     76        //
     77        // Use is deprecated!
     78        //
    7679        return fHiGainPos;
    7780    }
    7881
    79     Byte_t  GetNumHiGainSamples() const { return fNumHiGainSamples ; }
    80     Byte_t  GetNumLoGainSamples() const { return fNumLoGainSamples ; }
     82    Byte_t *GetSamples() const
     83    {
     84        //
     85        // return a pointer to the fadc samples of the hi gains
     86        // WARNING: Don't forget to get the number of valid entries
     87        //          (GetNumSamples) to know how many entries of the array
     88        //          belong to the actual pixel
     89        //
     90        return fHiGainPos;
     91    }
    8192
     93    Byte_t  GetNumHiGainSamples() const { return fNumHiGainSamples ; }// Use is deprecated!
     94    Byte_t  GetNumLoGainSamples() const { return fNumLoGainSamples ; }// Use is deprecated!
     95    Byte_t  GetNumSamples() const { return fNumHiGainSamples+fNumLoGainSamples; }
     96
     97    Byte_t  GetIdxMaxHiGainSample(const Byte_t hifirst=0, const Byte_t hilast=0xff) const;
     98    Short_t GetIdxMaxLoGainSample(const Byte_t lofirst=0, const Byte_t lolast=0xff) const;
     99
     100    Byte_t  GetMaxHiGainSample(const Byte_t hifirst=0, const Byte_t hilast=0xff) const;
     101/*
    82102    ULong_t GetSumHiGainSamples() const;
    83103    ULong_t GetSumSqrHiGainSamples() const;
    84104    Float_t GetVarHiGainSamples() const;
    85105
    86     Byte_t  GetMaxHiGainSample() const;
    87106    Byte_t  GetMaxLoGainSample() const;
    88     Byte_t  GetIdxMaxHiGainSample() const;
    89     Short_t GetIdxMaxLoGainSample(const Byte_t lofirst=0) const;
    90107    Short_t GetIdxMaxHiLoGainSample() const;
    91108
    92     Bool_t HasLoGain() const;
     109    ULong_t GetSumLoGainSamples() const;
     110    ULong_t GetSumSqrLoGainSamples() const;
     111  */
     112    Bool_t HasLoGain() const { return fNumLoGainSamples>0; }
    93113    Bool_t IsABFlagValid() const { return fABFlags ? kTRUE : kFALSE; }
    94114    Bool_t HasABFlag() const
     
    116136    }
    117137
    118     ULong_t GetSumLoGainSamples() const;
    119     ULong_t GetSumSqrLoGainSamples() const;
    120 
    121138    void Reset();
    122139
Note: See TracChangeset for help on using the changeset viewer.