These steps should guide you towards creating a new package. Feel free to add and correct.

Creating a new package in SFrame

A new package is easily created using the scripts that are provided by SFrame. In your analysis directory type

sframe_new_package.sh NewPackageName

Changing to that directory and typing make compiles the new, but already functional package.

Incorporating external packages

In order to shield users from changes of external packages and in order to avoid code duplication, external packages that are used by SFrame packages should be wrapped/interfaced by providing a tool. An example of that can be seen in MuonCPTools. External code can be written in very different ways, but your colleagues won't need to worry about this if you write a nice interface. Preferrably those tools should use the DESY Particles as arguments (and not only e.g. muon.eta()) in case for instance the muon scale factors are additionally binned in phi in the next iteration. External packages shouldn't be added to our SVN but instead SVN hooks should be used that will automatically trigger the check-out of a dedicated external package when the SFrame package is checked out. This is achieved by typing in your package dir (that already has to be in SVN. For testing/first development just perform the check-out by hand):

svn propedit svn:externals .

This will open your preferred text editor where you can then type things like:

SubDirToCheckOutTo   svn+ssh://svn.cern.ch/reps/...PathToExternalPackage.../trunk

for instance:

PileupReweightingPackage svn+ssh://svn.cern.ch/reps/atlasoff/PhysicsAnalysis/AnalysisCommon/PileupReweighting/trunk

Usually it is better to not add the trunk but a certain tag.

When adding these hooks, please always add "Package" to the external package check-out folder so that it is clear to everyone that this is an external package that shouldn't be touched (e.g. check-out folder set to PileupReiweightingToolPackage and not PileupReiweightingTool). This is also important as one will have to create some soft links in order to make the external package compile within the SFrame package. This should be done within a setup script. Please refer to MuonCPTools for an example.

Adding the new package to SVN

Let's assume your package now does what it's supposed to do. Then it is time to share it with everyone else. Instead of using svn import, consider using svn add because that provides you with better of control of what is being added. The first steps should be the following:

mv MyNewPackage MyNewPackage.local
svn mkdir svn+ssh://svn.cern.ch/reps/desyatfw/CommonAnalysis/MyNewPackage -m "creating new package MyNewPackage"
svn mkdir svn+ssh://svn.cern.ch/reps/desyatfw/CommonAnalysis/YourChoice/MyNewPackage -m "creating new package MyNewPackage"
svn mkdir svn+ssh://svn.cern.ch/reps/desyatfw/CommonAnalysis/YourChoice/MyNewPackage/trunk -m "creating trunk for new package MyNewPackage"
svn mkdir svn+ssh://svn.cern.ch/reps/desyatfw/CommonAnalysis/YourChoice/MyNewPackage/tags -m "creating tags for new package MyNewPackage"
svn mkdir svn+ssh://svn.cern.ch/reps/desyatfw/CommonAnalysis/YourChoice/MyNewPackage/branches -m "creating branches for new package MyNewPackage"
svn co svn+ssh://svn.cern.ch/reps/desyatfw/CommonAnalysis/YourChoice/MyNewPackage/trunk MyNewPackage

Then copy the needed files from your local copy to the working directory.

Add the external package hooks if needed as described above.

svn update
source setup.sh
make

Check if your package compiles.

make distclean

Now add the needed files step by step. Make sure you only add the cxx files from src that are needed (e.g. no Dict files). Same applies for the include directory (don't forget the LinkDef file). Also don't add the dep directory. The only other directories you might need to add are config and proof. Once you've added the desired files type

svn commit -m "initial revision of MyNewPackage"

Testing the new package

Delete your checked-out copy of MyNewPackage and check it out again:

svn co svn+ssh://svn.cern.ch/reps/desyatfw/CommonAnalysis/YourChoice/MyNewPackage/trunk MyNewPackage
cd MyNewPackage
source setup.sh
make

Hopefully it's working :-)

ATLAS: Projects/TopPhysicsInternal/AnalysisFramework/AddingNewPackages (last edited 2011-07-07 15:33:36 by ChristophWasicki)