Data file to .root [Segmentation violation]

Dear Root experts;

I stuck in converting the magnetic field data in root file. I have written a code (from an example given in root forum) but am receiving segmentation fault.

My data file has 6 columns and 20000 lines. I am unable to proceed now. Please help me.

For the sake I am attaching herewith the c and data file.
field.C (608 Bytes)

Regards
vJ
field.txt (1.6 KB)

PS::
The error I am getting is as:
*** Break *** segmentation violation

===========================================================
There was a crash.
This is the entire stack trace of all threads:

In your “field.txt” file, make sure that the values are separated by at least one space character.

{
  TFile *f = new TFile("MATRIX.root", "RECREATE");
  TTree *t = new TTree("ntuple", "data from the MATRIX file");
  t->ReadFile("field.txt", "x:y:z:a:b:c");
  // t->Scan("*");
  TH1F *h = new TH1F("h1", "x distribution", 100, -4., 4.);
  t->Project("h1", "x");
  f->Write();
  delete f; // automatically deletes t and h, too
}
2 Likes

Thanyou so much … It is Solved … A hug … Gracias …