-
Notifications
You must be signed in to change notification settings - Fork 29
Add a first version of documentation about histograms #344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
fe1e095
to
4699511
Compare
These histograms have a few caveats:
|
It might be necessary to monitor an algorithm, e.g. by keeping track of how many | ||
times different branches in the algorithm logic are taken. Since Functional | ||
algorithms run potentially multithreaded, the usual approach of simply using | ||
mutable counters or histograms for this is not easily possible. Gaudi, provides |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mutable counters or histograms for this is not easily possible. Gaudi, provides | |
mutable counters or histograms for this is not easily possible. Gaudi provides |
some threadsafe tools to make monitoring Functional algorithms possible more | ||
easily. These tools generally take care of updating counters and histograms in a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some threadsafe tools to make monitoring Functional algorithms possible more | |
easily. These tools generally take care of updating counters and histograms in a | |
some threadsafe tools to make monitoring Functional algorithms more easily | |
possible. These tools generally take care of updating counters and histograms in a |
|
||
In Gaudi all of these tools live in the `Gaudi::Accumulators` namespace and we | ||
refer to the [documentation of | ||
that](ttps://gaudi.web.cern.ch/doxygen/v40r0/da/dd5/namespace_gaudi_1_1_accumulators.html) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that](ttps://gaudi.web.cern.ch/doxygen/v40r0/da/dd5/namespace_gaudi_1_1_accumulators.html) | |
that](https://gaudi.web.cern.ch/doxygen/v40r0/da/dd5/namespace_gaudi_1_1_accumulators.html) |
|
||
Histograms also exist as generic versions and as ROOT backed versions. The main | ||
difference is that the ROOT backed version will obviously produce ROOTs | ||
`TH[1-3][I,D,F]`s (and are hence also limited to at most 3 dimensions), where as |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`TH[1-3][I,D,F]`s (and are hence also limited to at most 3 dimensions), where as | |
`TH[1-3][I,D,F]`s (and are hence also limited to at most 3 dimensions), whereas |
// We can also just define the dimensions and the title | ||
mutable Gaudi::Accumulators::RootHistogram<2> m_hist2d{this, "Hist2D", "A 2D histogram"}; | ||
|
||
// NOTE: For configurable histograms you ahve to register this empty callback |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// NOTE: For configurable histograms you ahve to register this empty callback | |
// NOTE: For configurable histograms you have to register this empty callback |
```python | ||
from Configurables import Gaudi__Histograming__Sink__Root as RootHistoSink | ||
|
||
histoSinkSvc = RootHistSink("RootHistoSink") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
histoSinkSvc = RootHistSink("RootHistoSink") | |
histoSinkSvc = RootHistoSink("RootHistoSink") |
Change here or change above. In Gaudi it is only used once and with the o
.
|
||
### Customizing a histogram | ||
|
||
Configurable histograms need to be crated in `initialize` as follows in order to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Configurable histograms need to be crated in `initialize` as follows in order to | |
Configurable histograms need to be created in `initialize` as follows in order to |
|
||
```cpp | ||
auto operator()(/* However your signature looks like */) { | ||
{ // create a scope to limit the liftime of the buffer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{ // create a scope to limit the liftime of the buffer | |
{ // create a scope to limit the lifetime of the buffer |
Configurable histograms need to be crated in `initialize` as follows in order to | ||
pick up the configuration from python: | ||
```cpp | ||
StatusCode MyAlgorithm::initizlize() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StatusCode MyAlgorithm::initizlize() { | |
StatusCode MyAlgorithm::initialize() { |
Filling a histogram is done by using the `operator[]` of the histogram classes | ||
and is the same, regardless of whether the histograms are configurable or | ||
static, e.g. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filling a histogram is done by using the `operator[]` of the histogram classes | |
and is the same, regardless of whether the histograms are configurable or | |
static, e.g. | |
Filling a histogram is done by using the `operator[]` of the histogram classes | |
and is the same whether the histograms are configurable or | |
static. |
BEGINRELEASENOTES
ENDRELEASENOTES
This is meant to be a basic introduction on how to use monitoring histograms. We should potentially also have a section about the underlying accumulators and maybe a few small examples.