Skip to content

Commit 395f55a

Browse files
committed
implement cascade processing in v0selector (1-st working version)
1 parent ac4b67b commit 395f55a

File tree

1 file changed

+105
-4
lines changed

1 file changed

+105
-4
lines changed

PWGDQ/Tasks/v0selector.cxx

Lines changed: 105 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
#include <map>
5050
#include <memory>
5151
#include <string>
52+
#include <utility>
5253
#include <vector>
5354

5455
using namespace o2;
@@ -89,6 +90,18 @@ struct v0selector {
8990
Configurable<float> cutAPL1{"cutAPL1", 0.107, "cutAPL1"};
9091
Configurable<float> cutAPL2{"cutAPL2", -0.69, "cutAPL2"};
9192
Configurable<float> cutAPL3{"cutAPL3", 0.5, "cutAPL3"};
93+
// Omega & A-Omega cuts
94+
Configurable<float> cutAPOmegaUp1{"cutAPOmegaUp1", 0.25, "cutAPOmegaUp1"};
95+
Configurable<float> cutAPOmegaUp2{"cutAPOmegaUp2", 0.358, "cutAPOmegaUp2"};
96+
Configurable<float> cutAPOmegaUp3{"cutAPOmegaUp3", 0.35, "cutAPOmegaUp3"};
97+
Configurable<float> cutAPOmegaDown1{"cutAPOmegaDown1", 0.15, "cutAPOmegaDown1"};
98+
Configurable<float> cutAPOmegaDown2{"cutAPOmegaDown2", 0.358, "cutAPOmegaDown2"};
99+
Configurable<float> cutAPOmegaDown3{"cutAPOmegaDown3", 0.16, "cutAPOmegaDown3"};
100+
Configurable<float> cutAlphaOmegaHigh{"cutAlphaOmegaHigh", 0.358, "cutAlphaOmegaHigh"};
101+
Configurable<float> cutAlphaOmegaLow{"cutAlphaOmegaLow", 0., "cutAlphaOmegaLow"};
102+
Configurable<float> cutMassOmegaHigh{"cutMassOmegaHigh", 1.677, "cutMassOmegaHigh"};
103+
Configurable<float> cutMassOmegaLow{"cutMassOmegaLow", 1.667, "cutMassOmegaLow"};
104+
92105
Configurable<bool> produceV0ID{"produceV0ID", false, "Produce additional V0ID table"};
93106
Configurable<bool> produceCascID{"produceCascID", false, "Produce additional CascID table"};
94107

@@ -104,7 +117,7 @@ struct v0selector {
104117

105118
Produces<o2::aod::V0Bits> v0bits;
106119
Produces<o2::aod::V0MapID> v0mapID;
107-
Produces<o2::aod::CascMapID> cascMapID;
120+
Produces<o2::aod::CascMapID> cascmapID;
108121

109122
// int checkV0(const array<float, 3>& ppos, const array<float, 3>& pneg)
110123
int checkV0(const float alpha, const float qt)
@@ -161,10 +174,49 @@ struct v0selector {
161174
return kUndef;
162175
}
163176

164-
int checkCascade()
177+
std::pair<float, float> evalArmenterosPodolanskiCascade(aod::CascData const& casc)
178+
{
179+
const float pxv0 = casc.pxpos() + casc.pxneg();
180+
const float pyv0 = casc.pypos() + casc.pyneg();
181+
const float pzv0 = casc.pzpos() + casc.pzneg();
182+
183+
const float pxbach = casc.pxbach();
184+
const float pybach = casc.pybach();
185+
const float pzbach = casc.pzbach();
186+
187+
const double momTot = RecoDecay::p2(pxv0 + pxbach, pyv0 + pybach, pzv0 + pzbach);
188+
189+
const float lQlv0 = RecoDecay::dotProd(std::array{pxv0, pyv0, pzv0}, std::array{pxv0 + pxbach, pyv0 + pybach, pzv0 + pzbach}) / momTot;
190+
const float lQlbach = RecoDecay::dotProd(std::array{pxbach, pybach, pzbach}, std::array{pxv0 + pxbach, pyv0 + pybach, pzv0 + pzbach}) / momTot;
191+
const float dp = RecoDecay::dotProd(std::array{pxbach, pybach, pzbach}, std::array{pxv0 + pxbach, pyv0 + pybach, pzv0 + pzbach});
192+
193+
float alpha = (lQlv0 - lQlbach) / (lQlv0 + lQlbach);
194+
const float qtarm = std::sqrt(RecoDecay::p2(pxbach, pybach, pzbach) - dp * dp / momTot / momTot);
195+
196+
if (casc.sign() > 0) {
197+
alpha = -alpha;
198+
}
199+
200+
return std::make_pair(alpha, qtarm);
201+
}
202+
203+
int checkCascade(float alpha, float qt)
165204
{
166-
// to be implemented;
167-
return kOmega;
205+
const bool isAlphaPos = alpha > 0;
206+
alpha = std::fabs(alpha);
207+
208+
const float qUp = cutAPOmegaUp1 * std::sqrt(std::abs(1.0f - ((alpha - cutAPOmegaUp2) * (alpha - cutAPOmegaUp2)) / (cutAPOmegaUp3 * cutAPOmegaUp3)));
209+
const float qDown = cutAPOmegaDown1 * std::sqrt(std::abs(1.0f - ((alpha - cutAPOmegaDown2) * (alpha - cutAPOmegaDown2)) / (cutAPOmegaDown3 * cutAPOmegaDown3)));
210+
211+
if (alpha < cutAlphaOmegaLow || alpha > cutAlphaOmegaHigh || qt < qDown || qt > qUp) {
212+
return kUndef;
213+
}
214+
215+
if (isAlphaPos) {
216+
return kOmega;
217+
} else {
218+
return kAntiOmega;
219+
}
168220
}
169221

170222
// Configurables
@@ -210,6 +262,10 @@ struct v0selector {
210262
registry.add("hV0APplot", "hV0APplot", HistType::kTH2F, {{200, -1.0f, +1.0f}, {250, 0.0f, 0.25f}});
211263
registry.add("hV0APplotSelected", "hV0APplotSelected", HistType::kTH2F, {{200, -1.0f, +1.0f}, {250, 0.0f, 0.25f}});
212264
registry.add("hV0Psi", "hV0Psi", HistType::kTH2F, {{100, 0, TMath::PiOver2()}, {100, 0, 0.1}});
265+
registry.add("hCascAPplot", "hCascAPplot", HistType::kTH2F, {{200, -1.0f, +1.0f}, {500, 0.0f, 0.5f}});
266+
registry.add("hCascAPplotSelected", "hCascAPplotSelected", HistType::kTH2F, {{200, -1.0f, +1.0f}, {500, 0.0f, 0.5f}});
267+
registry.add("hMassOmega", "hMassOmega", HistType::kTH2F, {{900, 0.0f, 90.0f}, {100, 1.62f, 1.72f}});
268+
registry.add("hMassAntiOmega", "hMassAntiOmega", HistType::kTH2F, {{900, 0.0f, 90.0f}, {100, 1.62f, 1.72f}});
213269
}
214270
}
215271

@@ -395,6 +451,7 @@ struct v0selector {
395451
v0mapID(v0pidmap[V0.globalIndex()]);
396452
}
397453
}
454+
398455
for (const auto& Casc : Cascs) {
399456
if (fillhisto) {
400457
registry.fill(HIST("hCascCandidate"), 1);
@@ -406,9 +463,53 @@ struct v0selector {
406463
registry.fill(HIST("hCascCandidate"), 2);
407464
}
408465

466+
const float Cascradius = Casc.cascradius();
467+
409468
const float mOmega = Casc.mOmega();
410469

470+
auto [alpha, qt] = evalArmenterosPodolanskiCascade(Casc);
471+
472+
if (fillhisto) {
473+
registry.fill(HIST("hCascAPplot"), alpha, qt);
474+
}
475+
476+
const int cascid = checkCascade(alpha, qt);
477+
if (cascid < 0) {
478+
continue;
479+
}
480+
if (fillhisto) {
481+
registry.fill(HIST("hCascAPplotSelected"), alpha, qt);
482+
}
483+
484+
auto storeCascAddID = [&](auto gix, auto id) {
485+
if (produceCascID.value) {
486+
cascpidmap[gix] = id;
487+
}
488+
};
489+
490+
if (cascid == kOmega) {
491+
if (fillhisto) {
492+
registry.fill(HIST("hMassOmega"), Cascradius, mOmega);
493+
}
494+
if (cutMassOmegaLow < mOmega && mOmega < cutMassOmegaHigh) {
495+
pidmap[Casc.bachelorId()] |= (uint8_t(1) << kOmega);
496+
storeCascAddID(Casc.globalIndex(), kOmega);
497+
}
498+
} else if (cascid == kAntiOmega) {
499+
if (fillhisto) {
500+
registry.fill(HIST("hMassAntiOmega"), Cascradius, mOmega);
501+
}
502+
if (cutMassOmegaLow < mOmega && mOmega < cutMassOmegaHigh) {
503+
pidmap[Casc.bachelorId()] |= (uint8_t(1) << kAntiOmega);
504+
storeCascAddID(Casc.globalIndex(), kAntiOmega);
505+
}
506+
}
411507
} // end of Casc loop
508+
if (produceCascID.value) {
509+
for (auto& Casc : Cascs) {
510+
cascmapID(cascpidmap[Casc.globalIndex()]);
511+
}
512+
}
412513
for (auto& track : tracks) {
413514
// printf("setting pidmap[%lld] = %d\n",track.globalIndex(),pidmap[track.globalIndex()]);
414515
v0bits(pidmap[track.globalIndex()]);

0 commit comments

Comments
 (0)