Skip to content

Commit cd8e576

Browse files
authored
DPL Analysis: add an example of the string filter (#14570)
1 parent 0364324 commit cd8e576

File tree

1 file changed

+31
-4
lines changed

1 file changed

+31
-4
lines changed

Framework/TestWorkflows/src/o2TestHistograms.cxx

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,17 @@ DECLARE_SOA_TABLE(SkimmedExampleTrack, "AOD", "SKIMEXTRK", //!
3939
struct EtaAndClsHistogramsSimple {
4040
OutputObj<TH2F> etaClsH{TH2F("eta_vs_pt", "#eta vs pT", 102, -2.01, 2.01, 100, 0, 10)};
4141
Produces<o2::aod::SkimmedExampleTrack> skimEx;
42+
Configurable<std::string> trackFilterString{"track-filter", "o2::aod::track::pt < 10.f", "Track filter string"};
43+
Filter trackFilter = o2::aod::track::pt < 10.f;
4244

43-
void process(aod::Tracks const& tracks, aod::FT0s const&)
45+
void init(InitContext&)
46+
{
47+
if (!trackFilterString->empty()) {
48+
trackFilter = trackFilterString;
49+
}
50+
}
51+
52+
void process(soa::Filtered<aod::Tracks> const& tracks, aod::FT0s const&)
4453
{
4554
LOGP(info, "Invoking the simple one");
4655
for (auto& track : tracks) {
@@ -53,10 +62,19 @@ struct EtaAndClsHistogramsSimple {
5362
struct EtaAndClsHistogramsIUSimple {
5463
OutputObj<TH2F> etaClsH{TH2F("eta_vs_pt", "#eta vs pT", 102, -2.01, 2.01, 100, 0, 10)};
5564
Produces<o2::aod::SkimmedExampleTrack> skimEx;
65+
Configurable<std::string> trackFilterString{"track-filter", "o2::aod::track::pt < 10.f", "Track filter string"};
66+
Filter trackFilter = o2::aod::track::pt < 10.f;
5667

57-
void process(aod::TracksIU const& tracks, aod::FT0s const&)
68+
void init(InitContext&)
5869
{
59-
LOGP(info, "Invoking the simple one");
70+
if (!trackFilterString->empty()) {
71+
trackFilter = trackFilterString;
72+
}
73+
}
74+
75+
void process(soa::Filtered<aod::TracksIU> const& tracks, aod::FT0s const&)
76+
{
77+
LOGP(info, "Invoking the simple one IU");
6078
for (auto& track : tracks) {
6179
etaClsH->Fill(track.eta(), track.pt());
6280
skimEx(track.pt(), track.eta());
@@ -66,8 +84,17 @@ struct EtaAndClsHistogramsIUSimple {
6684

6785
struct EtaAndClsHistogramsFull {
6886
OutputObj<TH3F> etaClsH{TH3F("eta_vs_cls_vs_sigmapT", "#eta vs N_{cls} vs sigma_{1/pT}", 102, -2.01, 2.01, 160, -0.5, 159.5, 100, 0, 10)};
87+
Configurable<std::string> trackFilterString{"track-filter", "o2::aod::track::pt < 10.f", "Track filter string"};
88+
Filter trackFilter = o2::aod::track::pt < 10.f;
89+
90+
void init(InitContext&)
91+
{
92+
if (!trackFilterString->empty()) {
93+
trackFilter = trackFilterString;
94+
}
95+
}
6996

70-
void process(soa::Join<aod::FullTracks, aod::TracksCov> const& tracks)
97+
void process(soa::Filtered<soa::Join<aod::FullTracks, aod::TracksCov>> const& tracks)
7198
{
7299
LOGP(info, "Invoking the run 3 one");
73100
for (auto& track : tracks) {

0 commit comments

Comments
 (0)