Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
{
gROOT->Reset();
#include "Riostream.h"

ifstream in;

in.open("goodXtalk.dat");

Int_t index;
Float_t leftSlope, leftIntercept, rightSlope, rightIntercept;
int i=0;
Int_t nlines = 0;
TFile *f = new TFile("xtalk.root","RECREATE");

TNtuple *ntuple = new TNtuple("Xtalk","data from ascii file","index:leftSlope:leftIntercept:rightSlope:rightIntercept");

while (1) {
  i++;
  in >> index >> leftSlope >> leftIntercept >> rightSlope >> rightIntercept;

  if (!in.good()) break;

  Xtalk->Fill(index,leftSlope,leftIntercept,rightSlope,rightIntercept);
  nlines++;
}

std::cout<<" found nr of lines: "<<nlines<<std::endl;

in.close();
f->Write();
}