Skip to content

Commit 449e066

Browse files
committed
[PWGLF & PWGJE] Create V0 Selector Task
* Creates a table containing a flag denoting whether a V0 is possible signal or if it would be rejected by cuts made in the analysis * Allows filtering out V0s that would never be reconstructed as signal before passing them on to other table producing tasks (important for V0 jet studies) * pT-dependent cuts for K0S, Lambda, and LambdaBar separately * Optionally cut on invariant mass * Optionally apply competing mass cuts * Optionally downscale potential signal collection (important for JE checks) * [PWGJE] Added QA for V0 flags
1 parent 6cfbb3a commit 449e066

4 files changed

Lines changed: 353 additions & 0 deletions

File tree

PWGJE/Tasks/v0qa.cxx

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "PWGJE/Core/JetFinder.h"
3333
#include "PWGJE/Core/JetUtilities.h"
3434
#include "PWGJE/Core/JetFindingUtilities.h"
35+
#include "PWGLF/DataModel/V0SelectorTables.h"
3536

3637
using namespace o2;
3738
using namespace o2::framework;
@@ -90,6 +91,9 @@ struct V0QA {
9091
const AxisSpec axisLambdaM{binInvMassLambda, "M(p #pi^{-}) (GeV/c^{2})"};
9192
const AxisSpec axisAntiLambdaM{binInvMassLambda, "M(#bar{p} #pi^{+}) (GeV/c^{2})"};
9293

94+
if (doprocessFlags) {
95+
registry.add("inclusive/V0Flags", "V0Flags", HistType::kTH2D, {{4, -0.5, 3.5}, {4, -0.5, 3.5}});
96+
}
9397
if (doprocessMcD) {
9498
registry.add("inclusive/hEvents", "Events", {HistType::kTH1D, {{2, 0.0f, 2.0f}}});
9599
registry.add("inclusive/K0SPtEtaMass", "K0S Pt, Eta, Mass", HistType::kTH3D, {axisV0Pt, axisEta, axisK0SM});
@@ -230,6 +234,35 @@ struct V0QA {
230234
void processDummy(CandidatesV0MCD const&) {}
231235
PROCESS_SWITCH(V0QA, processDummy, "Dummy process function turned on by default", true);
232236

237+
void processFlags(soa::Join<aod::V0Datas, aod::V0SignalFlags>::iterator const& v0)
238+
{
239+
int isK0S = static_cast<int>(v0.isK0SCandidate());
240+
int isLambda = static_cast<int>((v0.isLambdaCandidate()));
241+
int isAntiLambda = static_cast<int>(v0.isAntiLambdaCandidate());
242+
int isRejected = static_cast<int>(v0.isRejectedCandidate());
243+
244+
registry.fill(HIST("inclusive/V0Flags"), 0, 0, isK0S);
245+
registry.fill(HIST("inclusive/V0Flags"), 1, 1, isLambda);
246+
registry.fill(HIST("inclusive/V0Flags"), 2, 2, isAntiLambda);
247+
registry.fill(HIST("inclusive/V0Flags"), 3, 3, isRejected);
248+
249+
registry.fill(HIST("inclusive/V0Flags"), 0, 1, isK0S * isLambda);
250+
registry.fill(HIST("inclusive/V0Flags"), 1, 0, isK0S * isLambda);
251+
registry.fill(HIST("inclusive/V0Flags"), 0, 2, isK0S * isAntiLambda);
252+
registry.fill(HIST("inclusive/V0Flags"), 2, 0, isK0S * isAntiLambda);
253+
registry.fill(HIST("inclusive/V0Flags"), 0, 3, isK0S * isRejected);
254+
registry.fill(HIST("inclusive/V0Flags"), 3, 0, isK0S * isRejected);
255+
256+
registry.fill(HIST("inclusive/V0Flags"), 1, 2, isLambda * isAntiLambda);
257+
registry.fill(HIST("inclusive/V0Flags"), 2, 1, isLambda * isAntiLambda);
258+
registry.fill(HIST("inclusive/V0Flags"), 1, 3, isLambda * isRejected);
259+
registry.fill(HIST("inclusive/V0Flags"), 3, 1, isLambda * isRejected);
260+
261+
registry.fill(HIST("inclusive/V0Flags"), 2, 3, isAntiLambda * isRejected);
262+
registry.fill(HIST("inclusive/V0Flags"), 3, 2, isAntiLambda * isRejected);
263+
}
264+
PROCESS_SWITCH(V0QA, processFlags, "V0 flags", false);
265+
233266
void processMcD(soa::Filtered<JetCollisionsMCD>::iterator const& jcoll, JetMcCollisions const&, soa::Join<CandidatesV0MCD, aod::McV0Labels> const& v0s, aod::McParticles const&)
234267
{
235268
registry.fill(HIST("inclusive/hEvents"), 0.5);

PWGLF/DataModel/V0SelectorTables.h

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
#ifndef PWGLF_DATAMODEL_V0SELECTORTABLES_H
12+
#define PWGLF_DATAMODEL_V0SELECTORTABLES_H
13+
14+
namespace o2::aod
15+
{
16+
17+
namespace v0flags
18+
{
19+
20+
enum V0Flags : uint8_t {
21+
FK0S = 0x1, // K0S candidate
22+
FLAMBDA = 0x2, // Lambda candidate
23+
FANTILAMBDA = 0x4, // AntiLambda candidate
24+
FREJECTED = 0x8 // Does not satisfy any of the above, or is randomly rejected
25+
};
26+
27+
DECLARE_SOA_COLUMN(SignalFlag, signalFlag, uint8_t);
28+
DECLARE_SOA_DYNAMIC_COLUMN(IsK0SCandidate, isK0SCandidate, //! Flag to check if V0 is a K0S candidate
29+
[](uint8_t flag) -> bool { return flag & o2::aod::v0flags::FK0S; });
30+
DECLARE_SOA_DYNAMIC_COLUMN(IsLambdaCandidate, isLambdaCandidate, //! Flag to check if V0 is a Lambda candidate
31+
[](uint8_t flag) -> bool { return flag & o2::aod::v0flags::FLAMBDA; });
32+
DECLARE_SOA_DYNAMIC_COLUMN(IsAntiLambdaCandidate, isAntiLambdaCandidate, //! Flag to check if V0 is a AntiLambda candidate
33+
[](uint8_t flag) -> bool { return flag & o2::aod::v0flags::FANTILAMBDA; });
34+
DECLARE_SOA_DYNAMIC_COLUMN(IsRejectedCandidate, isRejectedCandidate, //! Flag to check if V0 is rejected
35+
[](uint8_t flag) -> bool { return flag & o2::aod::v0flags::FREJECTED; });
36+
} // namespace v0flags
37+
38+
DECLARE_SOA_TABLE(V0SignalFlags, "AOD", "V0SIGNALFLAGS",
39+
v0flags::SignalFlag,
40+
v0flags::IsK0SCandidate<v0flags::SignalFlag>,
41+
v0flags::IsLambdaCandidate<v0flags::SignalFlag>,
42+
v0flags::IsAntiLambdaCandidate<v0flags::SignalFlag>,
43+
v0flags::IsRejectedCandidate<v0flags::SignalFlag>);
44+
45+
DECLARE_SOA_TABLE(StoredV0SignalFlags, "AOD1", "V0SIGNALFLAGS",
46+
v0flags::SignalFlag,
47+
v0flags::IsK0SCandidate<v0flags::SignalFlag>,
48+
v0flags::IsLambdaCandidate<v0flags::SignalFlag>,
49+
v0flags::IsAntiLambdaCandidate<v0flags::SignalFlag>,
50+
v0flags::IsRejectedCandidate<v0flags::SignalFlag>,
51+
o2::soa::Marker<1>);
52+
53+
} // namespace o2::aod
54+
55+
#endif // PWGLF_DATAMODEL_V0SELECTORTABLES_H

PWGLF/TableProducer/Strangeness/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ o2physics_add_dpl_workflow(strangederivedbuilder
107107
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DetectorsBase
108108
COMPONENT_NAME Analysis)
109109

110+
o2physics_add_dpl_workflow(v0-selector
111+
SOURCES v0selector.cxx
112+
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
113+
COMPONENT_NAME Analysis)
114+
110115
o2physics_add_dpl_workflow(v0qaanalysis
111116
SOURCES v0qaanalysis.cxx
112117
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
Lines changed: 260 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,260 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
/// \brief Task to select V0s based on cuts
13+
///
14+
/// \author Gijs van Weelden <g.van.weelden@cern.ch>
15+
16+
#include <vector>
17+
#include <string>
18+
#include <TRandom3.h>
19+
20+
#include "Framework/runDataProcessing.h"
21+
#include "Framework/AnalysisTask.h"
22+
#include "Framework/AnalysisDataModel.h"
23+
#include "Framework/ASoA.h"
24+
25+
#include "CommonConstants/PhysicsConstants.h"
26+
#include "Common/Core/RecoDecay.h"
27+
28+
#include "PWGLF/DataModel/LFStrangenessTables.h"
29+
#include "PWGLF/DataModel/V0SelectorTables.h"
30+
31+
using namespace o2;
32+
using namespace o2::framework;
33+
using namespace o2::framework::expressions;
34+
35+
struct V0SelectorTask {
36+
Produces<aod::V0SignalFlags> v0FlagTable;
37+
38+
Configurable<std::vector<float>> K0SPtBins{"K0SPtBins", {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 10.0, 15.0, 20.0, 25.0, 30.0}, "K0S pt Vals"};
39+
Configurable<std::vector<float>> K0SRVals{"K0SRVals", {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}, "K0S min R values"};
40+
Configurable<std::vector<float>> K0SCtauVals{"K0SCtauVals", {20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0}, "K0S max ctau values"};
41+
Configurable<std::vector<float>> K0SCosPAVals{"K0SCosPAVals", {0.997, 0.997, 0.997, 0.997, 0.997, 0.997, 0.997, 0.997, 0.997, 0.997}, "K0S min cosPA values"};
42+
Configurable<std::vector<float>> K0SDCAVals{"K0SDCAVals", {0.20, 0.20, 0.20, 0.20, 0.20, 0.20, 0.15, 0.15, 0.10, 0.10}, "K0S min DCA +- values"};
43+
Configurable<std::vector<float>> K0SDCAdVals{"K0SDCAdVals", {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}, "K0S max DCAd values"};
44+
45+
Configurable<std::vector<float>> LambdaPtBins{"LambdaPtBins", {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 10.0, 15.0, 20.0}, "Lambda pt Vals"};
46+
Configurable<std::vector<float>> LambdaRVals{"LambdaRVals", {1.0, 10.0, 10.0, 10.0, 10.0, 10.0, 20.0, 20.0}, "Lambda min R values"};
47+
Configurable<std::vector<float>> LambdaCtauVals{"LambdaCtauVals", {22.5, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0}, "Lambda max ctau values"};
48+
Configurable<std::vector<float>> LambdaCosPAVals{"LambdaCosPAVals", {0.997, 0.997, 0.997, 0.997, 0.997, 0.997, 0.997, 0.997}, "Lambda min cosPA values"};
49+
Configurable<std::vector<float>> LambdaDCApVals{"LambdaDCApVals", {0.20, 0.10, 0.10, 0.10, 0.10, 0.10, 0.10, 0.10}, "Lambda min DCA+ values"};
50+
Configurable<std::vector<float>> LambdaDCAnVals{"LambdaDCAnVals", {0.20, 0.20, 0.20, 0.20, 0.20, 0.20, 0.15, 0.15}, "Lambda min DCA- values"};
51+
Configurable<std::vector<float>> LambdaDCAdVals{"LambdaDCAdVals", {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}, "Lambda max DCAd values"};
52+
53+
Configurable<std::vector<float>> AntiLambdaPtBins{"AntiLambdaPtBins", {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 10.0, 15.0, 20.0}, "AntiLambda pt Vals"};
54+
Configurable<std::vector<float>> AntiLambdaRVals{"AntiLambdaRVals", {10.0, 10.0, 10.0, 10.0, 20.0, 20.0, 20.0, 20.0}, "AntiLambda min R values"};
55+
Configurable<std::vector<float>> AntiLambdaCtauVals{"AntiLambdaCtauVals", {22.5, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0}, "AntiLambda max ctau values"};
56+
Configurable<std::vector<float>> AntiLambdaCosPAVals{"AntiLambdaCosPAVals", {0.997, 0.997, 0.997, 0.997, 0.997, 0.997, 0.997, 0.997}, "AntiLambda min cosPA values"};
57+
Configurable<std::vector<float>> AntiLambdaDCApVals{"AntiLambdaDCApVals", {0.20, 0.20, 0.20, 0.20, 0.20, 0.20, 0.20, 0.20}, "AntiLambda min DCA+ values"};
58+
Configurable<std::vector<float>> AntiLambdaDCAnVals{"AntiLambdaDCAnVals", {0.20, 0.10, 0.10, 0.10, 0.10, 0.10, 0.10, 0.10}, "AntiLambda min DCA- values"};
59+
Configurable<std::vector<float>> AntiLambdaDCAdVals{"AntiLambdaDCAdVals", {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}, "AntiLambda max DCAd values"};
60+
61+
Configurable<bool> massCuts{"massCuts", true, "Apply mass cuts"};
62+
Configurable<bool> competingMassCuts{"competingMassCuts", true, "Apply competing mass cuts"};
63+
Configurable<std::vector<float>> K0SMassLowVals{"K0SMassLowVals", {0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4}, "K0S mass cut lower values (MeV)"};
64+
Configurable<std::vector<float>> K0SMassHighVals{"K0SMassHighVals", {0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6}, "K0S mass cut upper values (MeV)"};
65+
Configurable<std::vector<float>> LambdaMassLowVals{"LambdaMassLowVals", {1.08, 1.08, 1.08, 1.08, 1.08, 1.08, 1.08, 1.08}, "Lambda mass cut lower values (MeV)"};
66+
Configurable<std::vector<float>> LambdaMassHighVals{"LambdaMassHighVals", {1.125, 1.125, 1.125, 1.125, 1.125, 1.125, 1.125, 1.125}, "Lambda mass cut upper values (MeV)"};
67+
Configurable<std::vector<float>> AntiLambdaMassLowVals{"AntiLambdaMassLowVals", {1.08, 1.08, 1.08, 1.08, 1.08, 1.08, 1.08, 1.08}, "AntiLambda mass cut lower values (MeV)"};
68+
Configurable<std::vector<float>> AntiLambdaMassHighVals{"AntiLambdaMassHighVals", {1.125, 1.125, 1.125, 1.125, 1.125, 1.125, 1.125, 1.125}, "AntiLambda mass cut upper values (MeV)"};
69+
70+
Configurable<bool> randomSelection{"randomSelection", true, "Randomly select V0s"};
71+
Configurable<std::vector<float>> K0SFraction{"randomSelectionFraction", {2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0}, "Fraction of K0S to randomly select"};
72+
Configurable<std::vector<float>> LambdaFraction{"LambdaFraction", {2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0}, "Fraction of Lambda to randomly select"};
73+
Configurable<std::vector<float>> AntiLambdaFraction{"AntiLambdaFraction", {2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0}, "Fraction of AntiLambda to randomly select"};
74+
75+
void init(InitContext const&)
76+
{}
77+
78+
template <typename T, typename U>
79+
bool K0SCuts(T const& collision, U const& v0)
80+
{
81+
if (v0.pt() < K0SPtBins->at(0) || v0.pt() > K0SPtBins->at(K0SPtBins->size() - 1)) {
82+
return false;
83+
}
84+
int ptBin = std::distance(K0SPtBins->begin(), std::upper_bound(K0SPtBins->begin(), K0SPtBins->end(), v0.pt())) - 1;
85+
if (v0.v0radius() < K0SRVals->at(ptBin)) {
86+
return false;
87+
}
88+
if (v0.v0cosPA() < K0SCosPAVals->at(ptBin)) {
89+
return false;
90+
}
91+
if (v0.dcaV0daughters() > K0SDCAdVals->at(ptBin)) {
92+
return false;
93+
}
94+
if (TMath::Abs(v0.dcapostopv()) < K0SDCAVals->at(ptBin)) {
95+
return false;
96+
}
97+
if (TMath::Abs(v0.dcanegtopv()) < K0SDCAVals->at(ptBin)) {
98+
return false;
99+
}
100+
float ctau = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short;
101+
if (ctau < K0SCtauVals->at(ptBin)) {
102+
return false;
103+
}
104+
// Apply mass cuts only if requested
105+
if (!massCuts) {
106+
return true;
107+
}
108+
if (v0.mK0Short() < K0SMassLowVals->at(ptBin) || v0.mK0Short() > K0SMassHighVals->at(ptBin)) {
109+
return false;
110+
}
111+
if (!competingMassCuts) {
112+
return true;
113+
}
114+
if (v0.mLambda() > LambdaMassLowVals->at(ptBin) && v0.mLambda() < LambdaMassHighVals->at(ptBin)) {
115+
return false;
116+
}
117+
if (v0.mAntiLambda() > AntiLambdaMassLowVals->at(ptBin) && v0.mAntiLambda() < AntiLambdaMassHighVals->at(ptBin)) {
118+
return false;
119+
}
120+
return true;
121+
}
122+
template <typename T, typename U>
123+
bool LambdaCuts(T const& collision, U const& v0)
124+
{
125+
if (v0.pt() < LambdaPtBins->at(0) || v0.pt() > LambdaPtBins->at(LambdaPtBins->size() - 1)) {
126+
return false;
127+
}
128+
int ptBin = std::distance(LambdaPtBins->begin(), std::upper_bound(LambdaPtBins->begin(), LambdaPtBins->end(), v0.pt())) - 1;
129+
if (v0.v0radius() < LambdaRVals->at(ptBin)) {
130+
return false;
131+
}
132+
if (v0.v0cosPA() < LambdaCosPAVals->at(ptBin)) {
133+
return false;
134+
}
135+
if (v0.dcaV0daughters() > LambdaDCAdVals->at(ptBin)) {
136+
return false;
137+
}
138+
if (TMath::Abs(v0.dcapostopv()) < LambdaDCApVals->at(ptBin)) {
139+
return false;
140+
}
141+
if (TMath::Abs(v0.dcanegtopv()) < LambdaDCAnVals->at(ptBin)) {
142+
return false;
143+
}
144+
float ctau = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0;
145+
if (ctau < LambdaCtauVals->at(ptBin)) {
146+
return false;
147+
}
148+
// Apply mass cuts only if requested
149+
if (!massCuts) {
150+
return true;
151+
}
152+
if (v0.mLambda() < LambdaMassLowVals->at(ptBin) || v0.mLambda() > LambdaMassHighVals->at(ptBin)) {
153+
return false;
154+
}
155+
if (!competingMassCuts) {
156+
return true;
157+
}
158+
if (v0.mK0Short() > K0SMassLowVals->at(ptBin) && v0.mK0Short() < K0SMassHighVals->at(ptBin)) {
159+
return false;
160+
}
161+
return true;
162+
}
163+
template <typename T, typename U>
164+
bool AntiLambdaCuts(T const& collision, U const& v0)
165+
{
166+
if (v0.pt() < AntiLambdaPtBins->at(0) || v0.pt() > AntiLambdaPtBins->at(AntiLambdaPtBins->size() - 1)) {
167+
return false;
168+
}
169+
int ptBin = std::distance(AntiLambdaPtBins->begin(), std::upper_bound(AntiLambdaPtBins->begin(), AntiLambdaPtBins->end(), v0.pt())) - 1;
170+
if (v0.v0radius() < AntiLambdaRVals->at(ptBin)) {
171+
return false;
172+
}
173+
if (v0.v0cosPA() < AntiLambdaCosPAVals->at(ptBin)) {
174+
return false;
175+
}
176+
if (v0.dcaV0daughters() > AntiLambdaDCAdVals->at(ptBin)) {
177+
return false;
178+
}
179+
if (TMath::Abs(v0.dcapostopv()) < AntiLambdaDCApVals->at(ptBin)) {
180+
return false;
181+
}
182+
if (TMath::Abs(v0.dcanegtopv()) < AntiLambdaDCAnVals->at(ptBin)) {
183+
return false;
184+
}
185+
float ctau = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0;
186+
if (ctau < AntiLambdaCtauVals->at(ptBin)) {
187+
return false;
188+
}
189+
// Apply mass cuts only if requested
190+
if (!massCuts) {
191+
return true;
192+
}
193+
if (v0.mAntiLambda() < AntiLambdaMassLowVals->at(ptBin) || v0.mAntiLambda() > AntiLambdaMassHighVals->at(ptBin)) {
194+
return false;
195+
}
196+
if (!competingMassCuts) {
197+
return true;
198+
}
199+
if (v0.mK0Short() > K0SMassLowVals->at(ptBin) && v0.mK0Short() < K0SMassHighVals->at(ptBin)) {
200+
return false;
201+
}
202+
return true;
203+
}
204+
template <typename T>
205+
bool RandomlyReject(T const& v0, uint8_t flag)
206+
{
207+
if (!(flag & aod::v0flags::FK0S || flag & aod::v0flags::FLAMBDA || flag & aod::v0flags::FANTILAMBDA)) {
208+
return true;
209+
}
210+
211+
// In case of multiple candidate types, only check the lowest threshold value
212+
float threshold = 2.;
213+
if (flag & aod::v0flags::FK0S) {
214+
int ptBin = std::distance(K0SPtBins->begin(), std::upper_bound(K0SPtBins->begin(), K0SPtBins->end(), v0.pt())) - 1;
215+
if (threshold > K0SFraction->at(ptBin)) {
216+
threshold = K0SFraction->at(ptBin);
217+
}
218+
}
219+
if (flag & aod::v0flags::FLAMBDA) {
220+
int ptBin = std::distance(LambdaPtBins->begin(), std::upper_bound(LambdaPtBins->begin(), LambdaPtBins->end(), v0.pt())) - 1;
221+
if (threshold > LambdaFraction->at(ptBin)) {
222+
threshold = LambdaFraction->at(ptBin);
223+
}
224+
}
225+
if (flag & aod::v0flags::FANTILAMBDA) {
226+
int ptBin = std::distance(AntiLambdaPtBins->begin(), std::upper_bound(AntiLambdaPtBins->begin(), AntiLambdaPtBins->end(), v0.pt())) - 1;
227+
if (threshold > AntiLambdaFraction->at(ptBin)) {
228+
threshold = AntiLambdaFraction->at(ptBin);
229+
}
230+
}
231+
return (gRandom->Uniform() > threshold);
232+
}
233+
234+
void processV0(aod::Collision const& collision, aod::V0Datas const& v0s)
235+
{
236+
for (const auto& v0 : v0s) {
237+
bool candidateK0S = K0SCuts(collision, v0);
238+
bool candidateLambda = LambdaCuts(collision, v0);
239+
bool candidateAntiLambda = AntiLambdaCuts(collision, v0);
240+
uint8_t flag = 0;
241+
flag += candidateK0S * aod::v0flags::FK0S;
242+
flag += candidateLambda * aod::v0flags::FLAMBDA;
243+
flag += candidateAntiLambda * aod::v0flags::FANTILAMBDA;
244+
245+
if (candidateK0S + candidateLambda + candidateAntiLambda == 0) {
246+
flag += aod::v0flags::FREJECTED;
247+
} else if (randomSelection) {
248+
flag += RandomlyReject(v0, flag) * aod::v0flags::FREJECTED;
249+
}
250+
v0FlagTable(flag);
251+
}
252+
}
253+
PROCESS_SWITCH(V0SelectorTask, processV0, "flags V0 candidates as potential signal", true);
254+
};
255+
256+
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
257+
{
258+
return WorkflowSpec{
259+
adaptAnalysisTask<V0SelectorTask>(cfgc, TaskName{"v0-selector"})};
260+
}

0 commit comments

Comments
 (0)