Skip to content

Commit 241e0fa

Browse files
authored
[PWGLF] Added explicit track selection for reassociation (#13243)
1 parent 716ee17 commit 241e0fa

File tree

1 file changed

+61
-30
lines changed

1 file changed

+61
-30
lines changed

PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx

Lines changed: 61 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ using namespace o2::aod::rctsel;
6060

6161
auto static constexpr kMinCharge = 3.f;
6262
auto static constexpr kNumDecay = 4;
63+
auto static constexpr kIntZero = 0;
64+
auto static constexpr kZero = 0.f;
65+
auto static constexpr kIntOne = 1;
6366

6467
enum TrkSel {
6568
trkSelAll,
@@ -72,11 +75,14 @@ enum TrkSel {
7275
nTrkSel
7376
};
7477

75-
enum TrkAmbSel {
76-
trkSelAmbiguousAll,
77-
trkSelWoAmbiguous,
78-
trkSelNumReassoc,
79-
nTrkAmbSel
78+
enum TrkBestSel {
79+
trkBestSelAll,
80+
trkBestSelCollID,
81+
trkBestSelDCAxyCut,
82+
trkBestSelDCAzCut,
83+
trkBestSelWoAmbiguous,
84+
trkBestSelNumReassoc,
85+
nTrkBestSel
8086
};
8187

8288
struct DndetaMFTPbPb {
@@ -288,10 +294,13 @@ struct DndetaMFTPbPb {
288294
hev->GetXaxis()->SetBinLabel(13, "Above max occup.");
289295
hev->GetXaxis()->SetBinLabel(14, "RCT Flag Checker");
290296

291-
registry.add("Tracks/hAmbTrkSel", "Number of ambiguous tracks; Cut; #Tracks Passed Cut", {HistType::kTH1F, {{nTrkAmbSel, -0.5, +nTrkAmbSel - 0.5}}});
292-
registry.get<TH1>(HIST("Tracks/hAmbTrkSel"))->GetXaxis()->SetBinLabel(trkSelAmbiguousAll + 1, "All");
293-
registry.get<TH1>(HIST("Tracks/hAmbTrkSel"))->GetXaxis()->SetBinLabel(trkSelWoAmbiguous + 1, "No Ambiguous");
294-
registry.get<TH1>(HIST("Tracks/hAmbTrkSel"))->GetXaxis()->SetBinLabel(trkSelNumReassoc + 1, "Reassociated");
297+
registry.add("Tracks/hBestTrkSel", "Number of best tracks; Cut; #Tracks Passed Cut", {HistType::kTH1F, {{nTrkBestSel, -0.5, +nTrkBestSel - 0.5}}});
298+
registry.get<TH1>(HIST("Tracks/hBestTrkSel"))->GetXaxis()->SetBinLabel(trkBestSelAll + 1, "All");
299+
registry.get<TH1>(HIST("Tracks/hBestTrkSel"))->GetXaxis()->SetBinLabel(trkBestSelCollID + 1, "Assigned (ID>=0)");
300+
registry.get<TH1>(HIST("Tracks/hBestTrkSel"))->GetXaxis()->SetBinLabel(trkBestSelDCAxyCut + 1, "DCA xy cut");
301+
registry.get<TH1>(HIST("Tracks/hBestTrkSel"))->GetXaxis()->SetBinLabel(trkBestSelDCAzCut + 1, "DCA z cut");
302+
registry.get<TH1>(HIST("Tracks/hBestTrkSel"))->GetXaxis()->SetBinLabel(trkBestSelWoAmbiguous + 1, "No Ambiguous");
303+
registry.get<TH1>(HIST("Tracks/hBestTrkSel"))->GetXaxis()->SetBinLabel(trkBestSelNumReassoc + 1, "Reassociated");
295304

296305
registry.add("Tracks/hTrkSel", "Number of tracks; Cut; #Tracks Passed Cut", {HistType::kTH1F, {{nTrkSel, -0.5, +nTrkSel - 0.5}}});
297306
registry.get<TH1>(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelAll + 1, "All");
@@ -842,7 +851,7 @@ struct DndetaMFTPbPb {
842851
/// Filters - tracks
843852
Filter filtTrkEta = (aod::fwdtrack::eta < trackCuts.maxEta) &&
844853
(aod::fwdtrack::eta > trackCuts.minEta);
845-
Filter filtATrackID = (aod::fwdtrack::bestCollisionId >= 0);
854+
Filter filtATrackID = (aod::fwdtrack::bestCollisionId >= kIntZero);
846855
Filter filtATrackDCAxy = (nabs(aod::fwdtrack::bestDCAXY) < trackCuts.maxDCAxy);
847856
Filter filtATrackDCAz = (nabs(aod::fwdtrack::bestDCAZ) < trackCuts.maxDCAz);
848857

@@ -852,6 +861,7 @@ struct DndetaMFTPbPb {
852861
/// Joined tables
853862
using FullBCs = soa::Join<aod::BCsWithTimestamps, aod::BcSels>;
854863
using CollBCs = soa::Join<aod::BCsWithTimestamps, aod::Run3MatchedToBCSparse>;
864+
// Collisions
855865
using Colls = soa::Join<aod::Collisions, aod::EvSels>;
856866
using Coll = Colls::iterator;
857867
using CollsCentFT0C = soa::Join<aod::Collisions, aod::CentFT0Cs, aod::EvSels>;
@@ -866,7 +876,7 @@ struct DndetaMFTPbPb {
866876
aod::CentFT0Cs, aod::EvSels>;
867877
using CollGenCent = CollsGenCentFT0C::iterator;
868878
using CollsCorr = soa::Join<aod::Collisions, aod::EvSels, aod::Mults, aod::PVMults, aod::CentFT0Cs, aod::CentFV0As, aod::CentFT0CVariant1s, aod::CentFT0Ms, aod::CentNGlobals, aod::CentMFTs>;
869-
879+
// Tracks
870880
using MFTTracksLabeled = soa::Join<aod::MFTTracks, aod::McMFTTrackLabels>;
871881
using MftTracksWColls = soa::Join<aod::MFTTracks, aod::MFTTrkCompColls>;
872882

@@ -876,10 +886,37 @@ struct DndetaMFTPbPb {
876886
using FiltBestTracks = soa::Filtered<aod::BestCollisionsFwd3d>;
877887
using FiltParticles = soa::Filtered<aod::McParticles>;
878888

879-
bool isHitAtDisk(uint16_t map, int ilayer)
889+
template <bool fillHis = true, typename B>
890+
bool isBestTrackSelected(const B& besttrack)
880891
{
881-
LOGF(debug, " map %i --> %i", map, (map >> (ilayer * 6)) & 0x3F);
882-
return (map >> (ilayer * 6)) & 0x3F;
892+
if (fillHis) {
893+
registry.fill(HIST("Tracks/hBestTrkSel"), trkBestSelAll);
894+
}
895+
if (besttrack.bestCollisionId() < kIntZero) {
896+
return false;
897+
}
898+
if constexpr (fillHis) {
899+
registry.fill(HIST("Tracks/hBestTrkSel"), trkBestSelCollID);
900+
}
901+
if (std::abs(besttrack.bestDCAXY()) >= trackCuts.maxDCAxy) {
902+
return false;
903+
}
904+
if constexpr (fillHis) {
905+
registry.fill(HIST("Tracks/hBestTrkSel"), trkBestSelDCAxyCut);
906+
}
907+
if (std::abs(besttrack.bestDCAZ()) >= trackCuts.maxDCAxy) {
908+
return false;
909+
}
910+
if constexpr (fillHis) {
911+
registry.fill(HIST("Tracks/hBestTrkSel"), trkBestSelDCAzCut);
912+
}
913+
if (trackCuts.excludeAmbiguous && besttrack.ambDegree() > kIntOne) {
914+
return false;
915+
}
916+
if (fillHis) {
917+
registry.fill(HIST("Tracks/hBestTrkSel"), trkBestSelWoAmbiguous);
918+
}
919+
return true;
883920
}
884921

885922
template <bool fillHis = true, typename T>
@@ -962,7 +999,7 @@ struct DndetaMFTPbPb {
962999
if (fillHis) {
9631000
float phi = track.phi();
9641001
o2::math_utils::bringTo02Pi(phi);
965-
if (phi < 0.f || TwoPI < phi) {
1002+
if (phi < kZero || TwoPI < phi) {
9661003
continue;
9671004
}
9681005
if constexpr (has_reco_cent<C>) {
@@ -993,15 +1030,9 @@ struct DndetaMFTPbPb {
9931030
ambiguousTrkIds.reserve(besttracks.size());
9941031
reassignedTrkIds.reserve(besttracks.size());
9951032
for (auto const& atrack : besttracks) {
996-
if (fillHis) {
997-
registry.fill(HIST("Tracks/hAmbTrkSel"), trkSelAmbiguousAll);
998-
}
999-
if (trackCuts.excludeAmbiguous && atrack.ambDegree() > 1) {
1033+
if (!isBestTrackSelected(atrack)) {
10001034
continue;
10011035
}
1002-
if (fillHis) {
1003-
registry.fill(HIST("Tracks/hAmbTrkSel"), trkSelWoAmbiguous);
1004-
}
10051036
auto itrack = atrack.template mfttrack_as<T>();
10061037
if (!isTrackSelected(itrack)) {
10071038
continue;
@@ -1011,7 +1042,7 @@ struct DndetaMFTPbPb {
10111042
if (fillHis) {
10121043
float phi = itrack.phi();
10131044
o2::math_utils::bringTo02Pi(phi);
1014-
if (phi < 0.f || TwoPI < phi) {
1045+
if (phi < kZero || TwoPI < phi) {
10151046
continue;
10161047
}
10171048
if constexpr (has_reco_cent<C>) {
@@ -1038,10 +1069,10 @@ struct DndetaMFTPbPb {
10381069
if (itrack.has_collision() && itrack.collisionId() != atrack.bestCollisionId()) {
10391070
reassignedTrkIds.emplace_back(atrack.mfttrackId());
10401071
if (fillHis) {
1041-
registry.fill(HIST("Tracks/hAmbTrkSel"), trkSelNumReassoc);
1072+
registry.fill(HIST("Tracks/hBestTrkSel"), trkBestSelNumReassoc);
10421073
float phi = itrack.phi();
10431074
o2::math_utils::bringTo02Pi(phi);
1044-
if (phi < 0.f || TwoPI < phi) {
1075+
if (phi < kZero || TwoPI < phi) {
10451076
continue;
10461077
}
10471078
if constexpr (has_reco_cent<C>) {
@@ -1069,7 +1100,7 @@ struct DndetaMFTPbPb {
10691100
if (fillHis) {
10701101
float phi = track.phi();
10711102
o2::math_utils::bringTo02Pi(phi);
1072-
if (phi < 0.f || TwoPI < phi) {
1103+
if (phi < kZero || TwoPI < phi) {
10731104
continue;
10741105
}
10751106
if constexpr (has_reco_cent<C>) {
@@ -1291,7 +1322,7 @@ struct DndetaMFTPbPb {
12911322

12921323
float phi = particle.phi();
12931324
o2::math_utils::bringTo02Pi(phi);
1294-
if (phi < 0.f || TwoPI < phi) {
1325+
if (phi < kZero || TwoPI < phi) {
12951326
continue;
12961327
}
12971328
if constexpr (isCent) {
@@ -1307,7 +1338,7 @@ struct DndetaMFTPbPb {
13071338
if (gtZeroColl) {
13081339
float phi = particle.phi();
13091340
o2::math_utils::bringTo02Pi(phi);
1310-
if (phi < 0.f || TwoPI < phi) {
1341+
if (phi < kZero || TwoPI < phi) {
13111342
continue;
13121343
}
13131344
if constexpr (isCent) {
@@ -2157,7 +2188,7 @@ struct DndetaMFTPbPb {
21572188

21582189
for (auto const& track : besttracks) {
21592190
ambiguousTrkIdsMC.emplace_back(track.mfttrackId());
2160-
if (trackCuts.excludeAmbiguous && track.ambDegree() > 1) {
2191+
if (!isBestTrackSelected<false>(track)) {
21612192
continue;
21622193
}
21632194
auto itrack = track.mfttrack_as<FiltMcMftTracks>();
@@ -2639,7 +2670,7 @@ struct DndetaMFTPbPb {
26392670

26402671
auto nBestTrks = 0;
26412672
for (auto const& atrack : besttracks) {
2642-
if (trackCuts.excludeAmbiguous && atrack.ambDegree() > 1) {
2673+
if (cfgUseTrackSel && !isBestTrackSelected<false>(atrack)) {
26432674
continue;
26442675
}
26452676
auto itrack = atrack.template mfttrack_as<FiltMftTracks>();

0 commit comments

Comments
 (0)