I know the SaveAs() function that allwas to save an histo in a .C file (or other format, of course, but I’m interested now in .C).
I was trying to find a way to save many histos in one same .C file, like adding them to an existing .C file.
Is it possible?
Thanks a lot for your help,
“Adding histograms to an existing .C file” is surely not something recommended … SaveAs a .C file is meant to store a canvas as C code.
To Store histograms and add more of them in the same file your should use .root files (via TFile).
Thanks for your answer,
yes, I know .root file and I use them. But I was wondering if it were possible to save many histograms in a .C file as well.
Thanks a lot,
This should not be too complex to implement for a collection of histograms using TH1::SavePrimitive. We will look into it.
For teh time being, simply create a TCanvas where you draw all your histograms, say with option “same” and you canvas.Print(“myfile.C”)
Thanks for the answer Rene, and for the suggestion.
Have a nice day!