-------------------------------------
Installation instructions for fastjet
-------------------------------------

As of version 2.2beta1-devel, fastjet has moved over to the use of
autotools (for a few versions thereafter, the old build system will be
retained in parallel, see below). 

First configure fastjet for your local machine and needs with

% ./configure [options]

The full list of possible options can be obtained with ./configure
--help; some useful ones include:

   --prefix=<where-you-wish-to-install>   (default=/usr/local)
		    specify location where FastJet will be installed
		    The library and plugins will be installed in
		    ${prefix}/lib while the headers will be placed in
		    ${prefix}/include/fastjet

   --disable-static
   --enable-shared  disable/enable contruction of static/shared 
                    libraries (static enabled by default, shared
                    disabled)

   --enable-cgal    enable use of CGAL libraries, which are needed 
                    for the N ln N version of the k_t algorithm and
                    N^{3/2} version of anti-k_t; relevant mainly if you
                    expect to have N>15000.

   --with-cgaldir=directory
                    For CGAL >= 3.4 tells it where to look for CGAL, if
                    it's not in a standard place.

   --with-cgalmakefile=makefile
                    For CGAL <= 3.3.x specify location of CGAL
                    Makefile (which contains info on correct
                    compilation flags when using CGAL).  In the
                    absence of this flag, the environment variable
                    $(CGAL_MAKEFILE) will be used to locate the CGAL
                    Makefile. If this is absent too, the default
                    location (/usr/share/cgal/cgal.mk) is used.

    --enable-allcxxplugins    (default=no)
                    enable all C++ plugins, but not the Fortran ones

    --enable-alllugins        (default=no)
                    enable all plugins, including the Fortran ones
                    (PxCone). 

    --enable-siscone          (default=yes)
                    enables the SISCone plugin

    --enable-cdfcones         (default=yes)
		    enables the CDFJetClu and CDFMidPoint plugins

    --enable-d0runiicone      (default=no)
                    enables the D0RunIICone (also known as
                    ILConeAlgorithm within D0)

    --enable-pxcone           (default=no)
		    enables the PxCone plugin (note this is in f77,
                    and so you may have to deal with C++/f77
                    compatibility issues)

    etc.            many more plugins available: --help option lists
                    them

Then compile and install:

% make
% make install

To check that your compilation is giving answers as expected, type

% make check

As well as installing the libraries and headers, "make install" also
installs ${prefix}/bin/fastjet-config; assuming this is in your path,
then you can compile a program that uses fastjet as follows

% g++ myprog.cc `fastjet-config --cxxflags` \
                `fastjet-config --libs --plugins` -o myprog

the --plugins option is only needed if you want access to plugins!
If shared libraries are built, they will be used by default. You can
still switch to the static libraries by adding the --shared=no option.
Other examples of the usage of this are given in the Makefile.alt file
in the example directory.


Note on the --enable-foo usage
------------------------------
each --enable-foo option can also be specified using
--enable-foo=yes. If, instead you want to disable the 
option, you can use --enable-foo=no or --disable-foo 

Note for SVN users -- developers only
------------------
If you download a subversion copy of FastJet (currently restricted to
the developers), you first need to generate all configuration
files. This is done by using

% autoreconf --install
% ./configure [configure option]

or, alternatively,

% ./autogen.sh [configure option]

Remarks: 
- a version of libtool >= 1.5 is needed. On Mac OSX the GNU libtool
  should be installed.
- adding '--force' to the list of autoreconf arguments will overwrite
  the INSTALL file with the default version
- using the autogen.sh script automatically runs ./configure 
  (with the specified options)

======================================================================
OLD (NON-AUTOTOOLS) BUILD SYSTEM
======================================================================
------------
Quick method
------------

Run the following to build FastJet and its plugins and to test them.

./test-static.sh

------------------
Longer description
------------------

To make it possible to have two build systems in parallel, the
makefiles for the old system are named makefile.static -- you should
tell make to use them explicitly with the "-f makefile.static" option.

As a first step the user should decide whether or not they want to
have access to the N ln N algorithms for the kt algorithm, based on
the Computational Geometry Algorithms Library (CGAL).

If the user does not wish to use it, he or she should ensure that the
Makefile in the top directory has the line

USE_CGAL = no

Otherwise it should read

USE_CGAL = yes

