Commit a6e5a8cb authored by Jérémie Dudouet's avatar Jérémie Dudouet
Browse files

adding text size in peak search

parent 4b383706
Pipeline #65308 passed with stage
in 9 minutes and 1 second
......@@ -4,12 +4,14 @@
#include "TBox.h"
#include "TH1.h"
#include "TVirtualPad.h"
#include "TFrame.h"
#include "CXFit.h"
CXArrow::CXArrow(CXFit *fit, Double_t E,Double_t y1 ,Double_t y2,Float_t arrowsize,Option_t *option) : TArrow(E, y1, E, y2, arrowsize, option)
CXArrow::CXArrow(CXFit *fit, Double_t E,Double_t y1 ,Double_t y2,Float_t arrowsize, Float_t textsize, Option_t *option) : TArrow(E, y1, E, y2, arrowsize, option)
{
fFit = fit;
fTextSize = textsize;
}
void CXArrow::SetEnergy(Float_t E)
......@@ -69,12 +71,14 @@ void CXArrow::SetText(TH1 *hist, const TString &text, const TString &tooltip)
fBox->SetLineColor(0);
fBox->SetLineStyle(3);
Double_t height = gPad->GetFrame()->GetY2() - gPad->GetFrame()->GetY1();
delete fLatex;
fLatex = new TLatex(fX1,fY2,text);
fLatex = new TLatex(fX1,fY2+fArrowSize*height,text);
fLatex->SetTextAngle(90);
fLatex->SetTextFont(132);
fLatex->SetTextSize(fTextSize);
fLatex->SetTextColor(hist->GetLineColor());
fLatex->SetTextAlign(12);
fLatex->SetBit(TObject::kCannotPick);
fLatex->Draw();
......
......@@ -27,7 +27,7 @@ private:
public:
CXArrow(CXFit *fit, Double_t E,Double_t y1 ,Double_t y2,Float_t arrowsize=0.05,Option_t *option=">");
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() = default;
CXFit *GetFit(){return fFit;}
......
......@@ -62,7 +62,7 @@ void CXFit::AddArrow(Double_t Energy)
Energy = fHistogram->GetBinCenter(Bin);
Double_t MaxGlob = fHistogram->GetMaximum();
auto *arrow = new CXArrow(this,Energy,(Value + MaxGlob/100.) ,(Value +MaxGlob/15.),0.01,"<|");
auto *arrow = new CXArrow(this,Energy,(Value + MaxGlob/100.) ,(Value +MaxGlob/15.),0.01,0.03,"<|");
arrow->SetAngle(30);
arrow->SetLineWidth(2);
arrow->Draw();
......
......@@ -35,14 +35,18 @@ CXHist1DPlayer::CXHist1DPlayer(const TGCompositeFrame *MotherFrame, UInt_t w, UI
TGCompositeFrame *fHorizontalFrame = new TGCompositeFrame(fGroupFrame, 60, 20, kHorizontalFrame);
fHorizontalFrame->AddFrame(new TGLabel(fHorizontalFrame, "Sigma"), new TGLayoutHints(kLHintsCenterY | kLHintsLeft,5,20,0,0));
fHorizontalFrame->AddFrame(new TGLabel(fHorizontalFrame, "Sigma"), new TGLayoutHints(kLHintsCenterY | kLHintsLeft,5,10,0,0));
fSigmaSPEntry = new TGNumberEntry(fHorizontalFrame, 2, 3, 0, TGNumberFormat::kNESReal, TGNumberFormat::kNEANonNegative ,TGNumberFormat::kNELNoLimits);
fHorizontalFrame->AddFrame(fSigmaSPEntry,new TGLayoutHints(kLHintsCenterY | kLHintsLeft | kLHintsExpandX ,1,3,0,0));
fHorizontalFrame->AddFrame(new TGLabel(fHorizontalFrame, "Threshold"), new TGLayoutHints(kLHintsCenterY | kLHintsLeft,20,5,0,0));
fHorizontalFrame->AddFrame(new TGLabel(fHorizontalFrame, "Threshold"), new TGLayoutHints(kLHintsCenterY | kLHintsLeft,10,5,0,0));
fThresholdSPEntry = new TGNumberEntry(fHorizontalFrame, 0.05, 4, 0, TGNumberFormat::kNESReal, TGNumberFormat::kNEANonNegative ,TGNumberFormat::kNELLimitMinMax,0.001,0.999);
fHorizontalFrame->AddFrame(fThresholdSPEntry,new TGLayoutHints(kLHintsCenterY | kLHintsLeft | kLHintsExpandX ,1,3,0,0));
fHorizontalFrame->AddFrame(new TGLabel(fHorizontalFrame, "Size"), new TGLayoutHints(kLHintsCenterY | kLHintsLeft,10,5,0,0));
fTextSize = new TGNumberEntry(fHorizontalFrame,0.03, 4,0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEANonNegative ,TGNumberFormat::kNELLimitMinMax, 0.01 ,0.1);
fHorizontalFrame->AddFrame(fTextSize,new TGLayoutHints(kLHintsCenterY | kLHintsLeft | kLHintsExpandX ,1,3,0,0));
fGroupFrame->AddFrame(fHorizontalFrame,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,-10,-10,5,0));
fHorizontalFrame = new TGCompositeFrame(fGroupFrame, 60, 20, kHorizontalFrame);
......@@ -316,7 +320,7 @@ void CXHist1DPlayer::PeakSearch()
if(found) continue;
CXArrow *GammaArrow = new CXArrow(nullptr, Energy,(Value + MaxGlob/100.) ,(Value +MaxGlob/15.),0.01,"<|");
CXArrow *GammaArrow = new CXArrow(nullptr, Energy,(Value + MaxGlob/100.) ,(Value +MaxGlob/15.),0.01,fTextSize->GetNumber(),"<|");
GammaArrow->SetAngle(40);
GammaArrow->SetLineColor(fCurrentHist->GetLineColor());
......
......@@ -44,6 +44,7 @@ private:
TGNumberEntry *fSigmaSPEntry = nullptr;
TGNumberEntry *fThresholdSPEntry = nullptr;
TGNumberEntry *fTextSize = nullptr;
TGComboBox *fMinimizer = nullptr;
TGComboBox *fAlgorithm = nullptr;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment