Skip to content

Commit d813fb8

Browse files
committed
Change ev and trk selection flags
1 parent 74d1947 commit d813fb8

1 file changed

Lines changed: 42 additions & 24 deletions

File tree

PWGMM/UE/Tasks/uecharged.cxx

Lines changed: 42 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@
1313
/// \file uecharged.cxx
1414
/// \brief Underlying event analysis task
1515
/// \since November 2021
16-
/// \last update: April 2026
16+
/// \last update: June 2026
1717

1818
#include "PWGLF/Utils/inelGt.h"
1919

2020
#include "Common/CCDB/EventSelectionParams.h"
2121
#include "Common/Core/TrackSelection.h"
2222
#include "Common/Core/TrackSelectionDefaults.h"
2323
#include "Common/DataModel/EventSelection.h"
24+
#include "Common/DataModel/McCollisionExtra.h"
2425
#include "Common/DataModel/Multiplicity.h"
2526
#include "Common/DataModel/TrackSelectionTables.h"
2627

@@ -62,6 +63,7 @@ struct ueCharged {
6263
Configurable<bool> removeITSROFBorder{"event_removeITSROFBorder", false, "Remove ITS Read-Out Frame border and only apply kIsTriggerTVX & kNoTimeFrameBorder (recommended for MC)"};
6364
Configurable<int> cfgINELCut{"event_cfgINELCut", 0, "INEL event selection: 0 no sel, 1 INEL>0, 2 INEL>1"};
6465
Configurable<float> CollPosZ{"event_CollPosZ", 10.f, "Cut on the z component of the vertex position"};
66+
Configurable<bool> GoodITS{"event_GoodITS", true, "Numbers of inactive chips on all ITS layers are below maximum allowed values"};
6567
Configurable<bool> analyzeEvandTracksel{"analyzeEvandTracksel", true, "Analyze the event and track selection"};
6668

6769
// Track selection configurables
@@ -72,16 +74,16 @@ struct ueCharged {
7274
Configurable<float> minPt{"trkcfg_minPt", 0.1f, "Set minimum pT of tracks"};
7375
Configurable<float> maxPt{"trkcfg_maxPt", 1e10f, "Set maximum pT of tracks"};
7476
Configurable<float> requireEta{"trkcfg_requireEta", 0.8f, "Set eta range of tracks"};
75-
Configurable<bool> requireITSRefit{"trkcfg_requireITSRefit", true, "Additional cut on the ITS requirement"};
76-
Configurable<bool> requireTPCRefit{"trkcfg_requireTPCRefit", true, "Additional cut on the TPC requirement"};
7777
Configurable<bool> requireGoldenChi2{"trkcfg_requireGoldenChi2", true, "Additional cut on the GoldenChi2"};
7878
Configurable<float> maxChi2PerClusterTPC{"trkcfg_maxChi2PerClusterTPC", 4.f, "Additional cut on the maximum value of the chi2 per cluster in the TPC"};
7979
Configurable<float> maxChi2PerClusterITS{"trkcfg_maxChi2PerClusterITS", 36.f, "Additional cut on the maximum value of the chi2 per cluster in the ITS"};
80-
// Configurable<int> minITSnClusters{"trkcfg_minITSnClusters", 5, "minimum number of found ITS clusters"};
8180
Configurable<float> minNCrossedRowsTPC{"trkcfg_minNCrossedRowsTPC", 70.f, "Additional cut on the minimum number of crossed rows in the TPC"};
82-
Configurable<float> minNCrossedRowsOverFindableClustersTPC{"trkcfg_minNCrossedRowsOverFindableClustersTPC", 0.8f, "Additional cut on the minimum value of the ratio between crossed rows and findable clusters in the TPC"};
8381
Configurable<float> maxDcaXYFactor{"trkcfg_maxDcaXYFactor", 1.f, "Multiplicative factor on the maximum value of the DCA xy"};
8482
Configurable<float> maxDcaZ{"trkcfg_maxDcaZ", 0.1f, "Additional cut on the maximum value of the DCA z"};
83+
// Configurable<bool> requireITSRefit{"trkcfg_requireITSRefit", true, "Additional cut on the ITS requirement"};
84+
// Configurable<bool> requireTPCRefit{"trkcfg_requireTPCRefit", true, "Additional cut on the TPC requirement"};
85+
// Configurable<float> minNCrossedRowsOverFindableClustersTPC{"trkcfg_minNCrossedRowsOverFindableClustersTPC", 0.8f, "Additional cut on the minimum value of the ratio between crossed rows and findable clusters in the TPC"};
86+
// Configurable<int> minITSnClusters{"trkcfg_minITSnClusters", 5, "minimum number of found ITS clusters"};
8587

8688
Service<o2::framework::O2DatabasePDG> pdg;
8789

@@ -94,6 +96,7 @@ struct ueCharged {
9496
using TrackMCTrueTable = aod::McParticles;
9597

9698
// reconstructed collisions associated to MC collisions (small groups keyed by mcCollisionId)
99+
using ColMCTrueTableWithExtra = soa::Join<aod::McCollisions, aod::McCollsExtra>;
97100
using ColMCRecTable = soa::SmallGroups<soa::Join<aod::McCollisionLabels, aod::Collisions, aod::EvSels, aod::Mults, aod::PVMults>>;
98101
using TrackMCRecTable = soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksDCA, aod::TrackSelection, aod::McTrackLabels>;
99102
using FilTrackMCRecTable = soa::Filtered<TrackMCRecTable>;
@@ -138,17 +141,17 @@ struct ueCharged {
138141
myTrkSel = getGlobalTrackSelectionRun3ITSMatch(setITSreq.value);
139142
myTrkSel.SetPtRange(minPt.value, maxPt.value);
140143
myTrkSel.SetEtaRange(-requireEta.value, requireEta.value);
141-
myTrkSel.SetRequireITSRefit(requireITSRefit.value);
142-
myTrkSel.SetRequireTPCRefit(requireTPCRefit.value);
143144
myTrkSel.SetRequireGoldenChi2(requireGoldenChi2.value);
144145
myTrkSel.SetMaxChi2PerClusterTPC(maxChi2PerClusterTPC.value);
145146
myTrkSel.SetMaxChi2PerClusterITS(maxChi2PerClusterITS.value);
146-
// myTrkSel.SetMinNClustersITS(minITSnClusters.value);
147147
myTrkSel.SetMinNCrossedRowsTPC(minNCrossedRowsTPC.value);
148-
myTrkSel.SetMinNCrossedRowsOverFindableClustersTPC(minNCrossedRowsOverFindableClustersTPC.value);
149-
// myTrkSel.SetMaxDcaXYPtDep([](float pt) { return 0.0105f + 0.0350f / pow(pt, 1.1f); });
150148
myTrkSel.SetMaxDcaXYPtDep([](float /*pt*/) { return 10000.f; });
151149
myTrkSel.SetMaxDcaZ(maxDcaZ.value);
150+
// myTrkSel.SetRequireITSRefit(requireITSRefit.value);
151+
// myTrkSel.SetRequireTPCRefit(requireTPCRefit.value);
152+
// myTrkSel.SetMinNClustersITS(minITSnClusters.value);
153+
// myTrkSel.SetMinNCrossedRowsOverFindableClustersTPC(minNCrossedRowsOverFindableClustersTPC.value);
154+
// myTrkSel.SetMaxDcaXYPtDep([](float pt) { return 0.0105f + 0.0350f / pow(pt, 1.1f); });
152155
myTrkSel.print();
153156
}
154157

@@ -214,7 +217,7 @@ struct ueCharged {
214217
ue.add("vtxZEta", ";#eta;vtxZ", HistType::kTH2F, {{50, -2.5, 2.5, " "}, {60, -30, 30, " "}});
215218
ue.add("phiEta", ";#eta;#varphi", HistType::kTH2F, {{50, -2.5, 2.5}, {200, 0., 2 * o2::constants::math::PI, " "}});
216219
ue.add("hvtxZ", "vtxZ", HistType::kTH1F, {{40, -20.0, 20.0, " "}});
217-
ue.add("hCounter", "Counter; sel; Nev", HistType::kTH1D, {{7, 0, 7, " "}});
220+
ue.add("hCounter", "Counter; sel; Nev", HistType::kTH1D, {{8, 0, 8, " "}});
218221
ue.add("hPtLeadingRecPS", "rec pTleading after physics selection", HistType::kTH1D, {ptAxist});
219222
ue.add("hPtLeadingMeasured", "measured pTleading after physics selection", HistType::kTH1D, {ptAxist});
220223
ue.add("hPtLeadingVsTracks", "", HistType::kTProfile, {{ptAxist}});
@@ -226,6 +229,7 @@ struct ueCharged {
226229
h->GetXaxis()->SetBinLabel(4, "NoSameBunchPileup");
227230
h->GetXaxis()->SetBinLabel(5, "IsGoodZvtxFT0vsPV");
228231
h->GetXaxis()->SetBinLabel(6, "posZ passed");
232+
h->GetXaxis()->SetBinLabel(7, "GoodITSLayersAll");
229233

230234
for (int i = 0; i < 3; ++i) {
231235
ue.add(pNumDenMeasuredPS[i].data(), "Number Density; ; #LT #it{N}_{trk} #GT", HistType::kTProfile, {ptAxist});
@@ -422,8 +426,14 @@ struct ueCharged {
422426
if ((std::abs(collision.posZ()) > CollPosZ)) {
423427
return false;
424428
}
425-
426429
ue.fill(HIST("hCounter"), 5);
430+
431+
if (GoodITS && !collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) {
432+
return false;
433+
}
434+
435+
ue.fill(HIST("hCounter"), 6);
436+
427437
return true;
428438
}
429439

@@ -470,6 +480,12 @@ struct ueCharged {
470480
}
471481

472482
ue.fill(HIST("hCounter"), 5);
483+
484+
if (GoodITS && !collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) {
485+
return false;
486+
}
487+
488+
ue.fill(HIST("hCounter"), 6);
473489
return true;
474490
}
475491

@@ -652,7 +668,7 @@ struct ueCharged {
652668
}
653669
PROCESS_SWITCH(ueCharged, processData, "Process data", false);
654670

655-
void processMC(ColMCTrueTable::iterator const& mcCollision,
671+
void processMC(ColMCTrueTableWithExtra::iterator const& mcCollision,
656672
ColMCRecTable const& RecCols,
657673
TrackMCTrueTable const& GenParticles,
658674
TrackMCRecTable const& RecTracks,
@@ -672,20 +688,22 @@ struct ueCharged {
672688
ue.fill(HIST("hStat"), mcCollision.size());
673689
const auto vtxZ = mcCollision.posZ();
674690

675-
// pick best reconstructed collision associated to this mcCollision (max ntracks = recRow.size())
691+
// pick best reconstructed collision associated to this mcCollision using bestCollisionIndex
676692
bool foundRec = false;
677693
auto chosenRec = *RecCols.begin();
678694
int64_t chosenRecGlobalIndex = -1;
679-
int maxTracks = -1;
680-
681-
if (RecCols.size() != 0) {
682-
for (const auto& recRow : RecCols) {
683-
int ntracks = recRow.size();
684-
if (ntracks > maxTracks) {
685-
chosenRec = recRow;
686-
chosenRecGlobalIndex = recRow.globalIndex();
687-
maxTracks = ntracks;
688-
foundRec = true;
695+
696+
if (mcCollision.has_mcCollsExtra()) {
697+
int bestCollIdx = mcCollision.bestCollisionIndex();
698+
if (bestCollIdx >= 0) {
699+
// Find the reconstructed collision with this index
700+
for (const auto& recRow : RecCols) {
701+
if (recRow.globalIndex() == bestCollIdx) {
702+
chosenRec = recRow;
703+
chosenRecGlobalIndex = bestCollIdx;
704+
foundRec = true;
705+
break;
706+
}
689707
}
690708
}
691709
}

0 commit comments

Comments
 (0)