Support import of ROOT (CERN) TH1 histograms
ClosedPublic

Authored by croick on Jun 24 2018, 9:45 PM.

Details

Summary

The data analysis framework ROOT (https://root.cern.ch/)
provides its own file type containing different types of
histograms.
To prevent the use of the native library, a light ROOTHist
class gives access to the required data of the histograms.

  • depends on LZIP and LZ4 compression
  • no export module foreseen so far
  • test data will be provided in a separate commit
Test Plan

Open a new project and import histograms into a workbook.
The underflow bin can be skipped by increasing the start row.

Diff Detail

Repository
R262 LabPlot
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
croick created this revision.Jun 24 2018, 9:45 PM
Restricted Application added a project: KDE Edu. · View Herald TranscriptJun 24 2018, 9:45 PM
Restricted Application added a subscriber: kde-edu. · View Herald Transcript
croick requested review of this revision.Jun 24 2018, 9:45 PM
sgerlach requested changes to this revision.Jun 24 2018, 11:13 PM

Your patch is excellent and of extreme high quality. Thank you.
Can you check if "ROOT" can be put after "FITS"?

src/backend/datasources/LiveDataSource.h
52

Can "ROOT" be also put after "FITS"? This can avoid problems with older project files using FITS.

src/kdefrontend/datasources/ImportFileDialog.cpp
231–232

... and ROOT

This revision now requires changes to proceed.Jun 24 2018, 11:13 PM
fkristof added inline comments.Jun 25 2018, 11:17 AM
src/backend/datasources/filters/ROOTFilter.cpp
169

columnOffSet can be const if you don't intend to change it.

182

I suggest you to group these conditions with parenthesis so it's easier to understand them.

192
const QString & fileName

Extra space, remove it

202

This should be

const auto&
src/backend/datasources/filters/ROOTFilterPrivate.h
71

The code should follow our conventions. We use camelCase in the naming.

src/kdefrontend/datasources/ROOTOptionsWidget.cpp
73
const auto&
croick updated this revision to Diff 36705.Jun 26 2018, 5:49 PM
  • Put ROOT after FITS
  • Fix style
croick updated this revision to Diff 36706.Jun 26 2018, 5:51 PM
  • Enable easier selection of columns and bin ranges
croick marked 7 inline comments as done.Jun 26 2018, 6:06 PM

Thank you for your quick feedback.

Maybe the initial patch was submitted a little precoiously, the latest diff includes quite a few changes (sorry for that) which should improve the usability:

  • Don't make use of the data portion widget, but use checkboxes for the selection of columns.
  • Also the bin ranges are now selected on the same options page and are adjusted according to the selected histogram.
    • This might require later changes; if somebody wants to import multiple histograms with different numbers of bins.
src/kdefrontend/datasources/ROOTOptionsWidget.cpp
73

Actually they are pointers, so I used auto* to make that clear.

sgerlach accepted this revision.Jun 26 2018, 6:39 PM
This revision is now accepted and ready to land.Jun 26 2018, 6:39 PM
fkristof accepted this revision.Jun 26 2018, 6:48 PM
fkristof added inline comments.
src/kdefrontend/datasources/ROOTOptionsWidget.cpp
73

Right, then they can be const items const pointers, aka

const auto* const item
This revision was automatically updated to reflect the committed changes.