Deprecated: Array and string offset access syntax with curly braces is deprecated in /mnt/hep_web/hep_web/member/n-kota/dokuwiki/inc/init.php on line 542
====== TDatime ======
----
正直あんまり便利じゃないかも。\\
時間を横軸にしたりするときに使えるかも。
#include
TDatime::TDatime()// 引数なしだと現在時刻をとる。
TDatime::TDatime(Int_t year, Int_t month, Int_t day, Int_t hour, Int_t min, Int_t sec)
TDatime::Set(Int_t year, Int_t month, Int_t day, Int_t hour, Int_t min, Int_t sec)
UInt_t TDatime::Convert(Bool_t toGMT=kFALSE)// UNIX time で出力
char* TDatime::AsString()//出力
char* TDatime::AsSQLString()//SQLのフォーマットで出力
// gStyle->SetTimeOffset(-788918400);// <- なぜかこれではうまくいかなかったので其々の値からoffsetをいちいち引くことにする
UInt_t Offset = 788918400;
TDatime *dateBegin = new TDatime(2010,1,1,0,0,0);
TDatime *dateEnd = new TDatime(2011,1,1,0,0,0);
TCanvas *c = new TCanvas("c","c",1300,500);
TH1F *frame = c->DrawFrame(dateBegin->Convert()-Offset,0,dateEnd->Convert()-Offset,1);
// frame->GetXaxis()->SetTimeOffset(788918400);// <- これでもうまくいかなかった
frame->GetXaxis()->SetNdivisions(505);
frame->GetXaxis()->SetTimeDisplay(1);
frame->GetXaxis()->SetTimeFormat("#splitline{%Y/%m/%d}{%H:%M}");//#splitline{}{}で二段に。%yは年の下2桁のみ表示
frame->GetXaxis()->SetLabelOffset(0.02);
gPad->Modified();