Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 54 additions & 15 deletions PWGLF/Tasks/Strangeness/lambdalambda.cxx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.

Check failure on line 1 in PWGLF/Tasks/Strangeness/lambdalambda.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-task]

Specify task name only when it cannot be derived from the struct name. Only append to the default name.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
Expand Down Expand Up @@ -42,7 +42,7 @@
#include "Math/Vector3D.h"
#include "Math/Vector4D.h"
#include "TF1.h"
#include "TLorentzVector.h"

Check failure on line 45 in PWGLF/Tasks/Strangeness/lambdalambda.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/lorentz-vector]

Do not use the TLorentzVector legacy class. Use std::array with RecoDecay methods or the ROOT::Math::LorentzVector template instead.
#include "TRandom3.h"
#include "TVector3.h"
#include <TMath.h>
Expand Down Expand Up @@ -119,15 +119,17 @@

Configurable<bool> cfgV0V0Sel{"cfgV0V0Sel", false, "application of V0V0 selections"};

Configurable<float> cfgV0V0RadiusMin{"cfgV0V0RadiusMin", 1.0, "maximum radius of v0v0"};
Configurable<float> cfgV0V0RadiusMin{"cfgV0V0RadiusMin", 1.0, "minimum radius of v0v0"};
Configurable<float> cfgV0V0CPAMin{"cfgV0V0CPAMin", 0.6, "minimum CPA of v0v0"};
Configurable<float> cfgV0V0DistanceMin{"cfgV0V0DistanceMin", 1, "minimum distance of v0v0"};
Configurable<float> cfgV0V0DCAMin{"cfgV0V0DCAMin", 1.0, "maximum DCA of v0v0 R"};
Configurable<float> cfgV0V0DCAMin{"cfgV0V0DCAMin", 1.0, "minimum DCA of v0v0 R"};
Configurable<float> cfgV0V0PVPAMin{"cfgV0V0PVPAMin", 0.9, "minimum PV PA of v0v0"};

Configurable<float> cfgV0V0RadiusMax{"cfgV0V0RadiusMax", 1.0, "maximum radius of v0v0"};
Configurable<float> cfgV0V0CPAMax{"cfgV0V0CPAMax", 0.6, "maximum CPA of v0v0"};
Configurable<float> cfgV0V0DistanceMax{"cfgV0V0DistanceMax", 1, "maximum distance of v0v0"};
Configurable<float> cfgV0V0DCAMax{"cfgV0V0DCAMax", 1.0, "maximum DCA of v0v0 R"};
Configurable<float> cfgV0V0PVPAMax{"cfgV0V0PVPAMax", 1.0, "maximum PV PA of v0v0"};

Configurable<bool> cfgEffCor{"cfgEffCor", false, "flag to apply efficiency correction"};
Configurable<std::string> cfgEffCorPath{"cfgEffCorPath", "", "path for pseudo efficiency correction"};
Expand Down Expand Up @@ -184,11 +186,13 @@
histos.add("CPA_V0V0_full", "", {HistType::kTHnSparseF, {massAxis, ptAxis, CPAAxis, combAxis}});
histos.add("Distance_V0V0_full", "", {HistType::kTHnSparseF, {massAxis, ptAxis, DistanceAxis, combAxis}});
histos.add("DCA_V0V0_full", "", {HistType::kTHnSparseF, {massAxis, ptAxis, DCAAxis, combAxis}});
histos.add("PVPA_V0V0_full", "", {HistType::kTHnSparseF, {massAxis, ptAxis, CPAAxis, combAxis}});

histos.add("Radius_V0V0_sel", "", {HistType::kTHnSparseF, {massAxis, ptAxis, RadiusAxis, combAxis}});
histos.add("CPA_V0V0_sel", "", {HistType::kTHnSparseF, {massAxis, ptAxis, CPAAxis, combAxis}});
histos.add("Distance_V0V0_sel", "", {HistType::kTHnSparseF, {massAxis, ptAxis, DistanceAxis, combAxis}});
histos.add("DCA_V0V0_sel", "", {HistType::kTHnSparseF, {massAxis, ptAxis, DCAAxis, combAxis}});
histos.add("PVPA_V0V0_sel", "", {HistType::kTHnSparseF, {massAxis, ptAxis, CPAAxis, combAxis}});

histos.add("h_InvMass_same", "", {HistType::kTHnSparseF, {massAxis, ptAxis, centAxis, combAxis}});
histos.add("h_InvMass_mixed", "", {HistType::kTHnSparseF, {massAxis, ptAxis, centAxis, combAxis}});
Expand Down Expand Up @@ -303,8 +307,8 @@
return true;
}

template <typename V01, typename V02>
bool isSelectedV0V0(V01 const& v01, V02 const& v02)
template <typename V01, typename V02, typename Coll>
bool isSelectedV0V0(V01 const& v01, V02 const& v02, Coll const& coll)
{
if (getDCAofV0V0(v01, v02) > cfgV0V0DCAMax)
return false;
Expand All @@ -318,9 +322,13 @@
return false;
if (getDistance(v01, v02) < cfgV0V0DistanceMin)
return false;
if (getRadius(v01, v02) > cfgV0V0RadiusMax)
if (getRadius(v01, v02, coll) > cfgV0V0RadiusMax)
return false;
if (getRadius(v01, v02, coll) < cfgV0V0RadiusMin)
return false;
if (getPVPA(v01, v02, coll) > cfgV0V0PVPAMax)
return false;
if (getRadius(v01, v02) < cfgV0V0RadiusMin)
if (getPVPA(v01, v02, coll) < cfgV0V0PVPAMin)
return false;

return true;
Expand Down Expand Up @@ -360,8 +368,8 @@
return std::sqrt(posdiff.Mag2());
}

template <typename V01, typename V02>
float getRadius(V01 const& v01, V02 const& v02)
template <typename V01, typename V02, typename Coll>
float getRadius(V01 const& v01, V02 const& v02, Coll const& coll)
{
ROOT::Math::XYZVector v01pos, v02pos, v01mom, v02mom;
v01pos.SetXYZ(v01.x(), v01.y(), v01.z());
Expand All @@ -371,13 +379,43 @@
ROOT::Math::XYZVector posdiff = v02pos - v01pos;

float d = 1. - TMath::Power(v01mom.Dot(v02mom), 2);
if (d < 1e-5)

Check failure on line 382 in PWGLF/Tasks/Strangeness/lambdalambda.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
return 999;
float t = posdiff.Dot(v01mom - v01mom.Dot(v02mom) * v02mom) / d;
float s = -posdiff.Dot(v02mom - v01mom.Dot(v02mom) * v01mom) / d;
ROOT::Math::XYZVector dca = v01pos + v02pos + t * v01mom + s * v02mom;
dca /= 2.;
return std::sqrt(dca.Mag2());
ROOT::Math::XYZVector pv;
pv.SetXYZ(coll.posX(), coll.posY(), coll.posZ());
ROOT::Math::XYZVector reldca = dca - pv;
return std::sqrt(reldca.Mag2());
}

template <typename V01, typename V02, typename Coll>
float getPVPA(V01 const& v01, V02 const& v02, Coll const& coll)
{
ROOT::Math::XYZVector v0v0mom;
v0v0mom.SetXYZ(v01.px() + v02.px(), v01.py() + v02.py(), v01.pz() + v02.pz());

ROOT::Math::XYZVector v01pos, v02pos, v01mom, v02mom;
v01pos.SetXYZ(v01.x(), v01.y(), v01.z());
v02pos.SetXYZ(v02.x(), v02.y(), v02.z());
v01mom.SetXYZ(v01.px() / v01.p(), v01.py() / v01.p(), v01.pz() / v01.p());
v02mom.SetXYZ(v02.px() / v02.p(), v02.py() / v02.p(), v02.pz() / v02.p());
ROOT::Math::XYZVector posdiff = v02pos - v01pos;

float d = 1. - TMath::Power(v01mom.Dot(v02mom), 2);
if (d < 1e-5)

Check failure on line 408 in PWGLF/Tasks/Strangeness/lambdalambda.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
return -2;
float t = posdiff.Dot(v01mom - v01mom.Dot(v02mom) * v02mom) / d;
float s = -posdiff.Dot(v02mom - v01mom.Dot(v02mom) * v01mom) / d;
ROOT::Math::XYZVector dca = v01pos + v02pos + t * v01mom + s * v02mom;
dca /= 2.;
ROOT::Math::XYZVector pv;
pv.SetXYZ(coll.posX(), coll.posY(), coll.posZ());
ROOT::Math::XYZVector reldca = dca - pv;

return v0v0mom.Dot(reldca) / sqrt(v0v0mom.Mag2() * reldca.Mag2());

Check failure on line 418 in PWGLF/Tasks/Strangeness/lambdalambda.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
}

template <typename C1, typename C2, typename V01, typename V02>
Expand All @@ -386,7 +424,7 @@
IsTriggered = false;
IsSelected = false;

for (auto& v01 : V01s) {

Check failure on line 427 in PWGLF/Tasks/Strangeness/lambdalambda.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
auto postrack_v01 = v01.template posTrack_as<TrackCandidates>();
auto negtrack_v01 = v01.template negTrack_as<TrackCandidates>();

Expand Down Expand Up @@ -419,7 +457,7 @@
RecoV01 = ROOT::Math::PxPyPzMVector(v01.px(), v01.py(), v01.pz(), v01.mAntiLambda());
}

