A problem when reading a ascii file by using the read function of RooDataSet

Hi, here is my problem. The file “a.txt” I want to read contains contents like"0.85678E-58 0.30111E+03 0.677E+29". However, when I use RooDataSet *data=RooDataSet::read(“a.txt”, RooArgSet(x,y,z)), it said that 0.85678E is not a Double_t value. It seems that this RooDataSet::read method cannot recognize “-” and “+”. Does anyone know how can I solve this?
Thank you for all the help!
Juan

Hi Juan,

I think your second best bet is to re-format the input text file.

The better option, probably easier and more useful for the world: teach RooFit to read these numbers and create a github pull request so this gets fixed once and for all! Let us know if you need help with this!

Cheers, Axel.

Hi, Axel

Thanks your reply. I think it is hard to re-format the input file since I don’t know other ways to express values like “E-98”. I agree with you, the better way is to teach RooFit to read these numbers. I trace back from the function RooDataSet:read to RooRealVar::readFromStream and RooStreamParser::readToken(), however, still haven’t solve this. It will be very appreciated if you could help!

Thanks
Juan

Hi Juan,
Line 230 in RooStreamParser.cxx seems to suggest that e32 is supported, only capital E is not. Maybe you could try adding E there as one of the options?
Axel.

Hi, Axel

It works! Many thanks for the help!

Juan

Good! Would you mind sending a patch / pull request?
Axel.

OK. I will try to do it after I understand how to send a pull request.
Juan

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.