Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 46 additions & 17 deletions PWGJE/Tasks/jetOutlierQA.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
Configurable<unsigned int> splitCollisionsDeltaBC{"splitCollisionsDeltaBC", 5, "threshold in BC to assign as split collision"};
Configurable<int> mergeCollisionsDeltaMin{"mergeCollisionsDeltaMin", -10, "number of prior collisions to search for close Z position"};
Configurable<int> mergeCollisionsDeltaMax{"mergeCollisionsDeltaMax", 10, "number of following collisions to search for close Z position"};
Configurable<int> maxNTracksJJdifferent{"maxNTracksJJdifferent", 10, "maximum number of tracks from different JJ collision to be considered for track rejection"};

std::map<uint64_t, std::vector<int64_t>> fBCCollMap; // key: global BC, value: vector of reduced event global indices

Expand All @@ -101,10 +102,10 @@
auto jetPtTemp = 0.0;
jetPtBins.push_back(jetPtTemp);
while (jetPtTemp < jetPtMax) {
if (jetPtTemp < 100.0) {

Check failure on line 105 in PWGJE/Tasks/jetOutlierQA.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
jetPtTemp += 1.0;
jetPtBins.push_back(jetPtTemp);
} else if (jetPtTemp < 200.0) {

Check failure on line 108 in PWGJE/Tasks/jetOutlierQA.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
jetPtTemp += 5.0;
jetPtBins.push_back(jetPtTemp);
} else {
Expand Down Expand Up @@ -233,6 +234,15 @@
registry.add("h2_outlier_collision_ID_difference", "difference in collision ID between outlier collision and analysed collision", {HistType::kTH2F, {{600, 0, 600}, {200, -100, 100}}});
registry.add("h_DeltaZ_Outlier", "Delta Z between outlier collision and analysed collision", {HistType::kTH1F, {{1200, -30, 30}}});
registry.add("h2_DeltaZ_Outlier_difference", "Delta Z between outlier collision and analysed collision vs difference in collision ID", {HistType::kTH2F, {{1200, -30, 30}, {200, -100, 100}}});

registry.add("h_track_pt_same_collision", "track pt from same collision or different MB collision;p_{T,track} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0, 200}}});
registry.add("h_track_pt_eta_same_collision", "track pt vs eta from same collision or different MB collision;p_{T,track} (GeV/#it{c});#eta_{track};entries", {HistType::kTH2F, {{200, 0, 200}, {100, -5, 5}}});
registry.add("h_track_pt_phi_same_collision", "track pt vs phi from same collision or different MB collision;p_{T,track} (GeV/#it{c});#varphi_{track} (rad);entries", {HistType::kTH2F, {{200, 0, 200}, {160, -1.0, 7.0}}});
registry.add("h2_collision_ID_difference_same_collision", "difference in collision ID between outlier collision and analysed collision", {HistType::kTH2F, {{600, 0, 600}, {200, -100, 100}}});
registry.add("h_track_pt_no_JJ_different", "track pt from same collision or different MB collision;p_{T,track} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0, 200}}});
registry.add("h_track_pt_eta_no_JJ_different", "track pt vs eta from same collision or different MB collision;p_{T,track} (GeV/#it{c});#eta_{track};entries", {HistType::kTH2F, {{200, 0, 200}, {100, -5, 5}}});
registry.add("h_track_pt_phi_no_JJ_different", "track pt vs phi from same collision or different MB collision;p_{T,track} (GeV/#it{c});#varphi_{track} (rad);entries", {HistType::kTH2F, {{200, 0, 200}, {160, -1.0, 7.0}}});
registry.add("h2_collision_ID_difference_no_JJ_different", "difference in collision ID between outlier collision and analysed collision", {HistType::kTH2F, {{600, 0, 600}, {200, -100, 100}}});
}
}

Expand All @@ -243,13 +253,13 @@
bool isAcceptedJet(U const& jet)
{

if (jetAreaFractionMin > -98.0) {

Check failure on line 256 in PWGJE/Tasks/jetOutlierQA.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
if (jet.area() < jetAreaFractionMin * M_PI * (jet.r() / 100.0) * (jet.r() / 100.0)) {
return false;
}
}
bool checkConstituentPt = true;
bool checkConstituentMinPt = (leadingConstituentPtMin > -98.0);

Check failure on line 262 in PWGJE/Tasks/jetOutlierQA.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
bool checkConstituentMaxPt = (leadingConstituentPtMax < 9998.0);
if (!checkConstituentMinPt && !checkConstituentMaxPt) {
checkConstituentPt = false;
Expand Down Expand Up @@ -292,7 +302,7 @@
registry.fill(HIST("h3_pthat_jet_pt_jet_ntracks_all"), pTHat, jet.pt(), jet.tracksIds().size(), weight);
registry.fill(HIST("h3_pthat_jet_pt_jet_ntracks_all_noweight"), pTHat, jet.pt(), jet.tracksIds().size());
}
for (auto& constituent : jet.template tracks_as<aod::JetTracksMCD>()) {

Check failure on line 305 in PWGJE/Tasks/jetOutlierQA.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
if (jet.pt() > pTHatMaxMCDOutlier * pTHat) {
registry.fill(HIST("h3_jet_pt_track_dEta_track_dPhi_outliers"), jet.pt(), jet.eta() - constituent.eta(), jet.phi() - constituent.phi(), weight);
registry.fill(HIST("h3_jet_pt_track_dEta_track_dPhi_outliers_noweight"), jet.pt(), jet.eta() - constituent.eta(), jet.phi() - constituent.phi());
Expand All @@ -311,7 +321,7 @@
double pt_total = 0;
double pt_amb = 0;
double pt_unmatched = 0;
for (auto& constituent : jet.template tracks_as<aod::JetTracksMCD>()) {

Check failure on line 324 in PWGJE/Tasks/jetOutlierQA.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
pt_total += constituent.pt();
bool has_MCparticle = constituent.has_mcParticle();
if (!has_MCparticle) {
Expand Down Expand Up @@ -465,10 +475,10 @@
auto bc2Events = bc2It->second;

// loop over events in the first BC
for (auto ev1It : bc1Events) {

Check failure on line 478 in PWGJE/Tasks/jetOutlierQA.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
auto ev1 = collisions.rawIteratorAt(ev1It);
// loop over events in the second BC
for (auto ev2It : bc2Events) {

Check failure on line 481 in PWGJE/Tasks/jetOutlierQA.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
auto ev2 = collisions.rawIteratorAt(ev2It);
// compute 2-event quantities and mark the candidate split collisions
float deltaZ = ev1.posZ() - ev2.posZ();
Expand Down Expand Up @@ -567,12 +577,31 @@
}
// check outlier tracks and neighbouring collisions
registry.fill(HIST("h2_pt_hat_track_pt"), pTHat, track.pt());
// get MC info about track and collision
auto mcParticleOutlier = track.mcParticle_as<JetParticlesWithOriginal>();
auto collisionMCOutlier = collisionsMC.sliceBy(perColParticle, mcParticleOutlier.mcCollisionId());
if (collisionMCOutlier.size() != 1) {
LOG(info) << "size of collision outlier not expected";
return;
}
int mcCollisionIDcoll = collision.mcCollisionId(); // Get the corresponding MC collision ID from the reco collision
int mcCollisionIDOutlier = mcParticleOutlier.mcCollisionId();
int subGenIDOutlier = collisionMCOutlier.begin().subGeneratorId();
int outlierCollisionIDDifference = mcCollisionIDOutlier - mcCollisionIDcoll;

int nMBdifferent = 0;
int nMBdifferentSelected = 0;
int nJJdifferent = 0;
int nJJdifferentSelected = 0;
int nJJsame = 0;
int nJJsameSelected = 0;
// ID outlier based on track pT relative to pTHat
if (track.pt() > pTHatMaxMCDOutlier * pTHat) { // high weight outlier track
registry.fill(HIST("h_track_pt_outlier"), track.pt());
registry.fill(HIST("h2_pt_hat_track_pt_outlier"), pTHat, track.pt());
for (auto const& collisionOutlier : collisions) { // find collisions closeby
int diffColl = collision.globalIndex() - collisionOutlier.globalIndex();
if (abs(diffColl) < 6) {

Check failure on line 604 in PWGJE/Tasks/jetOutlierQA.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
float eventWeightOutlier = collisionOutlier.mcCollision().weight();
double pTHatOutlier = collisionOutlier.mcCollision().ptHard();
registry.fill(HIST("h2_neighbour_pt_hat_outlier"), float(diffColl + 0.1), pTHatOutlier, eventWeightOutlier);
Expand All @@ -581,13 +610,6 @@
}
// now match tracks to their MC particle, check the MC collision ID of this particle, and
// check what fraction of tracks in this event are associated to this MC collision
int nMBdifferent = 0;
int nMBdifferentSelected = 0;
int nJJdifferent = 0;
int nJJdifferentSelected = 0;
int nJJsame = 0;
int nJJsameSelected = 0;
int mcCollisionIDcoll = collision.mcCollisionId(); // Get the corresponding MC collision ID from the reco collision
// LOG(info) << "--- Loop over tracks in outlier event with pT/pThat = " << track.pt() / pTHat << "---";
// LOG(info) << "N tracks in outlier event = " << tracksColl.size() << " pTHat = " << pTHat << " collisionID = " << collision.globalIndex() << " mcCollisionID = " << collision.mcCollisionId();
for (auto const& trackOutlier : tracksColl) {
Expand Down Expand Up @@ -639,15 +661,6 @@
registry.fill(HIST("h2_outlier_event_tracks_frac_different_selected_JJ"), pTHat, float(nJJdifferentSelected) / float(nJJdifferentSelected + nJJsameSelected + nMBdifferentSelected));
registry.fill(HIST("h2_outlier_event_tracks_frac_different_selected_MB"), pTHat, float(nMBdifferentSelected) / float(nJJdifferentSelected + nJJsameSelected + nMBdifferentSelected));
// now check where outlier comes from
auto mcParticleOutlier = track.mcParticle_as<JetParticlesWithOriginal>();
auto collisionMCOutlier = collisionsMC.sliceBy(perColParticle, mcParticleOutlier.mcCollisionId());
if (collisionMCOutlier.size() != 1) {
LOG(info) << "size of collision outlier not expected";
return;
}
int mcCollisionIDOutlier = mcParticleOutlier.mcCollisionId();
int subGenIDOutlier = collisionMCOutlier.begin().subGeneratorId();
int outlierCollisionIDDifference = mcCollisionIDOutlier - mcCollisionIDcoll;
// LOG(info) <<"outlier comes from " << (mcCollisionIDOutlier == mcCollisionIDcoll ? "same" : "different") << " event which is a " << (subGenIDOutlier == jetderiveddatautilities::JCollisionSubGeneratorId::mbGap ? " MB-gap" : " jet-jet") << " collision with mcCollisionID = " << mcCollisionIDOutlier;
registry.fill(HIST("h2_outlier_collision_ID_difference"), pTHat, float(outlierCollisionIDDifference));
// if outlier comes from different collision, check which type and set flags
Expand All @@ -660,13 +673,29 @@
isOutlierEventDifferentMBCollision = true;
}
}
// all
// fill for tracks from same collision or different MB collision in collisions that likely aren't fully merged
if (nJJdifferentSelected < maxNTracksJJdifferent &&
(subGenIDOutlier == jetderiveddatautilities::JCollisionSubGeneratorId::mbGap ||
mcCollisionIDOutlier == mcCollisionIDcoll)) {
registry.fill(HIST("h_track_pt_same_collision"), track.pt(), weight);
registry.fill(HIST("h_track_pt_eta_same_collision"), track.pt(), track.eta(), weight);
registry.fill(HIST("h_track_pt_phi_same_collision"), track.pt(), track.phi(), weight);
registry.fill(HIST("h2_collision_ID_difference_same_collision"), pTHat, float(outlierCollisionIDDifference));
}
// fill tracks for events which have no JJ outlier tracks from different events
if (nJJdifferentSelected == 0) {
registry.fill(HIST("h_track_pt_no_JJ_different"), track.pt(), weight);
registry.fill(HIST("h_track_pt_eta_no_JJ_different"), track.pt(), track.eta(), weight);
registry.fill(HIST("h_track_pt_phi_no_JJ_different"), track.pt(), track.phi(), weight);
registry.fill(HIST("h2_collision_ID_difference_no_JJ_different"), pTHat, float(outlierCollisionIDDifference));
}
// collision checks for all tracks
for (auto const& collisionOutlier : collisions) { // find collisions closeby
float eventWeightOutlier = collisionOutlier.mcCollision().weight();
double pTHatOutlier = collisionOutlier.mcCollision().ptHard();
int diffColl = collision.globalIndex() - collisionOutlier.globalIndex();

if (abs(diffColl) < 6) {

Check failure on line 698 in PWGJE/Tasks/jetOutlierQA.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
// LOG(info) << "pThat = " << pTHat << "pThat neighbour = "<<pTHatOutlier;
registry.fill(HIST("h2_neighbour_pt_hat_all"), float(diffColl + 0.1), pTHatOutlier, eventWeightOutlier);
registry.fill(HIST("h2_neighbour_track_pt_all"), float(diffColl + 0.1), track.pt(), eventWeightOutlier);
Expand Down
Loading