TTreader Error

while (myReader.Next() && myReader1.Next())

BTW. Your code assumes that the length of “z[]” is always the same as that of “energy[]” (and “x[]” and “y[]”).