Ignore:
Timestamp:
01/27/04 19:33:39 (21 years ago)
Author:
gaug
Message:
*** empty log message ***
File:
1 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)
Note: See TracChangeset for help on using the changeset viewer.