for (auto& v02 : V02s) {

Check failure on line 460 in PWGLF/Tasks/Strangeness/lambdalambda.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
if (v01.v0Id() <= v02.v0Id() && doprocessDataSame)
continue;
auto postrack_v02 = v02.template posTrack_as<TrackCandidates>();
Expand Down Expand Up @@ -465,22 +503,23 @@
continue;
IsTriggered = true;

histos.fill(HIST("Radius_V0V0_full"), RecoV0V0.M(), RecoV0V0.Pt(), getRadius(v01, v02), V01Tag + V02Tag);
histos.fill(HIST("Radius_V0V0_full"), RecoV0V0.M(), RecoV0V0.Pt(), getRadius(v01, v02, c1), V01Tag + V02Tag);
histos.fill(HIST("CPA_V0V0_full"), RecoV0V0.M(), RecoV0V0.Pt(), getCPA(v01, v02), V01Tag + V02Tag);
histos.fill(HIST("Distance_V0V0_full"), RecoV0V0.M(), RecoV0V0.Pt(), getDistance(v01, v02), V01Tag + V02Tag);
histos.fill(HIST("DCA_V0V0_full"), RecoV0V0.M(), RecoV0V0.Pt(), getDCAofV0V0(v01, v02), V01Tag + V02Tag);

if (isSelectedV0V0(v01, v02)) {
histos.fill(HIST("Radius_V0V0_sel"), RecoV0V0.M(), RecoV0V0.Pt(), getRadius(v01, v02), V01Tag + V02Tag);
histos.fill(HIST("PVPA_V0V0_full"), RecoV0V0.M(), RecoV0V0.Pt(), getPVPA(v01, v02, c1), V01Tag + V02Tag);
if (isSelectedV0V0(v01, v02, c1)) {
histos.fill(HIST("Radius_V0V0_sel"), RecoV0V0.M(), RecoV0V0.Pt(), getRadius(v01, v02, c1), V01Tag + V02Tag);
histos.fill(HIST("CPA_V0V0_sel"), RecoV0V0.M(), RecoV0V0.Pt(), getCPA(v01, v02), V01Tag + V02Tag);
histos.fill(HIST("Distance_V0V0_sel"), RecoV0V0.M(), RecoV0V0.Pt(), getDistance(v01, v02), V01Tag + V02Tag);
histos.fill(HIST("DCA_V0V0_sel"), RecoV0V0.M(), RecoV0V0.Pt(), getDCAofV0V0(v01, v02), V01Tag + V02Tag);
histos.fill(HIST("PVPA_V0V0_sel"), RecoV0V0.M(), RecoV0V0.Pt(), getPVPA(v01, v02, c1), V01Tag + V02Tag);
IsSelected = true;
}

if (doprocessDataSame) {
histos.fill(HIST("h_InvMass_same"), RecoV0V0.M(), RecoV0V0.Pt(), centrality, V01Tag + V02Tag);
if (cfgV0V0Sel && isSelectedV0V0(v01, v02)) {
if (cfgV0V0Sel && isSelectedV0V0(v01, v02, c1)) {
histos.fill(HIST("h_InvMass_same_sel"), RecoV0V0.M(), RecoV0V0.Pt(), centrality, V01Tag + V02Tag);
if (cfgRotBkg) {
for (int nr = 0; nr < cfgNRotBkg; nr++) {
Expand All @@ -495,7 +534,7 @@
}
if (doprocessDataMixed) {
histos.fill(HIST("h_InvMass_mixed"), RecoV0V0.M(), RecoV0V0.Pt(), centrality, V01Tag + V02Tag);
if (cfgV0V0Sel && isSelectedV0V0(v01, v02)) {
if (cfgV0V0Sel && isSelectedV0V0(v01, v02, c1)) {
histos.fill(HIST("h_InvMass_mixed_sel"), RecoV0V0.M(), RecoV0V0.Pt(), centrality, V01Tag + V02Tag);
}
}
Expand All @@ -509,7 +548,7 @@
{
if (cfgCentEst == 1) {
centrality = collision.centFT0C();
} else if (cfgCentEst == 2) {

Check failure on line 551 in PWGLF/Tasks/Strangeness/lambdalambda.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
centrality = collision.centFT0M();
}
histos.fill(HIST("hEventstat"), 0.5);
Expand Down Expand Up @@ -550,7 +589,7 @@
TrackCandidates const& /*tracks*/, aod::V0Datas const& V0s, aod::BCsWithTimestamps const&)
{
int currentRun = -1;
for (auto& [c1, c2] : selfCombinations(colBinning, cfgNoMixedEvents, -1, collisions, collisions)) {

Check failure on line 592 in PWGLF/Tasks/Strangeness/lambdalambda.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
if (c1.index() == c2.index())
continue;

Expand Down Expand Up @@ -587,5 +626,5 @@
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
{
return WorkflowSpec{
adaptAnalysisTask<lambdalambda>(cfgc, TaskName{"lf-lambdalambda"})};

Check failure on line 629 in PWGLF/Tasks/Strangeness/lambdalambda.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-task]

Specified task name lf-lambdalambda produces device name lf-lambdalambda which does not match the device name lambdalambda from the struct name lambdalambda. (Matching struct name LfLambdalambda)
}
Loading