# get whizard (latest release)
wget http://www.hepforge.org/archive/whizard/whizard-2.4.0.tar.gz
tar -xzf whizard-2.4.0.tar.gz
cd whizard-2.4.0
# or, in principle,  (head version):
mkdir whizard-2.4.0-head-rev7784
cd whizard-2.4.0-head-rev7784
svn co http://whizard.hepforge.org/svn/trunk/ .
bash build_master.sh
autoreconf
# ... but there one needs to  at least
#  wget http://ftp.gnu.org/gnu/automake/automake-1.11.6.tar.gz
#  wget http://ftp.halifax.rwth-aachen.de/gnu/libtool/libtool-2.4.2.tar.gz
#  wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.65.tar.gz
# and un-tar,  configure --prefix=/nfs/dust/ilc/user/berggren/whiz2-tests/gnutools/,
# make install for each of them, and then pathhead /nfs/dust/ilc/user/berggren/whiz2-tests/gnutools/bin/
# to get bleeding-edge enough versions to satisfy the whizards
# also:
#  wget ftp://www.eecs.harvard.edu/pub/nr/noweb.tgz
# untar, go dowen to the src subdirectory, edit the Makefile, as per the INSTALL
# file, and make all install.
#
# define LCIO. NB that whizard's config looks in LCIO_DIR, while
# the ilcsodt-setup defines LCIO (without _DIR)!
. /afs/desy.de/user/b/berggren/scripts/ilc_soft_setup-2 "" 48
export LCIO_DIR=$LCIO
# on the NAF, the default OCaml is too old, so I use
# a newer version from http://pauillac.inria.fr/ocaml/
export PATH=`pwd`/../ocaml-4.01.0/usr/local/bin:$PATH
#
./configure --prefix=`pwd`/install/ --enable-lcio
make
make install
# 
tar -xzf rundir.tar.gz
cd rundir

../install/bin/whizard dbd-2n4f-transl.sin
bash tidy-compile
bash setup-sub
cd sub
# pre-integrate:
../../install/bin/whizard -e  'logical ?preint = true sqrts = 500 GeV beams_pol_density = @(1),@(-1)'  <( cat dbd-2n4f-transl.sin ; echo 'integrate ( zzorww_h0udud,zzorww_h0cscs){ ?polarized_events = true ?vis_channels = true}' )
bash ../tidy-integrate 
rm zzorww_h0udud_m1.vg zzorww_h0cscs_m1.vg
# integrete
../../install/bin/whizard -e  'sqrts = 500 GeV beams_pol_density = @(1),@(-1)'  <( cat dbd-2n4f-transl.sin ; echo 'integrate ( zzorww_h0udud,zzorww_h0cscs){ ?polarized_events = true }' )
bash ../tidy-integrate 
grep "Integral   ="  *.log
# events:
../../install/bin/whizard -e  'luminosity = 5  sqrts = 500 GeV beams_pol_density = @(1),@(-1) $sample = "zzorww_h"'  <( cat dbd-2n4f-transl.sin ; echo 'simulate (zzorww_h0udud,zzorww_h0cscs){ ?polarized_events = true }' )
bash ../tidy-run
# look at the events
~/activity/analysis_methods/stdhep/std2pyj-sl6 zzorww_h.0.stdhep 2 1 1
~/activity/analysis_methods/stdhep/std2pyj-sl6 zzorww_h.0.stdhep 2 1 -2
# look at history and diagrams:
evince zzorww_h0udud-history.pdf 
evince zzorww_h0cscs-history.pdf
evince zzorww_h0cscs_i1_phs.pdf
evince zzorww_h0udud_i1_phs.pdf

  