#ifndef MARS_MCerPhotEvt #define MARS_MCerPhotEvt #ifndef ROOT_TClonesArray #include #endif #ifndef ROOT_TArrayI #include #endif #ifndef MARS_MCamEvent #include "MCamEvent.h" #endif #ifndef MARS_MCerPhotPix #include "MCerPhotPix.h" #endif class MGeomCam; class MCerPhotPix; class MCerPhotEvtIter; class MCerPhotEvt : public MParContainer, public MCamEvent { friend class MCerPhotEvtIter; private: UInt_t fNumPixels; TArrayI fLut; // Lookup tabel to lookup pixel by index TClonesArray *fPixels; //-> FIXME: Change TClonesArray away from a pointer? public: MCerPhotEvt(const char *name=NULL, const char *title=NULL); ~MCerPhotEvt() { delete fPixels; } UInt_t GetNumPixels() const { return fNumPixels; } //void InitSize(UInt_t num) { fPixels->Expand(num); } MCerPhotPix *AddPixel(Int_t idx, Float_t nph=0, Float_t er=0) { // // If this is too slow or takes to much space we might use // MGeomApply and an InitSize member function instead. // if (idx>=fLut.GetSize()) { const Int_t n = fLut.GetSize(); fLut.Set(idx+1); for (int i=n; iUncheckedAt(i)); } MCerPhotPix &operator[](int i) const { return *(MCerPhotPix*)(fPixels->UncheckedAt(i)); } void Scale(Double_t f) { fPixels->ForEach(MCerPhotPix, Scale)(f); } void RemoveUnusedPixels(); MCerPhotPix *GetPixById(Int_t idx) const; void Reset(); void Print(Option_t *opt=NULL) const; void Clear(Option_t *opt=NULL) { Reset(); } // class MCamEvent Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const; void DrawPixelContent(Int_t num) const; operator TIterator*() const; ClassDef(MCerPhotEvt, 2) // class for an event containing cerenkov photons }; class MCerPhotEvtIter : public TObjArrayIter { private: Bool_t fUsedOnly; public: MCerPhotEvtIter(const MCerPhotEvt *evt, Bool_t usedonly=kTRUE, Bool_t dir=kIterForward) : TObjArrayIter(evt->fPixels, dir), fUsedOnly(usedonly) { } TObject *Next(); ClassDef(MCerPhotEvtIter, 0) }; inline MCerPhotEvt::operator TIterator*() const { return new MCerPhotEvtIter(this); } #endif