2009年7月8日水曜日

How to use pyROOT 応用編 その2

Gauss 分布のヒストグラムを書いてみよう

  1. #/bin/usr/env python  
  2.   
  3. import sys, math  
  4. import ROOT  
  5.   
  6. if __name__=='__main__':  
  7.   
  8.     cv  = ROOT.TCanvas("cv""Gauss Example"20010700500)  
  9.   
  10.     # create histogram( identify, Title, ?, xmin, xmax )  
  11.     hpx = ROOT.TH1F('hpx''px'100, -44)  
  12.   
  13.     for i in xrange(25000):  
  14.         px = ROOT.gRandom.Gaus()  
  15.         hpx.Fill(px)  
  16.   
  17.     hpx.Draw()  
  18.     cv.Update()  
  19.   
  20.     # export  
  21.     cv.Print("graphtest3.png")  


0 件のコメント:

コメントを投稿