Skip to content

Commit 8bc2060

Browse files
committed
[PWGJE] fixed leading-jet selection in nuclei-in-jets
1 parent 08b4914 commit 8bc2060

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

‎PWGJE/Tasks/nucleiInJets.cxx‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,8 @@ struct nucleiInJets {
940940
bool jetFlagPerpCone = false;
941941
float jetPt = -999.;
942942

943-
if (isWithLeadingJet) {
943+
const bool hasValidLeadingJet = leadingJetPtEtaPhi.size() >= 3 && leadingJetPtEtaPhi[0] > 0.f;
944+
if (isWithLeadingJet && hasValidLeadingJet) {
944945
if (!isConeAxisAccepted(leadingJetPtEtaPhi[1])) {
945946
return;
946947
}
@@ -958,7 +959,7 @@ struct nucleiInJets {
958959
double RPerpCone2 = RecoDecay::sqrtSumOfSquares(delEta, delPhiPerpCone2);
959960
if (RPerpCone1 < cfgjetR || RPerpCone2 < cfgjetR)
960961
jetFlagPerpCone = true;
961-
} else {
962+
} else if (!isWithLeadingJet) {
962963
for (auto const& jet : jets) {
963964
if (!isConeAxisAccepted(jet.eta())) {
964965
continue;
@@ -1754,7 +1755,7 @@ struct nucleiInJets {
17541755
jetHist.fill(HIST("hNEvents"), 6.5);
17551756
int nJets = 0;
17561757
int nAcceptedJets = 0;
1757-
std::vector<float> leadingJetWithPtEtaPhi(3);
1758+
std::vector<float> leadingJetWithPtEtaPhi(3, -999.f);
17581759
float leadingJetPt = -1.0f;
17591760
float leadingJetPtBkgSub = -999.0f;
17601761
float backgroundRho = collision.rho(); // Get background rho from collision
@@ -1856,7 +1857,7 @@ struct nucleiInJets {
18561857
jetHist.fill(HIST("hNEvents"), 6.5);
18571858
int nJets = 0;
18581859
int nAcceptedJets = 0;
1859-
std::vector<float> leadingJetWithPtEtaPhi(3);
1860+
std::vector<float> leadingJetWithPtEtaPhi(3, -999.f);
18601861
float leadingJetPt = -1.0f;
18611862
float leadingJetPtBkgSub = -999.0f;
18621863
float backgroundRho = collision.rho(); // Get background rho from collision
@@ -2290,7 +2291,7 @@ struct nucleiInJets {
22902291
jetHist.fill(HIST("mcdJet/eventStat"), 2.5);
22912292

22922293
int nJets = 0;
2293-
std::vector<float> leadingJetWithPtEtaPhi(3);
2294+
std::vector<float> leadingJetWithPtEtaPhi(3, -999.f);
22942295
float leadingJetPt = -1.0f;
22952296
for (auto& mcdjet : mcdjets) {
22962297
jetHist.fill(HIST("mcdJet/hJetPt"), mcdjet.pt());
@@ -2322,7 +2323,8 @@ struct nucleiInJets {
23222323
bool jetFlag = false;
23232324
bool jetFlagPerpCone = false;
23242325
// float jetPt = -999.;
2325-
if (isWithLeadingJet) {
2326+
const bool hasValidLeadingJet = leadingJetWithPtEtaPhi.size() >= 3 && leadingJetWithPtEtaPhi[0] > 0.f;
2327+
if (isWithLeadingJet && hasValidLeadingJet) {
23262328
double delPhi = TVector2::Phi_mpi_pi(leadingJetWithPtEtaPhi[2] - track.phi());
23272329
double delEta = leadingJetWithPtEtaPhi[1] - track.eta();
23282330
double R = RecoDecay::sqrtSumOfSquares(delEta, delPhi);
@@ -2335,7 +2337,7 @@ struct nucleiInJets {
23352337
double RPerpCone2 = RecoDecay::sqrtSumOfSquares(delEta, delPhiPerpCone2);
23362338
if (RPerpCone1 < cfgjetR || RPerpCone2 < cfgjetR)
23372339
jetFlagPerpCone = true;
2338-
} else {
2340+
} else if (!isWithLeadingJet) {
23392341
for (const auto& mcdjet : mcdjets) {
23402342
double delPhi = TVector2::Phi_mpi_pi(mcdjet.phi() - track.phi());
23412343
double delEta = mcdjet.eta() - track.eta();
@@ -2385,7 +2387,7 @@ struct nucleiInJets {
23852387
return;
23862388
// LOG(info) <<" size(mcd) "<<mcdjets.size();
23872389

2388-
std::vector<double> leadingJetWithPtEtaPhi(3);
2390+
std::vector<double> leadingJetWithPtEtaPhi(3, -999.);
23892391
for (const auto& mcdjet : mcdjets) {
23902392
if (!mcdjet.has_matchedJetGeo())
23912393
continue;

0 commit comments

Comments
 (0)