Skip to content

Commit c8caab2

Browse files
improve example
1 parent e93be7f commit c8caab2

2 files changed

Lines changed: 27 additions & 24 deletions

File tree

examples/example.yaml

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,45 @@
11
1D:
2-
- name: "px"
3-
x_axis: &sim_px
4-
title: "p_{x}, GeV/c"
5-
field: "SimParticles.px"
6-
bins: [100, -3., 3.]
7-
cuts: "rec_pT_cut"
8-
- name: "py"
2+
# Simplest way to define plot
3+
- name: "sim_pT"
94
x_axis:
10-
field: "RecTracks.py"
11-
bins_edges: [0, 0.2, 0.5, 1, 2]
5+
field: "SimParticles.pT"
6+
bins: [100, 0, 3]
7+
# Better way to define plot (cuts are defined in C++ code)
8+
- name: "sim_pT_y_1.5_3"
9+
x_axis: &sim_pT # anchor could be reused later
10+
title: "p_{T}, GeV/c"
11+
field: "SimParticles.pT"
12+
bins: [100, 0, 3]
13+
cuts: "sim_y_cut"
14+
# Plot by variable name (defined in C++ code)
1215
- name: "pxpy"
1316
x_axis:
1417
field: "pxpy"
1518
bins: [100, -3, 3]
1619
2D:
17-
- name: "px_py"
18-
x_axis: *sim_px
19-
y_axis: &sim_py
20-
title: "p_{y}, GeV/c"
21-
field: "SimParticles.py"
22-
bins: [100, -2, 2]
20+
- name: "sim_pT_y"
21+
x_axis: &sim_y
22+
title: "#it{y}_{Lab}"
23+
field: "SimParticles.rapidity"
24+
bins: [100, -2, 6]
25+
y_axis: *sim_pT
2326
Profile:
24-
- name: "px_py_profile"
25-
x_axis: *sim_px
26-
y_axis: *sim_py
27+
- name: "pT_y_profile"
28+
x_axis: *sim_pT
29+
y_axis: *sim_y
2730
Integral:
2831
- name: "pT_integral"
29-
x_axis: &sim_pT
32+
x_axis: &sim_pT_integral
3033
title: "#Sum{p_{T}, GeV/c}"
3134
field: "SimParticles.pT"
3235
bins: [100, 0, 100]
33-
cuts: "rec_pT_cut"
36+
cuts: "sim_y_cut"
3437
Integral2D:
3538
- name: "pT_M_integral"
3639
x_axis:
3740
title: "M"
3841
field: "SimParticles.ones"
3942
bins: [100, 0, 2000]
40-
y_axis: *sim_pT
41-
y_cuts: "rec_pT_cut"
43+
y_axis: *sim_pT_integral
44+
y_cuts: "sim_y_cut"
4245

examples/test_yaml.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ void example(const std::string& filelist){
1414
auto* task = new QA::Task;
1515
task->SetOutputFileName("cbm_qa.root");
1616

17-
Cuts* pT_cut = new Cuts("rec_pT_cut", {RangeCut("RecTracks.pT", 1, 1.5)});
1817
Variable pxpy("pxpy", {{"RecTracks", "px"}, {"RecTracks", "py"}}, []( std::vector<double>& var ) { return var.at(0)*var.at(1); });
1918

20-
task->AddCut(pT_cut);
19+
task->AddCut(new Cuts("sim_y_cut", {RangeCut("SimParticles.rapidity", 1.5, 3)}));
20+
task->AddCut(new Cuts("rec_pT_cut", {RangeCut("RecTracks.pT", 1, 1.5)}));
2121
task->AddVariable(pxpy);
2222

2323
QA::YamlReader r("/Users/viktor/Soft/AnalysisTreeQA/examples/example.yaml");

0 commit comments

Comments
 (0)