Ignore:
Timestamp:
01/27/04 19:33:39 (21 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/manalysis
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/manalysis/MPedestalCam.cc

    r2582 r2929  
    5555    fArray = new TClonesArray("MPedestalPix", 1);
    5656
    57 //    for (int i=0; i<577; i++)
    58 //        new ((*fArray)[i]) MPedestalPix;
    5957}
    6058
     
    7977// --------------------------------------------------------------------------
    8078//
     79// Check if position i is inside bounds
     80//
     81Bool_t MPedestalCam::CheckBounds(Int_t i) const
     82{
     83  return i < GetSize();
     84}
     85
     86// --------------------------------------------------------------------------
     87//
     88// This function returns the current size of the TClonesArray
     89// independently if the MPedestalPix is filled with values or not.
     90//
    8191// Get the size of the MPedestalCam
    8292//
     
    92102MPedestalPix &MPedestalCam::operator[](Int_t i)
    93103{
    94     return *static_cast<MPedestalPix*>(fArray->UncheckedAt(i));
     104  if (!CheckBounds(i))
     105    return *static_cast<MPedestalPix*>(NULL);
     106
     107  return *static_cast<MPedestalPix*>(fArray->UncheckedAt(i));
    95108}
    96109
     
    101114MPedestalPix &MPedestalCam::operator[](Int_t i) const
    102115{
    103     return *static_cast<MPedestalPix*>(fArray->UncheckedAt(i));
    104 }
    105 
    106 // --------------------------------------------------------------------------
    107 //
    108 // Check if position i is inside bounds
    109 //
    110 Bool_t MPedestalCam::CheckBounds(Int_t i)
    111 {
    112     return i < fArray->GetEntriesFast();
    113 }
     116  if (!CheckBounds(i))
     117    return *static_cast<MPedestalPix*>(NULL);
     118
     119  return *static_cast<MPedestalPix*>(fArray->UncheckedAt(i));
     120}
    114121
    115122void MPedestalCam::Clear(Option_t *o)
  • trunk/MagicSoft/Mars/manalysis/MPedestalCam.h

    r2416 r2929  
    3131    Float_t GetPedestalMax(const MGeomCam *cam) const;
    3232
    33     Bool_t CheckBounds(Int_t i);
     33    Bool_t CheckBounds(Int_t i) const;
    3434
    3535    void Print(Option_t *o="") const;
  • trunk/MagicSoft/Mars/manalysis/MPedestalPix.cc

    r2237 r2929  
    4848void MPedestalPix::Clear(Option_t *o)
    4949{
    50     fPedestal = -1;
    51     fPedestalRms = -1;
     50    fPedestal = 0.;
     51    fPedestalRms = 0.;
    5252}
    5353
Note: See TracChangeset for help on using the changeset viewer.