SegFault calling GetN() method of a TGraph object

You improperly define / use your tree branches / leaves.