HistogramRegistry: add support for all root histogram types#4616
Merged
jgrosseo merged 2 commits intoAliceO2Group:devfrom Oct 17, 2020
Merged
HistogramRegistry: add support for all root histogram types#4616jgrosseo merged 2 commits intoAliceO2Group:devfrom
jgrosseo merged 2 commits intoAliceO2Group:devfrom
Conversation
Member
mario-krueger
commented
Oct 16, 2020
- renamed readableName to title (to be consistent with root naming conventions)
- made nBins in AxisSpec std::optional to seamlessly distinguish between fixed and variable binning per axis -> removed binsEqual in AxisSpec and HistogramConfigSpec
- added callSumw2 property to HistogramSpec
- rename axis lable -> title (to be consistent with root naming conventions)
- added optional name property to axis (this can be helpful in n dimensional histograms so they are not only called axis0, axis1, axis2...)
- added possibility to insert axes also after ctor was called
- store histograms in registry in form of a std::variant (HistPtr) that can take any root hist pointer type
- added static HistFactory helper class that handles the creation of the actual root histograms
- HistFactory provides createHist<>() function to instanciate arbitrary histogram based on the blueprint defined in HistogramSpec
- HistFactory provides createHistVariant<>() function that creates the histogram and returns a properly casted HistPtr which can be stored in the registry
- HistFactory provides a runtime version of the above, which creates the histogram based on the type information stored in HistogramConfigSpec
- it was necessary to move from unique_ptrs to shared_ptrs because we must be able to 'downcast' the actual pointer to the few interface types stored in HistPtr (this can not be done with unique ptrs). As a beneficial side effect, this way the pointers created by the HistFactory can also be stored in OutputObj<> (which uses shared_ptrs)
- extend HistogramCreationCallback to cover all root histogram types
- moved HistogramCallbacks map to .cxx as it is now const static member variable in HistFactory that should be defined only once (otherwise linker will complain)
- get() now also requires to specify the interface type (TH1, TH2, TH3, THn, THnSparse, TProfile, TProfile2D or TProfile3D) since type cannot be infered from the variant at compile time
- allowed adding histograms to an existing registry
- added HistFiller static helper class that contains functions to fill histogams of any type both simply via values or via filtered tables
- extended existing fill-from-table functionality to arbitrary number of dimensions
- added fill and fillWeight functions to registry that can fill the stored histograms (again providing a version to fill values and one to fill whole filtered table)
- renamed HistogramType -> HistType to reduce code verbosity
- renamed readableName to title (to be consistent with root naming conventions) - made nBins in AxisSpec std::optional to seamlessly distinguish between fixed and variable binning per axis -> removed binsEqual in AxisSpec and HistogramConfigSpec - added callSumw2 property to HistogramSpec - rename axis lable -> title (to be consistent with root naming conventions) - added optional name property to axis (this can be helpful in n dimensional histograms so they are not only called axis0, axis1, axis2...) - added possibility to insert axes also after ctor was called - store histograms in registry in form of a std::variant (HistPtr) that can take any root hist pointer type - added static HistFactory helper class that handles the creation of the actual root histograms - HistFactory provides createHist<>() function to instanciate arbitrary histogram based on the blueprint defined in HistogramSpec - HistFactory provides createHistVariant<>() function that creates the histogram and returns a properly casted HistPtr which can be stored in the registry - HistFactory provides a runtime version of the above, which creates the histogram based on the type information stored in HistogramConfigSpec - it was necessary to move from unique_ptrs to shared_ptrs because we must be able to 'downcast' the actual pointer to the few interface types stored in HistPtr (this can not be done with unique ptrs). As a beneficial side effect, this way the pointers created by the HistFactory can also be stored in OutputObj<> (which uses shared_ptrs) - extend HistogramCreationCallback to cover all root histogram types - moved HistogramCallbacks map to .cxx as it is now const static member variable in HistFactory that should be defined only once (otherwise linker will complain) - get() now also requires to specify the interface type (TH1, TH2, TH3, THn, THnSparse, TProfile, TProfile2D or TProfile3D) since type cannot be infered from the variant at compile time - allowed adding histograms to an existing registry - added HistFiller static helper class that contains functions to fill histogams of any type both simply via values or via filtered tables - extended existing fill-from-table functionality to arbitrary number of dimensions - added fill and fillWeight functions to registry that can fill the stored histograms (again providing a version to fill values and one to fill whole filtered table) - renamed HistogramType -> HistType to reduce code verbosity
Member
|
Please make sure you remove the draft to have this tested. |
Collaborator
|
@mkruegerGitHub I am happy to merge this. Could you send me by mattermost a shorter description for the squashed commit? (In this way, you don't need to push and rerun all the tests just for changing the commit message) |
tklemenz
pushed a commit
to tklemenz/AliceO2
that referenced
this pull request
Nov 12, 2020
…roup#4616) - store histograms in std::variant to support arbitrary root types - add fill() and fillWeight() functions to the registry - support filling by value and filling from filtered table with variable number of arguments depending on histogram dimensions
EmilGorm
pushed a commit
to EmilGorm/AliceO2
that referenced
this pull request
Nov 22, 2021
…roup#4616) - store histograms in std::variant to support arbitrary root types - add fill() and fillWeight() functions to the registry - support filling by value and filling from filtered table with variable number of arguments depending on histogram dimensions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.