Skip to content

Commit c05afac

Browse files
committed
Add V0s in jet reconstruction in DATA with configurable useV0inJetRec
1 parent 7646f27 commit c05afac

1 file changed

Lines changed: 100 additions & 15 deletions

File tree

PWGLF/Tasks/Strangeness/strangenessInJetsIons.cxx

Lines changed: 100 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1579,6 +1579,83 @@ struct StrangenessInJetsIons {
15791579
}
15801580
}
15811581

1582+
/**
1583+
* @brief Add V0s as input for the jet finder algorithm in DATA
1584+
*
1585+
* @tparam Track
1586+
* @tparam V0PerColl The container type holding the sliced V0 candidates for the current collision.
1587+
*
1588+
* @param[in,out] fjInput Vector of FastJet PseudoJets where valid V0s will be appended.
1589+
* @param[in] fjTracks Vector containing tracks already selected for jet finder input.
1590+
* @param[in] v0sPerColl V0 candidates belonging to this specific collision.
1591+
* @param[in] vtxPos TVector3 object representing the vertex position.
1592+
*/
1593+
template <typename Track, typename V0PerColl>
1594+
void AddV0sForJetReconstructionData(std::vector<fastjet::PseudoJet>& fjInput,
1595+
const std::vector<Track>& fjTracks,
1596+
V0PerColl const& v0sPerColl,
1597+
const TVector3& vtxPos)
1598+
{
1599+
// Vector of labels: if true remove the element from fjInput
1600+
std::vector<bool> isTrackReplaced(fjTracks.size(), false);
1601+
std::vector<fastjet::PseudoJet> v0PseudoJets; // V0s to use as input for jet finder
1602+
1603+
for (const auto& v0 : v0sPerColl) {
1604+
const auto& pos = v0.template posTrack_as<DaughterTracks>();
1605+
const auto& neg = v0.template negTrack_as<DaughterTracks>();
1606+
1607+
bool isK0S = false, isLambda = false, isAntiLambda = false;
1608+
// K0s
1609+
if (passedK0ShortSelection(v0, pos, neg, vtxPos)) {
1610+
// LOG(info) << "[AddV0sForJetReconstructionData] Add K0S as input for jet finder.";
1611+
double energy = GetEnergy(v0.px(), v0.py(), v0.pz(), o2::constants::physics::MassK0Short);
1612+
fastjet::PseudoJet fourMomentum(v0.px(), v0.py(), v0.pz(), energy);
1613+
v0PseudoJets.emplace_back(fourMomentum);
1614+
isK0S = true;
1615+
}
1616+
// Lambda
1617+
if (passedLambdaSelection(v0, pos, neg, vtxPos)) {
1618+
// LOG(info) << "[AddV0sForJetReconstructionData] Add Lambda as input for jet finder.";
1619+
double energy = GetEnergy(v0.px(), v0.py(), v0.pz(), o2::constants::physics::MassLambda0);
1620+
fastjet::PseudoJet fourMomentum(v0.px(), v0.py(), v0.pz(), energy);
1621+
v0PseudoJets.emplace_back(fourMomentum);
1622+
isLambda = true;
1623+
}
1624+
// AntiLambda
1625+
if (passedAntiLambdaSelection(v0, pos, neg, vtxPos)) {
1626+
// LOG(info) << "[AddV0sForJetReconstructionData] Add AntiLambda as input for jet finder.";
1627+
double energy = GetEnergy(v0.px(), v0.py(), v0.pz(), o2::constants::physics::MassLambda0Bar);
1628+
fastjet::PseudoJet fourMomentum(v0.px(), v0.py(), v0.pz(), energy);
1629+
v0PseudoJets.emplace_back(fourMomentum);
1630+
isAntiLambda = true;
1631+
}
1632+
1633+
// Exclude daughter tracks in case a V0 is found
1634+
bool isV0 = isK0S || isLambda || isAntiLambda;
1635+
if (!isV0)
1636+
continue;
1637+
for (int i = 0; i < fjTracks.size(); ++i) {
1638+
if (isV0DaughterTrack(fjTracks[i], v0)) {
1639+
// LOG(info) << "[AddV0sForJetReconstructionData] V0 daughter track found in fjTracks.";
1640+
isTrackReplaced[i] = true;
1641+
}
1642+
}
1643+
}
1644+
1645+
std::vector<fastjet::PseudoJet> cleanFjInput;
1646+
cleanFjInput.reserve(fjInput.size());
1647+
for (size_t i = 0; i < fjInput.size(); ++i) {
1648+
if (!isTrackReplaced[i])
1649+
cleanFjInput.push_back(fjInput[i]);
1650+
}
1651+
for (const auto& v0pj : v0PseudoJets) {
1652+
cleanFjInput.push_back(v0pj);
1653+
}
1654+
// LOG(info) << "[AddV0sForJetReconstructionData] Size fjInput: " << fjInput.size();
1655+
fjInput = std::move(cleanFjInput);
1656+
// LOG(info) << "[AddV0sForJetReconstructionData] Size fjInput dopo move: " << fjInput.size();
1657+
}
1658+
15821659
/**
15831660
* @brief Add V0s as input for the jet finder algorithm in MC reco (detector level)
15841661
*
@@ -1592,11 +1669,11 @@ struct StrangenessInJetsIons {
15921669
* @param[in] vtxPos TVector3 object representing the vertex position.
15931670
*/
15941671
template <typename Track, typename V0PerColl>
1595-
void AddV0sForJetReconstructionMC(std::vector<fastjet::PseudoJet>& fjInput,
1596-
const std::vector<Track>& fjTracks,
1597-
V0PerColl const& v0sPerColl,
1598-
aod::McParticles const& mcParticles,
1599-
const TVector3& vtxPos)
1672+
void AddV0sForJetReconstructionMCD(std::vector<fastjet::PseudoJet>& fjInput,
1673+
const std::vector<Track>& fjTracks,
1674+
V0PerColl const& v0sPerColl,
1675+
aod::McParticles const& mcParticles,
1676+
const TVector3& vtxPos)
16001677
{
16011678
// Vector of labels: if true remove the element from fjInput
16021679
std::vector<bool> isTrackReplaced(fjTracks.size(), false);
@@ -1628,23 +1705,23 @@ struct StrangenessInJetsIons {
16281705
bool isK0S = false, isLambda = false, isAntiLambda = false;
16291706
// K0s
16301707
if (passedK0ShortSelection(v0, pos, neg, vtxPos) && pdgParent == kK0Short) {
1631-
// LOG(info) << "[AddV0sForJetReconstructionMC] Add K0S as input for jet finder.";
1708+
// LOG(info) << "[AddV0sForJetReconstructionMCD] Add K0S as input for jet finder.";
16321709
double energy = GetEnergy(v0.px(), v0.py(), v0.pz(), o2::constants::physics::MassK0Short);
16331710
fastjet::PseudoJet fourMomentum(v0.px(), v0.py(), v0.pz(), energy);
16341711
v0PseudoJets.emplace_back(fourMomentum);
16351712
isK0S = true;
16361713
}
16371714
// Lambda
16381715
if (passedLambdaSelection(v0, pos, neg, vtxPos) && pdgParent == kLambda0) {
1639-
// LOG(info) << "[AddV0sForJetReconstructionMC] Add Lambda as input for jet finder.";
1716+
// LOG(info) << "[AddV0sForJetReconstructionMCD] Add Lambda as input for jet finder.";
16401717
double energy = GetEnergy(v0.px(), v0.py(), v0.pz(), o2::constants::physics::MassLambda0);
16411718
fastjet::PseudoJet fourMomentum(v0.px(), v0.py(), v0.pz(), energy);
16421719
v0PseudoJets.emplace_back(fourMomentum);
16431720
isLambda = true;
16441721
}
16451722
// AntiLambda
16461723
if (passedAntiLambdaSelection(v0, pos, neg, vtxPos) && pdgParent == kLambda0Bar) {
1647-
// LOG(info) << "[AddV0sForJetReconstructionMC] Add AntiLambda as input for jet finder.";
1724+
// LOG(info) << "[AddV0sForJetReconstructionMCD] Add AntiLambda as input for jet finder.";
16481725
double energy = GetEnergy(v0.px(), v0.py(), v0.pz(), o2::constants::physics::MassLambda0Bar);
16491726
fastjet::PseudoJet fourMomentum(v0.px(), v0.py(), v0.pz(), energy);
16501727
v0PseudoJets.emplace_back(fourMomentum);
@@ -1657,7 +1734,7 @@ struct StrangenessInJetsIons {
16571734
continue;
16581735
for (int i = 0; i < fjTracks.size(); ++i) {
16591736
if (isV0DaughterTrack(fjTracks[i], v0)) {
1660-
// LOG(info) << "[AddV0sForJetReconstructionMC] V0 daughter track found in fjTracks.";
1737+
// LOG(info) << "[AddV0sForJetReconstructionMCD] V0 daughter track found in fjTracks.";
16611738
isTrackReplaced[i] = true;
16621739
}
16631740
}
@@ -1672,16 +1749,19 @@ struct StrangenessInJetsIons {
16721749
for (const auto& v0pj : v0PseudoJets) {
16731750
cleanFjInput.push_back(v0pj);
16741751
}
1675-
// LOG(info) << "[AddV0sForJetReconstructionMC] Size fjInput: " << fjInput.size();
1752+
// LOG(info) << "[AddV0sForJetReconstructionMCD] Size fjInput: " << fjInput.size();
16761753
fjInput = std::move(cleanFjInput);
1677-
// LOG(info) << "[AddV0sForJetReconstructionMC] Size fjInput dopo move: " << fjInput.size();
1754+
// LOG(info) << "[AddV0sForJetReconstructionMCD] Size fjInput dopo move: " << fjInput.size();
16781755
}
16791756

16801757
// Process data
16811758
void processData(SelCollisions::iterator const& collision, aod::V0Datas const& fullV0s,
16821759
aod::CascDataExt const& Cascades, DaughterTracks const& tracks,
16831760
aod::BCsWithTimestamps const&)
16841761
{
1762+
// Vertex position vector
1763+
TVector3 vtxPos(collision.posX(), collision.posY(), collision.posZ());
1764+
16851765
// Fill event counter before event selection
16861766
registryData.fill(HIST("number_of_events_data"), 0.5);
16871767

@@ -1738,6 +1818,7 @@ struct StrangenessInJetsIons {
17381818

17391819
// Loop over reconstructed tracks
17401820
std::vector<fastjet::PseudoJet> fjParticles;
1821+
std::vector<std::decay_t<decltype(*tracks.begin())>> fjTracks;
17411822
for (auto const& track : tracks) {
17421823

17431824
// Require that tracks pass selection criteria
@@ -1747,7 +1828,14 @@ struct StrangenessInJetsIons {
17471828
// 4-momentum representation of a particle
17481829
fastjet::PseudoJet fourMomentum(track.px(), track.py(), track.pz(), track.energy(o2::constants::physics::MassPionCharged));
17491830
fjParticles.emplace_back(fourMomentum);
1831+
fjTracks.push_back(track);
1832+
}
1833+
1834+
// Include V0s as tracks for jet reconstruction
1835+
if (useV0inJetRec && particleOfInterestDict[ParticleOfInterest::kV0Particles]) {
1836+
AddV0sForJetReconstructionData(fjParticles, fjTracks, fullV0s, vtxPos);
17501837
}
1838+
fjTracks.clear();
17511839

17521840
// Reject empty events
17531841
if (fjParticles.size() < 1)
@@ -1839,9 +1927,6 @@ struct StrangenessInJetsIons {
18391927
const float deltaPhiUe2 = getDeltaPhi(v0dir.Phi(), ue2[i].Phi());
18401928
const float deltaRue2 = std::sqrt(deltaEtaUe2 * deltaEtaUe2 + deltaPhiUe2 * deltaPhiUe2);
18411929

1842-
// Vertex position vector
1843-
TVector3 vtxPos(collision.posX(), collision.posY(), collision.posZ());
1844-
18451930
// Fill Armenteros-Podolanski TH2
18461931
// registryQC.fill(HIST("ArmenterosPreSel_DATA"), v0.alpha(), v0.qtarm());
18471932

@@ -2406,7 +2491,7 @@ struct StrangenessInJetsIons {
24062491

24072492
// Include V0s as tracks for jet reconstruction
24082493
if (useV0inJetRec && particleOfInterestDict[ParticleOfInterest::kV0Particles]) {
2409-
AddV0sForJetReconstructionMC(fjParticles, fjTracks, v0sPerColl, mcParticles, vtxPos);
2494+
AddV0sForJetReconstructionMCD(fjParticles, fjTracks, v0sPerColl, mcParticles, vtxPos);
24102495
}
24112496
fjTracks.clear();
24122497

0 commit comments

Comments
 (0)