Plotting branches from different root files

Dear ROOT Experts,

I have several different trees root files having the same name for branches and leaves. I created them using structures and variables filling them are 1D vectors. Now, I am trying to plot same leaves from different root files on the same canvas so I could compare the results. However, when I tried to draw only a single leaf from a tree using compiled code by;

TFile f1 ("/media/aya/LinuxSpace/Pheno_Work_2/final_analysis/output_demo_Hhhbb4M_BMP1.root");
TTree *T1;
f1.GetObject("output_demo_Hhhbb4M_BMP1", T1);  
TCanvas *c1 = new TCanvas("c1","c1",600,600);
T1->Draw("muon1_pt");

Also, tried:

T1->Draw("Four_Muons.muon1_pt");

I get the following error:

Error in <TTreeFormula::Compile>:  Bad numerical expression : "muon1_pt"
Info in <TSelectorDraw::AbortProcess>: Variable compilation failed: {muon1_pt,}

I am doubt that I am not doing it the right way. So, how could I properly draw leaves from various root files on one canvas or even draw only one from a specific root file?

I have added these two png to illustrate the shape of tree .

ttbartree

ttbar3

Thanks a lot,
Aya

Attach the output from: T1->Print();

Hi,

Here it is.
printTree.txt (22.4 KB)

Thanks,
Aya

This should work: T1->Draw("muon1_pt");
If it does not, then we probably need your ROOT file for inspection.

Its quite large, please find it on lxplus, /afs/cern.ch/user/a/abeshr/public

Thanks,
Aya

This works fine for me:

{
  TFile f1("output_demo_ttbar.root"); // f1.ls();
  TTree *T1; f1.GetObject("output_demo_ttbar", T1); // if (T1) T1->Print();
  if (T1) T1->Draw("muon1_pt");
}

I tried the same and ran macro as .x /path/to/macro.C , also tried to do it in root session, there are no errors, but nothing is shown.

Thanks,
Aya

Make sure you first: cd /afs/cern.ch/user/a/abeshr/public

Well, thanks

Aya

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.