From d813fb85c5b0a3549d0be3f57e52a16ea22aac79 Mon Sep 17 00:00:00 2001 From: jmunozme Date: Mon, 22 Jun 2026 21:59:49 -0600 Subject: [PATCH] Change ev and trk selection flags --- PWGMM/UE/Tasks/uecharged.cxx | 66 +++++++++++++++++++++++------------- 1 file changed, 42 insertions(+), 24 deletions(-) diff --git a/PWGMM/UE/Tasks/uecharged.cxx b/PWGMM/UE/Tasks/uecharged.cxx index 8fef7ee4a8b..e8d1f641b7b 100644 --- a/PWGMM/UE/Tasks/uecharged.cxx +++ b/PWGMM/UE/Tasks/uecharged.cxx @@ -13,7 +13,7 @@ /// \file uecharged.cxx /// \brief Underlying event analysis task /// \since November 2021 -/// \last update: April 2026 +/// \last update: June 2026 #include "PWGLF/Utils/inelGt.h" @@ -21,6 +21,7 @@ #include "Common/Core/TrackSelection.h" #include "Common/Core/TrackSelectionDefaults.h" #include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/McCollisionExtra.h" #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/TrackSelectionTables.h" @@ -62,6 +63,7 @@ struct ueCharged { Configurable removeITSROFBorder{"event_removeITSROFBorder", false, "Remove ITS Read-Out Frame border and only apply kIsTriggerTVX & kNoTimeFrameBorder (recommended for MC)"}; Configurable cfgINELCut{"event_cfgINELCut", 0, "INEL event selection: 0 no sel, 1 INEL>0, 2 INEL>1"}; Configurable CollPosZ{"event_CollPosZ", 10.f, "Cut on the z component of the vertex position"}; + Configurable GoodITS{"event_GoodITS", true, "Numbers of inactive chips on all ITS layers are below maximum allowed values"}; Configurable analyzeEvandTracksel{"analyzeEvandTracksel", true, "Analyze the event and track selection"}; // Track selection configurables @@ -72,16 +74,16 @@ struct ueCharged { Configurable minPt{"trkcfg_minPt", 0.1f, "Set minimum pT of tracks"}; Configurable maxPt{"trkcfg_maxPt", 1e10f, "Set maximum pT of tracks"}; Configurable requireEta{"trkcfg_requireEta", 0.8f, "Set eta range of tracks"}; - Configurable requireITSRefit{"trkcfg_requireITSRefit", true, "Additional cut on the ITS requirement"}; - Configurable requireTPCRefit{"trkcfg_requireTPCRefit", true, "Additional cut on the TPC requirement"}; Configurable requireGoldenChi2{"trkcfg_requireGoldenChi2", true, "Additional cut on the GoldenChi2"}; Configurable maxChi2PerClusterTPC{"trkcfg_maxChi2PerClusterTPC", 4.f, "Additional cut on the maximum value of the chi2 per cluster in the TPC"}; Configurable maxChi2PerClusterITS{"trkcfg_maxChi2PerClusterITS", 36.f, "Additional cut on the maximum value of the chi2 per cluster in the ITS"}; - // Configurable minITSnClusters{"trkcfg_minITSnClusters", 5, "minimum number of found ITS clusters"}; Configurable minNCrossedRowsTPC{"trkcfg_minNCrossedRowsTPC", 70.f, "Additional cut on the minimum number of crossed rows in the TPC"}; - Configurable minNCrossedRowsOverFindableClustersTPC{"trkcfg_minNCrossedRowsOverFindableClustersTPC", 0.8f, "Additional cut on the minimum value of the ratio between crossed rows and findable clusters in the TPC"}; Configurable maxDcaXYFactor{"trkcfg_maxDcaXYFactor", 1.f, "Multiplicative factor on the maximum value of the DCA xy"}; Configurable maxDcaZ{"trkcfg_maxDcaZ", 0.1f, "Additional cut on the maximum value of the DCA z"}; + // Configurable requireITSRefit{"trkcfg_requireITSRefit", true, "Additional cut on the ITS requirement"}; + // Configurable requireTPCRefit{"trkcfg_requireTPCRefit", true, "Additional cut on the TPC requirement"}; + // Configurable minNCrossedRowsOverFindableClustersTPC{"trkcfg_minNCrossedRowsOverFindableClustersTPC", 0.8f, "Additional cut on the minimum value of the ratio between crossed rows and findable clusters in the TPC"}; + // Configurable minITSnClusters{"trkcfg_minITSnClusters", 5, "minimum number of found ITS clusters"}; Service pdg; @@ -94,6 +96,7 @@ struct ueCharged { using TrackMCTrueTable = aod::McParticles; // reconstructed collisions associated to MC collisions (small groups keyed by mcCollisionId) + using ColMCTrueTableWithExtra = soa::Join; using ColMCRecTable = soa::SmallGroups>; using TrackMCRecTable = soa::Join; using FilTrackMCRecTable = soa::Filtered; @@ -138,17 +141,17 @@ struct ueCharged { myTrkSel = getGlobalTrackSelectionRun3ITSMatch(setITSreq.value); myTrkSel.SetPtRange(minPt.value, maxPt.value); myTrkSel.SetEtaRange(-requireEta.value, requireEta.value); - myTrkSel.SetRequireITSRefit(requireITSRefit.value); - myTrkSel.SetRequireTPCRefit(requireTPCRefit.value); myTrkSel.SetRequireGoldenChi2(requireGoldenChi2.value); myTrkSel.SetMaxChi2PerClusterTPC(maxChi2PerClusterTPC.value); myTrkSel.SetMaxChi2PerClusterITS(maxChi2PerClusterITS.value); - // myTrkSel.SetMinNClustersITS(minITSnClusters.value); myTrkSel.SetMinNCrossedRowsTPC(minNCrossedRowsTPC.value); - myTrkSel.SetMinNCrossedRowsOverFindableClustersTPC(minNCrossedRowsOverFindableClustersTPC.value); - // myTrkSel.SetMaxDcaXYPtDep([](float pt) { return 0.0105f + 0.0350f / pow(pt, 1.1f); }); myTrkSel.SetMaxDcaXYPtDep([](float /*pt*/) { return 10000.f; }); myTrkSel.SetMaxDcaZ(maxDcaZ.value); + // myTrkSel.SetRequireITSRefit(requireITSRefit.value); + // myTrkSel.SetRequireTPCRefit(requireTPCRefit.value); + // myTrkSel.SetMinNClustersITS(minITSnClusters.value); + // myTrkSel.SetMinNCrossedRowsOverFindableClustersTPC(minNCrossedRowsOverFindableClustersTPC.value); + // myTrkSel.SetMaxDcaXYPtDep([](float pt) { return 0.0105f + 0.0350f / pow(pt, 1.1f); }); myTrkSel.print(); } @@ -214,7 +217,7 @@ struct ueCharged { ue.add("vtxZEta", ";#eta;vtxZ", HistType::kTH2F, {{50, -2.5, 2.5, " "}, {60, -30, 30, " "}}); ue.add("phiEta", ";#eta;#varphi", HistType::kTH2F, {{50, -2.5, 2.5}, {200, 0., 2 * o2::constants::math::PI, " "}}); ue.add("hvtxZ", "vtxZ", HistType::kTH1F, {{40, -20.0, 20.0, " "}}); - ue.add("hCounter", "Counter; sel; Nev", HistType::kTH1D, {{7, 0, 7, " "}}); + ue.add("hCounter", "Counter; sel; Nev", HistType::kTH1D, {{8, 0, 8, " "}}); ue.add("hPtLeadingRecPS", "rec pTleading after physics selection", HistType::kTH1D, {ptAxist}); ue.add("hPtLeadingMeasured", "measured pTleading after physics selection", HistType::kTH1D, {ptAxist}); ue.add("hPtLeadingVsTracks", "", HistType::kTProfile, {{ptAxist}}); @@ -226,6 +229,7 @@ struct ueCharged { h->GetXaxis()->SetBinLabel(4, "NoSameBunchPileup"); h->GetXaxis()->SetBinLabel(5, "IsGoodZvtxFT0vsPV"); h->GetXaxis()->SetBinLabel(6, "posZ passed"); + h->GetXaxis()->SetBinLabel(7, "GoodITSLayersAll"); for (int i = 0; i < 3; ++i) { ue.add(pNumDenMeasuredPS[i].data(), "Number Density; ; #LT #it{N}_{trk} #GT", HistType::kTProfile, {ptAxist}); @@ -422,8 +426,14 @@ struct ueCharged { if ((std::abs(collision.posZ()) > CollPosZ)) { return false; } - ue.fill(HIST("hCounter"), 5); + + if (GoodITS && !collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + return false; + } + + ue.fill(HIST("hCounter"), 6); + return true; } @@ -470,6 +480,12 @@ struct ueCharged { } ue.fill(HIST("hCounter"), 5); + + if (GoodITS && !collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + return false; + } + + ue.fill(HIST("hCounter"), 6); return true; } @@ -652,7 +668,7 @@ struct ueCharged { } PROCESS_SWITCH(ueCharged, processData, "Process data", false); - void processMC(ColMCTrueTable::iterator const& mcCollision, + void processMC(ColMCTrueTableWithExtra::iterator const& mcCollision, ColMCRecTable const& RecCols, TrackMCTrueTable const& GenParticles, TrackMCRecTable const& RecTracks, @@ -672,20 +688,22 @@ struct ueCharged { ue.fill(HIST("hStat"), mcCollision.size()); const auto vtxZ = mcCollision.posZ(); - // pick best reconstructed collision associated to this mcCollision (max ntracks = recRow.size()) + // pick best reconstructed collision associated to this mcCollision using bestCollisionIndex bool foundRec = false; auto chosenRec = *RecCols.begin(); int64_t chosenRecGlobalIndex = -1; - int maxTracks = -1; - - if (RecCols.size() != 0) { - for (const auto& recRow : RecCols) { - int ntracks = recRow.size(); - if (ntracks > maxTracks) { - chosenRec = recRow; - chosenRecGlobalIndex = recRow.globalIndex(); - maxTracks = ntracks; - foundRec = true; + + if (mcCollision.has_mcCollsExtra()) { + int bestCollIdx = mcCollision.bestCollisionIndex(); + if (bestCollIdx >= 0) { + // Find the reconstructed collision with this index + for (const auto& recRow : RecCols) { + if (recRow.globalIndex() == bestCollIdx) { + chosenRec = recRow; + chosenRecGlobalIndex = bestCollIdx; + foundRec = true; + break; + } } } }