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
93 changes: 42 additions & 51 deletions PWGJE/Tasks/jetHadronRecoil.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
Configurable<bool> skipMBGapEvents{"skipMBGapEvents", false, "flag to choose to reject min. bias gap events; jet-level rejection applied at the jet finder level, here rejection is applied for collision and track process functions"};
Configurable<bool> outlierRejectEvent{"outlierRejectEvent", true, "where outliers are found, reject event (true) or just reject the single track/jet (false)"};
Configurable<bool> doSumw{"doSumw", false, "enable sumw2 for weighted histograms"};
Configurable<bool> applyRCTSelections{"applyRCTSelections", true, "decide to apply RCT selections"};

TRandom3* rand = new TRandom3(0);

Expand All @@ -102,7 +103,7 @@
std::vector<double> dRBinning = {0.0, 1.0e-9, 0.003, 0.006, 0.009, 0.012, 0.015, 0.018, 0.021, 0.024,
0.027, 0.03, 0.033, 0.036, 0.039, 0.042, 0.045, 0.048, 0.051, 0.054,
0.057, 0.06, 0.063, 0.066, 0.069, 0.072, 0.075, 0.078, 0.081, 0.084,
0.087, 0.09, 0.093, 0.096, 0.099, 0.102, 0.105, 0.108, 0.111, 0.114,

Check failure on line 106 in PWGJE/Tasks/jetHadronRecoil.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-mass]