In that case the user should first download CGAL from
http://www.cgal.org/ and then compile and install it. Under linux, she
or he will have to ensure that an environment variable CGAL_MAKEFILE
points to the Makefile generated by CGAL at install time, containing
various definitions of locations of include files. CGAL will encourage
the user to set this variable during the install process.

Then in the src/ directory do

  make -f makefile.static
  make -f makefile.static install

which places the fastjet library in lib/. 

To build the cone jet-finder plugins, you should go to the plugin
directory and type
  
  make -f makefile.static
  make -f makefile.static pxcone      
                   // OPTIONAL --  if you want fortran pxcone plugin
                   // to be compiled too -- make sure you also set
                   // G77LIBDIR in the main Makefile

To run the example program cd to the example directory and do

  make -f makefile.static fastjet_example
  ./fastjet_example < data/single-event.dat

The output (without CGAL) should be 

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#--------------------------------------------------------------------------
#                      FastJet release 2.3-beta0
#            Written by M. Cacciari, G.P. Salam and G. Soyez            
#              http://www.lpthe.jussieu.fr/~salam/fastjet                  
#                                                                          
# Longitudinally invariant Kt, anti-Kt, and inclusive Cambridge/Aachen  
# clustering using fast geometric algorithms, with area measures and optional
# external jet-finder plugins.                                          
# Please cite Phys. Lett. B641 (2006) [hep-ph/0512210] if you use this code.
#                                                                          
# This package uses T.Chan's closest pair algorithm, Proc.13th ACM-SIAM 
# Symp. Discr. Alg, p.472 (2002), S.Fortune's Voronoi algorithm and code .
#-------------------------------------------------------------------------
Ran Longitudinally invariant kt algorithm with R = 1 and E scheme recombination
Strategy adopted by FastJet was N2Tiled

Printing inclusive jets with pt > 5 GeV
---------------------------------------
jet #        rapidity             phi              pt  n constituents
    0     -0.86730713      2.90511470    983.38727662       35
    1      0.22380471      6.04226446    910.28808604       52
    2     -1.16520657      6.04589034     70.78886044       48
    3     -2.34731970      1.25431317     10.72317440       18
    4     -1.19479918      0.80734483      8.29342805       15
    5     -1.71897064      4.01955399      8.16413672        9
    6     -4.71909257      4.09173629      5.57326514       15
    7      3.42713139      5.74362063      5.17254118       13
    8     -4.83615264      2.20502275      5.02711586       12

Printing exclusive jets with dcut = 25 GeV^2
--------------------------------------------
jet #        rapidity             phi              pt  n constituents
    0     -0.86730713      2.90511470    983.38727662       35
    1      0.22093749      6.02911715    898.62586887       29
    2     -1.16520657      6.04589034     70.78886044       48
    3      0.36257181      0.54763129     16.65531147       23
    4     -2.34731970      1.25431317     10.72317440       18
    5     -1.19479918      0.80734483      8.29342805       15
    6     -1.71897064      4.01955399      8.16413672        9
    7     -4.71909257      4.09173629      5.57326514       15
    8      3.42713139      5.74362063      5.17254118       13
    9     -4.83615264      2.20502275      5.02711586       12
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Additionally the example/ directory contains the following other
programs

ktjet_example		
	same example program, but written with ktjet, to illustrate
	similarities and differences with fastjet_example. For
	compilation to work please set the KTJET_INCLUDE and
	KTJET_LIBRARY variables in the fastjet main Makefile.

fastjet_timing
ktjet_timing
	programs for testing output and timings of the two programs --
	may be run with a variety of command-line options to control
	behaviour -- see the beginning of fastjet_timing.cc for
	further information.

fastjet_timing_plugins
        similar to fastjet_timing, but also works for plugins

fastjet_areas
	example program for evaluating the areas of the jets in 
	a single event (it reads in the same input file as fastjet_example)

fastjet_subtraction
	example program which uses the areas calculated by FastJet
	for each jet to perform the subtraction of the background generated
	by a number of pileup events. Sample input files for production
	at high luminosity at the LHC of a Z boson, an hypotetical Z', 
	or a dijet event with a ptmin = 100 GeV are in example/data/
 
fastjet_example_v1_interface
        same as fastjet_example, but using the (now deprecated) interface
	of FastJet v1.0. It still compiles correctly with v2.0, backward
	compatibility having been ensured.
