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:wantto4 [GiriWiki]

ユーザ用ツール

サイト用ツール


ja:root:wantto4

差分

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

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

両方とも前のリビジョン 前のリビジョン
次のリビジョン
前のリビジョン
ja:root:wantto4 [2015/04/01 09:30]
kota
ja:root:wantto4 [2018/07/27 00:57] (現在)
kota
ライン 1: ライン 1:
-===== Progress Bar を表示させたい =====+===== イベントループの進行状況を表示させたい =====
  
-Tree から1イベントずつ取ってきて処理するような解析をよくやるが、その時にprogress bar を表示させたい。 ​+Tree から1イベントずつ取ってきて処理するような解析をよくやるが、その時にイベントループの進行状況を表示させたい。 ​
  
 <code c> <code c>
  
-   ​Long64_t ​nentries ​= tree->​GetEntries(); ​   // Loopさせるイベント数を取得 +   const Long64_t ​nentry ​= tree->​GetEntries(); ​   // Loopさせるイベント数を取得 
-   cout << "# events : " << nentries << endl; +   const Long64_t ​n_100  ​nentry/100;      // イベント数÷100 を定義しておく 
-   Long64_t ​in Long64_t(nentries/100);      // イベント数÷100 を定義しておく+   cout << "# events : " << nentry << endl;
  
-  for (Long64_t ​jentry=0; jentry<nentries;jentry++) { +  for( Long64_t ​ientry ​= 0 ; ientry ​nentry ​; ++ientry ​){ 
- +     if( nentry>​100 ){ 
-     if((jentry ​in == 0) && (jentry ​!= 0)){ +       if( (ientry%n_100==0) && (ientry!=0) ){ 
-       ​if( jentry ​% (in * 10) == 0 ) +         ​if( ientry ​% (n_100 * 10) == 0 ) 
-  std::cerr << (jentry ​in) << "% processed. ​ " ​ << std::endl; // 10%毎に表示、改行。 +    std::cerr << (ientry ​n_100) << "% processed. ​ " ​ << std::endl; // 10%毎に表示、改行。 
-       ​else if( jentry ​in < 10 ) +         ​else if( ientry ​n_100 < 10 ) 
-  std::cerr << " " << (jentry ​in) << "​% ​  "​ << std::flush; // 1%毎に表示。改行なし。1桁数(1〜9)の前に空白。 +    std::cerr << " " << (ientry ​n_100) << "​% ​  "​ << std::flush; // 1%毎に表示。改行なし。1桁数(1〜9)の前に空白。 
-       ​else +         ​else 
-  std::cerr << (jentry ​in) << "​% ​  "​ << std::​flush; ​       // 1%毎に表示。改行なし。+    std::cerr << (ientry ​n_100) << "​% ​  "​ << std::​flush; ​       // 1%毎に表示。改行なし。 
 +       }
      }      }
-     +     tree->​GetEntry(ientry);​
      ...      ...
 </​code>​ </​code>​
  
 coutじゃなくてcerrを使うと良いとかどうとか。。。 coutじゃなくてcerrを使うと良いとかどうとか。。。
ja/root/wantto4.1427880601.txt.gz · 最終更新: 2015/04/01 09:30 by kota