Welcome to the Phat II HOWTO!

The main goal of Phat II was to separate out library dependencies, to
enhance speed, reliability, and future maintenance of the codebase.
PhatII consists of a number of libraries that can be dynamically loaded
into ROOT; this differs from the old Phat, where every single class in
Phat was linked into the 'phat' executable.

This will require a little extra work for users, since you will have to
know which library you need to load.  However the PhatII team has done
most of the work for you: all of the existing modules and supermodules
know which libraries they need and will load them automagically.
Additionally the libraries themselves know which libraries THEY depend
on and will also load them automagically.  This functionality is
described below the HOWTO.

Ok, here we go:

1. Check out a fresh PhatII wherever you like:

cvs -d /phobos/u/phobos/Repository co PhatII

2. Remove PHATHOME and PHAT2HOME from your startup scripts.

3. Point setphat in your startup scripts at your PhatII directory (this will set PHATHOME and PHAT2HOME automatically).

4. Execute your startup scripts (or log out and log in).

5. Configure and make:

cd $PHAT2HOME
./configure
make -j 2

and go have a cup of coffee or whatever.  Note that the first time you
run 'make' it will complain about a lot of *.d files not existing --
that's fine, those are the dependencies that need to be generated.

6. Add the loading of core libraries to your .rootlogon.C:

gSystem->Load("libGui.so"); // only needed for rootn.exe -b
gSystem->Load("$PHAT2HOME/lib/libPhatCore.so");

If you do not have a .rootlogon.C, create one.  It has the same structure as a macro, including an open brace at the start of file { and a closed one at the end of file }.  Then add the following line to your .rootrc (or create a .rootrc with this line if you do not have one):

Rint.Logon: $(HOME)/.rootlogon.C

7. Make the new module library, modulelib2.root:

rootn.exe (this is how we run phat 2)
.x $PHAT2HOME/macros/load_all_libs.C
.x $PHAT2HOME/macros/makelib.C
.q

8. Note that the new module library is of class TPhModuleLib2 (same basic methods as TPhModuleLib).  


How to load Modules/SuperModules:

Use the same methods as you did before, using ModuleLib2 instead of
ModuleLib:

TPhModuleLib2 *modlib = TPhModuleLib2::GetInstance();
TPhSuperModule *sm = modlib->GetSuperModule("onlineSM");
sm->StartAnalysis();
...


How to load Libraries for non-module analysis:

The class TPhModMapDynLib is where the most of the work happens.  You'll
need to look at the phat-based classes in your macro and determine which
library they belong to (trivial, since each directory corresponds to a
library).

For instance, if you need access to tracking routines, you'll need to
load libtracking.so.  You would add the following to your macro:

TPhModMapDynLib *dl = TPhModMapDynLib::GetInstance();
dl->LoadLibAndDeps("libtracking.so");

Note that you won't need to load the libraries that libtracking.so
depends on; TPhModMapDynLib will handle this for you.

Caveats:


Finally:

Please direct bug reports and questions to phbugs@mit.edu and/or
phsoft@mit.edu (if they are of more general interest).  We are using the
PHOBOS forums as a poor man's bug tracker; you can go there to check on
any updates:

http://pgate.lns.mit.edu/forums