Skip to content
Open
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
54 changes: 50 additions & 4 deletions PWGCF/Tasks/correlations.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 PWGCF/Tasks/correlations.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/workflow-file]

Name of a workflow file must match the name of the main struct in it (without the PWG prefix). (Class implementation files should be in "Core" directories.)
// 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 @@ -62,6 +62,7 @@
#include <string>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <utility>
#include <vector>

Expand Down Expand Up @@ -115,6 +116,7 @@
O2_DEFINE_CONFIGURABLE(cfgEfficiencyAssociated, std::string, "", "CCDB path to efficiency object for associated particles")

O2_DEFINE_CONFIGURABLE(cfgNoMixedEvents, int, 5, "Number of mixed events per event")
O2_DEFINE_CONFIGURABLE(cfgRejectMixedPhiProngEvents, bool, true, "Reject associated hadrons from either mixed-phi prong event")

O2_DEFINE_CONFIGURABLE(cfgVerbosity, int, 1, "Verbosity level (0 = major, 1 = per collision)")

Expand All @@ -127,6 +129,9 @@
O2_DEFINE_CONFIGURABLE(cfgPtCentDepMLbkgSel, std::vector<float>, {}, "Bkg ML selection")
O2_DEFINE_CONFIGURABLE(cfgPtCentDepMLpromptSel, std::vector<float>, {}, "Prompt ML selection")

std::unordered_map<int64_t, int64_t> cfTrackToCFCollision;
bool rejectMixedPhiProngEventsNow = false;

ConfigurableAxis axisVertex{"axisVertex", {7, -7, 7}, "vertex axis for histograms"};
ConfigurableAxis axisDeltaPhi{"axisDeltaPhi", {72, -PIHalf, PIHalf * 3}, "delta phi axis for histograms"};
ConfigurableAxis axisDeltaEta{"axisDeltaEta", {40, -2, 2}, "delta eta axis for histograms"};
Expand Down Expand Up @@ -435,7 +440,7 @@

if (cfgCorrelationMethod == 1 && track1.decay() != track2.decay())
continue;
if (cfgCorrelationMethod == 2 && track1.decay() == track2.decay())

Check failure on line 443 in PWGCF/Tasks/correlations.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.
continue;
registry.fill(HIST("invMassTwoPart"), track1.invMass(), track2.invMass(), track1.pt(), track2.pt(), multiplicity);
registry.fill(HIST("invMassTwoPartDPhi"), track1.invMass(), track2.invMass(), track1.pt(), track2.pt(), TVector2::Phi_0_2pi(track1.phi() - track2.phi() + TMath::Pi() / 2.0) - TMath::Pi() / 2.0);
Expand Down Expand Up @@ -511,6 +516,8 @@
using HasPartDaugh0Id = decltype(std::declval<T&>().cfParticleDaugh0Id());
template <class T>
using HasPartDaugh1Id = decltype(std::declval<T&>().cfParticleDaugh1Id());
template <class T>
using HasCFCollisionId = decltype(std::declval<T&>().cfCollisionId());

template <class CollType>
bool passOutlier(CollType const& collision)
Expand Down Expand Up @@ -654,6 +661,29 @@
continue;
}
}

if (rejectMixedPhiProngEventsNow && cfgRejectMixedPhiProngEvents) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is rejectMixedPhiProngEventsNow needed? Why not just check if target is mixed and doprocessMixed2ProngDerivedMixedPhi true?

if constexpr (std::experimental::is_detected<HasDecay, typename TTracks1::iterator>::value &&
std::experimental::is_detected<HasProng0Id, typename TTracks1::iterator>::value &&
std::experimental::is_detected<HasProng1Id, typename TTracks1::iterator>::value &&
std::experimental::is_detected<HasCFCollisionId, typename TTracks2::iterator>::value) {

if (track1.decay() == aod::cf2prongtrack::PhiToKKPID3Mixed) {
auto pr0 = cfTrackToCFCollision.find(track1.cfTrackProng0Id());
auto pr1 = cfTrackToCFCollision.find(track1.cfTrackProng1Id());

if (pr0 != cfTrackToCFCollision.end() &&
pr1 != cfTrackToCFCollision.end()) {
const auto assocColl = track2.cfCollisionId();

if (assocColl == pr0->second || assocColl == pr1->second) {
continue;
}
}
}
}
}

