Skip to content

Commit da55681

Browse files
[PWGJE] PWGJE - fix jetBackgroundAnalysis RC without 2 leading jets (#9628)
1 parent 9f0e9a5 commit da55681

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

PWGJE/Tasks/jetBackgroundAnalysis.cxx

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -173,21 +173,22 @@ struct JetBackgroundAnalysisTask {
173173
}
174174
}
175175
}
176-
177176
registry.fill(HIST("h2_centrality_rhorandomconewithoutleadingjet"), collision.centrality(), randomConePt - M_PI * randomConeR * randomConeR * collision.rho());
178177

179178
// randomised eta,phi for tracks, to assess part of fluctuations coming from statistically independently emitted particles, removing tracks from 2 leading jets
180179
double randomConePtWithoutOneLeadJet = 0;
181180
double randomConePtWithoutTwoLeadJet = 0;
182-
for (auto const& track : tracks) {
183-
if (jetderiveddatautilities::selectTrack(track, trackSelection)) {
184-
float dPhi = RecoDecay::constrainAngle(randomNumber.Uniform(0.0, 2 * M_PI) - randomConePhi, static_cast<float>(-M_PI)); // ignores actual phi of track
185-
float dEta = randomNumber.Uniform(trackEtaMin, trackEtaMax) - randomConeEta; // ignores actual eta of track
186-
if (TMath::Sqrt(dEta * dEta + dPhi * dPhi) < randomConeR) {
187-
if (!trackIsInJet(track, jets.iteratorAt(0))) {
188-
randomConePtWithoutOneLeadJet += track.pt();
189-
if (!trackIsInJet(track, jets.iteratorAt(1))) {
190-
randomConePtWithoutTwoLeadJet += track.pt();
181+
if (jets.size() > 1) { // if there are no jets, or just one, in the acceptance (from the jetfinder cuts) then one cannot find 2 leading jets
182+
for (auto const& track : tracks) {
183+
if (jetderiveddatautilities::selectTrack(track, trackSelection)) {
184+
float dPhi = RecoDecay::constrainAngle(randomNumber.Uniform(0.0, 2 * M_PI) - randomConePhi, static_cast<float>(-M_PI)); // ignores actual phi of track
185+
float dEta = randomNumber.Uniform(trackEtaMin, trackEtaMax) - randomConeEta; // ignores actual eta of track
186+
if (TMath::Sqrt(dEta * dEta + dPhi * dPhi) < randomConeR) {
187+
if (!trackIsInJet(track, jets.iteratorAt(0))) {
188+
randomConePtWithoutOneLeadJet += track.pt();
189+
if (!trackIsInJet(track, jets.iteratorAt(1))) {
190+
randomConePtWithoutTwoLeadJet += track.pt();
191+
}
191192
}
192193
}
193194
}

0 commit comments

Comments
 (0)