<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="FeedCreator 1.8" -->
<?xml-stylesheet href="https://wiki.physik.uzh.ch/lhcb/lib/exe/css.php?s=feed" type="text/css"?>
<rdf:RDF
    xmlns="http://purl.org/rss/1.0/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
    xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel rdf:about="https://wiki.physik.uzh.ch/lhcb/feed.php">
        <title>LHCb Wiki Pages - root</title>
        <description></description>
        <link>https://wiki.physik.uzh.ch/lhcb/</link>
        <image rdf:resource="https://wiki.physik.uzh.ch/lhcb/_media/wiki:dokuwiki.svg" />
       <dc:date>2026-04-05T20:56:29+00:00</dc:date>
        <items>
            <rdf:Seq>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:addclasstoroot?rev=1299584553&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:addlegend?rev=1289317420&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:backcat?rev=1233660034&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:batchmode?rev=1236938039&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:binsorder?rev=1300448002&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:chain?rev=1245658034&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:changemarkerstyle?rev=1289315098&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:colorscheme?rev=1282662654&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:componentspyrootroofit?rev=1319031619&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:controloutputroofit?rev=1329907361&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:convpdgnumber?rev=1233667364&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:custompdfsandworkspace?rev=1335377246&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:disk?rev=1260262965&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:findbin?rev=1269025945&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:functionsetnumberpoints?rev=1285665003&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:labelstitle?rev=1289317276&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:lhcbroot?rev=1289313939&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:loadtext?rev=1289837879&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:logscale?rev=1289316960&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:nanfinite?rev=1234948233&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:nostats?rev=1320238198&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:numberofdivisions?rev=1289317035&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:ownershippyroot?rev=1308391996&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:padlayouts?rev=1289318358&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:padmargins?rev=1289317727&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:paletteaxis?rev=1308846394&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:pyrootgetevent?rev=1384953862&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:pyrootpassref?rev=1406714307&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:python?rev=1392218252&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:pythonrootconstructors?rev=1248520934&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:pythonrootmacro?rev=1236162272&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:redrawaxis?rev=1377269709&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:root?rev=1406714003&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:rootlogonscript?rev=1228146079&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:saveplot?rev=1289380810&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:setaxisrange?rev=1394529657&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:setup_most_recent_root_version_from_afs?rev=1289817409&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:setxaxisrangetgraph?rev=1289052378&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:showcuts?rev=1263292000&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:splash?rev=1289315523&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:storemcnumbers?rev=1231337806&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:strings?rev=1289386864&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:style?rev=1289317547&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:thstack?rev=1345111087&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:troubleshooting?rev=1371204855&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:ttreedraw?rev=1371202918&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.physik.uzh.ch/lhcb/root:two_stats_boxes?rev=1238162198&amp;do=diff"/>
            </rdf:Seq>
        </items>
    </channel>
    <image rdf:about="https://wiki.physik.uzh.ch/lhcb/_media/wiki:dokuwiki.svg">
        <title>LHCb Wiki Pages</title>
        <link>https://wiki.physik.uzh.ch/lhcb/</link>
        <url>https://wiki.physik.uzh.ch/lhcb/_media/wiki:dokuwiki.svg</url>
    </image>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:addclasstoroot?rev=1299584553&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2011-03-08T11:42:33+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>addclasstoroot</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:addclasstoroot?rev=1299584553&amp;do=diff</link>
        <description>Adding A Class to ROOT

Idea

Instead of writing C++ macros which are intepreted by CINT, one can think of adding a class to ROOT itself. This may be particularly useful for methods that draw and save histograms, apply cuts, etc. The advantage over macros is the stability, as the code is compiled and then executed, and not interpreted by CINT.</description>
    </item>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:addlegend?rev=1289317420&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2010-11-09T15:43:40+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>addlegend</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:addlegend?rev=1289317420&amp;do=diff</link>
        <description>Adding a legend


 TLegend *legend = new TLegend(0.65,0.85,0.95,0.75); //xmin,ymin,xmax,ymax in percent from lower left corner
 legend-&gt;AddEntry(histogram1, &quot;name1&quot;);
 legend-&gt;AddEntry(histogram2, &quot;name2&quot;);
 legend-&gt;SetFillColor(kWhite);  // otherwise you get an ugly grey background
 legend-&gt;Draw();</description>
    </item>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:backcat?rev=1233660034&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2009-02-03T11:20:34+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>backcat</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:backcat?rev=1233660034&amp;do=diff</link>
        <description>Categorizing Background using Monte Carlo truth

