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
ja:root:tdatime [GiriWiki]

ユーザ用ツール

サイト用ツール


ja:root:tdatime

差分

この文書の現在のバージョンと選択したバージョンの差分を表示します。

この比較画面にリンクする

次のリビジョン
前のリビジョン
ja:root:tdatime [2016/12/03 11:41]
kota 作成
ja:root:tdatime [2017/04/06 00:19] (現在)
kota
ライン 1: ライン 1:
 ====== TDatime ====== ====== TDatime ======
- 
  
 ---- ----
 +正直あんまり便利じゃないかも。\\
 +時間を横軸にしたりするときに使えるかも。
  
-<​code ​c+#include <​TDatime.h>​ 
-  //  ​gStyle->​SetTimeOffset(-788918400);                                            + 
-  //  gStyle->​SetTimeOffset(788918400); ​                                           +<​code ​cpp
 +  ​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のフォーマットで出力 
 + 
 +</​code>​ 
 + 
 +<code cpp> 
 +  //  gStyle->​SetTimeOffset(-788918400);// <- なぜかこれではうまくいかなかったので其々の値からoffsetをいちいち引くことにする 
 +  UInt_t Offset = 788918400;
   TDatime *dateBegin = new TDatime(2010,​1,​1,​0,​0,​0);​   TDatime *dateBegin = new TDatime(2010,​1,​1,​0,​0,​0);​
   TDatime *dateEnd ​  = new TDatime(2011,​1,​1,​0,​0,​0);​   TDatime *dateEnd ​  = new TDatime(2011,​1,​1,​0,​0,​0);​
   TCanvas *c = new TCanvas("​c","​c",​1300,​500);​   TCanvas *c = new TCanvas("​c","​c",​1300,​500);​
-  ​//  TH1F *frame = c->​DrawFrame(dateBegin->​Convert(),​0,​dateEnd->​Convert(),​1); ​     +  TH1F *frame = c->​DrawFrame(dateBegin->​Convert()-Offset,​0,​dateEnd->​Convert()-Offset,1); 
-  UInt_t Offset = 788918400;​ +  // ​ ​frame->​GetXaxis()->​SetTimeOffset(788918400);​// <- これでもうまくいかなかった
-  ​TH1F *frame = c->​DrawFrame(dateBegin->​Convert()-Offset,​0,​dateEnd->​Convert()-Offs\ +
-et,1); +
-  frame->​GetXaxis()->​SetTimeOffset(788918400);​+
   frame->​GetXaxis()->​SetNdivisions(505);​   frame->​GetXaxis()->​SetNdivisions(505);​
   frame->​GetXaxis()->​SetTimeDisplay(1);​   frame->​GetXaxis()->​SetTimeDisplay(1);​
-  frame->​GetXaxis()->​SetTimeFormat("#​splitline{%y/​%m/​%d}{%H:​%M}"​);​+  frame->​GetXaxis()->​SetTimeFormat("#​splitline{%Y/​%m/​%d}{%H:​%M}"​);​//#​splitline{}{}で二段に。%yは年の下2桁のみ表示
   frame->​GetXaxis()->​SetLabelOffset(0.02);​   frame->​GetXaxis()->​SetLabelOffset(0.02);​
   gPad->​Modified();​   gPad->​Modified();​
-test 
 </​code>​ </​code>​
ja/root/tdatime.1480765307.txt.gz · 最終更新: 2016/12/03 11:41 by kota