Greetings!
I am working on a particle physics analysis where I need to plot histograms for different centrality bins in Pb-Pb collisions (using ROOT). I have successfully adjusted the legend position for centrality 0 (0-5%), but when I apply the same settings to centrality 4 (30-40%), the alignment and formatting do not appear as expected.
I want the legend for centrality 4 and other plots to exactly match the legend of the image which i have uploaded.
Has anyone encountered a similar issue? Any suggestions on how to ensure a consistent legend appearance across different centralities?
here is the macro, which i am running and facing the issue described earlier. the target is to set the plots according to the provided image. kindly suggest some necessary editing in the code to get exact plot
Thanks for your file I got it. How do I run it in ROOT ? It has a main program and some code appears to be outside any C function. Can you instruct me how I should run it ?
root [0] .L normal_spectr01.cpp
In file included from input_line_8:1:
/Users/couet/Downloads/normal_spectr01.cpp:69:26: warning: variable length arrays in C++ are a Clang extension [-Wvla-cxx-extension]
TH1D* hPiPlus_energy[numFiles][numCentralityBins];
^~~~~~~~
/Users/couet/Downloads/normal_spectr01.cpp:69:26: note: function parameter 'numFiles' with unknown value cannot be used in a constant expression
/Users/couet/Downloads/normal_spectr01.cpp:61:61: note: declared here
void DrawAndNormalizeHistograms(TFile** f_energy, const int numFiles) {
`.....
after this, i use main() to draw the plots on TCanvas
Respected Sir, i just want to smooth the flow legends and set their positions according to the reference image
Hi @Physics_Wala,
Despite the many warnings your macro gives, your macro produces 4 canvases. Shown in the following picture. What should be changed in these pictures ?
The legends’ positions is defined in the TLegend constructor.
You can change them for instance to TLegend(0.15, 0.15, 0.57, 0.25, NULL,"brNDC");
But this has to be adjusted for each canvas depending on what is on the canvas and where is more space to place the legend. Just play with the parameters to adjust them the best way.
The parameters are x1, y1, x2, y2, in that order, and are in the normalised space.