59 void KVAutoFit::init()
62 lfunc->SetOwner(kTRUE);
67 c1 =
new TCanvas(
Form(
"%s_canvas", GetName()),
Form(
"%s_canvas", GetName()), 0, 0, 1200, 600);
69 c1->AddExec(
"interval",
"ap->GetInterval()");
70 c1->AddExec(
"recommence",
"ap->Recommence()");
71 c1->AddExec(
"gather",
"ap->Gather()");
74 lplabel->SetOwner(kTRUE);
75 lplabel->Add(
new TPaveLabel(0.10, 0.92, 0.25, 0.99,
"Annule Tout",
"NDC"));
76 lplabel->Add(
new TPaveLabel(0.27, 0.92, 0.44, 0.99,
"Annule Dernier",
"NDC"));
77 lplabel->Add(
new TPaveLabel(0.46, 0.92, 0.55, 0.99,
"Gather",
"NDC"));
78 lplabel->Add(
new TPaveLabel(0.57, 0.92, 0.65, 0.99,
"Suivant",
"NDC"));
80 lplabel->Execute(
"SetTextSize",
"0.625");
81 lplabel->Execute(
"SetFillColor",
"10");
156 if (!fBatch) c1->
Clear();
165 void KVAutoFit::ClearRange(
void)
210 Info(
"SetHistos",
"On s'occupe de tous les histos de la liste");
212 else if (
option ==
"relecture") {
213 Info(
"SetHistos",
"On s'occupe de tous les histos de la liste en relisant les infos des histos pour lesquels on en a (des info)");
215 else if (
option ==
"inconnu") {
216 Info(
"SetHistos",
"On ne s'occupe que des histos pour lesquels on n'a pas d info");
219 Info(
"SetHistos",
"la variable option doit prendre la valeur \"all\", \"relecture\" ou \"inconnu\"");
235 void KVAutoFit::NextHisto()
246 Info(
"NextHisto",
"Fin de la liste d histos");
250 if (koption ==
"all" || koption ==
"relecture") {
254 if (koption ==
"inconnu") {
256 while (IsKnown(snom.Data())) {
259 Info(
"NextHisto",
"Fin de la liste d histos");
262 snom.Form(
"%s", lhisto->
At(nhisto)->
GetName());
276 Info(
"Print",
"Liste des fonctions pour l'histogram %s :", hfit->
GetName());
278 Info(
"Print",
"Liste des fonctions :");
300 Bool_t KVAutoFit::NewFunction()
306 return NewFunction_2D();
308 return NewFunction_1D();
315 Bool_t KVAutoFit::NewFunction_1D()
318 Info(
"NewFunction_1D",
"To be defined in child class");
325 Bool_t KVAutoFit::NewFunction_2D()
327 Info(
"NewFunction_2D",
"To be defined in child class");
344 return ReloadFunction_2D(name, np);
346 return ReloadFunction_1D(name, np);
356 Info(
"ReloadFunction_1D",
"To be defined in child class");
365 Info(
"ReloadFunction_2D",
"To be defined in child class");
418 KVError::Warning(
this,
"SetHisto",
"La dimension de lhisto n'est pas compatible avec celle definie ds cette classe");
424 hclone = (
TH1*)hh->
Clone(
"ap_clone");
434 if (koption ==
"relecture")
469 Xmin =
gPad->AbsPixeltoX(xx);
470 Ymin =
gPad->AbsPixeltoY(yy);
479 Xmax =
gPad->AbsPixeltoX(xx);
480 Ymax =
gPad->AbsPixeltoY(yy);
496 if (XminSet && XmaxSet) {
498 printf(
"\tX : %lf %lf\n", Xmin, Xmax);
499 printf(
"\tY : %lf %lf\n", Ymin, Ymax);
506 hfit->
Fit(f1Dfit,
"0N",
"", Xmin, Xmax);
507 f1Dfit->
Draw(
"same");
511 hfit->
Fit(f2Dfit,
"0N",
"", Xmin, Xmax);
512 f2Dfit->
Draw(
"same,cont2");
540 if (!strcmp(
"Annule Tout", select->
GetTitle())) {
541 Info(
"",
"On efface les fonctions...");
546 if (!strcmp(
"Annule Dernier", select->
GetTitle())) {
547 Info(
"",
"On retire la derniere fonction ...");
553 if (!strcmp(
"Suivant", select->
GetTitle())) {
574 if (!strcmp(
"Gather", select->
GetTitle())) {
575 Info(
"Gather",
"Do nothing");
593 fout <<
"// Functions generated by class=" <<
GetName() << endl;
594 #ifdef WITH_BZR_INFOS
595 fout <<
"// From bzr revision=" << KVBase::bzrRevisionNumber() << endl;
597 #ifdef WITH_GIT_INFOS
603 fout << userdefined << endl;
611 fout <<
x1 <<
" " <<
x2 << endl;
615 fout <<
x1 <<
" " <<
x2 <<
" " <<
y1 <<
" " <<
y2 << endl;
633 Info(
"Relecture",
"%s, Reading existing data",
name);
644 while (
line.BeginsWith(
"//"))
line.ReadLine(fin);
647 for (
Int_t ii = 0; ii < nf; ii += 1) {
655 if (sfor.
Atoi() == 0) {
665 freload = ReloadFunction(snom.
Data(),
np);
669 toks =
line.Tokenize(
" ");
678 toks =
line.Tokenize(
" ");
686 freload->
Draw(
"same");
697 while (
line.BeginsWith(
"//"))
line.ReadLine(fin);
700 for (
Int_t ii = 0; ii < nf; ii += 1) {
708 if (sfor.
Atoi() == 0) {
718 freload = (
TF2*)ReloadFunction(snom.
Data(),
np);
722 toks =
line.Tokenize(
" ");
733 toks =
line.Tokenize(
" ");
741 freload->
Draw(
"cont2,same");
749 Info(
"Relecture",
"done");
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t np
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char y1
char * Form(const char *fmt,...)
R__EXTERN TStyle * gStyle
R__EXTERN TSystem * gSystem
Manage SemiAutomatic Fits.
Bool_t is2D
histogramme analyse herite de TH1 ou TH2
virtual void SetHisto(TH1 *hh)
virtual void SetHistos(KVHashList *lh, TString option="")
virtual void ExtraDrawing()
virtual ~KVAutoFit()
Destructor.
void Clear(Option_t *opt="") override
void Print(Option_t *opt="") const override
KVHashList * GetFunctions() const
virtual void Relecture(const Char_t *name)
virtual void HandleKey(Int_t)
void Copy(TObject &) const override
Base class for KaliVeda framework.
static const Char_t * gitCommit()
Returns last git commit of sources.
static const Char_t * gitBranch()
Returns git branch of sources.
void Copy(TObject &) const override
Make a copy of this object.
Extended version of ROOT THashList.
void Execute(const char *method, const char *params, Int_t *error=0) override
void Add(TObject *obj) override
void Clear(Option_t *option="") override
TObject * At(Int_t idx) const override
void Clear(Option_t *option="") override
TVirtualPad * cd(Int_t subpadnumber=0) override
virtual void Print(Option_t *option, const char *wildcard, Int_t recurse=1) const
virtual Int_t GetEntries() const
virtual void SetParError(Int_t ipar, Double_t error)
virtual Double_t GetParameter(const TString &name) const
virtual Double_t GetParError(Int_t ipar) const
virtual void SetRange(Double_t xmin, Double_t xmax)
virtual Int_t GetNpar() const
virtual TString GetExpFormula(Option_t *option="") const
void Draw(Option_t *option="") override
virtual void GetRange(Double_t &xmin, Double_t &xmax) const
virtual void SetParameter(const TString &name, Double_t value)
void Draw(Option_t *option="") override
void SetRange(Double_t xmin, Double_t xmax) override
virtual TFitResultPtr Fit(const char *formula, Option_t *option="", Option_t *goption="", Double_t xmin=0, Double_t xmax=0)
void Draw(Option_t *option="") override
TObject * Clone(const char *newname="") const override
const char * GetName() const override
TObject * At(Int_t idx) const override
virtual const char * GetName() const
virtual Bool_t InheritsFrom(const char *classname) const
virtual const char * GetTitle() const
virtual void Info(const char *method, const char *msgfmt,...) const
virtual TObject * RemoveAt(Int_t idx)
const char * Data() const
void Form(const char *fmt,...)
void SetOptTitle(Int_t tit=1)
virtual Bool_t IsFileInIncludePath(const char *name, char **fullpath=nullptr)
void Warning(UserClass p, const char *location, const char *va_(fmt),...)