Root for loops, how to use?

hello, all I am new to root. I am trying to develop a code to calculate magnetic Jhonson noise, but I can’t seem to get my for loops to work. I am trying to convert my python code into a root code, so it’s entirely possible I’m understanding something wrong as this is my first time using root.
I can run this macro without the for loops and I do get an output as expected (although I should find a function to get the norm instead of Mag2, but that’s a later issue), but when I try to run the macro attached below that contains nested for loops I don’t get an output or anything, the terminal just sits there as if it’s still running the code.
Help is greatly appreciated!

_ROOT Version:6.24/02
_Platform: Windows
Compiler: Not Provided


In the for loop lines (i, j, k), you are missing the “=” in the last part, e.g.

  for (...;  ...;  i+=...)

Without that, the loop variables (i,j,k) are not incrementing and you are in infinite loops (print out the values of i, j and k and check this).

1 Like

That’s a C/C++ question. There is many examples/tutorials online