Ignore:
Timestamp:
10/30/03 17:09:40 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/manalysis
Files:
2 edited

Legend:

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

    r2416 r2445  
    124124Bool_t MCerPhotEvt::IsPixelExisting(Int_t id) const
    125125{
    126     const MCerPhotPix *pix = GetPixById(id);
    127     return pix ? kTRUE : kFALSE;
     126    return GetPixById(id) ? kTRUE : kFALSE;
    128127}
    129128
     
    163162    Float_t minval = FLT_MAX;
    164163
    165     for (UInt_t i=1; i<fNumPixels; i++)
     164    for (UInt_t i=0; i<fNumPixels; i++)
    166165    {
    167166        const MCerPhotPix &pix = (*this)[i];
     
    170169
    171170        const UInt_t id = pix.GetPixId();
    172         if (id>=n)
     171        if (id<0 || id>=n)
    173172            continue;
    174173
     
    200199    Float_t maxval = -FLT_MAX;
    201200
    202     for (UInt_t i=1; i<fNumPixels; i++)
     201    for (UInt_t i=0; i<fNumPixels; i++)
    203202    {
    204203        const MCerPhotPix &pix = (*this)[i];
     
    207206
    208207        const UInt_t id = pix.GetPixId();
    209         if (id>=n)
     208        if (id<0 || id>=n)
    210209            continue;
    211210
     
    229228        return -5.;
    230229
    231     Float_t minval = (*this)[0].GetNumPhotons()/(*this)[0].GetErrorPhot();
    232 
    233     for (UInt_t i=1; i<fNumPixels; i++)
     230    Float_t minval = FLT_MAX;
     231
     232    for (UInt_t i=0; i<fNumPixels; i++)
    234233    {
    235234        const MCerPhotPix &pix = (*this)[i];
     
    259258    Float_t maxval = -FLT_MAX;
    260259
    261     for (UInt_t i=1; i<fNumPixels; i++)
     260    for (UInt_t i=0; i<fNumPixels; i++)
    262261    {
    263262        const MCerPhotPix &pix = (*this)[i];
     
    289288    Float_t minval = FLT_MAX;
    290289
    291     for (UInt_t i=1; i<fNumPixels; i++)
     290    for (UInt_t i=0; i<fNumPixels; i++)
    292291    {
    293292        const MCerPhotPix &pix = (*this)[i];
     
    319318    Float_t maxval = -FLT_MAX;
    320319
    321     for (UInt_t i=1; i<fNumPixels; i++)
     320    for (UInt_t i=0; i<fNumPixels; i++)
    322321    {
    323322        const MCerPhotPix &pix = (*this)[i];
     
    356355// try to search in the array.
    357356//
    358 MCerPhotPix *MCerPhotEvt::GetPixById(int idx) const
    359 {
     357MCerPhotPix *MCerPhotEvt::GetPixById(Int_t idx) const
     358{
     359    if (idx<0)
     360        return 0;
     361
    360362    if (fLut.GetSize()>0)
    361         return idx>=0 && idx<fLut.GetSize() ? (MCerPhotPix*)(fPixels->UncheckedAt(fLut[idx])) : 0;
     363    {
     364        if (idx>=fLut.GetSize())
     365            return 0;
     366
     367        return fLut[idx]<0 ? 0 : (MCerPhotPix*)(fPixels->UncheckedAt(fLut[idx]));
     368    }
    362369
    363370    TIter Next(fPixels);
  • trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.h

    r2416 r2445  
    3939        //
    4040        if (idx>=fLut.GetSize())
     41        {
     42            const Int_t n = fLut.GetSize();
    4143            fLut.Set(idx+1);
     44            for (int i=n; i<idx; i++)
     45                fLut[i] = -1;
     46        }
    4247
    4348        fLut[idx] = fNumPixels;
     
    6671    void RemoveUnusedPixels();
    6772
    68     MCerPhotPix *GetPixById(int idx) const;// { return idx>=0 && idx<fLut.GetSize() ? (MCerPhotPix*)(fPixels->UncheckedAt(fLut[idx])) : 0; } // Return a pointer to the pixel with the requested id. NULL if it doesn't exist.
     73    MCerPhotPix *GetPixById(Int_t idx) const;
    6974
    7075    void Reset();
Note: See TracChangeset for help on using the changeset viewer.