CSV file to histogram

Hello,

Is there any easy way to fill a Th2 histogram from a CSV file (comma separated 2D table) ? (some build in stuff?)

Tamas

Hi,

For inspiration $ROOTSYS/tutorials/basic.C

Cheers,
Philippe.

Hello,

thank you for your answer, but I know this example. In my case there is 512 row and 512 column …
I thought there is a CSV class to handle these kind of files like in IDL (www.rsinc.com). I’ve read another post about reading a BMP file into TH2, which is quiet the same task. I hope in the future release there will be a handler for this kind of job. It would be great!

Tamas

Hi,

You are welcome to provide the actual implementation :slight_smile: This would speed up the incorporation of this feature in ROOT.

Cheers,
Philippe.

Hi,
[ul]there is a lot of open source software
which do reading CSV files. Probably the most
famous is MySQL. If you are going to implement it I
suggest to look into MySQL code.[/ul]

Concerning BMP files …

[ul]ROOT uses TImage->TASImage -> libAfterImage library
to read BMP files. libAfterImage can generate an image
from so called “scientific data” (an array of double precision values).
Check, for example,

$ROOTSYS/tutorials/galaxy_image.C

In principle, it’s possible reverse convertion , i.e.
image-> “scientific data”. We contacted to Sasha Vasko,
the author of libAfterImage, to provide such facility.
Hopefully will appear soon.[/ul]

Regards. Valeriy

This file is now located:

$ROOTSYS/tutorials/[size=150]tree[/size]/basic.C