Skip to content

Commit da2c322

Browse files
update ldmx-sw analysis tutorial with histogram name change
1 parent c3b66df commit da2c322

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

src/using/analysis/analyzer-total-rec-energy.cxx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,13 @@ class MyAnalyzer : public framework::Analyzer {
1313
};
1414

1515
void MyAnalyzer::onProcessStart() {
16-
getHistoDirectory(); // forget this -> silently no output histogram
16+
/**
17+
* In v4.5.1 ldmx-sw and earlier, forgetting `getHistoDirectory()`
18+
* led to silently not creating any histograms.
19+
* In v4.5.2 ldmx-sw and newer, it can be left out but it does
20+
* no harm if left in.
21+
*/
22+
getHistoDirectory();
1723
histograms_.create(
1824
"total_ecal_rec_energy",
1925
"Total ECal Rec Energy [GeV]", 160, 0.0, 16.0

src/using/analysis/ldmx-sw.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ One can follow the same general workflow with [some additional changes
3838
to the config script](#pre-401-standalone-analyzers) described below.
3939
```
4040
cd work-area
41-
denv init ldmx/pro:v4.0.1
41+
denv init ldmx/pro:<ldmx-sw-version>
4242
```
43+
where `<ldmx-sw-version>` is a version of ldmx-sw that has been [released](https://github.com/LDMX-Software/ldmx-sw/releases). The version of ldmx-sw you want to use depends on what features
44+
you need and input data files you want to analyze.
4345
The following code block shows the necessary boilerplate for starting
4446
a C++ analyzer running with ldmx-sw.
4547
```cpp
@@ -97,6 +99,8 @@ made within the function definitions.
9799
```cpp
98100
{{#include analyzer-total-rec-energy.cxx}}
99101
```
102+
Look at the [documentation of the HistogramPool](https://ldmx-software.github.io/ldmx-sw/classframework_1_1HistogramPool.html)
103+
to see more examples of how to `create` and `fill` histograms.
100104
101105
In order to run this code on the data, we need to compile and run the program.
102106
The special `from_file` function within the config script handles this in
@@ -123,6 +127,13 @@ $ denv rootls -l hist.root:*
123127
TH1F Apr 30 22:30 2024 MyAnalyzer_total_ecal_rec_energy ""
124128
```
125129
130+
~~~admonish warning title="Naming Change"
131+
In v4.5.2 of ldmx-sw, the histogram pooling was changed to avoid referencing the name
132+
of the analyzer in both the directory and the histogram itself.
133+
Before this release, the histogram would have been located at "MyAnalyzer/MyAnalyzer_total_ecal_rec_energy"
134+
but if you are using this release or newer, the same histogram would be located at "MyAnalyzer/total_ecal_rec_energy".
135+
~~~
136+
126137
## Plotting Histograms
127138
Viewing the histogram with the filled data is another fork in the road.
128139
I often switch back to the Jupyter Lab approach using `uproot` to load histograms from `hist.root`

0 commit comments

Comments
 (0)