ReadFile() incorrectly reads data in assigned file

Hello,

I’m trying to use ReadFile() from TTree to plot data and I’m noticing that it’s not plotting the right values from the column that I selected to plot when I run my code. It’s reading the column as numbers in the range of 10^6, but when you look at the txt file in a text editor and under TScan(), they appear as they should. I will provide the list file in this post along with the code. ReadFile() has worked for me with a similar range of values that I’m trying to plot. Here is the code:

void RMS_mip_histogram ()
{
  TTree t0;
  t0.ReadFile("mip_w_RMS.gains","cell:a:x:y");
  t0.Draw("y:a>>h0");
  TH2F *h0 = (TH2F*) gROOT->FindObject("h0");
  h0->GetXaxis()->SetRangeUser(0,30);
  h0->GetYaxis()->SetRangeUser(0,2);

  TCanvas * c1 = new TCanvas("c1","c1",800,800);
  h0->Draw("CANDLEY6");

}

I hope I can get some help with this. Thanks in advance.

-Charlie Clark
mean_mip_histogram.C (2.2 KB)

_ROOT Version: ROOT 6.26/06
_Platform: MacOS


mip_w_RMS.txt (113.4 KB)

Check your data file, there are 21 entries with value above 10^6 in the second column, plus more entries in the thousands and tens of thousands, even a negative.

t0.Scan("y:a", "a < 0. || a > 100.")

@Wile_E_Coyote If the file is being read incorrectly, this doesn’t help find the problem.

@dastudillo You CAN open the file in a simple text editor and, e.g., inspect the line numbers (±1) shown by the “Scan”.

@Wile_E_Coyote @dastudillo Thank you for your help.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.