There are a few approaches to writing your package:
-
Adapt a pre-existing package. If an existing package
provides similar or related functionality, eg. if you're
implementing the detector B analogue of an existing
detector A package, you can use the
existing package as a starting point. Consult the owner as to
whether it is a good, up to date starting point.
-
Extend an existing package. In some cases it may be
better to incorporate the functionality you need in an existing
package. Review what's already there.
-
Create an entirely new package. If you propose to create
a new package, the procedure is
documented here.
For all of these options, the first step is to check out the package
you're using as a starting point. If you're starting from scratch,
use
StRoot/St_TLA_Maker
as a starting point (do not use the non-standard
name of this package as a model; it's name is historical baggage and if
we were to name it today it would be StTemplateMaker). eg.
cvs co StRoot/St_TLA_Maker
.
Set up directories needed
- Go to your work area, e.g.
cd ~/workdir
- Check out your starting point package, eg.
cvs co StRoot/St_TLA_Maker
.
- Create a directory for your package, eg.
mkdir StRoot/StMyMaker
(packages to be used in
the STAR framework live under StRoot/).
- Copy files from your starting point package to your new package
directory. Do not just rename the starting point package's
directory name.
- Note that, with infrequent exceptions, package directories should
have no subdirectories except for the doc directory which is
essential. See the
tutorial on documenting packages regarding
the required documentation and README file.
- Rename and edit files appropriately in your package directory.
When you are ready to compile,
use
cons +StMyPackage
.
Most packages are structured as Makers, modular components that
can be included in a processing chain within the framework. The
template package St_TLA_Maker documents the interface that the Maker
scheme provides you with. You fill in methods such as Init(), Make() (the
'event loop' step), InitRun(), etc.
Be sure to include and maintain a descriptive README file and documentation
in your package. See the documentation tutorial.
To run your package
Assuming your package is a Maker,
you must set up a macro that incorporates your package into a chain
running within the framework in order to run it. In the macro you must
load your shared library (and any others needed), create an instance
of your Maker, add it to a chain, and run the chain. A standard example
to follow is StRoot/macros/analysis/doEvents.C.
You should create this macro and work at the top level of your working
directory, not down in your package directory.
Committing your package to CVS
To have your package added to the CVS repository once it is approved,
consult the STAR software librarian, Lidia Didenko, didenko@bnl.gov.