CXArrow.h 1.35 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 10 11 12 13
class TLatex;
class TBox;
class TH1;
class TVirtualPad;

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

class CXArrow : public  TArrow
{

private:

    TList *fList = nullptr;
    CXFit *fFit = nullptr;

23 24 25 26 27
    TLatex *fLatex = nullptr;
    CXArrowBox *fBox = nullptr;

    Float_t fTextSize = 0.03;

Jérémie Dudouet's avatar
Jérémie Dudouet committed
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
public:

    CXArrow(CXFit *fit, Double_t E,Double_t y1 ,Double_t y2,Float_t arrowsize=0.05,Option_t *option=">");
    ~CXArrow();

    CXFit *GetFit(){return fFit;}

    //! 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*

44 45
    void SetText(TH1 *hist, TString text, TString tooltip);

46
    void ClearPad(TVirtualPad *pad = nullptr, bool refresh = true);
47 48 49

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

Jérémie Dudouet's avatar
Jérémie Dudouet committed
50 51 52 53 54 55 56
    //! Sort
    virtual Bool_t  IsSortable() const {return kTRUE;}
    virtual Int_t Compare(const TObject *obj) const;

    ClassDef(CXArrow,0);
};

57 58 59 60 61 62 63 64 65 66 67 68 69 70
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
71
#endif