Skip to content

Commit 8021ec6

Browse files
authored
DPL Analysis: ability to use some Configurables in filters (#4274)
1 parent fa6f5c0 commit 8021ec6

12 files changed

Lines changed: 1173 additions & 905 deletions

File tree

‎Analysis/Tutorials/src/histograms.cxx‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
using namespace o2;
1818
using namespace o2::framework;
19+
using namespace o2::framework::expressions;
1920

2021
// This is a very simple example showing how to create an histogram
2122
// FIXME: this should really inherit from AnalysisTask but
@@ -58,6 +59,8 @@ struct CTask {
5859
OutputObj<TH1F> trZ{"trZ", OutputObjHandlingPolicy::QAObject};
5960
Configurable<float> pTCut{"pTCut", 0.5f, "Lower pT limit"};
6061

62+
Filter ptfilter = aod::track::pt > pTCut;
63+
6164
void init(InitContext const&)
6265
{
6366
trZ.setObject(new TH1F("Z", "Z", 100, -10., 10.));
@@ -67,11 +70,9 @@ struct CTask {
6770
// trZ.setObject({"Z","Z",100,-10.,10.}); <- creates new
6871
}
6972

70-
void process(aod::Tracks const& tracks)
73+
void process(soa::Filtered<aod::Tracks> const& tracks)
7174
{
7275
for (auto& track : tracks) {
73-
if (track.pt() < pTCut)
74-
continue;
7576
ptH->Fill(track.pt());
7677
trZ->Fill(track.z());
7778
}

‎Analysis/Tutorials/src/partitions.cxx‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@ using namespace o2::framework::expressions;
2121
// we need GCC 7.4+ for that
2222
struct ATask {
2323
float fPI = static_cast<float>(M_PI);
24-
float ptlow = 0.5f;
25-
float ptup = 2.0f;
24+
Configurable<float> ptlow{"pTlow", 0.5f, "Lowest pT"};
25+
Configurable<float> ptup{"pTup", 2.0f, "highest pT"};
2626
Filter ptFilter_a = aod::track::pt > ptlow;
2727
Filter ptFilter_b = aod::track::pt < ptup;
2828

29-
float etalow = -1.0f;
30-
float etaup = 1.0f;
29+
Configurable<float> etalow{"etaLow", -1.0f, "lowest eta"};
30+
Configurable<float> etaup{"etaUp", 1.0f, "highest eta"};
3131
Filter etafilter = (aod::track::eta < etaup) && (aod::track::eta > etalow);
3232

33-
float philow = 1.0f;
34-
float phiup = 2.0f;
33+
Configurable<float> philow{"phiLow", 1.0f, "lowest phi"};
34+
Configurable<float> phiup{"phiUp", 2.0f, "highest phi"};
3535

3636
using myTracks = soa::Filtered<aod::Tracks>;
3737

0 commit comments

Comments
 (0)