1.) How could I split an histogram in two?
I would like to remove the background from the histogram, and after that save it in a new histogram. The difference should be the rest ( in my case some peaks) …
TH1F t_hist1_b = (TH1F)t_hist1->Clone(“t_hist1_b”);
t_hist1_b->Add(hb,-1);// sub hb from t_hist1
(…)
There are any other way to do that?
2.) Supose that I have two histograms (the splited ones):
one for the background
one for the peaks
What is the best way to fit them?
3.) How could I put the outputs from cout’s or from print’s in a popup window or in a canvas? … like a window for debug…
I have my GUI interface but by now I don’t now exactly how to do this…
TH1F *t_hist1_b = (TH1F*)t_hist1->Clone("t_hist1_b");
t_hist1_b->Add(hb,-1);// sub hb from t_hist1
What is wrong with these two lines?
[quote]2.) Supose that I have two histograms (the splited ones):
one for the background
one for the peaks
What is the best way to fit them?
[/quote]
Why do you want fit background+peaks where the background is obtained
from TSpectrum::Background?
If your question is more general, ie how to find the fraction of
signal(s) and background, see classes like TFractionFitter and TSPlot root.cern.ch/root/htmldoc/TFractionFitter.html root.cern.ch/root/htmldoc/TSPlot.html
[quote]3.) How could I put the outputs from cout’s or from print’s in a popup window or in a canvas? … like a window for debug…
I have my GUI interface but by now I don’t now exactly how to do this…
[/quote]
When executing your script or command, pipe the output to a log file,
then read this log file (or part of it).
Bertrand may add some additional info.
[code] // form temporary file path
TString pathtmp = Form("%s/my_tmpfile", gSystem->TempDirectory());
// redirect stdout/stderr in the temporary file
// “w” means write, could be “a” to append
if (gSystem->RedirectOutput(pathtmp.Data(), “w”) != 0) {
Error(“ShowStatus”, “stdout/stderr redirection failed; skipping”);
return;
}
// execute command(s) to be monitored
[…]
// restore back stdout/stderr
if (gSystem->RedirectOutput(0) != 0) {
Error(“ShowStatus”, “stdout/stderr retore failed; skipping”);
return;
}
// load (display) temp file in a text view
fInfoTextView->LoadFile(pathtmp.Data());
[/code]
Cheers,
Bertrand.