Eicplot

From EIC
Jump to navigation Jump to search

eicplot is a collection of ROOT utilities to help making plots of EIC data. It includes the following classes:

  • Credits - draws EIC task force credits to an image. All public plots should contains these credits.
  • BinLog10 - rebins histogram axes to uniform log10 intervals.
  • Q2VsXPlot - Q2 vs. x histogram, with lines of constant y and logarithmic axes.
  • MultiPanelPlot - grid of histograms with shared x and y axes.

All classes are contained in the erhic namespace. If you source the EIC logon script this package is automatically loaded when ROOT starts. Please see the class documentation for details of the code and the Subversion repository if you wish to check out and build your own copy.

Credits

All publicly presented plots should show credit to the EIC task force. Credits::Draw() draws the standard EIC task force credits message to the right margin of the active ROOT pad. It makes an effort not to overlay with other elements, such as colour axes and statistics boxes, repositioning them in some cases. For example:

TH1D hist("hist", "", 10, 0, 10);
... do something with the histogram
TCanvas canvas("mycanvas", "", 800, 800); // This is the active pad
erhic::Credits::Draw();

Eicplot credits.png

BinLog10

Helpful when drawing histograms with the TPad::Logx/y/z() options. BinLog10 can be applied separately to axes, or to a histogram, in which case all axes are rebinned. For example:

TH2D hist("hist", "", 10, 0, 10, 20, 0, 20);
erhic::BinLog10 rebin;
rebin(hist.GetXaxis()); // Just the x axis
rebin(hist); // All axes

Eicplot binlog10.png

Q2VsXPlot

This is 2D histogram inheriting from ROOT::TH2D. Therefore any operations that work with ROOT::TH2D are supported. Lines of constant y are drawn at the values defined by the user, with labels showing the y value. Additional lines can be added manually, or no lines drawn by requesting values outside the range [0, 1]. Axis ranges are automatically defined with equal intervals in log10 and automatic axis titles are provided. For example:

erhic::Q2VsXPlot plot("q2VsX", "", 20, 1.e-4, 1., 16, 0.1, 1000.); // Set x and Q2 binning. Log10 is automatic
plot.setYRange(0.01, 0.95); // Or setYRange(erhic::Range<double>(0.01, 0.95));
plot.setS(4. * 5. * 100.); // Need to set squared centre-of-mass energy to compute y correctly
plot.Draw("colz");

Eicplot q2VsX.png

MultiPanelPlot

Histograms all share the same axes. y axis ranges and labels are copied from the histograms in the left-most column, and x axis ranges and labels from the histograms in the bottom row. It is up to the user to ensure that the histograms all do in fact have the same ranges! For example:

TCanvas canvas;
erhic::MultiPanelPlot plot(2, 1); // 2 columns, 1 row
plot.Draw(); // Best to draw the plot on the canvas before adding images to it
... Create some histograms, graphs, etc
plot.cd(1); // Select the first panel
something.Draw();
plot.cd(2);
somethingElse.Draw();
canvas.cd(); // Important to select the canvas before (re)drawing
plot.Draw()

Eicplot multi1d.png