Ignore:
Timestamp:
10/20/03 17:49:59 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

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

    r2216 r2410  
    44#ifndef ROOT_TClonesArray
    55#include <TClonesArray.h>
     6#endif
     7#ifndef ROOT_TArrayI
     8#include <TArrayI.h>
    69#endif
    710#ifndef MARS_MCamEvent
     
    1922private:
    2023    UInt_t        fNumPixels;
     24    TArrayI       fLut;        // Lookup tabel to lookup pixel by index
    2125    TClonesArray *fPixels;     //-> FIXME: Change TClonesArray away from a pointer?
    2226
     
    2832    //void   InitSize(UInt_t num) { fPixels->Expand(num); }
    2933
    30     void   AddPixel(Int_t id, Float_t nph, Float_t er)
     34    void   AddPixel(Int_t idx, Float_t nph, Float_t er)
    3135    {
    32         new ((*fPixels)[fNumPixels++]) MCerPhotPix(id, nph, er);
     36        //
     37        // If this is too slow or takes to much space we might use
     38        // MGeomApply and an InitSize member function instead.
     39        //
     40        if (idx>=fLut.GetSize())
     41            fLut.Set(idx+1);
     42
     43        fLut[idx] = fNumPixels;
     44        new ((*fPixels)[fNumPixels++]) MCerPhotPix(idx, nph, er);
    3345    }
    3446
    3547    void FixSize();
    36 
    37     //Bool_t  AddEvent(const MCerPhotEvt &evt);
    3848
    3949    Bool_t  IsPixelExisting(Int_t id) const;
     
    5363    MCerPhotPix &operator[](int i) const { return *(MCerPhotPix*)(fPixels->UncheckedAt(i)); }
    5464
    55     void Scale(Double_t f);
     65    void Scale(Double_t f) { fPixels->ForEach(MCerPhotPix, Scale)(f); }
    5666    void RemoveUnusedPixels();
    5767
    58     MCerPhotPix *GetPixById(int id) const;
     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.
    5969
    6070    void Reset();
    6171
    62     void Draw(Option_t* option = "");
    6372    void Print(Option_t *opt=NULL) const;
    6473    void Clear(Option_t *opt=NULL) { Reset(); }
    6574
    6675    Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const;
    67     void DrawPixelContent(Int_t num) const
    68     {
    69     }
     76    void DrawPixelContent(Int_t num, TVirtualPad *pad=NULL) const;
    7077
    71     ClassDef(MCerPhotEvt, 1)    // class for an event containing cerenkov photons
     78    ClassDef(MCerPhotEvt, 2)    // class for an event containing cerenkov photons
    7279};
    7380
    7481#endif
    75 
Note: See TracChangeset for help on using the changeset viewer.