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
205 changes: 198 additions & 7 deletions PWGCF/TwoParticleCorrelations/Tasks/longrangecorrDerived.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "PWGCF/DataModel/CorrelationsDerived.h"
#include "PWGCF/TwoParticleCorrelations/DataModel/LongRangeDerived.h"
#include "PWGMM/Mult/DataModel/bestCollisionTable.h"
#include "PWGUD/Core/SGSelector.h"

#include "Common/Core/RecoDecay.h"
#include "Common/Core/TrackSelection.h"
Expand Down Expand Up @@ -77,12 +78,19 @@ using namespace o2::constants::math;
struct LongrangecorrDerived {

SliceCache cache;
SGSelector sgSelector;
HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject};
Configurable<int> cfgNmixedevent{"cfgNmixedevent", 5, "how many events are mixed"};
Configurable<int> cfgPidMask{"cfgPidMask", 0, "Selection bitmask for the TPC particle"};
Configurable<int> cfgV0Mask{"cfgV0Mask", 0, "Selection bitmask for the V0 particle"};
Configurable<float> cfgVtxCut{"cfgVtxCut", 10.0f, "Vertex Z range to consider"};

Configurable<float> cfgFv0Cut{"cfgFv0Cut", 50.0f, "FV0A threshold"};
Configurable<float> cfgFt0aCut{"cfgFt0aCut", 100.0f, "FT0A threshold"};
Configurable<float> cfgFt0cCut{"cfgFt0cCut", 50.0f, "FT0C threshold"};
Configurable<float> cfgZdcCut{"cfgZdcCut", 0.1f, "ZDC threshold"};
Configurable<int> cfgGapSideCut{"cfgGapSideCut", 0, "Gap-side A=0, C=1, AC = 2, No Gap = -1, All events = 3"};