Idea

It may be useful to print the decay tree of a Monte Carlo particle that was associated to a reconstructed particle. 
Suppose you have a preselection and you want to see what particles the background, that passes your preselection, consists of. As your reconstruction</description>
    </item>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:batchmode?rev=1236938039&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2009-03-13T09:53:59+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>batchmode</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:batchmode?rev=1236938039&amp;do=diff</link>
        <description>Running ROOT in batch mode

Idea

Sometimes it may be useful to use ROOT without anything put on a canvas, e.g. if you want to run a script with nohup and then disconnect the ssh-connection.

How to...

You can start ROOT in batch mode with 


root -b</description>
    </item>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:binsorder?rev=1300448002&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2011-03-18T11:33:22+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>binsorder</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:binsorder?rev=1300448002&amp;do=diff</link>
        <description>What does &quot;Bins must be in increasing order&quot; mean

It can mean, that:

	*  Your (self set) bins are really not in increasing order, or:
	*  The number of bins does not correspond to the array you give the histogram to set the bins, for example, you have to set:</description>
    </item>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:chain?rev=1245658034&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2009-06-22T08:07:14+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>chain</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:chain?rev=1245658034&amp;do=diff</link>
        <description>How to use chains in ROOT

Idea

A chain is sort of a container for trees. A chain can contain an arbitrary number of trees and can be used the same way as a tree, as the class chain inherits from the class tree.

Adding Files

A simple example is the following:</description>
    </item>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:changemarkerstyle?rev=1289315098&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2010-11-09T15:04:58+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>changemarkerstyle</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:changemarkerstyle?rev=1289315098&amp;do=diff</link>
        <description>Change Marker Style

To change the marker style, you have to do:


TGraph* myGraph = TGraph();
//...
myGraph-&gt;Draw();  /** This is important */
myGraph-&gt;SetMarkerStyle(20);


It will not work if the marker style is set before the graph is drawn.
as your file will be empty.</description>
    </item>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:colorscheme?rev=1282662654&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2010-08-24T15:10:54+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>colorscheme</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:colorscheme?rev=1282662654&amp;do=diff</link>
        <description>Color scheme

255 Colors scheme

To have 255 colors in the histograms, add the following to the root logon macro:


