<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://t2bwiki.iihe.ac.be/index.php?action=history&amp;feed=atom&amp;title=TopTreeSetupInstructions</id>
	<title>TopTreeSetupInstructions - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://t2bwiki.iihe.ac.be/index.php?action=history&amp;feed=atom&amp;title=TopTreeSetupInstructions"/>
	<link rel="alternate" type="text/html" href="https://t2bwiki.iihe.ac.be/index.php?title=TopTreeSetupInstructions&amp;action=history"/>
	<updated>2026-04-20T11:10:40Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://t2bwiki.iihe.ac.be/index.php?title=TopTreeSetupInstructions&amp;diff=290&amp;oldid=prev</id>
		<title>Maintenance script: Created page with &quot; == Setting up TopTree code on the &#039;&#039;m/mtop&#039;&#039; machines ==   This page contains basic instructions on how to set up a coding environment for analysis of &#039;TopTrees&#039;, the dedic...&quot;</title>
		<link rel="alternate" type="text/html" href="https://t2bwiki.iihe.ac.be/index.php?title=TopTreeSetupInstructions&amp;diff=290&amp;oldid=prev"/>
		<updated>2015-08-26T12:29:13Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot; == Setting up TopTree code on the &amp;#039;&amp;#039;m/mtop&amp;#039;&amp;#039; machines ==   This page contains basic instructions on how to set up a coding environment for analysis of &amp;#039;TopTrees&amp;#039;, the dedic...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
