Moved some declarations around so outfile is visible from other functions.
Writing TGraph to output file after every calibration.