Avoid hard-coded particle masses. Use o2::constants::physics::Mass... instead.
0.117, 0.12, 0.123, 0.126, 0.129, 0.132, 0.135, 0.138, 0.141, 0.144,
0.147, 0.15, 0.153, 0.156, 0.159, 0.162, 0.165, 0.168, 0.171, 0.174,
0.177, 0.18, 0.183, 0.186, 0.189, 0.192, 0.195, 0.198, 0.201, 0.204,
Expand Down Expand Up @@ -204,9 +205,11 @@
if (doprocessJetsMCPMCDMatched || doprocessJetsMCPMCDMatchedWithRhoSubtraction || doprocessJetsMCPMCDMatchedWeighted || doprocessJetsMCPMCDMatchedWeightedWithRhoSubtraction || doprocessRecoilJetsMCPMCDMatched || doprocessRecoilJetsMCPMCDMatchedWeighted || doprocessRecoilJetsMCPMCDMatchedWeightedWithRhoSubtraction) {
registry.add("hPtMatched", "p_{T} matching;p_{T,det};p_{T,part}", {HistType::kTH2F, {ptAxisDet, ptAxisPart}}, doSumw);
registry.add("hPhiMatched", "#phi matching;#phi_{det};#phi_{part}", {HistType::kTH2F, {phiAxisDet, phiAxisPart}}, doSumw);
registry.add("hPhiMatched2d", "#phi matching 2d;#phi;p_{T}", {HistType::kTH2F, {phiAxisPart, ptAxisPart}}, doSumw);
registry.add("hPhiMatchedPt", "#phi matching 2d;#phi;p_{T}", {HistType::kTH2F, {{400, 0, 400}, phiAxisPart}}, doSumw);
registry.add("hDeltaRMatched", "#DeltaR matching;#DeltaR_{det};#DeltaR_{part}", {HistType::kTH2F, {dRAxisDet, dRAxisPart}}, doSumw);
registry.add("hPtMatched1d", "p_{T} matching 1d;p_{T,part}", {HistType::kTH1F, {{400, 0, 400}}}, doSumw);
registry.add("hPtTruth2D", "p_{T} truth 2d;p_{T,part};dphip", {HistType::kTH2F, {{400, 0, 400}, phiAxisPart}}, doSumw);
registry.add("hPtTruth1D", "p_{T} truth 1d;p_{T,part}", {HistType::kTH1F, {{400, 0, 400}}}, doSumw);
registry.add("hDeltaRMatched1d", "#DeltaR matching 1d;#DeltaR_{part}", {HistType::kTH1F, {dRAxisPart}}, doSumw);
registry.add("hPtResolution", "p_{T} resolution;p_{T,part};Relative Resolution", {HistType::kTH2F, {ptAxisPart, {100, -5.0, 5.0}}}, doSumw);
registry.add("hPhiResolution", "#phi resolution;#p_{T,part};Resolution", {HistType::kTH2F, {ptAxisPart, {100, -7.0, 7.0}}}, doSumw);
Expand Down Expand Up @@ -281,7 +284,7 @@
registry.fill(HIST("hNtrig"), 0.5, weight);
registry.fill(HIST("hRefEventTriggers"), nTT, weight);
registry.fill(HIST("hRhoReference"), rhoReference, weight);
for (double shift = 0.0; shift <= 2.0; shift += 0.1) {

Check failure on line 287 in PWGJE/Tasks/jetHadronRecoil.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.
registry.fill(HIST("hRhoReferenceShift"), rho + shift, shift, weight);
}
registry.fill(HIST("hReferenceTriggersPtHard"), ptTT / pTHat, weight);
Expand Down Expand Up @@ -316,31 +319,31 @@
float dphi = RecoDecay::constrainAngle(jet.phi() - phiTT);
double dR = getWTAaxisDifference(jet, tracks);
if (isSigCol) {
if (std::abs(dphi - o2::constants::math::PI) < 0.6) {

Check failure on line 322 in PWGJE/Tasks/jetHadronRecoil.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.
registry.fill(HIST("hDeltaRpTSignal"), jet.pt() - (rho * jet.area()), dR, weight);
registry.fill(HIST("hDeltaRSignal"), dR, weight);
}
registry.fill(HIST("hDeltaRpTDPhiSignal"), jet.pt() - (rho * jet.area()), dphi, dR, weight);
registry.fill(HIST("hSignalPtDPhi"), dphi, jet.pt() - (rho * jet.area()), weight);
if (std::abs(dphi - o2::constants::math::PI) < 0.6) {

Check failure on line 328 in PWGJE/Tasks/jetHadronRecoil.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.
registry.fill(HIST("hSignalPt"), jet.pt() - (rho * jet.area()), weight);
registry.fill(HIST("hSignalPtHard"), jet.pt() - (rho * jet.area()), ptTT / pTHat, weight);
}
}
if (!isSigCol) {
if (std::abs(dphi - o2::constants::math::PI) < 0.6) {

Check failure on line 334 in PWGJE/Tasks/jetHadronRecoil.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.
registry.fill(HIST("hDeltaRpTReference"), jet.pt() - (rhoReference * jet.area()), dR, weight);
registry.fill(HIST("hDeltaRReference"), dR, weight);
}
registry.fill(HIST("hDeltaRpTDPhiReference"), jet.pt() - (rhoReference * jet.area()), dphi, dR, weight);
for (double shift = 0.0; shift <= 2.0; shift += 0.1) {

Check failure on line 339 in PWGJE/Tasks/jetHadronRecoil.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.
registry.fill(HIST("hDeltaRpTDPhiReferenceShifts"), jet.pt() - ((rho + shift) * jet.area()), dphi, dR, shift, weight);
}
registry.fill(HIST("hReferencePtDPhi"), dphi, jet.pt() - (rhoReference * jet.area()), weight);
for (double shift = 0.0; shift <= 2.0; shift += 0.1) {

Check failure on line 343 in PWGJE/Tasks/jetHadronRecoil.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.
registry.fill(HIST("hReferencePtDPhiShifts"), dphi, jet.pt() - ((rho + shift) * jet.area()), shift, weight);
}
if (std::abs(dphi - o2::constants::math::PI) < 0.6) {

Check failure on line 346 in PWGJE/Tasks/jetHadronRecoil.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.
registry.fill(HIST("hReferencePt"), jet.pt() - (rhoReference * jet.area()), weight);
registry.fill(HIST("hReferencePtHard"), jet.pt() - (rhoReference * jet.area()), ptTT / pTHat, weight);
}
Expand Down Expand Up @@ -423,7 +426,7 @@
registry.fill(HIST("hNtrig"), 0.5, weight);
registry.fill(HIST("hRefEventTriggers"), nTT, weight);
registry.fill(HIST("hRhoReference"), rhoReference, weight);
for (double shift = 0.0; shift <= 2.0; shift += 0.1) {

Check failure on line 429 in PWGJE/Tasks/jetHadronRecoil.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.
registry.fill(HIST("hRhoReferenceShift"), rho + shift, shift, weight);
}
registry.fill(HIST("hReferenceTriggersPtHard"), ptTT / pTHat, weight);
Expand Down Expand Up @@ -626,9 +629,10 @@
}
}