if constexpr (std::experimental::is_detected<HasPDGCode, typename TTracks2::iterator>::value) { // skip those that are specifically chosen to be triggers
if (!cfgMcTriggerPDGs->empty() && std::find(cfgMcTriggerPDGs->begin(), cfgMcTriggerPDGs->end(), track2.pdgCode()) != cfgMcTriggerPDGs->end())
continue; // TODO: fix cases like MC D0-D0
Expand Down Expand Up @@ -704,7 +734,7 @@
if constexpr (std::experimental::is_detected<HasDecay, typename TTracks1::iterator>::value && std::experimental::is_detected<HasDecay, typename TTracks2::iterator>::value) {
if (cfgCorrelationMethod == 1 && track1.decay() != track2.decay())
continue;
if (cfgCorrelationMethod == 2 && track1.decay() == track2.decay())

Check failure on line 737 in PWGCF/Tasks/correlations.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.
continue;
}

Expand Down Expand Up @@ -783,16 +813,15 @@
} // ML selection

// last param is the weight
if (cfgMassAxis && (doprocessSame2Prong2Prong || doprocessMixed2Prong2Prong || doprocessSame2Prong2ProngML || doprocessMixed2Prong2ProngML) && !(doprocessSame2ProngDerived || doprocessSame2ProngDerivedML || doprocessMixed2ProngDerived || doprocessMixed2ProngDerivedML)) {
if (cfgMassAxis && (doprocessSame2Prong2Prong || doprocessMixed2Prong2Prong || doprocessSame2Prong2ProngML || doprocessMixed2Prong2ProngML) && !(doprocessSame2ProngDerived || doprocessSame2ProngDerivedML || doprocessMixed2ProngDerived || doprocessMixed2ProngDerivedML || doprocessMixed2ProngDerivedMixedPhi)) {
if constexpr (std::experimental::is_detected<HasInvMass, typename TTracks1::iterator>::value && std::experimental::is_detected<HasInvMass, typename TTracks2::iterator>::value)
target->getPairHist()->Fill(step, track1.eta() - track2.eta(), track2.pt(), track1.pt(), multiplicity, deltaPhi, posZ, track2.invMass(), track1.invMass(), associatedWeight);
else
LOGF(fatal, "Can not fill mass axis without invMass column. \n no mass for two particles");
} else if (cfgMassAxis) {
if constexpr (std::experimental::is_detected<HasInvMass, typename TTracks1::iterator>::value)
if constexpr (std::experimental::is_detected<HasInvMass, typename TTracks1::iterator>::value) {
target->getPairHist()->Fill(step, track1.eta() - track2.eta(), track2.pt(), track1.pt(), multiplicity, deltaPhi, posZ, track1.invMass(), associatedWeight);
else if constexpr (std::experimental::is_detected<HasPDGCode, typename TTracks1::iterator>::value) {
// TParticlePDG *p = pdg->GetParticle(track1.pdgCode()); //TODO: get the mass for the PDG properly
} else if constexpr (std::experimental::is_detected<HasPDGCode, typename TTracks1::iterator>::value) {
target->getPairHist()->Fill(step, track1.eta() - track2.eta(), track2.pt(), track1.pt(), multiplicity, deltaPhi, posZ, 1.8, associatedWeight); // p->Mass()
} else {
LOGF(fatal, "Can not fill mass axis without invMass column. Disable cfgMassAxis.");
Expand Down Expand Up @@ -1071,6 +1100,23 @@
processMixedDerivedT(collisions, p2tracks, tracks);
}
PROCESS_SWITCH(CorrelationTask, processMixed2ProngDerived, "Process mixed events on derived data", false);
void processMixed2ProngDerivedMixedPhi(DerivedCollisions const& collisions,
DerivedTracks const& tracks,
soa::Filtered<aod::CF2ProngTracks> const& p2tracks)
{
cfTrackToCFCollision.clear();
cfTrackToCFCollision.reserve(tracks.size());

for (const auto& trk : tracks) {
cfTrackToCFCollision.emplace(trk.globalIndex(), trk.cfCollisionId());
}

rejectMixedPhiProngEventsNow = true;
processMixedDerivedT(collisions, p2tracks, tracks);
rejectMixedPhiProngEventsNow = false;
}

PROCESS_SWITCH(CorrelationTask, processMixed2ProngDerivedMixedPhi, "Process mixed events for mixed-phi triggers", false);

void processMixed2ProngDerivedML(DerivedCollisions const& collisions, DerivedTracks const& tracks, soa::Filtered<soa::Join<aod::CF2ProngTracks, aod::CF2ProngTrackmls>> const& p2tracks)
{
Expand Down
Loading