CXArrow.h 1.62 KB
Newer Older
Jérémie Dudouet's avatar
Jérémie Dudouet committed
1 2 3 4
#ifndef CXArrow_H
#define CXArrow_H

#include "TArrow.h"
5
#include "TBox.h"
Jérémie Dudouet's avatar
Jérémie Dudouet committed
6 7

class CXFit;
8 9
class CXBgdFit;

10 11 12 13 14 15
class TLatex;
class TBox;
class TH1;
class TVirtualPad;

class CXArrowBox;
Jérémie Dudouet's avatar
Jérémie Dudouet committed
16 17 18 19 20 21 22 23

class CXArrow : public  TArrow
{

private:

    TList *fList = nullptr;
    CXFit *fFit = nullptr;
24
    CXBgdFit *fBgdFit = nullptr;
Jérémie Dudouet's avatar
Jérémie Dudouet committed
25

26 27 28 29 30
    TLatex *fLatex = nullptr;
    CXArrowBox *fBox = nullptr;

    Float_t fTextSize = 0.03;

Jérémie Dudouet's avatar
Jérémie Dudouet committed
31 32
public:

33 34 35 36
    CXArrow(CXFit *fit, Double_t E,Double_t y1 ,Double_t y2,Float_t arrowsize=0.05, Float_t textsize = 0.03, Option_t *option=">");
    CXArrow(CXBgdFit *fit, Double_t E,Double_t y1 ,Double_t y2,Float_t arrowsize=0.05, Float_t textsize = 0.03, Option_t *option=">");

    ~CXArrow() = default;
Jérémie Dudouet's avatar
Jérémie Dudouet committed
37 38

    CXFit *GetFit(){return fFit;}
39
    CXBgdFit *GetBgdFit(){return fBgdFit;}
Jérémie Dudouet's avatar
Jérémie Dudouet committed
40 41 42 43 44 45 46 47 48 49

    //! Energy
    void SetEnergy(Float_t E); // *MENU* *ARGS={E=>fX1}*
    Double_t GetEnergy() const {return fX1;}

    void Set(Double_t X, Double_t Y1, Double_t Y2);

    void RemoveArrow(); // *MENU*
    void RemoveFit(); // *MENU*

50
    void SetText(TH1 *hist, const TString &text, const TString &tooltip);
51

52
    void ClearPad(TVirtualPad *pad = nullptr, bool refresh = true);
53 54 55

    virtual void Paint(Option_t *option = "");

Jérémie Dudouet's avatar
Jérémie Dudouet committed
56 57 58 59 60 61 62
    //! Sort
    virtual Bool_t  IsSortable() const {return kTRUE;}
    virtual Int_t Compare(const TObject *obj) const;

    ClassDef(CXArrow,0);
};

63 64 65 66 67 68 69 70 71 72 73 74 75 76
class CXArrowBox : public  TBox
{
private:
    CXArrow *fArrow = nullptr;

public:
    CXArrowBox(CXArrow *arrow) : TBox() {fArrow = arrow;}
    ~CXArrowBox(){;}

    void Clean(){if(fArrow) {fArrow->ClearPad(); delete fArrow; fArrow = nullptr;}}

    ClassDef(CXArrowBox,0);
};

Jérémie Dudouet's avatar
Jérémie Dudouet committed
77
#endif