I’m a beginner in root and therefore I have some problems with it.
My goal is it to draw two histogram (from different root files) in one canvas.
My Problem is that the code below does not draw anything into the canvas (the created pdf is empty…).
If I execute the different steps individually, I recognized that a Canvas will be created (as wanted) but if I then try to draw something, it will be drawn, but not into the created canvas (a additional window pops up with the histogram in it).
The most confusing thing is, that I tried it with a another root file and it worked perfectly.
Could be there a difference? The one with which the code worked was really a histogram. And the problematic one is a graphic were I have several simulated points.
I have no idea where the difference is… Except that the names of the two histograms are the same (both myCanvas).
Thanks in advance for your help!!
TFile* f1 = new TFile(“E_vs_vDrift_Ar_100.root”);
TFile* f2 = new TFile(“E_vs_vDrift_CH4_100.root”);
TH1F *h1 = f1->Get(“myCanvas”);
TH1F *h2 = f2->Get(“myCanvas”);
TCanvas* c1 = new TCanvas(“c1”, “Test”, 800, 600);