TProfile to TH1D

Hello everyone…

I am converting a profile into a 1d histogram, using

TH1D *hist = profile->ProjectionX();
and then
hist->Draw(“l”);

The first annoyance is that this automatically creates a histogram called profile_px,
which lingers in the memory, hence if you try to do
TH1D *secondhist = profile->ProjectionX();
you start getting memory leak warnings…

The second annoyance is that it’s impossible to do
hist->Draw(“l”) – i.e. you get a plot of points with error bars, and
if you want to get a line plot, well, there seems to be no way (I go
into the Editor and try to do it using the gui, and still, all I see
are points with error bars). This prolem is particularly annoying,
and I am looking for ways to solve this. Any ideas?

Please read the documentation of the involved functions.
When calling TProfile::ProjectionX, you can specify a name for the projected histogram. If you do not want to have the new histogram registered to the ROOT current directory, call
TH1::AddDirectory(kFALSE);
before making your projections.

Concerning your second point, see doc of TH1::Draw. You can specify
the option “hist” to draw only the line contour and not the errors.

Rene

Thanks for the response.

Re second problem…

You can specify
the option “hist” to draw only the line contour and not the errors.


Option “hist” does work – thanks for the note.
Other options, however (“lf2”,“c”,“b”, and most importantly “l”) do not seem to work.