[ROOT] Cint and loops?

From: Ole Streicher (ole@ifh.de)
Date: Mon Sep 02 2002 - 18:27:37 MEST


Hi!

I have a problem when using interactive cint. The following doesn't
work for me:

root [0] TH1F *hist = new TH1F("i", "i", 1000, 0., 1000.);
root [1] for (Int_t j = 0; j < 1000; j++) {
!!!Bad command input. Ignored!!!
root [2] for (Int_t j = 0; j < 1000; j++)
root [3] {
end with '}'> hist->Fill(j);
end with '}'> }
(Int_t)(-1)
root [4] hist->Print();
TH1.Print Name= i, Entries= 1, Total sum= 0
 
For me, it is not clear why I can't use the opening brace at the same
line as the for (; ; ) statement.

If I set the opening brace to the next line, I dont get the histogram
filled properly: It has just one entry instead of 1000.

What is the reason for that and how can I write this loop at command
line?

(Sorry for all these questions, but I dont have an "expert" on my site
who may help with the trivial questions)

Ole



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:06 MET