Skip to content
Merged
Show file tree
Hide file tree
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
170 changes: 132 additions & 38 deletions EventFiltering/PWGCF/CFFilter.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#include "PWGCF/FemtoDream/FemtoDreamContainer.h"
#include "PWGCF/FemtoDream/FemtoDreamMath.h"
#include "PWGCF/FemtoDream/FemtoDreamPairCleaner.h"
#include "PWGCF/FemtoDream/FemtoDreamDetaDphiStar.h"
#include "PWGCF/FemtoDream/FemtoDreamContainer.h"

#include "Common/DataModel/EventSelection.h"
#include "Common/DataModel/Multiplicity.h"
Expand All @@ -51,13 +53,13 @@ enum CFTriggers {

static const std::vector<std::string> CfTriggerNames{"ppp", "ppL", "pLL", "LLL"};

//uint8_t trackTypeSel = o2::aod::femtodreamparticle::ParticleType::kTrack; Fix this to work instead of below hardcoded lines
//uint V0TypeSel = o2::aod::femtodreamparticle::ParticleType::kV0; Fix this to work instead of below hardcoded lines
// uint8_t trackTypeSel = o2::aod::femtodreamparticle::ParticleType::kTrack; Fix this to work instead of below hardcoded lines
// uint V0TypeSel = o2::aod::femtodreamparticle::ParticleType::kV0; Fix this to work instead of below hardcoded lines
static constexpr uint8_t Track = 0; // Track
static constexpr uint8_t V0 = 1; // V0
static constexpr uint8_t V0Daughter = 2; // V0 daughters
static constexpr uint32_t kSignMinusMask = 1;
static constexpr uint32_t kSignPlusMask = 1 << 1;
static constexpr uint32_t kSignPlusMask = 2;
static constexpr uint32_t kValue0 = 0;

} // namespace
Expand All @@ -78,25 +80,45 @@ struct CFFilter {

Produces<aod::CFFilters> tags;

//Obtain particle and antiparticle candidates of protons and lambda hyperons for current femto collision
Configurable<std::vector<float>> confQ3TriggerLimit{"Q3TriggerLimitC", std::vector<float>{0.6f, 0.6f, 0.6f, 0.6f}, "Q3 limit for selection"};
Configurable<int> Q3Trigger{"Q3Trigger", 0, "Choice which trigger to run"};
Configurable<float> ldeltaPhiMax{"ldeltaPhiMax", 0.017, "Max limit of delta phi"};
Configurable<float> ldeltaEtaMax{"ldeltaEtaMax", 0.017, "Max limit of delta eta"};
Configurable<float> lmagfield{"lmagfield", 0.5, "Magnetic field value"};

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.

You don't need a configurable for the magnetic field any longer
Have a look at https://github.com/AliceO2Group/O2Physics/blob/master/PWGCF/Tasks/correlations.cxx#L162

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Thanks a lot for pointing to this example, Victor! Vale is implementing this now, but I want to merge the trigger code now as it is so that I can test it on hyperloop over the weekend. Next week we will include the magnetic field information appropriately.


// Obtain particle and antiparticle candidates of protons and lambda hyperons for current femto collision
Partition<o2::aod::FemtoDreamParticles> partsProton1 = (o2::aod::femtodreamparticle::partType == Track) && ((o2::aod::femtodreamparticle::cut & kSignPlusMask) > kValue0);
Partition<o2::aod::FemtoDreamParticles> partsLambda1 = (o2::aod::femtodreamparticle::partType == V0) && ((o2::aod::femtodreamparticle::cut & kSignPlusMask) > kValue0);
Partition<o2::aod::FemtoDreamParticles> partsProton0 = (o2::aod::femtodreamparticle::partType == Track) && ((o2::aod::femtodreamparticle::cut & kSignMinusMask) > kValue0);
Partition<o2::aod::FemtoDreamParticles> partsLambda0 = (o2::aod::femtodreamparticle::partType == V0) && ((o2::aod::femtodreamparticle::cut & kSignMinusMask) > kValue0);

HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject, true, true};
HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject};
HistogramRegistry registryQA{"registryQA", {}, OutputObjHandlingPolicy::AnalysisObject};

