この文書の現在のバージョンと選択したバージョンの差分を表示します。
両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン | ||
ja:root:tf1 [2014/08/10 16:26] kota [基本] |
ja:root:tf1 [2017/08/30 14:38] (現在) kota |
||
---|---|---|---|
ライン 2: | ライン 2: | ||
---- | ---- | ||
===== 基本 ===== | ===== 基本 ===== | ||
+ | <code cpp> | ||
TF1 *func1 = nes TF1("func1" , "x*sin(x)" , x_min , x_max);//x_min,x_maxは定義域 | TF1 *func1 = nes TF1("func1" , "x*sin(x)" , x_min , x_max);//x_min,x_maxは定義域 | ||
TF1 *func2 = nes TF1("func2" , "gaus" , x_min , x_max);// システム定義関数を使うことができる | TF1 *func2 = nes TF1("func2" , "gaus" , x_min , x_max);// システム定義関数を使うことができる | ||
TF1 *func3 = nes TF1("func3" , "gaus(0)+pol1(3)" , x_min , x_max);// 複数使う場合は最初のパラメータの番号を指定する | TF1 *func3 = nes TF1("func3" , "gaus(0)+pol1(3)" , x_min , x_max);// 複数使う場合は最初のパラメータの番号を指定する | ||
- | | + | </code> |
==== システム定義関数(TMath::) ==== | ==== システム定義関数(TMath::) ==== | ||
ライン 17: | ライン 17: | ||
+ | ===== function ===== | ||
+ | <code cpp> | ||
+ | void TF1::Draw(Option_t *option="") | ||
+ | void TF1::Print(Option_t *option="")//パラメータなどを出力 | ||
+ | Double_t TF1::Eval(Double_t x, Double_t y=0, Double_t z=0, Double_t t=0)//あるxのときのyの値を返す | ||
+ | Double_t TF1::Integral(Double_t a, Double_t b, Double_t epsrel=1.e-12)//aからbまで積分 | ||
+ | Double_t TF1::Derivative(Double_t x, Double_t *params=0, Double_t epsilon=0.001)//xにおける微分を得る | ||
+ | void TF1::SetTitle(const char *title = "")//関数・軸のタイトルを設定 | ||
+ | | ||
+ | void TF1::SetParName(Int_t ipar, const char *name) | ||
+ | void TF1::SetParNames(const char *name0="p0", const char *name1="p1", ..., const char *name10="p10") | ||
+ | |||
+ | void TF1::SetParameter(Int_t param, Double_t value) | ||
+ | void TF1::SetParameter(const TString &name, Double_t value) | ||
+ | void TF1::SetParameters(const Double_t *params) | ||
+ | void TF1::SetParameters(Double_t p0, Double_t p1, Double_t p2=0,..., Double_t p10=0) | ||
+ | |||
+ | void TF1::SetParError(Int_t ipar, Double_t error)//指定したパラメータに値を代入 | ||
+ | void TF1::SetParErrors(const Double_t *errors)//全パラメータを配列で代入。配列要素数は少なくともパラメータ数分は必要 | ||
+ | |||
+ | void TF1::SetParLimits(Int_t ipar, Double_t parmin, Double_t parmax)//指定したパラメータの可動範囲を指定(0,0にすると解放) | ||
+ | void TF1::ReleaseParameter(Int_t ipar)//SetParLimitsで指定した可動範囲を解放(SetParLimits(ipar,0,0)と同じ) | ||
+ | |||
+ | void TF1::FixParameter(Int_t ipar, Double_t value) | ||
+ | |||
+ | void TF1::SetRange(Double_t xmin, Double_t xmax)//描画範囲を指定 | ||
+ | |||
+ | |||
+ | Double_t TF1::GetParameter(Int_t ipar)//指定したパラメータの値を返す | ||
+ | Double_t TF1::GetParameter(const TString &name)//パラメータの名前でも指定可能 | ||
+ | Double_t* TF1::GetParameters()//全パラメータを配列にして返す | ||
+ | Double_t TF1::GetParameters(Double_t *params)//渡した配列にパラメータを詰める | ||
+ | | ||
+ | Double_t TF1::GetParError(Int_t ipar)//指定したパラメータのエラーを返す | ||
+ | Double_t* TF1::GetParErrors()//全パラメータのエラーを配列にして返す | ||
+ | |||
+ | void TF1::GetParLimits(Int_t ipar, Double_t &parmin, Double_t &parmax) | ||
+ | char* TF1::GetParName(Int_t ipar) | ||
+ | |||
+ | Double_t TF1::GetChisquare()//fitのχ2を返す | ||
+ | Double_t TF1::GetNDF()//fitの自由度を返す | ||
+ | </code> | ||
===== 使い方 ===== | ===== 使い方 ===== | ||
+ | <code cpp> | ||
func->Draw(); | func->Draw(); | ||
func->Print();//パラメータを出力 | func->Print();//パラメータを出力 | ||
ライン 26: | ライン 69: | ||
func->SetLineStyle(style); | func->SetLineStyle(style); | ||
func->SetLineWidth(width); | func->SetLineWidth(width); | ||
- | func->SetTitle("Title"); | + | func->SetTitle("fffffff;xxxx;yyyy");// functionTitle ; XaxisTitle : YaxisTitle |
func->SetParameters(p0,p1,...); | func->SetParameters(p0,p1,...); | ||
func->SetParName(p_num,p_name); | func->SetParName(p_num,p_name); | ||
func->SetParNames(p0_name,p1_name,...); | func->SetParNames(p0_name,p1_name,...); | ||
+ | </code> |