I have 2 root files from 2 separate simulation and I want only to draw and compare “ParticleEnergy” of the 2 simulation in one Canvas. The idea here it that “ParticleEnergy” is from different particles and I constructed a method to filter only gamma because I want to draw comparison between energy spectrum of gamma entries. I tried to do this but I faced some difficulties that usually the program read and Draw only one root file not both. Any help would be appreciated in this task.
- In the attachment are the root file and program used.
Out_run_0.root (10.2 KB) Out_run_1.root (12.0 KB) SameHisto.cpp (2.2 KB)
Welcome to the ROOT Forum!
Try this one: SameHisto.cpp (2.6 KB)
Thanks a lot. It works perfect
I would like to ask about legend to add the description for the Histograms.
I tried to add the following lines in the code and it works correctly but the color of each text of each Histogram inside the legend is not different as I want so where is the problem.
SameHisto.cpp (2.9 KB)
TLegend *legend = new TLegend(0.7, 0.7, 0.95, 0.95);
legend->AddEntry(EnergyGamma, "PMMAPhantom EnergySpectrum", "f");
legend->AddEntry(EnergyGamma, "CTDICOM EnergySpectrum", "f");
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.