This project is read-only.


One of the nice things about ROOT is its ability to process TeX formulas in plot titles and axes labels. For example, p_{T} as an axis title will put the T in a subscript. I find it makes my code a bit messy putting this in – and I’m always forgetting. A small abbreviation service is implemented to help with this. It will scan a title that is part of one of the .Plot extension methods and replace things like “pT” with “p_{T}”.


Using this is very easy. For example, the following Plot will have “pt” replaced by “p_{T}” in the actual title and axis label. There is nothing you need to do extra to turn this feature on.

                .SelectMany(evt => evt)
                .FuturePlot("mc_pT", "pT of all MC Particles; pT [GeV]; # Particles", 20, 0.0, 200.0, p => p.TLZ.Pt() / 1000.0)

Default Abbreviations

The default abbreviations are setup in the Utils.cs file, located in the LINQToTreeHelpers package. As of this update to the documentation, they are: pT, ET, MET, DR, eta, and phi.

Adding Your Own Abbreviations

You can add your own abbreviation at anytime you want. You need to add them before the plot is made (obviously). There is a method you can use (also located in the LINQToTreeHelpers/Utils.cs file): Utils.AddLatexReplacement. It is overloaded, and takes two arguments. First, two strings – one string is the text to be replaced, and the second one is a string that it should be replaced with. Regular expressions are used for the matching, and in the match word boundaries are used. For example, a “pT” string passed to this method causes a regular expression to be created that looks like “\bpT\b”.

The second overload takes a regular expression as its first argument giving you complete flexibility.

Last edited Apr 12, 2012 at 7:33 PM by gwatts, version 1


No comments yet.