Skip to content

Commit 4947005

Browse files
committed
Change ev and trk selection flags
1 parent 1a20c5a commit 4947005

1 file changed

Lines changed: 35 additions & 20 deletions

File tree

PWGMM/UE/Tasks/uecharged.cxx

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

1817
#include "PWGLF/Utils/inelGt.h"
1918

2019
#include "Common/CCDB/EventSelectionParams.h"
2120
#include "Common/Core/TrackSelection.h"
2221
#include "Common/Core/TrackSelectionDefaults.h"
2322
#include "Common/DataModel/EventSelection.h"
23+
#include "Common/DataModel/McCollisionExtra.h"
2424
#include "Common/DataModel/Multiplicity.h"
2525
#include "Common/DataModel/TrackSelectionTables.h"
2626

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

6768
// Track selection configurables
@@ -72,16 +73,16 @@ struct ueCharged {
7273
Configurable<float> minPt{"trkcfg_minPt", 0.1f, "Set minimum pT of tracks"};
7374
Configurable<float> maxPt{"trkcfg_maxPt", 1e10f, "Set maximum pT of tracks"};
7475
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"};
7776
Configurable<bool> requireGoldenChi2{"trkcfg_requireGoldenChi2", true, "Additional cut on the GoldenChi2"};
7877
Configurable<float> maxChi2PerClusterTPC{"trkcfg_maxChi2PerClusterTPC", 4.f, "Additional cut on the maximum value of the chi2 per cluster in the TPC"};
7978
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"};
8179
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"};
8380
Configurable<float> maxDcaXYFactor{"trkcfg_maxDcaXYFactor", 1.f, "Multiplicative factor on the maximum value of the DCA xy"};
8481
Configurable<float> maxDcaZ{"trkcfg_maxDcaZ", 0.1f, "Additional cut on the maximum value of the DCA z"};
82+
// Configurable<bool> requireITSRefit{"trkcfg_requireITSRefit", true, "Additional cut on the ITS requirement"};
83+
// Configurable<bool> requireTPCRefit{"trkcfg_requireTPCRefit", true, "Additional cut on the TPC requirement"};
84+
// 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"};
85+
// Configurable<int> minITSnClusters{"trkcfg_minITSnClusters", 5, "minimum number of found ITS clusters"};
8586

8687
Service<o2::framework::O2DatabasePDG> pdg;
8788

@@ -94,6 +95,7 @@ struct ueCharged {
9495
using TrackMCTrueTable = aod::McParticles;
9596

9697
// reconstructed collisions associated to MC collisions (small groups keyed by mcCollisionId)
98+
using ColMCTrueTableWithExtra = soa::Join<aod::McCollisions, aod::McCollsExtra>;
9799
using ColMCRecTable = soa::SmallGroups<soa::Join<aod::McCollisionLabels, aod::Collisions, aod::EvSels, aod::Mults, aod::PVMults>>;
98100
using TrackMCRecTable = soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksDCA, aod::TrackSelection, aod::McTrackLabels>;
99101
using FilTrackMCRecTable = soa::Filtered<TrackMCRecTable>;
@@ -138,17 +140,17 @@ struct ueCharged {
138140
myTrkSel = getGlobalTrackSelectionRun3ITSMatch(setITSreq.value);
139141
myTrkSel.SetPtRange(minPt.value, maxPt.value);
140142
myTrkSel.SetEtaRange(-requireEta.value, requireEta.value);
141-
myTrkSel.SetRequireITSRefit(requireITSRefit.value);
142-
myTrkSel.SetRequireTPCRefit(requireTPCRefit.value);
143143
myTrkSel.SetRequireGoldenChi2(requireGoldenChi2.value);
144144
myTrkSel.SetMaxChi2PerClusterTPC(maxChi2PerClusterTPC.value);
145145
myTrkSel.SetMaxChi2PerClusterITS(maxChi2PerClusterITS.value);
146-
// myTrkSel.SetMinNClustersITS(minITSnClusters.value);
147146
myTrkSel.SetMinNCrossedRowsTPC(minNCrossedRowsTPC.value);
148-
myTrkSel.SetMinNCrossedRowsOverFindableClustersTPC(minNCrossedRowsOverFindableClustersTPC.value);
149-
// myTrkSel.SetMaxDcaXYPtDep([](float pt) { return 0.0105f + 0.0350f / pow(pt, 1.1f); });
150147
myTrkSel.SetMaxDcaXYPtDep([](float /*pt*/) { return 10000.f; });
151148
myTrkSel.SetMaxDcaZ(maxDcaZ.value);
149+
// myTrkSel.SetRequireITSRefit(requireITSRefit.value);
150+
// myTrkSel.SetRequireTPCRefit(requireTPCRefit.value);
151+
// myTrkSel.SetMinNClustersITS(minITSnClusters.value);
152+
// myTrkSel.SetMinNCrossedRowsOverFindableClustersTPC(minNCrossedRowsOverFindableClustersTPC.value);
153+
// myTrkSel.SetMaxDcaXYPtDep([](float pt) { return 0.0105f + 0.0350f / pow(pt, 1.1f); });
152154
myTrkSel.print();
153155
}
154156

@@ -214,7 +216,7 @@ struct ueCharged {
214216
ue.add("vtxZEta", ";#eta;vtxZ", HistType::kTH2F, {{50, -2.5, 2.5, " "}, {60, -30, 30, " "}});
215217
ue.add("phiEta", ";#eta;#varphi", HistType::kTH2F, {{50, -2.5, 2.5}, {200, 0., 2 * o2::constants::math::PI, " "}});
216218
ue.add("hvtxZ", "vtxZ", HistType::kTH1F, {{40, -20.0, 20.0, " "}});
217-
ue.add("hCounter", "Counter; sel; Nev", HistType::kTH1D, {{7, 0, 7, " "}});
219+
ue.add("hCounter", "Counter; sel; Nev", HistType::kTH1D, {{8, 0, 8, " "}});
218220
ue.add("hPtLeadingRecPS", "rec pTleading after physics selection", HistType::kTH1D, {ptAxist});
219221
ue.add("hPtLeadingMeasured", "measured pTleading after physics selection", HistType::kTH1D, {ptAxist});
220222
ue.add("hPtLeadingVsTracks", "", HistType::kTProfile, {{ptAxist}});
@@ -226,6 +228,7 @@ struct ueCharged {
226228
h->GetXaxis()->SetBinLabel(4, "NoSameBunchPileup");
227229
h->GetXaxis()->SetBinLabel(5, "IsGoodZvtxFT0vsPV");
228230
h->GetXaxis()->SetBinLabel(6, "posZ passed");
231+
h->GetXaxis()->SetBinLabel(7, "GoodITSLayersAll");
229232

230233
for (int i = 0; i < 3; ++i) {
231234
ue.add(pNumDenMeasuredPS[i].data(), "Number Density; ; #LT #it{N}_{trk} #GT", HistType::kTProfile, {ptAxist});
@@ -422,8 +425,14 @@ struct ueCharged {
422425
if ((std::abs(collision.posZ()) > CollPosZ)) {
423426
return false;
424427
}
425-
426428
ue.fill(HIST("hCounter"), 5);
429+
430+
if (GoodITS && !collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) {
431+
return false;
432+
}
433+
434+
ue.fill(HIST("hCounter"), 6);
435+
427436
return true;
428437
}
429438

@@ -470,6 +479,12 @@ struct ueCharged {
470479
}
471480

472481
ue.fill(HIST("hCounter"), 5);
482+
483+
if (GoodITS && !collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) {
484+
return false;
485+
}
486+
487+
ue.fill(HIST("hCounter"), 6);
473488
return true;
474489
}
475490

@@ -652,7 +667,7 @@ struct ueCharged {
652667
}
653668
PROCESS_SWITCH(ueCharged, processData, "Process data", false);
654669

655-
void processMC(ColMCTrueTable::iterator const& mcCollision,
670+
void processMC(ColMCTrueTableWithExtra::iterator const& mcCollision,
656671
ColMCRecTable const& RecCols,
657672
TrackMCTrueTable const& GenParticles,
658673
TrackMCRecTable const& RecTracks,
@@ -672,20 +687,20 @@ struct ueCharged {
672687
ue.fill(HIST("hStat"), mcCollision.size());
673688
const auto vtxZ = mcCollision.posZ();
674689

675-
// pick best reconstructed collision associated to this mcCollision (max ntracks = recRow.size())
690+
// pick best reconstructed collision associated to this mcCollision using bestCollisionIndex
676691
bool foundRec = false;
677692
auto chosenRec = *RecCols.begin();
678693
int64_t chosenRecGlobalIndex = -1;
679-
int maxTracks = -1;
680694

681-
if (RecCols.size() != 0) {
695+
int bestCollIdx = mcCollision.bestCollisionIndex();
696+
if (bestCollIdx >= 0) {
697+
// Find the reconstructed collision with this index
682698
for (const auto& recRow : RecCols) {
683-
int ntracks = recRow.size();
684-
if (ntracks > maxTracks) {
699+
if (recRow.globalIndex() == bestCollIdx) {
685700
chosenRec = recRow;
686-
chosenRecGlobalIndex = recRow.globalIndex();
687-
maxTracks = ntracks;
701+
chosenRecGlobalIndex = bestCollIdx;
688702
foundRec = true;
703+
break;
689704
}
690705
}
691706
}

0 commit comments

Comments
 (0)