Categories
ATLAS recipes

Truth D3PD root example

  • On titan, copy the following file ~willocq/root/example/simple_plot_truth.C to your own subdirectory. After setting up root with localSetupROOT, the simple plotting macro can be run with

root simple_plot_truth.C

or you can just start root and at the root prompt type:

.x simple_plot_truth.C

  • Once this is working, extend the macro to create additional canvases like c1 to plot the following variables stored in the truth ntuple file that is opened in the macro:
    • jetAntiKt4TruthJets_pt          transverse momentum of truth jets
    • jetAntiKt4TruthJets_eta        pseudorapidity  of truth jets
    • el_pt                                           transverse momentum of truth electrons
    • el_eta                                         pseudorapidity of truth electrons
    • mu_muid_pt                             transverse momentum of truth muons
    • mu_muid_eta                           pseudorapidity of truth muons
  • Do the above plots with a logarithmic vertical scale
  • Produce a second set of those above plots with a minimum pt cut of 25000 MeV for  jets and 5000 MeV for both electrons and muons, i.e. in the example there is a cut on the barcode, simply replace that with a cut on the variable mu_muid_pt>5000 for muons, and similarly for electrons and jets
  • Produce a plot of the pseudorapidity of electrons and muons (separately) showing an overlay of negatively and postively charged particles (histograms with different colors).

One reply on “Truth D3PD root example”

I have been having some trouble with this assignment. When I try to create new canvases, drawing a histogram on the new canvas always overwrites the histogram on the previous canvas. Also, setting the logarithm scale seems to only work when the canvas is not divided. for example, the following code:
c1 -> SetLogy(1);
c1->Divide(1,2);
c1->cd(1);
c1 -> SetLogy(1);
h_el_pt0->Draw();
c1 -> SetLogy(1);
c1->cd(2);
h_el_pt1->Draw();
c1 -> cd(0);
c2 -> SetLogy(1);
c2 -> Divide(1,2);
c2 -> cd(1);
h_el_eta0 -> Draw();

causes h_el_eta0 to appear in half of it’s own canvas with a linear scale and replace all of c1 with a logarithim scale in a different window. I have tried placing the SetLogy command in various different positions in the code, but they all cause the same result. Also, if you take out c1 -> cd(0) then it will replace h_el_pt1 and keep a linear scale.

Leave a Reply