ConfigurableAxis axisMultiplicity{"axisMultiplicity", {VARIABLE_WIDTH, 0, 10, 15, 25, 50, 60, 1000}, "multiplicity axis"};
ConfigurableAxis axisPhi{"axisPhi", {96, 0, TwoPI}, "#phi axis"};
ConfigurableAxis axisEtaTrig{"axisEtaTrig", {40, -1., 1.}, "#eta trig axis"};
Expand Down Expand Up @@ -111,13 +119,28 @@ struct LongrangecorrDerived {
using MftbestTrksTable = aod::MftBestTrkLRTables;
using V0TrksTable = aod::V0TrkLRTables;

using UpcCollsTable = soa::Join<aod::UpcCollLRTables, aod::UpcSgCollLRTables, aod::ZdcLRTables>;
using TrksUpcTable = aod::TrkLRUpcTables;
using MftTrksUpcTable = aod::MftTrkLRUpcTables;
using Ft0aTrksUpcTable = aod::Ft0aLRUpcTables;
using Ft0cTrksUpcTable = aod::Ft0cLRUpcTables;
using MftbestTrksUpcTable = aod::MftBestTrkLRUpcTables;
using V0TrksUpcTable = aod::V0TrkLRUpcTables;

Preslice<TrksTable> perColTpc = aod::lrcorrtrktable::collLRTableId;
Preslice<MftTrksTable> perColMft = aod::lrcorrtrktable::collLRTableId;
Preslice<MftbestTrksTable> perColMftbest = aod::lrcorrtrktable::collLRTableId;
Preslice<Ft0aTrksTable> perColFt0a = aod::lrcorrtrktable::collLRTableId;
Preslice<Ft0cTrksTable> perColFt0c = aod::lrcorrtrktable::collLRTableId;
Preslice<V0TrksTable> perColV0 = aod::lrcorrtrktable::collLRTableId;

Preslice<TrksUpcTable> perUpcColTpc = aod::lrcorrtrktable::upcCollLRTableId;
Preslice<MftTrksUpcTable> perUpcColMft = aod::lrcorrtrktable::upcCollLRTableId;
Preslice<MftbestTrksUpcTable> perUpcColMftbest = aod::lrcorrtrktable::upcCollLRTableId;
Preslice<Ft0aTrksUpcTable> perUpcColFt0a = aod::lrcorrtrktable::upcCollLRTableId;
Preslice<Ft0cTrksUpcTable> perUpcColFt0c = aod::lrcorrtrktable::upcCollLRTableId;
Preslice<V0TrksUpcTable> perUpcColV0 = aod::lrcorrtrktable::upcCollLRTableId;

void init(InitContext const&)
{
std::vector<AxisSpec> corrAxis = {{axisVtxZ, "z-vtx (cm)"},
Expand All @@ -135,9 +158,12 @@ struct LongrangecorrDerived {
mixed.setObject(new CorrelationContainer("mixedEvent", "mixedEvent", corrAxis, effAxis, userAxis));

histos.add("hMultiplicity", "hMultiplicity", kTH1D, {axisMultiplicity});
histos.add("hCentrality", "hCentrality", kTH1D, {axisMultiplicity});
histos.add("hVertexZ", "hVertexZ", kTH1D, {axisVtxZ});

histos.add("hGapSide", "hGapSide", kTH1I, {{5, -0.5, 4.5}});
histos.add("hTrueGapSide", "hTrueGapSide", kTH1I, {{6, -1.5, 4.5}});
histos.add("hTrueGapSide_AfterSel", "hTrueGapSide_AfterSel", kTH1I, {{6, -1.5, 4.5}});

histos.add("Trig_eta", "Trig_eta", kTH1D, {axisEtaTrig});
histos.add("Trig_phi", "Trig_phi", kTH1D, {axisPhi});
histos.add("Trig_etavsphi", "Trig_etavsphi", kTH2D, {axisPhi, axisEtaTrig});
Expand All @@ -157,7 +183,6 @@ struct LongrangecorrDerived {
void fillCollQA(TCollision const& col)
{
histos.fill(HIST("hMultiplicity"), col.multiplicity());
histos.fill(HIST("hCentrality"), col.centrality());
histos.fill(HIST("hVertexZ"), col.zvtx());
}

Expand All @@ -178,12 +203,32 @@ struct LongrangecorrDerived {
histos.fill(HIST("Assoc_phi"), track.phi());
}

template <bool fillHist = true, typename CheckCol>
bool isUpcEventSelected(CheckCol const& col)
{
if constexpr (fillHist) {
histos.fill(HIST("hGapSide"), col.gapSide());
}
int truegapSide = sgSelector.trueGap(col, cfgFv0Cut, cfgFt0aCut, cfgFt0cCut, cfgZdcCut);
if constexpr (fillHist) {
histos.fill(HIST("hTrueGapSide"), truegapSide);
}
if (truegapSide != cfgGapSideCut)
return false;
if constexpr (fillHist) {
histos.fill(HIST("hTrueGapSide_AfterSel"), truegapSide);
}
return true;
}

template <class T>
using HasTpcTrack = decltype(std::declval<T&>().trackType());
template <class T>
using HasV0Track = decltype(std::declval<T&>().v0Type());
template <class T>
using HasInvMass = decltype(std::declval<T&>().invMass());
template <class T>
using HasUpc = decltype(std::declval<T&>().gapSide());

template <CorrelationContainer::CFStep step, typename TTarget, typename TTriggers, typename TAssocs>
void fillCorrHist(TTarget target, TTriggers const& triggers, TAssocs const& assocs, bool mixing, float vz, float multiplicity, float eventWeight)
Expand Down Expand Up @@ -233,20 +278,31 @@ struct LongrangecorrDerived {
} // process same

template <typename TCollision, typename... TrackTypes>
void processMixed(TCollision const& col, TrackTypes&&... tracks)
void processMixed(TCollision const& cols, TrackTypes&&... tracks)
{
auto getMultiplicity = [this](auto& collision) {
(void)this;
return collision.multiplicity();
auto getMultiplicity = [this](auto& col) {
if constexpr (std::experimental::is_detected<HasUpc, TCollision>::value) {
if (!isUpcEventSelected<false>(col)) {
return -1.0f;
}
} else {
(void)this;
}
return col.multiplicity();
};
using MixedBinning = FlexibleBinningPolicy<std::tuple<decltype(getMultiplicity)>, aod::lrcorrcolltable::Zvtx, decltype(getMultiplicity)>;
MixedBinning binningOnVtxAndMult{{getMultiplicity}, {axisVtxZME, axisMultME}, true};
auto tracksTuple = std::make_tuple(std::forward<TrackTypes>(tracks)...);
using TupleAtrack = std::tuple_element<0, decltype(tracksTuple)>::type;
using TupleBtrack = std::tuple_element<std::tuple_size_v<decltype(tracksTuple)> - 1, decltype(tracksTuple)>::type;
Pair<TCollision, TupleAtrack, TupleBtrack, MixedBinning> pairs{binningOnVtxAndMult, cfgNmixedevent, -1, col, tracksTuple, &cache};
Pair<TCollision, TupleAtrack, TupleBtrack, MixedBinning> pairs{binningOnVtxAndMult, cfgNmixedevent, -1, cols, tracksTuple, &cache};
for (auto it = pairs.begin(); it != pairs.end(); it++) {
auto& [col1, tracks1, col2, tracks2] = *it;
if constexpr (std::experimental::is_detected<HasUpc, TCollision>::value) {
if (!isUpcEventSelected<false>(col1) || !isUpcEventSelected<false>(col2)) {
continue;
}
}
float eventweight = 1.0f / it.currentWindowNeighbours();
fillCorrHist<CorrelationContainer::kCFStepReconstructed>(mixed, tracks1, tracks2, true, col1.zvtx(), col1.multiplicity(), eventweight);
} // pair loop
Expand Down Expand Up @@ -342,6 +398,123 @@ struct LongrangecorrDerived {
processMixed(cols, tracks, mfts);
}

void processUpcTpcft0aSE(UpcCollsTable::iterator const& col, TrksUpcTable const& tracks, Ft0aTrksUpcTable const& ft0as)
{
if (!isUpcEventSelected<true>(col)) {
return;
}
processSame(col, tracks, ft0as);
}

void processUpcTpcft0cSE(UpcCollsTable::iterator const& col, TrksUpcTable const& tracks, Ft0cTrksUpcTable const& ft0cs)
{
if (!isUpcEventSelected<true>(col)) {
return;
}
processSame(col, tracks, ft0cs);
}

void processUpcTpcmftSE(UpcCollsTable::iterator const& col, TrksUpcTable const& tracks, MftTrksUpcTable const& mfts)
{
if (!isUpcEventSelected<true>(col)) {
return;
}
processSame(col, tracks, mfts);
}

void processUpcMftft0aSE(UpcCollsTable::iterator const& col, MftTrksUpcTable const& mfts, Ft0aTrksUpcTable const& ft0as)
{
if (!isUpcEventSelected<true>(col)) {
return;
}
processSame(col, mfts, ft0as);
}

void processUpcV0ft0aSE(UpcCollsTable::iterator const& col, V0TrksUpcTable const& tracks, Ft0aTrksUpcTable const& ft0as)
{
if (!isUpcEventSelected<true>(col)) {
return;
}
processSame(col, tracks, ft0as);
}

void processUpcV0mftSE(UpcCollsTable::iterator const& col, V0TrksUpcTable const& tracks, MftTrksUpcTable const& mfts)
{
if (!isUpcEventSelected<true>(col)) {
return;
}
processSame(col, tracks, mfts);
}

void processUpcTpcmftbestSE(UpcCollsTable::iterator const& col, TrksUpcTable const& tracks, MftbestTrksUpcTable const& mfts)
{
if (!isUpcEventSelected<true>(col)) {
return;
}
processSame(col, tracks, mfts);
}

void processUpcMftbestft0aSE(UpcCollsTable::iterator const& col, MftbestTrksUpcTable const& mfts, Ft0aTrksUpcTable const& ft0as)
{
if (!isUpcEventSelected<true>(col)) {
return;
}
processSame(col, mfts, ft0as);
}

void processUpcV0mftbestSE(UpcCollsTable::iterator const& col, V0TrksUpcTable const& tracks, MftbestTrksUpcTable const& mfts)
{
if (!isUpcEventSelected<true>(col)) {
return;
}
processSame(col, tracks, mfts);
}

void processUpcTpcft0aME(UpcCollsTable const& cols, TrksUpcTable const& tracks, Ft0aTrksUpcTable const& ft0as)
{
processMixed(cols, tracks, ft0as);
}

void processUpcTpcft0cME(UpcCollsTable const& cols, TrksUpcTable const& tracks, Ft0cTrksUpcTable const& ft0cs)
{
processMixed(cols, tracks, ft0cs);
}

void processUpcTpcmftME(UpcCollsTable const& cols, TrksUpcTable const& tracks, MftTrksUpcTable const& mfts)
{
processMixed(cols, tracks, mfts);
}

void processUpcMftft0aME(UpcCollsTable const& cols, MftTrksUpcTable const& mfts, Ft0aTrksUpcTable const& ft0as)
{
processMixed(cols, mfts, ft0as);
}

void processUpcV0ft0aME(UpcCollsTable const& cols, V0TrksUpcTable const& tracks, Ft0aTrksUpcTable const& ft0as)
{
processMixed(cols, tracks, ft0as);
}

void processUpcV0mftME(UpcCollsTable const& cols, V0TrksUpcTable const& tracks, MftTrksUpcTable const& mfts)
{
processMixed(cols, tracks, mfts);
}

void processUpcTpcmftbestME(UpcCollsTable const& cols, TrksUpcTable const& tracks, MftbestTrksUpcTable const& mfts)
{
processMixed(cols, tracks, mfts);
}

void processUpcMftbestft0aME(UpcCollsTable const& cols, MftbestTrksUpcTable const& mfts, Ft0aTrksUpcTable const& ft0as)
{
processMixed(cols, mfts, ft0as);
}

void processUpcV0mftbestME(UpcCollsTable const& cols, V0TrksUpcTable const& tracks, MftbestTrksUpcTable const& mfts)
{
processMixed(cols, tracks, mfts);
}

PROCESS_SWITCH(LongrangecorrDerived, processTpcft0aSE, "same event TPC vs FT0A", false);
PROCESS_SWITCH(LongrangecorrDerived, processTpcft0aME, "mixed event TPC vs FT0A", false);
PROCESS_SWITCH(LongrangecorrDerived, processTpcft0cSE, "same event TPC vs FT0C", false);
Expand All @@ -360,6 +533,24 @@ struct LongrangecorrDerived {
PROCESS_SWITCH(LongrangecorrDerived, processMftbestft0aME, "mixed event best MFT vs FT0A", false);
PROCESS_SWITCH(LongrangecorrDerived, processV0mftbestSE, "same event V0 vs best MFT", false);
PROCESS_SWITCH(LongrangecorrDerived, processV0mftbestME, "mixed event V0 vs best MFT", false);
PROCESS_SWITCH(LongrangecorrDerived, processUpcTpcft0aSE, "same UPC event TPC vs FT0A", false);
PROCESS_SWITCH(LongrangecorrDerived, processUpcTpcft0aME, "mixed UPC event TPC vs FT0A", false);
PROCESS_SWITCH(LongrangecorrDerived, processUpcTpcft0cSE, "same UPC event TPC vs FT0C", false);
PROCESS_SWITCH(LongrangecorrDerived, processUpcTpcft0cME, "mixed UPC event TPC vs FT0C", false);
PROCESS_SWITCH(LongrangecorrDerived, processUpcTpcmftSE, "same UPC event TPC vs MFT", false);
PROCESS_SWITCH(LongrangecorrDerived, processUpcTpcmftME, "mixed UPC event TPC vs MFT", false);
PROCESS_SWITCH(LongrangecorrDerived, processUpcMftft0aSE, "same UPC event MFT vs FT0A", false);
PROCESS_SWITCH(LongrangecorrDerived, processUpcMftft0aME, "mixed UPC event MFT vs FT0A", false);
PROCESS_SWITCH(LongrangecorrDerived, processUpcV0ft0aSE, "same UPC event V0 vs FT0A", false);
PROCESS_SWITCH(LongrangecorrDerived, processUpcV0ft0aME, "mixed UPC event V0 vs FT0A", false);
PROCESS_SWITCH(LongrangecorrDerived, processUpcV0mftSE, "same UPC event V0 vs MFT", false);
PROCESS_SWITCH(LongrangecorrDerived, processUpcV0mftME, "mixed UPC event V0 vs MFT", false);
PROCESS_SWITCH(LongrangecorrDerived, processUpcTpcmftbestSE, "same UPC event TPC vs best MFT", false);
PROCESS_SWITCH(LongrangecorrDerived, processUpcTpcmftbestME, "mixed UPC event TPC vs best MFT", false);
PROCESS_SWITCH(LongrangecorrDerived, processUpcMftbestft0aSE, "same UPC event best MFT vs FT0A", false);
PROCESS_SWITCH(LongrangecorrDerived, processUpcMftbestft0aME, "mixed UPC event best MFT vs FT0A", false);
PROCESS_SWITCH(LongrangecorrDerived, processUpcV0mftbestSE, "same UPC event V0 vs best MFT", false);
PROCESS_SWITCH(LongrangecorrDerived, processUpcV0mftbestME, "mixed UPC event V0 vs best MFT", false);
};

WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
Expand Down
Loading