const Int_t NRGBs = 5;
const Int_t NCont = 255;
Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
Double_t red[NRGBs]   = { 0.00, 0.00, 0.87, 1.00, 0.51 };
Double_t green[NRGBs] = { 0.00, 0.81, 1.00, 0.20, 0.00 };
Double_t blue[NRGBs]  = { 0.51, 1.00, 0.12, 0.00, 0.00 };
TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
gStyle-&gt;SetNumberContours(NCont…</description>
    </item>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:componentspyrootroofit?rev=1319031619&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2011-10-19T13:40:19+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>componentspyrootroofit</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:componentspyrootroofit?rev=1319031619&amp;do=diff</link>
        <description>Drawing components of pdfs in RooFit with pyRoot

Instead of doing:


sum.plotOn(xframe, RooFit.Components(RooFit.RooArgSet(BG)), RooFit.LineColor(2)) 


you have to do:


argset = RooArgSet(BG)
sum.plotOn(xframe, RooFit.Components(argset), RooFit.LineColor(2))</description>
    </item>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:controloutputroofit?rev=1329907361&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2012-02-22T10:42:41+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>controloutputroofit</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:controloutputroofit?rev=1329907361&amp;do=diff</link>
        <description>Controlling the Output of RooFit

In General

The most systematic approach to controlling the output of RooFit is accessing the streams of the message service directly.
The first thing is to check the instance of the RooMsgService:


RooMsgService::instance().Print() ;</description>
    </item>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:convpdgnumber?rev=1233667364&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2009-02-03T13:22:44+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>convpdgnumber</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:convpdgnumber?rev=1233667364&amp;do=diff</link>
        <description>The convPDGnumber class

Idea

The C++-class convPDGnumber takes as an input the numbers of the Monte Carlo particle numbering schemes and provides information about them. The class is based on a list of all particles (PDGLaTeXTable.txt), according to the</description>
    </item>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:custompdfsandworkspace?rev=1335377246&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2012-04-25T18:07:26+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>custompdfsandworkspace</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:custompdfsandworkspace?rev=1335377246&amp;do=diff</link>
        <description>Custom PDFs and Workspaces

Idea

In RooFit you can define a custom PDF shape in a C++ class. This is a good idea if the model is widely used and speed is an issue. A popular example is the class “RooExpAndGauss”, which is used for partly reconstructed background in B decays. However, you need to be careful when defining these if you also want to deal with RooWorkspaces.</description>
    </item>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:disk?rev=1260262965&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2009-12-08T09:02:45+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>disk</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:disk?rev=1260262965&amp;do=diff</link>
        <description>root setup

Setup root in the current directory and its subdirectories.
Create a script setupROOT.sh containing:
  #!/bin/bash
  export MYSITEROOT=/app/lhcb/sw
  export CMTCONFIG=slc4_ia32_gcc34
  export CMTPATH=$HOME/cmtuser
  export PATH=$MYSITEROOT/local/gcc-3.4.6/bin:$MYSITEROOT/local/binutils-2.15.92.0.2/bin:$MYSITEROOT/scripts:$PATH
  export LD_LIBRARY_PATH=$MYSITEROOT/local/gcc-3.4.6/lib:$MYSITEROOT/local/binutils-2.15.92.0.2/lib:$MYSITEROOT/lib:$LD_LIBRARY_PATH 
  . $MYSITEROOT/LbLogin.s…</description>
    </item>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:findbin?rev=1269025945&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2010-03-19T19:12:25+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>findbin</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:findbin?rev=1269025945&amp;do=diff</link>
        <description>Find the bin the value corresponds to

How to


TH1D* bla = new TH1D(&quot;bla&quot;, &quot;myHisto&quot;, 100,0,1);
bla-&gt;FindBin(0,53);


It also works for 2 or 3 dimensions.</description>
    </item>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:functionsetnumberpoints?rev=1285665003&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2010-09-28T09:10:03+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>functionsetnumberpoints</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:functionsetnumberpoints?rev=1285665003&amp;do=diff</link>
        <description>Set the number of points to draw a function

Problem

If you draw a function and zoom in, you see it is composed of straight lines connecting points. You can increase the number of points to solve this.

Do


TF1* func = new TF1(&quot;func&quot;,&quot;function&quot;, 0, 100);
func-&gt;SetNpx(myNumberOfPoints);</description>
    </item>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:labelstitle?rev=1289317276&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2010-11-09T15:41:16+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>labelstitle</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:labelstitle?rev=1289317276&amp;do=diff</link>
        <description>Configure labels and title


histo-&gt;GetYaxis()-&gt;SetLabelSize(.1); // font-size of Numbers on axis in percent of ??? 
histo-&gt;GetYaxis()-&gt;SetTitleSize(.12); // font-size for title in percent of ??? 
histo-&gt;GetYaxis()-&gt;SetTitleOffset(.2); // distance between axis and title in percent of normal distance
histo-&gt;GetYaxis()-&gt;SetTitle(&quot;mySweetTitle&quot;);</description>
    </item>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:lhcbroot?rev=1289313939&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2010-11-09T14:45:39+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>lhcbroot</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:lhcbroot?rev=1289313939&amp;do=diff</link>
        <description>LHCb ROOT

This page collects LHCb specific ROOT information. For general hints see ROOT.

	*   Adding A Class to ROOT - how to add your own class (for analysis, drawing histograms,...) to ROOT
	*   Store Monte Carlo particle numbers in a file - how to write a simple method that stores information about Monte Carlo particle numbers</description>
    </item>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:loadtext?rev=1289837879&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2010-11-15T16:17:59+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>loadtext</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:loadtext?rev=1289837879&amp;do=diff</link>
        <description>Read data from text file

To read data from a text file into a tree all you need are the following two lines


  TTree *myTree = new TTree(&quot;mytree&quot;,&quot;data from ascii file&quot;);
  Long64_t nlines = myTree-&gt;ReadFile(filename,&quot;col1:col2:col3&quot;);


Dynamic Branche Names</description>
    </item>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:logscale?rev=1289316960&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2010-11-09T15:36:00+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>logscale</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:logscale?rev=1289316960&amp;do=diff</link>
        <description>Set log scale for an axis

If a scale is displayed in log or normal scale is determined by the pad not the histogram!


canvas-&gt;SetLogx();
pad-&gt;SetLogy();


Note that the axis letter (X, Y) are in lowercase.</description>
    </item>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:nanfinite?rev=1234948233&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2009-02-18T09:10:33+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>nanfinite</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:nanfinite?rev=1234948233&amp;do=diff</link>
        <description>Treatment of non-real numbers / infinity

Idea

If the result of a calculation in your code is an infinite number or an imaginary number, this may lead to problems (when drawing histograms, etc.). The following two methods help to catch these cases.</description>
    </item>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:nostats?rev=1320238198&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2011-11-02T12:49:58+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>nostats</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:nostats?rev=1320238198&amp;do=diff</link>
        <description>No StatBoxes

gStyle-&gt;SetOptStat(kFALSE);


from root import gStyle, kFALSE, kTRUE

gStyle.SetOptStat(kFALSE)</description>
    </item>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:numberofdivisions?rev=1289317035&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2010-11-09T15:37:15+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>numberofdivisions</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:numberofdivisions?rev=1289317035&amp;do=diff</link>
        <description>How to Set the Number of Divisions in a TH1

Idea

It may sometimes be useful to set the number of divisions for the axes of a TH1 in ROOT.

How to

Do:


myhisto-&gt;GetXaxis()-&gt;SetNdivisions(ndiv, )


where ndiv = n1 + 100n2 + 10000*n3, where n1, n2, n3 are the number of primary, secondary and tertiary divisions. So 503 gives 3 main ticks, and 5 sub ticks between each of the main tick.
And what is this option?</description>
    </item>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:ownershippyroot?rev=1308391996&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2011-06-18T10:13:16+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>ownershippyroot</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:ownershippyroot?rev=1308391996&amp;do=diff</link>
        <description>Ownership in PyROOT

As python has a garbage collector, you have to make sure to pass on all objects that you want to keep. For example canvases.

The following macro will produce 10 empty canvases and delete them in the end.


from ROOT import *
import ROOT

for i in range(0,10):
    canv = TCanvas(&quot;canv&quot;+str(i))</description>
    </item>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:padlayouts?rev=1289318358&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2010-11-09T15:59:18+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>padlayouts</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:padlayouts?rev=1289318358&amp;do=diff</link>
        <description>Examples of special padLayouts

Two Histograms next to each other (vertically)




        TCanvas *canvas = new TCanvas(&quot;canvas&quot;,&quot;canvas&quot;);
        pad1 = new TPad(&quot;pad1&quot;,&quot;&quot;,0,0.3,1,1);
        pad2 = new TPad(&quot;pad2&quot;,&quot;&quot;,0,0,1,0.3);
        pad1-&gt;Draw(); 
        pad2-&gt;Draw();


        pad1-&gt;cd();
        pad1-&gt;SetBottomMargin(0.0);
        pad1-&gt;SetLogy();
        pad1-&gt;SetGridx();
        hist1-&gt;SetXTitle(xTitle);
        hist1-&gt;GetYaxis()-&gt;SetTitleSize(.05);
        hist1-&gt;GetYaxis()-&gt;SetTit…</description>
    </item>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:padmargins?rev=1289317727&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2010-11-09T15:48:47+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>padmargins</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:padmargins?rev=1289317727&amp;do=diff</link>
        <description>Change the Margins of a pad

You can change the borders on a pad around a histogram by


 pad-&gt;SetTopMargin(0.0);    // useful if you want to join two adjacent pads
 pad-&gt;SetBottomMargin(0.2); // in percent of the height</description>
    </item>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:paletteaxis?rev=1308846394&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2011-06-23T16:26:34+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>paletteaxis</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:paletteaxis?rev=1308846394&amp;do=diff</link>
        <description>The colour axis is an object of the type TPaletteAxis. 
Here the code i use to format it nicely:


def ScaleZAxis(histname):
 	hist = ROOT.gDirectory.Get(histname)
 	ROOT.gPad.Update()
 	palette = hist.GetListOfFunctions().FindObject(&quot;palette&quot;)
 	palette.SetX1NDC(0.90)
 	palette.SetX2NDC(0.92)
 	palette.Draw()
 	ROOT.gPad.Update()</description>
    </item>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:pyrootgetevent?rev=1384953862&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2013-11-20T13:24:22+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>pyrootgetevent</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:pyrootgetevent?rev=1384953862&amp;do=diff</link>
        <description>Accessing Events in a Tree

To access the events in a tree no variables need to be assigned to the different branches. 
Instead the leaves are available as properties of the tree, returning the values of the present event.


tree.GetEvent(0)
print tree.Z0_MM  # 18558.9
tree.GetEvent(1)
print tree.Z0_MM  # 2896.5</description>
    </item>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:pyrootpassref?rev=1406714307&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2014-07-30T09:58:27+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>pyrootpassref</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:pyrootpassref?rev=1406714307&amp;do=diff</link>
        <description>Pass by Reference


# assuming graph is a TGraph

from ROOT import Double
x = Double(0)
y = Double(0)
graph.GetPoint(1, x, y)</description>
    </item>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:python?rev=1392218252&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2014-02-12T15:17:32+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>python</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:python?rev=1392218252&amp;do=diff</link>
        <description>Root and python

TGraph
      
      from ROOT import *
      from numpy import array
      x = [1,2,3,4]  # a list 
      y = [5,6,7,8]  # a list
      graph = TGraph(len(x),array(x,'f'),array(y,'f')) # convert lists to arrays</description>
    </item>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:pythonrootconstructors?rev=1248520934&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2009-07-25T11:22:14+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>pythonrootconstructors</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:pythonrootconstructors?rev=1248520934&amp;do=diff</link>
        <description>How use a ROOT constructor which needs pointers as arguments in python

For example to create a histogram with variable bin width, the constructor needs a pointer to the array of the lowEdges (xbins).


TH1D::TH1D(const char* name, const char* title, Int_t nbinsx, const Float_t* xbins)</description>
    </item>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:pythonrootmacro?rev=1236162272&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2009-03-04T10:24:32+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>pythonrootmacro</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:pythonrootmacro?rev=1236162272&amp;do=diff</link>
        <description>In your shell do:


export PYTHONPATH=$PYTHONPATH:$ROOTSYS/lib:$ROOTSYS/root/pyroot


Your python root macro should begin like this:


from ROOT import *


To run your macro:


 python -i filename.py</description>
    </item>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:redrawaxis?rev=1377269709&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2013-08-23T14:55:09+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>redrawaxis</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:redrawaxis?rev=1377269709&amp;do=diff</link>
        <description>Redraw axis to get Ticks on top

When you draw several histograms on the same pad, later histograms will cover the axis drawn together with the first histogram.
To redraw the axis on top, you can use Draw(“axis same”):


hist1-&gt;Draw(&quot;Ep&quot;);        // to draw axis-range and label from hist1
hist2-&gt;Draw(&quot;hist same&quot;);
hist1-&gt;Draw(&quot;Ep same&quot;);   // to draw points on top
hist1-&gt;Draw(&quot;axis same&quot;); // to redraw axis</description>
    </item>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:root?rev=1406714003&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2014-07-30T09:53:23+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>root</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:root?rev=1406714003&amp;do=diff</link>
        <description>ROOT

This page collects general ROOT hints. For LHCb specific info see LHCbROOT.

Finding Help

If you are looking for an example containing some specific class (TObjArray below). grep for it in the tutorial directory:


cd $ROOTSYS/tutorials/
grep -r TObjArray *</description>
    </item>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:rootlogonscript?rev=1228146079&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2008-12-01T15:41:19+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>rootlogonscript</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:rootlogonscript?rev=1228146079&amp;do=diff</link>
        <description>Logon Script for ROOT

When you start ROOT from commandline, it will execute the script rootlogon.C in the same directory. This may be useful when you want to load your own classes into ROOT or want to set some styles.

Example

Create a file named rootlogon.C (note the capital C), open it and write</description>
    </item>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:saveplot?rev=1289380810&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2010-11-10T09:20:10+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>saveplot</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:saveplot?rev=1289380810&amp;do=diff</link>
        <description>Save a plot to a file

To save a file in a given format, you need to specify the format as parameter


 canvas-&gt;Print(&quot;filename.pdf&quot;,&quot;pdf&quot;);</description>
    </item>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:setaxisrange?rev=1394529657&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2014-03-11T09:20:57+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>setaxisrange</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:setaxisrange?rev=1394529657&amp;do=diff</link>
        <description>Set Display Range of Axis

The normal way to change the display range of an axis is:


histogram-&gt;GetYaxis()-&gt;SetRangeUser(lower,upper);


but there are several situations where this fails. See below for help in these cases.

Y Axis of a normalized Histogram</description>
    </item>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:setup_most_recent_root_version_from_afs?rev=1289817409&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2010-11-15T10:36:49+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>setup_most_recent_root_version_from_afs</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:setup_most_recent_root_version_from_afs?rev=1289817409&amp;do=diff</link>
        <description>Root is stored in afs at:

/afs/cern.ch/sw/lcg/app/releases/ROOT/

select version and architecture (adapt first line)

and set the following environment variables (code for bash):


export ROOTSYS=/afs/cern.ch/sw/lcg/app/releases/ROOT/5.27.06/x86_64-slc5-gcc43-dbg/root #SLC 5
export ROOTSYS=/afs/cern.ch/sw/lcg/app/releases/ROOT/5.27.06/slc4_ia32_gcc34/root #SUSE 10
export PATH=$ROOTSYS/bin:$PYTHONDIR/bin:$PATH
export LD_LIBRARY_PATH=$ROOTSYS/lib:$PYTHONDIR/lib:$LD_LIBRARY_PATH
export PYTHONPATH=…</description>
    </item>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:setxaxisrangetgraph?rev=1289052378&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2010-11-06T14:06:18+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>setxaxisrangetgraph</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:setxaxisrangetgraph?rev=1289052378&amp;do=diff</link>
        <description>Set the range of the x axis in a TGraph

Problem

If you have a TGraph, SetRangeUser will not work for the x axis.


TGraph* myGraph = new TGraph();
...
myGraph-&gt;SetRangeUser(lower,upper);


will not complain but also not do anything. Or not the thing you want.</description>
    </item>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:showcuts?rev=1263292000&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2010-01-12T10:26:40+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>showcuts</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:showcuts?rev=1263292000&amp;do=diff</link>
        <description>Show cut value as a line in a histogram

 To create a line in a histogram for example to indicate a cut do the following in your python root macro and in the canvas where you have the histogram:


cutObj = TLine(XcutValue, hist.GetMinimum(), XcutValue, hist.GetMaximum())
cutObj.SetLineColor(kGreen+2)
cutObj.SetLineWidth(2)

cutObj.Draw(&quot;lsames&quot;)</description>
    </item>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:splash?rev=1289315523&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2010-11-09T15:12:03+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>splash</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:splash?rev=1289315523&amp;do=diff</link>
        <description>Splash Screen

You can get rid of the splash screen when starting root by using the -l flag:


$ root -l


You might want to set this as an alias in your shells rc-file (.cshrc, .bashrc)


alias root='root -l' # bash
alias root 'root -l' # csh</description>
    </item>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:storemcnumbers?rev=1231337806&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2009-01-07T14:16:46+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>storemcnumbers</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:storemcnumbers?rev=1231337806&amp;do=diff</link>
        <description>Storing Monte Carlo particle numbers in a file

Idea

When analyzing signal or background using Monte Carlo truth information, it may be useful to check the real identity of a particle that was considered a Kaon, a Muon, etc.

The following script loops through the whole tree, calculates the percentage of the respective particle and saves the output in a textfile. It needs as input the tree with the truth-information (e.g. in an nTuple) and the name of the variable. Furthermore, the name of the …</description>
    </item>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:strings?rev=1289386864&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2010-11-10T11:01:04+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>strings</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:strings?rev=1289386864&amp;do=diff</link>
        <description>String manipulation

For more details see the  TString Reference.

Substring

Get substring of existing string


TString new = old(start, subStrLength);
// start is the index of the first character
// subStrLength is the number of characters to copy

// e.g: remove S charachters form start and E from end
TString new = old(S, old.Length()-S-E);</description>
    </item>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:style?rev=1289317547&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2010-11-09T15:45:47+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>style</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:style?rev=1289317547&amp;do=diff</link>
        <description>Change Style of Canvas/Pad

To get plots without any backgrounds use


//void myMacro(myArgList) {
  gROOT-&gt;SetStyle(&quot;Plain&quot;);


In macros this needs to be given inside the function to have an effect.</description>
    </item>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:thstack?rev=1345111087&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2012-08-16T09:58:07+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>thstack</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:thstack?rev=1345111087&amp;do=diff</link>
        <description>Using and Troubleshooting THStack

Basic Code


  TH1F *h;
  THStack *hs = new THStack(&quot;hs&quot;,&quot;Stacked 1D histograms&quot;);
  //create three 1-d histograms
  for (int i = 0; i &lt; 3; i++) {
    h = new TH1F(&quot;h&quot;+i,&quot;test hstack&quot;,100,-4,4);
    h-&gt;FillRandom(&quot;gaus&quot;,20000-i*5000);
    h-&gt;SetFillColor(i+2);
    h-&gt;SetMarkerColor(i+2);
    hs-&gt;Add(h);
  }
  TCanvas *cst = new TCanvas(&quot;cst&quot;,&quot;stacked hists&quot;,10,10,700,700);
  cst-&gt;SetFillColor(41);
  hs-&gt;Draw()</description>
    </item>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:troubleshooting?rev=1371204855&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2013-06-14T10:14:15+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>troubleshooting</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:troubleshooting?rev=1371204855&amp;do=diff</link>
        <description>Root-files

Root-files can be the source of various problems.
Usually they are caused by hidden changes in the internal state of ROOT.
ROOT stores the active directory and uses this to create new objects and look for existing ones.
The active directory is changed when a new file is opened. 
This can lead to unexpected behaviours and hard to trace bugs.</description>
    </item>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:ttreedraw?rev=1371202918&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2013-06-14T09:41:58+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>ttreedraw</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:ttreedraw?rev=1371202918&amp;do=diff</link>
        <description>TTree::Draw()

Basic Usage

The Draw()-Method of TTrees is a very useful tool to quickly create histograms.
The following code creates a histogram with the default settings.


TFile file(&quot;myfile.root&quot;);
TTree *tree = file.Get(&quot;mytree&quot;);
tree-&gt;Draw(&quot;myvar&quot;);</description>
    </item>
    <item rdf:about="https://wiki.physik.uzh.ch/lhcb/root:two_stats_boxes?rev=1238162198&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2009-03-27T13:56:38+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>two_stats_boxes</title>
        <link>https://wiki.physik.uzh.ch/lhcb/root:two_stats_boxes?rev=1238162198&amp;do=diff</link>
        <description>How to overlay tow histograms and draw both stats boxes

void myfunction()
{
...
TCanvas *c = new TCanvas(...)
TH1D *h1 = new TH1D(...) ; // histo 1
TH1D *h2 = new TH1D(...) ; // histo 2// set stats options (show histo title, nEntries, mean, rms)
gStyle-&gt;SetOptStat(1111);</description>
    </item>
</rdf:RDF>
