Move computation of bin id from HistoInputType to Axis
This refactoring opens the way to special Arithmetic implementations, like enums or arrays of strings, or just optimize integral axes access.
To-do:
-
implement an example of a special axis.
Merge request reports
Activity
changed milestone to %v36r1
added lhcb-gaudi-head label
- [2021-07-15 00:06] Validation started with lhcb-gaudi-head#2987
- [2021-07-15 01:29] Validation started with lhcb-run2-gaudi-head#167
- [2021-07-16 00:04] Validation started with lhcb-gaudi-head#2988
- [2021-07-16 00:44] Validation started with lhcb-run2-gaudi-head#168
- [2021-07-17 00:30] Validation started with lhcb-gaudi-head#2989
- [2021-07-17 01:23] Validation started with lhcb-run2-gaudi-head#169
- [2021-07-18 00:03] Validation started with lhcb-gaudi-head#2990
- [2021-07-18 00:10] Validation started with lhcb-run2-gaudi-head#170
- [2021-07-20 00:04] Validation started with lhcb-gaudi-head#2991
- [2021-07-20 00:31] Validation started with lhcb-run2-gaudi-head#171
- [2021-07-21 00:28] Validation started with lhcb-gaudi-head#2992
- [2021-07-21 01:29] Validation started with lhcb-run2-gaudi-head#172
- [2021-07-22 00:15] Validation started with lhcb-gaudi-head#2993
- [2021-07-22 01:08] Validation started with lhcb-run2-gaudi-head#173
- [2021-07-23 00:04] Validation started with lhcb-gaudi-head#2994
- [2021-07-24 00:15] Validation started with lhcb-gaudi-head#2995
- [2021-07-24 01:22] Validation started with lhcb-run2-gaudi-head#174
- [2021-07-27 00:03] Validation started with lhcb-gaudi-head#2996
- [2021-07-27 00:46] Validation started with lhcb-run2-gaudi-head#175
- [2021-07-29 00:04] Validation started with lhcb-gaudi-head#2997
- [2021-07-30 00:06] Validation started with lhcb-gaudi-head#2998
- [2021-07-30 00:51] Validation started with lhcb-run2-gaudi-head#176
- [2021-07-31 00:08] Validation started with lhcb-gaudi-head#2999
- [2021-07-31 00:20] Validation started with lhcb-run2-gaudi-head#177
- [2021-08-03 00:04] Validation started with lhcb-gaudi-head#3000
- [2021-08-03 00:30] Validation started with lhcb-run2-gaudi-head#178
- [2021-08-03 00:37] Validation started with lhcb-run2-gaudi-head#178
- [2021-08-04 00:07] Validation started with lhcb-gaudi-head#3001
- [2021-08-04 00:58] Validation started with lhcb-run2-gaudi-head#179
- [2021-08-05 00:04] Validation started with lhcb-gaudi-head#3002
- [2021-08-06 00:09] Validation started with lhcb-gaudi-head#3003
- [2021-08-07 00:07] Validation started with lhcb-gaudi-head#3004
- [2021-08-07 01:03] Validation started with lhcb-gaudi-head#3004
- [2021-08-07 01:23] Validation started with lhcb-gaudi-head#3004
- [2021-08-08 00:03] Validation started with lhcb-gaudi-head#3005
- [2021-08-10 00:04] Validation started with lhcb-gaudi-head#3006
- [2021-08-11 00:06] Validation started with lhcb-gaudi-head#3007
- [2021-08-11 00:50] Validation started with lhcb-run2-gaudi-head#180
- [2021-08-12 00:04] Validation started with lhcb-gaudi-head#3008
- [2021-08-13 00:04] Validation started with lhcb-gaudi-head#3009
- [2021-08-14 00:04] Validation started with lhcb-gaudi-head#3010
- [2021-08-17 00:04] Validation started with lhcb-gaudi-head#3011
- [2021-08-18 00:06] Validation started with lhcb-gaudi-head#3012
- [2021-08-18 01:04] Validation started with lhcb-run2-gaudi-head#181
- [2021-08-19 00:04] Validation started with lhcb-gaudi-head#3013
- [2021-08-19 01:04] Validation started with lhcb-run2-gaudi-head#182
- [2021-08-20 00:07] Validation started with lhcb-gaudi-head#3014
- [2021-08-20 01:07] Validation started with lhcb-run2-gaudi-head#183
- [2021-08-21 00:08] Validation started with lhcb-gaudi-head#3015
- [2021-08-21 00:53] Validation started with lhcb-run2-gaudi-head#184
- [2021-08-22 00:03] Validation started with lhcb-gaudi-head#3016
- [2021-08-24 00:05] Validation started with lhcb-gaudi-head#3017
- [2021-08-24 00:51] Validation started with lhcb-run2-gaudi-head#185
- [2021-08-25 00:03] Validation started with lhcb-gaudi-head#3018
- [2021-08-25 00:52] Validation started with lhcb-run2-gaudi-head#186
- [2021-08-26 00:03] Validation started with lhcb-gaudi-head#3019
- [2021-08-27 00:05] Validation started with lhcb-gaudi-head#3020
- [2021-08-28 00:05] Validation started with lhcb-gaudi-head#3021
- [2021-08-30 00:04] Validation started with lhcb-gaudi-head#3022
- [2021-09-01 00:05] Validation started with lhcb-gaudi-head#3023
- [2021-09-01 00:49] Validation started with lhcb-run2-gaudi-head#187
- [2021-09-02 00:07] Validation started with lhcb-gaudi-head#3024
- [2021-09-03 00:06] Validation started with lhcb-gaudi-head#3025
- [2021-09-03 00:56] Validation started with lhcb-run2-gaudi-head#188
- [2021-09-04 00:06] Validation started with lhcb-gaudi-head#3026
- [2021-09-04 00:58] Validation started with lhcb-run2-gaudi-head#189
- [2021-09-04 01:20] Validation started with lhcb-gaudi-head#3026
- [2021-09-06 00:04] Validation started with lhcb-gaudi-head#3027
- [2021-09-07 00:03] Validation started with lhcb-gaudi-head#3028
- [2021-09-08 00:04] Validation started with lhcb-gaudi-head#3029
- [2021-09-09 00:03] Validation started with lhcb-gaudi-head#3030
- [2021-09-09 00:42] Validation started with lhcb-run2-gaudi-head#190
- [2021-09-10 00:05] Validation started with lhcb-gaudi-head#3031
- [2021-09-11 00:03] Validation started with lhcb-gaudi-head#3032
- [2021-09-12 00:03] Validation started with lhcb-gaudi-head#3033
- [2021-09-13 00:03] Validation started with lhcb-gaudi-head#3034
- [2021-09-14 00:03] Validation started with lhcb-gaudi-head#3035
- [2021-09-14 00:40] Validation started with lhcb-run2-gaudi-head#191
- [2021-09-15 00:03] Validation started with lhcb-gaudi-head#3036
- [2021-09-15 00:46] Validation started with lhcb-run2-gaudi-head#192
- [2021-09-15 09:47] Validation started with lhcb-run2-gaudi-head#193
- [2021-09-16 00:04] Validation started with lhcb-gaudi-head#3037
- [2021-09-16 00:41] Validation started with lhcb-run2-gaudi-head#194
- [2021-09-17 00:06] Validation started with lhcb-gaudi-head#3038
- [2021-09-17 00:55] Validation started with lhcb-run2-gaudi-head#195
Edited by Software for LHCbI added a couple of tests using histograms of
enum class
types.In the exercise I found a bug in the implementation of "isEmpty", but also some issues with the implementation:
- histograms can only use
Gaudi::Accumulators::Axis<T>
- it would be practical to use a custom axis type
- the axis interface require having a number of data members (
nBins
,minValue
, ...)- using member functions instead of data members would allow axis customizations that do not require memory (for enums, those values are compile time constants)
- the constructors from
array<Axis>
andAxis
gets confused if the axis customization is default constructible- it would be useful to
enable_if
only one of the two, depending on the number of dimensions
- it would be useful to
About the constructor from
array<Axis>
, it took me a few hours to realize a segmentation fault at run time was caused by me passing and empty array ({}
) instead of an array with one default constructed axis ({{}}
), while I wanted to pass one default constructed axis ({}
).- histograms can only use
Another note: this will probably conflict with !1234 (merged) and !1235 (merged), so I'll probably rebase, also taking into account that using enum names as bin labels would be very nice.
added 1 commit
- 571482cf - Add test to fill histogram of enums and write it out
added 10 commits
- 9180b13e - Correctly group histograms in ROOT files
- 6ae726fd - Take into account grouping of histograms in directories
- db5709d9 - Test histogram writing and grouping for tools too
- 63917b20 - Store tools' histograms in subdirs of the parent
- a3525dd2 - Add optional bin labels to Histogram accumulators axes
- 02169e0a - Add test of axis labels in Gaudi::Accumulators::Histogram
- 5edbcfc1 - Move computation of bin id from HistoInputType to Axis
- cbba4980 - Fixes to Gaudi::Accumulators::Axis
- eb036f2d - Add unit test for Gaudi::Accumulators::Histogram<..., TestEnum>
- a042ea05 - Add test to fill histogram of enums and write it out
Toggle commit listadded 1 commit
- 17461bab - Add test to fill histogram of enums and write it out
Rebased on !1234 (merged) and !1235 (merged) and changed the tests to use enum values names as labels.
Using a trick like https://github.com/therocode/meta_enum or https://gitlab.cern.ch/lhcb/LHCb/-/blob/master/Kernel/LHCbKernel/include/Kernel/meta_enum.h would make enum axes very easy to write.
- Resolved by Marco Clemencic
As for turning enum values into labels, I would propose to not introduce any new machinery, but re-use what the parsing of properties also requires, namely just an ADL-findable
const std::string& toString(enum_type)
-- and the fact that https://gitlab.cern.ch/lhcb/LHCb/-/blob/master/Kernel/LHCbKernel/include/Kernel/meta_enum.h just so happens to provide that is not a coincidence, as it was intended to provide support for `Gaudi::Property<enum_type> ;-)So in practice this just requires the
enum
to be in some namespace, and an appropriatetoString
must be available in the same namespace...
- Resolved by Marco Clemencic
mentioned in commit d4dc7e10