Editing a RooHist in a TCanvas

I have a problem that is similar to an old topic, but sadly the solution there does not work. I have a RooHist that was saved in a TCanvas. Now I need to edit the RooHist in the sense that the axes have to be changed in Font Size (same for the axes title). I do not find a way to access the axis. As I need to do this process multiple times, clicking on the axis in the TBrowser is not an option.

Can you provide the root file containing this TCanvas ?

Sure. I hope that helps.
CrossSection_JustK_SW_3Tagger_Final.root (191.6 KB)

something like that:

   auto f = new TFile("CrossSection_JustK_SW_3Tagger_Final.root");
   auto can = (TCanvas *) f->Get("Fit_1610_1665");
   RooHist *h1 = (RooHist *)can->GetListOfPrimitives()->FindObject("...");

The axes (including their “titles”) are not defined by the “RooHist h_values”.
They are defined by the “TH1D frame_...” histogram (which is actually drawn twice).

That seems like a nice solution. However, I have a small problem. In the line with “ls” I get something like this as the output:

OBJ: RooHist h_values Histogram of values_plot__Mass : 1 at: 0x138ffc960

So I tried to put “h_values” in the FindObject command, but this leads to a segmentation fault.
Can you tell me what’s wrong?

(Same with the TH1D and the name “frame_12ff1a800”)

TH1D *h = (TH1D*)can->FindObject("frame_13cdb3b30"); // for the "Fit_1610_1665" canvas

@couet There is something terribly wrong. I get a “segmentation violation” from a simple: can->Draw(); delete can;

This works well, thank you very much! Yet I would like to take it a step further. In order to change a lot of TCanvas, it would be nice, if the name of the TH1D was “automatically” detected. (I always only have one TH1D in the TCanvas, even though it is plotted twice.)
Is it possible to do so?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.