46 static const Int_t kSliderRes = 10000;
47 static const Int_t kNDrawPts = 500;
49 static const Int_t kBtnRefit = 1000;
50 static const Int_t kBtnAccept = 1001;
51 static const Int_t kBtnCancel = 1002;
52 static const Int_t kBtnReset = 1003;
53 static const Int_t kSliderBase = 2000;
54 static const Int_t kEntryBase = 3000;
55 static const Int_t kFixBase = 4000;
56 static const Int_t kLoBoundBase = 5000;
57 static const Int_t kHiBoundBase = 6000;
58 static const Int_t kRangeSlider = 7000;
59 static const Int_t kRangeLoEntry = 7001;
60 static const Int_t kRangeHiEntry = 7002;
63 const std::vector<Double_t> *events_;
64 Float_t display_bin_width_kev_;
65 RooAbsPdf *total_pdf_;
68 std::vector<RooFitPeakModel> *peaks_;
70 TString info_label_text_;
73 Double_t original_range_low_;
74 Double_t original_range_high_;
80 std::vector<RooRealVar *> params_;
82 std::vector<Double_t> original_params_;
83 std::vector<Double_t> original_bounds_low_;
84 std::vector<Double_t> original_bounds_high_;
85 std::vector<Bool_t> original_fixed_;
86 std::vector<Double_t> current_bounds_low_;
87 std::vector<Double_t> current_bounds_high_;
89 TRootEmbeddedCanvas *embedded_canvas_;
93 std::vector<TGHSlider *> sliders_;
94 std::vector<TGNumberEntry *> value_entries_;
95 std::vector<TGCheckButton *> fix_checks_;
96 std::vector<TGNumberEntry *> lo_bound_entries_;
97 std::vector<TGNumberEntry *> hi_bound_entries_;
99 TGDoubleHSlider *range_slider_;
100 TGNumberEntry *range_lo_entry_;
101 TGNumberEntry *range_hi_entry_;
104 TGraph *total_graph_;
106 TGraph *comp_graphs_[3][4];
114 Bool_t needs_redraw_;
118 TTimer *redraw_timer_;
121 void BuildPeakTab(TGCompositeFrame *parent, Int_t peak_idx);
122 void BuildBackgroundTab(TGCompositeFrame *parent);
123 void AddParamRow(TGCompositeFrame *parent, Int_t param_idx,
const char *name);
127 void UpdateAllGraphs();
128 void UpdateResPoints();
130 void SyncAllWidgets();
131 void SyncWidget(Int_t param_idx);
133 void OnSliderMoved(Int_t param_idx);
134 void OnEntryChanged(Int_t param_idx);
135 void OnBoundsChanged(Int_t param_idx);
136 void OnFixToggled(Int_t param_idx);
137 void OnRangeChanged();
144 Int_t ValToSlider(Int_t param_idx, Double_t val);
145 Double_t SliderToVal(Int_t param_idx, Int_t pos);
146 Bool_t IsFixed(Int_t param_idx);
147 void GetDefaultBounds(Int_t param_idx, Double_t &lo, Double_t &hi);
148 Int_t BkgConstIdx() {
return num_peaks_ * 10; }
149 Int_t BkgSlopeIdx() {
return num_peaks_ * 10 + 1; }
150 static Int_t PeakStyle(Int_t peak_idx);
152 Double_t EvalPdfDensity(RooAbsPdf *pdf, Double_t xv);
153 Double_t ComponentExpected(RooAbsPdf *pdf, Double_t yield, Double_t xv);
178 const std::vector<Double_t> *events,
179 Float_t display_bin_width_kev, RooAbsPdf *total_pdf,
180 RooRealVar *x, RooAbsData *data,
181 std::vector<RooFitPeakModel> *peaks,
183 Double_t range_high,
const TString &info_label =
"");
194 virtual Bool_t
ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
Bool_t LaunchInteractiveRooFitEditor(TH1 *hist, const std::vector< Double_t > *events, Float_t display_bin_width_kev, RooAbsPdf *total_pdf, RooRealVar *x, RooAbsData *data, std::vector< RooFitPeakModel > *peaks, RooFitBackgroundModel *bkg, Double_t range_low, Double_t range_high, const TString &info_label)
Open the RooFit editor and pump its event loop until the user is done.
InteractiveRooFitEditor(const TGWindow *parent, TH1 *hist, const std::vector< Double_t > *events, Float_t display_bin_width_kev, RooAbsPdf *total_pdf, RooRealVar *x, RooAbsData *data, std::vector< RooFitPeakModel > *peaks, RooFitBackgroundModel *bkg, Double_t range_low, Double_t range_high, const TString &info_label="")
Build the editor around a converged RooFit model.