Ignore:
Timestamp:
01/22/09 19:07:37 (16 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/msim/MPhotonEvent.h

    r9232 r9239  
    55#include "MParContainer.h"
    66#endif
    7 /*
    8 #ifndef MARS_MCamEvent
    9 #include "MCamEvent.h"
    10 #endif
    11 */
     7
    128#ifndef ROOT_TClonesArray
    139#include <TClonesArray.h>
    1410#endif
    1511
    16 // gcc 3.2
    17 //class ifstream;
    1812#include <iosfwd>
    19 
    20 /*
    21 class TH1;
    22 class TH2;
    23 class TH3;
    24 */
    2513
    2614class MPhotonData;
     
    7159        Changed();
    7260    }
     61
     62    void SetSorted() { fSorted = kTRUE; }
    7363};
    7464
    75 class MPhotonEvent : public MParContainer//, public MCamEvent
     65class MPhotonEvent : public MParContainer
    7666{
    7767private:
     
    8171    MPhotonEvent(const char *name=NULL, const char *title=NULL);
    8272
    83     //void Clear(Option_t * = NULL);
    84     void Print(Option_t * = NULL) const;
     73    // TObjArray, FIXME: This could be improved if checking for IsSortable is omitted
     74    void Sort(Bool_t force=kFALSE) { if (force) fData.UnSort(); fData.Sort(); }
     75    Bool_t IsSorted() const { return fData.IsSorted(); }
    8576
    86     const char *GetClassName() const;
     77
     78    // Getter/Setter
     79    Int_t GetNumPhotons() const { return fData.GetEntriesFast(); }
    8780
    8881    TClonesArray &GetArray() { return fData; }
    8982    const TClonesArray &GetArray() const { return fData; }
    90     void Remove(TObject *o) { fData.Remove(o); }
    9183
    9284    MPhotonData &Add(Int_t n);
    9385    MPhotonData &Add();
     86
     87    MPhotonData *GetFirst() const;
     88    MPhotonData *GetLast() const;
    9489
    9590    MPhotonData &operator[](UInt_t idx);
     
    106101        //        for (int i=fData.GetSize()-1; i>=n; i--)
    107102        //          fData.RemoveAt(i);
    108         static_cast<MyClonesArray&>(fData).FastRemove(n, fData.GetSize()-1);
     103        const Bool_t sorted = fData.IsSorted();
     104
     105        MyClonesArray &loc = static_cast<MyClonesArray&>(fData);
     106
     107        loc.FastRemove(n, fData.GetSize()-1);
     108
     109        // If it was sorted before it is also sorted now.
     110        if (sorted)
     111            loc.SetSorted();
    109112
    110113        return fData.GetEntriesFast();
    111114    }
    112 /*
    113     void Expand(Int_t n)
    114     {
    115         for (int i=fData.GetSize(); i<n; i++)
    116             fData.New(i);
    117     }
    118  */
     115
     116    // I/O
    119117    Int_t ReadCorsikaEvt(istream &fin);
    120118    Int_t ReadRflEvt(istream &fin);
    121119
    122     Int_t GetNumPhotons() const { return fData.GetEntriesFast(); }
    123 /*
    124     void FillRad(TH1 &hist, Float_t scale=1) const;
    125     void FillRad(TH2 &hist, Double_t x, Float_t scale=1) const;
    126     void Fill(TH2 &hist, Float_t scale=1) const;
    127     void Fill(TH3 &hist, Double_t z, Float_t scale=1) const;
    128  */
     120    // TObject
    129121    void Paint(Option_t *o="");
    130 
    131 //    Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const;
    132 //    void   DrawPixelContent(Int_t num) const;
    133 
    134     void Sort() { fData.Sort(); }
     122    void Print(Option_t * = NULL) const;
     123    //void Clear(Option_t * = NULL);
    135124
    136125    ClassDef(MPhotonEvent, 1) //Container to store the raw Event Data
Note: See TracChangeset for help on using the changeset viewer.