//FemtoDreamPairCleaner<aod::femtodreamparticle::ParticleType::kTrack, aod::femtodreamparticle::ParticleType::kTrack> pairCleanerTT; Currently not used, will be needed later
// FemtoDreamPairCleaner<aod::femtodreamparticle::ParticleType::kTrack, aod::femtodreamparticle::ParticleType::kTrack> pairCleanerTT; Currently not used, will be needed later
FemtoDreamPairCleaner<aod::femtodreamparticle::ParticleType::kTrack, aod::femtodreamparticle::ParticleType::kV0> pairCleanerTV;
FemtoDreamDetaDphiStar<aod::femtodreamparticle::ParticleType::kTrack, aod::femtodreamparticle::ParticleType::kTrack> closePairRejectionTT;
FemtoDreamDetaDphiStar<aod::femtodreamparticle::ParticleType::kTrack, aod::femtodreamparticle::ParticleType::kV0> closePairRejectionTV0;

void init(o2::framework::InitContext&)
{
bool plotPerRadii = true;

closePairRejectionTT.init(&registry, &registryQA, ldeltaPhiMax, ldeltaEtaMax, lmagfield, plotPerRadii);
closePairRejectionTV0.init(&registry, &registryQA, ldeltaPhiMax, ldeltaEtaMax, lmagfield, plotPerRadii);
registry.add("fProcessedEvents", "CF - event filtered;;events", HistType::kTH1F, {{6, -0.5, 5.5}});
std::array<std::string, 6> eventTitles = {"all", "rejected", "p-p-p", "p-p-L", "p-L-L", "L-L-L"};
for (size_t iBin = 0; iBin < eventTitles.size(); iBin++) {
registry.get<TH1>(HIST("fProcessedEvents"))->GetXaxis()->SetBinLabel(iBin + 1, eventTitles[iBin].data());
}
registry.add("fSameEvent", "CF - same event distribution;;events", HistType::kTH1F, {{8000, 0, 8}});
if (Q3Trigger == 0 || Q3Trigger == 11) {
registry.add("fSameEventPartPPP", "CF - same event ppp distribution for particles;;events", HistType::kTH1F, {{8000, 0, 8}});
registry.add("fSameEventAntiPartPPP", "CF - same event ppp distribution for antiparticles;;events", HistType::kTH1F, {{8000, 0, 8}});
}
if (Q3Trigger == 1 || Q3Trigger == 11) {
registry.add("fSameEventPartPPL", "CF - same event ppL distribution for particles;;events", HistType::kTH1F, {{8000, 0, 8}});
registry.add("fSameEventAntiPartPPL", "CF - same event ppL distribution for antiparticles;;events", HistType::kTH1F, {{8000, 0, 8}});
}
}

