The problem might be that you are creating a new Branch(“current”) or that ReadFile is not reading current.txt correctly. You can check the contents of t with t->Scan(), see the docs.
@eguiraud If I remove these lines, my code will look like this
{
TTree t;
t.ReadFile("NP02_HVCurrent_10-09-2019_11-09-2019.txt");
TH1F *h = new TH1F("h1", "Events Vs Current", 100, -5 , 15);
t.Draw("Current>>h1");
}
I have a file with two columns. One column has time and other column has current data. I am trying to create the histogram of current data. Please let me know the correct way to do that. Thank you.
@eguiraud Here is my code and data. The first column of the data is unix time and the second column is current (microamps). I am trying to create a histogram out of current data. Thank you.
In the first case, the histogram was created and immediately destroyed (there was no corresponding variable), so the TTree::Draw call was filling a new histogram and deciding the binning on its own.