Dear root users, From the manual, the commands to normalize a histogram (TH1 *h) is: Double_t scale = norm/h.Integral(); h.Scale(scale); I tried to normalize a histogram to 1, but that doesn't work. The normalized histo isn't drawn. And root doesn't say it's an error. However, if I want to include the two lines mentioned above in a macro, an error "Error: / Illegal operator for pointer 3 ..... Error: non class,struct,union object 1/pt used with . or ->..." appears. My commands when I do it on the command line, not in the macro: root [] TH1F *nj = new TH1F("nj","NJET",100,0,20) root [] t.Draw("NJET>>nj") //NJET is a leave name in a tree root [] nj.Draw() //an un-normalized histo drawn root [] Double_t scale = 1/nj.Integral() root [] nj.Scale(scale) root [] nj.Draw() //still, an un-normalized histo When I try to go further to normalize it per entry and per unit of X axis. An error appears. My command: root [18] Double_t scale = nj.GetXaxis().GetBinWidth(1)/nj.GetIntegral() Error: operator '/' divided by zero FILE:(tmpfile) LINE:1 *** Interpreter error recovered *** Any suggestions? Thanks in advance! tcli
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:14 MET