Dear all,
How can I import values in the following format to plot the values against time? I am just beginning at programming and I am not sure how to parse this text file and turn it into parameters that I can graph with ROOT.
Fri Mar 25 04:50:46 2011
404.242
Fri Mar 25 04:57:22 2011
404.364
Fri Mar 25 05:03:59 2011
405.199
Fri Mar 25 05:10:35 2011
404.786
Fri Mar 25 05:17:11 2011
404.766
Fri Mar 25 05:23:47 2011
404.452
Fri Mar 25 05:30:23 2011
404.241
I plan to take the parsed information and graph it with the following C++ function.
#include “TH1F.h”
#include “TPad.h”
void DrawVoltage()
{
TH1F* h=(TH1F*)gROOT->FindObject(“h_voltage”);
if(h){
h->Reset();
} else {
h = new TH1F (“h_voltage”,”Voltage Over Time”,500,0,24);
}
h->Draw();
{
x = (PARSED INFO)
h->Fill(x);
gPad->Modified(); gPad->Update();
}
}
I think by writing (500,0,24) I am having the graph range from 0 to 500 on the y axis, and from 0 to 24 on the x axis—if this is incorrect I am not exactly sure what to put instead. I think this function will work to graph the information, but if you see any problems let me know.
I really appreciate anyone’s assistance, I am still learning code and I am having a bit of trouble with this assignment.
Thanks in advance,
Greg