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
43 changes: 26 additions & 17 deletions PWGLF/DataModel/LFHStrangeCorrelationTables.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@
#ifndef PWGLF_DATAMODEL_LFHSTRANGECORRELATIONTABLES_H_
#define PWGLF_DATAMODEL_LFHSTRANGECORRELATIONTABLES_H_

#include <cmath>
#include "Framework/AnalysisDataModel.h"
#include "Common/Core/RecoDecay.h"
#include "CommonConstants/PhysicsConstants.h"
#include <cmath>

// Simple checker
#define bitcheck(var, nbit) ((var) & (1 << (nbit)))

namespace o2::aod
{
Expand All @@ -52,9 +55,12 @@ namespace assocV0s
{
DECLARE_SOA_INDEX_COLUMN(Collision, collision); //!
DECLARE_SOA_INDEX_COLUMN(V0Core, v0Core); //!
DECLARE_SOA_COLUMN(CompatibleK0Short, compatibleK0Short, bool); // compatible with K0Short
DECLARE_SOA_COLUMN(CompatibleLambda, compatibleLambda, bool); // compatible with Lambda
DECLARE_SOA_COLUMN(CompatibleAntiLambda, compatibleAntiLambda, bool); // compatible with AntiLambda

// dEdx compatibility is done via encoded integer: 0: passes loose; 1: passes normal, 2: passes tight; definition of loose/normal/tight is in hStrangeCorrelationFilter
DECLARE_SOA_COLUMN(CompatibleK0Short, compatibleK0Short, int); // compatible with K0Short dEdx, encoded syst checks
DECLARE_SOA_COLUMN(CompatibleLambda, compatibleLambda, int); // compatible with Lambda dEdx, encoded syst checks
DECLARE_SOA_COLUMN(CompatibleAntiLambda, compatibleAntiLambda, int); // compatible with AntiLambda dEdx, encoded syst checks

DECLARE_SOA_COLUMN(MCTrueK0Short, mcTrueK0Short, bool); // true K0Short in MC
DECLARE_SOA_COLUMN(MCTrueLambda, mcTrueLambda, bool); // true Lambda in MC
DECLARE_SOA_COLUMN(MCTrueAntiLambda, mcTrueAntiLambda, bool); // true AntiLambda in MC
Expand All @@ -63,12 +69,12 @@ DECLARE_SOA_COLUMN(MassRegionK0Short, massRegionK0Short, int); //
DECLARE_SOA_COLUMN(MassRegionLambda, massRegionLambda, int); //
DECLARE_SOA_COLUMN(MassRegionAntiLambda, massRegionAntiLambda, int); //
DECLARE_SOA_DYNAMIC_COLUMN(Compatible, compatible, //! check compatibility with a hypothesis of a certain number (0 - K0, 1 - L, 2 - Lbar)
[](bool cK0Short, bool cLambda, bool cAntiLambda, int value) -> bool {
if (value == 0 && cK0Short)
[](int cK0Short, int cLambda, int cAntiLambda, int value, int compatibilityLevel) -> bool {
if (value == 0 && bitcheck(cK0Short, compatibilityLevel))
return true;
if (value == 1 && cLambda)
if (value == 1 && bitcheck(cLambda, compatibilityLevel))
return true;
if (value == 2 && cAntiLambda)
if (value == 2 && bitcheck(cAntiLambda, compatibilityLevel))
return true;
return false;
});
Expand Down Expand Up @@ -125,10 +131,13 @@ namespace assocCascades
{
DECLARE_SOA_INDEX_COLUMN(Collision, collision); //!
DECLARE_SOA_INDEX_COLUMN(CascData, cascData); //!
DECLARE_SOA_COLUMN(CompatibleXiMinus, compatibleXiMinus, bool); // compatible with XiMinus
DECLARE_SOA_COLUMN(CompatibleXiPlus, compatibleXiPlus, bool); // compatible with XiPlus
DECLARE_SOA_COLUMN(CompatibleOmegaMinus, compatibleOmegaMinus, bool); // compatible with OmegaMinus
DECLARE_SOA_COLUMN(CompatibleOmegaPlus, compatibleOmegaPlus, bool); // compatible with OmegaPlus

// dEdx compatibility is done via encoded integer: 0: passes loose; 1: passes normal, 2: passes tight; definition of loose/normal/tight is in hStrangeCorrelationFilter
DECLARE_SOA_COLUMN(CompatibleXiMinus, compatibleXiMinus, int); // compatible with XiMinus
DECLARE_SOA_COLUMN(CompatibleXiPlus, compatibleXiPlus, int); // compatible with XiPlus
DECLARE_SOA_COLUMN(CompatibleOmegaMinus, compatibleOmegaMinus, int); // compatible with OmegaMinus
DECLARE_SOA_COLUMN(CompatibleOmegaPlus, compatibleOmegaPlus, int); // compatible with OmegaPlus

DECLARE_SOA_COLUMN(MCTrueXiMinus, mcTrueXiMinus, bool); // true XiMinus in mc
DECLARE_SOA_COLUMN(MCTrueXiPlus, mcTrueXiPlus, bool); // true XiPlus in mc
DECLARE_SOA_COLUMN(MCTrueOmegaMinus, mcTrueOmegaMinus, bool); // true OmegaMinus in mc
Expand All @@ -137,14 +146,14 @@ DECLARE_SOA_COLUMN(MCPhysicalPrimary, mcPhysicalPrimary, bool); // physica
DECLARE_SOA_COLUMN(MassRegionXi, massRegionXi, int); //
DECLARE_SOA_COLUMN(MassRegionOmega, massRegionOmega, int); //
DECLARE_SOA_DYNAMIC_COLUMN(Compatible, compatible, //! check compatibility with a hypothesis of a certain number (0 - K0, 1 - L, 2 - Lbar)
[](bool cXiMinus, bool cXiPlus, bool cOmegaMinus, bool cOmegaPlus, int value) -> bool {
if (value == 0 && cXiMinus)
[](int cXiMinus, int cXiPlus, int cOmegaMinus, int cOmegaPlus, int value, int compatibilityLevel) -> bool {
if (value == 0 && bitcheck(cXiMinus, compatibilityLevel))
return true;
if (value == 1 && cXiPlus)
if (value == 1 && bitcheck(cXiPlus, compatibilityLevel))
return true;
if (value == 2 && cOmegaMinus)
if (value == 2 && bitcheck(cOmegaMinus, compatibilityLevel))
return true;
if (value == 3 && cOmegaPlus)
if (value == 3 && bitcheck(cOmegaPlus, compatibilityLevel))
return true;
return false;
});
Expand Down
110 changes: 71 additions & 39 deletions PWGLF/TableProducer/Strangeness/hStrangeCorrelationFilter.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,17 @@ using namespace o2;
using namespace o2::framework;
using namespace o2::framework::expressions;

#define bitset(var, nbit) ((var) |= (1 << (nbit)))
#define bitcheck(var, nbit) ((var) & (1 << (nbit)))

struct hstrangecorrelationfilter {
HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject};

// Operational
Configurable<bool> fillTableOnlyWithCompatible{"fillTableOnlyWithCompatible", true, "pre-apply dE/dx, broad mass window in table filling"};
Configurable<float> strangedEdxNSigma{"strangedEdxNSigma", 5, "Nsigmas for strange decay daughters"};
Configurable<float> strangedEdxNSigmaLoose{"strangedEdxNSigmaLoose", 5, "Nsigmas for strange decay daughters"};
Configurable<float> strangedEdxNSigma{"strangedEdxNSigma", 4, "Nsigmas for strange decay daughters"};
Configurable<float> strangedEdxNSigmaTight{"strangedEdxNSigmaTight", 3, "Nsigmas for strange decay daughters"};

// Trigger particle selections in phase space
Configurable<float> triggerEtaMin{"triggerEtaCutMin", -0.8, "triggeretamin"};
Expand Down Expand Up @@ -329,9 +332,9 @@ struct hstrangecorrelationfilter {
continue;
}
// check dE/dx compatibility
bool compatibleK0Short = false;
bool compatibleLambda = false;
bool compatibleAntiLambda = false;
int compatibleK0Short = 0;
int compatibleLambda = 0;
int compatibleAntiLambda = 0;

auto posdau = v0.posTrack_as<DauTracks>();
auto negdau = v0.negTrack_as<DauTracks>();
Expand All @@ -342,19 +345,33 @@ struct hstrangecorrelationfilter {
if (posdau.tpcNClsCrossedRows() < minTPCNCrossedRows)
continue;

if (TMath::Abs(posdau.tpcNSigmaPi()) < strangedEdxNSigma && TMath::Abs(negdau.tpcNSigmaPi()) < strangedEdxNSigma) {
compatibleK0Short = true;
}
if (TMath::Abs(posdau.tpcNSigmaPr()) < strangedEdxNSigma && TMath::Abs(negdau.tpcNSigmaPi()) < strangedEdxNSigma) {
if (v0.v0cosPA() > lambdaCospa) {
compatibleLambda = true;
}
}
if (TMath::Abs(posdau.tpcNSigmaPi()) < strangedEdxNSigma && TMath::Abs(negdau.tpcNSigmaPr()) < strangedEdxNSigma) {
if (v0.v0cosPA() > lambdaCospa) {
compatibleAntiLambda = true;
}
}
if (TMath::Abs(posdau.tpcNSigmaPi()) < strangedEdxNSigmaLoose && TMath::Abs(negdau.tpcNSigmaPi()) < strangedEdxNSigmaLoose)
bitset(compatibleK0Short, 0);
if (TMath::Abs(posdau.tpcNSigmaPi()) < strangedEdxNSigma && TMath::Abs(negdau.tpcNSigmaPi()) < strangedEdxNSigma)
bitset(compatibleK0Short, 1);
if (TMath::Abs(posdau.tpcNSigmaPi()) < strangedEdxNSigmaTight && TMath::Abs(negdau.tpcNSigmaPi()) < strangedEdxNSigmaTight)
bitset(compatibleK0Short, 2);

if (TMath::Abs(posdau.tpcNSigmaPr()) < strangedEdxNSigmaLoose && TMath::Abs(negdau.tpcNSigmaPi()) < strangedEdxNSigmaLoose)
if (v0.v0cosPA() > lambdaCospa)
bitset(compatibleLambda, 0);
if (TMath::Abs(posdau.tpcNSigmaPr()) < strangedEdxNSigma && TMath::Abs(negdau.tpcNSigmaPi()) < strangedEdxNSigma)
if (v0.v0cosPA() > lambdaCospa)
bitset(compatibleLambda, 1);
if (TMath::Abs(posdau.tpcNSigmaPr()) < strangedEdxNSigmaTight && TMath::Abs(negdau.tpcNSigmaPi()) < strangedEdxNSigmaTight)
if (v0.v0cosPA() > lambdaCospa)
bitset(compatibleLambda, 2);

if (TMath::Abs(posdau.tpcNSigmaPi()) < strangedEdxNSigmaLoose && TMath::Abs(negdau.tpcNSigmaPr()) < strangedEdxNSigmaLoose)
if (v0.v0cosPA() > lambdaCospa)
bitset(compatibleAntiLambda, 0);
if (TMath::Abs(posdau.tpcNSigmaPi()) < strangedEdxNSigma && TMath::Abs(negdau.tpcNSigmaPr()) < strangedEdxNSigma)
if (v0.v0cosPA() > lambdaCospa)
bitset(compatibleAntiLambda, 1);
if (TMath::Abs(posdau.tpcNSigmaPi()) < strangedEdxNSigmaTight && TMath::Abs(negdau.tpcNSigmaPr()) < strangedEdxNSigmaTight)
if (v0.v0cosPA() > lambdaCospa)
bitset(compatibleAntiLambda, 2);

// check whether V0s are in the regin
int massRegK0Short = -1;
if (TMath::Abs(v0.mK0Short() - fK0Mean->Eval(v0.pt()) < peakNsigma * fK0Width->Eval(v0.pt()))) {
Expand Down Expand Up @@ -416,9 +433,9 @@ struct hstrangecorrelationfilter {

if (!fillTableOnlyWithCompatible ||
( // start major condition check
(compatibleK0Short && massRegK0Short > 0 && massRegK0Short < 4) ||
(compatibleLambda && massRegLambda > 0 && massRegLambda < 4) ||
(compatibleAntiLambda && massRegAntiLambda > 0 && massRegAntiLambda < 4)) // end major condition check
(compatibleK0Short > 0 && massRegK0Short > 0 && massRegK0Short < 4) ||
(compatibleLambda > 0 && massRegLambda > 0 && massRegLambda < 4) ||
(compatibleAntiLambda > 0 && massRegAntiLambda > 0 && massRegAntiLambda < 4)) // end major condition check
) {
assocV0(v0.collisionId(), v0.globalIndex(),
compatibleK0Short, compatibleLambda, compatibleAntiLambda,
Expand Down Expand Up @@ -454,23 +471,38 @@ struct hstrangecorrelationfilter {
continue;

// check dE/dx compatibility
bool compatibleXiMinus = false;
bool compatibleXiPlus = false;
bool compatibleOmegaMinus = false;
bool compatibleOmegaPlus = false;

if (TMath::Abs(posTrackCast.tpcNSigmaPr()) < strangedEdxNSigma && TMath::Abs(negTrackCast.tpcNSigmaPi()) < strangedEdxNSigma && TMath::Abs(bachTrackCast.tpcNSigmaPi()) < strangedEdxNSigma && casc.sign() < 0) {
compatibleXiMinus = true;
}
if (TMath::Abs(posTrackCast.tpcNSigmaPi()) < strangedEdxNSigma && TMath::Abs(negTrackCast.tpcNSigmaPr()) < strangedEdxNSigma && TMath::Abs(bachTrackCast.tpcNSigmaPi()) < strangedEdxNSigma && casc.sign() > 0) {
compatibleXiPlus = true;
}
if (TMath::Abs(posTrackCast.tpcNSigmaPr()) < strangedEdxNSigma && TMath::Abs(negTrackCast.tpcNSigmaPi()) < strangedEdxNSigma && TMath::Abs(bachTrackCast.tpcNSigmaKa()) < strangedEdxNSigma && casc.sign() < 0) {
compatibleOmegaMinus = true;
}
if (TMath::Abs(posTrackCast.tpcNSigmaPi()) < strangedEdxNSigma && TMath::Abs(negTrackCast.tpcNSigmaPr()) < strangedEdxNSigma && TMath::Abs(bachTrackCast.tpcNSigmaKa()) < strangedEdxNSigma && casc.sign() > 0) {
compatibleOmegaPlus = true;
}
int compatibleXiMinus = 0;
int compatibleXiPlus = 0;
int compatibleOmegaMinus = 0;
int compatibleOmegaPlus = 0;

if (TMath::Abs(posTrackCast.tpcNSigmaPr()) < strangedEdxNSigmaLoose && TMath::Abs(negTrackCast.tpcNSigmaPi()) < strangedEdxNSigmaLoose && TMath::Abs(bachTrackCast.tpcNSigmaPi()) < strangedEdxNSigmaLoose && casc.sign() < 0)
bitset(compatibleXiMinus, 0);
if (TMath::Abs(posTrackCast.tpcNSigmaPr()) < strangedEdxNSigma && TMath::Abs(negTrackCast.tpcNSigmaPi()) < strangedEdxNSigma && TMath::Abs(bachTrackCast.tpcNSigmaPi()) < strangedEdxNSigma && casc.sign() < 0)
bitset(compatibleXiMinus, 1);
if (TMath::Abs(posTrackCast.tpcNSigmaPr()) < strangedEdxNSigmaTight && TMath::Abs(negTrackCast.tpcNSigmaPi()) < strangedEdxNSigmaTight && TMath::Abs(bachTrackCast.tpcNSigmaPi()) < strangedEdxNSigmaTight && casc.sign() < 0)
bitset(compatibleXiMinus, 2);

if (TMath::Abs(posTrackCast.tpcNSigmaPi()) < strangedEdxNSigmaLoose && TMath::Abs(negTrackCast.tpcNSigmaPr()) < strangedEdxNSigmaLoose && TMath::Abs(bachTrackCast.tpcNSigmaPi()) < strangedEdxNSigmaLoose && casc.sign() > 0)
bitset(compatibleXiPlus, 0);
if (TMath::Abs(posTrackCast.tpcNSigmaPi()) < strangedEdxNSigma && TMath::Abs(negTrackCast.tpcNSigmaPr()) < strangedEdxNSigma && TMath::Abs(bachTrackCast.tpcNSigmaPi()) < strangedEdxNSigma && casc.sign() > 0)
bitset(compatibleXiPlus, 1);
if (TMath::Abs(posTrackCast.tpcNSigmaPi()) < strangedEdxNSigmaTight && TMath::Abs(negTrackCast.tpcNSigmaPr()) < strangedEdxNSigmaTight && TMath::Abs(bachTrackCast.tpcNSigmaPi()) < strangedEdxNSigmaTight && casc.sign() > 0)
bitset(compatibleXiPlus, 2);

if (TMath::Abs(posTrackCast.tpcNSigmaPr()) < strangedEdxNSigmaLoose && TMath::Abs(negTrackCast.tpcNSigmaPi()) < strangedEdxNSigmaLoose && TMath::Abs(bachTrackCast.tpcNSigmaKa()) < strangedEdxNSigmaLoose && casc.sign() < 0)
bitset(compatibleOmegaMinus, 0);
if (TMath::Abs(posTrackCast.tpcNSigmaPr()) < strangedEdxNSigma && TMath::Abs(negTrackCast.tpcNSigmaPi()) < strangedEdxNSigma && TMath::Abs(bachTrackCast.tpcNSigmaKa()) < strangedEdxNSigma && casc.sign() < 0)
bitset(compatibleOmegaMinus, 1);
if (TMath::Abs(posTrackCast.tpcNSigmaPr()) < strangedEdxNSigmaTight && TMath::Abs(negTrackCast.tpcNSigmaPi()) < strangedEdxNSigmaTight && TMath::Abs(bachTrackCast.tpcNSigmaKa()) < strangedEdxNSigmaTight && casc.sign() < 0)
bitset(compatibleOmegaMinus, 2);

if (TMath::Abs(posTrackCast.tpcNSigmaPi()) < strangedEdxNSigmaLoose && TMath::Abs(negTrackCast.tpcNSigmaPr()) < strangedEdxNSigmaLoose && TMath::Abs(bachTrackCast.tpcNSigmaKa()) < strangedEdxNSigmaLoose && casc.sign() > 0)
bitset(compatibleOmegaPlus, 0);
if (TMath::Abs(posTrackCast.tpcNSigmaPi()) < strangedEdxNSigma && TMath::Abs(negTrackCast.tpcNSigmaPr()) < strangedEdxNSigma && TMath::Abs(bachTrackCast.tpcNSigmaKa()) < strangedEdxNSigma && casc.sign() > 0)
bitset(compatibleOmegaPlus, 1);
if (TMath::Abs(posTrackCast.tpcNSigmaPi()) < strangedEdxNSigmaTight && TMath::Abs(negTrackCast.tpcNSigmaPr()) < strangedEdxNSigmaTight && TMath::Abs(bachTrackCast.tpcNSigmaKa()) < strangedEdxNSigmaTight && casc.sign() > 0)
bitset(compatibleOmegaPlus, 2);

int massRegXi = -1;
if (TMath::Abs(casc.mXi() - fXiMean->Eval(casc.pt()) < peakNsigma * fXiWidth->Eval(casc.pt()))) {
Expand Down Expand Up @@ -517,8 +549,8 @@ struct hstrangecorrelationfilter {

if (!fillTableOnlyWithCompatible ||
( // start major condition check
((compatibleXiMinus || compatibleXiPlus) && massRegXi > 0 && massRegXi < 4) ||
((compatibleOmegaMinus || compatibleOmegaPlus) && massRegOmega > 0 && massRegOmega < 4)) // end major condition check
((compatibleXiMinus > 0 || compatibleXiPlus > 0) && massRegXi > 0 && massRegXi < 4) ||
((compatibleOmegaMinus > 0 || compatibleOmegaPlus > 0) && massRegOmega > 0 && massRegOmega < 4)) // end major condition check
) {
assocCascades(casc.collisionId(), casc.globalIndex(),
compatibleXiMinus, compatibleXiPlus, compatibleOmegaMinus, compatibleOmegaPlus,
Expand Down
Loading