Skip to content

Commit 2e1eea7

Browse files
committed
Collision and track filters added.
1 parent 07ee882 commit 2e1eea7

1 file changed

Lines changed: 21 additions & 24 deletions

File tree

PWGCF/Flow/Tasks/flowSmallSystems.cxx

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -35,41 +35,38 @@ using namespace o2::framework::expressions;
3535
// A basic event selection is applied.
3636

3737
struct FlowSmallSystems {
38-
O2_DEFINE_CONFIGURABLE(cfgPtMin, double, 0.2, "Minimum pt (GeV/c)");
39-
O2_DEFINE_CONFIGURABLE(cfgPtMax, double, 10.0, "Maximum pt (GeV/c)");
38+
O2_DEFINE_CONFIGURABLE(cfgPtMin, float, 0.2, "Minimum pt (GeV/c)");
39+
O2_DEFINE_CONFIGURABLE(cfgPtMax, float, 10, "Maximum pt (GeV/c)");
40+
O2_DEFINE_CONFIGURABLE(cfgEta, float, 0.8, "Eta cut");
41+
O2_DEFINE_CONFIGURABLE(cfgVtxZ, float, 10, "Vertex cut in z (cm)");
4042
HistogramRegistry registry{"HistRegistry"};
4143

4244
// Equivalent of the AliRoot task UserCreateOutputObjects
43-
void init(InitContext&)
45+
void init(InitContext const&)
4446
{
4547
// Define your axes
4648
// Constant bin width axis
47-
std::vector<double> ptBinning = {cfgPtMin};
48-
while (ptBinning.back() < cfgPtMax)
49-
{
50-
if (ptBinning.back() < 1.0) {
51-
ptBinning.emplace_back(ptBinning.back() + 0.1);
52-
} else if (ptBinning.back() < 5.0) {
53-
ptBinning.emplace_back(ptBinning.back() + 0.5);
54-
} else if (ptBinning.back() < 10.0) {
55-
ptBinning.emplace_back(ptBinning.back() + 1.0);
56-
} else {
57-
ptBinning.emplace_back(ptBinning.back() + 10.0);
58-
}
59-
}
60-
AxisSpec PtAxis = {ptBinning, "#it{p}_{T} (GeV/#it{c})"};
49+
std::vector<double> cfgPtBinning = {0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95,
50+
1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9,
51+
2, 2.2, 2.4, 2.6, 2.8,
52+
3, 3.5, 4, 5, 6,
53+
8, 10};
54+
AxisSpec axisPt = {cfgPtBinning, "#it{p}_{T} (GeV/#it{c})"};
6155
// Add histograms to histogram manager (as in the output object of in AliPhysics)
62-
registry.add("hPt", ";#it{p}_{T} (GeV/#it{c})", HistType::kTH1D, {PtAxis});
63-
registry.add("hVtxZ",";z (cm)", HistType::kTH1D, {{160, -20, 20}});
56+
registry.add("hPt", ";#it{p}_{T} (GeV/#it{c})", HistType::kTH1D, {axisPt});
57+
registry.add("hVtxZ",";z (cm)", HistType::kTH1D, {{120, -20, 20}});
6458
}
65-
59+
Filter collisionFilter = nabs(aod::collision::posZ) < cfgVtxZ;
60+
Filter trackFilter = nabs(aod::track::eta) < cfgEta && (aod::track::pt > cfgPtMin && aod::track::pt < cfgPtMax);
6661
// Equivalent of the AliRoot task UserExec
67-
void process(aod::Collision const& coll, aod::Tracks const& Tracks)
62+
using MyCollision = soa::Filtered<aod::Collisions>;
63+
using MyTrack = soa::Filtered<aod::Tracks>;
64+
65+
void process(MyCollision::iterator const& collision, MyTrack const& Tracks)
6866
{
6967
// Performing the event selection
70-
registry.fill(HIST("hVtxZ"), coll.posZ());
71-
72-
for (auto track : Tracks) { // Loop over tracks
68+
registry.fill(HIST("hVtxZ"), collision.posZ());
69+
for (const auto& track : Tracks) { // Loop over tracks
7370
registry.fill(HIST("hPt"), track.pt());
7471
}
7572
}

0 commit comments

Comments
 (0)