GSI Object Oriented Online Offline (Go4)  GO4-5.3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4FitPanel.cpp
Go to the documentation of this file.
1 // $Id: TGo4FitPanel.cpp 1483 2015-06-03 14:19:49Z linev $
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum für Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
14 #include "TGo4FitPanel.h"
15 
16 #include <stdio.h>
17 
18 
19 #include "qevent.h"
20 #include "qheaderview.h"
21 
22 #include <QtCore/QSignalMapper>
23 
24 #include <QMenuBar>
25 #include <QFocusEvent>
26 #include <QDropEvent>
27 #include <QMessageBox>
28 #include <QApplication>
29 #include <QToolTip>
30 #include <QMenu>
31 #include <QMenuBar>
32 #include <QFileDialog>
33 #include <QInputDialog>
34 
35 #include "TStyle.h"
36 #include "TString.h"
37 #include "TObject.h"
38 #include "TObjArray.h"
39 #include "TArrayI.h"
40 #include "TROOT.h"
41 #include "TClass.h"
42 #include "TMath.h"
43 #include "Buttons.h"
44 #include "TH1.h"
45 #include "TCutG.h"
46 #include "TPad.h"
47 #include "TCanvas.h"
48 #include "TPaveStats.h"
49 #include "TLegend.h"
50 #include "TFile.h"
51 #include "Riostream.h"
52 
53 #include "TGo4LockGuard.h"
54 #include "TGo4Slot.h"
55 #include "TGo4Fitter.h"
56 #include "TGo4FitterAction.h"
57 #include "TGo4FitterConfig.h"
58 #include "TGo4FitterOutput.h"
59 #include "TGo4FitMinuit.h"
60 #include "TGo4FitAmplEstimation.h"
61 #include "TGo4FitPeakFinder.h"
62 #include "TGo4FitParsList.h"
63 #include "TGo4FitParameter.h"
64 #include "TGo4FitComponent.h"
65 #include "TGo4FitModel.h"
66 #include "TGo4FitModelPolynom.h"
67 #include "TGo4FitModelGauss1.h"
68 #include "TGo4FitModelGauss2.h"
69 #include "TGo4FitModelGaussN.h"
70 #include "TGo4FitModelFormula.h"
71 #include "TGo4FitModelFunction.h"
72 #include "TGo4FitModelFromData.h"
73 #include "TGo4FitData.h"
74 #include "TGo4FitDataHistogram.h"
75 #include "TGo4FitDataGraph.h"
76 #include "TGo4FitDataProfile.h"
77 #include "TGo4FitDataRidge.h"
78 #include "TGo4FitDependency.h"
79 #include "TGo4FitMinuitResult.h"
80 #include "TGo4FitSlot.h"
81 #include "TGo4FitAxisTrans.h"
82 #include "TGo4FitLinearTrans.h"
83 #include "TGo4FitMatrixTrans.h"
84 #include "TGo4Log.h"
85 #include "TGo4ViewPanel.h"
86 #include "TGo4MdiArea.h"
87 #include "TGo4QSettings.h"
88 #include "QFitItem.h"
89 #include "QFitWidget.h"
90 #include "QFitNamedWidget.h"
91 #include "QFitRangeWidget.h"
92 #include "QFitRangeCutWidget.h"
93 #include "QFitParWidget.h"
94 #include "QFitDependencyWidget.h"
95 #include "QFitParCfgWidget.h"
96 #include "QFitDataWidget.h"
97 #include "QFitModelWidget.h"
98 #include "QFitModelPolynomWidget.h"
99 #include "QFitModelGauss1Widget.h"
100 #include "QFitModelGauss2Widget.h"
101 #include "QFitModelGaussNWidget.h"
102 #include "QFitModelFormulaWidget.h"
103 #include "QFitModelFunctionWidget.h"
104 #include "QFitAmplEstimWidget.h"
105 #include "QFitPeakFinderWidget.h"
106 #include "QFitOutputActionWidget.h"
107 #include "QFitMinuitWidget.h"
108 #include "QFitMinuitResWidget.h"
109 #include "QFitSlotWidget.h"
110 #include "QFitterWidget.h"
111 #include "QFitTableWidget.h"
112 #include "QFitPrintWidget.h"
113 #include "QFitLinearTransWidget.h"
114 #include "QFitMatrixTransWidget.h"
115 #include "TGo4FitGuiTypes.h"
116 
117 
118 // ********************************************************************
119 
121  TArrow(), fxType(at_none), fxModel(0), fxOther(0), fdLineAmpl(0.), fxComp(0), fiRangeNum(0),
122  fdRangeY(0.), fdShiftX(0.), fxItem(0), fxPanel(0)
123 {
124 }
125 
126 TGo4FitGuiArrow::TGo4FitGuiArrow(Float_t arrowsize, Option_t* option) :
127  TArrow(0.,0.,0.,0.,arrowsize,option), fxType(at_none), fxModel(0), fxOther(0), fdLineAmpl(0.), fxComp(0), fiRangeNum(0),
128  fdRangeY(0.), fdShiftX(0.), fxItem(0), fxPanel(0)
129 {
130 }
131 
132 TGo4FitGuiArrow::TGo4FitGuiArrow(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Float_t arrowsize, Option_t* option) :
133  TArrow(x1,y1,x2,y2,arrowsize,option), fxType(at_none), fxModel(0), fxOther(0), fdLineAmpl(0.), fxComp(0), fiRangeNum(0),
134  fdRangeY(0.), fdShiftX(0.), fxItem(0), fxPanel(0)
135 {
136 }
137 
139 {
140 }
141 
142 void TGo4FitGuiArrow::SetForPosition(TGo4FitModel* model, TGo4FitGuiArrow* forwidth, Double_t iLineAmpl)
143 {
144  fxType = at_pos;
145  fxModel = model;
146  fxOther = forwidth;
147  fdLineAmpl = iLineAmpl;
148 }
149 
151 {
152  fxType = at_width;
153  fxModel = model;
154  fxOther = forposition;
155 }
156 
157 void TGo4FitGuiArrow::SetForRange(TGo4FitComponent* Comp, Int_t num, Double_t rangey, Double_t shiftx) {
158  fxType = at_range;
159  fxComp = Comp;
160  fiRangeNum = num;
161  fdRangeY = rangey;
162  fdShiftX = shiftx;
163 }
164 
166 {
167  fxItem = item;
168  fxPanel = panel;
169 }
170 
172 {
173  Double_t x1 = GetX1(), x2 = GetX2();
174  Double_t y1 = GetY1(), y2 = GetY2();
175 
176  switch (fxType) {
177  case at_pos:
178  Double_t pos;
179  if (fxModel->GetPosition(0,pos)) {
180  SetX1(pos); SetX2(pos); SetY1(fdLineAmpl/2); SetY2(fdLineAmpl);
181  }
182  break;
183  case at_width:
184  Double_t width, ppp;
185  if ((fxModel->GetWidth(0,width)) && (fxModel->GetPosition(0,ppp))) {
186  SetX1(ppp-width); SetX2(ppp+width);
187  SetY1(fxOther->GetY1());
188  SetY2(fxOther->GetY1());
189  }
190  break;
191  case at_range:
192  Int_t typ, naxis;
193  Double_t left, right;
194  fxComp->GetRangeCondition(fiRangeNum, typ, naxis, left, right);
195  switch (typ) {
196  case 0: SetX1(left); SetX2(right); break;
197  case 1: SetX1(left); SetX2(right); break;
198  case 2: SetX1(left); SetX2(left+fdShiftX); break;
199  case 3: SetX1(right-fdShiftX); SetX2(right); break;
200  }
201  SetY1(fdRangeY); SetY2(fdRangeY);
202 
203  break;
204  }
205 
206  return (x1 != GetX1()) || (x2 != GetX2()) || (y1 != GetY1()) || (y2 != GetY2());
207 }
208 
209 Bool_t TGo4FitGuiArrow::IsAssignTo(TObject* obj)
210 {
211  return (obj!=0) && ((obj==fxModel) || (obj==fxComp));
212 }
213 
214 void TGo4FitGuiArrow::Delete(Option_t* option)
215 {
216  if ((fxType==at_pos) && (fxPanel!=0))
218 }
219 
220 void TGo4FitGuiArrow::ExecuteEvent(Int_t event, Int_t px, Int_t py)
221 {
222  TArrow::ExecuteEvent(event,px,py);
223  if (event!=kButton1Up) return;
224 
225  switch (fxType) {
226 
227  case at_pos: {
228  fxModel->SetPosition(0, GetX2());
229  fdLineAmpl = (GetY1()>GetY2()) ? GetY1() : GetY2();
230  if (fxPanel) fxPanel->ArrowChanged(this);
231  break; }
232 
233  case at_width: {
234  Double_t width = 0;
235  fxModel->GetWidth(0,width);
236  Double_t pos = fxOther->GetX2();
237 
238  Double_t w0 = (GetX2()-GetX1())/2;
239  Double_t w1 = pos-GetX1();
240  Double_t w2 = GetX2()-pos;
241 
242  if (TMath::Abs(w0-width)>1e-10) {
243  Double_t w = width;
244  if (TMath::Abs(w1-width)>1e-10) w=w1; else w=w2;
245  if (w>0) {
246  width=w;
247  fxModel->SetWidth(0,width);
248  if (fxPanel) fxPanel->ArrowChanged(this);
249  }
250  }
251  break; }
252 
253  case at_range: {
254  Int_t typ, naxis;
255  Double_t left, right;
256  fxComp->GetRangeCondition(fiRangeNum,typ,naxis,left,right);
257 
258  left = GetX1()<GetX2() ? GetX1() : GetX2();
259  right = GetX1()>GetX2() ? GetX1() : GetX2();
260 
261  fxComp->SetRangeCondition(fiRangeNum,typ,naxis,left,right);
262 
263  if (fxPanel) fxPanel->ArrowChanged(this);
264 
265  break; }
266 
267  }
268 }
269 
270 // *************************************************************************
271 
272 TGo4FitPanel::TGo4FitPanel(QWidget *parent, const char* name) :
273  QGo4Widget(parent, name)
274 {
275  setupUi(this);
276 
277  fbFreezeMode = false;
279  fbParsWidgetShown = false;
280 
281  fbNeedConfirmation = go4sett->getBool("/FitPanel/NeedConfirmation", false);
282  fbShowPrimitives = go4sett->getBool("/FitPanel/ShowPrimitives", true);
283  fbSaveWithReferences = go4sett->getBool("/FitPanel/SaveWithReferences", false);
284  fbUseCurrentRange = go4sett->getBool("/FitPanel/UseCurrentRange", true);
285  fbDrawModels = go4sett->getBool("/FitPanel/DrawModels", true);
286  fbDrawComponents = go4sett->getBool("/FitPanel/DrawComponents", false);
287  fbUseSamePanelForDraw = go4sett->getBool("/FitPanel/UseSamePanelForDraw",true);
288  fbDrawBackground = go4sett->getBool("/FitPanel/DrawBackground", false);
289  fbDrawInfoOnPad = go4sett->getBool("/FitPanel/DrawInfoOnPad", false);
290  fbRecalculateGaussWidth = go4sett->getBool("/FitPanel/RecalculateGaussWidth", true);
291  fiIntegralMode = go4sett->getInt("/FitPanel/IntegralMode", 0);
292  fiBuffersUsage = go4sett->getInt("/FitPanel/BuffersUsage", 1);
293 
294  FitList->setContextMenuPolicy(Qt::CustomContextMenu);
295 
296  // fit options part
297  fxWizDataName = "";
298  fxWizModelName = "";
299  fbWizShowAllModels = true;
300  fiWizPageIndex = 0;
301  fbUseAmplEstim = false;
302  fiNumMigradIter = 0;
303 
304  fxCurrentItem = 0;
306 
307  fxActivePanel = 0;
308  fxActivePad = 0;
309 
310  fxDrawNewPanel = 0;
311  fbDrawPanelCreation = false;
312 
313  QTableWidgetItem* item = new QTableWidgetItem;
314  item->setFlags(item->flags() & ~Qt::ItemIsEditable);
315  Wiz_DataSlotsTable->setItemPrototype(item);
316  Wiz_DataSlotsTable->setContextMenuPolicy(Qt::CustomContextMenu);
317 
318  connect(TGo4MdiArea::Instance(), SIGNAL(panelSignal(TGo4ViewPanel*, TPad*, int)),
319  this, SLOT(panelSlot(TGo4ViewPanel*, TPad*, int)));
320 
321  MenuBar = new QMenuBar(MenuFrame);
322  // MenuBar->setMinimumWidth(100);
323  // MenuBar->setFrameShape(QMenuBar::NoFrame);
324 #if (QT_VERSION >= 0x040600)
325  MenuBar->setNativeMenuBar(kFALSE); // disable putting this to screen menu. for MAC style WMs
326 #endif
327 
328 
329  FitterMap = new QSignalMapper(this);
330  connect(FitterMap, SIGNAL(mapped(int)), this, SLOT(FitterMenuItemSelected(int)));
331  FitterMenu = MenuBar->addMenu("&Fitter");
332  connect(FitterMenu, SIGNAL(aboutToShow()), this, SLOT(AboutToShowFitterMenu()) );
333 
334  ViewMap = new QSignalMapper(this);
335  connect(ViewMap, SIGNAL(mapped(int)), this, SLOT(ChangeViewType(int)));
336  ViewMenu = MenuBar->addMenu("&Tools");
337  connect(ViewMenu, SIGNAL(aboutToShow()), this, SLOT(AboutToShowViewMenu()) );
338 
339  SettMap = new QSignalMapper(this);
340  connect(SettMap, SIGNAL(mapped(int)), this, SLOT(ChangeSettings(int)));
341  SettMenu = MenuBar->addMenu("&Settings");
342  connect(SettMenu, SIGNAL(aboutToShow()), this, SLOT(AboutToShowSettMenu()) );
343 
344  AddIdAction(SettMenu, SettMap, "&Confirmation", 1);
345  AddIdAction(SettMenu, SettMap, "&Show primitives", 2);
346  AddIdAction(SettMenu, SettMap, "&Freeze mode", 3);
347  AddIdAction(SettMenu, SettMap, "&Save with objects", 4);
348 
349  SettMenu->addSeparator();
350 
351  AddIdAction(SettMenu, SettMap, "&Use current range", 10);
352  AddIdAction(SettMenu, SettMap, "&Draw model", 11);
353  AddIdAction(SettMenu, SettMap, "Draw &background", 14);
354  AddIdAction(SettMenu, SettMap, "Dra&w components", 12);
355  AddIdAction(SettMenu, SettMap, "Draw on same &pad", 13);
356  AddIdAction(SettMenu, SettMap, "Draw &info on pad", 15);
357 
358  SettMenu->addSeparator();
359 
360  AddIdAction(SettMenu, SettMap, "&No &integral", 17);
361  AddIdAction(SettMenu, SettMap, "&Counts", 18);
362  AddIdAction(SettMenu, SettMap, "&Integral", 19);
363  AddIdAction(SettMenu, SettMap, "&Gauss integral", 20);
364 
365  AddIdAction(SettMenu, SettMap, "Recalculate gauss &widths", 16);
366 
367  SettMenu->addSeparator();
368 
369  AddIdAction(SettMenu, SettMap, "&Do not use buffers", 21);
370  AddIdAction(SettMenu, SettMap, "&Only for data", 22);
371  AddIdAction(SettMenu, SettMap, "&For data and models", 23);
372  AddIdAction(SettMenu, SettMap, "&Individual settings", 24);
373 
374  ItemMenu = 0;
375  ItemMap = new QSignalMapper(this);
376  connect(ItemMap, SIGNAL(mapped(int)), this, SLOT(ItemMenuItemSelected(int)));
377  CurrFitItem = 0;
378 
379  Wiz_DataSlotsTable->horizontalHeader()->setStretchLastSection(true);
380  Wiz_ParTable->horizontalHeader()->setStretchLastSection(true);
381 
382  fxWizPars = new TObjArray();
383  fxWizSlots = new TObjArray();
384  fxParsTableList = new TObjArray();
385 
386  fiPaintMode = 0;
387 
388  gridLayout->setMargin(3);
389  gridLayout->setSpacing(1);
391 }
392 
394 {
395  // discards messages from deleted items
396  fbFillingWidget = true;
397 
398  fxCurrentItem = 0;
399  FitList->clear();
400 
401  delete fxParsTableList;
402  delete fxWizSlots;
403  delete fxWizPars;
404 
407  CloseDrawPanel();
408 
410 }
411 
412 // *********************** overloaded methods of QGo4Widget **************************
413 
414 
415 bool TGo4FitPanel::IsAcceptDrag( const char* itemname, TClass * cl, int kind )
416 {
417  if (cl==0) return false;
418 
419  return (cl->InheritsFrom(TGo4Fitter::Class())) ||
420  (cl->InheritsFrom(TH1::Class())) ||
421  (cl->InheritsFrom(TGraph::Class()));
422 }
423 
424 void TGo4FitPanel::DropOnPanel( QDropEvent* event, const char * itemname, TClass * cl, int kind)
425 {
426  if (cl==0) return;
427 
428  if (cl->InheritsFrom(TGo4Fitter::Class())) {
429  WorkWithFitter(itemname, 0, 0);
430  return;
431  }
432 
433  if (event==0) return;
434 
435  QWidget* w = childAt(event->pos());
436 
437  if (w == Wiz_DataSlotsTable) {
438  QPoint pnt = Wiz_DataSlotsTable->mapFrom(this, event->pos());
439  QTableWidgetItem* item = Wiz_DataSlotsTable->itemAt(pnt);
440 
441  int nrow = item ? item->row() : -1;
442 
443  if ((nrow<0) || (nrow>fxWizSlots->GetLast())) return;
444 
445  TGo4FitSlot* slot = dynamic_cast<TGo4FitSlot*> (fxWizSlots->At(nrow));
446 
447  if (slot==0) return;
448  if (!slot->IsSuitableClass(cl)) return;
449 
450  CreateFitSlotLink(slot, itemname);
451 
453  } else
454 
455  if(w == (QWidget*)FitList->viewport()) {
456  QPoint pnt = FitList->viewport()->mapFrom(this, event->pos());
457  QFitItem* item = dynamic_cast<QFitItem*> (FitList->itemAt(pnt));
458  if ((item==0) || (item->ObjectType()!=FitGui::ot_slot)) return;
459 
460  TGo4FitSlot* slot = dynamic_cast<TGo4FitSlot*>(item->Object());
461  if (slot==0) return;
462  if (!slot->IsSuitableClass(cl)) return;
463 
464  CreateFitSlotLink(slot, itemname);
465 
467  }
468 }
469 
470 void TGo4FitPanel::linkedObjectUpdated( const char * linkname, TObject * obj )
471 {
473 
475 }
476 
478 {
479  RemoveLink("Fitter");
480 }
481 
482 void TGo4FitPanel::linkedObjectRemoved( const char * linkname )
483 {
484  if (strcmp(linkname,"Fitter")==0) {
485  RemoveAllLinks();
486  fxActivePanel = 0;
487  fxActivePad = 0;
488  } else {
490  }
491 
493 }
494 
495 void TGo4FitPanel::linkedRemoved(TGo4Slot* slot, TObject* obj)
496 {
497 }
498 
499 
500 void TGo4FitPanel::WorkWithFitter(const char* itemname, TGo4ViewPanel* panel, TPad* pad)
501 {
504  CloseDrawPanel();
506 
507  fxActivePanel = panel;
508  fxActivePad = pad;
509 
511  AddLink(itemname, "Fitter");
512 
513  // just take object
514  GetLinked("Fitter", 2);
515 
517 
519 }
520 
522 {
525  CloseDrawPanel();
527 
528  fxActivePanel = 0;
529  fxActivePad = 0;
530 
532  AddLink(slot, "Fitter");
533 
534  TObject* obj = GetLinked("Fitter",0);
535 
537 
539 }
540 
541 // **************************** interface to MainGUI ************************
542 
543 void TGo4FitPanel::panelSlot(TGo4ViewPanel* panel, TPad* pad, int signalid)
544 {
545  switch (signalid) {
546  case panel_Activated: {
547  if ((panel==0) || (pad==0)) return;
548 
549  if (fbDrawPanelCreation) return;
550  if ((panel==fxDrawNewPanel) || fbDrawPanelCreation) return;
551 
552  bool update = fbFreezeMode;
553 
554  if (!update && (GetFitter()!=0) && (GetFitter()->GetNumData()>1))
555  update = true;
556 
557  if (WorkingWithPanel() &&
558  (panel==ActivePanel()) &&
559  (pad==ActivePad()) ) update = true;
560 
561  if (update) {
565  return;
566  }
567 
570  CloseDrawPanel();
572 
574 
575  fxActivePanel = panel;
576  fxActivePad = pad;
577 
578  if ((panel!=0) && (pad!=0)) {
579  TGo4Slot* slot = panel->GetDrawObjectSlot(pad, "::Fitter");
580  AddLink(slot, "Fitter");
581  }
582 
584 
586 
587  break;
588  }
589 
590  case panel_Modified: {
591  if (!WorkingWithPanel() || (panel!=ActivePanel())) return;
593  CloseDrawPanel();
597  break;
598  }
599 
600  case panel_Deleted: {
601  if (panel==0) return;
602  if (panel==fxDrawNewPanel) { fxDrawNewPanel = 0; return; }
603  if (WorkingWithPanel() && (panel==ActivePanel())) {
606  fxActivePanel = 0;
607  fxActivePad = 0;
608  }
609 
611  break;
612  }
613  }
614 }
615 
616 // ************************ functionality of fitslots classes *****************************
617 
618 
620 {
621  return (fxActivePanel!=0) && (fxActivePad!=0);
622 }
623 
625 {
626  return WorkingWithPanel() ? !ActivePanel()->IsPadHasSubPads(ActivePad()) : false;
627 }
628 
630 {
631  return fxActivePanel;
632 }
633 
635 {
636  return fxActivePad;
637 }
638 
640 {
641  return dynamic_cast<TGo4Fitter*>(GetLinked("Fitter",0));
642 }
643 
645 {
648  if (!WorkingWithPanel()) {
649  if (fitter!=0) {
650  QString itemname = SaveObjectInMemory("FitPanel", fitter);
651  AddLink(itemname.toLatin1().constData(), "Fitter");
652  }
653  } else {
654  ActivePanel()->DeleteDrawObject(ActivePad(),"::Fitter");
656  ActivePad(),
658  "::Fitter",
659  fitter, true, 0);
660  if (slot!=0)
661  AddLink(slot, "Fitter");
662  }
664  fbParsWidgetShown = false;
665 }
666 
668 {
669  TGo4Fitter* fitter = GetFitter();
670  if (fitter==0) return 0;
671 
673 
674  return dynamic_cast<TGo4Fitter*> (fitter->Clone());
675 }
676 
678 {
679  if (WorkingWithPanel()) {
681  fxActivePanel = 0;
682  fxActivePad = 0;
683  }
684 
685  TGo4Fitter* fitter = new TGo4Fitter("Fitter","Fitter object");
686  SetFitter(fitter);
687 
689 }
690 
691 
693 {
694  TGo4ViewPanel* panel = LastActivePanel();
695  if ((panel==0) || (panel==fxDrawNewPanel)) return;
696  TPad* pad = panel->GetActivePad();
697 
699 
701 
702  fxActivePanel = panel;
703  fxActivePad = pad;
704 
705  if ((panel!=0) && (pad!=0)) {
706  TGo4Slot* fitterslot = panel->GetDrawObjectSlot(pad, "::Fitter");
707 
708  if (!overwrite && (fitterslot!=0))
709  AddLink(fitterslot, "Fitter");
710  }
711 
712  if (overwrite || (GetFitter()==0))
713  SetFitter(CreateFitterFor(panel, pad, "Fitter"));
714 
717 }
718 
720 {
722  if ( QMessageBox::information(0,
723  QString("Delete fitter"),
724  QString("Are you sure?"),
725  QMessageBox::Yes, QMessageBox::No) == QMessageBox::No ) return;
726 
729  CloseDrawPanel();
730 
732 
733  SetFitter(0);
734 
735  if (WorkingWithPanel()) {
736  fxActivePanel = 0;
737  fxActivePad = 0;
738  }
739 
741 }
742 
744 {
746  CloseDrawPanel();
748 
749  fxActivePanel = 0;
750  fxActivePad = 0;
751 
754 }
755 
756 
758 {
761 }
762 
764 {
765  TGo4LockGuard lock;
766 
767  TGo4Fitter* clone = CloneFitter();
768 
769  if (clone!=0) SaveObjectInMemory("", clone);
770 }
771 
773 {
774  QTableWidget* tab = ParsTable;
775  if (tab==0) return;
776 
777  TGo4Log::Info("Printout of fitter parameters table");
778 
779  QString str("Name");
780  for(int ncol=0;ncol<tab->columnCount();ncol++) {
781  str+="\t";
782  str+=tab->horizontalHeaderItem(ncol)->text();
783  }
784  TGo4Log::Info(str.toLatin1().constData());
785 
786  for(int nrow=0;nrow<tab->rowCount();nrow++) {
787  str = tab->verticalHeaderItem(nrow)->text();
788  for(int ncol=0;ncol<tab->columnCount();ncol++) {
789  str+="\t";
790  str+=tab->item(nrow, ncol)->text();
791  }
792  TGo4Log::Info(str.toLatin1().constData());
793  }
794 }
795 
797 {
798  TGo4Fitter* fitter = GetFitter();
799  fitter->RememberPars();
800 
801  UpdateStatusBar(0);
803 }
804 
806 {
807  TGo4LockGuard lock;
808 
809  TGo4Fitter* fitter = GetFitter();
810  if (fitter!=0) {
811  TGo4ViewPanel* panel = LastActivePanel();
812  if ((panel==0) || (panel==fxDrawNewPanel)) return;
813  if ( (panel!=ActivePanel()) || (panel->GetActivePad()!=ActivePad())) {
814  TGo4Fitter* clone = (TGo4Fitter*) fitter->Clone();
815  fxActivePanel = panel;
816  fxActivePad = panel->GetActivePad();
817  SetFitter(clone);
820  }
821  } else
822  Fitter_NewForActivePad(false);
823 }
824 
826 {
827  if (!WorkingWithOnlyPad()) return;
828 
829  TGo4Fitter* fitter = GetFitter();
830  if (fitter==0) return;
831 
832  if (fitter->GetNumData()!=1) { std::cout << " Incorrect data" << std::endl; return; }
833 
834  if (!UpdateObjectReferenceInSlots()) return;
835 
836  TGo4FitData* data = fitter->GetData(0);
837  if (data==0) return;
838 
839  data->ClearRanges();
840  data->SetRange(0, ActivePad()->GetUxmin(), ActivePad()->GetUxmax());
841 
842  fitter->SetMemoryUsage(1);
843 
844  int NumDim = data->DefineDimensions();
845 
846  TGo4FitModel* model = 0;
847 
848  switch (nmodel) {
849  case 0:
850  fitter->AddPolynoms(data->GetName(), "Pol", Smp_PolOrderSpin->value(), NumDim);
851  break;
852 
853  case 1:
854  model = CreateModel(20, 0, fitter, data);
855  break;
856 
857  case 2:
858  model = CreateModel(24, 0, fitter, data);
859  break;
860 
861  case 3:
862  model = CreateModel(25, 0, fitter, data);
863  break;
864  }
865 
866  if (model && ((nmodel==1) || (nmodel==2))) LocateModel(model, data, false);
867 
868  fbUseAmplEstim = true;
869  fiNumMigradIter = 500;
870 
872 }
873 
875 {
876  TGo4Fitter* fitter = GetFitter();
877  if (fitter==0) return;
878 
879  fitter->DeleteAllModels();
880 
883 }
884 
886 {
887  TGo4Fitter* fitter = GetFitter();
888  if (fitter==0) return;
889 
890  TGo4FitPeakFinder* finder = GetPeakFinder(true);
891  if (finder==0) return;
892 
893  TGo4FitData* data = 0;
895  else data = fitter->GetData(0);
896  if (data==0) return;
897 
900 
901  if (fbUseCurrentRange)
903 
904  finder->SetDataName(data->GetName());
905 
906  finder->SetClearModels(kTRUE);
907 
909 
910  UpdateStatusBar("Start peak finder ... ");
911 
912  fitter->DoAction(finder);
913 
914  fbUseAmplEstim = true;
915  fiNumMigradIter = 300;
916 
917  UpdateStatusBar(0);
918 
919  fiPaintMode = 1;
921 }
922 
924 {
925  TGo4Fitter* fitter = GetFitter();
926  if (fitter==0) return;
927 
929 
930  if (fbUseAmplEstim || (fiNumMigradIter>0)) {
931  TGo4FitPeakFinder* finder = GetPeakFinder(false);
932  Int_t n=0;
933  while (n<fitter->GetNumActions()) {
934  TGo4FitterAction* action = fitter->GetAction(n);
935  if (action==finder) n++;
936  else fitter->DeleteAction(action);
937  }
938 
939  if (fbUseAmplEstim) fitter->AddAmplEstimation();
940  if (fiNumMigradIter > 0) {
941  TGo4FitMinuit* minuit = new TGo4FitMinuit("Minuit");
942  QString cmd("MIGRAD ");
943  cmd+=QString::number(fiNumMigradIter);
944  cmd+=" 1";
945  minuit->AddCommand(cmd.toLatin1().constData());
946  fitter->AddAction(minuit);
947  }
948  }
949 
950  if (fitter->GetNumActions() == 0)
951  fitter->AddStandardActions();
952  }
953 
954  if (fbUseCurrentRange)
956 
958 
959  fitter->MemorizePars();
960 
961  UpdateStatusBar("Start fitting ... ");
962 
963  fitter->DoActions();
964 
966 
969  if (!fbShowPrimitives) return;
970  TGo4FitData* data = fitter->GetData(0);
971  PaintModelsFor(fitter, data, 0, true);
972  UpdateStatusBar(0);
973  } else
975 }
976 
978 {
979  TGo4Fitter* fitter = GetFitter();
980  if ((fitter==0) ||
983  return;
984  }
985 
986  bool UseSamePads = fbUseSamePanelForDraw;
987  if (UseSamePads)
988  for(Int_t n=0;n<fitter->GetNumData();n++) {
989  TGo4FitData* data = fitter->GetData(n);
990  if (selecteddata && (data!=selecteddata)) continue;
991  if (data->IsAnyDataTransform()) {
992  UseSamePads = false;
993  }
994 
995  if (FindPadWhereData(data)==0)
996  UseSamePads = false;
997  }
998 
999  int NeedPads = 1;
1000  if(!UseSamePads) {
1001  if (fxDrawNewPanel==0) {
1002  fbDrawPanelCreation = kTRUE;
1004  fbDrawPanelCreation = kFALSE;
1005  if (fxDrawNewPanel==0) return;
1006  } else fxDrawNewPanel->ClearCanvas();
1007 
1008  if (selecteddata==0) NeedPads = fitter->GetNumData();
1009  else NeedPads = 1;
1010 
1011  if (NeedPads>1) {
1012  int DivX = (int)TMath::Sqrt(NeedPads*1.);
1013  int DivY = DivX;
1014  while (DivX*DivY<NeedPads) DivY++;
1015  fxDrawNewPanel->Divide(DivX, DivY);
1016  }
1017  }
1018 
1019  for(Int_t n=0;n<fitter->GetNumData();n++) {
1020  TGo4FitData* data = fitter->GetData(n);
1021 
1022  if (selecteddata && (data!=selecteddata)) continue;
1023 
1024  const char* drawopt = 0;
1025  if (data->GetDataType()==TGo4FitData::dtGraph)
1026  drawopt = "L";
1027 
1028  TGo4ViewPanel* panel = 0;
1029  TPad* pad = 0;
1030 
1031  if (UseSamePads) {
1032  panel = ActivePanel();
1033  pad = FindPadWhereData(data);
1034  } else {
1035  panel = fxDrawNewPanel;
1036  pad = fxDrawNewPanel->GetSubPad(0, n, true);
1037  }
1038  if ((panel==0) || (pad==0)) continue;
1039 
1041 
1042  // disable autoscaling while THStack is not able to automatically
1043  // scale only visible region
1044  if (UseSamePads) panel->SetAutoScale(false, pad);
1045 
1046  // panel->DeleteDrawObjects(pad, TGo4ViewPanel::kind_FitInfo);
1047  // panel->SetPadSuperImpose(pad, true);
1048 
1049  panel->ShootRepaintTimer();
1050 
1051  if (!UseSamePads) {
1052  TObject* obj = fitter->CreateDrawObject("Data", data->GetName(), kFALSE);
1053  panel->AddDrawObject(pad, TGo4ViewPanel::kind_FitModels, "::Data", obj, true, drawopt);
1054  }
1055 
1056  if (!fbDrawInfoOnPad)
1058  else {
1059  Double_t x2 = 0.98;
1060  Double_t y2 = 0.5;
1061  Double_t x1 = x2 - gStyle->GetStatW();
1062  Double_t y1 = y2 - gStyle->GetStatH();
1063 
1064  if (LineParsChk->isChecked()) {
1065  x1 = 0.6; x2 = 0.95;
1066  y1 = 0.8; y2 = 0.88;
1067  }
1068 
1069  TPaveStats* stats = dynamic_cast<TPaveStats*> (pad->GetPrimitive("stats"));
1070  if (stats) {
1071  x1 = stats->GetX1NDC();
1072  x2 = stats->GetX2NDC();
1073  y2 = stats->GetY1NDC() - 0.03;
1074  y1 = y2 - (stats->GetY2NDC() - stats->GetY1NDC());
1075  if (y1<0.02) y1 = 0.02;
1076  }
1077 
1078  TLegend* leg = dynamic_cast<TLegend*> (pad->GetPrimitive("fitlegend"));
1079  if (leg) {
1080  x1 = leg->GetX1NDC();
1081  x2 = leg->GetX2NDC();
1082  y2 = leg->GetY1NDC() - 0.03;
1083  y1 = y2 - (leg->GetY2NDC() - leg->GetY1NDC());
1084  if (y1<0.02) y1 = 0.02;
1085  }
1086 
1087  TPaveStats* info = dynamic_cast<TPaveStats*>
1088  (panel->GetDrawObject(pad, "::FitterPars"));
1089 
1090  bool infocreated = false;
1091 
1092  if (info!=0)
1093  info->Clear("*");
1094  else {
1095  infocreated = true;
1096 
1097  info = new TPaveStats(x1,y1,x2,y2,"brNDC");
1098  info->SetFillColor(gStyle->GetStatColor());
1099  info->SetFillStyle(gStyle->GetStatStyle());
1100  info->SetBorderSize(gStyle->GetStatBorderSize());
1101  info->SetTextFont(gStyle->GetStatFont());
1102  if (gStyle->GetStatFont()%10 > 2)
1103  info->SetTextSize(gStyle->GetStatFontSize());
1104  info->SetFitFormat(gStyle->GetFitFormat());
1105  info->SetStatFormat(gStyle->GetStatFormat());
1106  info->SetTextColor(gStyle->GetStatTextColor());
1107  info->SetTextAlign(12);
1108  info->SetName("fitinfo");
1109  }
1110 
1111  info->AddText(data->GetName());
1112  info->AddLine(0,0,0,0);
1113 
1114  if (LineParsChk->isChecked())
1115  info->AddText(TString::Format("Line | Ampl | Pos & %s", (fbRecalculateGaussWidth ? "FWHM" : "Width")));
1116 
1117  for(Int_t m=0;m<fitter->GetNumModel();m++) {
1118  TGo4FitModel* model = fitter->GetModel(m);
1119  if (!model->IsAssignTo(data->GetName())) continue;
1120 
1121  if (LineParsChk->isChecked()) {
1122  Double_t ampl, pos, width;
1123 
1124  ampl = model->GetAmplValue();
1125  if (!model->GetPosition(0,pos)) pos = 0.;
1126  if (!model->GetWidth(0,width)) width = 0.;
1127 
1128  bool recalculatew = (model->InheritsFrom(TGo4FitModelGauss1::Class()) ||
1129  model->InheritsFrom(TGo4FitModelGauss2::Class()) ||
1130  model->InheritsFrom(TGo4FitModelGaussN::Class())) &&
1132  double widthk = recalculatew ? 2.3548 : 1.0;
1133 
1134  TString tt = TString::Format("%7s | %s%s | %s%s %s%s",
1135  model->GetName(),
1136  "%", gStyle->GetStatFormat(),
1137  "%", gStyle->GetStatFormat(),
1138  "%", gStyle->GetStatFormat());
1139 
1140  info->AddText(Form(tt.Data(), ampl, pos, width*widthk));
1141  } else {
1142  int maxparlen = 7;
1143  for(Int_t np=0;np<model->NumPars();np++) {
1144  int len = strlen(model->GetParFullName(np));
1145  if (len>maxparlen) maxparlen = len;
1146  }
1147  TString tt = TString::Format("%s%ds = %s%s","%",maxparlen,"%",gStyle->GetStatFormat());
1148 
1149  for(Int_t np=0;np<model->NumPars();np++)
1150  info->AddText(Form(tt.Data(),model->GetParFullName(np), model->GetPar(np)->GetValue()));
1151  }
1152  }
1153 
1154  if (infocreated)
1155  panel->AddDrawObject(pad, TGo4ViewPanel::kind_FitInfo, "::FitterPars", info, true, 0);
1156  }
1157 
1158  if (fbDrawModels) {
1159  TObject* model = fitter->CreateDrawObject("Model", data->GetName(), kTRUE);
1160  panel->AddDrawObject(pad, TGo4ViewPanel::kind_FitModels, "::DataModel", model, true, drawopt);
1161  }
1162 
1163  if (fbDrawBackground) {
1164  TObject* model = fitter->CreateDrawObject("Background", data->GetName(), kTRUE, "Background");
1165  panel->AddDrawObject(pad, TGo4ViewPanel::kind_FitModels, "::Background", model, true, drawopt);
1166  }
1167 
1168  if (fbDrawComponents)
1169  for(Int_t m=0;m<fitter->GetNumModel();m++) {
1170  TGo4FitModel* model = fitter->GetModel(m);
1171  if (!model->IsAssignTo(data->GetName())) continue;
1172  if (model->GetGroupIndex()==0) continue;
1173  TObject* comp = fitter->CreateDrawObject(model->GetName(), data->GetName(), kTRUE, model->GetName());
1174  if (comp==0) continue;
1175 
1176  panel->AddDrawObject(pad, TGo4ViewPanel::kind_FitModels, "::FitComponent", comp, true, drawopt);
1177  }
1178  } // data
1179 }
1180 
1181 
1183 {
1184  TGo4Fitter* fitter = new TGo4Fitter("Fitter","Fitter object");
1185  SetFitter(fitter);
1186 
1187  UpdateActivePage();
1188 }
1189 
1191 {
1192  TGo4Fitter* fitter = CreateFitterFor(ActivePanel(), ActivePad(), "Fitter");
1193  if (fitter) {
1194  SetFitter(fitter);
1195  UpdateActivePage();
1196  }
1197 }
1198 
1200 {
1201  if(fbNeedConfirmation)
1202  if ( QMessageBox::information(0,
1203  QString("Clear fitter"),
1204  QString("Are you sure?"),
1205  QMessageBox::Yes, QMessageBox::No) == QMessageBox::No ) return;
1206 
1207  RemovePrimitives();
1208 
1209  SetFitter(0);
1210 
1211  UpdateActivePage();
1212 }
1213 
1215 {
1216  TGo4Fitter* fitter = GetFitter();
1217  if (fitter==0) return;
1218 
1219  if(fbNeedConfirmation)
1220  if ( QMessageBox::information(0,
1221  QString("Clear fitter"),
1222  QString("Are you sure?"),
1223  QMessageBox::Yes, QMessageBox::No) == QMessageBox::No ) return;
1224 
1225  fitter->Clear();
1226 
1227  UpdateActivePage();
1228 }
1229 
1231 {
1232  TGo4Fitter* fitter = GetFitter();
1233  if (fitter==0) return;
1234 
1235  QString fname(fitter->GetName());
1236  fname+=".root";
1237 
1238  if(ask) {
1239  fname = QFileDialog::getSaveFileName(this,
1240  "Save fitter dialog",
1241  fname,
1242  "Root file (*.root)");
1243  if (fname==QString::null) return;
1244  }
1245 
1247 
1248  TFile f(fname.toLatin1().constData(),"recreate");
1249  fitter->Write();
1250 }
1251 
1253 {
1254  TObject* obj = item->Object();
1255  if (obj==0) return;
1256 
1257  QString str("*");
1258  bool ok = true;
1259  if (obj->InheritsFrom(TGo4Fitter::Class()))
1260  str = QInputDialog::getText(this,
1261  QString("Go4 Fit Panel"),
1262  QString("Enter parameters for Print() command"),
1263  QLineEdit::Normal, str, &ok);
1264  if (!ok) return;
1265 
1266  RemoveItemWidget();
1267  QFitPrintWidget* widget = new QFitPrintWidget(0, (QString("Print ")+obj->GetName()).toLatin1().constData());
1268 
1269  fxCurrentItemWidget = widget;
1270 
1271  ListStack->addWidget(widget);
1272  widget->SetDrawOption(str);
1273  widget->SetItem(this, item);
1274  ListStack->setCurrentWidget(widget);
1275 }
1276 
1278 {
1279  TGo4FitData* data = dynamic_cast<TGo4FitData*> (item->Object());
1280  if (data) Button_FitterDraw(data);
1281 }
1282 
1284 {
1285  TGo4FitData* data = dynamic_cast<TGo4FitData*> (item->Object());
1286  TGo4Fitter* fitter = GetFitter();
1287 
1288  if ((data==0) || (fitter==0)) return;
1289 
1290  if(fbNeedConfirmation)
1291  if ( QMessageBox::information(0,
1292  QString("Delete data"),
1293  QString("Are you sure to delete ") + data->GetName(),
1294  QMessageBox::Yes, QMessageBox::No) == QMessageBox::No ) return;
1295 
1296  fitter->RemoveData(data->GetName(),kTRUE);
1297 
1299 
1301 
1302  UpdateItem(item->Parent(), true);
1303 
1304  UpdateStatusBar(0);
1305 }
1306 
1308 {
1309  TGo4Fitter* fitter = GetFitter();
1310  if (fitter==0) return;
1311 
1312  if(fbNeedConfirmation)
1313  if ( QMessageBox::information(0,
1314  QString("Delete all data"),
1315  QString("Are you sure to delete all data objects"),
1316  QMessageBox::Yes, QMessageBox::No) == QMessageBox::No ) return;
1317 
1318  fitter->DeleteAllData();
1319 
1321 
1323 
1324  UpdateItem(item, true);
1325 
1326  UpdateStatusBar(0);
1327 }
1328 
1330 {
1331  if ((item==0) || (item->Parent()==0)) return;
1332  TGo4FitData* data = dynamic_cast<TGo4FitData*> (item->Object());
1333  TGo4Fitter* fitter = GetFitter();
1334 
1335  if ((data==0) || (fitter==0)) return;
1336 
1337  if(fbNeedConfirmation)
1338  if ( QMessageBox::information(0,
1339  QString("Delete models"),
1340  QString("Are you sure to delete models, assosiated to ") + data->GetName(),
1341  QMessageBox::Yes, QMessageBox::No) == QMessageBox::No ) return;
1342 
1343  fitter->DeleteModelsAssosiatedTo(data->GetName());
1344 
1345  QFitItem* mlist = FindItem(0, FitGui::ot_modellist, 0);
1346  if (mlist) UpdateItem(mlist, true);
1347 
1349 
1350  ShowItem(item, false);
1351 
1352  UpdateStatusBar(0);
1353 }
1354 
1356 {
1357  TGo4FitModel* model = dynamic_cast<TGo4FitModel*> (item->Object());
1358 
1359  Cmd_RemoveModel(model);
1360 }
1361 
1363 {
1364  TGo4Fitter* fitter = GetFitter();
1365  if ((model==0) || (fitter==0)) return;
1366 
1367  if(fbNeedConfirmation)
1368  if ( QMessageBox::information(0,
1369  QString("Delete model"),
1370  QString("Are you sure to delete ") + model->GetName(),
1371  QMessageBox::Yes, QMessageBox::No) == QMessageBox::No ) return;
1372 
1373  fitter->RemoveModel(model->GetName(), kTRUE);
1374 
1376 
1377  UpdateActivePage();
1378 }
1379 
1381 {
1382  TGo4Fitter* fitter = GetFitter();
1383  if (fitter==0) return;
1384 
1385  if(fbNeedConfirmation)
1386  if ( QMessageBox::information(0,
1387  QString("Delete all models"),
1388  QString("Are you sure to delete all models objects"),
1389  QMessageBox::Yes, QMessageBox::No) == QMessageBox::No ) return;
1390 
1391  fitter->DeleteAllModels();
1392 
1394 
1395  UpdateItem(item, true);
1397  UpdateStatusBar(0);
1398 }
1399 
1401 {
1402  TGo4FitModel* model = dynamic_cast<TGo4FitModel*> (item->Object());
1403 
1404  TGo4Fitter* fitter = GetFitter();
1405  if ((fitter==0) || (model==0)) return;
1406 
1407  fitter->CloneModel(model->GetName());
1408 
1410 
1411  UpdateActivePage();
1412 }
1413 
1415 {
1416  if (item->ObjectType()!=FitGui::ot_datalist) item = item->Parent();
1417  if (item->ObjectType()!=FitGui::ot_datalist) return;
1418 
1419  TGo4Fitter* fitter = GetFitter();
1420  if (fitter==0) return;
1421 
1422  TGo4FitData* data = CreateData(id, 0);
1423  if (data==0) return;
1424 
1425  fitter->AddData(data);
1426 
1428 
1429  UpdateItem(item, true);
1430 
1432 
1433  QFitItem* curr = FindItem(data, FitGui::ot_data, item);
1434  if (curr!=0)
1435  FitList->setCurrentItem(curr, QItemSelectionModel::Select);
1436  UpdateStatusBar(0);
1437 }
1438 
1440 {
1441  if (item->ObjectType()!=FitGui::ot_modellist) item = item->Parent();
1442  if (item->ObjectType()!=FitGui::ot_modellist) return;
1443 
1444  TGo4Fitter* fitter = GetFitter();
1445  if (fitter==0) return;
1446 
1447  TGo4FitModel* model = CreateModel(id, 0, fitter, 0);
1448  LocateModel(model, 0, true);
1449 
1451 
1452  UpdateItem(item, true);
1453 
1455 
1456  QFitItem* curr = FindItem(model, FitGui::ot_model, item);
1457  if (curr!=0)
1458  FitList->setCurrentItem(curr, QItemSelectionModel::Select);
1459  UpdateStatusBar(0);
1460 }
1461 
1463 {
1464  if (item==0) return;
1465  TGo4FitModel* model = dynamic_cast<TGo4FitModel*> (item->Parent()->Object());
1466  if (model==0) return;
1467 
1468  model->ClearAssignmentTo(item->text(0).toLatin1().constData());
1469 
1471 
1472  UpdateItem(item->Parent(), true);
1473 }
1474 
1476 {
1477  TGo4FitModel* model = dynamic_cast<TGo4FitModel*> (item->Object());
1478  if (model==0) return;
1479 
1480  model->ClearAssignments();
1481 
1483 
1484  UpdateItem(item, true);
1485 }
1486 
1488 {
1489  TGo4FitModel* model = dynamic_cast<TGo4FitModel*> (item->Object());
1490  TGo4Fitter* fitter = GetFitter();
1491  if ((model==0) || (fitter==0)) return;
1492 
1493  fitter->AssignModelTo(model->GetName(), 0);
1494 
1496 
1497  UpdateItem(item, true);
1498 }
1499 
1501 {
1502  TGo4FitModel* model = dynamic_cast<TGo4FitModel*> (item->Object());
1503  TGo4Fitter* fitter = GetFitter();
1504  if ((model==0) || (fitter==0)) return;
1505 
1506  fitter->AssignModelTo(model->GetName(), fitter->GetDataName(id));
1507 
1509 
1510  UpdateItem(item, true);
1511 }
1512 
1514 {
1515  if (item==0) return;
1516 
1517  Int_t typ = item->ObjectType();
1518 
1519  if ((typ!=FitGui::ot_range) && (typ!=FitGui::ot_rangecut)) return;
1520 
1521  int num = item->Tag();
1522 
1523  if (num<0) return;
1524 
1525  if(fbNeedConfirmation)
1526  if ( QMessageBox::information(0,
1527  QString("Remove condition"),
1528  QString("Are you sure to delete condition ") + item->text(0),
1529  QMessageBox::Yes, QMessageBox::No) == QMessageBox::No ) return;
1530 
1531  QFitItem* parent = item->Parent();
1532  TGo4FitComponent* comp = dynamic_cast<TGo4FitComponent*> (parent->Object());
1533 
1534  if (typ==FitGui::ot_range) comp->RemoveRangeCondition(num);
1535  else comp->RemoveRangeCut(num);
1536 
1537  UpdateItem(parent, true);
1538 }
1539 
1541 {
1542  if ((item==0) || (item->ObjectType()!=FitGui::ot_rangelist)) return;
1543 
1544  if(fbNeedConfirmation)
1545  if ( QMessageBox::information(0,
1546  QString("Delete conditions"),
1547  QString("Are you sure to delete all conditions"),
1548  QMessageBox::Yes, QMessageBox::No) == QMessageBox::No ) return;
1549 
1550  TGo4FitComponent* comp = dynamic_cast<TGo4FitComponent*> (item->Object());
1551  comp->ClearRanges();
1552 
1553  UpdateItem(item, true);
1554 }
1555 
1557 {
1558  if ((item==0) || (item->ObjectType()!=FitGui::ot_rangelist)) return;
1559 
1560  TGo4FitData* data = 0;
1561 
1562  if (item->Object()->InheritsFrom(TGo4FitData::Class()))
1563  data = dynamic_cast<TGo4FitData*> (item->Object());
1564  else {
1565  TGo4FitModel* model = dynamic_cast<TGo4FitModel*> (item->Object());
1566  TGo4Fitter* fitter = GetFitter();
1567  if ((model!=0) && (fitter!=0))
1568  for (Int_t n=0;n<model->NumAssigments();n++) {
1569  data = fitter->FindData(model->AssignmentName(n));
1570  if (data!=0) break;
1571  }
1572 
1573  }
1574  Double_t minx = 0., maxx = 100., miny = 0., maxy = 100;
1575 
1576  TPad* pad = FindPadWhereData(data);
1577  if (pad) {
1578  minx = pad->GetUxmin(); maxx = pad->GetUxmax();
1579  miny = pad->GetUymin(); maxy = pad->GetUymax();
1580  } else
1581  if (data!=0) {
1582  data->DefineScaleMinMax(0,minx,maxx);
1583  data->DefineScaleMinMax(1,miny,maxy);
1584  Double_t ddx = 0.1*(maxx-minx);
1585  minx += ddx;
1586  maxx -= ddx;
1587  Double_t ddy = 0.1*(maxy-miny);
1588  miny += ddy;
1589  maxy -= ddy;
1590  }
1591 
1592  TGo4FitComponent* comp = dynamic_cast<TGo4FitComponent*> (item->Object());
1593 
1594  if (id==0) comp->SetRange(0, minx, maxx); else
1595  if (id==1) comp->ExcludeRange(0, minx, maxx); else
1596  if (id==2) comp->SetRangeMin(0, minx); else
1597  if (id==3) comp->SetRangeMax(0, maxx); else
1598  if (id==4) {
1599  TString name = TString::Format("Cut%d", comp->GetNumRangeCut());
1600  TCutG* cut = new TCutG(name, 5);
1601  cut->SetTitle("range cut of X and Y axis");
1602  cut->SetPoint(0, minx, miny);
1603  cut->SetPoint(1, maxx, miny);
1604  cut->SetPoint(2, maxx, maxy);
1605  cut->SetPoint(3, minx, maxy);
1606  cut->SetPoint(4, minx, miny);
1607  comp->AddRangeCut(cut);
1608  }
1609 
1610  UpdateItem(item, true);
1611 }
1612 
1614 {
1615  if (item==0) return;
1616  TGo4FitterAction* action = dynamic_cast<TGo4FitterAction*> (item->Object());
1617  TGo4Fitter* fitter = GetFitter();
1618 
1619  if(action && fitter) {
1620  if(fbNeedConfirmation)
1621  if ( QMessageBox::information(0,
1622  QString("Delete action"),
1623  QString("Are you sure to delete ") + item->text(0),
1624  QMessageBox::Yes, QMessageBox::No) == QMessageBox::No ) return;
1625 
1626  fitter->DeleteAction(action);
1627  UpdateItem(item->Parent(), true);
1628  }
1629 }
1630 
1632 {
1633  if ((item==0) || (item->Parent()==0)) return;
1634 
1635  TGo4FitterAction* action = dynamic_cast<TGo4FitterAction*> (item->Object());
1636  TGo4Fitter* fitter = GetFitter();
1637 
1638  if(action && fitter) {
1639  fitter->ReplaceAction(action, dir);
1640  QFitItem* parent = item->Parent();
1641  UpdateItem(parent, true);
1642  item = FindItem(action, -1, 0);
1643  if (item!=0)
1644  FitList->setCurrentItem(item, QItemSelectionModel::Select);
1645  }
1646 }
1647 
1649 {
1650  TGo4Fitter* fitter = GetFitter();
1651  if ((item==0) || (fitter==0)) return;
1652 
1653  TGo4FitterAction* action = dynamic_cast<TGo4FitterAction*> (item->Object());
1654  if (action==0) return;
1655 
1656  fitter->DoAction(action);
1657 
1658  if (action->CanChangeFitter()) UpdateActivePage(); else {
1659  UpdateItem(item, true);
1661  }
1662 }
1663 
1665 {
1666  TGo4Fitter* fitter = GetFitter();
1667 
1668  if ((item==0) || (fitter==0)) return;
1669 
1670  fitter->MemorizePars();
1671 
1672  fitter->DoActions(expert);
1673 
1674  if (expert) UpdateActivePage(); else {
1675  UpdateItem(item, true);
1677  }
1678 }
1679 
1681 {
1682  TGo4Fitter* fitter = GetFitter();
1683  if ((item==0) || (item->ObjectType()!=FitGui::ot_actlist) || (fitter==0)) return;
1684 
1685  if(fbNeedConfirmation)
1686  if ( QMessageBox::information(0,
1687  QString("Delete output actions"),
1688  QString("Are you sure to delete all output actions") + item->text(0),
1689  QMessageBox::Yes, QMessageBox::No) == QMessageBox::No ) return;
1690 
1691  fitter->DeleteOutputActions();
1692  UpdateItem(item, true);
1693 }
1694 
1696 {
1697  TGo4Fitter* fitter = GetFitter();
1698  if ((item==0) || (item->ObjectType()!=FitGui::ot_actlist) || (fitter==0)) return;
1699 
1700  if(fbNeedConfirmation)
1701  if ( QMessageBox::information(0,
1702  QString("Delete all actions"),
1703  QString("Are you sure to delete all actions"),
1704  QMessageBox::Yes, QMessageBox::No) == QMessageBox::No ) return;
1705 
1706  fitter->DeleteActions();
1707  UpdateItem(item, true);
1708 }
1709 
1711 {
1712  TGo4Fitter* fitter = GetFitter();
1713  if ((item==0) || (item->ObjectType()!=FitGui::ot_actlist) || (fitter==0)) return;
1714 
1715  switch(id) {
1716  case 0: fitter->AddAction(new TGo4FitterConfig("Config","Fitter configuration")); break;
1717  case 1: fitter->AddAmplEstimation(); break;
1718  case 2: fitter->AddSimpleMinuit(); break;
1719  case 3: fitter->AddOutputAction("Print","*"); break;
1720  case 4: fitter->AddAction(new TGo4FitPeakFinder("Finder")); break;
1721  }
1722  UpdateItem(item, true);
1723 }
1724 
1726 {
1727  if ((item==0) || (item->ObjectType()!=FitGui::ot_depend)) return;
1728 
1729  TGo4FitDependency* depen = dynamic_cast<TGo4FitDependency*> (item->Object());
1730  TObjArray* lst = dynamic_cast<TObjArray*> (item->Parent()->Object());
1731 
1732  if((depen==0) || (lst==0)) return;
1733 
1734  if(fbNeedConfirmation)
1735  if ( QMessageBox::information(0,
1736  QString("Delete dependency item"),
1737  QString("Are you sure to delete ") + item->text(0),
1738  QMessageBox::Yes, QMessageBox::No) == QMessageBox::No ) return;
1739 
1740  lst->Remove(depen);
1741  lst->Compress();
1742  delete depen;
1743 
1744  UpdateItem(item->Parent(), true);
1745 }
1746 
1748 {
1749  if (item==0) return;
1750  TObjArray* lst = dynamic_cast<TObjArray*> (item->Object());
1751  if(lst==0) return;
1752 
1753  if(fbNeedConfirmation)
1754  if ( QMessageBox::information(0,
1755  QString("Delete all"),
1756  QString("Are you sure to delete all items from ") + item->text(0),
1757  QMessageBox::Yes, QMessageBox::No) == QMessageBox::No ) return;
1758 
1759  lst->Clear();
1760 
1761  UpdateItem(item, true);
1762 }
1763 
1765 {
1766  if (item==0) return;
1767 
1768  TObjArray* lst = dynamic_cast<TObjArray*> (item->Object());
1769  if(lst==0) return;
1770 
1771  if(item->ObjectType()==FitGui::ot_reslist)
1772  lst->Add(new TGo4FitDependency(0,0.0));
1773  else
1774  lst->Add(new TGo4FitDependency("Par1",1.0));
1775 
1776  UpdateItem(item, true);
1777 }
1778 
1780 {
1781  if (item==0) return;
1782 
1783  TGo4FitParsList* pars = dynamic_cast<TGo4FitParsList*> (item->Object());
1784  if (pars==0) return;
1785 
1786  pars->MemorizePars();
1787 }
1788 
1790 {
1791  if (item==0) return;
1792 
1793  TGo4FitParsList* pars = dynamic_cast<TGo4FitParsList*> (item->Object());
1794  if (pars==0) return;
1795 
1796  pars->RememberPars();
1797 
1799 
1800  ShowItem(item, false);
1801 }
1802 
1804 {
1805  if (item==0) return;
1806  TGo4FitParsList* pars = dynamic_cast<TGo4FitParsList*> (item->Object());
1807  if (pars==0) return;
1808 
1809  if(fbNeedConfirmation)
1810  if ( QMessageBox::information(0,
1811  QString("Delete all"),
1812  QString("Are you sure to delete all items"),
1813  QMessageBox::Yes, QMessageBox::No) == QMessageBox::No ) return;
1814 
1815  pars->ClearPars();
1816 
1817  UpdateItem(item, true);
1818 }
1819 
1821 {
1822  if (item==0) return;
1823  TGo4FitParameter* par = dynamic_cast<TGo4FitParameter*> (item->Object());
1824  if (par==0) return;
1825 
1826  par->MemorizeValue();
1827 }
1828 
1830 {
1831  if (item==0) return;
1832  TGo4FitParameter* par = dynamic_cast<TGo4FitParameter*> (item->Object());
1833  if (par==0) return;
1834 
1835  par->RememberValue();
1836 
1837  SetItemText(item, true);
1838 
1839  ShowItem(item, false);
1840 }
1841 
1843 {
1844  if (item==0) return;
1845 
1846  TGo4FitParsList* pars = dynamic_cast<TGo4FitParsList*> (item->Object());
1847  if (pars==0) return;
1848 
1849  TString name;
1850  int num(0);
1851  do {
1852  name = TString::Format("Par%d", num++);
1853  } while (pars->FindPar(name.Data()));
1854  pars->CreatePar(name.Data(),"additional parameter",0.);
1855 
1856  UpdateItem(item, true);
1857 }
1858 
1860 {
1861  if (item==0) return;
1862 
1863  TGo4FitParameter* par = dynamic_cast<TGo4FitParameter*> (item->Object());
1864  TGo4FitParsList* pars = dynamic_cast<TGo4FitParsList*> (item->Parent()->Object());
1865  if ((pars==0) || (par==0)) return;
1866 
1867  if(fbNeedConfirmation)
1868  if ( QMessageBox::information(0,
1869  QString("Delete item"),
1870  QString("Are you sure to delete ") + par->GetName(),
1871  QMessageBox::Yes, QMessageBox::No) == QMessageBox::No ) return;
1872 
1873  pars->RemovePar(par);
1874 
1875  UpdateItem(item->Parent(), true);
1876 }
1877 
1879 {
1880  if (item==0) return;
1881 
1882  TGo4FitMinuitResult* res = dynamic_cast<TGo4FitMinuitResult*> (item->Object());
1883  TGo4FitMinuit* minuit = dynamic_cast<TGo4FitMinuit*> (item->Parent()->Object());
1884  if ((res==0) || (minuit==0)) return;
1885 
1886  if(fbNeedConfirmation)
1887  if ( QMessageBox::information(0,
1888  QString("Delete result"),
1889  QString("Are you sure to delete ") + res->GetName(),
1890  QMessageBox::Yes, QMessageBox::No) == QMessageBox::No ) return;
1891 
1892  minuit->RemoveResult(res);
1893  delete res;
1894 
1895  UpdateItem(item->Parent(), true);
1896 }
1897 
1899 {
1900  if (item==0) return;
1901 
1903 
1904  for (int n=0; n < item->childCount(); n++)
1905  UpdateItem(dynamic_cast<QFitItem*>(item->child(n)), true);
1906 }
1907 
1908 
1909 // *************************** fitslots ends ******************************
1910 
1911 
1913 {
1914  QFitItem* fititem = dynamic_cast<QFitItem*> (FitList->itemAt(pnt));
1915  if (fititem==0) return;
1916 
1917  QSignalMapper map(this);
1918  connect(&map, SIGNAL(mapped(int)), this, SLOT(ItemMenuItemSelected(int)));
1919 
1920  QMenu menu(this);
1921 
1922  if (FillPopupForItem(fititem, &menu, &map)) {
1923  CurrFitItem = fititem;
1924  menu.exec(FitList->viewport()->mapToGlobal(pnt));
1925  CurrFitItem = 0;
1926  }
1927 }
1928 
1929 
1930 void TGo4FitPanel::FitList_currentItemChanged(QTreeWidgetItem* curr, QTreeWidgetItem*)
1931 {
1932  if (fbFillingWidget) return;
1933 
1934  QFitItem* fititem = dynamic_cast<QFitItem*> (curr);
1935  if (fititem==0) return;
1936 
1937  ShowItem(fititem, false);
1938  fxCurrentItem = fititem;
1939 
1940  UpdateItemMenu();
1941 }
1942 
1944 {
1945  ViewMenu->clear();
1946 
1950  SetIdAction(ViewMap, fiPanelMode, true, true);
1951 }
1952 
1953 
1955 {
1956  if (id!=FitGui::pm_None)
1957  fiPanelMode = id;
1958 
1959  fbParsWidgetShown = false;
1960  UpdateActivePage();
1961 }
1962 
1964 {
1965  QWidget* w = PageEmpty;
1966  switch(id) {
1967  case 1: w = PageSimple; break;
1968  case 2: w = PageWizard; break;
1969  case 3: w = PageExtended; break;
1970  case 100: w = PageParameters; break;
1971  }
1972  if (w!=WidgetStack->currentWidget())
1973  WidgetStack->setCurrentWidget(w);
1974 }
1975 
1976 void TGo4FitPanel::UpdateStatusBar(const char* info)
1977 {
1978  QString status;
1979  TGo4Fitter* fitter = GetFitter();
1980 
1981  if (info!=0) status=info; else {
1982  if (WorkingWithPanel()) {
1983  status = QString("Active: ") + ActivePad()->GetName();
1984  if (!WorkingWithOnlyPad())
1985  status += ". Muiltifit";
1986 
1987  } else status = "Workspace";
1988  if (fitter==0) status+=". No fitter";
1989  else status = status + ". Fitter: "+fitter->GetName();
1990  }
1991  MainStatusLbl->setText(status);
1992  MainStatusLbl->update();
1993  MainStatusLbl->repaint();
1994 
1995  MainAttachBtn->setEnabled(true);
1996 
1997  if (fbParsWidgetShown) {
1998  MainParsBtn->setText("Back");
1999  MainParsBtn->setToolTip("Back to last selected page");
2000  } else {
2001  MainParsBtn->setText("Pars");
2002  MainParsBtn->setToolTip("Show list of fitter parameters");
2003  }
2004 
2005  if (fitter==0) {
2006  MainFitBtn->setEnabled(false);
2007  MainDrawBtn->setEnabled(false);
2008  MainFindBtn->setEnabled(false);
2009  MainParsBtn->setEnabled(false);
2010  } else {
2011  MainFitBtn->setEnabled((fitter->GetNumData()>0) &&
2012  ((fitter->GetNumModel()>0) || (fiPanelMode==FitGui::pm_Simple)));
2013  MainDrawBtn->setEnabled(fitter->GetNumData()>0);
2014  MainFindBtn->setEnabled((fitter->GetNumData()>0) && (fiPanelMode==FitGui::pm_Wizard)
2015  && GetPeakFinder(false));
2016  MainParsBtn->setEnabled(true);
2017  }
2018 }
2019 
2021 {
2022  bool showitem = fiPanelMode==FitGui::pm_Expert;
2023 
2024  QString itemtext;
2025 
2026  if (showitem) {
2027  QFitItem* item = dynamic_cast<QFitItem*> (FitList->currentItem());
2028  if ((item==0) || (item->ObjectType()==FitGui::ot_fitter)) showitem = false; else
2029  itemtext = item->text(0);
2030  }
2031 
2032  if (showitem) {
2033  if (ItemMenu==0) {
2034  ItemMenu = MenuBar->addMenu(itemtext);
2035  connect(ItemMenu, SIGNAL(aboutToShow()), this, SLOT(AboutToShowItemMenu()));
2036  } else
2037  ItemMenu->setTitle(itemtext);
2038  MenuBar->adjustSize();
2039  } else
2040  if (ItemMenu!=0) {
2041  delete ItemMenu;
2042  ItemMenu = 0;
2043  }
2044 }
2045 
2047 {
2050  SetIdAction(SettMap, 3, true, fbFreezeMode);
2052 
2054  SetIdAction(SettMap, 11, true, fbDrawModels);
2055  SetIdAction(SettMap, 12, true, fbDrawComponents);
2057  SetIdAction(SettMap, 14, true, fbDrawBackground);
2058  SetIdAction(SettMap, 15, true, fbDrawInfoOnPad);
2060 
2061  SetIdAction(SettMap, 17, true, fiIntegralMode==0);
2062  SetIdAction(SettMap, 18, true, fiIntegralMode==1);
2063  SetIdAction(SettMap, 19, true, fiIntegralMode==2);
2064  SetIdAction(SettMap, 20, true, fiIntegralMode==3);
2065 
2066  SetIdAction(SettMap, 21, true, fiBuffersUsage==0);
2067  SetIdAction(SettMap, 22, true, fiBuffersUsage==1);
2068  SetIdAction(SettMap, 23, true, fiBuffersUsage==2);
2069  SetIdAction(SettMap, 24, true, fiBuffersUsage==3);
2070 }
2071 
2073 {
2074  switch(id) {
2075  case 1: fbNeedConfirmation = !fbNeedConfirmation; break;
2076  case 2: fbShowPrimitives = !fbShowPrimitives; break;
2077  case 3: fbFreezeMode = !fbFreezeMode; break;
2078  case 4: fbSaveWithReferences = !fbSaveWithReferences; break;
2079  case 10: fbUseCurrentRange = !fbUseCurrentRange; break;
2080  case 11: fbDrawModels = !fbDrawModels; break;
2081  case 12: fbDrawComponents = !fbDrawComponents; break;
2082  case 13: fbUseSamePanelForDraw = !fbUseSamePanelForDraw; break;
2083  case 14: fbDrawBackground = !fbDrawBackground; break;
2084  case 15: fbDrawInfoOnPad = !fbDrawInfoOnPad; break;
2086  case 17: fiIntegralMode = 0; UpdateActivePage(); break;
2087  case 18: fiIntegralMode = 1; UpdateActivePage(); break;
2088  case 19: fiIntegralMode = 2; UpdateActivePage(); break;
2089  case 20: fiIntegralMode = 3; UpdateActivePage(); break;
2090  case 21: fiBuffersUsage = 0; break;
2091  case 22: fiBuffersUsage = 1; break;
2092  case 23: fiBuffersUsage = 2; break;
2093  case 24: fiBuffersUsage = 3; break;
2094  }
2095 
2096  go4sett->setBool("/FitPanel/NeedConfirmation",fbNeedConfirmation);
2097  go4sett->setBool("/FitPanel/ShowPrimitives",fbShowPrimitives);
2098  go4sett->setBool("/FitPanel/SaveWithReferences",fbSaveWithReferences);
2099  go4sett->setBool("/FitPanel/UseCurrentRange",fbUseCurrentRange);
2100  go4sett->setBool("/FitPanel/DrawModels",fbDrawModels);
2101  go4sett->setBool("/FitPanel/DrawComponents",fbDrawComponents);
2102  go4sett->setBool("/FitPanel/UseSamePanelForDraw",fbUseSamePanelForDraw);
2103  go4sett->setBool("/FitPanel/DrawBackground",fbDrawBackground);
2104  go4sett->setBool("/FitPanel/DrawInfoOnPad",fbDrawInfoOnPad);
2105  go4sett->setBool("/FitPanel/RecalculateGaussWidth",fbRecalculateGaussWidth);
2106  go4sett->setInt("/FitPanel/IntegralMode",fiIntegralMode);
2107  go4sett->setInt("/FitPanel/BuffersUsage",fiBuffersUsage);
2108 }
2109 
2111 {
2112  FitterMenu->clear();
2113 
2114  TGo4Fitter* fitter = GetFitter();
2115  TGo4ViewPanel* panel = LastActivePanel();
2116 
2117  bool samepad = (panel==0) ? false : WorkingWithPanel() &&
2118  (panel==ActivePanel()) && (panel->GetActivePad()==ActivePad());
2119 
2120  QString padname;
2121  if (panel!=0) padname = QString("panel \"") + panel->windowTitle() + "\"";
2122 
2124  AddIdAction(FitterMenu, FitterMap, "&Create for workspace", 1, true);
2125  AddIdAction(FitterMenu, FitterMap, QString("Create &for ")+padname, 2, (panel!=0));
2126  AddIdAction(FitterMenu, FitterMap, "&Delete", 3, (fitter!=0));
2127  FitterMenu->addSeparator();
2128 
2129  AddIdAction(FitterMenu, FitterMap, "Save to &browser", 21, (fitter!=0));
2131  AddIdAction(FitterMenu, FitterMap, "&Workspace", 23, WorkingWithPanel());
2132  AddIdAction(FitterMenu, FitterMap, "&Update references", 24, (fitter!=0));
2133  AddIdAction(FitterMenu, FitterMap, "&Print parameters", 25, (fitter!=0) && fbParsWidgetShown);
2134  AddIdAction(FitterMenu, FitterMap, "&Rollback parameters", 26, (fitter!=0) && fitter->CanRollbackPars());
2135 
2136  FitterMenu->addSeparator();
2137 
2138  AddIdAction(FitterMenu, FitterMap, "&Close", 99, true);
2139 }
2140 
2142 {
2143  switch (id) {
2144  case 1: Fitter_New(); break;
2145  case 2: Fitter_NewForActivePad(true); break;
2146  case 3: Fitter_Delete(); break;
2147  case 21: Fitter_SaveToBrowser(); break;
2148  case 23: Fitter_UseWorkspace(); break;
2149  case 24: Fitter_UpdateReferences(); break;
2150  case 25: Fitter_PrintParameters(); break;
2151  case 26: Fitter_RollbackParameters(); break;
2152  case 99: close(); break;
2153  }
2154 }
2155 
2157 {
2158  QFitItem* item = dynamic_cast<QFitItem*> (FitList->currentItem());
2159  if ((ItemMenu==0) || (item==0)) return;
2160  ItemMenu->clear();
2162 }
2163 
2165 {
2166  QFitItem* item = CurrFitItem;
2167  if (item==0) item = dynamic_cast<QFitItem*> (FitList->currentItem());
2168  if (item==0) return;
2169 
2170  switch(id) {
2171  case 1: Cmd_DeleteFitter(); break;
2172  case 2: Cmd_ClearFitter(); break;
2173  case 3: Cmd_SaveFitter(false); break;
2174  case 4: Cmd_SaveFitter(true); break;
2175  case 5: Cmd_ItemPrint(item); break;
2176  case 6: Button_FitterDraw(0); break;
2177  case 8: Cmd_CreateFitter(); break;
2178  case 9: Cmd_CreateAppropriateFitter(); break;
2179  case 101: Cmd_DeleteData(item); break;
2180  case 102: Cmd_DeleteAssosiatedModels(item); break;
2181  case 105: Cmd_DrawData(item); break;
2182  case 107: Cmd_DeleteAllData(item); break;
2183  case 108: Wiz_RebuildDataList(); break;
2184  case 201: Cmd_DeleteModel(item); break;
2185  case 202: Cmd_DeleteModels(item); break;
2186  case 203: Cmd_CloneModel(item); break;
2187  case 301: Cmd_ClearAssigments(item); break;
2188  case 302: Cmd_AssignModelToAllData(item); break;
2189  case 303: Cmd_ClearAssigment(item); break;
2190  case 401: Cmd_RemoveRangeCondition(item); break;
2191  case 402: Cmd_RemoveRangeConditions(item); break;
2192  case 403:
2193  case 404:
2194  case 405:
2195  case 406:
2196  case 407: Cmd_AddRangeCondition(item, id-403); break;
2197  case 501: Cmd_DeleteAction(item); break;
2198  case 502: Cmd_MoveAction(item, -1); break;
2199  case 503: Cmd_MoveAction(item, +1); break;
2200  case 504: Cmd_ExecuteActions(item, false); break;
2201  case 505: Cmd_DeleteActions(item); break;
2202  case 506: Cmd_DeleteOutputActions(item); break;
2203  case 507: Cmd_ExecuteActions(item, true); break;
2204  case 508: Cmd_ExecuteAction(item); break;
2205  case 601: Cmd_DeleteDependency(item); break;
2206  case 602: Cmd_DeleteDependencies(item); break;
2207  case 603: Cmd_AddDependency(item); break;
2208  case 701: Cmd_DeletePars(item); break;
2209  case 702: Cmd_AddNewPar(item); break;
2210  case 703: Cmd_DeletePar(item); break;
2211  case 704: Cmd_MemorizePar(item); break;
2212  case 705: Cmd_RememberPar(item); break;
2213  case 706: Cmd_MemorizePars(item); break;
2214  case 707: Cmd_RememberPars(item); break;
2215  case 801: Cmd_DeleteMinuitResult(item); break;
2216  case 904: Cmd_UpdateAllSlots(item); break;
2217 
2218  default:
2219  if ((id>=110) && (id<200)) Cmd_AddNewData(item,id-110); else
2220  if ((id>=210) && (id<300)) Cmd_AddNewModel(item,id-210); else
2221  if ((id>=310) && (id<400)) Cmd_AssignModelToData(item,id-310); else
2222  if ((id>=510) && (id<600)) Cmd_AddNewAction(item,id-510); else
2223  if ((id>=1000) && (id<2000)) ExecutePopupForSlot(item, 0, id);
2224  }
2225 }
2226 
2227 void TGo4FitPanel::focusInEvent( QFocusEvent* event)
2228 {
2229  UpdateStatusBar(0);
2230  QWidget::focusInEvent(event);
2231 }
2232 
2233 void TGo4FitPanel::changeEvent(QEvent *event)
2234 {
2235  if (event->type() == QEvent::ActivationChange) UpdateStatusBar(0);
2236  QWidget::changeEvent(event);
2237 }
2238 
2239 //void TGo4FitPanel::windowActivationChange(bool OldActive)
2240 //{
2241 // UpdateStatusBar(0);
2242 // QWidget::windowActivationChange(OldActive);
2243 //}
2244 
2246 {
2247  TGo4FitPeakFinder* finder = GetPeakFinder(true);
2248  if (finder!=0)
2249  PF_AmplLbl->setText(QString("Threshold: ")+QString::number(finder->Get0MaxAmplFactor()*100)+"%");
2250  else
2251  PF_AmplLbl->setText("Threshold:");
2252  PF_AmplLbl->adjustSize();
2253 }
2254 
2256 {
2257  TGo4FitPeakFinder* finder = GetPeakFinder(true);
2258 
2259  if (finder!=0)
2260  PF_RelNoiseLbl->setText(QString("Noise factor: ")+QString::number(finder->Get2NoiseFactor()));
2261  else
2262  PF_RelNoiseLbl->setText("Noise factor: ");
2263  PF_RelNoiseLbl->adjustSize();
2264 }
2265 
2266 void TGo4FitPanel::PF_MinWidthEdt_textChanged( const QString & str )
2267 {
2268  if (fbFillingWidget) return;
2269  bool ok;
2270  double zn = str.toDouble(&ok);
2271  if (ok) {
2272  TGo4FitPeakFinder* finder = GetPeakFinder(true);
2273  if (finder!=0) finder->Set0MinWidth(zn);
2274  }
2275 }
2276 
2277 
2278 void TGo4FitPanel::PF_MaxWidthEdt_textChanged( const QString & str )
2279 {
2280  if (fbFillingWidget) return;
2281  bool ok;
2282  double zn = str.toDouble(&ok);
2283  if (ok) {
2284  TGo4FitPeakFinder* finder = GetPeakFinder(true);
2285  if (finder) finder->Set0MaxWidth(zn);
2286  }
2287 }
2288 
2289 
2290 void TGo4FitPanel::PF_WidthEdit_textChanged( const QString & str)
2291 {
2292  if (fbFillingWidget) return;
2293  bool ok;
2294  double zn = str.toDouble(&ok);
2295  if (ok) {
2296  TGo4FitPeakFinder* finder = GetPeakFinder(true);
2297  if (finder) finder->Set1LineWidth(zn);
2298  }
2299 }
2300 
2302 {
2303  if (!fbFillingWidget) {
2304  TGo4FitPeakFinder* finder = GetPeakFinder(true);
2305  if (finder) finder->Set0MaxAmplFactor(1.-zn/100.);
2306  UpdatePFAmplLbl();
2307  }
2308 }
2309 
2311 {
2312  if (!fbFillingWidget)
2314 }
2315 
2317 {
2318  if (!fbFillingWidget) {
2319  TGo4FitPeakFinder* finder = GetPeakFinder(true);
2320  if (finder) finder->Set2NoiseFactor((101-zn)/10.);
2322  }
2323 }
2324 
2326 {
2327  if (!fbFillingWidget)
2329 }
2330 
2332 {
2333  if (fbFillingWidget) return;
2334  bool ok;
2335  double zn = str.toDouble(&ok);
2336  if (ok) {
2337  TGo4FitPeakFinder* finder = GetPeakFinder(true);
2338  if (finder!=0) finder->Set2NoiseMinimum(zn);
2339  }
2340 }
2341 
2342 
2344 {
2345  if (!fbFillingWidget) {
2346  TGo4FitPeakFinder* finder = GetPeakFinder(true);
2347  if (finder!=0) {
2348  finder->Set2ChannelSum(num);
2350  }
2351  }
2352 }
2353 
2354 
2356 {
2357  TGo4Fitter* fitter = GetFitter();
2358 
2359  fbFillingWidget = true;
2360 
2361  bool updatestack = false, updatepaint = false;
2362 
2363  Wiz_DataList->clear();
2364  if (fitter==0) fxWizDataName = "";
2365  else {
2366  if ((Wiz_SelectedData()==0) && (fitter->GetNumData()>0)) {
2367  fxWizDataName = fitter->GetDataName(0);
2368  if (fiWizPageIndex<1) updatestack = true;
2369  if (fiPaintMode==0) updatepaint = true;
2370  }
2371 
2372  int selindx = -1;
2373  for(Int_t n=0;n<fitter->GetNumData();n++) {
2374  TGo4FitData* data = fitter->GetData(n);
2375  QListWidgetItem* item = new QListWidgetItem(data->GetName());
2376  if (strcmp(data->GetName(), fxWizDataName.toLatin1().constData())==0) {
2377  selindx = n;
2378  item->setSelected(true);
2379  }
2380  Wiz_DataList->addItem(item);
2381  }
2382  if (selindx<0) fxWizDataName = "";
2383  }
2385  fbFillingWidget = false;
2386 
2387  if (updatestack) {
2388  fiWizPageIndex = 2;
2390  }
2391  if (updatepaint)
2392  UpdateWizPaint(1);
2393 
2394 }
2395 
2397 {
2398  TGo4Fitter* fitter = GetFitter();
2399  TGo4FitData* data = Wiz_SelectedData();
2400 
2401  Wiz_PFSetupBtn->setEnabled(data!=0);
2402 
2403  if (!WorkingWithPanel()) {
2404  Wiz_RebuildDataBtn->setVisible(false);
2405  Wiz_AddDataBtn->setVisible(true);
2406  Wiz_DelDataBtn->setVisible(true);
2407  Wiz_AddDataBtn->setEnabled(fitter!=0);
2408  Wiz_DelDataBtn->setEnabled(data!=0);
2409  } else {
2410  Wiz_RebuildDataBtn->setVisible(true);
2411  Wiz_RebuildDataBtn->setEnabled(fitter!=0);
2412  Wiz_AddDataBtn->setVisible(false);
2413  Wiz_DelDataBtn->setVisible(false);
2414  }
2415 }
2416 
2418 {
2419  fbFillingWidget = true;
2420 
2421  Wiz_ModelList->clear();
2422 
2423  TGo4Fitter* fitter = GetFitter();
2424 
2425  Wiz_ShowAllMod->setChecked(fbWizShowAllModels);
2426  int selindx = -1;
2427  if(fitter!=0) {
2428  TGo4FitData* data = Wiz_SelectedData();
2429  int indx = 0;
2430  for(Int_t n=0;n<fitter->GetNumModel();n++) {
2431  TGo4FitModel* model = fitter->GetModel(n);
2432  if (data && !fbWizShowAllModels)
2433  if (!model->IsAssignTo(data->GetName())) continue;
2434 
2435  bool assign = false;
2436  if (data && model->IsAssignTo(data->GetName())) assign = true;
2437  QListWidgetItem* item = new QListWidgetItem(model->GetName());
2438  item->setCheckState(assign ? Qt::Checked : Qt::Unchecked );
2439  if (strcmp(model->GetName(), fxWizModelName.toLatin1().constData())==0) {
2440  selindx = indx;
2441  item->setSelected(true);
2442  }
2443  Wiz_ModelList->addItem(item);
2444  indx++;
2445  }
2446 
2447  if (selindx>=0)
2448  Wiz_ModelList->setCurrentRow(selindx);
2449 
2450  if (selindx<0) fxWizModelName = "";
2451 // else Wiz_ModelList->ensureCurrentVisible();
2452 
2453  } else fxWizModelName = "";
2454 
2455  if (changestack)
2456  if (selindx>=0) fiWizPageIndex = 1; else
2457  if (fiWizPageIndex==1) fiWizPageIndex = 0;
2458 
2460 
2461  fbFillingWidget = false;
2462 
2463  if(changestack)
2465 }
2466 
2468 {
2469  TGo4Fitter* fitter = GetFitter();
2470  TGo4FitModel* model = Wiz_SelectedModel();
2471 
2472  Wiz_ShowAllMod->setVisible(!WorkingWithOnlyPad());
2473 
2474  if (fitter) {
2475  Wiz_AddModelBtn->setEnabled(true);
2476  Wiz_DelModelBtn->setEnabled(model!=0);
2477  Wiz_CloneModelBtn->setEnabled(model!=0);
2478  Wiz_ShowAllMod->setEnabled(true);
2479  } else {
2480  Wiz_AddModelBtn->setEnabled(false);
2481  Wiz_DelModelBtn->setEnabled(false);
2482  Wiz_CloneModelBtn->setEnabled(false);
2483  Wiz_ShowAllMod->setEnabled(false);
2484  }
2485 }
2486 
2488 {
2489  fbFillingWidget = true;
2490  TGo4Fitter* fitter = GetFitter();
2491 
2492  int indx = -1;
2493  if (fitter==0) fiWizPageIndex = -1;
2494  else indx = fiWizPageIndex;
2495 
2496  QWidget* target = 0;
2497 
2498  switch (indx) {
2499  case -1:
2500  target = Wiz_EmptyPage;
2501  break;
2502  case 0: {
2503  target = Wiz_FitterPage;
2504 
2505  int typ = fitter->GetFitFunctionType();
2507  Wiz_FitFuncCmb->setCurrentIndex(typ);
2508 
2509  Wiz_UseAmplEstimChk->setChecked(fbUseAmplEstim);
2510  Wiz_MigradIterSpin->setValue(fiNumMigradIter);
2511 
2512  break;
2513  }
2514 
2515  case 1: {
2516  TGo4FitModel* model = Wiz_SelectedModel();
2517  if (model==0) break;
2518 
2519  target = Wiz_ModelPage;
2520 
2521  QString modelinfo;
2522  Wiz_GetModelInfo(model, &modelinfo);
2523  Wiz_ModelInfoLbl->setText(modelinfo);
2524 
2525  Wiz_BackgroundChk->setChecked(model->GetGroupIndex()==0);
2526 
2527  Wiz_ModelBufChk->setChecked(model->GetUseBuffers());
2528  Wiz_ModelBufChk->setEnabled(fiBuffersUsage==3);
2529 
2530  FillParsTable(Wiz_ParTable, fitter, model, false, fxWizPars);
2531 
2532  break;
2533  }
2534 
2535  case 2: {
2536  TGo4FitData* data = Wiz_SelectedData();
2537  if (data==0) break;
2538 
2539  target = Wiz_DataPage;
2540 
2541  QString datainfo("Data: ");
2542  datainfo += data->GetName();
2543  datainfo += " of class: ";
2544  datainfo += data->ClassName();
2545  if (fiIntegralMode==1) {
2546  datainfo += "\nCounts=";
2547  double v = fitter->CalculatesIntegral(data->GetName(),0,kTRUE);
2548  datainfo += QString::number(v);
2549  }
2550  if (fiIntegralMode==2) {
2551  datainfo += "\nIntegral=";
2552  double v = fitter->CalculatesIntegral(data->GetName(),0,kFALSE);
2553  datainfo += QString::number(v);
2554  }
2555  Wiz_DataInfoLbl->setText(datainfo);
2556 
2557  QString models("Models:");
2558  for(int n=0;n<fitter->GetNumModel();n++) {
2559  TGo4FitModel* model = fitter->GetModel(n);
2560  if (model->IsAssignTo(data->GetName())) {
2561  if (models.length()>45) {
2562  models += " ...";
2563  break;
2564  }
2565  models += " ";
2566  models += model->GetName();
2567  }
2568  }
2569  Wiz_DataModelsLbl->setText(models);
2570 
2571  Wiz_DataBufChk->setChecked(
2572  (fiBuffersUsage==1) || (fiBuffersUsage==2) ||
2573  ((fiBuffersUsage==3) && data->GetUseBuffers()));
2574  Wiz_DataBufChk->setEnabled(fiBuffersUsage==3);
2575 
2576  fxWizSlots->Clear();
2577  data->FillSlotList(fxWizSlots);
2578 
2579  Wiz_DataSlotsTable->setRowCount(fxWizSlots->GetLast()+1);
2580 
2581  for(int n=0;n<=fxWizSlots->GetLast();n++) {
2582  TGo4FitSlot* slot = dynamic_cast<TGo4FitSlot*> (fxWizSlots->At(n));
2583  if (slot==0) continue;
2584 
2585  Wiz_DataSlotsTable->setVerticalHeaderItem(n, new QTableWidgetItem(slot->GetName()));
2586  TObject* obj = slot->GetObject();
2587 
2588  if (obj==0) {
2589  Wiz_DataSlotsTable->setItem(n, 0, new QTableWidgetItem(" --- "));
2590  Wiz_DataSlotsTable->setItem(n, 1, new QTableWidgetItem(slot->GetClass()->GetName()));
2591  Wiz_DataSlotsTable->setItem(n, 2, new QTableWidgetItem("false"));
2592  } else {
2593  Wiz_DataSlotsTable->setItem(n, 0, new QTableWidgetItem(obj->GetName()));
2594  Wiz_DataSlotsTable->setItem(n, 1, new QTableWidgetItem(obj->ClassName()));
2595  if (slot->GetOwned()) Wiz_DataSlotsTable->setItem(n, 2, new QTableWidgetItem("true"));
2596  else Wiz_DataSlotsTable->setItem(n, 2, new QTableWidgetItem("false"));
2597  }
2598 
2599  Wiz_DataSlotsTable->setItem(n, 3, new QTableWidgetItem(Wiz_GetSlotSourceInfo(slot)));
2600  }
2601 
2602  Wiz_DataSlotsTable->resizeColumnsToContents ();
2603 
2604  Wiz_DataUseRangeBtn->setEnabled(FindPadWhereData(data)!=0);
2605  if (data!=0)
2606  Wiz_DataClearRangesBtn->setEnabled(data->IsAnyRangeLimits());
2607  Wiz_DrawDataBtn->setEnabled(data!=0);
2608 
2609  break;
2610  }
2611  case 3: {
2612  target = Wiz_PFPage;
2613 
2614  TGo4FitPeakFinder* finder = GetPeakFinder(true);
2615  if (finder==0) break;
2616 
2617  UpdateStatusBar(0);
2618 
2619  FindersTab->setCurrentIndex(finder->GetPeakFinderType());
2620 
2621  Wiz_PFUsePolynChk->setChecked(finder->GetUsePolynom());
2622  Wiz_PFPolynSpin->setEnabled(finder->GetUsePolynom());
2623  Wiz_PFPolynSpin->setValue(finder->GetPolynomOrder());
2624 
2625  PF_MinWidthEdt->setText(QString::number(finder->Get0MinWidth()));
2626  PF_MaxWidthEdt->setText(QString::number(finder->Get0MaxWidth()));
2627  PF_AmplSlider->setValue(int(100*(1.-finder->Get0MaxAmplFactor())));
2628  UpdatePFAmplLbl();
2629 
2630  PF_WidthEdit->setText(QString::number(finder->Get1LineWidth()));
2631 
2632  int zn = int(10*finder->Get2NoiseFactor()); // from 1..100
2633  PF_RelNoiseSlider->setValue(101 - zn);
2635  PF_MinNoiseEdit->setText(QString::number(finder->Get2NoiseMinimum()));
2636  PF_SumUpSpin->setValue(finder->Get2ChannelSum());
2637 
2638  break;
2639  }
2640  }
2641 
2642  if (target) Wiz_Stack->setCurrentWidget(target);
2643  else Wiz_Stack->setCurrentWidget(Wiz_EmptyPage);
2644 
2645  fbFillingWidget = false;
2646 }
2647 
2649 {
2650  RemovePrimitives();
2651 
2652  if (!fbShowPrimitives) return;
2653 
2654  if (mode>=0) fiPaintMode = mode;
2655 
2656  TGo4Fitter* fitter = GetFitter();
2657  TGo4FitModel* model = Wiz_SelectedModel();
2658  TGo4FitData* data = Wiz_SelectedData();
2659 
2660  if ((fitter!=0) && (data!=0) && (fiPaintMode==1)) {
2661  TPad* pad = FindPadWhereData(data);
2662 
2663  if (PaintModelsFor(fitter, data, 0, false))
2664  for(Int_t n=0;n<data->GetNumRangeCondition();n++)
2665  PaintRange(data, n, pad, 0);
2666  }
2667 
2668  if ((fitter!=0) && (model!=0) && (fiPaintMode==2)) {
2669  for(Int_t n=0;n<model->NumAssigments();n++) {
2670  data = fitter->FindData(model->AssignmentName(n));
2671  if ((data!=0) && !data->IsAnyDataTransform()) {
2672  TPad* pad = FindPadWhereData(data);
2673  PaintModel(model, pad, 0);
2674  }
2675  }
2676  }
2677 }
2678 
2679 void TGo4FitPanel::Wiz_DataListSelect(QListWidgetItem* item)
2680 {
2681  if (fbFillingWidget || (item==0)) return;
2682  QString name = item->text();
2683 
2684  if ((name==fxWizDataName) && (fiWizPageIndex == 2)) return;
2685  fxWizDataName = name;
2686  fiWizPageIndex = 2;
2688  UpdateWizModelsList(false);
2690  UpdateWizPaint(1);
2691 }
2692 
2693 void TGo4FitPanel::Wiz_ModelListSelect(QListWidgetItem* item)
2694 {
2695  if (fbFillingWidget || (item==0)) return;
2696 
2697  QString name = item->text();
2698 
2699  bool needupdate = ( (name != fxWizModelName) || (fiWizPageIndex != 1) );
2700 
2701  fxWizModelName = name;
2702  fiWizPageIndex = 1;
2703 
2704  TGo4Fitter* fitter = GetFitter();
2705  TGo4FitModel* model = Wiz_SelectedModel();
2706  TGo4FitData* data = Wiz_SelectedData();
2707  if ((fitter!=0) && (data!=0) && (model!=0)) {
2708  bool wasassigned = model->IsAssignTo(data->GetName());
2709  bool isassigned = (item->checkState() == Qt::Checked);
2710 
2711  if (wasassigned != isassigned) {
2712  if (wasassigned) fitter->ClearModelAssignmentTo(model->GetName(), data->GetName());
2713  else fitter->AssignModelTo(model->GetName(), data->GetName());
2714  needupdate = true;
2715  }
2716  }
2717 
2718  if (needupdate) {
2721  UpdateWizPaint(2);
2722  }
2723 }
2724 
2726 {
2727  if (fbFillingWidget) return;
2728 
2729  QSignalMapper map(this);
2730  QMenu menu(this);
2731 
2732  FillDataTypesList(&menu, &map, 0);
2733 
2734  QAction* act = menu.exec(Wiz_AddDataBtn->mapToGlobal(QPoint(5,5)));
2735  if (act==0) return;
2736 
2737  int id = 0;
2738  for(id=0;id<100;id++)
2739  if (act == (QAction*) map.mapping(id)) break;
2740 
2741  TGo4FitData* data = Wiz_CreateNewData(id);
2742  if (data) {
2743  fxWizDataName = data->GetName();
2744  fiWizPageIndex = 2;
2746  UpdateWizModelsList(false);
2748  UpdateWizPaint(1);
2749  UpdateStatusBar(0);
2750  }
2751 }
2752 
2753 
2755 {
2756  if (fbFillingWidget) return;
2757 
2758  if (Wiz_RemoveData()) {
2760  UpdateWizModelsList(false);
2761  fiWizPageIndex = 0;
2763  UpdateWizPaint(0);
2764  UpdateStatusBar(0);
2765  }
2766 }
2767 
2769 {
2770  if (fbFillingWidget) return;
2771 
2772  QSignalMapper map(this);
2773  QMenu menu(this);
2774 
2775  FillModelTypesList(&menu, &map, 0, true);
2776 
2777  QAction* act = menu.exec(Wiz_AddModelBtn->mapToGlobal(QPoint(5,5)));
2778 
2779  int id = 0;
2780  for(id=0;id<100;id++)
2781  if (act == (QAction*) map.mapping(id)) break;
2782 
2783  TGo4FitModel* model = Wiz_CreateNewModel(id);
2784  if (model) fxWizModelName = model->GetName();
2785  UpdateWizModelsList(true);
2786  if(Wiz_SelectedModel()!=0) UpdateWizPaint(2);
2787  UpdateStatusBar(0);
2788 }
2789 
2791 {
2792  if (fbFillingWidget) return;
2793 
2794  TGo4Fitter* fitter = GetFitter();
2795  if (fitter==0) return;
2796 
2797  if(fbNeedConfirmation)
2798  if ( QMessageBox::information(0,"Delete models",
2799  QString("Are you sure to delete selected models"),
2800  QMessageBox::Yes, QMessageBox::No) == QMessageBox::No ) return;
2801 
2802  for(uint n=0; n<Wiz_ModelList->count();n++) {
2803  if (!Wiz_ModelList->item(n)->isSelected()) continue;
2804  QString name = Wiz_ModelList->item(n)->text();
2805  fitter->RemoveModel(name.toLatin1().constData(), kTRUE);
2806  }
2807 
2808  fxWizModelName = "";
2809  UpdateWizModelsList(true);
2810  UpdateWizPaint(0);
2811  UpdateStatusBar(0);
2812 }
2813 
2815 {
2816  if (fbFillingWidget) return;
2817 
2818  TGo4Fitter* fitter = GetFitter();
2819  if (fitter==0) return;
2820 
2821  for(uint n=0; n<Wiz_ModelList->count();n++) {
2822  if (!Wiz_ModelList->item(n)->isSelected()) continue;
2823  QString name = Wiz_ModelList->item(n)->text();
2824  fitter->CloneModel(name.toLatin1().constData());
2825  }
2826 
2827  fxWizModelName = "";
2828  UpdateWizModelsList(true);
2829  UpdateWizPaint(0);
2830  UpdateStatusBar(0);
2831 }
2832 
2834 {
2835  if (fbFillingWidget) return;
2836  fbWizShowAllModels = zn;
2837  UpdateWizModelsList(true);
2838  UpdateWizPaint(2);
2839 }
2840 
2841 
2843 {
2844  if (!fbFillingWidget && GetFitter())
2845  GetFitter()->SetFitFunctionType(typ);
2846 }
2847 
2848 
2849 void TGo4FitPanel::Wiz_FitNameEdt_textChanged( const QString & name)
2850 {
2851  TGo4Fitter* fitter = GetFitter();
2852  if(fbFillingWidget || (fitter==0) || (name.length()==0)) return;
2853  fitter->SetName(name.toLatin1().constData());
2854 
2855  fiWizPageIndex = 0;
2857  UpdateWizPaint(0);
2858 
2859  UpdateStatusBar(0);
2860 }
2861 
2862 
2864 {
2865  ParsTableChanged(Wiz_ParTable, nrow, ncol, false, fxWizPars, true);
2866 }
2867 
2868 
2870 {
2871  TGo4Fitter* fitter = GetFitter();
2872  TGo4FitData* data = Wiz_SelectedData();
2873  if ((data==0) || (fitter==0)) return;
2874  bool ok;
2875  QString newname = QInputDialog::getText(this, "Change data name", "Input new name", QLineEdit::Normal, data->GetName(), &ok);
2876  if (ok && (newname.length()>0) && (newname!=data->GetName())) {
2877  if (fitter->FindData(newname.toLatin1().constData())) {
2878  QMessageBox::information(this, "Fit panel", "Unable to rename data.\n Name " +
2879  newname + " already exists","return");
2880  return;
2881  }
2882  fitter->ChangeDataNameInAssignments(data->GetName(), newname.toLatin1().constData());
2883  data->SetName(newname.toLatin1().constData());
2884  fxWizDataName = newname;
2886  UpdateWizPaint(1);
2887  }
2888 }
2889 
2890 
2892 {
2893  TGo4Fitter* fitter = GetFitter();
2894  TGo4FitModel* model = Wiz_SelectedModel();
2895  if ((model==0) || (fitter==0)) return;
2896  bool ok;
2897  QString newname = QInputDialog::getText(this, "Change model name", "Input new name", QLineEdit::Normal, model->GetName(), &ok);
2898  if (ok && (newname.length()>0) && (newname!=model->GetName())) {
2899  if (fitter->FindModel(newname.toLatin1().constData())) {
2900  QMessageBox::information(this, "Fit panel", QString("Unable to rename model.\n Name ")+
2901  newname + " already exists\n", "Return");
2902  return;
2903  }
2904  model->SetName(newname.toLatin1().constData());
2905  fxWizModelName = newname;
2906  UpdateWizModelsList(true);
2907  UpdateWizPaint(2);
2908  }
2909 }
2910 
2911 void TGo4FitPanel::Wiz_ModelList_itemChanged(QListWidgetItem* item)
2912 {
2913  if (fbFillingWidget) return;
2914 
2915  QString name = item->text();
2916 
2917  bool checked = (item->checkState() == Qt::Checked);
2918 
2919  bool needupdate = ( (name != fxWizModelName) || (fiWizPageIndex != 1) );
2920 
2921  fxWizModelName = name;
2922  fiWizPageIndex = 1;
2923 
2924  TGo4Fitter* fitter = GetFitter();
2925  TGo4FitModel* model = Wiz_SelectedModel();
2926  TGo4FitData* data = Wiz_SelectedData();
2927  if ((fitter!=0) && (data!=0) && (model!=0)) {
2928  bool wasassigned = model->IsAssignTo(data->GetName());
2929 
2930  if (wasassigned!=checked) {
2931  if (wasassigned) fitter->ClearModelAssignmentTo(model->GetName(), data->GetName());
2932  else fitter->AssignModelTo(model->GetName(), data->GetName());
2933  needupdate = true;
2934  }
2935  }
2936 
2937  if (needupdate) {
2940  UpdateWizPaint(2);
2941  }
2942 }
2943 
2945 {
2947 }
2948 
2950 {
2951  if (fbFillingWidget) return;
2952  TGo4FitData* data = Wiz_SelectedData();
2953  if (data) data->SetUseBuffers(zn);
2954 }
2955 
2956 
2958 {
2959  if (!fbFillingWidget)
2960  fbUseAmplEstim = chk;
2961 }
2962 
2963 
2965 {
2966  if (!fbFillingWidget)
2967  fiNumMigradIter = num;
2968 }
2969 
2970 
2972 {
2973  if (fbFillingWidget || (fxWizSlots==0)) return;
2974 
2975  QTableWidgetItem* item = Wiz_DataSlotsTable->itemAt(pnt);
2976 
2977  int nrow = item ? item->row() : -1;
2978 
2979  if ((nrow<0) || (nrow>fxWizSlots->GetLast())) return;
2980 
2981  TGo4FitSlot* slot = dynamic_cast<TGo4FitSlot*> (fxWizSlots->At(nrow));
2982  if (slot==0) return;
2983 
2984  QSignalMapper map(this);
2985  QMenu menu(this);
2986 
2987  if (FillPopupForSlot(slot, &menu, &map)) {
2988  QAction* act = menu.exec(Wiz_DataSlotsTable->mapToGlobal(pnt));
2989  if (act==0) return;
2990  for (int id=0; id<10000; id++)
2991  if (act == (QAction*) map.mapping(id))
2992  ExecutePopupForSlot(0, slot, id);
2993  }
2994 }
2995 
2997 {
2998  if (!fbFillingWidget)
3000 }
3001 
3002 
3004 {
3005  if (fbFillingWidget) return;
3006  TGo4FitData* data = Wiz_SelectedData();
3007  if (data!=0) {
3008  data->ClearRanges();
3009  UpdateActivePage();
3010  }
3011 }
3012 
3014 {
3015  if (fbFillingWidget) return;
3016  if (Wiz_SelectedData()!=0)
3018 }
3019 
3021 {
3022  UpdateStatusBar(0);
3023 
3025 }
3026 
3028 {
3029  QApplication::setOverrideCursor(Qt::WaitCursor);
3030 
3032 
3033  QApplication::restoreOverrideCursor();
3034 }
3035 
3037 {
3038  Button_FitterDraw(0);
3039 }
3040 
3042 {
3043  if (GetFitter()!=0)
3045 }
3046 
3048 {
3050 
3051  UpdateActivePage();
3052 }
3053 
3055 {
3056  TGo4Fitter* fitter = GetFitter();
3057  if (fitter==0) return;
3058  fbFillingWidget = true;
3059 
3060  Double_t FF = fitter->GetResultFF();
3061  Int_t NDF = fitter->GetResultNDF();
3062  if ((FF==0) && (NDF==0)) Par_FitterResLbl->hide();
3063  else {
3064  Par_FitterResLbl->setText("Result: Fit func = " + QString::number(FF) +
3065  " NDF = " + QString::number(NDF));
3066  Par_FitterResLbl->show();
3067  }
3068 
3069  FillParsTable(ParsTable, fitter, 0, LineParsChk->isChecked(), fxParsTableList);
3070  fbFillingWidget = false;
3071 }
3072 
3074 {
3075  if (fbFillingWidget) return;
3076 
3077  TGo4Fitter* fitter = GetFitter();
3078  if (fitter==0) return;
3079  fbFillingWidget = true;
3080  FillParsTable(ParsTable, fitter, 0, LineParsChk->isChecked(), fxParsTableList);
3081  WidgetStack->setCurrentWidget(PageParameters);
3082  fbFillingWidget = false;
3083 }
3084 
3085 
3086 void TGo4FitPanel::ParsTable_valueChanged( int nrow, int ncol)
3087 {
3088  if (!fbFillingWidget)
3089  ParsTableChanged(ParsTable, nrow, ncol, LineParsChk->isChecked(), fxParsTableList, false);
3090 }
3091 
3092 
3093 void TGo4FitPanel::FillParsTable(QTableWidget* table, TGo4Fitter* fitter, TGo4FitModel* model, bool LinesView, TObjArray* TableList) {
3094  if ((table==0) || (fitter==0) || (TableList==0)) return;
3095 
3096  if (model && LinesView) return;
3097  TableList->Clear();
3098 
3099 /* for (int nr=0;nr<table->rowCount();nr++)
3100  for (int nc=0;nc<table->columnCount();nc++) {
3101  QTableWidgetItem* item = table->item(nr,nc);
3102  if (item) {
3103  item->setFlags(item->flags() | Qt::ItemIsEnabled);
3104  if (nc==0) item->setText("");
3105  }
3106  }
3107 */
3108 
3109  if (LinesView) {
3110  int MaxAxis = 0;
3111  for (Int_t n=0; n<fitter->GetNumModel();n++) {
3112  TGo4FitModel* m = fitter->GetModel(n);
3113  if (m==0) continue;
3114  Double_t zn;
3115  for (int naxis=0;naxis<10;naxis++)
3116  if (m->GetPosition(naxis,zn) || m->GetWidth(naxis,zn)) MaxAxis = naxis;
3117  }
3118 
3119  int nfcol = (fiIntegralMode>0) ? 2 : 1;
3120  table->setColumnCount(nfcol+(MaxAxis+1)*2);
3121  table->setHorizontalHeaderItem(0, new QTableWidgetItem("Amplitude"));
3122 
3123  QString capt;
3124  if (fiIntegralMode==1) capt = "Counts"; else
3125  if (fiIntegralMode==2) capt = "Integral"; else
3126  if (fiIntegralMode==3) capt = "Gauss Int";
3127  if (!capt.isEmpty())
3128  table->setHorizontalHeaderItem(1, new QTableWidgetItem(capt));
3129 
3130  for (int naxis=0;naxis<=MaxAxis;naxis++) {
3131  capt = QString("Position ") + QString::number(naxis);
3132  table->setHorizontalHeaderItem(nfcol + naxis*2, new QTableWidgetItem(capt));
3134  capt = QString("FWHM ");
3135  else
3136  capt = QString("Sigma ");
3137  capt += QString::number(naxis);
3138  table->setHorizontalHeaderItem(nfcol+1 + naxis*2, new QTableWidgetItem(capt));
3139  }
3140 
3141  table->setRowCount(fitter->GetNumModel());
3142 
3143  for (Int_t n=0; n<fitter->GetNumModel();n++) {
3144  TGo4FitModel* m = fitter->GetModel(n);
3145  TableList->Add(m);
3146 
3147  bool recalculatew = (m->InheritsFrom(TGo4FitModelGauss1::Class()) ||
3148  m->InheritsFrom(TGo4FitModelGauss2::Class()) ||
3149  m->InheritsFrom(TGo4FitModelGaussN::Class())) &&
3151  double widthk = recalculatew ? 2.3548 : 1.0;
3152 
3153  table->setVerticalHeaderItem(n, new QTableWidgetItem(m->GetName()));
3154 
3155  QTableWidgetItem* item0 = new QTableWidgetItem(QString::number(m->GetAmplValue()));
3156  if (!m->GetAmplPar())
3157  item0->setFlags(item0->flags() & ~Qt::ItemIsEnabled);
3158  table->setItem(n, 0, item0);
3159 
3160  if (fiIntegralMode>0) {
3161  Double_t v = 0.;
3162  TGo4FitData* data = Wiz_SelectedData();
3163  switch (fiIntegralMode) {
3164  case 1:
3165  if (data!=0)
3166  v = fitter->CalculatesIntegral(data->GetName(), m->GetName(), kTRUE);
3167  else
3168  v = fitter->CalculatesModelIntegral(m->GetName(), kTRUE);
3169  break;
3170  case 2:
3171  if (data!=0)
3172  v = fitter->CalculatesIntegral(data->GetName(), m->GetName(), kFALSE);
3173  else
3174  v = fitter->CalculatesModelIntegral(m->GetName(), kFALSE);
3175  break;
3176  case 3: v = m->Integral(); break;
3177  default: v = 0;
3178  }
3179 
3180  QTableWidgetItem* item1;
3181  if ((v<=0.) && (fiIntegralMode==3))
3182  item1 = new QTableWidgetItem("---");
3183  else
3184  item1 = new QTableWidgetItem(QString::number(v));
3185  item1->setFlags(item1->flags() & ~Qt::ItemIsEnabled);
3186  table->setItem(n, 1, item1);
3187  }
3188 
3189  for (int naxis=0;naxis<=MaxAxis;naxis++) {
3190 
3191  Double_t pos, width;
3192 
3193  QTableWidgetItem* item;
3194 
3195  if (m->GetPosition(naxis,pos)) {
3196  item = new QTableWidgetItem(QString::number(pos));
3197  } else {
3198  item = new QTableWidgetItem("---");
3199  item->setFlags(item->flags() & ~Qt::ItemIsEnabled);
3200  }
3201 
3202  table->setItem(n, nfcol+naxis*2, item);
3203 
3204  if (m->GetWidth(naxis,width)) {
3205  item = new QTableWidgetItem(QString::number(width*widthk));
3206  } else {
3207  item = new QTableWidgetItem("---");
3208  item->setFlags(item->flags() & ~Qt::ItemIsEnabled);
3209  }
3210  table->setItem(n, nfcol+1+naxis*2, item);
3211  }
3212  }
3213 
3214  } else {
3215 
3216  TGo4FitParsList* pars = (model==0) ? dynamic_cast<TGo4FitParsList*> (fitter) :
3217  dynamic_cast<TGo4FitParsList*> (model);
3218  if (pars==0) return;
3219 
3220  for(Int_t n=0; n<pars->NumPars();n++)
3221  TableList->Add(pars->GetPar(n));
3222 
3223  table->setColumnCount(6);
3224  table->setHorizontalHeaderItem(0, new QTableWidgetItem("Fixed"));
3225  table->setHorizontalHeaderItem(1, new QTableWidgetItem("Value"));
3226  table->setHorizontalHeaderItem(2, new QTableWidgetItem("Error"));
3227  table->setHorizontalHeaderItem(3, new QTableWidgetItem("Epsilon"));
3228  table->setHorizontalHeaderItem(4, new QTableWidgetItem("Min"));
3229  table->setHorizontalHeaderItem(5, new QTableWidgetItem("Max"));
3230 
3231  table->setRowCount(TableList->GetLast()+1);
3232 
3233  for(Int_t n=0;n<=TableList->GetLast();n++) {
3234  TGo4FitParameter* par = dynamic_cast<TGo4FitParameter*> (TableList->At(n));
3235  if (par==0) continue;
3236 
3237  if (model) table->setVerticalHeaderItem(n, new QTableWidgetItem(par->GetName()));
3238  else table->setVerticalHeaderItem(n, new QTableWidgetItem(par->GetFullName()));
3239 
3240  QTableWidgetItem* checkitem = new QTableWidgetItem("fix");
3241  checkitem->setCheckState(par->GetFixed() ? Qt::Checked : Qt::Unchecked);
3242  table->setItem(n, 0, checkitem);
3243 
3244  QTableWidgetItem* item = new QTableWidgetItem(QString::number(par->GetValue()));
3245  if (par->GetFixed())
3246  item->setFlags(item->flags() & ~Qt::ItemIsEnabled);
3247  table->setItem(n, 1, item);
3248 
3249  table->setItem(n, 2, new QTableWidgetItem(QString::number(par->GetError())));
3250 
3251  Double_t eps, min, max;
3252  if (par->GetEpsilon(eps)) table->setItem(n, 3, new QTableWidgetItem(QString::number(eps)));
3253  else table->setItem(n, 3, new QTableWidgetItem(""));
3254 
3255  if (par->GetRange(min,max)) {
3256  table->setItem(n, 4, new QTableWidgetItem(QString::number(min)));
3257  table->setItem(n, 5, new QTableWidgetItem(QString::number(max)));
3258  } else {
3259  table->setItem(n, 4, new QTableWidgetItem(""));
3260  table->setItem(n, 5, new QTableWidgetItem(""));
3261  }
3262  }
3263  }
3264  table->resizeColumnsToContents();
3265  table->resizeRowsToContents();
3266 
3267  // table->verticalHeader()->adjustHeaderSize();
3268  // table->horizontalHeader()->adjustHeaderSize();
3269 }
3270 
3271 void TGo4FitPanel::ParsTableChanged(QTableWidget* table, int nrow, int ncol, bool LinesView, TObjArray* TableList, bool updatepaint)
3272 {
3273  if (fbFillingWidget || (table==0) || (TableList==0)) return;
3274 
3275  if ((nrow<0) || (nrow>TableList->GetLast())) return;
3276 
3277  if (LinesView) {
3278  TGo4FitModel* model = dynamic_cast<TGo4FitModel*> (TableList->At(nrow));
3279  if (model==0) return;
3280 
3281  bool recalculatew = (model->InheritsFrom(TGo4FitModelGauss1::Class()) ||
3282  model->InheritsFrom(TGo4FitModelGauss2::Class()) ||
3283  model->InheritsFrom(TGo4FitModelGaussN::Class())) &&
3285  double widthk = recalculatew ? 2.3548 : 1.0;
3286 
3287  bool ok = false;
3288  double zn = table->item(nrow, ncol)->text().toDouble(&ok);
3289  if (!ok) return;
3290 
3291  if (ncol==0) model->SetAmplValue(zn); else {
3292  int nfcol = (fiIntegralMode>0) ? 2 : 1;
3293  int naxis = (ncol-nfcol) /2;
3294  if ((ncol-nfcol) % 2 == 0) model->SetPosition(naxis, zn);
3295  else model->SetWidth(naxis, zn/widthk);
3296  }
3297 
3298  } else {
3299 
3300  TGo4FitParameter* par = dynamic_cast<TGo4FitParameter*> (TableList->At(nrow));
3301  if (par==0) return;
3302 
3303  switch (ncol) {
3304  case 0: {
3305  if (table->item(nrow,0)->checkState()==Qt::Checked) par->SetFixed(kTRUE); else
3306  if (table->item(nrow,0)->checkState()==Qt::Unchecked) par->SetFixed(kFALSE);
3307  if (par->GetFixed())
3308  table->item(nrow,1)->setFlags(table->item(nrow,1)->flags() & ~Qt::ItemIsEnabled);
3309  else
3310  table->item(nrow,1)->setFlags(table->item(nrow,1)->flags() | Qt::ItemIsEnabled);
3311  break;
3312  }
3313  case 1: {
3314  if (par->GetFixed()) break;
3315  bool ok = false;
3316  double zn = table->item(nrow,1)->text().toDouble(&ok);
3317  if (ok) {
3318  par->SetValue(zn);
3319  if (updatepaint) UpdateWizPaint(2);
3320  }
3321  break;
3322  }
3323  case 2: {
3324  if (par->GetFixed()) break;
3325  bool ok = false;
3326  double zn = table->item(nrow,2)->text().toDouble(&ok);
3327  if (ok) par->SetError(zn);
3328  break; }
3329  case 3: {
3330  bool ok = false;
3331  double zn = table->item(nrow,3)->text().toDouble(&ok);
3332  if (ok) par->SetEpsilon(zn);
3333  break; }
3334  case 4:
3335  case 5: {
3336  std::cout << "Changing col " << ncol << std::endl;
3337 
3338  bool ok = false;
3339  bool range_changed = false;
3340  double zn = table->item(nrow, ncol)->text().toDouble(&ok);
3341  if(ok) {
3342 
3343  bool changemin = false;
3344  bool changemax = false;
3345 
3346  Double_t min, max;
3347  if (!par->GetRange(min,max)) {
3348  double vvv = par->GetValue();
3349  if (ncol==4) {
3350  min = zn;
3351  if (min<vvv) max = 2*vvv - min;
3352  else max = min;
3353  changemax = true;
3354  } else {
3355  max = zn;
3356  if (max>vvv) min = 2*vvv - max;
3357  else min = max;
3358  changemin = true;
3359  }
3360  } else
3361  if (ncol==4) {
3362  min = zn;
3363  if (max<min) { max = min; changemax = true; }
3364  } else
3365  if (ncol==5) {
3366  max = zn;
3367  if (min>max) { min = max; changemin = true; }
3368  }
3369  par->SetRange(min,max);
3370  range_changed = true;
3371  fbFillingWidget = true;
3372  if (changemin)
3373  table->item(nrow, 4)->setText(QString::number(min));
3374  if (changemax)
3375  table->item(nrow, 5)->setText(QString::number(max));
3376  fbFillingWidget = false;
3377  } else {
3378  if ((table->item(nrow, ncol)->text().length()==0) &&
3379  (table->item(nrow, 9-ncol)->text().length()==0)) {
3380  par->ClearRange();
3381  range_changed = true;
3382  }
3383  }
3384 
3385  // reset first columns of pars list when we touch range values
3386  if (range_changed) {
3387  fbFillingWidget = true;
3388  table->item(nrow,0)->
3389  setCheckState(par->GetFixed() ? Qt::Checked : Qt::Unchecked);
3390  if (par->GetFixed())
3391  table->item(nrow,1)->setFlags(table->item(nrow,1)->flags() & ~Qt::ItemIsEnabled);
3392  else
3393  table->item(nrow,1)->setFlags(table->item(nrow,1)->flags() | Qt::ItemIsEnabled);
3394  table->item(nrow,1)->setText(QString::number(par->GetValue()));
3395  fbFillingWidget = false;
3396  }
3397 
3398  break; }
3399  }
3400  }
3401 }
3402 
3403 
3405 {
3406  if (fbFillingWidget) return;
3407  TGo4FitModel* model = Wiz_SelectedModel();
3408  if (model) model->SetUseBuffers(zn);
3409 }
3410 
3411 
3413 {
3414  if (fbFillingWidget) return;
3415 
3416  if (Wiz_SelectedData()==0) return;
3417  fiWizPageIndex = 3;
3419  UpdateWizPaint(1);
3420 }
3421 
3422 
3424 {
3425  if (fbFillingWidget) return;
3426 
3427  TGo4FitPeakFinder* finder = GetPeakFinder(true);
3428  if (finder!=0) finder->SetUsePolynom(zn);
3429 
3430  Wiz_PFPolynSpin->setEnabled(zn);
3431 }
3432 
3434 {
3435  if (fbFillingWidget) return;
3436 
3437  TGo4FitPeakFinder* finder = GetPeakFinder(true);
3438  if (finder!=0) finder->SetPolynomOrder(zn);
3439 }
3440 
3441 
3443 {
3444  Button_SimpleFit(0);
3445 }
3446 
3448 {
3449  Button_SimpleFit(1);
3450 }
3451 
3453 {
3454  Button_SimpleFit(2);
3455 }
3456 
3458 {
3459  Button_SimpleFit(3);
3460 }
3461 
3463 {
3465 }
3466 
3468 {
3469  if (fbFillingWidget) return;
3470 
3471  fiWizPageIndex = 0;
3473  UpdateWizPaint(0);
3474 }
3475 
3477 {
3478  if (fbFillingWidget) return;
3479 
3480  TGo4FitPeakFinder* finder = GetPeakFinder(true);
3481  if (finder)
3482  finder->SetPeakFinderType(FindersTab->currentIndex());
3483 }
3484 
3486 {
3487  if (fbFillingWidget) return;
3488 
3489  TGo4FitModel* model = Wiz_SelectedModel();
3490  if (model!=0)
3491  if (chk) model->SetBackgroundGroupIndex();
3492  else model->SetGroupIndex(-1);
3493 }
3494 
3496 {
3497  if (!fbFillingWidget)
3499 }
3500 
3502 {
3503  if (!fbFillingWidget)
3505 }
3506 
3508 {
3509  if (!fbFillingWidget)
3511 }
3512 
3514 {
3515  if (!fbFillingWidget)
3517 }
3518 
3519 TGo4Fitter* TGo4FitPanel::CreateFitterFor(TGo4ViewPanel* panel, TPad* pad, const char* name)
3520 {
3521  if ((panel==0) || (pad==0)) return 0;
3522 
3523  TGo4Fitter* fitter = new TGo4Fitter(name,"Fitter object");
3524 
3525  CreateDataFor(panel, pad, fitter);
3526 
3527  fitter->AddStandardActions();
3528 
3529  fitter->SetMemoryUsage(3);
3530 
3532 
3533  return fitter;
3534 }
3535 
3536 void TGo4FitPanel::CreateDataFor(TGo4ViewPanel* panel, TPad* pad, TGo4Fitter* fitter)
3537 {
3538  if ((fitter==0) || (panel==0) || (pad==0)) return;
3539 
3540  int npads = panel->GetNumberOfPads(pad);
3541 
3542  for (Int_t n=0;n<npads;n++) {
3543  TPad* subpad = panel->GetSubPad(pad, n, false);
3544  if (panel->IsPadHasSubPads(subpad)) continue;
3545  TObject* obj = panel->GetPadMainObject(subpad);
3546  if (obj==0) continue;
3547 
3548  TGo4FitData* data = 0;
3549 
3550  if (obj->InheritsFrom(TH1::Class()))
3551  data = new TGo4FitDataHistogram(fitter->FindNextName("Data",0,kFALSE));
3552  else
3553  if (obj->InheritsFrom(TGraph::Class()))
3554  data = new TGo4FitDataGraph(fitter->FindNextName("Data",0,kFALSE));
3555 
3556  if (data!=0)
3557  fitter->AddData(data);
3558  }
3559 }
3560 
3562 {
3563  int select = fiPanelMode;
3564  if (GetFitter()==0) select = FitGui::pm_None;
3565 
3566  if (fbParsWidgetShown && (select!=FitGui::pm_None)) select = 100;
3567 
3568  switch (select) {
3569  case FitGui::pm_None: break;
3570  case FitGui::pm_Simple: UpdateSimplePage(); break;
3571  case FitGui::pm_Wizard: UpdateWizardPage(); break;
3572  case FitGui::pm_Expert: UpdateExtendedPage(); break;
3573  case 100: {
3574  FillParsWidget();
3576  RemovePrimitives();
3577  UpdateWizPaint(-1);
3578  }
3579  break;
3580  }
3581  }
3582 
3583  ShowPanelPage(select);
3584  UpdateStatusBar(0);
3585  UpdateItemMenu();
3586 }
3587 
3589 {
3590  RemovePrimitives();
3591 
3592  PaintFitter(GetFitter(), 0, true);
3593 
3594  UpdateStatusBar(0);
3595 }
3596 
3598 {
3599  RemovePrimitives();
3600 
3601  TGo4Fitter* fitter = GetFitter();
3602  fbFillingWidget = true;
3603  if (fitter) Wiz_FitNameEdt->setText(QString(fitter->GetName()));
3604  else Wiz_FitNameEdt->setText(QString(""));
3605  fbFillingWidget = false;
3606 
3608 
3609  UpdateWizModelsList(false);
3610 
3612 
3613  UpdateWizPaint(-1);
3614 
3615  UpdateStatusBar(0);
3616 }
3617 
3619 {
3620  RemoveItemWidget();
3621 
3622  RemovePrimitives();
3623 
3624  fbFillingWidget = true;
3625  FitList->clear();
3626  FitList->setSortingEnabled(false);
3627  fbFillingWidget = false;
3628 
3629  TGo4Fitter* fitter = GetFitter();
3630  if (fitter==0) {
3631  new QFitItem(this, FitList->invisibleRootItem(), 0, FitGui::ot_empty, FitGui::wt_none, FitGui::mt_empty);
3632  } else {
3633  QFitItem* fitteritem = new QFitItem(this, FitList->invisibleRootItem(), fitter, FitGui::ot_fitter, FitGui::wt_fitter, FitGui::mt_fitter, FitGui::gt_fitter);
3634  fitteritem->setExpanded(true);
3635  FitList->setCurrentItem(fitteritem, QItemSelectionModel::Select);
3636  ShowItem(fitteritem, false);
3637  }
3638 
3639  UpdateItemMenu();
3640 
3641  UpdateStatusBar(0);
3642 }
3643 
3645 {
3646  if (!WorkingWithPanel()) return;
3647 
3648  TGo4Fitter* fitter = GetFitter();
3649  if (fitter==0) return;
3650 
3651  for(Int_t n = 0; n<fitter->NumSlots();n++) {
3652  TPad* pad = FindPadForSlot(fitter->GetSlot(n));
3653  if (pad==0) continue;
3656  }
3657 }
3658 
3659 
3660 bool TGo4FitPanel::FillPopupForItem(QFitItem* item, QMenu* menu, QSignalMapper* map)
3661 {
3662  if((item==0) || (menu==0)) return false;
3663 
3664  if(item->PopupMenuType() == FitGui::mt_empty) {
3665  AddIdAction(menu, map, "Create empty fitter", 8);
3666  if (WorkingWithPanel())
3667  AddIdAction(menu, map, "Create appropriate fitter", 9);
3668  }
3669 
3670  if(item->PopupMenuType() == FitGui::mt_fitter) {
3671  AddIdAction(menu, map,"Delete fitter", 1);
3672  AddIdAction(menu, map,"Clear fitter", 2);
3673  AddIdAction(menu, map,"Save fitter", 3);
3674  AddIdAction(menu, map,"Save fitter as ...", 4);
3675  AddIdAction(menu, map,"Print ...", 5);
3676  AddIdAction(menu, map,"Draw", 6);
3677  AddIdAction(menu, map,"Memorize parameters", 706);
3678  AddIdAction(menu, map,"Remember parameters", 707);
3679 
3680  }
3681 
3682  if(item->PopupMenuType() == FitGui::mt_data) {
3683  if (!WorkingWithPanel())
3684  AddIdAction(menu, map, QString("Remove ")+item->Object()->GetName(), 101);
3685  AddIdAction(menu, map, "Remove assosiated models", 102);
3686  AddIdAction(menu, map, "Draw", 105);
3687  AddIdAction(menu, map, "Print", 5);
3688  }
3689 
3690  if(item->PopupMenuType() == FitGui::mt_datalist)
3691  if (WorkingWithPanel()) {
3692  AddIdAction(menu, map, "Rebuild data list", 108);
3693  } else {
3694  AddIdAction(menu, map, "Delete all data", 107);
3695  FillDataTypesList(menu, map, 110);
3696  }
3697 
3698  if(item->PopupMenuType() == FitGui::mt_model) {
3699  AddIdAction(menu, map, QString("Remove ")+item->Object()->GetName(), 201);
3700  AddIdAction(menu, map, "Clone", 203);
3701  AddIdAction(menu, map, "Print", 5);
3702  }
3703 
3704  if(item->PopupMenuType() == FitGui::mt_modellist) {
3705  AddIdAction(menu, map, "Delete all models", 202);
3706  FillModelTypesList(menu, map, 210, true);
3707  }
3708 
3709  if(item->PopupMenuType() == FitGui::mt_asslist) {
3710  TGo4Fitter* fitter = GetFitter();
3711  TGo4FitModel* model = dynamic_cast<TGo4FitModel*> (item->Object());
3712  if (fitter && model) {
3713  AddIdAction(menu, map, "Clear all assignments", 301);
3714  AddIdAction(menu, map, "Assign to all data", 302);
3715  menu->addSeparator();
3716  for(Int_t n=0; n<fitter->GetNumData();n++)
3717  if(!model->IsAssignTo(fitter->GetDataName(n)))
3718  AddIdAction(menu, map, QString("Assign to: ") + fitter->GetDataName(n), 310+n);
3719  }
3720  }
3721 
3722  if(item->PopupMenuType() == FitGui::mt_ass)
3723  AddIdAction(menu, map, QString("Clear assignment to ") + item->text(0), 303);
3724 
3725  if(item->PopupMenuType() == FitGui::mt_range)
3726  AddIdAction(menu, map, "Remove range condition", 401);
3727 
3728  if(item->PopupMenuType() == FitGui::mt_rangecut)
3729  AddIdAction(menu, map, "Remove range condition", 401);
3730 
3731  if(item->PopupMenuType() == FitGui::mt_rangelist) {
3732  TGo4FitComponent* comp = dynamic_cast<TGo4FitComponent*> (item->Object());
3733  if(comp) {
3734  if (comp->IsAnyRangeLimits()>0) {
3735  AddIdAction(menu, map, "Clear all ranges", 402);
3736  menu->addSeparator();
3737  }
3738  AddIdAction(menu, map, "Include new range", 403);
3739  AddIdAction(menu, map, "Exclude new range", 404);
3740  AddIdAction(menu, map, "Add left bound", 405);
3741  AddIdAction(menu, map, "Add right bound", 406);
3742  menu->addSeparator();
3743  AddIdAction(menu, map, "Add range cut", 407);
3744  }
3745  }
3746 
3747  if(item->PopupMenuType() == FitGui::mt_action) {
3748  AddIdAction(menu, map,"Delete action", 501);
3749  AddIdAction(menu, map,"Move action up", 502);
3750  AddIdAction(menu, map,"Move action down", 503);
3751  AddIdAction(menu, map,"Print", 5);
3752  AddIdAction(menu, map,"Execute", 508);
3753  }
3754 
3755  if(item->PopupMenuType() == FitGui::mt_actlist) {
3756  TGo4Fitter* fitter = dynamic_cast<TGo4Fitter*> (item->Object());
3757  if(fitter) {
3758  if (fitter->GetNumActions()>0) {
3759  AddIdAction(menu, map,"Execute norm actions", 504);
3760  AddIdAction(menu, map,"Execute all actions", 507);
3761  AddIdAction(menu, map,"Delete all actions", 505);
3762  AddIdAction(menu, map,"Delete output actions", 506);
3763  menu->addSeparator();
3764  }
3765  AddIdAction(menu, map,"Add config", 510);
3766  AddIdAction(menu, map,"Add peak finder", 514);
3767  AddIdAction(menu, map,"Add amplitude estimation", 511);
3768  AddIdAction(menu, map,"Add minuit", 512);
3769  AddIdAction(menu, map,"Add output", 513);
3770  }
3771  }
3772 
3773  if(item->PopupMenuType() == FitGui::mt_depend)
3774  AddIdAction(menu, map, "Delete item", 601);
3775 
3776  if(item->PopupMenuType() == FitGui::mt_deplist) {
3777  AddIdAction(menu, map, "Delete all items", 602);
3778  AddIdAction(menu, map, "Insert new item", 603);
3779  }
3780 
3781  if(item->PopupMenuType() == FitGui::mt_newpars) {
3782  AddIdAction(menu, map, "Delete all items", 701);
3783  AddIdAction(menu, map, "Insert new item", 702);
3784  }
3785 
3786  if(item->PopupMenuType() == FitGui::mt_parcfg)
3787  AddIdAction(menu, map, "Delete item", 703);
3788 
3789  if(item->PopupMenuType() == FitGui::mt_par) {
3790  AddIdAction(menu, map, "Memorize value", 704);
3791  AddIdAction(menu, map, "Restore value", 705);
3792  }
3793 
3794  if((item->PopupMenuType() == FitGui::mt_parslist)) {
3795  AddIdAction(menu, map, "Memorize parameters", 706);
3796  AddIdAction(menu, map, "Remember parameters", 707);
3797  }
3798 
3799  if(item->PopupMenuType() == FitGui::mt_minuitres) {
3800  AddIdAction(menu, map,"Delete result entry", 801);
3801  AddIdAction(menu, map,"Print", 5);
3802  }
3803 
3804  if(item->PopupMenuType() == FitGui::mt_slot) {
3805  TGo4FitSlot* slot = dynamic_cast<TGo4FitSlot*> (item->Object());
3806  if (slot!=0) FillPopupForSlot(slot, menu, map);
3807  }
3808 
3809  if(item->PopupMenuType() == FitGui::mt_allslots) {
3810  TGo4Fitter* fitter = dynamic_cast<TGo4Fitter*> (item->Object());
3811  if(fitter)
3812  AddIdAction(menu, map, "Update slots from sources", 904);
3813  }
3814 
3815  return ! menu->isEmpty();
3816 }
3817 
3818 bool TGo4FitPanel::FillPopupForSlot(TGo4FitSlot* slot, QMenu* menu, QSignalMapper* map)
3819 {
3820  if ((slot==0) || (menu==0)) return false;
3821 
3822  if(!slot->GetOwned() && slot->IsObject())
3823  AddIdAction(menu, map, "Clone object in slot", 1000);
3824 
3825  if(slot->IsObject())
3826  AddIdAction(menu, map, "Clear object in slot", 1001);
3827 
3828  if (FindPadForSlot(slot)!=0)
3829  AddIdAction(menu, map, QString("Update from ") + Wiz_GetSlotSourceInfo(slot), 1002);
3830 
3831  if (!menu->isEmpty()) menu->addSeparator();
3832 
3833  if (slot->GetConnectedSlot())
3834  AddIdAction(menu, map, "Brake connection to slot", 1004);
3835  TGo4Fitter* fitter = GetFitter();
3836  if (fitter)
3837  for(Int_t n=0;n<fitter->NumSlots();n++) {
3838  TGo4FitSlot* sl = fitter->GetSlot(n);
3839  if (slot->CanConnectToSlot(sl) && (slot->GetConnectedSlot()!=sl))
3840  AddIdAction(menu, map, QString("Connect to ") + sl->GetFullName(), 1400 + n);
3841  }
3842 
3843  if (!menu->isEmpty()) menu->addSeparator();
3844 
3845  if (slot->GetClass() == TGo4FitData::Class()) FillDataTypesList(menu, map, 1100); else
3846  if (slot->GetClass() == TGo4FitModel::Class()) FillModelTypesList(menu, map, 1200, false); else
3847  if (slot->GetClass() == TGo4FitAxisTrans::Class()) {
3848  AddIdAction(menu, map, TGo4FitLinearTrans::Class()->GetName(), 1300);
3849  AddIdAction(menu, map, TGo4FitMatrixTrans::Class()->GetName(), 1301);
3850  }
3851 
3852  return ! menu->isEmpty();
3853 }
3854 
3856 {
3857  if (item!=0) slot = dynamic_cast<TGo4FitSlot*> (item->Object());
3858 
3859  TGo4Fitter* fitter = GetFitter();
3860  if ((slot==0) || (fitter==0)) return;
3861 
3862  switch (id) {
3863  case 1000: {
3864  TObject* newobj = slot->CloneObject();
3865  slot->SetObject(newobj, kTRUE);
3866  break;
3867  }
3868 
3869  case 1001: {
3870 
3871  if(fbNeedConfirmation)
3872  if ( QMessageBox::information(0,
3873  QString("Clear slot"),
3874  QString("Are you sure to clear object from slot ") + slot->GetName(),
3875  QMessageBox::Yes, QMessageBox::No) == QMessageBox::No ) return;
3876 
3877  fitter->ClearSlot(slot, kFALSE);
3878 
3879  if (item)
3880  for(Int_t i=0;i<fitter->NumSlots();i++) {
3881  QFitItem* sitem = FindItem(fitter->GetSlot(i), FitGui::ot_slot, 0);
3882  if (sitem) UpdateItem(sitem, true);
3883  }
3884 
3885  break; }
3886 
3887  case 1002: {
3888  UpdateObjectReferenceInSlot(slot, false);
3889  break;
3890  }
3891 
3892  case 1004: {
3893  slot->ClearConnectionToSlot();
3894  break;
3895  }
3896 
3897  default: {
3898  TObject* obj = 0;
3899  if ((id>=1100) && (id<1200)) obj = CreateData(id-1100,"Data"); else
3900  if ((id>=1200) && (id<1300)) obj = CreateModel(id-1200, "Model", 0, 0); else
3901  if (id==1300) obj = new TGo4FitLinearTrans("Trans","Linear axis transformation"); else
3902  if (id==1301) obj = new TGo4FitMatrixTrans("Trans","Matrix axis transformation"); else
3903  if (id>=1400) {
3904  TGo4FitSlot* sl = fitter->GetSlot(id-1400);
3905  slot->ConnectToSlot(sl);
3906  break;
3907  }
3908  if (obj) slot->SetObject(obj, kTRUE);
3909  }
3910  }
3911 
3912  if (item) {
3913  ShowItem(item, false);
3914  UpdateItem(item, true);
3915  item->setExpanded(true);
3916  } else
3917  UpdateActivePage();
3918 }
3919 
3920 void TGo4FitPanel::UpdateItem(QFitItem* item, bool trace)
3921 {
3922  if (item==0) return;
3923 
3924  if (fxCurrentItem!=0)
3926 
3927  while (item->childCount() > 0)
3928  delete item->child(0);
3929 
3930  SetItemText(item, false);
3931 
3932  switch (item->ObjectType()) {
3933  case FitGui::ot_empty: break;
3934  case FitGui::ot_datalist: {
3935  TGo4Fitter* fitter = dynamic_cast<TGo4Fitter*> (item->Object());
3936  if(fitter)
3937  for(Int_t n=fitter->GetNumData()-1;n>=0;n--)
3939  break; }
3940  case FitGui::ot_data: {
3941  TGo4FitData* data = dynamic_cast<TGo4FitData*> (item->Object());
3942  if (data==0) break;
3943 
3944  FillSlotsList(item, data->GetSlotList(), data);
3945 
3947 
3949 
3950  break; }
3951  case FitGui::ot_modellist: {
3952  TGo4Fitter* fitter = dynamic_cast<TGo4Fitter*> (item->Object());
3953  if(fitter)
3954  for(Int_t n=fitter->GetNumModel()-1;n>=0;n--)
3955  new QFitItem(this, item, fitter->GetModel(n), FitGui::ot_model, DefineModelWidgetType(fitter->GetModel(n)), FitGui::mt_model, FitGui::gt_model, n);
3956  break; }
3957  case FitGui::ot_model: {
3958  TGo4FitModel* model = dynamic_cast<TGo4FitModel*> (item->Object());
3959  if (model==0) break;
3960 
3961  FillSlotsList(item, model->GetSlotList(), model);
3962 
3964 
3965  new QFitItem(this, item, model, FitGui::ot_rangelist, FitGui::wt_none, FitGui::mt_rangelist, FitGui::gt_ranges);
3966 
3967  new QFitItem(this, item, model, FitGui::ot_asslist, FitGui::wt_none, FitGui::mt_asslist, FitGui::gt_none);
3968 
3969  break; }
3970  case FitGui::ot_parslist: FillParsList(item); break;
3971  case FitGui::ot_par: break;
3972  case FitGui::ot_parcfg: break;
3973  case FitGui::ot_asslist: {
3974  TGo4FitModel* model = dynamic_cast<TGo4FitModel*> (item->Object());
3975  if (model)
3976  for (Int_t n = model->NumAssigments()-1; n>=0; n--)
3978  break; }
3979  case FitGui::ot_ass: break;
3980  case FitGui::ot_rangelist: {
3981  TGo4FitComponent* comp = dynamic_cast<TGo4FitComponent*> (item->Object());
3982  if (comp) {
3983  for (Int_t n = comp->GetNumRangeCut()-1; n>=0; n--)
3985  for (Int_t n = comp->GetNumRangeCondition()-1; n>=0; n--)
3987  }
3988  break; }
3989  case FitGui::ot_range: break;
3990  case FitGui::ot_rangecut: break;
3991  case FitGui::ot_actlist: {
3992  TGo4Fitter* fitter = dynamic_cast<TGo4Fitter*> (item->Object());
3993  if (fitter==0) break;
3994  for (Int_t n = fitter->GetNumActions()-1; n>=0; n--) {
3995  TGo4FitterAction* action = fitter->GetAction(n);
3996  int ot = FitGui::ot_action, wt = FitGui::wt_named;
3997  if (action->InheritsFrom(TGo4FitterConfig::Class())) ot = FitGui::ot_config; else
3998  if (action->InheritsFrom(TGo4FitAmplEstimation::Class())) { ot = FitGui::ot_amplest; wt = FitGui::wt_amplest; } else
3999  if (action->InheritsFrom(TGo4FitPeakFinder::Class())) { ot = FitGui::ot_peakfinder; wt = FitGui::wt_peakfinder; } else
4000  if (action->InheritsFrom(TGo4FitterOutput::Class())) { ot = FitGui::ot_output; wt = FitGui::wt_output; } else
4001  if (action->InheritsFrom(TGo4FitMinuit::Class())) { ot = FitGui::ot_minuit; wt = FitGui::wt_minuit; }
4002 
4003  new QFitItem(this, item, action, ot, wt, FitGui::mt_action);
4004  }
4005  break;
4006  }
4007  case FitGui::ot_action: break;
4008  case FitGui::ot_amplest: break;
4009  case FitGui::ot_peakfinder: break;
4010  case FitGui::ot_output: break;
4011  case FitGui::ot_config: {
4012  TGo4FitterConfig* cfg = dynamic_cast<TGo4FitterConfig*> (item->Object());
4013  if (cfg==0) break;
4019  break; }
4020  case FitGui::ot_minuit: {
4021  TGo4FitMinuit* minuit = dynamic_cast<TGo4FitMinuit*> (item->Object());
4022  if (minuit==0) break;
4023  for (Int_t n=minuit->GetNumResults()-1;n>=0;n--)
4025  break; }
4026  case FitGui::ot_parinitlist: FillDependencyList(item); break;
4027  case FitGui::ot_pardeplist: FillDependencyList(item); break;
4028  case FitGui::ot_reslist: FillDependencyList(item); break;
4029  case FitGui::ot_depend: break;
4030  case FitGui::ot_newpars: FillParsList(item); break;
4031  case FitGui::ot_parscfg: {
4032  TGo4FitParsList* pars = dynamic_cast<TGo4FitParsList*> (item->Object());
4033  if (pars==0) return;
4034  for (Int_t n = pars->NumPars()-1; n>=0;n--)
4036  break; }
4037  case FitGui::ot_minuitres: break;
4038  case FitGui::ot_slot: {
4039  TGo4FitSlot* slot = dynamic_cast<TGo4FitSlot*> (item->Object());
4040  if(slot==0) break;
4041 
4042  TObject* obj = slot->GetObject();
4043  if (obj==0) break;
4044 
4045  if (obj->InheritsFrom(TGo4FitData::Class()))
4046  new QFitItem(this, item, obj, FitGui::ot_data, FitGui::wt_data, FitGui::mt_none);
4047  else
4048 
4049  if (obj->InheritsFrom(TGo4FitModel::Class()))
4050  new QFitItem(this, item, obj, FitGui::ot_model, DefineModelWidgetType(obj), FitGui::mt_none);
4051  else
4052 
4053  if (obj->InheritsFrom(TGo4FitLinearTrans::Class()))
4055  else
4056 
4057  if (obj->InheritsFrom(TGo4FitMatrixTrans::Class()))
4059  else
4060 
4061  if (obj->InheritsFrom(TGo4FitAxisTrans::Class()))
4063  else
4064 
4065  new QFitItem(this, item, obj, FitGui::ot_none, FitGui::wt_none, FitGui::mt_none);
4066 
4067  break; }
4068  case FitGui::ot_fitter: {
4069  TGo4Fitter* fitter = dynamic_cast<TGo4Fitter*> (item->Object());
4070  if (fitter==0) break;
4071 
4072  new QFitItem(this, item, fitter, FitGui::ot_results, FitGui::wt_table);
4077  break; }
4078  case FitGui::ot_trans: FillParsList(item); break;
4079  case FitGui::ot_lintrans: FillParsList(item); break;
4080  case FitGui::ot_matrtrans: FillParsList(item); break;
4081  case FitGui::ot_results: break;
4082  case FitGui::ot_allslots: {
4083  TGo4Fitter* fitter = dynamic_cast<TGo4Fitter*> (item->Object());
4084  if (fitter)
4085  FillSlotsList(item, fitter->GetSlotList(), 0);
4086  break; }
4087  }
4088 
4089  if (trace && (item->Object()!=0)) {
4090  QFitItem* topitem = GetFitterItem();
4091  if (topitem==0) return;
4092 
4093 
4094  QTreeWidgetItemIterator iter(topitem);
4095 
4096  while (*iter) {
4097  QFitItem* it = dynamic_cast<QFitItem*> (*iter);
4098  if ((it!=0) && (it!=item) &&
4099  (item->ObjectType()==it->ObjectType()) &&
4100  (item->Object()==it->Object())) UpdateItem(it, false);
4101  ++iter;
4102  }
4103  }
4104 }
4105 
4106 void TGo4FitPanel::SetItemText(QFitItem* item, bool trace)
4107 {
4108  if (item==0) return;
4109  QString text;
4110  if (item->Object()) text = item->Object()->GetName();
4111  switch (item->ObjectType()) {
4112  case FitGui::ot_empty: text = "empty"; break;
4113  case FitGui::ot_datalist: text = "Data"; break;
4114  case FitGui::ot_data: break;
4115  case FitGui::ot_modellist: text = "Models"; break;
4116  case FitGui::ot_model: break;
4117  case FitGui::ot_parslist: text = "Parameters"; break;
4118  case FitGui::ot_par:
4119  case FitGui::ot_parcfg: {
4120  TGo4FitParameter* par = dynamic_cast<TGo4FitParameter*> (item->Object());
4121  if (par) text += " = " + QString::number(par->GetValue());
4122  break; }
4123  case FitGui::ot_asslist: text = "Assigments"; break;
4124  case FitGui::ot_ass: {
4125  TGo4FitModel* model = dynamic_cast<TGo4FitModel*> (item->Object());
4126  if (model) text = model->AssignmentName(item->Tag());
4127  break; }
4128  case FitGui::ot_rangelist: text = "Ranges"; break;
4129  case FitGui::ot_range: {
4130  TGo4FitComponent* comp = dynamic_cast<TGo4FitComponent*> (item->Object());
4131  if ((comp==0) || (item->Tag()<0) || (item->Tag()>=comp->GetNumRangeCondition())) break;
4132 
4133  Int_t typ, naxis;
4134  Double_t left, right;
4135  comp->GetRangeCondition(item->Tag(), typ, naxis, left, right);
4136  text = QString::number(naxis) + ": ";
4137 
4138  switch(typ) {
4139  case 0: text+="[" + QString::number(left) + "..." + QString::number(right) + "]"; break;
4140  case 1: text+="... " + QString::number(left) + "] [" + QString::number(right) + " ..."; break;
4141  case 2: text+="[" + QString::number(left) + " ..."; break;
4142  case 3: text+="... " + QString::number(right) + "]"; break;
4143  }
4144  break; }
4145  case FitGui::ot_rangecut: break;
4146  case FitGui::ot_actlist: text = "Actions"; break;
4147  case FitGui::ot_action: break;
4148  case FitGui::ot_amplest: break;
4149  case FitGui::ot_peakfinder: break;
4150  case FitGui::ot_output: break;
4151  case FitGui::ot_config: break;
4152  case FitGui::ot_minuit: break;
4153  case FitGui::ot_parinitlist: text = "Initialization"; break;
4154  case FitGui::ot_pardeplist: text = "Dependency"; break;
4155  case FitGui::ot_reslist: text = "Results"; break;
4156  case FitGui::ot_depend: {
4157  TGo4FitDependency* depen = dynamic_cast<TGo4FitDependency*> (item->Object());
4158  if (depen==0) break;
4159  if (depen->IsResultDepend()) text = "Res" + QString::number(item->Tag());
4160  else text = depen->GetParameter().Data();
4161  text += " = ";
4162  if (depen->IsInitValue()) text += QString::number(depen->GetInitValue());
4163  else text += depen->GetExpression().Data();
4164  break; }
4165  case FitGui::ot_newpars: text = "New pars"; break;
4166  case FitGui::ot_parscfg: text = "Pars setup"; break;
4167  case FitGui::ot_minuitres: break;
4168  case FitGui::ot_slot: break;
4169  case FitGui::ot_fitter: break;
4170  case FitGui::ot_trans: break;
4171  case FitGui::ot_lintrans: break;
4172  case FitGui::ot_matrtrans: break;
4173  case FitGui::ot_results: text = "Results"; break;
4174  case FitGui::ot_allslots: text = "Objects"; break;
4175  }
4176 
4177  item->setText(0, text);
4178 
4179  if (trace && (item->Object()!=0)) {
4180  QFitItem* topitem = GetFitterItem();
4181  if (topitem==0) return;
4182 
4183  QTreeWidgetItemIterator iter(topitem);
4184 
4185  while (*iter) {
4186  QFitItem* it = dynamic_cast<QFitItem*> (*iter);
4187  if ((it!=0) && (it!=item) &&
4188  (item->ObjectType()==it->ObjectType()) &&
4189  (item->Object()==it->Object()) && (item->Tag()==it->Tag()))
4190  it->setText(0, text);
4191  ++iter;
4192  }
4193  }
4194 }
4195 
4197 {
4198  if (parent==0) parent = GetFitterItem();
4199 
4200  if (parent==0) {
4201  std::cout << "Did not found " << std::endl;
4202  return;
4203  }
4204 
4205  QTreeWidgetItemIterator iter(parent);
4206 
4207  while (*iter) {
4208  QFitItem* item = dynamic_cast<QFitItem*> (*iter);
4209  if ((item!=0) && (item->ObjectType()==typ)) UpdateItem(item, false);
4210  ++iter;
4211  }
4212 }
4213 
4215 {
4216  QFitItem* item = dynamic_cast<QFitItem*> (FitList->topLevelItem(0));
4217  if (item && (item->ObjectType()==FitGui::ot_fitter)) return item;
4218  return 0;
4219 }
4220 
4221 QFitItem* TGo4FitPanel::FindItem(TObject* obj, int ObjectType, QFitItem* parent)
4222 {
4223  if (parent==0) parent = GetFitterItem();
4224 
4225  QTreeWidgetItemIterator iter(parent);
4226 
4227  while (*iter) {
4228  QFitItem* item = dynamic_cast<QFitItem*> (*iter);
4229  if (item!=0)
4230  if ((obj==0) || (item->Object()==obj))
4231  if ((ObjectType==FitGui::ot_none) || (ObjectType==item->ObjectType())) return item;
4232  ++iter;
4233  }
4234  return 0;
4235 }
4236 
4237 bool TGo4FitPanel::ShowItem(QFitItem* item, bool force)
4238 {
4239  if (force) RemoveItemWidget();
4240 
4241  bool gr = false;
4242 
4243  RemovePrimitives();
4244  if (fbShowPrimitives)
4245  gr = ShowItemAsGraph(item, force);
4246 
4247  bool txt = ShowItemAsText(item, force);
4248 
4249  return (gr || txt);
4250 }
4251 
4253 {
4254 
4255  QFitItem* widgetitem = item->DefineWidgetItem();
4256 
4257  QFitWidget* oldwidget = dynamic_cast<QFitWidget*> (fxCurrentItemWidget);
4258  if ((oldwidget!=0) && (oldwidget->GetItem()==widgetitem)) {
4259  oldwidget->FillWidget();
4260  return true;
4261  }
4262 
4263  RemoveItemWidget();
4264 
4265  QFitWidget* widget = 0;
4266 
4267  if (widgetitem==0) return true;
4268 
4269  QWidget* owner = 0;
4270 
4271  switch(widgetitem->WidgetType()) {
4272  case FitGui::wt_par: widget = new QFitParWidget(owner,"Parameter"); break;
4273  case FitGui::wt_range : widget = new QFitRangeWidget(owner,"Range"); break;
4274  case FitGui::wt_rangecut : widget = new QFitRangeCutWidget(owner,"Range cut"); break;
4275  case FitGui::wt_data : widget = new QFitDataWidget(owner,"Data object"); break;
4276  case FitGui::wt_model : widget = new QFitModelWidget(owner,"Model"); break;
4277  case FitGui::wt_polynom : widget = new QFitModelPolynomWidget(owner,"Polynom"); break;
4278  case FitGui::wt_gauss1: widget = new QFitModelGauss1Widget(owner,"Gauss1"); break;
4279  case FitGui::wt_gauss2: widget = new QFitModelGauss2Widget(owner,"Gauss2"); break;
4280  case FitGui::wt_gaussn: widget = new QFitModelGaussNWidget(owner,"GaussN"); break;
4281  case FitGui::wt_formula: widget = new QFitModelFormulaWidget(owner,"Formula"); break;
4282  case FitGui::wt_function: widget = new QFitModelFunctionWidget(owner,"Function"); break;
4283  case FitGui::wt_amplest: widget = new QFitAmplEstimWidget(owner,"Amplitude estimation"); break;
4284  case FitGui::wt_peakfinder: widget = new QFitPeakFinderWidget(owner,"Peak finder"); break;
4285  case FitGui::wt_output: widget = new QFitOutputActionWidget(owner,"Fitter output"); break;
4286  case FitGui::wt_minuit: widget = new QFitMinuitWidget(owner,"Minuit"); break;
4287  case FitGui::wt_minuitres: widget = new QFitMinuitResWidget(owner,"Minuit result"); break;
4288  case FitGui::wt_depend: widget = new QFitDependencyWidget(owner,"Dependency"); break;
4289  case FitGui::wt_parcfg: widget = new QFitParCfgWidget(owner,"Parameter configuration"); break;
4290  case FitGui::wt_slot: widget = new QFitSlotWidget(owner,"Slot for external object"); break;
4291  case FitGui::wt_fitter: widget = new QFitterWidget(owner,"Fitter"); break;
4292  case FitGui::wt_named: widget = new QFitNamedWidget(owner,"Named object"); break;
4293  case FitGui::wt_table: widget = new QFitTableWidget(owner,"Table"); break;
4294  case FitGui::wt_lintrans: widget = new QFitLinearTransWidget(owner,"Simple transform"); break;
4295  case FitGui::wt_matrtrans: widget = new QFitMatrixTransWidget(owner,"Matrix transform"); break;
4296  }
4297 
4298  if (widget!=0) {
4299  fxCurrentItemWidget = widget;
4300  widget->SetItem(this, widgetitem);
4301  ListStack->addWidget(widget);
4302  ListStack->setCurrentWidget(widget);
4303  }
4304 
4305  return true;
4306 }
4307 
4309 {
4310  if (item==0) return false;
4311 
4312  QFitItem* gritem = item->DefineGraphItem();
4313 
4314  if (gritem==0) return false;
4315 
4316  TGo4Fitter* fitter = GetFitter();
4317  if (fitter==0) return false;
4318 
4319  if (gritem->GraphType()==FitGui::gt_fitter) {
4320  PaintFitter(fitter, gritem, false);
4321  return true;
4322  }
4323 
4324  if (gritem->GraphType()==FitGui::gt_data) {
4325  TGo4FitData* data = dynamic_cast<TGo4FitData*> (gritem->Object());
4326 
4327  if (data!=0)
4328  PaintModelsFor(fitter, data, gritem->Parent()->Parent(), false);
4329 
4330  return (data!=0);
4331  }
4332 
4333  if (gritem->GraphType()==FitGui::gt_model) {
4334  TGo4FitModel* model = dynamic_cast<TGo4FitModel*> (gritem->Object());
4335  if (model==0) return false;
4336  bool draw = false;
4337  for(Int_t n=0;n<model->NumAssigments();n++) {
4338  TGo4FitData* data = fitter->FindData(model->AssignmentName(n));
4339  if (PaintModel(model, FindPadWhereData(data), gritem)) draw = true;
4340  }
4341  return draw;
4342  }
4343 
4344  if (gritem->GraphType()==FitGui::gt_ass) {
4345  TGo4FitModel* model = dynamic_cast<TGo4FitModel*> (gritem->Parent()->Parent()->Object());
4346  if (model) {
4347  TGo4FitData* data = fitter->FindData(gritem->text(0).toLatin1().constData());
4348  if (PaintModel(model, FindPadWhereData(data), gritem->Parent()->Parent()))
4349  return true;
4350  }
4351  }
4352 
4353  if (gritem->GraphType()==FitGui::gt_range) {
4354  TGo4FitComponent* comp = dynamic_cast<TGo4FitComponent*> (gritem->Parent()->Object());
4355  if (comp==0) return false;
4356  int nrange = gritem->Tag();
4357  if (PaintRange(comp, nrange, FindPadWhereComp(comp), gritem)) return true;
4358  }
4359 
4360  if (gritem->GraphType()==FitGui::gt_ranges) {
4361  TGo4FitComponent* comp = dynamic_cast<TGo4FitComponent*> (gritem->Object());
4362  if (comp==0) return false;
4363 
4364  TPad* pad = FindPadWhereComp(comp);
4365  if (pad!=0) {
4366  for(int nrange=0;nrange<comp->GetNumRangeCondition();nrange++) {
4367  QFitItem* child = dynamic_cast<QFitItem*> (gritem->child(nrange));
4368  if (child==0) return false;
4369  PaintRange(comp, nrange, pad, child);
4370  }
4371  return true;
4372  }
4373  }
4374 
4375  return false;
4376 }
4377 
4379 {
4380  fxCurrentItem = 0;
4381  if (fxCurrentItemWidget) {
4382  ListStack->removeWidget(fxCurrentItemWidget);
4383  delete fxCurrentItemWidget;
4384  fxCurrentItemWidget = 0;
4385  }
4386 }
4387 
4389 {
4390  if ((item!=0) && (fxCurrentItem==item))
4391  RemoveItemWidget();
4392 }
4393 
4395 {
4396  if (item==0) return;
4397  TGo4FitParsList* pars = dynamic_cast<TGo4FitParsList*> (item->Object());
4398  if (pars==0) return;
4399  for (Int_t n = pars->NumPars()-1; n>=0;n--)
4400  new QFitItem(this, item, pars->GetPar(n), FitGui::ot_par, FitGui::wt_par, FitGui::mt_par);
4401 }
4402 
4403 void TGo4FitPanel::FillSlotsList(QFitItem* parent, const TObjArray* lst, TObject* owner)
4404 {
4405  if ((parent==0) || (lst==0)) return;
4406  for(Int_t n = lst->GetLast();n>=0;n--) {
4407  TGo4FitSlot* slot = dynamic_cast<TGo4FitSlot*> (lst->At(n));
4408  if (slot && ((slot->GetOwner()==owner) || (owner==0)))
4409  new QFitItem(this, parent, slot, FitGui::ot_slot, FitGui::wt_slot, FitGui::mt_slot);
4410  }
4411 }
4412 
4414 {
4415  if (parent==0) return;
4416 
4417  TObjArray* lst = dynamic_cast<TObjArray*> (parent->Object());
4418  if (lst)
4419  for(Int_t n=lst->GetLast();n>=0;n--)
4420  new QFitItem(this, parent, lst->At(n), FitGui::ot_depend, FitGui::wt_depend, FitGui::mt_depend, FitGui::gt_none, n);
4421 }
4422 
4423 void TGo4FitPanel::FillModelTypesList(QMenu* menu, QSignalMapper* map, int id, bool extend)
4424 {
4425  if (! menu->isEmpty()) menu->addSeparator();
4426  if (extend) {
4427  AddIdAction(menu, map,"Add gaussian", id+20);
4428  AddIdAction(menu, map,"Add lorenzian", id+24);
4429  AddIdAction(menu, map,"Add exponent", id+25);
4430  AddIdAction(menu, map,"Add 1-order polynom", id+21);
4431  AddIdAction(menu, map,"Add 3-order polynom", id+22);
4432  AddIdAction(menu, map,"Add 7-order polynom", id+23);
4433  menu->addSeparator();
4434  }
4435 
4436  AddIdAction(menu, map, QString("Make ") + TGo4FitModelPolynom::Class()->GetName(), id+0);
4437  AddIdAction(menu, map, QString("Make ") + TGo4FitModelGauss1::Class()->GetName(), id+1);
4438  AddIdAction(menu, map, QString("Make ") + TGo4FitModelGauss2::Class()->GetName(), id+2);
4439  AddIdAction(menu, map, QString("Make ") + TGo4FitModelGaussN::Class()->GetName(), id+3);
4440  AddIdAction(menu, map, QString("Make ") + TGo4FitModelFormula::Class()->GetName(), id+4);
4441  AddIdAction(menu, map, QString("Make ") + TGo4FitModelFunction::Class()->GetName(),id+5);
4442  AddIdAction(menu, map, QString("Make ") + TGo4FitModelFromData::Class()->GetName(),id+6);
4443 }
4444 
4445 void TGo4FitPanel::FillDataTypesList(QMenu* menu, QSignalMapper* map, int id)
4446 {
4447  if (!menu->isEmpty()) menu->addSeparator();
4448  AddIdAction(menu, map, QString("Make ") + TGo4FitDataHistogram::Class()->GetName(), id+0);
4449  AddIdAction(menu, map, QString("Make ") + TGo4FitDataGraph::Class()->GetName(), id+1);
4450  AddIdAction(menu, map, QString("Make ") + TGo4FitDataProfile::Class()->GetName(), id+2);
4451  AddIdAction(menu, map, QString("Make ") + TGo4FitDataRidge::Class()->GetName(), id+3);
4452 }
4453 
4454 void TGo4FitPanel::PaintFitter(TGo4Fitter* fitter, QFitItem* item, bool update)
4455 {
4456  if (fitter)
4457  for(Int_t nd=0;nd<fitter->GetNumData();nd++)
4458  PaintModelsFor(fitter, fitter->GetData(nd), item, update);
4459 }
4460 
4461 bool TGo4FitPanel::PaintModel(TGo4FitModel* model, TPad* pad, QFitItem* item)
4462 {
4463  if ((model==0) || (pad==0) || !fbShowPrimitives) return false;
4464 
4465  TH1* histo = ActivePanel()->GetPadHistogram(pad);
4466  if ((histo==0) || (histo->GetDimension()!=1)) return false;
4467 
4468  Double_t pos, width, ampl;
4469 
4470  if (model->GetPosition(0,pos)) {
4471 
4472  Int_t nbin = histo->GetXaxis()->FindBin(pos);
4473  ampl = histo->GetBinContent(nbin);
4474 
4475  Double_t limit = pad->GetUymin()*.7 + pad->GetUymax()*.3;
4476  if (ampl<limit) ampl = limit;
4477 
4478  TGo4FitGuiArrow* arr = new TGo4FitGuiArrow(0.01,">");
4479  arr->SetLineColor(2);
4480  arr->SetLineWidth(1);
4481  arr->SetItem(item, this);
4482 
4483  TGo4FitGuiArrow* warr = 0;
4484  if (model->GetWidth(0,width)) {
4485  warr = new TGo4FitGuiArrow(0.01,"<|>");
4486  warr->SetLineColor(2);
4487  warr->SetLineWidth(1);
4488  warr->SetForWidth(model, arr);
4489  warr->SetItem(item, this);
4490  }
4491 
4492  arr->SetForPosition(model, warr, ampl);
4493  arr->Locate();
4494 
4495  ActivePanel()->AddDrawObject(pad, TGo4ViewPanel::kind_FitArrows, "::Model_VArrow", arr, true, 0);
4496 
4497  if (warr) {
4498  warr->Locate();
4499  ActivePanel()->AddDrawObject(pad, TGo4ViewPanel::kind_FitArrows, "::Model_HArrow", warr, true, 0);
4500  }
4501 
4503  }
4504 
4505  return true;
4506 }
4507 
4508 bool TGo4FitPanel::PaintModelsFor(TGo4Fitter* fitter, TGo4FitData* data, QFitItem* item, bool update)
4509 {
4510  if ((fitter==0) || (data==0)) return false;
4511 
4512  if (data->IsAnyDataTransform()) return false;
4513 
4514  for (Int_t nm=0;nm<fitter->GetNumModel();nm++) {
4515  TGo4FitModel* model = fitter->GetModel(nm);
4516  if (model->IsAssignTo(data->GetName()))
4517  PaintModel(model, FindPadWhereData(data), item);
4518  }
4519 
4520  return true;
4521 }
4522 
4523 bool TGo4FitPanel::PaintRange(TGo4FitComponent* comp, int nrange, TPad* pad, QFitItem* item)
4524 {
4525  if ((comp==0) || (pad==0) || !fbShowPrimitives) return false;
4526 
4527  TH1* histo = ActivePanel()->GetPadHistogram(pad);
4528 
4529  if ((histo==0) || (histo->GetDimension()!=1)) return false;
4530 
4531  double range = 0.1 * (histo->GetXaxis()->GetXmax() - histo->GetXaxis()->GetXmin());
4532 
4533  double ampl = (0.07 + nrange*0.02) * (histo->GetMaximum() - histo->GetMinimum()) + histo->GetMinimum();
4534 
4535  double size = 0.015;
4536 
4537  Int_t typ, naxis;
4538  Double_t left, right;
4539 
4540  comp->GetRangeCondition(nrange, typ, naxis, left, right);
4541 
4542  if (naxis!=0) return false;
4543 
4544  TGo4FitGuiArrow* arr = 0;
4545 
4546  switch (typ) {
4547  case 0: arr = new TGo4FitGuiArrow(size,"<|>"); break;
4548  case 1: arr = new TGo4FitGuiArrow(size,"-><-"); break;
4549  case 2: arr = new TGo4FitGuiArrow(size,"<"); break;
4550  case 3: arr = new TGo4FitGuiArrow(size,">"); break;
4551  }
4552 
4553  if (arr!=0) {
4554  arr->SetLineColor(3);
4555  arr->SetLineWidth(3);
4556  arr->SetForRange(comp,nrange,ampl,range);
4557  arr->SetItem(item, this);
4558  arr->Locate();
4559 
4560  ActivePanel()->AddDrawObject(pad, TGo4ViewPanel::kind_FitArrows, "::Range_Arrow", arr, true, 0);
4561 
4563  }
4564  return arr!=0;
4565 }
4566 
4568 {
4569  TGo4Fitter* fitter = GetFitter();
4570  if (fitter==0) return 0;
4571  for (Int_t n=0;n<fitter->GetNumActions();n++) {
4572  TGo4FitPeakFinder* finder = dynamic_cast<TGo4FitPeakFinder*> (fitter->GetAction(n));
4573  if (finder!=0) return finder;
4574  }
4575 
4576  if (autocreate) {
4577  TGo4FitPeakFinder* finder = new TGo4FitPeakFinder("Finder", 0, kTRUE, 1);
4578  finder->SetPeakFinderType(2);
4579  fitter->AddActionAt(finder, 0);
4580  return finder;
4581  }
4582 
4583  return 0;
4584 }
4585 
4587 {
4588  TGo4Fitter* fitter = GetFitter();
4589  return (fitter==0) ? 0 : fitter->FindData(fxWizDataName.toLatin1().constData());
4590 }
4591 
4593 {
4594  TGo4Fitter* fitter = GetFitter();
4595  return (fitter==0) ? 0 : fitter->FindModel(fxWizModelName.toLatin1().constData());
4596 }
4597 
4598 
4600 {
4601  TGo4Fitter* fitter = GetFitter();
4602  if (fitter==0) return 0;
4603 
4604  TGo4FitData* data = Wiz_SelectedData();
4605  TGo4FitModel* model = CreateModel(id, 0, fitter, data);
4606 
4607  LocateModel(model, data, true);
4608 
4609  return model;
4610 }
4611 
4613 {
4614  TGo4Fitter* fitter = GetFitter();
4615  if (fitter==0) return 0;
4616 
4617  TGo4FitData* data = CreateData(id, 0);
4618  if (data==0) return 0;
4619 
4620  fitter->AddData(data);
4621 
4623 
4624  return data;
4625 }
4626 
4628 {
4629  TGo4Fitter* fitter = GetFitter();
4630  if (fitter==0) return;
4631  if ((fitter->GetNumData()>0) && fbNeedConfirmation)
4632  if ( QMessageBox::information(0,
4633  QString("Remake data list"),
4634  QString("Remove all current data?"),
4635  QMessageBox::Yes, QMessageBox::No) == QMessageBox::No ) return;
4636 
4637  fitter->DeleteAllData();
4638  CreateDataFor(ActivePanel(), ActivePad(), fitter);
4639 
4641  UpdateActivePage();
4642 }
4643 
4645 {
4646  TGo4Fitter* fitter = GetFitter();
4647  TGo4FitData* data = Wiz_SelectedData();
4648  if ((data==0) || (fitter==0)) return false;
4649 
4650  if(fbNeedConfirmation)
4651  if ( QMessageBox::information(0,
4652  QString("Delete data"),
4653  QString("Are you sure to delete ") + data->GetName(),
4654  QMessageBox::Yes, QMessageBox::No) == QMessageBox::No ) return false;
4655 
4656  fitter->RemoveData(data->GetName(), kTRUE);
4657 
4658  fxWizDataName = "";
4659 
4661 
4662  return true;
4663 }
4664 
4666 {
4667  if (!WorkingWithPanel()) return;
4668 
4669  TGo4FitData* data = Wiz_SelectedData();
4670  TPad* pad = FindPadWhereData(data);
4671  if ((pad==0) || (data==0)) return;
4672 
4673  double xmin, xmax;
4674  if (ActivePanel()->GetVisibleRange(pad, 0, xmin, xmax))
4675  data->SetRange(0, xmin, xmax);
4676 
4677  UpdateActivePage();
4678 }
4679 
4681 {
4682  TGo4Fitter* fitter = GetFitter();
4683  if ((fitter==0) || (ActivePanel()==0)) return;
4684 
4685  for (int n=0;n<fitter->GetNumData();n++) {
4686  TGo4FitData* data = fitter->GetData(n);
4687  TPad* pad = FindPadWhereData(data);
4688 
4689  if ((pad!=0) && (data!=0)) {
4690  data->ClearRanges();
4691  double xmin, xmax;
4692  if (ActivePanel()->GetVisibleRange(pad, 0, xmin, xmax))
4693  data->SetRange(0, xmin, xmax);
4694  }
4695  }
4696 }
4697 
4699 {
4700  if ((model==0) || (info==0)) return;
4701  *info = "Model: ";
4702  *info += model->GetName();
4703  *info += " of class: ";
4704  *info += model->ClassName();
4705 
4706  if (model->InheritsFrom(TGo4FitModelFormula::Class())) {
4707  TGo4FitModelFormula* formula = dynamic_cast<TGo4FitModelFormula*> (model);
4708  if (formula) {
4709  *info += "\nFormula: ";
4710  *info += formula->GetExpression();
4711  }
4712  }
4713 
4714  if (model->InheritsFrom(TGo4FitModelFunction::Class())) {
4715  TGo4FitModelFunction* func = dynamic_cast<TGo4FitModelFunction*> (model);
4716  if (func) {
4717  *info += "\nFunction: ";
4718  *info += func->GetFunctionName();
4719  *info += " from: ";
4720  *info += func->GetLibraryName();
4721  }
4722  }
4723  if (fiIntegralMode>0) {
4724  int mode = fiIntegralMode;
4725 
4726  if ((mode==1) || (mode==2)) {
4727  TGo4Fitter* fitter = GetFitter();
4728  TGo4FitData* data = Wiz_SelectedData();
4729  if (data)
4730  if (!model->IsAssignTo(data->GetName())) data = 0;
4731  if ((data!=0) && (fitter!=0)) {
4732  if (mode==1) *info += "\nCounts="; else *info += "\nIntegral=";
4733  double v = fitter->CalculatesIntegral(data->GetName(),model->GetName(),(mode==1));
4734  *info += QString::number(v);
4735  }
4736  }
4737 
4738  if (mode==3) {
4739  double v = model->Integral();
4740  if (v>0) {
4741  *info += "\nGauss integral=";
4742  *info += QString::number(v);
4743  }
4744  }
4745  }
4746 }
4747 
4748 
4750 {
4751  QString res = "";
4752  if (slot==0) return res;
4753 
4754  if (slot->GetObject()==0) {
4755  res = "none";
4756  } else
4757  if (slot->GetOwned()) {
4758  res = "internal object";
4759  } else
4760  if (WorkingWithPanel()) {
4761  TPad* pad = FindPadForSlot(slot);
4762  if (pad==0)
4763  res = "reference without pad";
4764  else {
4765  res = "Panel: ";
4766  res+= ActivePanel()->objectName();
4767  if (ActivePanel()->GetCanvas() != pad) {
4768  res += " pad: ";
4769  res += pad->GetName();
4770  }
4771  }
4772  } else {
4773  int slotindex = GetPadIndexForSlot(slot);
4774  QString linkname;
4775  linkname.sprintf("FitSlotLink_%d", slotindex);
4776  const char* itemname = GetLinkedName(linkname.toLatin1().constData());
4777 
4778  if (itemname!=0) res = itemname;
4779  else res = "reference to external object";
4780  }
4781 
4782  return res;
4783 }
4784 
4786 {
4787  TGo4Fitter* fitter = GetFitter();
4788 
4789  if ((arr==0) || (fitter==0)) return;
4790 
4791  bool ismodified = false;
4792  for(Int_t n=0;n<fitter->NumSlots();n++) {
4793  TPad* pad = FindPadForSlot(fitter->GetSlot(n));
4794  if (pad==0) continue;
4795 
4796  TObjArray lst;
4798 
4799  bool res = false;
4800  for (Int_t k=0;k<=lst.GetLast();k++) {
4801  TGo4FitGuiArrow* a = dynamic_cast<TGo4FitGuiArrow*> (lst[k]);
4802  if (a==0) continue;
4803  if (a->Locate()) res = true;
4804  }
4805  if (res) {
4806  ActivePanel()->MarkPadModified(pad);
4807  ismodified = true;
4808  }
4809  }
4810  if (ismodified)
4812 
4814  if ((arr->GetType()==TGo4FitGuiArrow::at_pos) ||
4817 
4818  if (arr->GetType()==TGo4FitGuiArrow::at_range)
4819  SetItemText(arr->GetItem(), true);
4820 
4821  QFitWidget* current = dynamic_cast<QFitWidget*> (fxCurrentItemWidget);
4822  if(current) current->FillWidget();
4823  }
4824 
4826  if (fbParsWidgetShown)
4827  FillParsWidget();
4828  else
4830 }
4831 
4833 {
4834  if (arr==0) return;
4835  TGo4FitModel* model = arr->GetModel();
4836  if (model==0) return;
4837 
4839  QFitItem* item = FindItem(model, FitGui::ot_model, 0);
4840  if (item) Cmd_DeleteModel(item);
4841  } else
4842  Cmd_RemoveModel(model);
4843 }
4844 
4846 {
4847  TGo4Fitter* fitter = GetFitter();
4848  if ((slot==0) || (fitter==0)) return -1;
4849 
4850  int indx = -1;
4851  for (int n=0;n<fitter->NumSlots();n++) {
4852  TGo4FitSlot* subslot = fitter->GetSlot(n);
4853  bool needpad = !subslot->GetOwned() &&
4854  (subslot->GetClass()->InheritsFrom(TH1::Class()) ||
4855  subslot->GetClass()->InheritsFrom(TGraph::Class()));
4856  if (needpad) indx++;
4857  if (slot==subslot)
4858  return needpad ? indx : -1;
4859  }
4860  return -1;
4861 }
4862 
4864 {
4865  if (!WorkingWithPanel()) return 0;
4866  int indx = GetPadIndexForSlot(slot);
4867  return (indx<0) ? 0 : ActivePanel()->GetSubPad(ActivePad(), indx, true);
4868 }
4869 
4871 {
4872  TGo4Fitter* fitter = GetFitter();
4873  if (fitter==0) return 0;
4874  for(Int_t n = 0; n<fitter->NumSlots();n++) {
4875  TGo4FitSlot* slot = fitter->GetSlot(n);
4876  if (slot->GetOwner()!=data) continue;
4877  TPad* pad = FindPadForSlot(slot);
4878  if (pad!=0) return pad;
4879  }
4880  return 0;
4881 }
4882 
4884 {
4885  TGo4Fitter* fitter = GetFitter();
4886  if ((fitter==0) || (model==0)) return 0;
4887 
4888  for(Int_t n=0;n<model->NumAssigments();n++) {
4889  TGo4FitData* data = fitter->FindData(model->AssignmentName(n));
4890  TPad* pad = FindPadWhereData(data);
4891  if (pad!=0) return pad;
4892  }
4893  return 0;
4894 }
4895 
4897 {
4898  if (comp==0) return 0;
4899  if (comp->InheritsFrom(TGo4FitData::Class()))
4900  return FindPadWhereData(dynamic_cast<TGo4FitData*> (comp));
4901  else
4902  return FindPadWhereModel(dynamic_cast<TGo4FitModel*> (comp));
4903 }
4904 
4905 TGo4FitData* TGo4FitPanel::CreateData(int id, const char* name)
4906 {
4907  TString dataname;
4908 
4909  if (name==0) {
4910  TGo4Fitter* fitter = GetFitter();
4911  if (fitter==0) return 0;
4912  dataname = fitter->FindNextName("Data", 0, kFALSE);
4913  } else dataname = name;
4914 
4915  switch(id) {
4916  case 0: return new TGo4FitDataHistogram(dataname);
4917  case 1: return new TGo4FitDataGraph(dataname);
4918  case 2: return new TGo4FitDataProfile(dataname);
4919  case 3: return new TGo4FitDataRidge(dataname);
4920  }
4921  return 0;
4922 }
4923 
4924 TGo4FitModel* TGo4FitPanel::CreateModel(int id, const char* namebase, TGo4Fitter* fitter, TGo4FitData* data)
4925 {
4926  TString NameBase;
4927 
4928  if (fitter)
4929  if ((data==0) && (fitter->GetNumData()>0)) data = fitter->GetData(0);
4930  Int_t NumDim = 0;
4931  if (data) NumDim = data->DefineDimensions();
4932  if (NumDim<=0) NumDim = 1;
4933 
4934  Int_t order = 0;
4935  switch(id) {
4936  case 20: // gaussian
4937  switch (NumDim) {
4938  case 1: id = 1; break;
4939  case 2: id = 2; break;
4940  default: id = 3; break;
4941  }
4942  break;
4943  case 21: order = 1; id = 7; break; // polynom 1
4944  case 22: order = 3; id = 7; break; // polynom 3
4945  case 23: order = 7; id = 7; break; // polynom 7
4946  }
4947 
4948  if (namebase) NameBase = namebase; else
4949  switch(id) {
4950  case 0: NameBase = "Pol"; break;
4951  case 1:
4952  case 2:
4953  case 3: NameBase = "Gauss"; break;
4954  case 4: NameBase = "Form"; break;
4955  case 5: NameBase = "Func"; break;
4956  case 6: NameBase = "FromData"; break;
4957  case 7: NameBase = "Pol"; break;
4958  case 24: NameBase = "Lor"; break;
4959  case 25: NameBase = "Exp"; break;
4960  default: NameBase = "Model";
4961  }
4962 
4963  TString ModelName;
4964 
4965  if (fitter && (id!=7)) ModelName = fitter->FindNextName(NameBase.Data(), 0);
4966  else ModelName = NameBase;
4967 
4968  TGo4FitModel* model = 0;
4969 
4970  switch(id) {
4971  case 0: model = new TGo4FitModelPolynom(ModelName); break;
4972  case 1: model = new TGo4FitModelGauss1(ModelName); break;
4973  case 2: model = new TGo4FitModelGauss2(ModelName); break;
4974  case 3: model = new TGo4FitModelGaussN(ModelName, NumDim<3 ? 3 : NumDim); break;
4975  case 4: model = new TGo4FitModelFormula(ModelName); break;
4976  case 5: model = new TGo4FitModelFunction(ModelName); break;
4977  case 6: model = new TGo4FitModelFromData(ModelName); break;
4978  case 7: fitter->AddPolynoms(data ? data->GetName() : 0, NameBase.Data(), order, NumDim); break;
4979  case 24: {
4980  TGo4FitModelFormula* formula = new TGo4FitModelFormula(ModelName,"1./(1.+sq((x-Pos)/Width))",2,kTRUE);
4981  formula->SetParsNames("Ampl","Pos","Width");
4982  formula->SetPosParIndex(0, 0);
4983  formula->SetWidthParIndex(0, 1);
4984  model = formula;
4985  break;
4986  }
4987  case 25: {
4988  model = new TGo4FitModelFormula(ModelName,"exp(Koef*x)",1,kTRUE);
4989  model->SetParsNames("Ampl","Koef");
4990  break;
4991  }
4992  }
4993 
4994  if (fitter && model) {
4995  if (data) model->AssignToData(data->GetName());
4996  fitter->AddModel(model);
4997  }
4998 
4999  return model;
5000 }
5001 
5002 void TGo4FitPanel::LocateModel(TGo4FitModel* model, TGo4FitData* data, bool usepad)
5003 {
5004  TGo4Fitter* fitter = GetFitter();
5005 
5006  if ((fitter==0) || (model==0)) return;
5007 
5008  if (data==0)
5009  for(int n=0;n<=model->NumAssigments();n++) {
5010  data = fitter->FindData(model->AssignmentName(n));
5011  if (!usepad || FindPadWhereData(data)) break;
5012  }
5013  if (data==0) return;
5014 
5015  if (!usepad && data->DefineDimensions()!=1) usepad = true;
5016 
5017  if (usepad) {
5018  TPad* pad = FindPadWhereData(data);
5019  if (pad) {
5020  model->SetPosition(0, (pad->GetUxmin() + pad->GetUxmax())/2.);
5021  model->SetWidth(0, TMath::Abs(pad->GetUxmax() - pad->GetUxmin())*.05);
5022  model->SetPosition(1, (pad->GetUymin() + pad->GetUymax())/2.);
5023  model->SetWidth(1, TMath::Abs(pad->GetUymax() - pad->GetUymin())*.05);
5024  }
5025  } else {
5026  Double_t mid, width;
5027  if (fitter->CalculatesMomentums(data->GetName(), kTRUE, kTRUE, mid, width)) {
5028  model->SetPosition(0, mid);
5029  model->SetWidth(0, width);
5030  }
5031  }
5032 }
5033 
5035 {
5036  if (obj==0) return FitGui::wt_none;
5037  if (obj->InheritsFrom(TGo4FitModelPolynom::Class())) return FitGui::wt_polynom;
5038  if (obj->InheritsFrom(TGo4FitModelGauss1::Class())) return FitGui::wt_gauss1;
5039  if (obj->InheritsFrom(TGo4FitModelGauss2::Class())) return FitGui::wt_gauss2;
5040  if (obj->InheritsFrom(TGo4FitModelGaussN::Class())) return FitGui::wt_gaussn;
5041  if (obj->InheritsFrom(TGo4FitModelFormula::Class())) return FitGui::wt_formula;
5042  if (obj->InheritsFrom(TGo4FitModelFunction::Class())) return FitGui::wt_function;
5043  if (obj->InheritsFrom(TGo4FitModel::Class())) return FitGui::wt_model;
5044  return FitGui::wt_none;
5045 }
5046 
5047 void TGo4FitPanel::CreateFitSlotLink(TGo4FitSlot* slot, const char * itemname)
5048 {
5049  if ((slot==0) || (itemname==0)) return;
5050 
5051  int slotindex = GetPadIndexForSlot(slot);
5052 
5053  if (slotindex<0) return;
5054 
5055  QString linkname;
5056  linkname.sprintf("FitSlotLink_%d", slotindex);
5057 
5058  RemoveLink(linkname.toLatin1().constData());
5059 
5060  AddLink(itemname, linkname.toLatin1().constData());
5061 
5062  GetLinked(linkname.toLatin1().constData(), 1);
5063 
5064  UpdateObjectReferenceInSlot(slot, false);
5065 }
5066 
5067 
5069 {
5070  if (slot==0) return true;
5071 
5072  if (slot->GetOwned()) return true;
5073 
5074  bool res = true;
5075 
5076  TObject* obj = 0;
5077 
5078  if (WorkingWithPanel()) {
5079 
5080  TPad* pad = FindPadForSlot(slot);
5081 
5082  TGo4Slot* objslot = ActivePanel()->GetPadMainObjectSlot(pad);
5083  obj = objslot==0 ? 0 : objslot->GetAssignedObject();
5084 
5085  if ((obj!=0) && createlink) {
5086  TString linkname = "data_";
5087  linkname+=slot->GetName();
5088  AddLink(objslot, linkname);
5089  }
5090  } else {
5091  int slotindex = GetPadIndexForSlot(slot);
5092  QString linkname;
5093  linkname.sprintf("FitSlotLink_%d", slotindex);
5094  obj = GetLinked(linkname.toLatin1().constData(), 0);
5095  }
5096 
5097  if (obj==0) res = false;
5098  if ((obj==0) || !slot->IsSuitable(obj))
5099  slot->SetObject(0, kFALSE);
5100  else
5101  slot->SetObject(obj, kFALSE);
5102 
5103  return res;
5104 }
5105 
5106 
5108 {
5109  TGo4Fitter* fitter = GetFitter();
5110  if (fitter==0) return false;
5111 
5112  bool res = true;
5113 
5114  // remove all links, responsible to data connection,
5115  // which are started with "data_"
5116 // std::cout << "UpdateObjectReferenceInSlots(). Remove all links " << std::endl;
5117  if (WorkingWithPanel())
5118  RemoveLinksMasked("data_");
5119 
5120  // here new links will be create, which are connect widget with datasources
5121  for(Int_t n=0; n<fitter->NumSlots(); n++) {
5122  TGo4FitSlot* slot = fitter->GetSlot(n);
5123  if (slot->GetClass()->InheritsFrom(TH1::Class()) ||
5124  slot->GetClass()->InheritsFrom(TGraph::Class()))
5125  res = res && UpdateObjectReferenceInSlot(slot, true);
5126  }
5127 
5128 // std::cout << "UpdateObjectReferenceInSlots() done res = " << res << std::endl;
5129 
5130  return res;
5131 }
5132 
5134 {
5135  if (!WorkingWithPanel()) return;
5136 
5137  TGo4Fitter* fitter = GetFitter();
5138  if (fitter==0) return;
5139 
5140  for(Int_t n = 0; n<fitter->NumSlots();n++) {
5141  TGo4FitSlot* slot = fitter->GetSlot(n);
5142 
5143  if (slot->GetClass()->InheritsFrom(TH1::Class()) ||
5144  slot->GetClass()->InheritsFrom(TGraph::Class()))
5145  if (!slot->GetOwned())
5146  slot->SetObject(0, kFALSE);
5147  }
5148 }
5149 
5151 {
5152  if (!WorkingWithPanel()) return;
5153 
5154  TGo4Fitter* fitter = GetFitter();
5155  if (fitter==0) return;
5156 
5157  bool res = false;
5158 
5159  for(Int_t n = 0; n<fitter->NumSlots();n++) {
5160  TPad* pad = FindPadForSlot(fitter->GetSlot(n));
5161  if (pad==0) continue;
5164  }
5165  if (res) ActivePanel()->ShootRepaintTimer();
5166 }
5167 
5169 {
5170  if (fxDrawNewPanel!=0) {
5171  fxDrawNewPanel->close();
5172  fxDrawNewPanel = 0;
5173  }
5174 }
5175 
5177 {
5178  if (w==0) return;
5179  TObject* obj = w->GetObject();
5180  if (obj==0) return;
5181 
5182  w->ClassNameLbl->setText(QString("Class name: ") + obj->ClassName());
5183  w->ClassNameLbl->adjustSize();
5184  w->NameEdt->setText(obj->GetName());
5185  w->TitleEdt->setText(obj->GetTitle());
5186  TNamed* n = dynamic_cast<TNamed*> (obj);
5187  w->NameEdt->setReadOnly(n==0);
5188  w->TitleEdt->setReadOnly(n==0);
5189 
5190  TGo4FitNamed* go4n = dynamic_cast<TGo4FitNamed*> (obj);
5191  if((go4n!=0) && go4n->GetOwner())
5192  w->FullNameLbl->setText(QString("Full name: ")+go4n->GetFullName());
5193  else
5194  w->FullNameLbl->setText("");
5195  w->FullNameLbl->adjustSize();
5196 
5197  QFitModelWidget* mw = dynamic_cast<QFitModelWidget*> (w);
5198  TGo4FitModel* model = dynamic_cast<TGo4FitModel*> (obj);
5199  if ((mw!=0) && (model!=0)) {
5200  mw->AmplChk->setChecked(model->GetAmplPar()!=0);
5201  mw->AmplChk->setEnabled(model->CanAmplTouch());
5202  mw->BuffersChk->setChecked(model->GetUseBuffers());
5203  mw->GroupSpin->setValue(model->GetGroupIndex());
5204  }
5205 }
5206 
5208 {
5209  if (w==0) return;
5210  QFitItem* item = w->GetItem();
5211  if ((item==0) || (strlen(newname)==0)) return;
5212  TNamed* obj = dynamic_cast<TNamed*> (item->Object());
5213  if (obj==0) return;
5214 
5215  if (item->ObjectType()==FitGui::ot_slot) return;
5216 
5217  if (item->ObjectType()==FitGui::ot_par)
5218  if (item->Parent()!=0)
5219  if (item->Parent()->ObjectType()==FitGui::ot_parslist) {
5220  TGo4FitParsList* pars = dynamic_cast<TGo4FitParsList*> (item->Parent()->Object());
5221  if (pars->FindPar(newname)) return;
5222  }
5223 
5224  if (item->ObjectType()==FitGui::ot_data)
5225  if (item->Parent()!=0)
5226  if (item->Parent()->ObjectType()==FitGui::ot_datalist) {
5227  TGo4Fitter* fitter = GetFitter();
5228  if ((fitter==0) || (fitter->FindData(newname))) return;
5229  fitter->ChangeDataNameInAssignments(obj->GetName(), newname);
5231  }
5232 
5233  if (item->ObjectType()==FitGui::ot_model)
5234  if (item->Parent()!=0)
5235  if (item->Parent()->ObjectType()==FitGui::ot_modellist) {
5236  TGo4Fitter* fitter = GetFitter();
5237  if ((fitter==0) || (fitter->FindModel(newname))) return;
5238  }
5239 
5240  obj->SetName(newname);
5241 
5242  w->SetWidgetItemText(true);
5243 
5244  TGo4FitNamed* go4n = dynamic_cast<TGo4FitNamed*> (obj);
5245  if((go4n!=0) && go4n->GetOwner())
5246  w->FullNameLbl->setText(QString("Full name: ")+go4n->GetFullName());
5247  else
5248  w->FullNameLbl->setText("");
5249  w->FullNameLbl->adjustSize();
5250 }
5251 
5252 void TGo4FitPanel::ChangeObjectTitle(QFitNamedWidget* w, const char* newtitle)
5253 {
5254  if (w==0) return;
5255  TNamed* n = dynamic_cast<TNamed*> (w->GetObject());
5256  if (n!=0) n->SetTitle(newtitle);
5257 }
5258 
5259 void TGo4FitPanel::ChangeModelPar(QFitModelWidget* w, int npar, int value)
5260 {
5261  if (w==0) return;
5262  TGo4FitModel* model = dynamic_cast<TGo4FitModel*> (w->GetObject());
5263  if (model==0) return;
5264  switch (npar) {
5265  case 0: {
5266  if (model->CanAmplTouch()) {
5267  bool res = false;
5268  if (value!=0) res = model->MakeAmpl();
5269  else res = model->RemoveAmpl();
5270  if (res)
5272  }
5273  break;
5274  }
5275 
5276  case 1: {
5277  model->SetUseBuffers(value!=0);
5278  break;
5279  }
5280 
5281  case 2:{
5282  model->SetGroupIndex(value);
5283  break;
5284  }
5285  }
5286 }
void SetParsNames(const char *name0="Par0", const char *name1="Par1", const char *name2="Par2", const char *name3="Par3", const char *name4="Par4", const char *name5="Par5", const char *name6="Par6", const char *name7="Par7", const char *name8="Par8", const char *name9="Par9")
const char * GetLibraryName()
virtual void ShootRepaintTimer()
Bool_t DefineScaleMinMax(Int_t naxis, Double_t &min, Double_t &max)
virtual bool ShowItem(QFitItem *item, bool force)
Bool_t GetFixed() const
virtual TObject * GetDrawObject(TPad *pad, const char *name)
Double_t Get1LineWidth()
virtual bool IsPadHasSubPads(TGo4Slot *padslot)
virtual void MainFindBtn_clicked()
virtual void Cmd_RememberPar(QFitItem *item)
virtual TGo4FitData * Wiz_SelectedData()
virtual void MainAttachBtn_clicked()
const TString & GetParameter()
TGo4FitParsList & GetParsCfg()
virtual void Cmd_AddNewData(QFitItem *item, int id)
virtual void ArrowChanged(TGo4FitGuiArrow *arr)
virtual void UpdateWizModelsList(bool changestack)
virtual void Button_SimpleClear()
virtual void Cmd_AddDependency(QFitItem *item)
virtual void PF_MinWidthEdt_returnPressed()
virtual void UpdatePFAmplLbl()
bool fbDrawBackground
Definition: TGo4FitPanel.h:371
void SetUseBuffers(Bool_t iUse)
virtual Bool_t IsAnyDataTransform()
bool fbSaveWithReferences
Definition: TGo4FitPanel.h:377
virtual void Smp_PolynomBtn_clicked()
void SetMemoryUsage(Int_t iMemoryUsage)
Definition: TGo4Fitter.cxx:72
QLabel * FullNameLbl
virtual TPad * FindPadForSlot(TGo4FitSlot *slot)
virtual void Cmd_DrawData(QFitItem *item)
Int_t GetNumRangeCut() const
TObjArray & GetResults()
void RemoveResult(TGo4FitMinuitResult *res)
void RemoveLinksMasked(const char *startedwith=0, bool blockreset=true)
Definition: QGo4Widget.cpp:208
void DoAction(TGo4FitterAction *Action)
virtual void Cmd_DeleteAllData(QFitItem *item)
TGo4FitSlot * GetSlot(Int_t nslot)
virtual void SetItem(TGo4FitPanel *panel, QFitItem *iItem)
Definition: QFitWidget.cpp:41
TGo4FitGuiArrow * fxOther
Definition: TGo4FitPanel.h:98
bool FindInParents(QFitItem *item)
Definition: QFitItem.cpp:70
Int_t GetResultNDF() const
TObject * Object() const
Definition: QFitItem.h:27
virtual void Cmd_AddRangeCondition(QFitItem *item, int id)
Int_t GetNumResults()
Definition: TGo4FitMinuit.h:91
void ClearAssignments()
QMenu * SettMenu
Definition: TGo4FitPanel.h:347
void ClearRanges(Int_t naxis=-1)
void Set2NoiseFactor(Double_t factor)
virtual void Cmd_DeleteDependencies(QFitItem *item)
virtual bool UpdateObjectReferenceInSlot(TGo4FitSlot *slot, bool createlink)
virtual bool FillPopupForItem(QFitItem *item, QMenu *menu, QSignalMapper *map)
virtual TGo4Fitter * CloneFitter()
virtual void Cmd_MemorizePar(QFitItem *item)
QSignalMapper * ItemMap
Definition: TGo4FitPanel.h:350
QCheckBox * BuffersChk
void SetFitFunctionType(Int_t iFitFunctionType)
Definition: TGo4Fitter.h:80
void SetRangeCondition(Int_t n, Int_t typ, Int_t naxis, Double_t left, Double_t right)
virtual TPad * FindPadWhereModel(TGo4FitModel *model)
void AddAmplEstimation(Int_t NumIters=1)
Definition: TGo4Fitter.cxx:654
virtual void Fitter_UpdateReferences()
virtual void Button_WorkWithPanel()
void ClearModelAssignmentTo(const char *ModelName, const char *DataName=0)
Definition: TGo4Fitter.cxx:439
virtual void UpdateWizardPage()
Int_t GetNumRangeCondition() const
virtual void Wiz_RebuildDataBtn_clicked()
virtual void Wiz_ModelBufChk_toggled(bool zn)
void DeleteAction(TGo4FitterAction *action)
virtual void RemoveFitterLink()
virtual void RemoveItemWidget()
bool fbUseSamePanelForDraw
Definition: TGo4FitPanel.h:372
virtual void UpdatePFRelNoiseLbl()
virtual void linkedObjectUpdated(const char *linkname, TObject *obj)
virtual void PF_WidthEdit_returnPressed()
virtual void changeEvent(QEvent *event)
virtual void WorkWithFitterInSlot(TGo4Slot *slot)
TGo4FitModel * FindModel(const char *ModelName)
Definition: TGo4Fitter.cxx:198
TGo4FitParameter * CreatePar(const char *ParName, const char *Title, Double_t iValue=0)
Int_t GetGroupIndex() const
Definition: TGo4FitModel.h:119
QFitItem * GetItem()
Definition: TGo4FitPanel.h:80
void SetRangeMin(Int_t naxis, Double_t value)
int GraphType() const
Definition: QFitItem.h:32
static TGo4MdiArea * Instance()
Definition: TGo4MdiArea.cpp:27
virtual TGo4Slot * GetDrawObjectSlot(TPad *pad, const char *name)
virtual bool FillPopupForSlot(TGo4FitSlot *slot, QMenu *menu, QSignalMapper *map)
virtual void SetItemText(QFitItem *item, bool trace)
virtual void ChangeObjectName(QFitNamedWidget *w, const char *newname)
virtual void Cmd_DeleteOutputActions(QFitItem *item)
virtual void Cmd_DeleteDependency(QFitItem *item)
TObject * GetLinked(const char *linkname, int updatelevel)
Definition: QGo4Widget.cpp:176
void AddPolynoms(const char *DataName, const char *NamePrefix, Int_t MaxOrder=1, Int_t NumAxis=1, Int_t GroupIndex=0)
Definition: TGo4Fitter.cxx:297
void ClearConnectionToSlot()
Definition: TGo4FitSlot.cxx:94
virtual void UpdateItemsOfType(int typ, QFitItem *parent)
virtual void Cmd_DeleteActions(QFitItem *item)
virtual void Smp_ClearBtn_clicked()
virtual void Fitter_New()
TGo4FitParameter * GetPar(Int_t n)
virtual void Cmd_DeleteModels(QFitItem *item)
void AssignToData(const char *DataName, Double_t RatioValue=1., Bool_t FixRatio=kFALSE)
virtual void Wiz_DataListSelect(QListWidgetItem *)
bool fbNeedConfirmation
Definition: TGo4FitPanel.h:364
virtual void UpdateWizPaint(int mode)
virtual Bool_t CanAmplTouch()
virtual void Button_PeakFinder()
bool fbDrawComponents
Definition: TGo4FitPanel.h:370
void AddCommand(const char *iCommand)
virtual void MemorizePars()
virtual void FillSlotsList(QFitItem *parent, const TObjArray *lst, TObject *owner)
bool fbDrawInfoOnPad
Definition: TGo4FitPanel.h:373
virtual TPad * ActivePad()
void AddAction(TGo4FitterAction *Action)
void SetDataName(const char *name)
QFitItem * fxCurrentItem
Definition: TGo4FitPanel.h:362
virtual Bool_t SetPosition(Int_t naxis, Double_t pos)
virtual void UpdateWizModelsBtns()
virtual void UpdateWizDataBtns()
virtual void ClearObjectReferenceInSlots()
int PopupMenuType() const
Definition: QFitItem.h:31
virtual void Wiz_DataList_doubleClicked(QListWidgetItem *)
virtual void Fitter_SaveToBrowser()
void SetForRange(TGo4FitComponent *Comp, Int_t num, Double_t rangey, Double_t shiftx)
virtual bool IsAcceptDrag(const char *itemname, TClass *cl, int kind)
virtual TGo4Fitter * GetFitter()
virtual void Wiz_ModelListSelect(QListWidgetItem *)
Bool_t GetRange(Double_t &min, Double_t &max) const
virtual void Delete(Option_t *option="")
virtual Bool_t CanChangeFitter() const
virtual void CreateDataFor(TGo4ViewPanel *panel, TPad *pad, TGo4Fitter *fitter)
QFitItem * fxItem
Definition: TGo4FitPanel.h:104
const Int_t GetDataType()
Definition: TGo4FitData.h:57
void SetForPosition(TGo4FitModel *model, TGo4FitGuiArrow *forwidth, Double_t iLineAmpl)
QSignalMapper * ViewMap
Definition: TGo4FitPanel.h:346
virtual void Wiz_AddModelBtn_clicked()
virtual Double_t Integral()
int WidgetType() const
Definition: QFitItem.h:30
virtual void Wiz_ShowAllMod_toggled(bool zn)
QAction * AddIdAction(QMenu *menu, QSignalMapper *map, const QString &text, int id, int enabled, int checked)
Definition: QGo4Widget.cpp:419
virtual void Smp_GaussianBtn_clicked()
const char * GetFunctionName()
virtual void Cmd_DeletePar(QFitItem *item)
virtual QString Wiz_GetSlotSourceInfo(TGo4FitSlot *slot)
virtual void Wiz_TakeCurrentRange()
void ClearAssignmentTo(const char *DataName)
const char * GetFullName()
Double_t fdRangeY
Definition: TGo4FitPanel.h:102
virtual void FitterMenuItemSelected(int id)
virtual void Cmd_DeleteData(QFitItem *item)
virtual void LocateModel(TGo4FitModel *model, TGo4FitData *data, bool usepad)
void AssignModelTo(const char *ModelName, const char *DataName, Double_t RatioValue=1., Bool_t FixRatio=kFALSE)
Definition: TGo4Fitter.cxx:424
TObjArray * fxWizSlots
Definition: TGo4FitPanel.h:356
const char * GetLinkedName(const char *linkname)
Definition: QGo4Widget.cpp:157
QSignalMapper * SettMap
Definition: TGo4FitPanel.h:348
virtual void Cmd_AddNewAction(QFitItem *item, int id)
virtual TGo4Slot * GetPadMainObjectSlot(TPad *pad)
void ClearSlot(TGo4FitSlot *slot, Bool_t NonOwned)
void SetAmplValue(Double_t iAmpl)
void Set2NoiseMinimum(Double_t min)
TObjArray * fxWizPars
Definition: TGo4FitPanel.h:355
virtual void Fitter_PrintParameters()
const char * AssignmentName(Int_t n)
Definition: TGo4FitModel.h:129
virtual void Wiz_GetModelInfo(TGo4FitModel *model, QString *info)
virtual void focusInEvent(QFocusEvent *event)
TGo4FitData * RemoveData(const char *DataName, Bool_t IsDel=kFALSE)
Definition: TGo4Fitter.cxx:172
Double_t Get2NoiseFactor()
virtual void UpdateItemMenu()
virtual ~TGo4FitPanel()
virtual void PF_MinNoiseEdit_returnPressed()
void ReplaceAction(TGo4FitterAction *action, Int_t dir)
void DeleteAllData()
Definition: TGo4Fitter.cxx:185
QCheckBox * AmplChk
QFitItem * DefineWidgetItem()
Definition: QFitItem.cpp:48
virtual void Wiz_DataSlotsTable_contextMenuRequested(const QPoint &pnt)
TGo4FitModel * RemoveModel(const char *ModelName, Bool_t IsDel=kFALSE)
Definition: TGo4Fitter.cxx:377
virtual void ClearCanvas()
void SetPeakFinderType(Int_t typ)
virtual void PaintFitter(TGo4Fitter *fitter, QFitItem *item, bool update)
virtual void Cmd_DeletePars(QFitItem *item)
virtual void Divide(int numX, int numY)
virtual void ChangeViewType(int id)
virtual void Cmd_UpdateAllSlots(QFitItem *item)
virtual void Cmd_CreateFitter()
QGo4LineEdit * TitleEdt
tuple a
Definition: go4init.py:12
virtual bool UpdateObjectReferenceInSlots()
TGo4ViewPanel * CreateViewPanel(int ndiv=0)
Definition: QGo4Widget.cpp:303
QString fxWizDataName
Definition: TGo4FitPanel.h:379
virtual void Button_SimpleFit(int nmodel)
virtual void AboutToShowViewMenu()
bool fbParsWidgetShown
Definition: TGo4FitPanel.h:368
void DeleteModelsAssosiatedTo(const char *DataName)
Definition: TGo4Fitter.cxx:398
TGo4FitComponent * fxComp
Definition: TGo4FitPanel.h:100
bool getBool(const QString &name, bool def=true)
Double_t CalculatesIntegral(const char *DataName, const char *ModelName=0, Bool_t OnlyCounts=kFALSE)
Definition: TGo4Fitter.cxx:808
void SetForWidth(TGo4FitModel *model, TGo4FitGuiArrow *forposition)
virtual void UpdateExtendedPage()
void SetSaveFlagForObjects(Int_t iSaveFlag, const char *PlaceName=0)
virtual void ChangeModelPar(QFitModelWidget *w, int npar, int value)
TObjArray * fxParsTableList
Definition: TGo4FitPanel.h:357
virtual void Cmd_ClearFitter()
virtual void DeleteDrawObject(TPad *pad, const char *name)
virtual bool ShowItemAsText(QFitItem *item, bool force)
virtual void FillNamedWidget(QFitNamedWidget *w)
virtual TGo4Fitter * CreateFitterFor(TGo4ViewPanel *panel, TPad *pad, const char *name)
TGo4FitData * AddData(TGo4FitData *d)
Definition: TGo4Fitter.cxx:118
virtual Bool_t GetPosition(Int_t naxis, Double_t &pos)
virtual TGo4FitData * CreateData(int id, const char *name)
void RemoveAllLinks(bool blockreset=true)
Definition: QGo4Widget.cpp:200
virtual void MainDrawBtn_clicked()
Bool_t GetOwned()
Definition: TGo4FitSlot.h:161
TGo4FitterOutput * AddOutputAction(const char *Action, const char *Option=0)
TObject * GetAssignedObject()
Definition: TGo4Slot.cxx:373
Double_t Get0MaxAmplFactor()
virtual TPad * GetSubPad(TPad *toppad, int num, bool onlytoplevel)
virtual TObject * GetPadMainObject(TPad *pad)
virtual Int_t NumPars()
virtual void Cmd_DeleteAction(QFitItem *item)
virtual void Fitter_RollbackParameters()
virtual void Cmd_MoveAction(QFitItem *item, int dir)
const TObjArray * GetSlotList(Bool_t ForceUpdate=kFALSE)
QWidget * fxCurrentItemWidget
Definition: TGo4FitPanel.h:363
virtual void Cmd_RemoveModel(TGo4FitModel *model)
void setBool(const QString &name, bool value=true)
QMenu * ItemMenu
Definition: TGo4FitPanel.h:349
virtual void PF_MinWidthEdt_textChanged(const QString &str)
virtual void SetWidgetItemText(bool trace)
Definition: QFitWidget.cpp:97
void Set0MaxWidth(Double_t max)
virtual void Smp_LorenzBtn_clicked()
virtual void Cmd_ExecuteActions(QFitItem *item, bool expert)
virtual bool Wiz_RemoveData()
virtual bool ShowItemAsGraph(QFitItem *item, bool force)
TCutG * GetRangeCut(Int_t n) const
Double_t fdLineAmpl
Definition: TGo4FitPanel.h:99
virtual void Cmd_RemoveRangeCondition(QFitItem *item)
void Set0MaxAmplFactor(Double_t factor)
Bool_t IsSuitableClass(TClass *cl)
virtual void UpdateWizDataList()
virtual bool PaintRange(TGo4FitComponent *comp, int nrange, TPad *pad, QFitItem *item)
virtual void PF_MaxWidthEdt_returnPressed()
void SetPosParIndex(Int_t naxis, Int_t indx=-1)
virtual int GetPadIndexForSlot(TGo4FitSlot *slot)
TGo4FitSlot * GetConnectedSlot() const
Definition: TGo4FitSlot.h:124
virtual void Button_PerformFit()
QGo4LineEdit * NameEdt
virtual void Wiz_DelDataBtn_clicked()
void ChangeDataNameInAssignments(const char *oldname, const char *newname)
Definition: TGo4Fitter.cxx:448
virtual TPad * FindPadWhereData(TGo4FitData *data)
virtual void FillWidget()
Definition: QFitWidget.cpp:64
TObjArray & GetParsDepend()
void SetRange(Int_t naxis, Double_t min, Double_t max)
virtual bool PaintModel(TGo4FitModel *model, TPad *pad, QFitItem *item)
virtual void Button_FitterDraw(TGo4FitData *selecteddata)
virtual void Wiz_FitNameEdt_textChanged(const QString &name)
virtual void DropOnPanel(QDropEvent *event, const char *itemname, TClass *cl, int kind)
const char * GetExpression()
void DoActions(Bool_t AllowFitterChange=kFALSE, TObjArray *Actions=0)
bool fbFillingWidget
Definition: TGo4FitPanel.h:353
void RemoveLink(const char *linkname, bool blockreset=true)
Definition: QGo4Widget.cpp:192
int ObjectType() const
Definition: QFitItem.h:29
virtual void Cmd_ItemPrint(QFitItem *item)
Bool_t RemovePar(const char *name)
void Set2ChannelSum(Int_t sum)
TGo4FitModel * fxModel
Definition: TGo4FitPanel.h:97
Bool_t SetObject(TObject *iObject, Bool_t iOwned=kFALSE, Bool_t CheckClass=kTRUE)
virtual void MarkPadModified(TPad *pad)
virtual void PF_WidthEdit_textChanged(const QString &str)
const char * GetParFullName(Int_t n)
virtual void Wiz_ParTable_valueChanged(int nrow, int ncol)
virtual void Cmd_DeleteMinuitResult(QFitItem *item)
TGo4FitModel * GetModel(Int_t n)
Definition: TGo4Fitter.cxx:193
TPad * fxActivePad
Definition: TGo4FitPanel.h:359
int getInt(const QString &name, int def=0)
Double_t CalculatesModelIntegral(const char *ModelName, Bool_t OnlyCounts=kFALSE)
Definition: TGo4Fitter.cxx:846
virtual void Fitter_UseWorkspace()
void SetItem(QFitItem *item, TGo4FitPanel *panel)
virtual void Wiz_ModelList_itemChanged(QListWidgetItem *)
Bool_t IsAssignTo(TObject *obj)
virtual void DeleteModelWithPrimit(TGo4FitGuiArrow *arr)
virtual TGo4ViewPanel * ActivePanel()
virtual void Wiz_PFSetupBtn_clicked()
virtual TGo4FitModel * Wiz_SelectedModel()
virtual void Wiz_DataBufChk_toggled(bool zn)
virtual void FillDataTypesList(QMenu *menu, QSignalMapper *map, int id)
QFitItem * Parent() const
Definition: QFitItem.h:35
virtual void PF_SumUpSpin_valueChanged(int num)
virtual void PF_RelNoiseSlider_valueChanged(int zn)
virtual void Fitter_NewForActivePad(bool overwrite)
TGo4FitParameter * FindPar(const char *ParName)
QSignalMapper * FitterMap
Definition: TGo4FitPanel.h:344
Double_t GetError() const
TGo4FitMinuitResult * GetResult(Int_t indx)
TGo4FitModel * GetModel()
Definition: TGo4FitPanel.h:85
TGo4QSettings * go4sett
virtual void PF_MaxWidthEdt_textChanged(const QString &str)
virtual void Wiz_AddDataBtn_clicked()
Bool_t GetEpsilon(Double_t &eps) const
virtual void SetFitter(TGo4Fitter *)
virtual void Cmd_ClearAssigments(QFitItem *item)
virtual void Cmd_SaveFitter(bool ask)
Double_t Get2NoiseMinimum()
virtual void Cmd_ExecuteAction(QFitItem *item)
TClass * GetClass()
Definition: TGo4FitSlot.h:61
void AddRangeCut(TCutG *cut, Bool_t exclude=kFALSE)
virtual TGo4FitData * Wiz_CreateNewData(int id)
virtual void Cmd_RememberPars(QFitItem *item)
virtual QFitItem * FindItem(TObject *obj, int ObjectType, QFitItem *parent)
virtual void UpdateItem(QFitItem *item, bool trace)
virtual void AboutToShowItemMenu()
virtual Bool_t SetWidth(Int_t naxis, Double_t width)
TString FindNextName(const char *Head, Int_t start, Bool_t isModel=kTRUE)
virtual TPad * FindPadWhereComp(TGo4FitComponent *comp)
void SetRangeMax(Int_t naxis, Double_t value)
virtual void Cmd_DeleteAssosiatedModels(QFitItem *item)
virtual void FillSlotList(TSeqCollection *list)
virtual void PF_RelNoiseSlider_sliderReleased()
virtual void ChangeObjectTitle(QFitNamedWidget *w, const char *newtitle)
virtual void PF_AmplSlider_sliderReleased()
virtual void linkedObjectRemoved(const char *linkname)
virtual void MainFitBtn_clicked()
virtual void FillModelTypesList(QMenu *menu, QSignalMapper *map, int id, bool extend)
virtual TGo4FitModel * Wiz_CreateNewModel(int id)
TGo4FitData * GetData(Int_t n)
Definition: TGo4Fitter.cxx:103
TGo4ViewPanel * fxActivePanel
Definition: TGo4FitPanel.h:358
void SetGroupIndex(Int_t index=-1)
Definition: TGo4FitModel.h:109
virtual Bool_t GetWidth(Int_t naxis, Double_t &width)
QFitItem * DefineGraphItem()
Definition: QFitItem.cpp:59
virtual void Wiz_BackgroundChk_toggled(bool chk)
Int_t NumAssigments() const
Definition: TGo4FitModel.h:124
QMenu * FitterMenu
Definition: TGo4FitPanel.h:343
virtual void Cmd_MemorizePars(QFitItem *item)
void SetUsePolynom(Bool_t use)
virtual void CloseDrawPanel()
virtual TObject * GetObject()
Definition: QFitWidget.cpp:53
Int_t GetFitFunctionType()
Definition: TGo4Fitter.h:85
virtual void SetDrawOption(const QString &option)
TGo4ViewPanel * LastActivePanel()
Definition: QGo4Widget.cpp:344
bool fbUseAmplEstim
Definition: TGo4FitPanel.h:383
TNamed * GetOwner()
Definition: TGo4FitNamed.h:63
Int_t DefineDimensions()
virtual void PF_MinNoiseEdit_textChanged(const QString &str)
virtual void Wiz_UseAmplEstimChk_toggled(bool chk)
Bool_t IsObject() const
Definition: TGo4FitSlot.h:188
void GetRangeCondition(Int_t n, Int_t &typ, Int_t &naxis, Double_t &left, Double_t &right) const
Double_t GetResultFF() const
virtual void LineParsChk_toggled(bool)
virtual void Wiz_DataUseRangeBtn_clicked()
virtual void FillParsWidget()
virtual void Wiz_DrawDataBtn_clicked()
virtual void MainParsBtn_clicked()
void SetValue(Double_t iValue)
QAction * SetIdAction(QSignalMapper *map, int id, int enabled, int checked)
Definition: QGo4Widget.cpp:435
virtual void ExecutePopupForSlot(QFitItem *item, TGo4FitSlot *slot, int id)
virtual bool PaintModelsFor(TGo4Fitter *fitter, TGo4FitData *data, QFitItem *item, bool update)
virtual void Wiz_MigradIterSpin_valueChanged(int num)
virtual void ItemMenuItemSelected(int id)
virtual void AboutToShowSettMenu()
void RemoveRangeCut(Int_t n)
virtual TH1 * GetPadHistogram(TPad *pad)
virtual void Cmd_AddNewPar(QFitItem *item)
Double_t GetValue() const
virtual void RememberPars()
Bool_t ConnectToSlot(TGo4FitSlot *slot)
Definition: TGo4FitSlot.cxx:75
virtual void panelSlot(TGo4ViewPanel *, TPad *, int)
virtual ~TGo4FitGuiArrow()
virtual void UpdateWizStackWidget()
virtual void FitList_currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)
virtual void Wiz_PFPolynSpin_valueChanged(int zn)
TGo4FitModel * CloneModel(const char *ModelName, const char *NewName=0)
Definition: TGo4Fitter.cxx:355
virtual void Wiz_UseSelectedRange()
TGo4FitterAction * GetAction(Int_t num)
void RemoveRangeCondition(Int_t n)
virtual void Wiz_DelModelBtn_clicked()
virtual void Cmd_CloneModel(QFitItem *item)
virtual void UpdateActivePage()
virtual void Wiz_FitFuncCmb_activated(int typ)
void Set1LineWidth(Double_t width)
virtual void Cmd_DeleteModel(QFitItem *item)
TGo4FitPanel * fxPanel
Definition: TGo4FitPanel.h:105
TGo4FitPanel(QWidget *parent=0, const char *name=0)
const char * GetDataName(Int_t n)
Definition: TGo4Fitter.cxx:108
QFitItem * CurrFitItem
Definition: TGo4FitPanel.h:338
virtual void Wiz_PFUsePolynChk_toggled(bool zn)
TObject * CloneObject(const char *newname=0)
virtual TGo4FitPeakFinder * GetPeakFinder(bool autocreate)
virtual bool CanRollbackPars()
virtual void UpdateSimplePage()
void SetClearModels(Bool_t clear)
virtual void Fitter_Delete()
virtual QFitItem * GetItem()
Definition: QFitWidget.cpp:48
virtual void FillDependencyList(QFitItem *parent)
void SetEpsilon(Double_t iEpsilon)
Int_t GetNumModel() const
Definition: TGo4Fitter.h:178
virtual void FitItemDeleted(QFitItem *item)
virtual void ParsTable_valueChanged(int nrow, int ncol)
virtual void ParsTableChanged(QTableWidget *table, int nrow, int ncol, bool LinesView, TObjArray *TableList, bool updatepaint)
TGo4FitModel * AddModel(TGo4FitModel *m)
Definition: TGo4Fitter.cxx:203
void SetWidthParIndex(Int_t naxis, Int_t indx=-1)
virtual void RemovePrimitives()
Bool_t IsSuitable(TObject *obj)
void AddLink(const char *itemname, const char *linkname)
Definition: QGo4Widget.cpp:121
virtual TGo4FitModel * CreateModel(int id, const char *namebase, TGo4Fitter *fitter, TGo4FitData *data)
virtual void CreateFitSlotLink(TGo4FitSlot *slot, const char *itemname)
Bool_t MakeAmpl(Bool_t isFixed=kFALSE)
virtual void PF_AmplSlider_valueChanged(int zn)
virtual bool WorkingWithPanel()
virtual void CollectSpecialObjects(TPad *pad, TObjArray *objs, int selectkind)
virtual void Wiz_MinSetupBtn_clicked()
TObject * CreateDrawObject(const char *ObjName, const char *DataName, Bool_t IsModel=kFALSE, const char *ModelName=0)
Definition: TGo4Fitter.cxx:853
virtual void RemoveDrawObjects()
virtual void FillParsTable(QTableWidget *table, TGo4Fitter *fitter, TGo4FitModel *model, bool LinesView, TObjArray *TableList)
virtual QFitItem * GetFitterItem()
QString SaveObjectInMemory(const char *foldername, TObject *obj)
Definition: QGo4Widget.cpp:361
virtual bool WorkingWithOnlyPad()
virtual void Cmd_ClearAssigment(QFitItem *item)
TGo4FitParsList & GetParsNew()
QLabel * ClassNameLbl
void SetBackgroundGroupIndex()
Definition: TGo4FitModel.h:114
Bool_t IsAssignTo(const char *DataName) const
Definition: TGo4FitModel.h:141
virtual void FindersTab_currentChanged(int)
void setInt(const QString &name, int value=0)
virtual int GetNumberOfPads(TPad *toppad)
virtual void Wiz_RebuildDataList()
virtual TPad * GetActivePad()
virtual void AboutToShowFitterMenu()
Bool_t CalculatesMomentums(const char *DataName, Bool_t UseRanges, Bool_t SubstractModels, Double_t &first, Double_t &second)
Definition: TGo4Fitter.cxx:732
int Tag() const
Definition: QFitItem.h:33
QSpinBox * GroupSpin
virtual int DefineModelWidgetType(TObject *obj)
const TString & GetExpression()
QMenu * ViewMenu
Definition: TGo4FitPanel.h:345
bool fbShowPrimitives
Definition: TGo4FitPanel.h:365
virtual void Smp_ExponentBtn_clicked()
virtual void Clear(Option_t *option=0)
Definition: TGo4Fitter.cxx:96
TObject * GetObject() const
bool fbRecalculateGaussWidth
Definition: TGo4FitPanel.h:375
Double_t fdShiftX
Definition: TGo4FitPanel.h:103
virtual bool DeleteDrawObjects(TPad *pad, int kindtodelete)
QMenuBar * MenuBar
Definition: TGo4FitPanel.h:342
void AddActionAt(TGo4FitterAction *Action, Int_t indx)
void ExcludeRange(Int_t naxis, Double_t min, Double_t max)
void SetFixed(Bool_t iFixed)
virtual void FillParsList(QFitItem *item)
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual void UpdateStatusBar(const char *info)
virtual void Cmd_CreateAppropriateFitter()
virtual void Cmd_AddNewModel(QFitItem *item, int id)
virtual void FitList_customContextMenuRequested(const QPoint &)
TGo4FitData * FindData(const char *DataName)
Definition: TGo4Fitter.cxx:113
virtual void Wiz_DataClearRangesBtn_clicked()
void SetPolynomOrder(Int_t order)
virtual void linkedRemoved(TGo4Slot *slot, TObject *obj)
virtual TGo4Slot * AddDrawObject(TPad *pad, int kind, const char *itemname, TObject *obj, bool owner, const char *drawopt)
virtual void UpdateItemsOfType(int typ, bool allitems)
Definition: QFitWidget.cpp:103
bool fbDrawPanelCreation
Definition: TGo4FitPanel.h:361
virtual void WorkWithFitter(const char *itemname, TGo4ViewPanel *panel, TPad *pad)
static void Info(const char *text,...)
Definition: TGo4Log.cxx:283
void Set0MinWidth(Double_t min)
QString fxWizModelName
Definition: TGo4FitPanel.h:380
virtual void ChangeSettings(int id)
virtual void ShowPanelPage(int id)
virtual Int_t NumPars()
virtual void Cmd_DeleteFitter()
void SetRange(Double_t iRangeMin, Double_t iRangeMax)
virtual void Wiz_ModelList_doubleClicked(QListWidgetItem *)
virtual void Wiz_CloneModelBtn_clicked()
bool fbWizShowAllModels
Definition: TGo4FitPanel.h:381
virtual void Cmd_AssignModelToData(QFitItem *item, int id)
TGo4ViewPanel * fxDrawNewPanel
Definition: TGo4FitPanel.h:360
bool fbUseCurrentRange
Definition: TGo4FitPanel.h:378
void AddStandardActions()
Definition: TGo4Fitter.cxx:659
void SetError(Double_t iError)
TObjArray & GetParsInit()
TGo4FitParameter * GetAmplPar()
void DeleteAllModels()
Definition: TGo4Fitter.cxx:416
Int_t GetNumData() const
Definition: TGo4Fitter.h:123
virtual void SetAutoScale(bool on, TPad *selpad)
virtual void Cmd_RemoveRangeConditions(QFitItem *item)
Bool_t CanConnectToSlot(TGo4FitSlot *slot)
Definition: TGo4FitSlot.cxx:84
virtual void Cmd_AssignModelToAllData(QFitItem *item)