Skip to content

HistogramRegistry: add support for all root histogram types#4616

Merged
jgrosseo merged 2 commits intoAliceO2Group:devfrom
mario-krueger:histograms
Oct 17, 2020
Merged

HistogramRegistry: add support for all root histogram types#4616
jgrosseo merged 2 commits intoAliceO2Group:devfrom
mario-krueger:histograms

Conversation

@mario-krueger
Copy link
Copy Markdown
Member

  • 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
@ktf
Copy link
Copy Markdown
Member

ktf commented Oct 17, 2020

Please make sure you remove the draft to have this tested.

@mario-krueger mario-krueger marked this pull request as ready for review October 17, 2020 07:21
@mario-krueger mario-krueger requested review from a team, iarsene and jgrosseo as code owners October 17, 2020 07:21
@jgrosseo
Copy link
Copy Markdown
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)

@jgrosseo jgrosseo merged commit a986dd4 into AliceO2Group:dev Oct 17, 2020
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants