From 9c32a42fc614eb7770644d646da3c2ebbbfa1bc1 Mon Sep 17 00:00:00 2001 From: abmodak <67369858+abmodak@users.noreply.github.com> Date: Sat, 15 Nov 2025 08:56:02 +0100 Subject: [PATCH] Add correlation histos for UPC events --- .../Tasks/longrangecorrDerived.cxx | 205 +++++++++++++++++- 1 file changed, 198 insertions(+), 7 deletions(-) diff --git a/PWGCF/TwoParticleCorrelations/Tasks/longrangecorrDerived.cxx b/PWGCF/TwoParticleCorrelations/Tasks/longrangecorrDerived.cxx index 17f4499e011..751a5cedec5 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/longrangecorrDerived.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/longrangecorrDerived.cxx @@ -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" @@ -77,12 +78,19 @@ using namespace o2::constants::math; struct LongrangecorrDerived { SliceCache cache; + SGSelector sgSelector; HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; Configurable cfgNmixedevent{"cfgNmixedevent", 5, "how many events are mixed"}; Configurable cfgPidMask{"cfgPidMask", 0, "Selection bitmask for the TPC particle"}; Configurable cfgV0Mask{"cfgV0Mask", 0, "Selection bitmask for the V0 particle"}; Configurable cfgVtxCut{"cfgVtxCut", 10.0f, "Vertex Z range to consider"}; + Configurable cfgFv0Cut{"cfgFv0Cut", 50.0f, "FV0A threshold"}; + Configurable cfgFt0aCut{"cfgFt0aCut", 100.0f, "FT0A threshold"}; + Configurable cfgFt0cCut{"cfgFt0cCut", 50.0f, "FT0C threshold"}; + Configurable cfgZdcCut{"cfgZdcCut", 0.1f, "ZDC threshold"}; + Configurable 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"}; @@ -111,6 +119,14 @@ struct LongrangecorrDerived { using MftbestTrksTable = aod::MftBestTrkLRTables; using V0TrksTable = aod::V0TrkLRTables; + using UpcCollsTable = soa::Join; + 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 perColTpc = aod::lrcorrtrktable::collLRTableId; Preslice perColMft = aod::lrcorrtrktable::collLRTableId; Preslice perColMftbest = aod::lrcorrtrktable::collLRTableId; @@ -118,6 +134,13 @@ struct LongrangecorrDerived { Preslice perColFt0c = aod::lrcorrtrktable::collLRTableId; Preslice perColV0 = aod::lrcorrtrktable::collLRTableId; + Preslice perUpcColTpc = aod::lrcorrtrktable::upcCollLRTableId; + Preslice perUpcColMft = aod::lrcorrtrktable::upcCollLRTableId; + Preslice perUpcColMftbest = aod::lrcorrtrktable::upcCollLRTableId; + Preslice perUpcColFt0a = aod::lrcorrtrktable::upcCollLRTableId; + Preslice perUpcColFt0c = aod::lrcorrtrktable::upcCollLRTableId; + Preslice perUpcColV0 = aod::lrcorrtrktable::upcCollLRTableId; + void init(InitContext const&) { std::vector corrAxis = {{axisVtxZ, "z-vtx (cm)"}, @@ -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}); @@ -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()); } @@ -178,12 +203,32 @@ struct LongrangecorrDerived { histos.fill(HIST("Assoc_phi"), track.phi()); } + template + 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 using HasTpcTrack = decltype(std::declval().trackType()); template using HasV0Track = decltype(std::declval().v0Type()); template using HasInvMass = decltype(std::declval().invMass()); + template + using HasUpc = decltype(std::declval().gapSide()); template void fillCorrHist(TTarget target, TTriggers const& triggers, TAssocs const& assocs, bool mixing, float vz, float multiplicity, float eventWeight) @@ -233,20 +278,31 @@ struct LongrangecorrDerived { } // process same template - 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::value) { + if (!isUpcEventSelected(col)) { + return -1.0f; + } + } else { + (void)this; + } + return col.multiplicity(); }; using MixedBinning = FlexibleBinningPolicy, aod::lrcorrcolltable::Zvtx, decltype(getMultiplicity)>; MixedBinning binningOnVtxAndMult{{getMultiplicity}, {axisVtxZME, axisMultME}, true}; auto tracksTuple = std::make_tuple(std::forward(tracks)...); using TupleAtrack = std::tuple_element<0, decltype(tracksTuple)>::type; using TupleBtrack = std::tuple_element - 1, decltype(tracksTuple)>::type; - Pair pairs{binningOnVtxAndMult, cfgNmixedevent, -1, col, tracksTuple, &cache}; + Pair 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::value) { + if (!isUpcEventSelected(col1) || !isUpcEventSelected(col2)) { + continue; + } + } float eventweight = 1.0f / it.currentWindowNeighbours(); fillCorrHist(mixed, tracks1, tracks2, true, col1.zvtx(), col1.multiplicity(), eventweight); } // pair loop @@ -342,6 +398,123 @@ struct LongrangecorrDerived { processMixed(cols, tracks, mfts); } + void processUpcTpcft0aSE(UpcCollsTable::iterator const& col, TrksUpcTable const& tracks, Ft0aTrksUpcTable const& ft0as) + { + if (!isUpcEventSelected(col)) { + return; + } + processSame(col, tracks, ft0as); + } + + void processUpcTpcft0cSE(UpcCollsTable::iterator const& col, TrksUpcTable const& tracks, Ft0cTrksUpcTable const& ft0cs) + { + if (!isUpcEventSelected(col)) { + return; + } + processSame(col, tracks, ft0cs); + } + + void processUpcTpcmftSE(UpcCollsTable::iterator const& col, TrksUpcTable const& tracks, MftTrksUpcTable const& mfts) + { + if (!isUpcEventSelected(col)) { + return; + } + processSame(col, tracks, mfts); + } + + void processUpcMftft0aSE(UpcCollsTable::iterator const& col, MftTrksUpcTable const& mfts, Ft0aTrksUpcTable const& ft0as) + { + if (!isUpcEventSelected(col)) { + return; + } + processSame(col, mfts, ft0as); + } + + void processUpcV0ft0aSE(UpcCollsTable::iterator const& col, V0TrksUpcTable const& tracks, Ft0aTrksUpcTable const& ft0as) + { + if (!isUpcEventSelected(col)) { + return; + } + processSame(col, tracks, ft0as); + } + + void processUpcV0mftSE(UpcCollsTable::iterator const& col, V0TrksUpcTable const& tracks, MftTrksUpcTable const& mfts) + { + if (!isUpcEventSelected(col)) { + return; + } + processSame(col, tracks, mfts); + } + + void processUpcTpcmftbestSE(UpcCollsTable::iterator const& col, TrksUpcTable const& tracks, MftbestTrksUpcTable const& mfts) + { + if (!isUpcEventSelected(col)) { + return; + } + processSame(col, tracks, mfts); + } + + void processUpcMftbestft0aSE(UpcCollsTable::iterator const& col, MftbestTrksUpcTable const& mfts, Ft0aTrksUpcTable const& ft0as) + { + if (!isUpcEventSelected(col)) { + return; + } + processSame(col, mfts, ft0as); + } + + void processUpcV0mftbestSE(UpcCollsTable::iterator const& col, V0TrksUpcTable const& tracks, MftbestTrksUpcTable const& mfts) + { + if (!isUpcEventSelected(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); @@ -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)