Skip to content

DPL Analysis: Extended histogram registry to use TH2 and TH3#4063

Merged
ktf merged 2 commits intoAliceO2Group:devfrom
saganatt:histogram-registry
Aug 15, 2020
Merged

DPL Analysis: Extended histogram registry to use TH2 and TH3#4063
ktf merged 2 commits intoAliceO2Group:devfrom
saganatt:histogram-registry

Conversation

@saganatt
Copy link
Copy Markdown
Collaborator

Ciao @ktf,
this is a small introductory PR to allow for using different histograms in the histogram registry.

THn/THnSparse have different set of arguments in the constructors so I'd need to add HistogramConfigSpec specialization for these. TH1/2/3 can also accept different arguments (arrays of bins instead of min and max values), so that would require yet another Config specializations.
Or perhaps we should not store histogram-dependent values in a generic type?

@saganatt saganatt requested a review from a team as a code owner July 30, 2020 10:46
@ktf
Copy link
Copy Markdown
Member

ktf commented Aug 1, 2020

why making the histogramspec templated, rather than having a templated helper to construct a non templated one?

@saganatt
Copy link
Copy Markdown
Collaborator Author

saganatt commented Aug 1, 2020

why making the histogramspec templated, rather than having a templated helper to construct a non templated one?

OK, still I am thinking how to cope with different histograms requring different arguments - shall we have one big HistogramSpec containing all possible fields matching different histograms?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why making a template method, rather than a templated helper? Something like:

registry.insert(hs<TH1>());

This way you move the complexity on the helper rather than on the registry, which, IMHO it's more manageable / customizable.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, then we are back to making HistogramSpec templated? IMHO HistogramSpec needs to be templated to create different histogram types in a nicer way.

@saganatt saganatt force-pushed the histogram-registry branch from a30beb5 to e433607 Compare August 11, 2020 07:34
@saganatt
Copy link
Copy Markdown
Collaborator Author

Ciao @ktf , let me know if this is ok for you.

I noticed also that we store unique ptrs to TH1, but THn and THnSparse aren't derived from it, so they cannot be stored here. Shall we forget about them for now?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you you need to pass the type and the string with the type name?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The string is a remainder from the primary version, if it didn't have any purpose, I will delete it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My point is that if you have histSpec<TH1F>() you know you need to put "TH1F" in the spec. Unless that serves some other usecase.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest, I don't know if the spec string is needed now?
Hm, for that I'd have to store hardcoded lists of types and strings to set string without many ifs etc.
Actually, then one could pass just string and no templates will be needed. If hardcoded list is not a problem, maybe it would be better from the user's point of view...?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use fmt::format, not boost format. Why do you need the type as a string? Also, why do you return a tuple<uint32_t, TH1*>? A std::pair would have been ok, no? Why not just the HistogramSpec as before?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I will adjust the strings and tuple.
If I return histogram spec, I lose the type information for HistogramRegistry constructor. I would need to have HistogramSpec or HistogramRegistry templated. Now I just pass ready histograms of proper types as TH1*.

@saganatt saganatt force-pushed the histogram-registry branch from 3d76a61 to 4103f83 Compare August 14, 2020 16:40
@saganatt saganatt force-pushed the histogram-registry branch from 4103f83 to 6ae1ad7 Compare August 14, 2020 16:43
@ktf ktf merged commit 7c43a8a into AliceO2Group:dev Aug 15, 2020
ktf added a commit that referenced this pull request Aug 18, 2020
ktf added a commit that referenced this pull request Aug 18, 2020
arakotoz pushed a commit to arakotoz/AliceO2 that referenced this pull request Sep 26, 2020
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.

2 participants