TopTreeSetupInstructions

From T2B Wiki
Revision as of 12:29, 26 August 2015 by Maintenance script (talk | contribs) (Created page with " == Setting up TopTree code on the ''m/mtop'' machines == This page contains basic instructions on how to set up a coding environment for analysis of 'TopTrees', the dedic...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Setting up TopTree code on the m/mtop machines

This page contains basic instructions on how to set up a coding environment for analysis of 'TopTrees', the dedicated data format for the group's Top Quark analyses. The instructions here are rather generic, for a list of tips on setting up an analysis of 2012 8TeV data based on TopTrees produced with CMSSW_53X, try this page TipsFor2012.


The assumed shell is bash and the instructions refer to checking out code from the TopBrussels repository on GitHub. The CVS days are over.

Firstly, do not attempt to compile code on m1 as it is a 32-bit machine. For development, one should use: m0, m2, m3 or mtop.


ROOT setup

add the following to your login scripts. There are several root versions around, make sure you are using the correct one!


echo "Will set root_old"
export ROOTSYS="/user/cmssoft/root_5.32.00/root"
export PATH=$PATH:$ROOTSYS/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ROOTSYS/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/lib

This will set up ROOT 5.32 (the ROOT version used to produce the latest TopTrees (Jan '14)). If you want to use TMVA with ROOT v5.34 please get in touch for instructions (james.keaveney@SPAMNOT_VUB_AC_BE).


Git setup

It is probably also useful to include cvs settings (also in login scripts)

Setting up TopTreeProducer (package containing the class defintions for objects used in TopTrees and the software for theor automated production.)

mkdir TopBrussels
cd TopBrussels
git init TopTreeProducer
cd TopTreeProducer
git remote add origin git@github.com:TopBrussels/TopTreeProducer.git
git fetch origin
git checkout -b master origin/master
git checkout master

Setting up TopTreeAnalysisBase (package containing numerous essential tools for your analysis (JES tools, btagging weighting, PU re-weighting etc...))

cd ..
git init TopTreeAnalysisBase
cd TopTreeAnalysisBase/ 
git remote add origin git@github.com:TopBrussels/TopTreeAnalysisBase.git
git fetch origin
git checkout master

Setting up TopTreeAnalysis (package containg many examples of analysis macros, most users are making dedicated pacages for their analyses e.g. TopBrussels/FCNCAnalysis, consider doing the same).

cd ..
git init TopTreeAnalysis 
cd TopTreeAnalysis
git remote add origin git@github.com:TopBrussels/TopTreeAnalysis.git 
git fetch origin
git checkout master


first time compilation

The first time you need to check out the various packages and compile some libraries.

The default location for the root libraries is ~/lib, so make sure this directory exists, i.e, do

mkdir ~/lib


The 'data container' classes are in TopTreeProducer, and you should compile those (this only needs to be done once) First do:

cd TopBrussels/TopTreeProducer/src

Then:

make 
  1. there are LOADS of warnings ... only check for errors...

The main analysis classes are in TopTreeAnalysisBase, and you should compile these as well


First do:

cd ../../TopTreeAnalysisBase

Then:

make     # there are LOADS of warnings... only check for errors...


this make depends on the platform you work on!


Normal compilation and code development

Make sure your root is set up to the same version as the initial installation.


A working example (TopTreeAnalysis/macros/AnalysisSkeleton.cc) is maintained which should give the user a nice overview of how the typical macro is structured and what tools are available in the framework.

To compile this example, issue the following command:

g++ -g -L ~/lib -I ../../ -l TopTreeAnaContent53 -l TopTreeAna53 -l MLP -l TreePlayer -l TMVA -l XMLIO -I <tt>root-config --incdir</tt> <tt>root-config --libs</tt> AnalysisSkeleton.cc -o MACRO

It is a good idea to save this command or alias it.


Then to run the example:

./MACRO


The example will process some TTJets MC as an example and should provide a root file with some plots which you may browse.


The macros in this directory are intended to be gcc compiled c++ programs with root linked in. At some point you will want to edit an existing macro or develop your own macro and subsequently compile and link it. The compilation command for a macro with name YOURMACRO.cc is as follows (this command assumes you have used TAG=CMSSW_53X when checking out the TopBrussels packages). When you decide to develop your own macro, we advise that you make your own analysis directory in (TopBrussels/TopTreeAnalysis/MYANALYSIS) and do not work in the macros directory.

Example codes: There are many example macros in TopTreeAnalysis/macros, these can serve as examples how to use specific tools etc. but we do not at all guarantee that these will work out of the box (except for AnalysisSkeleton.cc).


If you do want to try build some of these macros, a simple compile-all script exists:

Simple compile-all script

I quickly wrote the following script (bash) to compile all (.cc) macros:

#!/bin/bash

for ccfile in ./*.cc
do
    ofile=<tt>echo $ccfile |sed 's/\.cc$//g'</tt>
    echo "compiling : " $ccfile ", executible name: " $ofile
    g++ -g -L ~/lib -I ../../ -l TopTreeAnaContent53 -l TopTreeAna53 -l MLP -l TreePlayer -l TMVA -l XMLIO -I <tt>root-config --incdir</tt> <tt>root-config --libs</tt> $ccfile -o $ofile
done

If you get errors of type cannot find dynamic library TopTree.... you might want to make sure that the TopTreeAna* commands that you give to g++ actually correspond to the libs in ~/lib.



Template:TracNotice