A class to read / open ANSI N42 files

Is there any routine written in ROOT to open ANSI.n42 files? They are used in many spectrometers for histogram output.
http://www.nist.gov/pml/div682/grp04/n42.cfm

A class in ROOT to open them and convert to it to a .root file would be interesting. Or does anyone have any suggestion of C++ library helping here?

I just found this:
https://decibel.ni.com/content/docs/DOC-26504
http://stackoverflow.com/questions/23229006/reading-large-xml-files-with-matlab

Hi,

I don’t think ROOT provides such a routine.
Are you interested in contributing one?

Cheers,
Danilo

Hi,

We do have support for reading XML file (TXMLEngine, etc.), see for example the tutorials in tutorials/xml and in particular tutorials/xml/xmlreadfile.C. It is likely that using this to reading ANSI N42 files should be straight forward (possibly with inspiration from decibel.ni.com/content/docs/DOC-26504).

Cheers,
Philippe.

Please find attached my contribution. Tested on Ubuntu 16.04 and ROOT 6.09

The spectrum can be accessed as:

TFile* _file0 = TFile::Open("Annex B.root");
TH1* h = NULL;
_file0->GetObject("RadInstrumentData/RadMeasurement_RadMeasurement-1/Spectrum_RadMeasurement-1Spectrum-1/ChannelData/RadMeasurement-1Spectrum-1",h);
new TCanvas();
h->Draw();

Regards.
Annex B.zip (1.16 KB)
Annex B.root (13.9 KB)
convert_ANSI_N42_42.cpp (8.63 KB)