Dear, I want to draw few graphs (column 8 Vs column 9, column 11 Vs column 12, then 1D histogram of area (= 3.1416column 11 column 12) from an ascii file (attached below). I stuck in first stage, reading ascii file accurately by TTree and Ntuple. Here I attach the code. So the problems are how can I read all column accurately , then perform mathematical equation for area and then fill column for graph (TGraph or TH1D). I tried this code from User Guide and some examples.
gROOT->Reset();
struct staff_t {
Double_t a;
Double_t b;
Double_t c;
Double_t d;
Double_t e;
Double_t f;
Double_t g;
Double_t h;
Double_t k;
Double_t l;
Double_t m;
};
staff_t staff;
FILE *fp = fopen("Image_146.pft","r");
char line[650];
TFile *i = new TFile("staff.root","RECREATE");
TTree *tree = new TTree("T","pit data from ascii file");
tree->Branch("staff",&staff.a,"a/D:b/D:c/D:d/D:e/D:f/D:g/D:h/D:k/D:l/D:m/D");
while (fgets(&line,650,fp)) {
sscanf(&line[0],"%f%f%f%f",&staff.a,&staff.b,&staff.c,&staff.d,);
sscanf(&line[13],"%f%f%f%f",&staff.e,&staff.f,&staff.g,&staff.h);
sscanf(&line[24],"%f%f%f",&staff.k,&staff.l,&staff.m);
tree->Fill();
}
tree.Scan("a:b:c:d:e:f:g:h:k:l:m");
Your kind help will be appreciated. It can be mention that I am a new user of ROOT.
ascii file (Image_146.pft): http://www.filedropper.com/image146