Skip to content

Commit 7ab16c3

Browse files
authored
[PWGJE] Fix an error when remove leading jet eta band at delta pt code (AliceO2Group#11025)
1 parent 153992b commit 7ab16c3

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

PWGJE/Tasks/jetChargedV2.cxx

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ struct JetChargedV2 {
9696
Configurable<float> jetEtaMin{"jetEtaMin", -0.9, "minimum eta acceptance for jets"};
9797
Configurable<float> jetEtaMax{"jetEtaMax", 0.9, "maximum eta acceptance for jets"};
9898
Configurable<float> jetRadius{"jetRadius", 0.2, "jet resolution parameters"};
99+
Configurable<float> randomConeLeadJetDeltaR{"randomConeLeadJetDeltaR", -99.0, "min distance between leading jet axis and random cone (RC) axis; if negative, min distance is set to automatic value of R_leadJet+R_RC "};
99100

100101
Configurable<float> localRhoFitPtMin{"localRhoFitPtMin", 0.2, "Minimum track pT used for local rho fluctuation fit"};
101102
Configurable<float> localRhoFitPtMax{"localRhoFitPtMax", 5, "Maximum track pT used for local rho fluctuation fit"};
@@ -789,28 +790,21 @@ struct JetChargedV2 {
789790

790791
// removing the leading jet from the random cone
791792
if (jets.size() > 0) { // if there are no jets in the acceptance (from the jetfinder cuts) then there can be no leading jet
792-
float leadingJetEta = jets.iteratorAt(0).eta();
793-
float leadingJetPhi = jets.iteratorAt(0).phi();
794-
float etaBandWidth = 2 * randomConeR;
793+
float dPhiLeadingJet = RecoDecay::constrainAngle(jets.iteratorAt(0).phi() - randomConePhi, static_cast<float>(-o2::constants::math::PI));
794+
float dEtaLeadingJet = jets.iteratorAt(0).eta() - randomConeEta;
795795

796796
bool jetWasInCone = false;
797-
do {
797+
while ((randomConeLeadJetDeltaR <= 0 && (std::sqrt(dEtaLeadingJet * dEtaLeadingJet + dPhiLeadingJet * dPhiLeadingJet) < jets.iteratorAt(0).r() / 100.0 + randomConeR)) || (randomConeLeadJetDeltaR > 0 && (std::sqrt(dEtaLeadingJet * dEtaLeadingJet + dPhiLeadingJet * dPhiLeadingJet) < randomConeLeadJetDeltaR))) {
798+
jetWasInCone = true;
798799
randomConeEta = randomNumber.Uniform(trackEtaMin + randomConeR, trackEtaMax - randomConeR);
799800
randomConePhi = randomNumber.Uniform(0.0, o2::constants::math::TwoPI);
800-
801-
float dEta = randomConeEta - leadingJetEta;
802-
float dPhi = RecoDecay::constrainAngle(randomConePhi - leadingJetPhi, static_cast<float>(-o2::constants::math::PI));
803-
804-
if (std::abs(dEta) > etaBandWidth && std::sqrt(dEta * dEta + dPhi * dPhi) > randomConeR + jets.iteratorAt(0).r() / 100.0) {
805-
break;
806-
}
807-
jetWasInCone = true;
808-
} while (true);
809-
801+
dPhiLeadingJet = RecoDecay::constrainAngle(jets.iteratorAt(0).phi() - randomConePhi, static_cast<float>(-o2::constants::math::PI));
802+
dEtaLeadingJet = jets.iteratorAt(0).eta() - randomConeEta;
803+
}
810804
if (jetWasInCone) {
811805
randomConePt = 0.0;
812806
for (auto const& track : tracks) {
813-
if (jetderiveddatautilities::selectTrack(track, trackSelection)) { // if track selection is uniformTrack, dcaXY and dcaZ cuts need to be added as they aren't in the selection so that they can be studied here
807+
if (jetderiveddatautilities::selectTrack(track, trackSelection) && (std::fabs(track.eta() - leadingJetEta) > randomConeR)) { // if track selection is uniformTrack, dcaXY and dcaZ cuts need to be added as they aren't in the selection so that they can be studied here
814808
float dPhi = RecoDecay::constrainAngle(track.phi() - randomConePhi, static_cast<float>(-o2::constants::math::PI));
815809
float dEta = track.eta() - randomConeEta;
816810
if (std::sqrt(dEta * dEta + dPhi * dPhi) < randomConeR) {

0 commit comments

Comments
 (0)