== Setting up TopTree code on the &amp;#039;&amp;#039;m/mtop&amp;#039;&amp;#039; machines == &lt;br /&gt;
&lt;br /&gt;
This page contains basic instructions on how to set up a coding environment for analysis of &amp;#039;TopTrees&amp;#039;, the dedicated data format for the&lt;br /&gt;
group&amp;#039;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&lt;br /&gt;
produced with CMSSW_53X, try this page TipsFor2012.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The assumed shell is bash and the instructions refer to checking out code from the TopBrussels repository on GitHub. The CVS &lt;br /&gt;
days are over.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== ROOT setup ====&lt;br /&gt;
&lt;br /&gt;
add the following to your login scripts. There are several root versions around, make sure you are using the correct one!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Will set root_old&amp;quot;&lt;br /&gt;
export ROOTSYS=&amp;quot;/user/cmssoft/root_5.32.00/root&amp;quot;&lt;br /&gt;
export PATH=$PATH:$ROOTSYS/bin&lt;br /&gt;
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ROOTSYS/lib&lt;br /&gt;
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/lib&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will set up ROOT 5.32 (the ROOT version used to produce the latest TopTrees (Jan &amp;#039;14)).&lt;br /&gt;
If you want to use TMVA with ROOT v5.34 please get in touch for instructions (james.keaveney@SPAMNOT_VUB_AC_BE).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Git setup ====&lt;br /&gt;
&lt;br /&gt;
It is probably also useful to include cvs settings (also in login scripts)&lt;br /&gt;
&lt;br /&gt;
Setting up TopTreeProducer (package containing the class defintions for objects used in TopTrees and the software for theor automated production.)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir TopBrussels&lt;br /&gt;
cd TopBrussels&lt;br /&gt;
git init TopTreeProducer&lt;br /&gt;
cd TopTreeProducer&lt;br /&gt;
git remote add origin git@github.com:TopBrussels/TopTreeProducer.git&lt;br /&gt;
git fetch origin&lt;br /&gt;
git checkout -b master origin/master&lt;br /&gt;
git checkout master&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Setting up TopTreeAnalysisBase (package containing numerous essential tools for your analysis (JES tools, btagging weighting, PU re-weighting etc...))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd ..&lt;br /&gt;
git init TopTreeAnalysisBase&lt;br /&gt;
cd TopTreeAnalysisBase/ &lt;br /&gt;
git remote add origin git@github.com:TopBrussels/TopTreeAnalysisBase.git&lt;br /&gt;
git fetch origin&lt;br /&gt;
git checkout master&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
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).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd ..&lt;br /&gt;
git init TopTreeAnalysis &lt;br /&gt;
cd TopTreeAnalysis&lt;br /&gt;
git remote add origin git@github.com:TopBrussels/TopTreeAnalysis.git &lt;br /&gt;
git fetch origin&lt;br /&gt;
git checkout master&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== first time compilation ====&lt;br /&gt;
&lt;br /&gt;
The first time you need to check out the various packages and compile some libraries.&lt;br /&gt;
&lt;br /&gt;
The default location for the root libraries is ~/lib, so make sure this directory exists, i.e, do&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir ~/lib&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;data container&amp;#039; classes are in TopTreeProducer, and you should compile those (this only needs to be done once)&lt;br /&gt;
First do:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd TopBrussels/TopTreeProducer/src&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
# there are LOADS of warnings ... only check for errors...&lt;br /&gt;
&lt;br /&gt;
The main analysis classes are in TopTreeAnalysisBase, and you should compile these as well&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
First do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd ../../TopTreeAnalysisBase&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make     # there are LOADS of warnings... only check for errors...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
this make depends on the platform you work on!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Normal compilation and code development ===&lt;br /&gt;
&lt;br /&gt;
Make sure your root is set up to the same version as the initial installation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A working example (TopTreeAnalysis/macros/AnalysisSkeleton.cc) is maintained which should give the user a nice&lt;br /&gt;
overview of how the typical macro is structured and what tools are available in the framework.&lt;br /&gt;
&lt;br /&gt;
To compile this example, issue the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
g++ -g -L ~/lib -I ../../ -l TopTreeAnaContent53 -l TopTreeAna53 -l MLP -l TreePlayer -l TMVA -l XMLIO -I &amp;lt;tt&amp;gt;root-config --incdir&amp;lt;/tt&amp;gt; &amp;lt;tt&amp;gt;root-config --libs&amp;lt;/tt&amp;gt; AnalysisSkeleton.cc -o MACRO&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is a good idea to save this command or alias it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then to run the example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./MACRO&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The example will process some TTJets MC as an example and should provide a root file with some plots which&lt;br /&gt;
you may browse.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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 &amp;lt;tt&amp;gt;YOURMACRO.cc&amp;lt;/tt&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
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).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you do want to try build some of these macros, a simple compile-all script exists:&lt;br /&gt;
==== Simple compile-all script ====&lt;br /&gt;
&lt;br /&gt;
I quickly wrote the following script (bash) to compile all (.cc) macros:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
for ccfile in ./*.cc&lt;br /&gt;
do&lt;br /&gt;
    ofile=&amp;lt;tt&amp;gt;echo $ccfile |sed &amp;#039;s/\.cc$//g&amp;#039;&amp;lt;/tt&amp;gt;&lt;br /&gt;
    echo &amp;quot;compiling : &amp;quot; $ccfile &amp;quot;, executible name: &amp;quot; $ofile&lt;br /&gt;
    g++ -g -L ~/lib -I ../../ -l TopTreeAnaContent53 -l TopTreeAna53 -l MLP -l TreePlayer -l TMVA -l XMLIO -I &amp;lt;tt&amp;gt;root-config --incdir&amp;lt;/tt&amp;gt; &amp;lt;tt&amp;gt;root-config --libs&amp;lt;/tt&amp;gt; $ccfile -o $ofile&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you get errors of type &amp;#039;&amp;#039;cannot find dynamic library TopTree....&amp;#039;&amp;#039; you might want to make sure that the &amp;lt;tt&amp;gt;TopTreeAna*&amp;lt;/tt&amp;gt; commands that you give to g++ actually correspond to the libs in ~/lib. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{TracNotice|{{PAGENAME}}}}&lt;/div&gt;</summary>
		<author><name>Maintenance script</name></author>
	</entry>
</feed>