I currently have a .dat file with format:
Format: Log(10,s22th13) deltacp chi^2
-4 0 0.098127
-4 4 0.093642
-4 8 0.089323
-4 12 0.085185
-4 16 0.081242 ....
How would I create a plot using ROOT, keeping the labels specified at the top of the .dat file?
The easiest way would be to read your file using TTree
class:
TTree *T = new TTree("ntuple","data from csv file");
Long64_t nlines = T->ReadFile("data.csv");
printf("found %lld points\n",nlines);
Your header will be used as names for branches. Then you can draw/save histograms using something like that:
TH1F *hist = new TH1F("name","title", nbinsx,xlow,xup);
T->Draw("branch>>name","","");