float mMassProton = TDatabasePDG::Instance()->GetParticle(2212)->Mass();
Expand All @@ -106,42 +128,114 @@ struct CFFilter {
{
registry.get<TH1>(HIST("fProcessedEvents"))->Fill(0);
bool keepEvent[nTriplets]{false};

// This is the main trigger part for proton-proton-Lambda
// pairCleanerTV -> Test if lambda hyperons don't have a daughter which is as well used as primary proton
// Calculate Q3 and check if it is smaller than 0.6
// If at collision has at least one triplet with Q3<0.6, the trigger value is set to true!
// IMPORTANT: Include close pair rejection here
int lowQ3Triplets[2] = {0, 0};
if (partsFemto.size() != 0) {
int lowQ3Triplets = 0;
if (partsLambda0.size() >= 1 && partsProton0.size() >= 2) {
for (auto& partLambda : partsLambda0) {
if (!pairCleanerTV.isCleanPair(partLambda, partLambda, partsFemto)) {
continue;
}
for (auto& [p1, p2] : combinations(partsProton0, partsProton0)) {
auto Q3 = FemtoDreamMath::getQ3(p1, mMassProton, p2, mMassProton, partLambda, mMassLambda);
registry.get<TH1>(HIST("fSameEvent"))->Fill(Q3);
if (Q3 < 1.5)
lowQ3Triplets++; // real value 0.6. We use 1.5 here for testing locally because of statistics
auto Q3TriggerLimit = (std::vector<float>)confQ3TriggerLimit;
// TRIGGER FOR PPP TRIPLETS
if (Q3Trigger == 0 || Q3Trigger == 11) {
if (partsProton0.size() >= 3) {
for (auto& [p1, p2, p3] : combinations(partsProton0, partsProton0, partsProton0)) {
// Think if pair cleaning is needed in current framework
if (closePairRejectionTT.isClosePair(p1, p2, partsFemto)) {
continue;
}
if (closePairRejectionTT.isClosePair(p1, p3, partsFemto)) {
continue;
}
if (closePairRejectionTT.isClosePair(p2, p3, partsFemto)) {
continue;
}
auto Q3 = FemtoDreamMath::getQ3(p1, mMassProton, p2, mMassProton, p3, mMassProton);
registry.get<TH1>(HIST("fSameEventPartPPP"))->Fill(Q3);
if (Q3 < Q3TriggerLimit.at(0)) {
lowQ3Triplets[0]++;
}
}
} // end if

if (lowQ3Triplets[0] == 0) { // if at least one triplet found in particles, no need to check antiparticles
if (partsProton1.size() >= 3) {
for (auto& [p1, p2, p3] : combinations(partsProton1, partsProton1, partsProton1)) {
// Think if pair cleaning is needed in current framework
if (closePairRejectionTT.isClosePair(p1, p2, partsFemto)) {
continue;
}
if (closePairRejectionTT.isClosePair(p1, p3, partsFemto)) {
continue;
}
if (closePairRejectionTT.isClosePair(p2, p3, partsFemto)) {
continue;
}
auto Q3 = FemtoDreamMath::getQ3(p1, mMassProton, p2, mMassProton, p3, mMassProton);
registry.get<TH1>(HIST("fSameEventAntiPartPPP"))->Fill(Q3);
if (Q3 < Q3TriggerLimit.at(0)) {
lowQ3Triplets[0]++;
}
}
} // end if
}
} // end if
if (partsLambda1.size() >= 1 && partsProton1.size() >= 2) {
for (auto& partLambda : partsLambda1) {
if (!pairCleanerTV.isCleanPair(partLambda, partLambda, partsFemto)) {
continue;
}
for (auto& [p1, p2] : combinations(partsProton1, partsProton1)) {
auto Q3 = FemtoDreamMath::getQ3(p1, mMassProton, p2, mMassProton, partLambda, mMassLambda);
registry.get<TH1>(HIST("fSameEvent"))->Fill(Q3);
if (Q3 < 1.5)
lowQ3Triplets++; // real value 0.6. We use 1.5 here for testing locally because of statistics
}

// TRIGGER FOR PPL TRIPLETS
if (Q3Trigger == 1 || Q3Trigger == 11) {
if (partsLambda0.size() >= 1 && partsProton0.size() >= 2) {
for (auto& partLambda : partsLambda0) {
if (!pairCleanerTV.isCleanPair(partLambda, partLambda, partsFemto)) {
continue;
}
for (auto& [p1, p2] : combinations(partsProton0, partsProton0)) {
if (closePairRejectionTT.isClosePair(p1, p2, partsFemto)) {
continue;
}
if (closePairRejectionTV0.isClosePair(p1, partLambda, partsFemto)) {
continue;
}
if (closePairRejectionTV0.isClosePair(p2, partLambda, partsFemto)) {
continue;
}
auto Q3 = FemtoDreamMath::getQ3(p1, mMassProton, p2, mMassProton, partLambda, mMassLambda);
registry.get<TH1>(HIST("fSameEventPartPPL"))->Fill(Q3);
if (Q3 < Q3TriggerLimit.at(1)) {
lowQ3Triplets[1]++;
}
}
}
} // end if

if (lowQ3Triplets[1] == 0) { // if at least one triplet found in particles, no need to check antiparticles
if (partsLambda1.size() >= 1 && partsProton1.size() >= 2) {
for (auto& partLambda : partsLambda1) {
if (!pairCleanerTV.isCleanPair(partLambda, partLambda, partsFemto)) {
continue;
}
for (auto& [p1, p2] : combinations(partsProton1, partsProton1)) {
if (closePairRejectionTT.isClosePair(p1, p2, partsFemto)) {
continue;
}
if (closePairRejectionTV0.isClosePair(p1, partLambda, partsFemto)) {
continue;
}
if (closePairRejectionTV0.isClosePair(p2, partLambda, partsFemto)) {
continue;
}
auto Q3 = FemtoDreamMath::getQ3(p1, mMassProton, p2, mMassProton, partLambda, mMassLambda);
registry.get<TH1>(HIST("fSameEventAntiPartPPL"))->Fill(Q3);
if (Q3 < Q3TriggerLimit.at(1)) {
lowQ3Triplets[1]++;
}
}
}
} // end if
}
} // end if
if (lowQ3Triplets > 0)
keepEvent[kPPL] = true;
}
}

if (lowQ3Triplets[0] > 0) {
keepEvent[kPPP] = true;
}

if (lowQ3Triplets[1] > 0) {
keepEvent[kPPL] = true;
}

tags(keepEvent[kPPP], keepEvent[kPPL], keepEvent[kPLL], keepEvent[kLLL]);
Expand Down
5 changes: 3 additions & 2 deletions PWGCF/FemtoDream/FemtoDreamDetaDphiStar.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,10 @@ class FemtoDreamDetaDphiStar
return false;
}

bool pass = true;
bool pass = false;
for (int i = 0; i < 2; i++) {
auto daughter = particles.begin() + part2.indices()[i];
auto indexOfDaughter = part2.index() - 2 + i;
auto daughter = particles.begin() + indexOfDaughter;
auto deta = part1.eta() - daughter.eta();
auto dphiAvg = AveragePhiStar(part1, *daughter, i);
histdetadpi[i][0]->Fill(deta, dphiAvg);
Expand Down
29 changes: 10 additions & 19 deletions PWGCF/FemtoDream/FemtoDreamPairCleaner.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,34 +57,25 @@ class FemtoDreamPairCleaner
{
if constexpr (mPartOneType == o2::aod::femtodreamparticle::ParticleType::kTrack && mPartTwoType == o2::aod::femtodreamparticle::ParticleType::kTrack) {
/// Track-Track combination
if (part1.partType() != o2::aod::femtodreamparticle::ParticleType::kTrack || part2.partType() != o2::aod::femtodreamparticle::ParticleType::kTrack) {
LOG(fatal) << "FemtoDreamPairCleaner: passed arguments don't agree with FemtoDreamPairCleaner instantiation! Please provide kTrack,kTrack candidates.";
return false;
}
return part1.globalIndex() != part2.globalIndex();
} else if constexpr (mPartOneType == o2::aod::femtodreamparticle::ParticleType::kTrack && mPartTwoType == o2::aod::femtodreamparticle::ParticleType::kV0) {
/// Track-V0 combination
// \todo to be implemented
uint64_t id1 = part2.indices()[0];
uint64_t id2 = part2.indices()[1];
if (part2.partType() != o2::aod::femtodreamparticle::ParticleType::kV0) {
LOG(fatal) << "FemtoDreamPairCleaner: passed arguments don't agree with FemtoDreamPairCleaner instantiation! Please provide second argument kV0 candidate.";
return false;
}
uint64_t id1 = part2.index() - 2;
uint64_t id2 = part2.index() - 1;
auto daughter1 = particles.begin() + id1;
auto daughter2 = particles.begin() + id2;
if ((*daughter1).indices()[0] <= 0 && (*daughter1).indices()[1] <= 0 && (*daughter2).indices()[0] <= 0 && (*daughter2).indices()[1] <= 0) {
return true;
}
return false;
} else if constexpr (mPartOneType == o2::aod::femtodreamparticle::ParticleType::kTrack && mPartTwoType == o2::aod::femtodreamparticle::ParticleType::kCascade) {
/// Track-Cascade combination
// \todo to be implemented
return false;
} else if constexpr (mPartOneType == o2::aod::femtodreamparticle::ParticleType::kV0 && mPartTwoType == o2::aod::femtodreamparticle::ParticleType::kV0) {
/// V0-V0 combination
// \todo to be implemented
return false;
} else if constexpr (mPartOneType == o2::aod::femtodreamparticle::ParticleType::kV0 && mPartTwoType == o2::aod::femtodreamparticle::ParticleType::kCascade) {
/// V0-Cascade combination
// \todo to be implemented
return false;
} else if constexpr (mPartOneType == o2::aod::femtodreamparticle::ParticleType::kCascade && mPartTwoType == o2::aod::femtodreamparticle::ParticleType::kCascade) {
/// Cascade-Cascade combination
// \todo to be implemented
return false;
} else {
LOG(fatal) << "FemtoDreamPairCleaner: Combination of objects not defined - quitting!";
return false;
Expand Down