Legend takes variables

Hi experts

I have a set of variables: Double_t a=3.14 … and I would like to include into legend, how should I do?

had something like this
leg->AddEntry(chi2f,“Theoretical #chi^{2}”,“l”);
and how can I add “a” values into legend?

You can use String::Format to convert numbers in a string.
For example:

leg->AddEntry(chi2f,String::Format("Theoretical #chi^{2} = %10.4f",chi2_value),"l");