Yasir
1
Please provide the following information:
ROOT Version (5.34.03):
Platform, Windows 7
I would like to write the bincontent of histogram to text file
I am doing this
Int_t n = p->GetNbinsX();
for (Int_t i=1; i<=n; i++) {
printf("%g %g\n",
p->GetBinLowEdge(i)+p->GetBinWidth(i)/2,
p->GetBinContent(i));
p.Print("all"); >myhist.txt
}
But I get this error : "Syntax Error: >myhist.txt may be missing;
Well, this works just fine on the command line (with ROOT v5.34/36), but inside a macro it should be like this:
Int_t n = p->GetNbinsX();
for (Int_t i=1; i<=n; i++) {
printf("%g %g\n",
p->GetBinLowEdge(i)+p->GetBinWidth(i)/2,
p->GetBinContent(i));
gInterpreter->ProcessLine(Form("((TH1F *)0x%lx)->Print(\"all\"); >myhist.txt", p));
}
Cheers, Bertrand.
Yasir
3
Thanks Bellenot It is working
1 Like
system
Closed
4
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.