Hi,
I failed to read an ASCII file with nan value into a tree. After searching the forum and internet, I did not find a solution to it. Since I am new user of ROOT, I appreciate your comments.
My fake data file(testdata.dat) is as follows:
1,2
3,4
nan,6
and my code (treetest.C)is
void treetest()
{
gROOT->Reset();
TTree* pMytree = new TTree(“SimpleTree”,“An example of tree”);
//Long64_t nlines = pMytree->ReadFile(“testdata.dat”,“x:y”);
//printf(“found %lld points\n”,nlines);
ifstream in(“testdata.dat”);
float x,y;
pMytree->Branch(“x”,&x,“x/F”);
pMytree->Branch(“y”,&y,“y/F”);
while(!in.eof()){
in>>x>>y;
pMytree->Fill();
}
//pMytree->Show(1);
//pMytree->Draw(“x”,“y”);
pMytree->Print();
//pMytree->Write();
}
When I use pMytree->ReadFile(“testdata.dat”,“x:y”) to read the data, it only reads the first two rows and did not read the row with nan value.
For the loop method, it frozend. Any suggestions? Thank you very much.
regards,
Gang Ma