Logo ROOT   6.16/01
Reference Guide
TFitEditor.cxx
Go to the documentation of this file.
1// @(#)root/fitpanel:$Id: ed8d59036b6a51c67cd739c2c75aa7780b847bf8 $
2// Author: Ilka Antcheva, Lorenzo Moneta 10/08/2006
3
4/*************************************************************************
5 * Copyright (C) 1995-2006, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12
13//////////////////////////////////////////////////////////////////////////
14// //
15// TFitEditor //
16// //
17// Allows to perform, explore and compare various fits. //
18// //
19// To display the new Fit panel interface right click on a histogram //
20// or a graph to pop up the context menu and then select the menu //
21// entry 'Fit Panel'. //
22// //
23// "General" Tab //
24// //
25// The first set of GUI elements is related to the function choice //
26// and settings. The status bar on the bottom provides information //
27// about the current minimization settings using the following //
28// abbreviations: //
29// LIB - shows the current choice between Minuit/Minuit2/Fumili //
30// MIGRAD or FUMILI points to the current minimization method in use. //
31// Itr: - shows the maximum number of iterations nnnn set for the fit. //
32// Prn: - can be DEF/VER/QT and shows the current print option in use. //
33// //
34// "Predefined" combo box - contains a list of predefined functions //
35// in ROOT. The default one is Gaussian. //
36// //
37// "Operation" radio button group defines selected operational mode //
38// between functions: NOP - no operation (default); ADD - addition //
39// CONV - convolution (will be implemented in the future). //
40// //
41// Users can enter the function expression in a text entry field. //
42// The entered string is checked after Enter key was pressed. An //
43// error message shows up if the string is not accepted. The current //
44// prototype is limited and users have no freedom to enter file/user //
45// function names in this field. //
46// //
47// "Set Parameters" button opens a dialog for parameters settings. //
48// //
49// "Fit Settings" provides user interface elements related to the //
50// fitter. Currently there are two method choices: Chi-square and //
51// Binned Likelihood. //
52// //
53// "Linear Fit" check button sets the use of Linear fitter is it is //
54// selected. Otherwise the option 'F' is applied if polN is selected. //
55// "Robust" number entry sets the robust value when fitting graphs. //
56// "No Chi-square" check button sets ON/OFF option 'C' - do not //
57// calculate Chi-square (for Linear fitter). //
58// //
59// Fit options: //
60// "Integral" check button switch ON/OFF option 'I' - use integral //
61// of function instead of value in bin center. //
62// "Best Errors" sets ON/OFF option 'E' - better errors estimation //
63// using Minos technique. //
64// "All weights = 1" sets ON/OFF option 'W' - all weights set to 1, //
65// excluding empty bins and ignoring error bars. //
66// "Empty bins, weights=1" sets ON/OFF option 'WW' - all weights //
67// equal to 1, including empty bins, error bars ignored. //
68// "Use range" sets ON/OFF option 'R' - fit only data within the //
69// specified function range with the slider. //
70// "Improve fit results" sets ON/OFF option 'M' - after minimum is //
71// found, search for a new one. //
72// "Add to list" sets On/Off option '+'- add function to the list //
73// without deleting the previous. //
74// //
75// Draw options: //
76// "SAME" sets On/Off function drawing on the same pad. //
77// "No drawing" sets On/Off option '0'- do not draw function graphics. //
78// "Do not store/draw" sets On/Off option 'N'- do not store the //
79// function, do not draw it. //
80// //
81// Sliders settings are used if option 'R' - use range is active. //
82// Users can change min/max values by pressing the left mouse button //
83// near to the left/right slider edges. It is possible o change both //
84// values simultaneously by pressing the left mouse button near to its //
85// center and moving it to a new desire position. //
86// //
87// "Minimization" Tab //
88// //
89// "Library" group allows you to use Minuit, Minuit2 or Fumili //
90// minimization packages for your fit. //
91// "Minuit" - the popular Minuit minimization package. //
92// "Minuit2" - a new object-oriented implementation of Minuit in C++. //
93// "Fumili" - the popular Fumili minimization package. //
94// //
95// "Method" group has currently restricted functionality. //
96// "MIGRAD" method is available for Minuit and Minuit2 //
97// "FUMILI" method is available for Fumili and Minuit2 //
98// "SIMPLEX" method is disabled (will come with the new fitter design) //
99// //
100// "Minimization Settings' group allows users to set values for: //
101// "Error definition" - between 0.0 and 100.0 (default is 1.0). //
102// "Maximum tolerance" - the fit relative precision in use. //
103// "Maximum number of iterations" - default is 5000. //
104// //
105// Print options: //
106// "Default" - between Verbose and Quiet. //
107// "Verbose" - prints results after each iteration. //
108// "Quiet" - no fit information is printed. //
109// //
110// Fit button - performs a fit. //
111// Reset - resets all GUI elements and related fit settings to the //
112// default ones. //
113// Close - closes this window. //
114// //
115// Begin_Html //
116/*
117<img src="gif/TFitEditor.gif">
118*/
119//End_Html
120//////////////////////////////////////////////////////////////////////////
121
122#include "TFitEditor.h"
123#include "TROOT.h"
124#include "TClass.h"
125#include "TCanvas.h"
126#include "TGTab.h"
127#include "TGLabel.h"
128#include "TG3DLine.h"
129#include "TGComboBox.h"
130#include "TGTextEntry.h"
131#include "TGFont.h"
132#include "TGGC.h"
133#include "TGButtonGroup.h"
134#include "TGNumberEntry.h"
135#include "TGDoubleSlider.h"
136#include "TGStatusBar.h"
137#include "TFitParametersDialog.h"
138#include "TGMsgBox.h"
139#include "TAxis.h"
140#include "TGraph.h"
141#include "TGraph2D.h"
142#include "TH1.h"
143#include "TH2.h"
144#include "HFitInterface.h"
145#include "TF1.h"
146#include "TF1NormSum.h"
147#include "TF1Convolution.h"
148#include "TF2.h"
149#include "TF3.h"
150#include "TTimer.h"
151#include "THStack.h"
152#include "TMath.h"
153#include "Fit/UnBinData.h"
154#include "Fit/BinData.h"
155#include "Fit/BinData.h"
156#include "TMultiGraph.h"
157#include "TTree.h"
158#include "TTreePlayer.h"
159#include "TTreeInput.h"
161
162#include "RConfigure.h"
163#include "TPluginManager.h"
164
165#include <sstream>
166#include <vector>
167#include <queue>
168using std::vector;
169using std::queue;
170using std::pair;
171using std::ostringstream;
172using std::make_pair;
173
174#include "CommonDefs.h"
175
176// #include <iostream>
177// using std::cout;
178// using std::endl;
179
180void SearchCanvases(TSeqCollection* canvases, std::vector<TObject*>& objects);
181
182typedef std::multimap<TObject*, TF1*> FitFuncMap_t;
183
184////////////////////////////////////////////////////////////////////////////////
185/// This method looks among the functions stored by the fitpanel, the
186/// one that is currently selected in the fFuncList
187
189{
190 // Get the list of functions from the system
191 std::vector<TF1*>& funcList(fSystemFuncs);
192
193 // Get the title/name of the function from fFuncList
195 if ( !te ) return 0;
196 TString name(te->GetTitle());
197
198 // Look for a system function if it's USER DEFINED function
199 if ( fTypeFit->GetSelected() == kFP_UFUNC ) {
200 for ( fSystemFuncIter it = funcList.begin();
201 it != funcList.end(); ++it ) {
202 TF1* f = (*it);
203 if ( strcmp( f->GetName(), name ) == 0 )
204 // If found, return it.
205 return f;
206 }
207 // If we are looking for previously fitted functions, look in the
208 // fPrevFit data structure.
209 } else if ( fTypeFit->GetSelected() == kFP_PREVFIT ) {
210 std::pair<fPrevFitIter, fPrevFitIter> look = fPrevFit.equal_range(fFitObject);
211 for ( fPrevFitIter it = look.first; it != look.second; ++it ) {
212 TF1* f = it->second;
213 if ( strcmp( f->GetName(), name ) == 0 )
214 // If found, return it
215 return f;
216 }
217 }
218
219 // Return a pointer to null if the function does not exist. This
220 // will eventually create a segmentation fault, but the line should
221 // never be executed.
222 return 0;
223}
224
225////////////////////////////////////////////////////////////////////////////////
226///Copies f into a new TF1 to be stored in the fitpanel with it's
227///own ownership. This is taken from Fit::StoreAndDrawFitFunction in
228///HFitImpl.cxx
229
231{
232 double xmin = 0, xmax = 0, ymin = 0, ymax = 0, zmin = 0, zmax = 0;
233
234 // no need to use kNotGlobal bit. TF1::Copy does not add in the list by default
235 if ( dynamic_cast<TF3*>(f) != 0 ) {
236 TF3* fnew = (TF3*)f->IsA()->New();
237 f->Copy(*fnew);
238 f->GetRange(xmin,ymin,zmin,xmax,ymax,zmax);
239 fnew->SetRange(xmin,ymin,zmin,xmax,ymax,zmax);
240 fnew->SetParent( 0 );
241 fnew->AddToGlobalList(false);
242 return fnew;
243 } else if ( dynamic_cast<TF2*>(f) != 0 ) {
244 TF2* fnew = (TF2*)f->IsA()->New();
245 f->Copy(*fnew);
246 f->GetRange(xmin,ymin,xmax,ymax);
247 fnew->SetRange(xmin,ymin,xmax,ymax);
248 fnew->Save(xmin,xmax,ymin,ymax,0,0);
249 fnew->SetParent( 0 );
250 fnew->AddToGlobalList(false);
251 return fnew;
252 } else {
253 TF1* fnew = (TF1*)f->IsA()->New();
254 f->Copy(*fnew);
255 f->GetRange(xmin,xmax);
256 fnew->SetRange(xmin,xmax);
257 // This next line is added, as fnew-Save fails with gausND! As
258 // the number of dimensions is unknown...
259 if ( '\0' != fnew->GetExpFormula()[0] )
260 fnew->Save(xmin,xmax,0,0,0,0);
261 fnew->SetParent( 0 );
262 fnew->AddToGlobalList(false);
263 return fnew;
264 }
265}
266
267////////////////////////////////////////////////////////////////////////////////
268/// Stores the parameters of the given function into pars
269
271{
272 int npar = func->GetNpar();
273 if (npar != (int) pars.size() ) pars.resize(npar);
274 for ( Int_t i = 0; i < npar; ++i )
275 {
276 Double_t par_min, par_max;
277 pars[i][PAR_VAL] = func->GetParameter(i);
278 func->GetParLimits(i, par_min, par_max);
279 pars[i][PAR_MIN] = par_min;
280 pars[i][PAR_MAX] = par_max;
281 }
282}
283
284////////////////////////////////////////////////////////////////////////////////
285/// Restore the parameters from pars into the function
286
288{
289 int npar = func->GetNpar();
290 if (npar > (int) pars.size() ) pars.resize(npar);
291 for ( Int_t i = 0; i < npar; ++i )
292 {
293 func->SetParameter(i, pars[i][PAR_VAL]);
294 func->SetParLimits(i, pars[i][PAR_MIN], pars[i][PAR_MAX]);
295 }
296}
297
298////////////////////////////////////////////////////////////////////////////////
299/// Parameter initialization for the function
300
301template<class FitObject>
302void InitParameters(TF1* func, FitObject * fitobj)
303{
304 const int special = func->GetNumber();
305 if (100 == special || 400 == special) {
307 ROOT::Fit::FillData(data,fitobj,func);
309 // case gaussian or Landau
310 } else if ( 110 == special || 410 == special ) {
312 ROOT::Fit::FillData(data,fitobj,func);
314 }
315}
316
317////////////////////////////////////////////////////////////////////////////////
318/// Splits the entry in fDataSet to get the selected variables and cuts
319/// from the text.
320
321void GetTreeVarsAndCuts(TGComboBox* dataSet, TString& variablesStr, TString& cutsStr)
322{
323 // Get the entry
324 TGTextLBEntry* textEntry =
325 static_cast<TGTextLBEntry*>( dataSet->GetListBox()->GetEntry( dataSet->GetSelected() ) );
326 if (!textEntry) return;
327 // Get the name of the tree
328 TString nameStr ( textEntry->GetText()->GetString() );
329 // Get the variables selected
330 variablesStr = nameStr(nameStr.First('(') + 2, nameStr.First(',') - nameStr.First('(') - 3);
331 // Get the cuts selected
332 cutsStr = nameStr( nameStr.First(',') + 3, nameStr.First(')') - nameStr.First(',') - 4 );
333}
334
335
337
339
340////////////////////////////////////////////////////////////////////////////////
341/// Static method - opens the fit panel.
342
344{
345 // Get the default pad if not provided.
346 if (!pad)
347 {
348 if (!gPad)
349 gROOT->MakeDefCanvas();
350 pad = gPad;
351 }
352
353 if (!fgFitDialog) {
354 fgFitDialog = new TFitEditor(pad, obj);
355 } else {
356 fgFitDialog->Show(pad, obj);
357 }
358 return fgFitDialog;
359}
360
361////////////////////////////////////////////////////////////////////////////////
362/// Constructor of fit editor. 'obj' is the object to be fitted and
363/// 'pad' where it is drawn.
364
366 TGMainFrame(gClient->GetRoot(), 20, 20),
367 fParentPad (0),
368 fFitObject (0),
369 fDim (0),
370 fXaxis (0),
371 fYaxis (0),
372 fZaxis (0),
373 fSumFunc (0),
374 fConvFunc (0),
375 fFuncPars (0),
376 fChangedParams (kFALSE)
377{
380
381 TGCompositeFrame *tf = new TGCompositeFrame(this, 350, 26,
383 TGLabel *label = new TGLabel(tf,"Data Set: ");
384 tf->AddFrame(label, new TGLayoutHints(kLHintsNormal, 15, 0, 5, 0));
385
386 fDataSet = new TGComboBox(tf, kFP_DATAS);
388 fDataSet->Resize(264, 20);
389
390 tf->AddFrame(fDataSet, new TGLayoutHints(kLHintsNormal, 13, 0, 5, 0));
391 fDataSet->Associate(this);
392
393 this->AddFrame(tf, new TGLayoutHints(kLHintsNormal | kLHintsExpandX,0,0,5,5));
394
396
397 fTab = new TGTab(this, 10, 10);
400 fTab->Associate(this);
401
402 TGHorizontalFrame *cf1 = new TGHorizontalFrame(this, 350, 20, kFixedWidth);
404 fUpdateButton = new TGTextButton(cf1, "&Update", kFP_UPDATE);
407 kLHintsExpandX, 0, 20, 2, 2));
408
409
410 fFitButton = new TGTextButton(cf1, "&Fit", kFP_FIT);
411 fFitButton->Associate(this);
413 kLHintsExpandX, 15, -6, 2, 2));
414
415 fResetButton = new TGTextButton(cf1, "&Reset", kFP_RESET);
416 fResetButton->Associate(this);
418 kLHintsExpandX, 11, -2, 2, 2));
419
420 fCloseButton = new TGTextButton(cf1, "&Close", kFP_CLOSE);
421 fCloseButton->Associate(this);
423 kLHintsExpandX, 7, 2, 2, 2));
425 kLHintsRight, 0, 5, 5, 5));
426
427 // Create status bar
428 int parts[] = { 20, 20, 20, 20, 20 };
429 fStatusBar = new TGStatusBar(this, 10, 10);
430 fStatusBar->SetParts(parts, 5);
434
437
438 gROOT->GetListOfCleanups()->Add(this);
439
442
443 // do not allow resizing
445 SetWindowName("Fit Panel");
446 SetIconName("Fit Panel");
447 SetClassHints("ROOT", "Fit Panel");
448
454
455 ConnectSlots();
456
458
459 if (!obj) {
460 TList* l = new TList();
461 l->Add(pad);
462 std::vector<TObject*> v;
464 if ( v.size() )
465 obj = v[0];
466 delete l;
467 }
468
469 SetFitObject(pad, obj, kButton1Down);
470
471 // In case we want to make it without a default canvas. This will
472 // be implemented after the 5.21/06 Release. Remember to take out
473 // any reference to the pad/canvas when the fitpanel is shown
474 // and/or built.
475
476 //SetCanvas(0 /*pad->GetCanvas()*/);
477
478 if ( pad ) {
479 SetCanvas(pad->GetCanvas());
480 if ( obj )
481 pad->GetCanvas()->Selected(pad, obj, kButton1Down);
482 }
483
485 UInt_t cw = 0;
486 UInt_t cx = 0;
487 UInt_t cy = 0;
488 if (pad && pad->GetCanvas() ) {
489 cw = pad->GetCanvas()->GetWindowWidth();
490 cx = (UInt_t)pad->GetCanvas()->GetWindowTopX();
491 cy = (UInt_t)pad->GetCanvas()->GetWindowTopY();
492 }
493
494 Resize(size);
495 MapWindow();
496
497 if (cw + size.fWidth < dw) {
498 Int_t gedx = 0, gedy = 0;
499 gedx = cx+cw+4;
500 gedy = (cy > 20) ? cy-20 : 0;
501 MoveResize(gedx, gedy, size.fWidth, size.fHeight);
502 SetWMPosition(gedx, gedy);
503 }
504
505 gVirtualX->RaiseWindow(GetId());
506
508 SetWMSize(size.fWidth, size.fHeight);
509 SetWMSizeHints(size.fWidth, size.fHeight, size.fWidth, size.fHeight, 0, 0);
510}
511
512////////////////////////////////////////////////////////////////////////////////
513/// Fit editor destructor.
514
516{
518
519 // Disconnect all the slot that were no disconnected in DisconnecSlots
520 fCloseButton ->Disconnect("Clicked()");
521 fDataSet ->Disconnect("Selected(Int_t)");
522 fUpdateButton->Disconnect("Clicked()");
523 TQObject::Disconnect("TCanvas", "Selected(TVirtualPad *, TObject *, Int_t)",
524 this, "SetFitObject(TVirtualPad *, TObject *, Int_t)");
525 gROOT->GetListOfCleanups()->Remove(this);
526
527 //Clean up the members that are not automatically cleaned.
528 Cleanup();
529 delete fLayoutNone;
530 delete fLayoutAdd;
531 delete fLayoutConv;
532
533 if (fConvFunc) delete fConvFunc;
534 if (fSumFunc) delete fSumFunc;
535
536 // Set the singleton reference to null
537 fgFitDialog = 0;
538}
539
540////////////////////////////////////////////////////////////////////////////////
541/// Creates the Frame that contains oll the information about the
542/// function.
543
545{
546 TGGroupFrame *gf1 = new TGGroupFrame(this, "Fit Function", kFitWidth);
547 TGCompositeFrame *tf0 = new TGCompositeFrame(gf1, 350, 26, kHorizontalFrame);
548 TGLabel *label1 = new TGLabel(tf0,"Type:");
549 tf0 -> AddFrame(label1, new TGLayoutHints(kLHintsNormal, 0, 0, 5, 0));
550
551 fTypeFit = new TGComboBox(tf0, kFP_TLIST);
552 fTypeFit -> AddEntry("User Func", kFP_UFUNC);
553 fTypeFit -> AddEntry("Predef-1D", kFP_PRED1D);
554 fTypeFit -> Resize(90, 20);
555 fTypeFit -> Select(kFP_PRED1D, kFALSE);
556
558 lb->Resize(lb->GetWidth(), 200);
559 tf0->AddFrame(fTypeFit, new TGLayoutHints(kLHintsNormal, 5, 0, 5, 0));
560 fTypeFit->Associate(this);
561
562 fFuncList = new TGComboBox(tf0, kFP_FLIST);
564 fFuncList->Resize(194, 20);
566
567 lb = fFuncList->GetListBox();
568 lb -> Resize(lb->GetWidth(), 500);
569 tf0 -> AddFrame(fFuncList, new TGLayoutHints(kLHintsNormal, 5, 0, 5, 0));
570 fFuncList->Associate(this);
571
573
574 TGCompositeFrame *tf1 = new TGCompositeFrame(gf1, 350, 26, kHorizontalFrame);
575 TGHButtonGroup *bgr = new TGHButtonGroup(tf1, "Operation");
576
577 bgr -> SetRadioButtonExclusive();
578 fNone = new TGRadioButton(bgr, "Nop", kFP_NONE);
579 fAdd = new TGRadioButton(bgr, "Add", kFP_ADD);
580 fNormAdd = new TGRadioButton(bgr, "NormAdd", kFP_NORMADD);
581 fConv = new TGRadioButton(bgr, "Conv", kFP_CONV);
582
583 fNone -> SetToolTipText("No operation defined");
584 fNone -> SetState(kButtonDown, kFALSE);
585 fAdd -> SetToolTipText("Addition");
586 // fAdd -> SetState(kButtonDown, kFALSE);
587 fNormAdd -> SetToolTipText("NormAddition");
588 //fNormAdd -> SetState(kButtonDown, kFALSE);
589 fConv -> SetToolTipText("Convolution");
590 //fConv -> SetState(kButtonDown, kTRUE);
591
592 fLayoutNone = new TGLayoutHints(kLHintsLeft,0 ,5,3,-10);
593 fLayoutAdd = new TGLayoutHints(kLHintsLeft,10,5,3,-10);
594 fLayoutNormAdd = new TGLayoutHints(kLHintsLeft,10,5,3,-10);
595 fLayoutConv = new TGLayoutHints(kLHintsLeft,10,5,3,-10);
596
597 bgr -> SetLayoutHints(fLayoutNone, fNone);
598 bgr -> SetLayoutHints(fLayoutAdd, fAdd);
599 bgr -> SetLayoutHints(fLayoutNormAdd,fNormAdd);
600 bgr -> SetLayoutHints(fLayoutConv, fConv);
601 bgr -> Show();
603
604 tf1 -> AddFrame(bgr, new TGLayoutHints(kLHintsExpandX, 0, 0, 3, 0));
605 gf1 -> AddFrame(tf1, new TGLayoutHints(kLHintsExpandX));
606
607 TGCompositeFrame *tf2 = new TGCompositeFrame(gf1, 350, 26,
609 fEnteredFunc = new TGTextEntry(tf2, new TGTextBuffer(0), kFP_FILE);
610 //fEnteredFunc->SetMaxLength(4000); // use default value (~4000)
613 assert(te);
615 fEnteredFunc->SetToolTipText("Enter file_name/function_name or a function expression");
619 kLHintsExpandX, 2, 2, 2, 2));
620 gf1->AddFrame(tf2, new TGLayoutHints(kLHintsNormal |
621 kLHintsExpandX, 0, 0, 2, 0));
622
624 TGLabel *label21 = new TGLabel(s1, "Selected: ");
625 s1->AddFrame(label21, new TGLayoutHints(kLHintsNormal |
626 kLHintsCenterY, 2, 2, 2, 0));
628 s1->AddFrame(hlines, new TGLayoutHints(kLHintsCenterY | kLHintsExpandX));
630
631 TGCompositeFrame *tf4 = new TGCompositeFrame(gf1, 350, 26,
634 TString s = txt->GetTitle();
635 fSelLabel = new TGLabel(tf4, s.Sizeof()>30?s(0,30)+"...":s);
637 kLHintsCenterY, 0, 6, 2, 0));
638 Pixel_t color;
639 gClient->GetColorByName("#336666", color);
641 TGCompositeFrame *tf5 = new TGCompositeFrame(tf4, 120, 20,
643 fSetParam = new TGTextButton(tf5, "Set Parameters...", kFP_PARS);
647 fSetParam->SetToolTipText("Open a dialog for parameter(s) settings");
648 tf4->AddFrame(tf5, new TGLayoutHints(kLHintsRight |
649 kLHintsTop, 5, 0, 2, 2));
650 gf1->AddFrame(tf4, new TGLayoutHints(kLHintsNormal |
651 kLHintsExpandX, 5, 0, 0, 0));
652
653 this->AddFrame(gf1, new TGLayoutHints(kLHintsExpandX, 5, 5, 0, 0));
654
655}
656
657////////////////////////////////////////////////////////////////////////////////
658/// Create 'General' tab.
659
661{
662 fTabContainer = fTab->AddTab("General");
666 5, 5, 2, 2));
667
668 // 'options' group frame
669 TGGroupFrame *gf = new TGGroupFrame(fGeneral, "Fit Settings", kFitWidth);
670
671 // 'method' sub-group
673 TGLabel *label4 = new TGLabel(h1, "Method");
674 h1->AddFrame(label4, new TGLayoutHints(kLHintsNormal |
675 kLHintsCenterY, 2, 2, 0, 0));
677 h1->AddFrame(hline1, new TGLayoutHints(kLHintsCenterY | kLHintsExpandX));
679
681 TGVerticalFrame *v1 = new TGVerticalFrame(h2);
684 fMethodList->Resize(140, 20);
686 Int_t lbe = lb->GetNumberOfEntries();
687 lb->Resize(lb->GetWidth(), lbe*16);
688 v1->AddFrame(fMethodList, new TGLayoutHints(kLHintsLeft, 0, 0, 2, 5));
689
690 fLinearFit = new TGCheckButton(v1, "Linear fit", kFP_MLINF);
691 fLinearFit->Associate(this);
692 fLinearFit->SetToolTipText("Perform Linear fitter if selected");
693 v1->AddFrame(fLinearFit, new TGLayoutHints(kLHintsNormal, 0, 0, 8, 2));
694
695
697
698 TGVerticalFrame *v2 = new TGVerticalFrame(h2);
699 TGCompositeFrame *v21 = new TGCompositeFrame(v2, 120, 20,
701 fUserButton = new TGTextButton(v21, "User-Defined...", kFP_MUSR);
705 fUserButton->SetToolTipText("Open a dialog for entering a user-defined method");
708
710 fEnableRobust = new TGCheckButton(v1h, "Robust:", -1);
711 fEnableRobust->Associate(this); // needed ???
712 fEnableRobust->SetToolTipText("Perform Linear Robust fitter if selected");
713 v1h->AddFrame(fEnableRobust, new TGLayoutHints(kLHintsNormal, 0, 0, 2, 2));
714 fRobustValue = new TGNumberEntry(v1h, 0.95, 5, kFP_RBUST,
719 v2->AddFrame(v1h, new TGLayoutHints(kLHintsNormal, 0, 0, 12, 2));
721 fRobustValue->GetNumberEntry()->SetToolTipText("Available only for graphs");
722
723 fNoChi2 = 0;
724 // fNoChi2 = new TGCheckButton(v2, "No Chi-square", kFP_NOCHI);
725 // fNoChi2->Associate(this);
726 // fNoChi2->SetToolTipText("'C'- do not calculate Chi-square (for Linear fitter)");
727 // v2->AddFrame(fNoChi2, new TGLayoutHints(kLHintsNormal, 0, 0, 34, 2));
728
729 h2->AddFrame(v2, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 20, 0, 0, 0));
730 gf->AddFrame(h2, new TGLayoutHints(kLHintsExpandX, 20, 0, 0, 0));
731
732 // 'fit option' sub-group
734 TGLabel *label5 = new TGLabel(h3, "Fit Options");
735 h3->AddFrame(label5, new TGLayoutHints(kLHintsNormal |
736 kLHintsCenterY, 2, 2, 0, 0));
737 TGHorizontal3DLine *hline2 = new TGHorizontal3DLine(h3);
740
743 fIntegral = new TGCheckButton(v3, "Integral", kFP_INTEG);
744 fIntegral->Associate(this);
745 fIntegral->SetToolTipText("'I'- use integral of function instead of value in bin center");
746 v3->AddFrame(fIntegral, new TGLayoutHints(kLHintsNormal, 0, 0, 2, 2));
747
748 fBestErrors = new TGCheckButton(v3, "Best errors", kFP_IMERR);
749 fBestErrors->Associate(this);
750 fBestErrors->SetToolTipText("'E'- better errors estimation using Minos technique");
751 v3->AddFrame(fBestErrors, new TGLayoutHints(kLHintsNormal, 0, 0, 2, 2));
752
753 fAllWeights1 = new TGCheckButton(v3, "All weights = 1", kFP_ALLW1);
754 fAllWeights1->Associate(this);
755 fAllWeights1->SetToolTipText("'W'- all weights=1 for non empty bins; error bars ignored");
756 v3->AddFrame(fAllWeights1, new TGLayoutHints(kLHintsNormal, 0, 0, 2, 2));
757
758 fEmptyBinsWghts1 = new TGCheckButton(v3, "Empty bins, weights=1", kFP_EMPW1);
760 fEmptyBinsWghts1->SetToolTipText("'WW'- all weights=1 including empty bins; error bars ignored");
762
763 h->AddFrame(v3, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
764
766 fUseRange = new TGCheckButton(v4, "Use range", kFP_USERG);
767 fUseRange->Associate(this);
768 fUseRange->SetToolTipText("'R'- fit only data within the specified function range");
769 v4->AddFrame(fUseRange, new TGLayoutHints(kLHintsNormal, 0, 0, 2, 2));
770
771 fImproveResults = new TGCheckButton(v4, "Improve fit results", kFP_IFITR);
773 fImproveResults->SetToolTipText("'M'- after minimum is found, search for a new one");
775
776 fAdd2FuncList = new TGCheckButton(v4, "Add to list", kFP_ADDLS);
778 fAdd2FuncList->SetToolTipText("'+'- add function to the list without deleting the previous");
779 v4->AddFrame(fAdd2FuncList, new TGLayoutHints(kLHintsNormal, 0, 0, 2, 2));
780
781 fUseGradient = new TGCheckButton(v4, "Use Gradient", kFP_ADDLS);
782 fUseGradient->Associate(this);
783 fUseGradient->SetToolTipText("'G'- Use the gradient as an aid for the fitting");
784 v4->AddFrame(fUseGradient, new TGLayoutHints(kLHintsNormal, 0, 0, 2, 2));
785
786 h->AddFrame(v4, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 20, 0, 0, 0));
787 gf->AddFrame(h, new TGLayoutHints(kLHintsExpandX, 20, 0, 0, 0));
788
789 // 'draw option' sub-group
791 TGLabel *label6 = new TGLabel(h5, "Draw Options");
792 h5->AddFrame(label6, new TGLayoutHints(kLHintsNormal |
793 kLHintsCenterY, 2, 2, 2, 2));
794 TGHorizontal3DLine *hline3 = new TGHorizontal3DLine(h5);
797
799 TGVerticalFrame *v5 = new TGVerticalFrame(h6);
800
801 fDrawSame = new TGCheckButton(v5, "SAME", kFP_DSAME);
802 fDrawSame->Associate(this);
803 fDrawSame->SetToolTipText("Superimpose on previous picture in the same pad");
804 v5->AddFrame(fDrawSame, new TGLayoutHints(kLHintsNormal, 0, 0, 2, 2));
805
806 fNoDrawing = new TGCheckButton(v5, "No drawing", kFP_DNONE);
807 fNoDrawing->Associate(this);
808 fNoDrawing->SetToolTipText("'0'- do not draw function graphics");
809 v5->AddFrame(fNoDrawing, new TGLayoutHints(kLHintsNormal, 0, 0, 2, 2));
810
811 fNoStoreDrawing = new TGCheckButton(v5, "Do not store/draw", kFP_DNOST);
813 fNoStoreDrawing->SetToolTipText("'N'- do not store the function, do not draw it");
815
817
818 TGVerticalFrame *v6 = new TGVerticalFrame(h6);
819 TGCompositeFrame *v61 = new TGCompositeFrame(v6, 120, 20,
821 fDrawAdvanced = new TGTextButton(v61, "&Advanced...", kFP_DADVB);
825 fDrawAdvanced->SetToolTipText("Open a dialog for advanced draw options");
827
829 0, 0, (4+fDrawSame->GetHeight())*2, 0));
830
832 gf->AddFrame(h6, new TGLayoutHints(kLHintsExpandX, 20, 0, 2, 0));
833
835 kLHintsExpandY, 5, 5, 0, 0));
836 // sliderX
838 TGLabel *label8 = new TGLabel(fSliderXParent, "X");
840 kLHintsCenterY, 0, 5, 0, 0));
841
847
849 fSliderX->SetScale(5);
851
852
859
860 // sliderY
862 TGLabel *label9 = new TGLabel(fSliderYParent, "Y");
864 kLHintsCenterY, 0, 5, 0, 0));
865
871
873 fSliderY->SetScale(5);
875
882
883 // sliderZ
885 TGLabel *label10 = new TGLabel(fSliderZParent, "Z:");
887 kLHintsCenterY, 0, 5, 0, 0));
889 fSliderZ->SetScale(5);
893}
894
895
896////////////////////////////////////////////////////////////////////////////////
897/// Create 'Minimization' tab.
898
900{
901 fTabContainer = fTab->AddTab("Minimization");
905 5, 5, 2, 2));
906 MakeTitle(fMinimization, "Library");
907
909 fLibMinuit = new TGRadioButton(hl, "Minuit", kFP_LMIN);
910 fLibMinuit->Associate(this);
911 fLibMinuit->SetToolTipText("Use minimization from libMinuit (default)");
912 hl->AddFrame(fLibMinuit, new TGLayoutHints(kLHintsNormal, 40, 0, 0, 1));
913 fStatusBar->SetText("LIB Minuit",1);
914
915 fLibMinuit2 = new TGRadioButton(hl, "Minuit2", kFP_LMIN2);
916 fLibMinuit2->Associate(this);
917 fLibMinuit2->SetToolTipText("New C++ version of Minuit");
918 hl->AddFrame(fLibMinuit2, new TGLayoutHints(kLHintsNormal, 35, 0, 0, 1));
919
920 fLibFumili = new TGRadioButton(hl, "Fumili", kFP_LFUM);
921 fLibFumili->Associate(this);
922 fLibFumili->SetToolTipText("Use minimization from libFumili");
923 hl->AddFrame(fLibFumili, new TGLayoutHints(kLHintsNormal, 30, 0, 0, 1));
924 fMinimization->AddFrame(hl, new TGLayoutHints(kLHintsExpandX, 20, 0, 5, 1));
925
927
928 fLibGSL = new TGRadioButton(hl2, "GSL", kFP_LGSL);
929 #ifdef R__HAS_MATHMORE
930 fLibGSL->Associate(this);
931 fLibGSL->SetToolTipText("Use minimization from libGSL");
932 #else
934 fLibGSL->SetToolTipText("Needs GSL to be compiled");
935 #endif
936 hl2->AddFrame(fLibGSL, new TGLayoutHints(kLHintsNormal, 40, 0, 0, 1));
937
938 fLibGenetics = new TGRadioButton(hl2, "Genetics", kFP_LGAS);
939 if (gPluginMgr->FindHandler("ROOT::Math::Minimizer","Genetic") ||
940 gPluginMgr->FindHandler("ROOT::Math::Minimizer","GAlibMin") )
941 {
942 fLibGenetics->Associate(this);
943 fLibGenetics->SetToolTipText("Different GAs implementations");
944 } else {
946 fLibGenetics->SetToolTipText("Needs any of the genetic"
947 "minimizers to be compiled");
948 }
949 hl2->AddFrame(fLibGenetics, new TGLayoutHints(kLHintsNormal, 45, 0, 0, 1));
950
951 fMinimization->AddFrame(hl2, new TGLayoutHints(kLHintsExpandX, 20, 0, 5, 1));
952
953 MakeTitle(fMinimization, "Method");
954
957 fMinMethodList->Resize(290, 20);
959
961 lb->Resize(lb->GetWidth(), 500);
963
965 fMinimization->AddFrame(hm0, new TGLayoutHints(kLHintsExpandX, 60, 0, 5, 1));
966
967 // Set the status to the default minimization options!
970 } else if ( ROOT::Math::MinimizerOptions::DefaultMinimizerType() == "Minuit" ) {
972 } else {
974 }
976
977 MakeTitle(fMinimization, "Settings");
978 TGLabel *hslabel1 = new TGLabel(fMinimization,"Use ENTER key to validate a new value or click");
979 fMinimization->AddFrame(hslabel1, new TGLayoutHints(kLHintsNormal, 61, 0, 5, 1));
980 TGLabel *hslabel2 = new TGLabel(fMinimization,"on Reset button to set the defaults.");
981 fMinimization->AddFrame(hslabel2, new TGLayoutHints(kLHintsNormal, 61, 0, 1, 10));
982
984
985 TGVerticalFrame *hsv1 = new TGVerticalFrame(hs, 180, 10, kFixedWidth);
986 TGLabel *errlabel = new TGLabel(hsv1,"Error definition (default = 1): ");
987 hsv1->AddFrame(errlabel, new TGLayoutHints(kLHintsLeft | kLHintsCenterY,
988 1, 1, 5, 7));
989 TGLabel *tollabel = new TGLabel(hsv1,"Max tolerance (precision): ");
990 hsv1->AddFrame(tollabel, new TGLayoutHints(kLHintsLeft | kLHintsCenterY,
991 1, 1, 5, 7));
992 TGLabel *itrlabel = new TGLabel(hsv1,"Max number of iterations: ");
993 hsv1->AddFrame(itrlabel, new TGLayoutHints(kLHintsLeft | kLHintsCenterY,
994 1, 1, 5, 5));
995 hs->AddFrame(hsv1, new TGLayoutHints(kLHintsNormal, 60, 0, 0, 0));
996
997 TGVerticalFrame *hsv2 = new TGVerticalFrame(hs, 90,10, kFixedWidth);
1003 1, 1, 0, 3));
1010 1, 1, 3, 3));
1011 fIterations = new TGNumberEntryField(hsv2, kFP_MITR, 5000,
1017 1, 1, 3, 3));
1018 hs->AddFrame(hsv2, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
1019 fMinimization->AddFrame(hs, new TGLayoutHints(kLHintsExpandX, 0, 0, 1, 1));
1021
1022 MakeTitle(fMinimization, "Print Options");
1023
1025 fOptDefault = new TGRadioButton(h8, "Default", kFP_PDEF);
1026 fOptDefault->Associate(this);
1027 fOptDefault->SetToolTipText("Default is between Verbose and Quiet");
1028 h8->AddFrame(fOptDefault, new TGLayoutHints(kLHintsNormal, 40, 0, 0, 1));
1030 fStatusBar->SetText("Prn: DEF",4);
1031
1032 fOptVerbose = new TGRadioButton(h8, "Verbose", kFP_PVER);
1033 fOptVerbose->Associate(this);
1034 fOptVerbose->SetToolTipText("'V'- print results after each iteration");
1035 h8->AddFrame(fOptVerbose, new TGLayoutHints(kLHintsNormal, 30, 0, 0, 1));
1036
1037 fOptQuiet = new TGRadioButton(h8, "Quiet", kFP_PQET);
1038 fOptQuiet->Associate(this);
1039 fOptQuiet->SetToolTipText("'Q'- no print");
1040 h8->AddFrame(fOptQuiet, new TGLayoutHints(kLHintsNormal, 25, 0, 0, 1));
1041
1042 fMinimization->AddFrame(h8, new TGLayoutHints(kLHintsExpandX, 20, 0, 5, 1));
1043
1044}
1045
1046////////////////////////////////////////////////////////////////////////////////
1047/// Connect GUI signals to fit panel slots.
1048
1050{
1051 // list of data sets to fit
1052 fDataSet -> Connect("Selected(Int_t)", "TFitEditor", this, "DoDataSet(Int_t)");
1053 // list of predefined functions
1054 fTypeFit -> Connect("Selected(Int_t)", "TFitEditor", this, "FillFunctionList(Int_t)");
1055 // list of predefined functions
1056 fFuncList -> Connect("Selected(Int_t)", "TFitEditor", this, "DoFunction(Int_t)");
1057 // entered formula or function name
1058 fEnteredFunc -> Connect("ReturnPressed()", "TFitEditor", this, "DoEnteredFunction()");
1059 // set parameters dialog
1060 fSetParam -> Connect("Clicked()", "TFitEditor", this, "DoSetParameters()");
1061 // allowed function operations
1062 fAdd -> Connect("Toggled(Bool_t)", "TFitEditor", this, "DoAddition(Bool_t)");
1063 //fNormAdd -> Connect("Toggled(Bool_t)", "TFitEditor", this, "DoNormAddition(Bool_t)");
1064 //fConv -> Connect("Toggled(Bool_t)", "TFitEditor", this, "DoConvolution(Bool_t)");
1065 // fit options
1066 fAllWeights1 -> Connect("Toggled(Bool_t)", "TFitEditor", this, "DoAllWeights1()");
1067 fUseRange -> Connect("Toggled(Bool_t)", "TFitEditor", this, "DoUseFuncRange()");
1068 fEmptyBinsWghts1 -> Connect("Toggled(Bool_t)", "TFitEditor", this, "DoEmptyBinsAllWeights1()");
1069 // linear fit
1070 fLinearFit -> Connect("Toggled(Bool_t)", "TFitEditor", this, "DoLinearFit()");
1071 fEnableRobust -> Connect("Toggled(Bool_t)", "TFitEditor", this, "DoRobustFit()");
1072 //fNoChi2->Connect("Toggled(Bool_t)","TFitEditor",this,"DoNoChi2()");
1073 // draw options
1074 fNoStoreDrawing -> Connect("Toggled(Bool_t)", "TFitEditor", this, "DoNoStoreDrawing()");
1075 // fit, reset, close buttons
1076 fUpdateButton -> Connect("Clicked()", "TFitEditor", this, "DoUpdate()");
1077 fFitButton -> Connect("Clicked()", "TFitEditor", this, "DoFit()");
1078 fResetButton -> Connect("Clicked()", "TFitEditor", this, "DoReset()");
1079 fCloseButton -> Connect("Clicked()", "TFitEditor", this, "DoClose()");
1080 // user method button
1081 fUserButton -> Connect("Clicked()", "TFitEditor", this, "DoUserDialog()");
1082 // advanced draw options
1083 fDrawAdvanced -> Connect("Clicked()", "TFitEditor", this, "DoAdvancedOptions()");
1084
1085 if (fType != kObjectTree)
1086 {
1087 fSliderX -> Connect("PositionChanged()","TFitEditor",this, "DoSliderXMoved()");
1088 fSliderXMax -> Connect("ValueSet(Long_t)", "TFitEditor",this, "DoNumericSliderXChanged()");
1089 fSliderXMin -> Connect("ValueSet(Long_t)", "TFitEditor",this, "DoNumericSliderXChanged()");
1090 }
1091 if (fDim > 1)
1092 {
1093 fSliderY -> Connect("PositionChanged()","TFitEditor",this, "DoSliderYMoved()");
1094 fSliderYMax -> Connect("ValueSet(Long_t)", "TFitEditor",this, "DoNumericSliderYChanged()");
1095 fSliderYMin -> Connect("ValueSet(Long_t)", "TFitEditor",this, "DoNumericSliderYChanged()");
1096 }
1097 if (fDim > 2)
1098 fSliderZ -> Connect("PositionChanged()","TFitEditor",this, "DoSliderZMoved()");
1099
1100 if ( fParentPad )
1101 fParentPad -> Connect("RangeAxisChanged()","TFitEditor",this, "UpdateGUI()");
1102 // 'Minimization' tab
1103 // library
1104 fLibMinuit -> Connect("Toggled(Bool_t)", "TFitEditor", this, "DoLibrary(Bool_t)");
1105 fLibMinuit2 -> Connect("Toggled(Bool_t)", "TFitEditor", this, "DoLibrary(Bool_t)");
1106 fLibFumili -> Connect("Toggled(Bool_t)", "TFitEditor", this, "DoLibrary(Bool_t)");
1107 fLibGSL -> Connect("Toggled(Bool_t)", "TFitEditor", this, "DoLibrary(Bool_t)");
1108 fLibGenetics -> Connect("Toggled(Bool_t)", "TFitEditor", this, "DoLibrary(Bool_t)");
1109
1110 // minimization method
1111 fMinMethodList -> Connect("Selected(Int_t)", "TFitEditor", this, "DoMinMethod(Int_t)");
1112 // fitter settings
1113 fIterations -> Connect("ReturnPressed()", "TFitEditor", this, "DoMaxIterations()");
1114 // print options
1115 fOptDefault -> Connect("Toggled(Bool_t)", "TFitEditor", this, "DoPrintOpt(Bool_t)");
1116 fOptVerbose -> Connect("Toggled(Bool_t)", "TFitEditor", this, "DoPrintOpt(Bool_t)");
1117 fOptQuiet -> Connect("Toggled(Bool_t)", "TFitEditor", this, "DoPrintOpt(Bool_t)");
1118
1119}
1120
1121////////////////////////////////////////////////////////////////////////////////
1122/// Disconnect GUI signals from fit panel slots.
1123
1125{
1126 Disconnect("CloseWindow()");
1127
1128 fFuncList -> Disconnect("Selected(Int_t)");
1129 fEnteredFunc -> Disconnect("ReturnPressed()");
1130 fSetParam -> Disconnect("Clicked()");
1131 fAdd -> Disconnect("Toggled(Bool_t)");
1132 // fNormAdd -> Disconnect("Toggled(Bool_t)");
1133 // fConv -> Disconnect("Toggled(Bool_t)");
1134
1135 // fit options
1136 fAllWeights1 -> Disconnect("Toggled(Bool_t)");
1137 fEmptyBinsWghts1 -> Disconnect("Toggled(Bool_t)");
1138
1139 // linear fit
1140 fLinearFit -> Disconnect("Toggled(Bool_t)");
1141 fEnableRobust -> Disconnect("Toggled(Bool_t)");
1142 //fNoChi2->Disconnect("Toggled(Bool_t)");
1143
1144 // draw options
1145 fNoStoreDrawing -> Disconnect("Toggled(Bool_t)");
1146
1147 // fit, reset, close buttons
1148 fFitButton -> Disconnect("Clicked()");
1149 fResetButton -> Disconnect("Clicked()");
1150
1151 // other methods
1152 fUserButton -> Disconnect("Clicked()");
1153 fDrawAdvanced -> Disconnect("Clicked()");
1154
1155 if (fType != kObjectTree)
1156 {
1157 fSliderX -> Disconnect("PositionChanged()");
1158 fSliderXMax -> Disconnect("ValueChanged(Long_t)");
1159 fSliderXMin -> Disconnect("ValueChanged(Long_t)");
1160 }
1161 if (fDim > 1)
1162 {
1163 fSliderY -> Disconnect("PositionChanged()");
1164 fSliderYMax -> Disconnect("ValueChanged(Long_t)");
1165 fSliderYMin -> Disconnect("ValueChanged(Long_t)");
1166 }
1167 if (fDim > 2)
1168 fSliderZ -> Disconnect("PositionChanged()");
1169 // slots related to 'Minimization' tab
1170 fLibMinuit -> Disconnect("Toggled(Bool_t)");
1171 fLibMinuit2 -> Disconnect("Toggled(Bool_t)");
1172 fLibFumili -> Disconnect("Toggled(Bool_t)");
1173 fLibGSL -> Disconnect("Toggled(Bool_t)");
1174 fLibGenetics -> Disconnect("Toggled(Bool_t)");
1175 // minimization method
1176 fMinMethodList -> Disconnect("Selected(Int_t)");
1177 // fitter settings
1178 fIterations -> Disconnect("ReturnPressed()");
1179 // print options
1180 fOptDefault -> Disconnect("Toggled(Bool_t)");
1181 fOptVerbose -> Disconnect("Toggled(Bool_t)");
1182 fOptQuiet -> Disconnect("Toggled(Bool_t)");
1183
1184}
1185
1186////////////////////////////////////////////////////////////////////////////////
1187/// Connect to another canvas.
1188
1190{
1191 // The next line is commented because it is stablishing a
1192 // connection with the particular canvas, while right the following
1193 // line will connect all the canvas in a general way.
1194
1195 // It would also make the fitpanel crash if there is no object
1196 // defined to be fitted in the construction (as a side effect of
1197 // it).
1198
1199// newcan->Connect("Selected(TVirtualPad*,TObject*,Int_t)", "TFitEditor",
1200// this, "SetFitObject(TVirtualPad *, TObject *, Int_t)");
1201
1202 TQObject::Connect("TCanvas", "Selected(TVirtualPad *, TObject *, Int_t)",
1203 "TFitEditor",this,
1204 "SetFitObject(TVirtualPad *, TObject *, Int_t)");
1205 TQObject::Connect("TCanvas", "Closed()", "TFitEditor", this, "DoNoSelection()");
1206}
1207
1208////////////////////////////////////////////////////////////////////////////////
1209/// Hide the fit panel and set it to non-active state.
1210
1212{
1213 if (fgFitDialog) {
1215 }
1216 if (fParentPad) {
1217 fParentPad->Disconnect("RangeAxisChanged()");
1218 DoReset();
1219 TQObject::Disconnect("TCanvas", "Selected(TVirtualPad *, TObject *, Int_t)",
1220 this, "SetFitObject(TVirtualPad *, TObject *, Int_t)");
1221 }
1222 fParentPad = 0;
1223 fFitObject = 0;
1224 gROOT->GetListOfCleanups()->Remove(this);
1225}
1226
1227////////////////////////////////////////////////////////////////////////////////
1228/// Show the fit panel (possible only via context menu).
1229
1231{
1232 if (!gROOT->GetListOfCleanups()->FindObject(this))
1233 gROOT->GetListOfCleanups()->Add(this);
1234
1235 if (!fgFitDialog->IsMapped()) {
1237 gVirtualX->RaiseWindow(GetId());
1238 }
1239 fParentPad = static_cast<TPad*>(pad);
1240 SetCanvas(pad->GetCanvas());
1241 SetFitObject(pad, obj, kButton1Down);
1242}
1243
1244////////////////////////////////////////////////////////////////////////////////
1245/// Close fit panel window.
1246
1248{
1249 Hide();
1250}
1251
1252//______________________________________________________________________________
1253// TFitEditor *&TFitEditor::GetFP()
1254// {
1255// // Static: return main fit panel
1256// return fgFitDialog;
1257// }
1258
1259////////////////////////////////////////////////////////////////////////////////
1260/// Called to delete the fit panel.
1261
1263{
1264 TQObject::Disconnect("TCanvas", "Closed()");
1265 delete fgFitDialog;
1266 fgFitDialog = 0;
1267}
1268
1269////////////////////////////////////////////////////////////////////////////////
1270/// Set the fit panel GUI according to the selected object.
1271
1273{
1274 if (!fFitObject) return;
1275
1276 DrawSelection(true);
1277
1278 if ( fType == kObjectTree )
1279 // Don't do anything with the sliders, as they work with TAxis
1280 // that are not defined for the TTree
1281 return;
1282
1283 // sliders
1284 if (fType != kObjectTree) { // This is as fDim > 0
1285 TH1* hist = 0;
1286 switch (fType) {
1287 case kObjectHisto:
1288 hist = (TH1*)fFitObject;
1289 break;
1290
1291 case kObjectGraph:
1292 hist = ((TGraph*)fFitObject)->GetHistogram();
1293 break;
1294
1295 case kObjectMultiGraph:
1296 hist = ((TMultiGraph*)fFitObject)->GetHistogram();
1297 break;
1298
1299 case kObjectGraph2D:
1300 hist = ((TGraph2D*)fFitObject)->GetHistogram("empty");
1301 break;
1302
1303 case kObjectHStack:
1304 hist = (TH1 *)((THStack *)fFitObject)->GetHists()->First();
1305
1306 case kObjectTree:
1307 default:
1308 break;
1309 }
1310
1311
1312 if (!hist) {
1313 Error("UpdateGUI","No hist is present - this should not happen, please report."
1314 "The FitPanel might be in an inconsistent state");
1315 //assert(hist);
1316 return;
1317 }
1318
1319 fSliderX->Disconnect("PositionChanged()");
1320 fSliderXMin->Disconnect("ValueChanged()");
1321 fSliderXMax->Disconnect("ValueChanged()");
1322
1323 if (!fSliderXParent->IsMapped())
1325
1326 fXaxis = hist->GetXaxis();
1327 fYaxis = hist->GetYaxis();
1328 fZaxis = hist->GetZaxis();
1329 Int_t ixrange = fXaxis->GetNbins();
1330 Int_t ixmin = fXaxis->GetFirst();
1331 Int_t ixmax = fXaxis->GetLast();
1332
1333 if (ixmin > 1 || ixmax < ixrange) {
1334 fSliderX->SetRange(ixmin,ixmax);
1335 fSliderX->SetPosition(ixmin, ixmax);
1336 } else {
1337 fSliderX->SetRange(1,ixrange);
1338 fSliderX->SetPosition(ixmin,ixmax);
1339 }
1340
1341 fSliderX->SetScale(5);
1342
1344 fXaxis->GetBinLowEdge( static_cast<Int_t>( fSliderX->GetMinPosition() ) ),
1345 fXaxis->GetBinUpEdge ( static_cast<Int_t>( fSliderX->GetMaxPosition() ) ));
1348 fXaxis->GetBinLowEdge( static_cast<Int_t>( fSliderX->GetMinPosition() ) ),
1349 fXaxis->GetBinUpEdge ( static_cast<Int_t>( fSliderX->GetMaxPosition() ) ));
1351
1352 fSliderX->Connect("PositionChanged()","TFitEditor",this, "DoSliderXMoved()");
1353 fSliderXMax->Connect("ValueSet(Long_t)", "TFitEditor", this, "DoNumericSliderXChanged()");
1354 fSliderXMin->Connect("ValueSet(Long_t)", "TFitEditor", this, "DoNumericSliderXChanged()");
1355 }
1356
1357 if (fDim > 1) {
1358 fSliderY->Disconnect("PositionChanged()");
1359 fSliderYMin->Disconnect("ValueChanged()");
1360 fSliderYMax->Disconnect("ValueChanged()");
1361
1362 if (!fSliderYParent->IsMapped())
1364 if (fSliderZParent->IsMapped())
1366
1367 Int_t iymin = 0, iymax = 0, iyrange = 0;
1368 switch (fType) {
1369 case kObjectHisto:
1370 case kObjectGraph2D:
1371 case kObjectHStack:
1372 iyrange = fYaxis->GetNbins();
1373 iymin = fYaxis->GetFirst();
1374 iymax = fYaxis->GetLast();
1375 break;
1376
1377 case kObjectGraph:
1378 case kObjectMultiGraph:
1379 case kObjectTree:
1380 default:
1381 //not implemented
1382 break;
1383 }
1384
1385 if (iymin > 1 || iymax < iyrange) {
1386 fSliderY->SetRange(iymin,iymax);
1387 fSliderY->SetPosition(iymin, iymax);
1388 } else {
1389 fSliderY->SetRange(1,iyrange);
1390 fSliderY->SetPosition(iymin,iymax);
1391 }
1392
1393 fSliderY->SetScale(5);
1394
1396 fYaxis->GetBinLowEdge( static_cast<Int_t>( fSliderY->GetMinPosition() ) ),
1397 fYaxis->GetBinUpEdge ( static_cast<Int_t>( fSliderY->GetMaxPosition() ) ));
1400 fYaxis->GetBinLowEdge( static_cast<Int_t>( fSliderY->GetMinPosition() ) ),
1401 fYaxis->GetBinUpEdge ( static_cast<Int_t>( fSliderY->GetMaxPosition() ) ));
1403
1404 fSliderY->Connect("PositionChanged()","TFitEditor",this, "DoSliderYMoved()");
1405 fSliderYMax->Connect("ValueSet(Long_t)", "TFitEditor", this, "DoNumericSliderYChanged()");
1406 fSliderYMin->Connect("ValueSet(Long_t)", "TFitEditor", this, "DoNumericSliderYChanged()");
1407 }
1408
1409
1410 if (fDim > 2) {
1411 fSliderZ->Disconnect("PositionChanged()");
1412
1413 if (!fSliderZParent->IsMapped())
1415
1416 Int_t izmin = 0, izmax = 0, izrange = 0;
1417 switch (fType) {
1418 case kObjectHStack:
1419 case kObjectHisto:
1420 izrange = fZaxis->GetNbins();
1421 izmin = fZaxis->GetFirst();
1422 izmax = fZaxis->GetLast();
1423 break;
1424
1425 case kObjectGraph:
1426 case kObjectGraph2D:
1427 case kObjectMultiGraph:
1428 case kObjectTree:
1429 default:
1430 //not implemented
1431 break;
1432 }
1433
1434 if (izmin > 1 || izmax < izrange) {
1435 fSliderZ->SetRange(izmin,izmax);
1436 fSliderZ->SetPosition(izmin, izmax);
1437 } else {
1438 fSliderZ->SetRange(1,izrange);
1439 fSliderZ->SetPosition(izmin,izmax);
1440 }
1441
1442 fSliderZ->SetScale(5);
1443 fSliderZ->Connect("PositionChanged()","TFitEditor",this, "DoSliderZMoved()");
1444 }
1445}
1446
1447////////////////////////////////////////////////////////////////////////////////
1448/// Slot called when the user clicks on an object inside a canvas.
1449/// Updates pointers to the parent pad and the selected object
1450/// for fitting (if suitable).
1451
1453{
1454 if (event != kButton1Down) return;
1455
1456 if ( !obj ) {
1457 DoNoSelection();
1458 return;
1459 }
1460
1461 // is obj suitable for fitting?
1462 if (!SetObjectType(obj)) return;
1463
1464 fParentPad = pad;
1465 fFitObject = obj;
1466 ShowObjectName(obj);
1467 UpdateGUI();
1468
1469 ConnectSlots();
1470
1471 TF1* fitFunc = HasFitFunction();
1472
1473 if (fitFunc)
1474 {
1475 //fFuncPars = FuncParams_t( fitFunc->GetNpar() );
1476 GetParameters(fFuncPars, fitFunc);
1477
1478 TString tmpStr = fitFunc->GetExpFormula();
1479 TGLBEntry *en = 0;
1480 // If the function comes from a C raw function.
1481 if ( tmpStr.Length() == 0 )
1482 {
1483 // Show the name of the function
1484 fEnteredFunc->SetText(fitFunc->GetName());
1485 en= fFuncList->FindEntry(fitFunc->GetName());
1486 // Don't allow edition!
1488 }
1489 // otherwise, it's got a formula
1490 else
1491 {
1492 // Show the formula
1493 fEnteredFunc->SetText(fitFunc->GetExpFormula().Data());
1494 en= fFuncList->FindEntry(fitFunc->GetExpFormula().Data());
1496 }
1497 // Select the proper entry in the function list
1498 if (en) fFuncList->Select(en->EntryId());
1499 }
1500 else
1501 { // if there is no fit function in the object
1502 // Use the selected function in fFuncList
1504 // Add the text to fEnteredFunc
1505 if (te && fNone->GetState() == kButtonDown)
1507 else if (te && fAdd->GetState() == kButtonDown)
1508 {
1509 TString tmpStr = fEnteredFunc->GetText();
1510 tmpStr += '+';
1511 tmpStr += te->GetTitle();
1512 fEnteredFunc->SetText(tmpStr);
1513 }
1514 else if (te && fNormAdd->GetState() == kButtonDown)
1515 {
1516 TString tmpStr = fEnteredFunc->GetText();
1517 tmpStr += '+';
1518 tmpStr += te -> GetTitle();
1519 fEnteredFunc -> SetText(tmpStr);
1520 }
1521 else if (te && fConv->GetState() == kButtonDown)
1522 {
1523 TString tmpStr = fEnteredFunc->GetText();
1524 tmpStr += '*';
1525 tmpStr +=te->GetTitle();
1526 fEnteredFunc->SetText(tmpStr);
1527 }
1528 else if ( !te )
1529 // If there is no space, an error message is shown:
1530 // Error in <TString::AssertElement>: out of bounds: i = -1, Length = 0
1531 // If there is no function selected, then put nothing.
1532 fEnteredFunc->SetText(" ");
1533 }
1535
1536
1537 // Update the information about the selected object.
1544 DoLinearFit();
1545}
1546
1547////////////////////////////////////////////////////////////////////////////////
1548/// Slot called when users close a TCanvas or when the user select
1549/// no object.
1550
1552{
1553 if (gROOT->GetListOfCanvases()->IsEmpty()) {
1554 Terminate();
1555 return;
1556 }
1557
1558 // Minimize user interaction until an object is selected
1560 fParentPad = 0;
1561 fFitObject = 0;
1562 fStatusBar->SetText("No selection",0);
1564 Layout();
1565
1570}
1571
1572////////////////////////////////////////////////////////////////////////////////
1573/// When obj is deleted, clear fFitObject if fFitObject = obj.
1574
1576{
1577 if (obj == fFitObject) {
1578 fFitObject = 0;
1580 fStatusBar->SetText("No selection",0);
1582 Layout();
1583
1587
1588 TQObject::Connect("TCanvas", "Selected(TVirtualPad *, TObject *, Int_t)",
1589 "TFitEditor",this,
1590 "SetFitObject(TVirtualPad *, TObject *, Int_t)");
1591 TQObject::Connect("TCanvas", "Closed()", "TFitEditor", this,
1592 "DoNoSelection()");
1593
1594 DoUpdate();
1595 return;
1596 }
1597 if (obj == fParentPad) {
1598 fFitObject = 0;
1599 fParentPad = 0;
1601 fStatusBar->SetText("No selection",0);
1603 Layout();
1604
1608 }
1609}
1610
1611////////////////////////////////////////////////////////////////////////////////
1612/// Fills the list of functions depending on the type of fit
1613/// selected.
1614
1616{
1618 // Case when the user has selected predefined functions in 1D.
1619 if ( fTypeFit->GetSelected() == kFP_PRED1D && fDim <= 1 ) {
1620 // Fill function list combo box.
1621 fFuncList->AddEntry("gaus" , kFP_GAUS);
1622 fFuncList->AddEntry("gausn", kFP_GAUSN);
1623 fFuncList->AddEntry("expo", kFP_EXPO);
1624 fFuncList->AddEntry("landau", kFP_LAND);
1625 fFuncList->AddEntry("landaun",kFP_LANDN);
1626 fFuncList->AddEntry("pol0", kFP_POL0);
1627 fFuncList->AddEntry("pol1", kFP_POL1);
1628 fFuncList->AddEntry("pol2", kFP_POL2);
1629 fFuncList->AddEntry("pol3", kFP_POL3);
1630 fFuncList->AddEntry("pol4", kFP_POL4);
1631 fFuncList->AddEntry("pol5", kFP_POL5);
1632 fFuncList->AddEntry("pol6", kFP_POL6);
1633 fFuncList->AddEntry("pol7", kFP_POL7);
1634 fFuncList->AddEntry("pol8", kFP_POL8);
1635 fFuncList->AddEntry("pol9", kFP_POL9);
1636 fFuncList->AddEntry("cheb0", kFP_CHEB0);
1637 fFuncList->AddEntry("cheb1", kFP_CHEB1);
1638 fFuncList->AddEntry("cheb2", kFP_CHEB2);
1639 fFuncList->AddEntry("cheb3", kFP_CHEB3);
1640 fFuncList->AddEntry("cheb4", kFP_CHEB4);
1641 fFuncList->AddEntry("cheb5", kFP_CHEB5);
1642 fFuncList->AddEntry("cheb6", kFP_CHEB6);
1643 fFuncList->AddEntry("cheb7", kFP_CHEB7);
1644 fFuncList->AddEntry("cheb8", kFP_CHEB8);
1645 fFuncList->AddEntry("cheb9", kFP_CHEB9);
1646 fFuncList->AddEntry("user", kFP_USER);
1647
1648 // Need to be setted this way, otherwise when the functions
1649 // are removed, the list doesn't show them.
1651 lb->Resize(lb->GetWidth(), 200);
1652
1653 // Select Gaus1D by default
1655
1656 }
1657 // Case for predefined 2D functions
1658 else if ( fTypeFit->GetSelected() == kFP_PRED2D && fDim == 2 ) {
1659 fFuncList->AddEntry("xygaus", kFP_XYGAUS);
1660 fFuncList->AddEntry("bigaus", kFP_BIGAUS);
1661 fFuncList->AddEntry("xyexpo", kFP_XYEXP);
1662 fFuncList->AddEntry("xylandau", kFP_XYLAN);
1663 fFuncList->AddEntry("xylandaun", kFP_XYLANN);
1664
1665 // Need to be setted this way, otherwise when the functions
1666 // are removed, the list doesn't show them.x
1668 lb->Resize(lb->GetWidth(), 200);
1669
1670 // Select Gaus2D by default
1672 }
1673 // Case for user defined functions. References to these functions
1674 // are kept by the fitpanel, so the information is gathered from
1675 // there.
1676 else if ( fTypeFit->GetSelected() == kFP_UFUNC ) {
1677 Int_t newid = kFP_ALTFUNC;
1678
1679 // Add system functions
1680 for ( fSystemFuncIter it = fSystemFuncs.begin();
1681 it != fSystemFuncs.end(); ++it ) {
1682 TF1* f = (*it);
1683 // Don't include system functions that has been previously
1684 // used to fit, as those are included under the kFP_PREVFIT
1685 // section.
1686 if ( strncmp(f->GetName(), "PrevFit", 7) != 0 ) {
1687 // If the dimension of the object coincides with the
1688 // dimension of the function, then include the function in
1689 // the list. It will also include de function if the
1690 // dimension of the object is 0 (i.e. a multivariable
1691 // TTree) as it is currently imposible to know how many
1692 // dimensions a TF1 coming from a C raw function has.
1693 if ( f->GetNdim() == fDim || fDim == 0) {
1694 fFuncList->AddEntry(f->GetName(), newid++);
1695 }
1696 }
1697 }
1698
1699 // If no function was added
1700 if ( newid != kFP_ALTFUNC )
1701 fFuncList->Select(newid-1);
1702 else if( fDim == 1 ) {
1703 // Select predefined 1D functions for 1D objects
1705 } else if( fDim == 2 ) {
1706 // Select predefined 2D functions for 2D objects
1708 }
1709 }
1710 // Case for previously used functions.
1711 else if ( fTypeFit->GetSelected() == kFP_PREVFIT ) {
1712 Int_t newid = kFP_ALTFUNC;
1713
1714 // Look only for those functions used in the selected object
1715 std::pair<fPrevFitIter, fPrevFitIter> look = fPrevFit.equal_range(fFitObject);
1716 // Then go over all those functions and add them to the list
1717 for ( fPrevFitIter it = look.first; it != look.second; ++it ) {
1718 fFuncList->AddEntry(it->second->GetName(), newid++);
1719 }
1720
1721 // If no functions were added.
1722 if ( newid == kFP_ALTFUNC ) {
1723 // Remove the entry previous fit from fTypeFit
1725 if( fDim == 1 )
1726 // Select predefined 1D functions for 1D objects
1728 else if ( fDim == 2 )
1729 // Select predefined 2D functions for 2D objects
1731 else
1732 // For more than 2 dimensions, select the user functions.
1734 }
1735 else
1736 // If there is there are previously used functions, select
1737 // the last one inserted.
1738 fFuncList->Select(newid-1, kTRUE);
1739 }
1740}
1741
1742////////////////////////////////////////////////////////////////////////////////
1743/// Fills the list of methods depending on the minimization library
1744/// selected.
1745
1747{
1749
1750 if ( fLibMinuit->GetState() == kButtonDown )
1751 {
1752 fMinMethodList->AddEntry("MIGRAD" , kFP_MIGRAD);
1753 fMinMethodList->AddEntry("SIMPLEX" , kFP_SIMPLX);
1754 fMinMethodList->AddEntry("SCAN" , kFP_SCAN);
1755 fMinMethodList->AddEntry("Combination" , kFP_COMBINATION);
1757 fStatusBar->SetText("MIGRAD",2);
1758 } else if ( fLibFumili->GetState() == kButtonDown )
1759 {
1760 fMinMethodList->AddEntry("FUMILI" , kFP_FUMILI);
1762 fStatusBar->SetText("FUMILI",2);
1763 } else if ( fLibGSL->GetState() == kButtonDown )
1764 {
1765 fMinMethodList->AddEntry("Fletcher-Reeves conjugate gradient" , kFP_GSLFR);
1766 fMinMethodList->AddEntry("Polak-Ribiere conjugate gradient" , kFP_GSLPR);
1767 fMinMethodList->AddEntry("BFGS conjugate gradient" , kFP_BFGS);
1768 fMinMethodList->AddEntry("BFGS conjugate gradient (Version 2)", kFP_BFGS2);
1769 fMinMethodList->AddEntry("Levenberg-Marquardt" , kFP_GSLLM);
1770 fMinMethodList->AddEntry("Simulated Annealing" , kFP_GSLSA);
1772 fStatusBar->SetText("CONJFR",2);
1773 } else if ( fLibGenetics->GetState() == kButtonDown )
1774 {
1775 if ( gPluginMgr->FindHandler("ROOT::Math::Minimizer","GAlibMin") ) {
1776 fMinMethodList->AddEntry("GA Lib Genetic Algorithm" , kFP_GALIB);
1778 } else if (gPluginMgr->FindHandler("ROOT::Math::Minimizer","Genetic")) {
1779 fMinMethodList->AddEntry("TMVA Genetic Algorithm" , kFP_TMVAGA);
1781 }
1782 } else // if ( fLibMinuit2->GetState() == kButtonDown )
1783 {
1784 fMinMethodList->AddEntry("MIGRAD" , kFP_MIGRAD);
1785 fMinMethodList->AddEntry("SIMPLEX" , kFP_SIMPLX);
1786 fMinMethodList->AddEntry("FUMILI" , kFP_FUMILI);
1787 fMinMethodList->AddEntry("SCAN" , kFP_SCAN);
1788 fMinMethodList->AddEntry("Combination" , kFP_COMBINATION);
1790 fStatusBar->SetText("MIGRAD",2);
1791 }
1792}
1793
1794void SearchCanvases(TSeqCollection* canvases, std::vector<TObject*>& objects)
1795{
1796 // Auxiliary function to recursively search for objects inside the
1797 // current canvases.
1798
1799 TIter canvasIter(canvases);
1800 // Iterate over all the canvases in canvases.
1801 while(TObject* obj = (TObject*) canvasIter()) {
1802 // If the object is another canvas, call this function
1803 // recursively.
1804 if ( TPad* can = dynamic_cast<TPad*>(obj))
1805 SearchCanvases(can->GetListOfPrimitives(), objects);
1806 // Otherwhise, if it's a recognised object, add it to the vector
1807 else if ( dynamic_cast<TH1*>(obj)
1808 || dynamic_cast<TGraph*>(obj)
1809 || dynamic_cast<TGraph2D*>(obj)
1810 || dynamic_cast<TMultiGraph*>(obj)
1811 || dynamic_cast<THStack*>(obj)
1812 || dynamic_cast<TTree*>(obj) ) {
1813 bool insertNew = true;
1814 // Be careful no to insert the same element twice.
1815 for ( std::vector<TObject*>::iterator i = objects.begin(); i != objects.end(); ++i )
1816 if ( (*i) == obj ) {
1817 insertNew = false;
1818 break;
1819 }
1820 // If the object is not already in the vector, then insert
1821 // it.
1822 if ( insertNew ) objects.push_back(obj);
1823 }
1824 }
1825}
1826
1827////////////////////////////////////////////////////////////////////////////////
1828/// Create a combo box with all the possible objects to be fitted.
1829
1831{
1832 // Get the title of the entry selected, so that we can select it
1833 // again once the fDataSet has been refilled.
1835 TString selEntryStr;
1836 if ( entry ) {
1837 selEntryStr = entry->GetTitle();
1838 }
1839
1840 // Remove all the elements
1842 std::vector<TObject*> objects;
1843
1844 // Get all the objects registered in gDirectory
1845 if (gDirectory) {
1846 TList * l = gDirectory->GetList();
1847 if (l) {
1848 TIter next(l);
1849 TObject* obj = NULL;
1850 while ( (obj = (TObject*) next()) ) {
1851 // But only if they are of a type recognized by the FitPanel
1852 if ( dynamic_cast<TH1*>(obj) ||
1853 dynamic_cast<TGraph2D*>(obj) ||
1854 dynamic_cast<TTree*>(obj) ) {
1855 objects.push_back(obj);
1856 }
1857 }
1858 }
1859 }
1860
1861 // Look for all the drawn objects. The method will take care the
1862 // same objects are not inserted twice.
1863 SearchCanvases(gROOT->GetListOfCanvases(), objects);
1864
1865 // Add all the objects stored in the vector
1866 int selected = kFP_NOSEL;
1867 // Add the No selection.
1868 Int_t newid = kFP_NOSEL;
1869 fDataSet->AddEntry("No Selection", newid++);
1870 for ( std::vector<TObject*>::iterator i = objects.begin(); i != objects.end(); ++i ) {
1871 // Insert the name as the class name followed by the name of the
1872 // object.
1873 TString name = (*i)->ClassName(); name.Append("::"); name.Append((*i)->GetName());
1874 // Check whether the names are the same!
1875 if ( selEntryStr && name == selEntryStr )
1876 selected = newid;
1877 fDataSet->AddEntry(name, newid++);
1878 }
1879
1880 // If there was an entry selected (which should be always the case
1881 // except the first time this method is executed), then make it the
1882 // selected one again.
1883 if (entry) {
1884 fDataSet->Select(selected);
1885 }
1886}
1887
1888////////////////////////////////////////////////////////////////////////////////
1889/// Create method list in a combo box.
1890
1892{
1893 TGComboBox *c = new TGComboBox(parent, id);
1894 c->AddEntry("Chi-square", kFP_MCHIS);
1895 c->AddEntry("Binned Likelihood", kFP_MBINL);
1896 c->AddEntry("Unbinned Likelihood", kFP_MUBIN);
1897 //c->AddEntry("User", kFP_MUSER); //for later use
1898 c->Select(kFP_MCHIS);
1899 return c;
1900}
1901
1902////////////////////////////////////////////////////////////////////////////////
1903/// Slot connected to advanced option button (opens a dialog).
1904
1906{
1908}
1909
1910////////////////////////////////////////////////////////////////////////////////
1911/// Slot connected to 'include emtry bins and forse all weights to 1' setting.
1912
1914{
1918}
1919
1920////////////////////////////////////////////////////////////////////////////////
1921
1923{
1924 if ( fUseRange->GetState() == kButtonDown ) {
1926 // Get the function
1927 TF1* tmpTF1 = FindFunction();
1928 if ( !tmpTF1 ) {
1931 tmpTF1 = (TF1*) GetFitObjectListOfFunctions()->FindObject( te->GetTitle() );
1932 }
1933 }
1934 // If the function has been retrieved, i.e. is a registered function.
1935 if ( tmpTF1 ) {
1936 Double_t xmin, ymin, zmin, xmax, ymax, zmax;
1937 // Get the range
1938 tmpTF1->GetRange(xmin, ymin, zmin, xmax, ymax, zmax);
1939 // And set the sliders
1940 if ( fType != kObjectTree ) {
1944 if ( fDim > 1 ) {
1948 }
1949 }
1950 }
1951 }
1953 }
1954}
1955
1956////////////////////////////////////////////////////////////////////////////////
1957/// Slot connected to 'set all weights to 1' setting.
1958
1960{
1964}
1965
1966////////////////////////////////////////////////////////////////////////////////
1967/// Close the fit panel.
1968
1970{
1971 Hide();
1972}
1973
1974////////////////////////////////////////////////////////////////////////////////
1975/// Easy here!
1976
1978{
1981}
1982
1983////////////////////////////////////////////////////////////////////////////////
1984/// Perform a fit with current parameters' settings.
1985
1987{
1988 if (!fFitObject) return;
1989 //if (!fParentPad) return;
1990
1991 // If fNone->GetState() == kButtonDisabled means the function is
1992 // not editable, i.e. it comes from a raw C function. So in this
1993 // case, it is editable and we have to check wheather the formula
1994 // is well built.
1996 {
1997 // If not, then show an error message and leave.
1999 "Error...", "2) Verify the entered function string!",
2000 kMBIconStop,kMBOk, 0);
2001 return;
2002 }
2003
2004 // Set the button so that the user cannot use it while fitting, set
2005 // the mouse to watch type and so on.
2007 if (gPad && gPad->GetVirtCanvas()) gPad->GetVirtCanvas()->SetCursor(kWatch);
2008 gVirtualX->SetCursor(GetId(), gVirtualX->CreateCursor(kWatch));
2009
2010 TVirtualPad *save = 0;
2011 if ( fParentPad ) {
2012 fParentPad->Disconnect("RangeAxisChanged()");
2013 save = gPad;
2014 gPad = fParentPad;
2015 fParentPad->cd();
2016
2017 if (fParentPad->GetCanvas())
2019 }
2020
2021 // Get the ranges from the sliders
2022 ROOT::Fit::DataRange drange;
2023 GetRanges(drange);
2024
2025 // Create a static pointer to fitFunc. Every second call to the
2026 // DoFit method, the old fitFunc is deleted. We need not to delete
2027 // the function after the fitting in case we want to do Advaced
2028 // graphics. The VirtualFitter need the function to be alived. One
2029 // problem, after the last fit the function is never deleted, but
2030 // ROOT's garbage collector will do the job for us.
2031 static TF1 *fitFunc = 0;
2032 if ( fitFunc ) {
2033 //std::cout << "TFitEditor::DoFit - deleting fit function " << fitFunc->GetName() << " " << fitFunc << std::endl;
2034 delete fitFunc;
2035 }
2036 fitFunc = GetFitFunction();
2037
2038 std::cout << "TFitEditor::DoFit - using function " << fitFunc->GetName() << " " << fitFunc << std::endl;
2039 // This assert
2040 if (!fitFunc) {
2041 Error("DoFit","This should have never happend, the fitfunc pointer is NULL! - Please Report" );
2042 return;
2043 }
2044
2045 // set parameters from panel in function
2046 SetParameters(fFuncPars, fitFunc);
2047 // Get the options stored in the GUI elements.
2049 Foption_t fitOpts;
2050 TString strDrawOpts;
2051 RetrieveOptions(fitOpts, strDrawOpts, mopts, fitFunc->GetNpar());
2052
2053 // Call the fit method, depending on the object to fit.
2054 switch (fType) {
2055 case kObjectHisto: {
2056
2057 TH1 *hist = dynamic_cast<TH1*>(fFitObject);
2058 if (hist)
2059 ROOT::Fit::FitObject(hist, fitFunc, fitOpts, mopts, strDrawOpts, drange);
2060
2061 break;
2062 }
2063 case kObjectGraph: {
2064
2065 TGraph *gr = dynamic_cast<TGraph*>(fFitObject);
2066 if (gr)
2067 FitObject(gr, fitFunc, fitOpts, mopts, strDrawOpts, drange);
2068 break;
2069 }
2070 case kObjectMultiGraph: {
2071
2072 TMultiGraph *mg = dynamic_cast<TMultiGraph*>(fFitObject);
2073 if (mg)
2074 FitObject(mg, fitFunc, fitOpts, mopts, strDrawOpts, drange);
2075
2076 break;
2077 }
2078 case kObjectGraph2D: {
2079
2080 TGraph2D *g2d = dynamic_cast<TGraph2D*>(fFitObject);
2081 if (g2d)
2082 FitObject(g2d, fitFunc, fitOpts, mopts, strDrawOpts, drange);
2083
2084 break;
2085 }
2086 case kObjectHStack: {
2087 // N/A
2088 break;
2089 }
2090 case kObjectTree: {
2091 // The three is a much more special case. The steps for
2092 // fitting have to be done manually here until they are
2093 // properly implemented within a FitObject method in
2094 // THFitImpl.cxx
2095
2096 // Retrieve the variables and cuts selected from the current
2097 // tree.
2099 TString cuts;
2101
2102 // This should be straight forward and the return should
2103 // never be called.
2104 TTree *tree = dynamic_cast<TTree*>(fFitObject);
2105 if ( !tree ) return;
2106
2107 // These method calls are just to set up everything for the
2108 // fitting. It's taken from another script.
2109 gROOT->ls();
2110 tree->Draw(variables,cuts,"goff");
2111
2112 TTreePlayer * player = (TTreePlayer*) tree->GetPlayer();
2113 if ( !player ) {
2114 Error("DoFit","Player reference is NULL");
2115 return;
2116 }
2117
2118 TSelectorDraw * selector = (TSelectorDraw* ) player->GetSelector();
2119 if ( !selector ) {
2120 Error("DoFit","Selector reference is NULL");
2121 return;
2122 }
2123
2124 // use pointer stored in the tree (not copy the data in)
2125 unsigned int ndim = player->GetDimension();
2126 if ( ndim == 0 ) {
2127 Error("DoFit","NDIM == 0");
2128 return;
2129 }
2130
2131 std::vector<double *> vlist;
2132 for (unsigned int i = 0; i < ndim; ++i) {
2133 double * v = selector->GetVal(i);
2134 if (v != 0) vlist.push_back(v);
2135 else
2136 std::cerr << "pointer for variable " << i << " is zero" << std::endl;
2137 }
2138 if (vlist.size() != ndim) {
2139 Error("DoFit","Vector is not complete");
2140 return;
2141 }
2142
2143 // fill the data
2144 Long64_t nrows = player->GetSelectedRows();
2145 if ( !nrows ) {
2146 Error("DoFit","NROWS == 0");
2147 return;
2148 }
2149
2150 ROOT::Fit::UnBinData * fitdata = new ROOT::Fit::UnBinData(nrows, ndim, vlist.begin());
2151
2152 for ( int i = 0; i < std::min(int(fitdata->Size()),10); ++i) {
2153 // print j coordinate
2154 for (unsigned int j = 0; j < ndim; ++j) {
2155 printf(" x_%d [%d] = %f \n", j, i,*(fitdata->Coords(i)+j) );
2156 }
2157 printf("\n");
2158 }
2159
2160
2161 //TVirtualFitter::SetDefaultFitter("Minuit");
2162 Foption_t fitOption;
2164 fitOption.Verbose=1;
2165
2166 // After all the set up is performed, then do the Fit!!
2167 ROOT::Fit::UnBinFit(fitdata, fitFunc, fitOption, minOption);
2168
2169 break;
2170 }
2171 }
2172
2173 // if SAME is set re-plot the function
2174 // useful in case histogram was drawn with HIST
2175 // and no function will be drawm)
2176 if (fDrawSame->GetState() == kButtonDown && fitFunc)
2177 fitFunc->Draw("same");
2178
2179
2180 // update parameters value shown in dialog
2181 //if (!fFuncPars) fFuncPars = new Double_t[fitFunc->GetNpar()][3];
2182 GetParameters(fFuncPars,fitFunc);
2183
2184 // Save fit data for future use as a PrevFit function.
2185 TF1* tmpTF1 = static_cast<TF1*>( copyTF1(fitFunc) );
2186 ostringstream name;
2187 name << "PrevFit-" << fPrevFit.size() + 1;
2188 if ( strcmp(tmpTF1->GetName(), "PrevFitTMP") != 0 )
2189 name << "-" << tmpTF1->GetName();
2190 tmpTF1->SetName(name.str().c_str());
2191 fPrevFit.insert(FitFuncMap_t::value_type(fFitObject, tmpTF1));
2192 fSystemFuncs.push_back( copyTF1(tmpTF1) );
2193
2194 float xmin = 0.f, xmax = 0.f, ymin = 0.f, ymax = 0.f, zmin = 0.f, zmax = 0.f;
2195 if ( fParentPad ) {
2197 // As the range is not changed, save the old values and restore
2198 // after the GUI has been updated. It would be more elegant to
2199 // disconnect the signal from fParentPad, however, this doesn't
2200 // work for unknown reasons.
2202 if ( fDim > 1 ) fSliderY->GetPosition(ymin, ymax);
2203 if ( fDim > 2 ) fSliderZ->GetPosition(zmin, zmax);
2204 fParentPad->Update();
2205 }
2206
2207 // In case the fit method draws something! Set the canvas!
2208 fParentPad = gPad;
2209 UpdateGUI();
2210
2211 // Change the sliders if necessary.
2212 if ( fParentPad ) {
2214 if ( fType != kObjectTree && fDim > 1 ) { fSliderY->SetPosition(ymin, ymax); DoSliderYMoved(); }
2215 if ( fType != kObjectTree && fDim > 2 ) { fSliderZ->SetPosition(zmin, zmax); DoSliderZMoved(); }
2216 if (fParentPad->GetCanvas())
2218 fParentPad->Connect("RangeAxisChanged()", "TFitEditor", this, "UpdateGUI()");
2219
2220 if (save) gPad = save;
2224 }
2225
2226 // Restore the Fit button and mouse cursor to their proper state.
2227 if (gPad && gPad->GetVirtCanvas()) gPad->GetVirtCanvas()->SetCursor(kPointer);
2228 gVirtualX->SetCursor(GetId(), gVirtualX->CreateCursor(kPointer));
2230
2231 if ( !fTypeFit->FindEntry("Prev. Fit") )
2233
2235}
2236
2237////////////////////////////////////////////////////////////////////////////////
2238/// Check entered function string.
2239
2241{
2242 Int_t rvalue = 0;
2243 if ( fDim == 1 || fDim == 0 ) {
2244 TF1 form("tmpCheck", fname);
2245 // coverity[uninit_use_in_call]
2246 rvalue = form.IsValid() ? 0 : -1;
2247 } else if ( fDim == 2 ) {
2248 TF2 form("tmpCheck", fname);
2249 // coverity[uninit_use_in_call]
2250 rvalue = form.IsValid() ? 0 : -1;
2251 } else if ( fDim == 3 ) {
2252 TF3 form("tmpCheck", fname);
2253 // coverity[uninit_use_in_call]
2254 rvalue = form.IsValid() ? 0 : -1;
2255 }
2256
2257 return rvalue;
2258}
2259
2260////////////////////////////////////////////////////////////////////////////////
2261/// Slot connected to addition of predefined functions. It will
2262/// insert the next selected function with a plus sign so that it
2263/// doesn't override the current content of the formula.
2264
2266{
2267 static Bool_t first = kFALSE;
2269 if (on) {
2270 if (!first) {
2271 fSelLabel->SetText(s.Sizeof()>30?s(0,30)+"...":s);
2272 s += "(0)";
2273 fEnteredFunc->SetText(s.Data());
2274 first = kTRUE;
2276 }
2277 } else {
2278 first = kFALSE;
2279 }
2280}
2281////////////////////////////////////////////////////////////////////////////////
2282/// Slot connected to addition of predefined functions. It will
2283/// insert the next selected function with a plus sign so that it
2284/// doesn't override the current content of the formula.
2285
2287{
2288 /*
2289 static Bool_t first = kFALSE;
2290 TString s = fEnteredFunc->GetText();
2291 if (on) {
2292 if (!first) {
2293 fSelLabel->SetText(s.Sizeof()>30?s(0,30)+"...":s);
2294 fEnteredFunc->SetText(s.Data());
2295 first = kTRUE;
2296 ((TGCompositeFrame *)fSelLabel->GetParent())->Layout();
2297 }
2298 } else {
2299 first = kFALSE;
2300 }*/
2301
2302 if (on) Info("DoNormAddition","Normalized addition is selected");
2303}
2304
2305////////////////////////////////////////////////////////////////////////////////
2306/// Slot connected to addition of predefined functions. It will
2307/// insert the next selected function with a plus sign so that it
2308/// doesn't override the current content of the formula.
2309
2311{
2312 /*
2313 static Bool_t first = kFALSE;
2314 TString s = fEnteredFunc->GetText();
2315 if (on) {
2316 if (!first) {
2317 fSelLabel->SetText(s.Sizeof()>30?s(0,30)+"...":s);
2318 // s += "(0)";
2319 fEnteredFunc->SetText(s.Data());
2320 first = kTRUE;
2321 ((TGCompositeFrame *)fSelLabel->GetParent())->Layout();
2322 }
2323 } else
2324 first = kFALSE;*/
2325
2326 if (on) Info("DoConvolution","Convolution is selected");
2327}
2328
2329////////////////////////////////////////////////////////////////////////////////
2330/// Selects the data set to be fitted
2331
2333{
2334 if ( selected == kFP_NOSEL ) {
2335 DoNoSelection();
2336 return;
2337 }
2338
2339 // Get the name and class of the selected object.
2340 TGTextLBEntry* textEntry = static_cast<TGTextLBEntry*>(fDataSet->GetListBox()->GetEntry(selected));
2341 if (!textEntry) return;
2342 TString textEntryStr = textEntry->GetText()->GetString();
2343 TString name = textEntry->GetText()->GetString()+textEntry->GetText()->First(':')+2;
2344 TString className = textEntryStr(0,textEntry->GetText()->First(':'));
2345
2346 // Check the object exists in the ROOT session and it is registered
2347 TObject* objSelected(0);
2348 if ( className == "TTree" ) {
2349 // It's a tree, so the name is before the space (' ')
2350 TString lookStr;
2351 if ( name.First(' ') == kNPOS )
2352 lookStr = name;
2353 else
2354 lookStr = name(0, name.First(' '));
2355 //std::cout << "\t1 SITREE: '" << lookStr << "'" << std::endl;
2356 objSelected = gROOT->FindObject(lookStr);
2357 } else {
2358 // It's not a tree, so the name is the complete string
2359 //std::cout << "\t1 NOTREE: '" << name << "'" << std::endl;
2360 objSelected = gROOT->FindObject(name);
2361 }
2362 if ( !objSelected )
2363 {
2364 //std::cerr << "Object not found! Please report the error! " << std::endl;
2365 return;
2366 }
2367
2368 // If it is a tree, and there are no variables selected, show a dialog
2369 if ( objSelected->InheritsFrom(TTree::Class()) &&
2370 name.First(' ') == kNPOS ) {
2371 char variables[256] = {0}; char cuts[256] = {0};
2372 strlcpy(variables, "Sin input!", 256);
2373 new TTreeInput( fClient->GetRoot(), GetMainFrame(), variables, cuts );
2374 if ( strcmp ( variables, "" ) == 0 ) {
2375 DoNoSelection();
2376 return;
2377 }
2378 ProcessTreeInput(objSelected, selected, variables, cuts);
2379 }
2380
2381 // Search the canvas where the object is drawn, if any
2382 TPad* currentPad = NULL;
2383 bool found = false;
2384 queue<TPad*> stPad;
2385 TIter padIter( gROOT->GetListOfCanvases() );
2386 while ( TObject* canvas = static_cast<TObject*>(padIter() ) ) {
2387 if ( dynamic_cast<TPad*>(canvas) )
2388 stPad.push(dynamic_cast<TPad*>(canvas));
2389 }
2390
2391 while ( !stPad.empty() && !found ) {
2392 currentPad = stPad.front();
2393 stPad.pop();
2394 TIter elemIter( currentPad->GetListOfPrimitives() );
2395 while ( TObject* elem = static_cast<TObject*>(elemIter() ) ) {
2396 if ( elem == objSelected ) {
2397 found = true;
2398 break;
2399 } else if ( dynamic_cast<TPad*>(elem) )
2400 stPad.push( dynamic_cast<TPad*>(elem) );
2401 }
2402 }
2403
2404 // Set the proper object and canvas (if found!)
2405 SetFitObject( found?currentPad:NULL, objSelected, kButton1Down);
2406}
2407
2409{
2410 // If the input is valid, insert the tree with the selections as an entry to fDataSet
2411 TString entryName = (objSelected)->ClassName(); entryName.Append("::"); entryName.Append((objSelected)->GetName());
2412 entryName.Append(" (\""); entryName.Append(variables); entryName.Append("\", \"");
2413 entryName.Append(cuts); entryName.Append("\")");
2415 fDataSet->InsertEntry(entryName, newid, selected );
2416 fDataSet->Select(newid);
2417}
2418
2419////////////////////////////////////////////////////////////////////////////////
2420/// Slot connected to predefined fit function settings.
2421
2423{
2425
2426 // check that selected passesd value is the correct one in the TextEntry
2427 R__ASSERT( selected == te->EntryId());
2428 //std::cout << "calling do function " << selected << " " << te->GetTitle() << " function " << te->EntryId() << std::endl;
2429 //selected = te->EntryId();
2430
2431 bool editable = false;
2433 {
2434 // Get the function selected and check weather it is a raw C
2435 // function or not
2436 TF1* tmpTF1 = FindFunction();
2437 if ( !tmpTF1 )
2438 {
2440 tmpTF1 = (TF1*) GetFitObjectListOfFunctions()->FindObject( te->GetTitle() );
2441 }
2442 if ( tmpTF1 && strcmp(tmpTF1->GetExpFormula(), "") )
2443 {
2444 editable = kTRUE;
2446 }
2447 else
2448 {
2449 if ( selected <= kFP_USER )
2450 editable = kTRUE;
2451 else
2452 editable = kFALSE;
2454 }
2455 // Once you have the function, set the editable.
2456 SetEditable(editable);
2457 }
2458 else if (fAdd -> GetState() == kButtonDown)
2459 {
2460 // If the add button is down don't replace the fEnteredFunc text
2461 Int_t np = 0;
2462 TString s = "";
2463 if (!strcmp(fEnteredFunc->GetText(), ""))
2464 {
2466 }
2467 else
2468 {
2469 s = fEnteredFunc->GetTitle();
2470 TFormula tmp("tmp", fEnteredFunc->GetText());
2471 np = tmp.GetNpar();
2472 }
2473 if (np)
2474 s += TString::Format("+%s(%d)", te->GetTitle(), np);
2475 else
2476 s += TString::Format("%s(%d)", te->GetTitle(), np);
2477 fEnteredFunc->SetText(s.Data());
2478 editable = true;
2479 }
2480 else if (fNormAdd->GetState() == kButtonDown)
2481 {
2482 // If the normadd button is down don't replace the fEnteredFunc text
2483 Int_t np = 0;
2484 TString s = "";
2485 if (!strcmp(fEnteredFunc->GetText(), ""))
2486 {
2488 }
2489 else
2490 {
2491 s = fEnteredFunc->GetTitle();
2492 TFormula tmp("tmp", fEnteredFunc->GetText());
2493 np = tmp.GetNpar();
2494 }
2495 if (np)
2496 s += TString::Format("+%s", te->GetTitle());
2497 else
2498 s += TString::Format("%s", te->GetTitle());
2499 fEnteredFunc->SetText(s.Data());
2500 //std::cout <<fEnteredFunc->GetText()<<std::endl;
2501 editable = true;
2502 }
2503 else if (fConv->GetState() == kButtonDown)
2504 {
2505 // If the normadd button is down don't replace the fEnteredFunc text
2506 Int_t np = 0;
2507 TString s = "";
2508 if (!strcmp(fEnteredFunc->GetText(), ""))
2510 else
2511 {
2512 s = fEnteredFunc->GetTitle();
2513 TFormula tmp("tmp", fEnteredFunc->GetText());
2514 np = tmp.GetNpar();
2515 }
2516 if (np)
2517 s += TString::Format("*%s", te->GetTitle());
2518 else
2519 s += TString::Format("%s", te->GetTitle());
2520 fEnteredFunc->SetText(s.Data());
2521 //std::cout <<fEnteredFunc->GetText()<<std::endl;
2522 editable = true;
2523 }
2524
2525
2526 // Get the final name in fEnteredFunc to process the function that
2527 // it would create
2528 TString tmpStr = fEnteredFunc->GetText();
2529
2530 // create TF1 with the passed string. Delete previous one if existing
2531 if (tmpStr.Contains("pol") || tmpStr.Contains("++")) {
2533 } else {
2535 }
2536
2538 fSelLabel->SetText(tmpStr.Sizeof()>30?tmpStr(0,30)+"...":tmpStr);
2540
2541 // reset function parameters if the number of parameters of the new
2542 // function is different from the old one!
2543 TF1* fitFunc = GetFitFunction();
2544 //std::cout << "TFitEditor::DoFunction - using function " << fitFunc->GetName() << " " << fitFunc << std::endl;
2545
2546 if ( fitFunc && (unsigned int) fitFunc->GetNpar() != fFuncPars.size() )
2547 fFuncPars.clear();
2548 if ( fitFunc ) {
2549 //std::cout << "TFitEditor::DoFunction - deleting function " << fitFunc->GetName() << " " << fitFunc << std::endl;
2550 delete fitFunc;
2551 }
2552}
2553
2554////////////////////////////////////////////////////////////////////////////////
2555/// Slot connected to entered function in text entry.
2556
2558{
2559 if (!strcmp(fEnteredFunc->GetText(), "")) return;
2560
2561 // Check if the function is well built
2563
2564 if (ok != 0) {
2566 "Error...", "3) Verify the entered function string!",
2567 kMBIconStop,kMBOk, 0);
2568 return;
2569 }
2570
2571 // And set the label with the entered text if everything is fine.
2573 fSelLabel->SetText(s.Sizeof()>30?s(0,30)+"...":s);
2575}
2576
2577////////////////////////////////////////////////////////////////////////////////
2578/// Slot connected to linear fit settings.
2579
2581{
2582 if (fLinearFit->GetState() == kButtonDown) {
2583 //fSetParam->SetState(kButtonDisabled);
2587 //fNoChi2->SetState(kButtonUp);
2588 } else {
2589 //fSetParam->SetState(kButtonUp);
2594 //fNoChi2->SetState(kButtonDisabled);
2595 }
2596}
2597
2598////////////////////////////////////////////////////////////////////////////////
2599/// Slot connected to 'no chi2' option settings.
2600
2602{
2603 //LM: no need to do operations here
2604 // if (fLinearFit->GetState() == kButtonUp)
2605 // fLinearFit->SetState(kButtonDown, kTRUE);
2606}
2607////////////////////////////////////////////////////////////////////////////////
2608/// Slot connected to 'robust fitting' option settings.
2609
2611{
2614 else
2616}
2617
2618////////////////////////////////////////////////////////////////////////////////
2619/// Slot connected to 'no storing, no drawing' settings.
2620
2622{
2623 if (fNoDrawing->GetState() == kButtonUp)
2625}
2626
2627////////////////////////////////////////////////////////////////////////////////
2628/// Slot connected to print option settings.
2629
2631{
2632 // Change the states of the buttons depending of which one is
2633 // selected.
2634 TGButton *btn = (TGButton *) gTQSender;
2635 Int_t id = btn->WidgetId();
2636 switch (id) {
2637 case kFP_PDEF:
2638 if (on) {
2642 }
2643 fStatusBar->SetText("Prn: DEF",4);
2644 break;
2645 case kFP_PVER:
2646 if (on) {
2650 }
2651 fStatusBar->SetText("Prn: VER",4);
2652 break;
2653 case kFP_PQET:
2654 if (on) {
2658 }
2659 fStatusBar->SetText("Prn: QT",4);
2660 default:
2661 break;
2662 }
2663}
2664
2665////////////////////////////////////////////////////////////////////////////////
2666/// Reset all fit parameters.
2667
2669{
2670 if ( fParentPad ) {
2672 fParentPad->Update();
2673 }
2674 fEnteredFunc->SetText("gaus");
2675
2676 // To restore temporary points and sliders
2677 UpdateGUI();
2678
2683 if (fUseRange->GetState() == kButtonDown)
2697 // if (fNoChi2->GetState() == kButtonDown)
2698 // fNoChi2->SetState(kButtonUp, kFALSE);
2699 if (fDrawSame->GetState() == kButtonDown)
2706 fFuncList->Select(1, kTRUE);
2707
2708 // minimization tab
2717 }
2721 }
2725 }
2726}
2727
2728////////////////////////////////////////////////////////////////////////////////
2729/// Open set parameters dialog.
2730
2732{
2733 // Get the function.
2734 TF1* fitFunc = GetFitFunction();
2735 //std::cout << "TFitEditor::DoSetParameters - using function " << fitFunc->GetName() << " " << fitFunc << std::endl;
2736
2737 if (!fitFunc) { Error("DoSetParameters","NUll function"); return; }
2738
2739 // case of special functions (gaus, expo, etc...) if the function
2740 // has not defined the parameters yet. For those, don't let the
2741 // parameters to be all equal to 0, as we can provide some good
2742 // starting value.
2743 if (fFuncPars.size() == 0) {
2744 switch (fType) {
2745 case kObjectHisto:
2746 InitParameters( fitFunc, (TH1*)fFitObject) ;
2747 break;
2748 case kObjectGraph:
2749 InitParameters( fitFunc, ((TGraph*)fFitObject));
2750 break;
2751 case kObjectMultiGraph:
2752 InitParameters( fitFunc, ((TMultiGraph*)fFitObject));
2753 break;
2754 case kObjectGraph2D:
2755 InitParameters( fitFunc, ((TGraph2D*)fFitObject));
2756 break;
2757 case kObjectHStack:
2758 case kObjectTree:
2759 default:
2760 break;
2761 }
2762 // The put these parameters into the fFuncPars structure
2763 GetParameters(fFuncPars, fitFunc);
2764 }
2765 else {
2766 // Otherwise, put the parameters in the function
2767 SetParameters(fFuncPars, fitFunc);
2768 }
2769
2770 if ( fParentPad ) fParentPad->Disconnect("RangeAxisChanged()");
2771 Int_t ret = 0;
2772 /// fit parameter dialog willbe deleted automatically when closed
2773 new TFitParametersDialog(gClient->GetDefaultRoot(), GetMainFrame(),
2774 fitFunc, fParentPad, &ret);
2775
2776 // Once the parameters are set in the fitfunction, save them.
2777 GetParameters(fFuncPars, fitFunc);
2778
2779 // check return code to see if parameters settings have been modified
2780 // in this case we need to set the B option when fitting
2781 if (ret) fChangedParams = kTRUE;
2782
2783
2784 if ( fParentPad ) fParentPad->Connect("RangeAxisChanged()", "TFitEditor", this, "UpdateGUI()");
2785
2786 if ( fNone->GetState() != kButtonDisabled ) {
2787 //std::cout << "TFitEditor::DoSetParameters - deleting function " << fitFunc->GetName() << " " << fitFunc << std::endl;
2788 delete fitFunc;
2789 }
2790}
2791
2792////////////////////////////////////////////////////////////////////////////////
2793/// Slot connected to range settings on x-axis.
2794
2796{
2797 if ( !fFitObject ) return;
2798
2801
2803
2804 DrawSelection();
2805}
2806
2807////////////////////////////////////////////////////////////////////////////////
2808/// Draws the square around the object showing where the limits for
2809/// fitting are.
2810
2812{
2813 static Int_t px1old, py1old, px2old, py2old; // to remember the square drawn.
2814
2815 if ( !fParentPad ) return;
2816
2817 if (restore) {
2822 return;
2823 }
2824
2825 Int_t px1,py1,px2,py2;
2826
2827 TVirtualPad *save = 0;
2828 save = gPad;
2829 gPad = fParentPad;
2830 gPad->cd();
2831
2832 Double_t xleft = 0;
2833 Double_t xright = 0;
2834 xleft = fXaxis->GetBinLowEdge((Int_t)((fSliderX->GetMinPosition())+0.5));
2835 xright = fXaxis->GetBinUpEdge((Int_t)((fSliderX->GetMaxPosition())+0.5));
2836
2837 Float_t ymin, ymax;
2838 if ( fDim > 1 )
2839 {
2840 ymin = fYaxis->GetBinLowEdge((Int_t)((fSliderY->GetMinPosition())+0.5));//gPad->GetUymin();
2841 ymax = fYaxis->GetBinUpEdge((Int_t)((fSliderY->GetMaxPosition())+0.5));//gPad->GetUymax();
2842 }
2843 else
2844 {
2845 ymin = gPad->GetUymin();
2846 ymax = gPad->GetUymax();
2847 }
2848
2849 px1 = gPad->XtoAbsPixel(xleft);
2850 py1 = gPad->YtoAbsPixel(ymin);
2851 px2 = gPad->XtoAbsPixel(xright);
2852 py2 = gPad->YtoAbsPixel(ymax);
2853
2854 if (gPad->GetCanvas()) gPad->GetCanvas()->FeedbackMode(kTRUE);
2855 gPad->SetLineWidth(1);
2856 gPad->SetLineColor(2);
2857
2858 gVirtualX->DrawBox(px1old, py1old, px2old, py2old, TVirtualX::kHollow);
2859 gVirtualX->DrawBox(px1, py1, px2, py2, TVirtualX::kHollow);
2860
2861 px1old = px1;
2862 py1old = py1;
2863 px2old = px2 ;
2864 py2old = py2;
2865
2866 if(save) gPad = save;
2867}
2868
2869////////////////////////////////////////////////////////////////////////////////
2870/// Sincronize the numeric sliders with the graphical one.
2871
2873{
2875 float xmin, xmax;
2877 fSliderXMin->SetNumber( fXaxis->GetBinLowEdge( static_cast<Int_t>( xmin ) ) );
2878 fSliderXMax->SetNumber( fXaxis->GetBinUpEdge ( static_cast<Int_t>( xmax ) ) );
2879 return;
2880 }
2881
2884
2886
2887 DrawSelection();
2888}
2889
2890////////////////////////////////////////////////////////////////////////////////
2891/// Slot connected to range settings on y-axis.
2892
2894{
2895 if ( !fFitObject ) return;
2896
2899
2901
2902 DrawSelection();
2903}
2904
2905////////////////////////////////////////////////////////////////////////////////
2906///syncronize the numeric slider with the graphical one.
2907
2909{
2911 float ymin, ymax;
2913 fSliderYMin->SetNumber( fYaxis->GetBinLowEdge( static_cast<Int_t>( ymin ) ) );
2914 fSliderYMax->SetNumber( fYaxis->GetBinUpEdge ( static_cast<Int_t>( ymax ) ) );
2915 return;
2916 }
2917
2920
2922
2923 DrawSelection();
2924}
2925
2926////////////////////////////////////////////////////////////////////////////////
2927/// Slot connected to range settings on z-axis.
2928
2930{
2931}
2932
2933////////////////////////////////////////////////////////////////////////////////
2934/// Open a dialog for getting a user defined method.
2935
2937{
2939 "Info", "Dialog of user method is not implemented yet",
2941}
2942
2943////////////////////////////////////////////////////////////////////////////////
2944/// Set the function to be used in performed fit.
2945
2947{
2949}
2950
2951////////////////////////////////////////////////////////////////////////////////
2952/// Check whether the object suitable for fitting and set
2953/// its type, dimension and method combo box accordingly.
2954
2956{
2957 Bool_t set = kFALSE;
2958
2959 // For each kind of object, set a different status in the fit
2960 // panel.
2961 if (obj->InheritsFrom(TGraph::Class())) {
2963 set = kTRUE;
2964 fDim = 1;
2966 fMethodList->AddEntry("Chi-square", kFP_MCHIS);
2969 fRobustValue->GetNumberEntry()->SetToolTipText("Set robust value");
2970 } else if (obj->InheritsFrom(TGraph2D::Class())) {
2972 set = kTRUE;
2973 fDim = 2;
2975 fMethodList->AddEntry("Chi-square", kFP_MCHIS);
2977 } else if (obj->InheritsFrom(THStack::Class())) {
2979 set = kTRUE;
2980 TH1 *hist = (TH1 *)((THStack *)obj)->GetHists()->First();
2981 fDim = hist->GetDimension();
2983 fMethodList->AddEntry("Chi-square", kFP_MCHIS);
2985 } else if (obj->InheritsFrom(TTree::Class())) {
2987 set = kTRUE;
2988 TString variables, cuts;
2990 fDim = 1;
2991 for ( int i = 0; i < variables.Length() && fDim <= 2; ++i )
2992 if ( ':' == variables[i] ) fDim += 1;
2993 // For any three of dimension bigger than 2, set the dimension
2994 // to 0, as we cannot infer the dimension from the TF1s, it's
2995 // better to have 0 as reference.
2996 if ( fDim > 2 ) fDim = 0;
2998 fMethodList->AddEntry("Unbinned Likelihood", kFP_MUBIN);
3000 } else if (obj->InheritsFrom(TH1::Class())){
3002 set = kTRUE;
3003 fDim = ((TH1*)obj)->GetDimension();
3005 fMethodList->AddEntry("Chi-square", kFP_MCHIS);
3006 fMethodList->AddEntry("Binned Likelihood", kFP_MBINL);
3008 } else if (obj->InheritsFrom(TMultiGraph::Class())) {
3010 set = kTRUE;
3011 fDim = 1;
3013 fMethodList->AddEntry("Chi-square", kFP_MCHIS);
3016 fRobustValue->GetNumberEntry()->SetToolTipText("Set robust value");
3017 }
3018
3019 // Depending on the dimension of the object, allow the
3020 // visualization of sliders.
3021 if ( fDim < 2 || fType == kObjectTree )
3023 else
3025
3026 if ( fDim < 1 || fType == kObjectTree )
3028 else
3030
3031 // And also, depending on the dimension, add predefined functions.
3032 if ( fDim == 1 ) {
3033 if ( !fTypeFit->FindEntry("Predef-1D") )
3035 } else {
3036 if ( fTypeFit->FindEntry("Predef-1D") )
3038 }
3039
3040 if ( fDim == 2 ) {
3041 if ( !fTypeFit->FindEntry("Predef-2D") )
3043 } else {
3044 if ( fTypeFit->FindEntry("Predef-2D") )
3046 }
3047
3048 return set;
3049}
3050
3051////////////////////////////////////////////////////////////////////////////////
3052/// Show object name on the top.
3053
3055{
3056 TString name;
3057 bool isTree = false;
3058
3059 // Build the string to be compared to look for the object.
3060 if (obj) {
3061 name = obj->ClassName();
3062 name.Append("::");
3063 name.Append(obj->GetName());
3064 isTree = strcmp(obj->ClassName(), "TTree") == 0;
3065 } else {
3066 name = "No object selected";
3067 }
3068 fStatusBar->SetText(name.Data(),0);
3069
3070 // If the selection was done in the fDataSet combo box, there is no need
3071 // to search through the list
3072 TGTextLBEntry* selectedEntry = static_cast<TGTextLBEntry*> ( fDataSet->GetSelectedEntry());
3073 if ( selectedEntry ) {
3074 TString selectedName = selectedEntry->GetText()->GetString();
3075 if ( isTree )
3076 selectedName = selectedName(0, selectedName.First(' '));
3077 if ( name.CompareTo(selectedName) == 0 ) {
3078 Layout();
3079 return;
3080 }
3081 }
3082
3083 // Search through the list for the object
3084 Int_t entryId = kFP_NOSEL+1;
3085 bool found = false;
3086 while ( TGTextLBEntry* entry = static_cast<TGTextLBEntry*>
3087 ( fDataSet->GetListBox()->GetEntry(entryId)) ) {
3088 TString compareName = entry->GetText()->GetString();
3089 if ( isTree )
3090 compareName = compareName(0, compareName.First(' '));
3091 if ( name.CompareTo(compareName) == 0 ) {
3092 // If the object is found, select it
3093 fDataSet->Select(entryId, false);
3094 found = true;
3095 break;
3096 }
3097 entryId += 1;
3098 }
3099
3100 // If the object was not found, add it and select it.
3101 if ( !found ) {
3102 fDataSet->AddEntry(name.Data(), entryId);
3103 fDataSet->Select(entryId, kTRUE);
3104 }
3105
3106 Layout();
3107}
3108
3109////////////////////////////////////////////////////////////////////////////////
3110/// Get draw options of the selected object.
3111
3113{
3114 if (!fParentPad) return "";
3115
3117 TObject *obj;
3118 while ((obj = next())) {
3119 if (obj == fFitObject) return next.GetOption();
3120 }
3121 return "";
3122}
3123
3124////////////////////////////////////////////////////////////////////////////////
3125/// Set selected minimization library in use.
3126
3128{
3129 TGButton *bt = (TGButton *)gTQSender;
3130 Int_t id = bt->WidgetId();
3131
3132 switch (id) {
3133
3134 // Depending on the selected library, set the state of the rest
3135 // of the buttons.
3136 case kFP_LMIN:
3137 {
3138 if (on) {
3142 if ( fLibGSL->GetState() != kButtonDisabled )
3146 fStatusBar->SetText("LIB Minuit", 1);
3147 }
3148
3149 }
3150 break;
3151
3152 case kFP_LMIN2:
3153 {
3154 if (on) {
3158 if ( fLibGSL->GetState() != kButtonDisabled )
3162 fStatusBar->SetText("LIB Minuit2", 1);
3163 }
3164 }
3165 break;
3166
3167 case kFP_LFUM:
3168 {
3169 if (on) {
3173 if ( fLibGSL->GetState() != kButtonDisabled )
3177 fStatusBar->SetText("LIB Fumili", 1);
3178 }
3179 }
3180 break;
3181 case kFP_LGSL:
3182 {
3183 if (on) {
3187 if ( fLibGSL->GetState() != kButtonDisabled )
3191 fStatusBar->SetText("LIB GSL", 1);
3192 }
3193 }
3194 break;
3195 case kFP_LGAS:
3196 {
3197 if (on) {
3201 if ( fLibGSL->GetState() != kButtonDisabled )
3205 fStatusBar->SetText("LIB Genetics", 1);
3206 }
3207 }
3208 default:
3209 break;
3210 }
3212}
3213
3214////////////////////////////////////////////////////////////////////////////////
3215/// Set selected minimization method in use.
3216
3218{
3220 fStatusBar->SetText("MIGRAD",2);
3221 else if ( fMinMethodList->GetSelected() == kFP_FUMILI)
3222 fStatusBar->SetText("FUMILI",2);
3223 else if ( fMinMethodList->GetSelected() == kFP_SIMPLX )
3224 fStatusBar->SetText("SIMPLEX",2);
3225 else if ( fMinMethodList->GetSelected() == kFP_SCAN )
3226 fStatusBar->SetText("SCAN",2);
3228 fStatusBar->SetText("Combination",2);
3229 else if ( fMinMethodList->GetSelected() == kFP_GSLFR )
3230 fStatusBar->SetText("CONJFR",2);
3231 else if ( fMinMethodList->GetSelected() == kFP_GSLPR )
3232 fStatusBar->SetText("CONJPR",2);
3233 else if ( fMinMethodList->GetSelected() == kFP_BFGS )
3234 fStatusBar->SetText("BFGS",2);
3235 else if ( fMinMethodList->GetSelected() == kFP_BFGS2 )
3236 fStatusBar->SetText("BFGS2",2);
3237 else if ( fMinMethodList->GetSelected() == kFP_GSLLM )
3238 fStatusBar->SetText("GSLLM",2);
3239 else if ( fMinMethodList->GetSelected() == kFP_GSLSA)
3240 fStatusBar->SetText("SimAn",2);
3241 else if ( fMinMethodList->GetSelected() == kFP_TMVAGA )
3242 fStatusBar->SetText("TMVAGA",2);
3243 else if ( fMinMethodList->GetSelected() == kFP_GALIB )
3244 fStatusBar->SetText("GALIB",2);
3245
3246
3247}
3248
3249////////////////////////////////////////////////////////////////////////////////
3250/// Set the maximum number of iterations.
3251
3253{
3255 fStatusBar->SetText(Form("Itr: %ld",itr),2);
3256}
3257
3258////////////////////////////////////////////////////////////////////////////////
3259/// Create section title in the GUI.
3260
3261void TFitEditor::MakeTitle(TGCompositeFrame *parent, const char *title)
3262{
3263 TGCompositeFrame *ht = new TGCompositeFrame(parent, 350, 10,
3265 ht->AddFrame(new TGLabel(ht, title),
3266 new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
3267 ht->AddFrame(new TGHorizontal3DLine(ht),
3268 new TGLayoutHints(kLHintsExpandX | kLHintsCenterY, 5, 5, 2, 2));
3269 parent->AddFrame(ht, new TGLayoutHints(kLHintsTop, 5, 0, 5, 0));
3270}
3271
3272////////////////////////////////////////////////////////////////////////////////
3273/// Look in the list of function for TF1. If a TF1 is
3274/// found in the list of functions, it will be returned
3275
3277{
3278 // Get the list of functions of the fit object
3280 TF1* func = 0;
3281
3282 // If it exists
3283 if ( lf ) {
3284 // Add the posibility to select previous fit function
3285 if ( !fTypeFit->FindEntry("Prev. Fit") )
3287
3288 // Then add all these functions to the fPrefFit structure.
3289 TObject *obj2;
3290 TIter next(lf, kIterForward);
3291 // Go over all the elements in lf
3292 while ((obj2 = next())) {
3293 if (obj2->InheritsFrom(TF1::Class())) {
3294 func = (TF1 *)obj2;
3295 fPrevFitIter it;
3296 // No go over all elements in fPrevFit
3297 for ( it = fPrevFit.begin(); it != fPrevFit.end(); ++it) {
3298 // To see wheather the object corresponds with fFitObject
3299 if ( it->first != fFitObject ) continue;
3300 // And if so, whether the function is already included
3301 if ( strcmp( func->GetName(), it->second->GetName() ) == 0 )
3302 break;
3303 if ( strcmp( func->GetName(), "PrevFitTMP" ) == 0 )
3304 break;
3305 }
3306 // Only if the function is not already in fPrevFit, the
3307 // breaks in the loops would make it to be different to
3308 // fPrevFit.end() if the function is already stored
3309 if ( it == fPrevFit.end() ) {
3310 fPrevFit.insert( FitFuncMap_t::value_type( fFitObject, static_cast<TF1*>( copyTF1( func ) ) ) );
3311 }
3312 }
3313 }
3314
3315 // Select the PrevFit set
3317 // And fill the function list
3320
3321
3322 } else {
3323 // If there is no prev fit functions.
3325 // Call FillFunctionList as it might happen that the user is
3326 // changing from a TTree to another one, and thus the fFuncList
3327 // if not properly filled
3329 }
3330
3332
3333 return func;
3334}
3335
3336////////////////////////////////////////////////////////////////////////////////
3337/// Retrieve the fitting options from all the widgets.
3338
3340{
3341 drawOpts = "";
3342
3343 fitOpts.Range = (fUseRange->GetState() == kButtonDown);
3344 fitOpts.Integral = (fIntegral->GetState() == kButtonDown);
3345 fitOpts.More = (fImproveResults->GetState() == kButtonDown);
3346 fitOpts.Errors = (fBestErrors->GetState() == kButtonDown);
3347 fitOpts.Like = (fMethodList->GetSelected() != kFP_MCHIS);
3348
3350 fitOpts.W1 = 2;
3351 else if (fAllWeights1->GetState() == kButtonDown)
3352 fitOpts.W1 = 1;
3353
3354 TString tmpStr = fEnteredFunc->GetText();
3355 if ( !(fLinearFit->GetState() == kButtonDown) &&
3356 (tmpStr.Contains("pol") || tmpStr.Contains("++")) )
3357 fitOpts.Minuit = 1;
3358
3359 // if ( (int) fFuncPars.size() == npar )
3360 // for ( Int_t i = 0; i < npar; ++i )
3361 // if ( fFuncPars[i][PAR_MIN] != fFuncPars[i][PAR_MAX] )
3362 //
3363
3364 // //fitOpts.Bound = 1;
3365 // break;
3366 // }
3367
3368 if (fChangedParams) {
3369 //std::cout << "Params have changed setting the Bound option " << std::endl;
3370 fitOpts.Bound = 1;
3371 fChangedParams = kFALSE; // reset
3372 }
3373
3374 //fitOpts.Nochisq = (fNoChi2->GetState() == kButtonDown);
3375 fitOpts.Nostore = (fNoStoreDrawing->GetState() == kButtonDown);
3376 fitOpts.Nograph = (fNoDrawing->GetState() == kButtonDown);
3377 fitOpts.Plus = (fAdd2FuncList->GetState() == kButtonDown);
3378 fitOpts.Gradient = (fUseGradient->GetState() == kButtonDown);
3379 fitOpts.Quiet = ( fOptQuiet->GetState() == kButtonDown );
3380 fitOpts.Verbose = ( fOptVerbose->GetState() == kButtonDown );
3381
3382 if ( !(fType != kObjectGraph) && (fEnableRobust->GetState() == kButtonDown) )
3383 {
3384 fitOpts.Robust = 1;
3385 fitOpts.hRobust = fRobustValue->GetNumber();
3386 }
3387
3388 drawOpts = GetDrawOption();
3389
3390 if ( fLibMinuit->GetState() == kButtonDown )
3391 minOpts.SetMinimizerType ( "Minuit");
3392 else if ( fLibMinuit2->GetState() == kButtonDown)
3393 minOpts.SetMinimizerType ( "Minuit2" );
3394 else if ( fLibFumili->GetState() == kButtonDown )
3395 minOpts.SetMinimizerType ("Fumili" );
3396 else if ( fLibGSL->GetState() == kButtonDown )
3397 minOpts.SetMinimizerType ("GSLMultiMin" );
3398
3400 minOpts.SetMinimizerAlgorithm( "Migrad" );
3401 else if ( fMinMethodList->GetSelected() == kFP_FUMILI)
3402 if ( fLibMinuit2->GetState() == kButtonDown )
3403 minOpts.SetMinimizerAlgorithm( "Fumili2" );
3404 else
3405 minOpts.SetMinimizerAlgorithm( "Fumili" );
3406 else if ( fMinMethodList->GetSelected() == kFP_SIMPLX )
3407 minOpts.SetMinimizerAlgorithm( "Simplex" );
3408 else if ( fMinMethodList->GetSelected() == kFP_SCAN )
3409 minOpts.SetMinimizerAlgorithm( "Scan" );
3411 minOpts.SetMinimizerAlgorithm( "Minimize" );
3412 else if ( fMinMethodList->GetSelected() == kFP_GSLFR )
3413 minOpts.SetMinimizerAlgorithm( "conjugatefr" );
3414 else if ( fMinMethodList->GetSelected() == kFP_GSLPR )
3415 minOpts.SetMinimizerAlgorithm( "conjugatepr" );
3416 else if ( fMinMethodList->GetSelected() == kFP_BFGS )
3417 minOpts.SetMinimizerAlgorithm( "bfgs" );
3418 else if ( fMinMethodList->GetSelected() == kFP_BFGS2 )
3419 minOpts.SetMinimizerAlgorithm( "bfgs2" );
3420 else if ( fMinMethodList->GetSelected() == kFP_GSLLM ) {
3421 minOpts.SetMinimizerType ("GSLMultiFit" );
3422 minOpts.SetMinimizerAlgorithm( "" );
3423 } else if ( fMinMethodList->GetSelected() == kFP_GSLSA) {
3424 minOpts.SetMinimizerType ("GSLSimAn" );
3425 minOpts.SetMinimizerAlgorithm( "" );
3426 } else if ( fMinMethodList->GetSelected() == kFP_TMVAGA) {
3427 minOpts.SetMinimizerType ("Geneti2c" );
3428 minOpts.SetMinimizerAlgorithm( "" );
3429 } else if ( fMinMethodList->GetSelected() == kFP_GALIB) {
3430 minOpts.SetMinimizerType ("GAlibMin" );
3431 minOpts.SetMinimizerAlgorithm( "" );
3432 }
3433
3434 minOpts.SetErrorDef ( fErrorScale->GetNumber() );
3435 minOpts.SetTolerance( fTolerance->GetNumber() );
3438}
3439
3441{
3442 // Set the state of some input widgets depending on whether the fit
3443 // function can be defined by text or if it is an existing one.
3444 if ( state )
3445 {
3446 fEnteredFunc-> SetState(kTRUE);
3447 fAdd -> SetState(kButtonUp, kFALSE);
3448 fNormAdd -> SetState(kButtonUp, kFALSE);
3449 fConv -> SetState(kButtonUp, kFALSE);
3450 fNone -> SetState(kButtonDown,kFALSE); // fNone::State is the one used as reference
3451 }
3452 else
3453 {
3454 fEnteredFunc-> SetState(kFALSE);
3455 fAdd -> SetState(kButtonDisabled, kFALSE);
3456 fNormAdd -> SetState(kButtonDisabled, kFALSE);
3457 fConv -> SetState(kButtonDisabled, kFALSE);
3458 fNone -> SetState(kButtonDisabled, kFALSE);
3459 }
3460}
3461
3463{
3464 // Return the ranges selected by the sliders.
3465
3466 // It's not working for trees as they don't have TAxis.
3467 if ( fType == kObjectTree ) return;
3468
3469 if ( fType != kObjectTree ) {
3470 Int_t ixmin = (Int_t)(fSliderX->GetMinPosition());
3471 Int_t ixmax = (Int_t)(fSliderX->GetMaxPosition());
3473 Double_t xmax = fXaxis->GetBinUpEdge(ixmax);
3474 drange.AddRange(0,xmin, xmax);
3475 }
3476
3477 if ( fDim > 1 ) {
3478 assert(fYaxis);
3479 Int_t iymin = (Int_t)(fSliderY->GetMinPosition());
3480 Int_t iymax = (Int_t)(fSliderY->GetMaxPosition());
3482 Double_t ymax = fYaxis->GetBinUpEdge(iymax);
3483 drange.AddRange(1,ymin, ymax);
3484 }
3485 if ( fDim > 2 ) {
3486 assert(fZaxis);
3487 Int_t izmin = (Int_t)(fSliderZ->GetMinPosition());
3488 Int_t izmax = (Int_t)(fSliderZ->GetMaxPosition());
3489 Double_t zmin = fZaxis->GetBinLowEdge(izmin);
3490 Double_t zmax = fZaxis->GetBinUpEdge(izmax);
3491 drange.AddRange(2,zmin, zmax);
3492 }
3493}
3494
3496{
3497 // Get the list of functions previously used in the fitobject.
3498
3499 TList *listOfFunctions = 0;
3500 if ( fFitObject ) {
3501 switch (fType) {
3502
3503 case kObjectHisto:
3504 listOfFunctions = ((TH1 *)fFitObject)->GetListOfFunctions();
3505 break;
3506
3507 case kObjectGraph:
3508 listOfFunctions = ((TGraph *)fFitObject)->GetListOfFunctions();
3509 break;
3510
3511 case kObjectMultiGraph:
3512 listOfFunctions = ((TMultiGraph *)fFitObject)->GetListOfFunctions();
3513 break;
3514
3515 case kObjectGraph2D:
3516 listOfFunctions = ((TGraph2D *)fFitObject)->GetListOfFunctions();
3517 break;
3518
3519 case kObjectHStack:
3520 case kObjectTree:
3521 default:
3522 break;
3523 }
3524 }
3525 return listOfFunctions;
3526}
3527
3529{
3530 // Looks for all the functions registered in the current ROOT
3531 // session.
3532
3533 // First, clean the copies stored in fSystemFunc
3534 for ( fSystemFuncIter it = fSystemFuncs.begin();
3535 it != fSystemFuncs.end();
3536 ++it ) {
3537 delete (*it);
3538 }
3539
3540 fSystemFuncs.clear();
3541
3542 // Be carefull not to store functions that will be in the
3543 // predefined section
3544 const unsigned int nfuncs = 16;
3545 const char* fnames[nfuncs] = { "gaus" , "gausn", "expo", "landau",
3546 "landaun", "pol0", "pol1", "pol2",
3547 "pol3", "pol4", "pol5", "pol6",
3548 "pol7", "pol8", "pol9", "user"
3549 };
3550
3551 // No go through all the objects registered in gROOT
3552 TIter functionsIter(gROOT->GetListOfFunctions());
3553 TObject* obj;
3554 while( ( obj = (TObject*) functionsIter() ) ) {
3555 // And if they are TF1s
3556 if ( TF1* func = dynamic_cast<TF1*>(obj) ) {
3557 bool addFunction = true;
3558 // And they are not already registered in fSystemFunc
3559 for ( unsigned int i = 0; i < nfuncs; ++i ) {
3560 if ( strcmp( func->GetName(), fnames[i] ) == 0 ) {
3561 addFunction = false;
3562 break;
3563 }
3564 }
3565 // Add them.
3566 if ( addFunction )
3567 fSystemFuncs.push_back( copyTF1(func) );
3568 }
3569 }
3570}
3571
3573{
3574 // This function returns a TList with all the functions used in the
3575 // FitPanel to fit a given object. If the object passed is NULL,
3576 // then the object used is the currently selected one. It is
3577 // important to notice that the FitPanel is still the owner of
3578 // those functions. This means that the user SHOULD NOT delete any
3579 // of these functions, as the FitPanel will do so in the
3580 // destructor.
3581
3582 if (!obj) obj = fFitObject;
3583
3584 TList *retList = new TList();
3585
3586 std::pair<fPrevFitIter, fPrevFitIter> look = fPrevFit.equal_range(obj);
3587 for ( fPrevFitIter it = look.first; it != look.second; ++it ) {
3588 retList->Add(it->second);
3589 }
3590
3591 return retList;
3592}
3593
3595{
3596 // Get the fit function selected or declared in the fiteditor
3597
3598 TF1 *fitFunc = 0;
3599 // If the function is not editable ==> it means it is registered in
3600 // gROOT
3601 if ( fNone->GetState() == kButtonDisabled )
3602 {
3603 // So we find it
3604 TF1* tmpF1 = FindFunction();
3605 // And if we don't find it, then it means there is something wrong!
3606 if ( tmpF1 == 0 )
3607 {
3609 "Error...", "1) Verify the entered function string!",
3610 kMBIconStop,kMBOk, 0);
3611 return 0;
3612 }
3613
3614 // Now we make a copy that will be used temporary. The caller of
3615 // the function should delete the returned function.
3616 fitFunc = (TF1*)tmpF1->IsA()->New();
3617 tmpF1->Copy(*fitFunc);
3618 // Copy the parameters of the function, if and only if the
3619 // parameters stored does not correspond with the ones of these
3620 // functions. Perhaps the user has already called
3621 // DoSetParameters. There is no way to know whether the
3622 // parameters have been modified, so we check the size of
3623 // fFuncPars against number of parameters.
3624 if ( int(fFuncPars.size()) != tmpF1->GetNpar() )
3625 {
3626 fitFunc->SetParameters(tmpF1->GetParameters());
3627 GetParameters(fFuncPars, fitFunc);
3628 } else {
3629 SetParameters(fFuncPars, fitFunc);
3630 }
3631 }
3632
3633 // If, we have no function at this point, it means that is is
3634 // described in fEnteredFunc, so we create it from scratch.
3635 if ( fitFunc == 0 )
3636 {
3637 ROOT::Fit::DataRange drange;
3638 GetRanges(drange);
3639 double xmin, xmax, ymin, ymax, zmin, zmax;
3640 drange.GetRange(xmin, xmax, ymin, ymax, zmin, zmax);
3641
3642 // Depending of course on the number of dimensions the object
3643 // has. These commands will raise an error message if the user
3644 // has not defined the function properly
3645 if ( fDim == 1 || fDim == 0 )
3646 {
3647
3648 fitFunc = new TF1("PrevFitTMP",fEnteredFunc->GetText(), xmin, xmax );
3649 //std::cout << "GetFitFunction - created function PrevFitTMP " << fEnteredFunc->GetText() << " " << fitFunc << std::endl;
3650 if (fNormAdd->IsOn())
3651 {
3652 if (fSumFunc) delete fSumFunc;
3654 fitFunc = new TF1("PrevFitTMP", *fSumFunc, xmin, xmax, fSumFunc->GetNpar());
3655 for (int i = 0; i < fitFunc->GetNpar(); ++i) fitFunc->SetParName(i, fSumFunc->GetParName(i) );
3656 //std::cout << "create fit normalized function " << fSumFunc << " fitfunc " << fitFunc << std::endl;
3657 }
3658
3659 if (fConv -> IsOn())
3660 {
3661 if (fConvFunc) delete fConvFunc;
3663 fitFunc = new TF1("PrevFitTMP", *fConvFunc, xmin, xmax, fConvFunc->GetNpar());
3664 for (int i = 0; i < fitFunc->GetNpar(); ++i) fitFunc->SetParName(i, fConvFunc->GetParName(i) );
3665 //std::cout << "create fit convolution function " << fSumFunc << " fitfunc " << fitFunc << std::endl;
3666 }
3667 }
3668 else if ( fDim == 2 ) {
3669 fitFunc = new TF2("PrevFitTMP",fEnteredFunc->GetText(), xmin, xmax, ymin, ymax );
3670 }
3671 else if ( fDim == 3 ) {
3672 fitFunc = new TF3("PrevFitTMP",fEnteredFunc->GetText(), xmin, xmax, ymin, ymax, zmin, zmax );
3673 }
3674
3675 // if the function is not a C defined
3676 if ( fNone->GetState() != kButtonDisabled )
3677 {
3678 // and the formulas are the same
3679 TF1* tmpF1 = FindFunction();
3680// if (tmpF1)
3681 //std::cout << "GetFitFunction: found existing function " << tmpF1 << " " << tmpF1->GetName() << " " << tmpF1->GetExpFormula() << std::endl;
3682// else
3683 //std::cout << "GetFitFunction: - no existing function found " << std::endl;
3684 if ( tmpF1 != 0 && fitFunc != 0 &&
3685 strcmp(tmpF1->GetExpFormula(), fEnteredFunc->GetText()) == 0 ) {
3686 // copy everything from the founction available in gROOT
3687 //std::cout << "GetFitFunction: copying tmp function in PrevFitTMP " << tmpF1->GetName() << " "
3688 // << tmpF1->GetExpFormula() << std::endl;
3689 tmpF1->Copy(*fitFunc);
3690 if ( int(fFuncPars.size()) != tmpF1->GetNpar() )
3691 {
3692 GetParameters(fFuncPars, fitFunc);
3693 }
3694 }
3695 }
3696 }
3697
3698 return fitFunc;
3699}
@ kButton1Down
Definition: Buttons.h:17
void Class()
Definition: Class.C:29
@ PAR_MIN
Definition: CommonDefs.h:39
@ PAR_MAX
Definition: CommonDefs.h:40
@ PAR_VAL
Definition: CommonDefs.h:38
@ kFP_PRED1D
Definition: CommonDefs.h:29
@ kFP_PQET
Definition: CommonDefs.h:16
@ kFP_CLOSE
Definition: CommonDefs.h:26
@ kFP_ADD
Definition: CommonDefs.h:13
@ kFP_CHEB7
Definition: CommonDefs.h:9
@ kFP_RESET
Definition: CommonDefs.h:26
@ kFP_FILE
Definition: CommonDefs.h:13
@ kFP_YMIN
Definition: CommonDefs.h:17
@ kFP_UPDATE
Definition: CommonDefs.h:26
@ kFP_MUSR
Definition: CommonDefs.h:15
@ kFP_POL6
Definition: CommonDefs.h:7
@ kFP_LGSL
Definition: CommonDefs.h:19
@ kFP_XMIN
Definition: CommonDefs.h:17
@ kFP_CHEB2
Definition: CommonDefs.h:8
@ kFP_LMIN2
Definition: CommonDefs.h:19
@ kFP_XYGAUS
Definition: CommonDefs.h:10
@ kFP_CHEB6
Definition: CommonDefs.h:9
@ kFP_MCHIS
Definition: CommonDefs.h:15
@ kFP_MLINF
Definition: CommonDefs.h:15
@ kFP_IMERR
Definition: CommonDefs.h:14
@ kFP_POL1
Definition: CommonDefs.h:6
@ kFP_POL5
Definition: CommonDefs.h:6
@ kFP_LFUM
Definition: CommonDefs.h:19
@ kFP_POL0
Definition: CommonDefs.h:6
@ kFP_NOSEL
Definition: CommonDefs.h:32
@ kFP_INTEG
Definition: CommonDefs.h:14
@ kFP_DATAS
Definition: CommonDefs.h:30
@ kFP_CHEB9
Definition: CommonDefs.h:9
@ kFP_LAND
Definition: CommonDefs.h:5
@ kFP_CHEB1
Definition: CommonDefs.h:8
@ kFP_NONE
Definition: CommonDefs.h:13
@ kFP_MLIST
Definition: CommonDefs.h:15
@ kFP_CHEB0
Definition: CommonDefs.h:8
@ kFP_POL4
Definition: CommonDefs.h:6
@ kFP_CHEB4
Definition: CommonDefs.h:8
@ kFP_EXPO
Definition: CommonDefs.h:5
@ kFP_POL7
Definition: CommonDefs.h:7
@ kFP_GSLSA
Definition: CommonDefs.h:21
@ kFP_CHEB5
Definition: CommonDefs.h:8
@ kFP_MITR
Definition: CommonDefs.h:24
@ kFP_UFUNC
Definition: CommonDefs.h:29
@ kFP_IFITR
Definition: CommonDefs.h:14
@ kFP_BIGAUS
Definition: CommonDefs.h:10
@ kFP_XYLANN
Definition: CommonDefs.h:10
@ kFP_MINMETHOD
Definition: CommonDefs.h:20
@ kFP_FLIST
Definition: CommonDefs.h:5
@ kFP_TLIST
Definition: CommonDefs.h:29
@ kFP_POL3
Definition: CommonDefs.h:6
@ kFP_FIT
Definition: CommonDefs.h:26
@ kFP_NORMADD
Definition: CommonDefs.h:13
@ kFP_GAUSN
Definition: CommonDefs.h:5
@ kFP_MTOL
Definition: CommonDefs.h:24
@ kFP_CHEB8
Definition: CommonDefs.h:9
@ kFP_CHEB3
Definition: CommonDefs.h:8
@ kFP_FUMILI
Definition: CommonDefs.h:20
@ kFP_RBUST
Definition: CommonDefs.h:13
@ kFP_POL2
Definition: CommonDefs.h:6
@ kFP_POL8
Definition: CommonDefs.h:7
@ kFP_SIMPLX
Definition: CommonDefs.h:19
@ kFP_PDEF
Definition: CommonDefs.h:16
@ kFP_PRED2D
Definition: CommonDefs.h:29
@ kFP_USERG
Definition: CommonDefs.h:14
@ kFP_PARS
Definition: CommonDefs.h:13
@ kFP_XYLAN
Definition: CommonDefs.h:10
@ kFP_MBINL
Definition: CommonDefs.h:15
@ kFP_ALTFUNC
Definition: CommonDefs.h:33
@ kFP_DNOST
Definition: CommonDefs.h:16
@ kFP_GSLLM
Definition: CommonDefs.h:21
@ kFP_BFGS
Definition: CommonDefs.h:21
@ kFP_MUBIN
Definition: CommonDefs.h:15
@ kFP_CONV
Definition: CommonDefs.h:13
@ kFP_GAUS
Definition: CommonDefs.h:5
@ kFP_PVER
Definition: CommonDefs.h:16
@ kFP_GALIB
Definition: CommonDefs.h:22
@ kFP_LMIN
Definition: CommonDefs.h:19
@ kFP_POL9
Definition: CommonDefs.h:7
@ kFP_EMPW1
Definition: CommonDefs.h:13
@ kFP_DNONE
Definition: CommonDefs.h:16
@ kFP_GSLPR
Definition: CommonDefs.h:21
@ kFP_USER
Definition: CommonDefs.h:12
@ kFP_SCAN
Definition: CommonDefs.h:22
@ kFP_LANDN
Definition: CommonDefs.h:5
@ kFP_ALLW1
Definition: CommonDefs.h:14
@ kFP_COMBINATION
Definition: CommonDefs.h:20
@ kFP_XYEXP
Definition: CommonDefs.h:10
@ kFP_GSLFR
Definition: CommonDefs.h:21
@ kFP_BFGS2
Definition: CommonDefs.h:21
@ kFP_ADDLS
Definition: CommonDefs.h:14
@ kFP_DADVB
Definition: CommonDefs.h:16
@ kFP_LGAS
Definition: CommonDefs.h:19
@ kFP_MERR
Definition: CommonDefs.h:24
@ kFP_PREVFIT
Definition: CommonDefs.h:29
@ kFP_MIGRAD
Definition: CommonDefs.h:19
@ kFP_TMVAGA
Definition: CommonDefs.h:22
@ kFP_DSAME
Definition: CommonDefs.h:16
std::multimap< TObject *, TF1 * >::iterator fPrevFitIter
Definition: CommonDefs.h:1
std::vector< TF1 * >::iterator fSystemFuncIter
Definition: CommonDefs.h:2
SVector< double, 2 > v
Definition: Dict.h:5
ULong_t Pixel_t
Definition: GuiTypes.h:39
#define f(i)
Definition: RSha256.hxx:104
#define c(i)
Definition: RSha256.hxx:101
#define s1(x)
Definition: RSha256.hxx:91
#define h(i)
Definition: RSha256.hxx:106
const Ssiz_t kNPOS
Definition: RtypesCore.h:111
int Int_t
Definition: RtypesCore.h:41
unsigned int UInt_t
Definition: RtypesCore.h:42
const Bool_t kFALSE
Definition: RtypesCore.h:88
long Long_t
Definition: RtypesCore.h:50
bool Bool_t
Definition: RtypesCore.h:59
double Double_t
Definition: RtypesCore.h:55
long long Long64_t
Definition: RtypesCore.h:69
float Float_t
Definition: RtypesCore.h:53
const Bool_t kTRUE
Definition: RtypesCore.h:87
const char Option_t
Definition: RtypesCore.h:62
#define ClassImp(name)
Definition: Rtypes.h:363
const Bool_t kIterForward
Definition: TCollection.h:40
#define gDirectory
Definition: TDirectory.h:213
#define R__ASSERT(e)
Definition: TError.h:96
TF1 * copyTF1(TF1 *f)
Copies f into a new TF1 to be stored in the fitpanel with it's own ownership.
Definition: TFitEditor.cxx:230
void GetParameters(TFitEditor::FuncParams_t &pars, TF1 *func)
Stores the parameters of the given function into pars.
Definition: TFitEditor.cxx:270
void InitParameters(TF1 *func, FitObject *fitobj)
Parameter initialization for the function.
Definition: TFitEditor.cxx:302
void GetTreeVarsAndCuts(TGComboBox *dataSet, TString &variablesStr, TString &cutsStr)
Splits the entry in fDataSet to get the selected variables and cuts from the text.
Definition: TFitEditor.cxx:321
void SetParameters(TFitEditor::FuncParams_t &pars, TF1 *func)
Restore the parameters from pars into the function.
Definition: TFitEditor.cxx:287
void SearchCanvases(TSeqCollection *canvases, std::vector< TObject * > &objects)
std::multimap< TObject *, TF1 * > FitFuncMap_t
Definition: TFitEditor.cxx:182
@ kObjectMultiGraph
Definition: TFitEditor.h:43
@ kObjectGraph
Definition: TFitEditor.h:39
@ kObjectHStack
Definition: TFitEditor.h:41
@ kObjectHisto
Definition: TFitEditor.h:38
@ kObjectGraph2D
Definition: TFitEditor.h:40
@ kObjectTree
Definition: TFitEditor.h:42
@ kButtonDown
Definition: TGButton.h:54
@ kButtonDisabled
Definition: TGButton.h:56
@ kButtonUp
Definition: TGButton.h:53
@ kButtonEngaged
Definition: TGButton.h:55
#define gClient
Definition: TGClient.h:166
@ kDoubleScaleBoth
@ kMWMDecorResizeH
Definition: TGFrame.h:96
@ kMWMFuncAll
Definition: TGFrame.h:80
@ kMWMFuncResize
Definition: TGFrame.h:81
@ kMWMDecorMaximize
Definition: TGFrame.h:100
@ kMWMDecorMinimize
Definition: TGFrame.h:99
@ kMWMDecorMenu
Definition: TGFrame.h:98
@ kMWMDecorAll
Definition: TGFrame.h:94
@ kMWMFuncMaximize
Definition: TGFrame.h:84
@ kMWMInputModeless
Definition: TGFrame.h:88
@ kMWMFuncMinimize
Definition: TGFrame.h:83
@ kDeepCleanup
Definition: TGFrame.h:51
@ kVerticalFrame
Definition: TGFrame.h:59
@ kFixedWidth
Definition: TGFrame.h:65
@ kFitWidth
Definition: TGFrame.h:64
@ kHorizontalFrame
Definition: TGFrame.h:60
@ kFixedSize
Definition: TGFrame.h:68
@ kLHintsRight
Definition: TGLayout.h:33
@ kLHintsExpandY
Definition: TGLayout.h:38
@ kLHintsLeft
Definition: TGLayout.h:31
@ kLHintsCenterY
Definition: TGLayout.h:35
@ kLHintsNormal
Definition: TGLayout.h:39
@ kLHintsBottom
Definition: TGLayout.h:36
@ kLHintsTop
Definition: TGLayout.h:34
@ kLHintsExpandX
Definition: TGLayout.h:37
@ kMBOk
Definition: TGMsgBox.h:44
@ kMBIconAsterisk
Definition: TGMsgBox.h:36
@ kMBIconStop
Definition: TGMsgBox.h:33
@ kTextLeft
Definition: TGWidget.h:34
float xmin
Definition: THbookFile.cxx:93
float ymin
Definition: THbookFile.cxx:93
float xmax
Definition: THbookFile.cxx:93
float ymax
Definition: THbookFile.cxx:93
R__EXTERN TPluginManager * gPluginMgr
R__EXTERN void * gTQSender
Definition: TQObject.h:45
#define gROOT
Definition: TROOT.h:410
char * Form(const char *fmt,...)
#define gPad
Definition: TVirtualPad.h:286
#define gVirtualX
Definition: TVirtualX.h:345
@ kWatch
Definition: TVirtualX.h:47
@ kPointer
Definition: TVirtualX.h:47
Class describing the binned data sets : vectors of x coordinates, y values and optionally error on y ...
Definition: BinData.h:53
class describing the range in the coordinates it supports multiple range in a coordinate.
Definition: DataRange.h:34
void AddRange(unsigned int icoord, double xmin, double xmax)
add a range [xmin,xmax] for the new coordinate icoord Adding a range does not delete existing one,...
Definition: DataRange.cxx:94
void GetRange(unsigned int irange, unsigned int icoord, double &xmin, double &xmax) const
get the i-th range for given coordinate.
Definition: DataRange.h:103
unsigned int Size() const
return number of fit points
Definition: FitData.h:303
const double * Coords(unsigned int ipoint) const
return a pointer to the coordinates data for the given fit point
Definition: FitData.h:246
Class describing the unbinned data sets (just x coordinates values) of any dimensions.
Definition: UnBinData.h:42
void SetMaxFunctionCalls(unsigned int maxfcn)
set maximum of function calls
void SetMaxIterations(unsigned int maxiter)
set maximum iterations (one iteration can have many function calls)
void SetMinimizerType(const char *type)
set minimizer type
static const std::string & DefaultMinimizerType()
void SetErrorDef(double err)
set error def
void SetMinimizerAlgorithm(const char *type)
set minimizer algorithm
void SetTolerance(double tol)
set the tolerance
virtual Int_t FindBin(Double_t x)
Find bin number corresponding to abscissa x.
Definition: TAxis.cxx:279
virtual Double_t GetBinLowEdge(Int_t bin) const
Return low edge of bin.
Definition: TAxis.cxx:504
Int_t GetLast() const
Return last bin on the axis i.e.
Definition: TAxis.cxx:455
Int_t GetNbins() const
Definition: TAxis.h:121
virtual Double_t GetBinUpEdge(Int_t bin) const
Return up edge of bin.
Definition: TAxis.cxx:514
Int_t GetFirst() const
Return first bin on the axis i.e.
Definition: TAxis.cxx:444
The Canvas class.
Definition: TCanvas.h:31
Int_t GetWindowTopX()
Returns current top x position of window on screen.
Definition: TCanvas.cxx:1149
Int_t GetWindowTopY()
Returns current top y position of window on screen.
Definition: TCanvas.cxx:1160
virtual void Selected(TVirtualPad *pad, TObject *obj, Int_t event)
Emit Selected() signal.
Definition: TCanvas.cxx:1572
virtual void SetCursor(ECursor cursor)
Set cursor.
Definition: TCanvas.cxx:1929
UInt_t GetWindowWidth() const
Definition: TCanvas.h:167
Class wrapping convolution of two functions.
Int_t GetNpar() const
const char * GetParName(Int_t ipar) const
Class adding two functions: c1*f1+c2*f2.
Definition: TF1NormSum.h:19
const char * GetParName(Int_t ipar) const
Definition: TF1NormSum.h:66
Int_t GetNpar() const
Return the number of (non constant) parameters including the coefficients: for 2 functions: c1,...
Definition: TF1NormSum.cxx:360
1-Dim function class
Definition: TF1.h:211
virtual Int_t GetNumber() const
Definition: TF1.h:482
virtual void GetParLimits(Int_t ipar, Double_t &parmin, Double_t &parmax) const
Return limits for parameter ipar.
Definition: TF1.cxx:1914
virtual void Copy(TObject &f1) const
Copy this F1 to a new F1.
Definition: TF1.cxx:994
virtual void SetRange(Double_t xmin, Double_t xmax)
Initialize the upper and lower bounds to draw the function.
Definition: TF1.cxx:3512
virtual void SetParent(TObject *p=0)
Definition: TF1.h:649
virtual Int_t GetNpar() const
Definition: TF1.h:465
virtual TString GetExpFormula(Option_t *option="") const
Definition: TF1.h:445
virtual Double_t * GetParameters() const
Definition: TF1.h:504
virtual void GetRange(Double_t *xmin, Double_t *xmax) const
Return range of a generic N-D function.
Definition: TF1.cxx:2257
virtual void SetParLimits(Int_t ipar, Double_t parmin, Double_t parmax)
Set limits for parameter ipar.
Definition: TF1.cxx:3491
virtual void SetParName(Int_t ipar, const char *name)
Set name of parameter number ipar.
Definition: TF1.cxx:3443
virtual void Draw(Option_t *option="")
Draw this function with its current attributes.
Definition: TF1.cxx:1312
virtual Bool_t IsValid() const
Return kTRUE if the function is valid.
Definition: TF1.cxx:2846
virtual void SetParameters(const Double_t *params)
Definition: TF1.h:628
virtual void SetParameter(Int_t param, Double_t value)
Definition: TF1.h:618
virtual void Save(Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Double_t zmin, Double_t zmax)
Save values of function in array fSave.
Definition: TF1.cxx:3127
virtual Bool_t AddToGlobalList(Bool_t on=kTRUE)
Add to global list of functions (gROOT->GetListOfFunctions() ) return previous status (true if the fu...
Definition: TF1.cxx:832
virtual Double_t GetParameter(Int_t ipar) const
Definition: TF1.h:496
A 2-Dim function with parameters.
Definition: TF2.h:29
virtual void Save(Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Double_t zmin, Double_t zmax)
Save values of function in array fSave.
Definition: TF2.cxx:776
virtual void SetRange(Double_t xmin, Double_t xmax)
Initialize the upper and lower bounds to draw the function.
Definition: TF2.h:150
A 3-Dim function with parameters.
Definition: TF3.h:28
virtual void SetRange(Double_t xmin, Double_t xmax)
Initialize the upper and lower bounds to draw the function.
Definition: TF3.h:143
TGCheckButton * fBestErrors
Definition: TFitEditor.h:91
TF1 * FindFunction()
This method looks among the functions stored by the fitpanel, the one that is currently selected in t...
Definition: TFitEditor.cxx:188
TGDoubleHSlider * fSliderX
Definition: TFitEditor.h:105
TFitEditor(const TFitEditor &)
TGComboBox * fMinMethodList
Definition: TFitEditor.h:148
TGTextButton * fSetParam
Definition: TFitEditor.h:89
void CreateGeneralTab()
Create 'General' tab.
Definition: TFitEditor.cxx:660
virtual void DoUpdate()
Easy here!
TGLayoutHints * fLayoutNormAdd
Definition: TFitEditor.h:87
TGNumberEntry * fSliderXMax
Definition: TFitEditor.h:106
virtual void DoConvolution(Bool_t on)
Slot connected to addition of predefined functions.
TGNumberEntry * fSliderXMin
Definition: TFitEditor.h:107
virtual void SetFitObject(TVirtualPad *pad, TObject *obj, Int_t event)
Slot called when the user clicks on an object inside a canvas.
virtual void DoEnteredFunction()
Slot connected to entered function in text entry.
virtual void DoNormAddition(Bool_t on)
Slot connected to addition of predefined functions.
virtual void DoPrintOpt(Bool_t on)
Slot connected to print option settings.
std::vector< TF1 * > fSystemFuncs
Definition: TFitEditor.h:141
TGCheckButton * fDrawSame
Definition: TFitEditor.h:103
TGRadioButton * fLibMinuit
Definition: TFitEditor.h:143
TGRadioButton * fConv
Definition: TFitEditor.h:84
TVirtualPad * fParentPad
Definition: TFitEditor.h:120
TGRadioButton * fOptDefault
Definition: TFitEditor.h:117
TGCheckButton * fLinearFit
Definition: TFitEditor.h:99
TGRadioButton * fLibMinuit2
Definition: TFitEditor.h:144
virtual void DoMinMethod(Int_t)
Set selected minimization method in use.
TF1 * HasFitFunction()
Look in the list of function for TF1.
void UpdateGUI()
Set the fit panel GUI according to the selected object.
TGCheckButton * fUseRange
Definition: TFitEditor.h:92
virtual void DoSliderXMoved()
Slot connected to range settings on x-axis.
TAxis * fYaxis
Definition: TFitEditor.h:125
TGTextButton * fDrawAdvanced
Definition: TFitEditor.h:104
TGComboBox * fTypeFit
Definition: TFitEditor.h:77
virtual void DoReset()
Reset all fit parameters.
TGNumberEntryField * fTolerance
Definition: TFitEditor.h:150
TGCheckButton * fNoDrawing
Definition: TFitEditor.h:102
TF1 * GetFitFunction()
void SetEditable(Bool_t)
Switch ON/OFF edit mode.
TGHorizontalFrame * fSliderZParent
Definition: TFitEditor.h:114
virtual void DoSetParameters()
Open set parameters dialog.
TGCompositeFrame * fMinimization
Definition: TFitEditor.h:70
TGTab * fTab
Definition: TFitEditor.h:67
virtual void DoLinearFit()
Slot connected to linear fit settings.
void FillFunctionList(Int_t selected=-1)
Fills the list of functions depending on the type of fit selected.
virtual void Show(TVirtualPad *pad, TObject *obj)
Show the fit panel (possible only via context menu).
virtual void DoNumericSliderYChanged()
syncronize the numeric slider with the graphical one.
virtual void DoClose()
Close the fit panel.
TF1NormSum * fSumFunc
Definition: TFitEditor.h:127
TGComboBox * fMethodList
Definition: TFitEditor.h:98
TGDoubleHSlider * fSliderY
Definition: TFitEditor.h:108
void ShowObjectName(TObject *obj)
Show object name on the top.
static TFitEditor * fgFitDialog
Definition: TFitEditor.h:157
virtual void RecursiveRemove(TObject *obj)
When obj is deleted, clear fFitObject if fFitObject = obj.
TList * GetFitObjectListOfFunctions()
virtual void DoAdvancedOptions()
Slot connected to advanced option button (opens a dialog).
TGRadioButton * fLibFumili
Definition: TFitEditor.h:145
virtual void DoDataSet(Int_t sel)
Selects the data set to be fitted.
TGRadioButton * fAdd
Definition: TFitEditor.h:82
TGComboBox * BuildMethodList(TGFrame *parent, Int_t id)
Create method list in a combo box.
void CreateMinimizationTab()
Create 'Minimization' tab.
Definition: TFitEditor.cxx:899
TGRadioButton * fLibGenetics
Definition: TFitEditor.h:147
TGCheckButton * fImproveResults
Definition: TFitEditor.h:96
TGComboBox * fFuncList
Definition: TFitEditor.h:78
TF1Convolution * fConvFunc
TF1NormSum object.
Definition: TFitEditor.h:128
TGCheckButton * fUseGradient
Definition: TFitEditor.h:94
TGRadioButton * fNormAdd
Definition: TFitEditor.h:83
virtual Option_t * GetDrawOption() const
Get draw options of the selected object.
virtual void SetCanvas(TCanvas *c)
Connect to another canvas.
EObjectType fType
Definition: TFitEditor.h:122
TGNumberEntryField * fIterations
Definition: TFitEditor.h:151
TGCompositeFrame * fTabContainer
Definition: TFitEditor.h:68
virtual void DoFunction(Int_t sel)
Slot connected to predefined fit function settings.
virtual void DoUseFuncRange()
virtual ~TFitEditor()
Fit editor destructor.
Definition: TFitEditor.cxx:515
TGComboBox * fDataSet
Definition: TFitEditor.h:76
virtual void ConnectSlots()
Connect GUI signals to fit panel slots.
virtual void DoFit()
Perform a fit with current parameters' settings.
TAxis * fZaxis
Definition: TFitEditor.h:126
TGRadioButton * fOptVerbose
Definition: TFitEditor.h:118
virtual void SetFunction(const char *function)
Set the function to be used in performed fit.
virtual void Terminate()
Called to delete the fit panel.
TGTextButton * fUserButton
Definition: TFitEditor.h:80
TGDoubleHSlider * fSliderZ
Definition: TFitEditor.h:111
TGTextButton * fFitButton
Definition: TFitEditor.h:72
virtual void DoMaxIterations()
Set the maximum number of iterations.
virtual void DoLibrary(Bool_t on)
Set selected minimization library in use.
void FillDataSetList()
Create a combo box with all the possible objects to be fitted.
virtual void DoEmptyBinsAllWeights1()
Slot connected to 'include emtry bins and forse all weights to 1' setting.
virtual void DoSliderYMoved()
Slot connected to range settings on y-axis.
void RetrieveOptions(Foption_t &, TString &, ROOT::Math::MinimizerOptions &, Int_t)
Retrieve the fitting options from all the widgets.
std::vector< FuncParamData_t > fFuncPars
Definition: TFitEditor.h:138
TGHorizontalFrame * fSliderYParent
Definition: TFitEditor.h:113
TGCheckButton * fNoChi2
Definition: TFitEditor.h:100
virtual void DoNoStoreDrawing()
Slot connected to 'no storing, no drawing' settings.
void MakeTitle(TGCompositeFrame *parent, const char *title)
Create section title in the GUI.
virtual void DoNoSelection()
Slot called when users close a TCanvas or when the user select no object.
TList * GetListOfFittingFunctions(TObject *obj=0)
TGTextButton * fUpdateButton
Definition: TFitEditor.h:71
TGTextEntry * fEnteredFunc
Definition: TFitEditor.h:79
TGCheckButton * fIntegral
Definition: TFitEditor.h:90
virtual void DoAllWeights1()
Slot connected to 'set all weights to 1' setting.
Bool_t SetObjectType(TObject *obj)
Check whether the object suitable for fitting and set its type, dimension and method combo box accord...
virtual void Hide()
Hide the fit panel and set it to non-active state.
TGNumberEntryField * fErrorScale
Definition: TFitEditor.h:149
TAxis * fXaxis
Definition: TFitEditor.h:124
std::vector< FuncParamData_t > FuncParams_t
Definition: TFitEditor.h:249
TGLayoutHints * fLayoutAdd
Definition: TFitEditor.h:86
TGHorizontalFrame * fSliderXParent
Definition: TFitEditor.h:112
void ProcessTreeInput(TObject *objSelected, Int_t selected, TString variables, TString cuts)
TGCheckButton * fEnableRobust
Definition: TFitEditor.h:115
void DrawSelection(bool restore=false)
Draws the square around the object showing where the limits for fitting are.
TGCheckButton * fEmptyBinsWghts1
Definition: TFitEditor.h:97
virtual void DoSliderZMoved()
Slot connected to range settings on z-axis.
Int_t fDim
Definition: TFitEditor.h:123
TGNumberEntry * fSliderYMin
Definition: TFitEditor.h:110
void GetRanges(ROOT::Fit::DataRange &)
std::multimap< TObject *, TF1 * > fPrevFit
Definition: TFitEditor.h:140
TGNumberEntry * fRobustValue
Definition: TFitEditor.h:116
static TFitEditor * GetInstance(TVirtualPad *pad=0, TObject *obj=0)
Static method - opens the fit panel.
Definition: TFitEditor.cxx:343
TGNumberEntry * fSliderYMax
Definition: TFitEditor.h:109
virtual void DoNoChi2()
Slot connected to 'no chi2' option settings.
TGCheckButton * fAdd2FuncList
Definition: TFitEditor.h:93
TGCompositeFrame * fGeneral
Definition: TFitEditor.h:69
virtual void DisconnectSlots()
Disconnect GUI signals from fit panel slots.
void GetFunctionsFromSystem()
TGRadioButton * fOptQuiet
Definition: TFitEditor.h:119
void FillMinMethodList(Int_t selected=-1)
Fills the list of methods depending on the minimization library selected.
TGCheckButton * fNoStoreDrawing
Definition: TFitEditor.h:101
TGCheckButton * fAllWeights1
Definition: TFitEditor.h:95
TGRadioButton * fNone
Definition: TFitEditor.h:81
TGLayoutHints * fLayoutConv
Definition: TFitEditor.h:88
TGTextButton * fResetButton
Definition: TFitEditor.h:73
void CreateFunctionGroup()
Creates the Frame that contains oll the information about the function.
Definition: TFitEditor.cxx:544
TGLayoutHints * fLayoutNone
Definition: TFitEditor.h:85
TGLabel * fSelLabel
Definition: TFitEditor.h:75
TGRadioButton * fLibGSL
Definition: TFitEditor.h:146
Int_t CheckFunctionString(const char *str)
Check entered function string.
TObject * fFitObject
Definition: TFitEditor.h:121
virtual void DoRobustFit()
Slot connected to 'robust fitting' option settings.
virtual void CloseWindow()
Close fit panel window.
TGTextButton * fCloseButton
Definition: TFitEditor.h:74
virtual void DoAddition(Bool_t on)
Slot connected to addition of predefined functions.
Bool_t fChangedParams
Definition: TFitEditor.h:155
TGStatusBar * fStatusBar
Definition: TFitEditor.h:153
virtual void DoUserDialog()
Open a dialog for getting a user defined method.
virtual void DoNumericSliderXChanged()
Sincronize the numeric sliders with the graphical one.
The Formula class.
Definition: TFormula.h:84
Int_t GetNpar() const
Definition: TFormula.h:222
virtual void SetToolTipText(const char *text, Long_t delayms=400)
Set tool tip text associated with this button.
Definition: TGButton.cxx:395
virtual EButtonState GetState() const
Definition: TGButton.h:112
virtual void SetEnabled(Bool_t e=kTRUE)
Set enabled or disabled state of button.
Definition: TGButton.cxx:409
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set button state.
Definition: TGButton.cxx:185
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set check button state.
Definition: TGButton.cxx:1200
const TGWindow * GetRoot() const
Returns current root (i.e.
Definition: TGClient.cxx:224
UInt_t GetDisplayWidth() const
Get display width.
Definition: TGClient.cxx:262
virtual Int_t GetSelected() const
Definition: TGComboBox.h:134
virtual TGLBEntry * GetSelectedEntry() const
Definition: TGComboBox.h:135
virtual void AddEntry(TGString *s, Int_t id)
Definition: TGComboBox.h:106
virtual void RemoveAll()
Remove all entries from combo box.
Definition: TGComboBox.cxx:675
virtual void RemoveEntry(Int_t id=-1)
Remove entry. If id == -1, the currently selected entry is removed.
Definition: TGComboBox.cxx:508
virtual TGListBox * GetListBox() const
Definition: TGComboBox.h:130
virtual void Select(Int_t id, Bool_t emit=kTRUE)
Make the selected item visible in the combo box window and emit signals according to the second param...
Definition: TGComboBox.cxx:443
virtual void InsertEntry(TGString *s, Int_t id, Int_t afterID)
Definition: TGComboBox.h:112
virtual TGLBEntry * FindEntry(const char *s) const
Find entry by name.
Definition: TGComboBox.cxx:414
virtual Int_t GetNumberOfEntries() const
Definition: TGComboBox.h:127
TGCompositeFrame(const TGCompositeFrame &)
Int_t GetState(TGFrame *f) const
Get state of sub frame.
Definition: TGFrame.cxx:1200
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1099
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
Definition: TGFrame.cxx:949
virtual void Layout()
Layout the elements of the composite frame.
Definition: TGFrame.cxx:1239
virtual void ChangeOptions(UInt_t options)
Change composite frame options. Options is an OR of the EFrameTypes.
Definition: TGFrame.cxx:1025
virtual void SetCleanup(Int_t mode=kLocalCleanup)
Turn on automatic cleanup of child frames in dtor.
Definition: TGFrame.cxx:1054
virtual TGDimension GetDefaultSize() const
std::cout << fWidth << "x" << fHeight << std::endl;
Definition: TGFrame.h:375
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
Definition: TGFrame.cxx:1146
virtual void ShowFrame(TGFrame *f)
Show sub frame.
Definition: TGFrame.cxx:1186
virtual void HideFrame(TGFrame *f)
Hide sub frame.
Definition: TGFrame.cxx:1172
UInt_t fHeight
Definition: TGDimension.h:30
UInt_t fWidth
Definition: TGDimension.h:29
virtual Float_t GetMaxPosition() const
virtual void GetPosition(Float_t &min, Float_t &max) const
virtual Float_t GetMinPosition() const
virtual void SetRange(Float_t min, Float_t max)
virtual void SetScale(Int_t scale)
virtual void SetPosition(Float_t min, Float_t max)
virtual UInt_t GetDefaultHeight() const
Definition: TGFrame.h:238
virtual UInt_t GetOptions() const
Definition: TGFrame.h:244
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:587
UInt_t GetHeight() const
Definition: TGFrame.h:272
virtual void MoveResize(Int_t x, Int_t y, UInt_t w=0, UInt_t h=0)
Move and/or resize the frame.
Definition: TGFrame.cxx:611
virtual void MapWindow()
Definition: TGFrame.h:251
UInt_t GetWidth() const
Definition: TGFrame.h:271
virtual void UnmapWindow()
Definition: TGFrame.h:253
Int_t EntryId() const
Definition: TGListBox.h:68
virtual void SetTextColor(Pixel_t color, Bool_t global=kFALSE)
Changes text color.
Definition: TGLabel.cxx:359
virtual void SetText(TGString *newText)
Set new text in label.
Definition: TGLabel.cxx:177
virtual void Resize(UInt_t w, UInt_t h)
Resize the listbox widget.
Definition: TGListBox.cxx:1419
virtual Int_t GetNumberOfEntries() const
Definition: TGListBox.h:331
virtual TGLBEntry * GetEntry(Int_t id) const
Returns list box entry with specified id.
Definition: TGListBox.cxx:1380
void SetClassHints(const char *className, const char *resourceName)
Set the windows class and resource name.
Definition: TGFrame.cxx:1814
void SetIconName(const char *name)
Set window icon name. This is typically done via the window manager.
Definition: TGFrame.cxx:1759
void SetWMSize(UInt_t w, UInt_t h)
Give the window manager a window size hint.
Definition: TGFrame.cxx:1849
void SetWMPosition(Int_t x, Int_t y)
Give the window manager a window position hint.
Definition: TGFrame.cxx:1837
void SetMWMHints(UInt_t value, UInt_t funcs, UInt_t input)
Set decoration style for MWM-compatible wm (mwm, ncdwm, fvwm?).
Definition: TGFrame.cxx:1824
void SetWMSizeHints(UInt_t wmin, UInt_t hmin, UInt_t wmax, UInt_t hmax, UInt_t winc, UInt_t hinc)
Give the window manager minimum and maximum size hints.
Definition: TGFrame.cxx:1862
void SetWindowName(const char *name=0)
Set window name. This is typically done via the window manager.
Definition: TGFrame.cxx:1746
virtual Long_t GetIntNumber() const
Get the numeric value (integer representation).
virtual Double_t GetNumber() const
Get the numeric value (floating point representation).
virtual void ReturnPressed()
Return was pressed.
virtual void SetIntNumber(Long_t val)
Set the numeric value (integer representation).
virtual void SetNumber(Double_t val)
Set the numeric value (floating point representation).
virtual void SetNumber(Double_t val)
TGNumberEntryField * GetNumberEntry() const
virtual void SetLimits(ELimit limits=TGNumberFormat::kNELNoLimits, Double_t min=0, Double_t max=1)
virtual void SetState(Bool_t enable=kTRUE)
Set the active state.
virtual Double_t GetNumber() const
TGClient * fClient
Definition: TGObject.h:37
Handle_t GetId() const
Definition: TGObject.h:47
virtual Bool_t IsOn() const
Definition: TGButton.h:370
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set radio button state.
Definition: TGButton.cxx:1563
virtual void SetText(TGString *text, Int_t partidx=0)
Set text in partition partidx in status bar.
virtual void SetParts(Int_t npart)
Divide the status bar in npart equal sized parts.
const char * GetString() const
Definition: TGString.h:40
Definition: TGTab.h:62
virtual TGCompositeFrame * AddTab(TGString *text)
Add a tab to the tab widget.
Definition: TGTab.cxx:341
const char * GetText() const
Definition: TGTextEntry.h:134
virtual const char * GetTitle() const
Returns title of object.
Definition: TGTextEntry.h:136
virtual void SelectAll()
Selects all text (i.e.
virtual void SetAlignment(ETextJustification mode=kTextLeft)
Sets the alignment of the text entry.
virtual void SetToolTipText(const char *text, Long_t delayms=500)
Set tool tip text associated with this text entry.
virtual void SetText(const char *text, Bool_t emit=kTRUE)
Sets text entry to text, clears the selection and moves the cursor to the end of the line.
const TGString * GetText() const
Definition: TGListBox.h:115
virtual const char * GetTitle() const
Returns title of object.
Definition: TGListBox.h:117
virtual void Associate(const TGWindow *w)
Definition: TGWidget.h:84
Int_t WidgetId() const
Definition: TGWidget.h:80
virtual const TGWindow * GetMainFrame() const
Returns top level main frame.
Definition: TGWindow.cxx:133
const TGWindow * GetParent() const
Definition: TGWindow.h:85
virtual Bool_t IsMapped()
Returns kTRUE if window is mapped on screen, kFALSE otherwise.
Definition: TGWindow.cxx:180
Graphics object made of three arrays X, Y and Z with the same number of points each.
Definition: TGraph2D.h:40
A Graph is a graphics object made of two arrays X and Y with npoints each.
Definition: TGraph.h:41
The TH1 histogram class.
Definition: TH1.h:56
TAxis * GetZaxis()
Definition: TH1.h:318
virtual Int_t GetDimension() const
Definition: TH1.h:278
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...
Definition: TH1.h:316
TAxis * GetYaxis()
Definition: TH1.h:317
The Histogram stack class.
Definition: THStack.h:31
Iterator of linked list.
Definition: TList.h:200
Option_t * GetOption() const
Returns the object option stored in the list.
Definition: TList.cxx:1140
A doubly linked list.
Definition: TList.h:44
virtual void Add(TObject *obj)
Definition: TList.h:87
virtual TObject * FindObject(const char *name) const
Delete a TObjLink object.
Definition: TList.cxx:574
A TMultiGraph is a collection of TGraph (or derived) objects.
Definition: TMultiGraph.h:35
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition: TNamed.cxx:140
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
Mother of all ROOT objects.
Definition: TObject.h:37
virtual const char * GetName() const
Returns name of object.
Definition: TObject.cxx:357
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Definition: TObject.cxx:128
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition: TObject.cxx:443
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:880
virtual const char * GetTitle() const
Returns title of object.
Definition: TObject.cxx:401
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Definition: TObject.cxx:854
The most important graphics class in the ROOT system.
Definition: TPad.h:29
TList * GetListOfPrimitives() const
Definition: TPad.h:240
TPluginHandler * FindHandler(const char *base, const char *uri=0)
Returns the handler if there exists a handler for the specified URI.
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot.
Definition: TQObject.cxx:867
Bool_t Disconnect(const char *signal=0, void *receiver=0, const char *slot=0)
Disconnects signal of this object from slot of receiver.
Definition: TQObject.cxx:1025
A specialized TSelector for TTree::Draw.
Definition: TSelectorDraw.h:31
virtual Double_t * GetVal(Int_t i) const
Return the last values corresponding to the i-th component of the formula being processed (where the ...
Sequenceable collection abstract base class.
Basic string class.
Definition: TString.h:131
Ssiz_t Length() const
Definition: TString.h:405
Ssiz_t First(char c) const
Find first occurrence of a character c.
Definition: TString.cxx:487
const char * Data() const
Definition: TString.h:364
TString & Append(const char *cs)
Definition: TString.h:559
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition: TString.cxx:2286
virtual Int_t Sizeof() const
Returns size string will occupy on I/O buffer.
Definition: TString.cxx:1309
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:619
Implement some of the functionality of the class TTree requiring access to extra libraries (Histogram...
Definition: TTreePlayer.h:37
TSelector * GetSelector() const
Definition: TTreePlayer.h:84
virtual Long64_t GetSelectedRows() const
Definition: TTreePlayer.h:83
virtual Int_t GetDimension() const
Definition: TTreePlayer.h:76
A TTree object has a header with a name and a title.
Definition: TTree.h:71
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition: TVirtualPad.h:50
virtual void Modified(Bool_t flag=1)=0
virtual Int_t YtoAbsPixel(Double_t y) const =0
virtual Double_t GetUymax() const =0
virtual TList * GetListOfPrimitives() const =0
virtual TVirtualPad * cd(Int_t subpadnumber=0)=0
virtual Int_t XtoAbsPixel(Double_t x) const =0
virtual void Update()=0
virtual Double_t GetUxmax() const =0
virtual Double_t GetUymin() const =0
virtual Double_t GetUxmin() const =0
virtual TCanvas * GetCanvas() const =0
leg AddEntry(h1,"Histogram filled with random numbers","f")
TGraphErrors * gr
Definition: legend1.C:25
TH1F * h1
Definition: legend1.C:5
TFitResultPtr FitObject(TH1 *h1, TF1 *f1, Foption_t &option, const ROOT::Math::MinimizerOptions &moption, const char *goption, ROOT::Fit::DataRange &range)
fitting function for a TH1 (called from TH1::Fit)
Definition: HFitImpl.cxx:964
void Init2DGaus(const ROOT::Fit::BinData &data, TF1 *f1)
compute initial parameter for 2D gaussian function given the fit data Set the sigma limits for zero t...
TFitResultPtr UnBinFit(ROOT::Fit::UnBinData *data, TF1 *f1, Foption_t &option, const ROOT::Math::MinimizerOptions &moption)
fit an unbin data set (from tree or from histogram buffer) using a TF1 pointer and fit options.
Definition: HFitImpl.cxx:809
void FillData(BinData &dv, const TH1 *hist, TF1 *func=0)
fill the data vector from a TH1.
void InitGaus(const ROOT::Fit::BinData &data, TF1 *f1)
compute initial parameter for gaussian function given the fit data Set the sigma limits for zero top ...
void function(const Char_t *name_, T fun, const Char_t *docstring=0)
Definition: RExports.h:151
static constexpr double mg
static constexpr double s
void variables(TString dataset, TString fin="TMVA.root", TString dirName="InputVariables_Id", TString title="TMVA Input Variables", Bool_t isRegression=kFALSE, Bool_t useTMVAStyle=kTRUE)
Definition: first.py:1
Definition: tree.py:1
int Range
Definition: Foption.h:39
int Nograph
Definition: Foption.h:42
int Quiet
Definition: Foption.h:29
int Like
Definition: Foption.h:34
int W1
Definition: Foption.h:36
int Gradient
Definition: Foption.h:40
int Robust
Definition: Foption.h:48
double hRobust
Definition: Foption.h:51
int Plus
Definition: Foption.h:43
int Integral
Definition: Foption.h:44
int Bound
Definition: Foption.h:31
int Nostore
Definition: Foption.h:41
int More
Definition: Foption.h:38
int Minuit
Definition: Foption.h:46
int Errors
Definition: Foption.h:37
int Verbose
Definition: Foption.h:30
auto * l
Definition: textangle.C:4