| 1 | #ifndef MARS_MHArray
|
|---|
| 2 | #define MARS_MHArray
|
|---|
| 3 |
|
|---|
| 4 | #ifndef MARS_MH
|
|---|
| 5 | #include "MH.h"
|
|---|
| 6 | #endif
|
|---|
| 7 |
|
|---|
| 8 | class TList;
|
|---|
| 9 | class TLegend;
|
|---|
| 10 |
|
|---|
| 11 | class MMap;
|
|---|
| 12 |
|
|---|
| 13 | class MHArray : public MH
|
|---|
| 14 | {
|
|---|
| 15 | private:
|
|---|
| 16 | Int_t fIdx; // current index for the fill function
|
|---|
| 17 | TList *fArray; //-> Array storing the histograms
|
|---|
| 18 |
|
|---|
| 19 | const MParList *fParList; //! pointer to parameter list used for SetupFill when a new Hist is created
|
|---|
| 20 | TClass *fClass; // pointer to class entry in root dictionary
|
|---|
| 21 |
|
|---|
| 22 | const MH *fTemplate; //-> pointer to a template histogram
|
|---|
| 23 | TString fTemplateName; // name of the template class
|
|---|
| 24 |
|
|---|
| 25 | MMap *fMapIdx; //! Table to map keys to array indices
|
|---|
| 26 |
|
|---|
| 27 | Bool_t CreateH();
|
|---|
| 28 | void AddLegendEntry(TLegend *leg, TObject *obj, Int_t idx) const;
|
|---|
| 29 |
|
|---|
| 30 | enum { kUseTemplate=BIT(14) };
|
|---|
| 31 |
|
|---|
| 32 | void Init(const char *name);
|
|---|
| 33 |
|
|---|
| 34 | public:
|
|---|
| 35 | MHArray(const char *name=NULL, const char *title=NULL);
|
|---|
| 36 | MHArray(const TString hname, Bool_t istempl=kFALSE, const char *name=NULL, const char *title=NULL);
|
|---|
| 37 | MHArray(const MH *hist, const char *name=NULL, const char *title=NULL);
|
|---|
| 38 | ~MHArray();
|
|---|
| 39 |
|
|---|
| 40 | void Set(const TString hname, Bool_t istempl=kFALSE);
|
|---|
| 41 | void Set(const MH *hist);
|
|---|
| 42 |
|
|---|
| 43 | Bool_t SetupFill(const MParList *pList);
|
|---|
| 44 | Int_t Fill(const MParContainer *par, const Stat_t w=1);
|
|---|
| 45 | Bool_t Finalize();
|
|---|
| 46 |
|
|---|
| 47 | Bool_t AddHistogram();
|
|---|
| 48 |
|
|---|
| 49 | MH &operator[](Int_t i);
|
|---|
| 50 | MH *At(Int_t i);
|
|---|
| 51 |
|
|---|
| 52 | MH *GetH();
|
|---|
| 53 |
|
|---|
| 54 | void SetIndexByKey(Double_t key);
|
|---|
| 55 |
|
|---|
| 56 | void SetIndex(Int_t i) { fIdx=i; }
|
|---|
| 57 | void IncIndex() { fIdx++; }
|
|---|
| 58 | void DecIndex() { fIdx--; }
|
|---|
| 59 |
|
|---|
| 60 | Int_t GetIndex() const { return fIdx; }
|
|---|
| 61 |
|
|---|
| 62 | void Print(Option_t *option="") const;
|
|---|
| 63 |
|
|---|
| 64 | void Draw(Option_t *opt="");
|
|---|
| 65 | TObject *DrawClone(Option_t *opt="") const;
|
|---|
| 66 |
|
|---|
| 67 | ClassDef(MHArray, 0) //A histogram class for an array of Mars histograms
|
|---|
| 68 | };
|
|---|
| 69 |
|
|---|
| 70 | #endif
|
|---|
| 71 |
|
|---|