double dR = getWTAaxisDifference(jetTag, particles);
registry.fill(HIST("hPtTruth1D"), jetTag.pt(), weight);

if (jetTag.has_matchedJetGeo() && jetTag.has_matchedJetPt()) {
double dR = getWTAaxisDifference(jetTag, particles);
if (jetTag.has_matchedJetGeo()) {
for (const auto& jetBase : jetTag.template matchedJetGeo_as<std::decay_t<T>>()) {
if (jetBase.pt() > pTHatMaxMCD * pTHat) {
if (outlierRejectEvent) {
Expand Down Expand Up @@ -701,32 +705,31 @@

float dphip = RecoDecay::constrainAngle(jetTag.phi() - phiTT);
double dRp = getWTAaxisDifference(jetTag, particles);

if (jetTag.has_matchedJetGeo() && jetTag.has_matchedJetPt()) {
registry.fill(HIST("hPtTruth1D"), jetTag.pt(), weight);
registry.fill(HIST("hPtTruth2D"), jetTag.pt(), dphip, weight);
if (jetTag.has_matchedJetGeo()) {
for (const auto& jetBase : jetTag.template matchedJetGeo_as<std::decay_t<T>>()) {
if (jetTag.template matchedJetGeo_first_as<std::decay_t<T>>().globalIndex() == jetTag.template matchedJetPt_first_as<std::decay_t<T>>().globalIndex()) {
if (jetBase.pt() > pTHatMaxMCD * pTHat) {
if (outlierRejectEvent) {
return;
} else {
continue;
}
if (jetBase.pt() > pTHatMaxMCD * pTHat) {
if (outlierRejectEvent) {
return;
} else {
continue;
}
}

float dphi = RecoDecay::constrainAngle(jetBase.phi() - phiTT);
double dR = getWTAaxisDifference(jetBase, tracks);
registry.fill(HIST("hPhiMatched"), dphi, dphip, weight);
registry.fill(HIST("hPhiMatched2d"), jetTag.phi(), jetTag.pt(), weight);
registry.fill(HIST("hPhiResolution"), jetTag.pt(), dphip - dphi, weight);
registry.fill(HIST("hFullMatching"), jetBase.pt() - (rho * jetBase.area()), jetTag.pt(), dphi, dphip, dR, dRp, weight);
if ((std::abs(dphip - o2::constants::math::PI) < 0.6)) {
registry.fill(HIST("hPtMatched1d"), jetTag.pt(), weight);
registry.fill(HIST("hDeltaRMatched1d"), dRp, weight);
registry.fill(HIST("hPtMatched"), jetBase.pt() - (rho * jetBase.area()), jetTag.pt(), weight);
registry.fill(HIST("hPtResolution"), jetTag.pt(), (jetTag.pt() - (jetBase.pt() - (rho * jetBase.area()))) / jetTag.pt(), weight);
registry.fill(HIST("hDeltaRMatched"), dR, dRp, weight);
registry.fill(HIST("hDeltaRResolution"), jetTag.pt(), dRp - dR, weight);
}
float dphi = RecoDecay::constrainAngle(jetBase.phi() - phiTT);
double dR = getWTAaxisDifference(jetBase, tracks);
registry.fill(HIST("hPhiMatched"), dphi, dphip, weight);
registry.fill(HIST("hPhiMatchedPt"), jetTag.pt(), dphip, weight);
registry.fill(HIST("hPhiResolution"), jetTag.pt(), dphip - dphi, weight);
registry.fill(HIST("hFullMatching"), jetBase.pt() - (rho * jetBase.area()), jetTag.pt(), dphi, dphip, dR, dRp, weight);
registry.fill(HIST("hPtMatched1d"), jetTag.pt(), weight);
if ((std::abs(dphip - o2::constants::math::PI) < 0.6)) {
registry.fill(HIST("hDeltaRMatched1d"), dRp, weight);
registry.fill(HIST("hPtMatched"), jetBase.pt() - (rho * jetBase.area()), jetTag.pt(), weight);
registry.fill(HIST("hPtResolution"), jetTag.pt(), (jetTag.pt() - (jetBase.pt() - (rho * jetBase.area()))) / jetTag.pt(), weight);
registry.fill(HIST("hDeltaRMatched"), dR, dRp, weight);
registry.fill(HIST("hDeltaRResolution"), jetTag.pt(), dRp - dR, weight);
}
}
}
Expand Down Expand Up @@ -768,10 +771,7 @@
soa::Filtered<soa::Join<aod::ChargedMCDetectorLevelJets, aod::ChargedMCDetectorLevelJetConstituents>> const& jets,
soa::Filtered<soa::Join<aod::JetTracks, aod::JTrackExtras, aod::JMcTrackLbs>> const& tracks)
{
if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) {
return;
}
if (skipMBGapEvents && collision.getSubGeneratorId() == jetderiveddatautilities::JCollisionSubGeneratorId::mbGap) {
if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents, applyRCTSelections)) {
return;
}
if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) {
Expand All @@ -793,10 +793,7 @@
soa::Filtered<soa::Join<aod::ChargedMCDetectorLevelJets, aod::ChargedMCDetectorLevelJetConstituents>> const& jets,
soa::Filtered<soa::Join<aod::JetTracks, aod::JTrackExtras, aod::JMcTrackLbs>> const& tracks)
{
if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) {
return;
}
if (skipMBGapEvents && collision.getSubGeneratorId() == jetderiveddatautilities::JCollisionSubGeneratorId::mbGap) {
if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents, applyRCTSelections)) {
return;
}
if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) {
Expand All @@ -818,10 +815,7 @@
soa::Filtered<soa::Join<aod::ChargedMCDetectorLevelJets, aod::ChargedMCDetectorLevelJetConstituents>> const& jets,
soa::Filtered<soa::Join<aod::JetTracks, aod::JTrackExtras, aod::JMcTrackLbs>> const& tracks)
{
if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) {
return;
}
if (skipMBGapEvents && collision.getSubGeneratorId() == jetderiveddatautilities::JCollisionSubGeneratorId::mbGap) {
if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents, applyRCTSelections)) {
return;
}
if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) {
Expand All @@ -843,10 +837,7 @@
soa::Filtered<soa::Join<aod::ChargedMCDetectorLevelJets, aod::ChargedMCDetectorLevelJetConstituents>> const& jets,
soa::Filtered<soa::Join<aod::JetTracks, aod::JTrackExtras, aod::JMcTrackLbs>> const& tracks)
{
if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) {
return;
}
if (skipMBGapEvents && collision.getSubGeneratorId() == jetderiveddatautilities::JCollisionSubGeneratorId::mbGap) {
if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents, applyRCTSelections)) {
return;
}
if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) {
Expand All @@ -871,7 +862,7 @@
if (std::abs(mccollision.posZ()) > vertexZCut) {
return;
}
if (skipMBGapEvents && mccollision.getSubGeneratorId() == jetderiveddatautilities::JCollisionSubGeneratorId::mbGap) {
if (!jetderiveddatautilities::selectMcCollision(mccollision, skipMBGapEvents, applyRCTSelections)) {
return;
}
if (mccollision.ptHard() < pTHatMinEvent) {
Expand Down Expand Up @@ -901,7 +892,7 @@
if (std::abs(mccollision.posZ()) > vertexZCut) {
return;
}
if (skipMBGapEvents && mccollision.getSubGeneratorId() == jetderiveddatautilities::JCollisionSubGeneratorId::mbGap) {
if (!jetderiveddatautilities::selectMcCollision(mccollision, skipMBGapEvents, applyRCTSelections)) {
return;
}
if (mccollision.ptHard() < pTHatMinEvent) {
Expand Down Expand Up @@ -933,7 +924,7 @@
if (std::abs(mccollision.posZ()) > vertexZCut) {
return;
}
if (skipMBGapEvents && mccollision.getSubGeneratorId() == jetderiveddatautilities::JCollisionSubGeneratorId::mbGap) {
if (!jetderiveddatautilities::selectMcCollision(mccollision, skipMBGapEvents, applyRCTSelections)) {
return;
}
if (mccollision.ptHard() < pTHatMinEvent) {
Expand Down Expand Up @@ -965,7 +956,7 @@
if (std::abs(mccollision.posZ()) > vertexZCut) {
return;
}
if (skipMBGapEvents && mccollision.getSubGeneratorId() == jetderiveddatautilities::JCollisionSubGeneratorId::mbGap) {
if (!jetderiveddatautilities::selectMcCollision(mccollision, skipMBGapEvents, applyRCTSelections)) {
return;
}
if (mccollision.ptHard() < pTHatMinEvent) {
Expand Down Expand Up @@ -997,7 +988,7 @@
if (std::abs(mccollision.posZ()) > vertexZCut) {
return;
}
if (skipMBGapEvents && mccollision.getSubGeneratorId() == jetderiveddatautilities::JCollisionSubGeneratorId::mbGap) {
if (!jetderiveddatautilities::selectMcCollision(mccollision, skipMBGapEvents, applyRCTSelections)) {
return;
}
if (mccollision.ptHard() < pTHatMinEvent) {
Expand Down Expand Up @@ -1029,7 +1020,7 @@
if (std::abs(mccollision.posZ()) > vertexZCut) {
return;
}
if (skipMBGapEvents && mccollision.getSubGeneratorId() == jetderiveddatautilities::JCollisionSubGeneratorId::mbGap) {
if (!jetderiveddatautilities::selectMcCollision(mccollision, skipMBGapEvents, applyRCTSelections)) {
return;
}
if (mccollision.ptHard() < pTHatMinEvent) {
Expand Down Expand Up @@ -1061,7 +1052,7 @@
if (std::abs(mccollision.posZ()) > vertexZCut) {
return;
}
if (skipMBGapEvents && mccollision.getSubGeneratorId() == jetderiveddatautilities::JCollisionSubGeneratorId::mbGap) {
if (!jetderiveddatautilities::selectMcCollision(mccollision, skipMBGapEvents, applyRCTSelections)) {
return;
}
if (mccollision.ptHard() < pTHatMinEvent) {
Expand Down Expand Up @@ -1093,7 +1084,7 @@
if (std::abs(mccollision.posZ()) > vertexZCut) {
return;
}
if (skipMBGapEvents && mccollision.getSubGeneratorId() == jetderiveddatautilities::JCollisionSubGeneratorId::mbGap) {
if (!jetderiveddatautilities::selectMcCollision(mccollision, skipMBGapEvents, applyRCTSelections)) {
return;
}
if (mccollision.ptHard() < pTHatMinEvent) {
Expand Down Expand Up @@ -1125,7 +1116,7 @@
if (std::abs(mccollision.posZ()) > vertexZCut) {
return;
}
if (skipMBGapEvents && mccollision.getSubGeneratorId() == jetderiveddatautilities::JCollisionSubGeneratorId::mbGap) {
if (!jetderiveddatautilities::selectMcCollision(mccollision, skipMBGapEvents, applyRCTSelections)) {
return;
}
if (mccollision.ptHard() < pTHatMinEvent) {
Expand Down Expand Up @@ -1154,7 +1145,7 @@
double deltaY = -1;
double dR = -1;
jetConstituents.clear();
for (auto& jetConstituent : jet.template tracks_as<X>()) {

Check failure on line 1148 in PWGJE/Tasks/jetHadronRecoil.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.
fastjetutilities::fillTracks(jetConstituent, jetConstituents, jetConstituent.globalIndex());
}
jetReclustered.clear();
Expand Down
Loading