Japanese page is here.
Ruby/CERNLIB is a collection of Ruby extension libraries to access various CERN Program Library, such as HBOOK, HIGZ, MATHLIB and so on.
Ruby/CERNLIB ver.0.3 release. (2003/12/13)
CERNLIB and PAW are still widely used, although there are several projects with the aim to replace them, for example, LHC++, ROOT, AIDA. In order to use CERNLIB routines, however, a user have to spend long compiling and linking time. Althogh PAW has its own macro language, KUMAC, it has only very limited features as a programing language (consider to read variously-formatted text files and to fill a N-tuple).
Ruby/CERNLIB provides much more conveinient way to use CERNLIB routines with the power of Ruby. This is quite useful for small programs and prototyping. For example, you can calculate Clebsch-Gordan coefficient <j1,j2,m1,m2|j1,j2,J,M> = <3/2,1,3/2,-1|3/2,1,5/2,1/2> even with one-liner on command line:
% ruby -r cern/mathlib -e 'p CERN::Mathlib.dtclgn(3,2,5,3,-2,1)'
Currently, this package contains following modules.
Here is a very simple script to create a histogram.
require 'cern/hbook'
include CERN::HBook
hlimit NWPAWC
hbook1 10, 'test histogram', 10, 0.0, 10.0, 0.0
1000.times do
x = rand * 10
hfill 10, x, 0.0, 1.0
end
hrput 10, 'testhist.rz', 'N'
This code using HBook2 module is equivalent to above:
require 'cern/hbook2'
include CERN::HBook2
hist = Hist1.new(10, 'test histogram', 10, 0.0, 10.0)
1000.times do
x = rand * 10
hist << x
end
hist.write 'testhist.rz'
current version: ruby-cernlib-0.3.tar.gz
My development environment:
Ruby's term.
back to my Ruby page(Japanese)
back to my home page(Japanese)
TAKAHASHI Hitoshi (hitoshi.takahashi@kek.jp)