Skip to content

Commit 1e35c09

Browse files
authored
[PWGEM/Dilepton] fix std::abs, std::fabs (#10521)
1 parent a5ff4db commit 1e35c09

File tree

4 files changed

+174
-174
lines changed

4 files changed

+174
-174
lines changed

PWGEM/Dilepton/Core/DielectronCut.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,10 +374,10 @@ class DielectronCut : public TNamed
374374
return mMinDca3D <= dca3DinSigma(track) && dca3DinSigma(track) <= mMaxDca3D; // in sigma for single leg
375375

376376
case DielectronCuts::kDCAxy:
377-
return abs(track.dcaXY()) <= ((mMaxDcaXYPtDep) ? mMaxDcaXYPtDep(track.pt()) : mMaxDcaXY);
377+
return std::fabs(track.dcaXY()) <= ((mMaxDcaXYPtDep) ? mMaxDcaXYPtDep(track.pt()) : mMaxDcaXY);
378378

379379
case DielectronCuts::kDCAz:
380-
return abs(track.dcaZ()) <= mMaxDcaZ;
380+
return std::fabs(track.dcaZ()) <= mMaxDcaZ;
381381

382382
case DielectronCuts::kITSNCls:
383383
return mMinNClustersITS <= track.itsNCls() && track.itsNCls() <= mMaxNClustersITS;

PWGEM/Dilepton/Core/Dilepton.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ struct Dilepton {
436436
if (d_bz_input > -990) {
437437
d_bz = d_bz_input;
438438
o2::parameters::GRPMagField grpmag;
439-
if (fabs(d_bz) > 1e-5) {
439+
if (std::fabs(d_bz) > 1e-5) {
440440
grpmag.setL3Current(30000.f / (d_bz / 5.0f));
441441
}
442442
o2::base::Propagator::initFieldFromGRP(&grpmag);
@@ -759,7 +759,7 @@ struct Dilepton {
759759
{
760760
bool is_good = true;
761761
for (auto& qn : qvectors[nmod]) {
762-
if (fabs(qn[0]) > 20.f || fabs(qn[1]) > 20.f) {
762+
if (std::fabs(qn[0]) > 20.f || std::fabs(qn[1]) > 20.f) {
763763
is_good = false;
764764
break;
765765
}
@@ -922,20 +922,20 @@ struct Dilepton {
922922
} else if (cfgAnalysisType == static_cast<int>(o2::aod::pwgem::dilepton::utils::pairutil::DileptonAnalysisType::kUPC)) {
923923
float dphi = v1.Phi() - v2.Phi();
924924
o2::math_utils::bringToPMPi(dphi);
925-
float aco = 1.f - abs(dphi) / M_PI;
926-
float asym = abs(v1.Pt() - v2.Pt()) / (v1.Pt() + v2.Pt());
925+
float aco = 1.f - std::fabs(dphi) / M_PI;
926+
float asym = std::fabs(v1.Pt() - v2.Pt()) / (v1.Pt() + v2.Pt());
927927
float dphi_e_ee = v1.Phi() - v12.Phi();
928928
o2::math_utils::bringToPMPi(dphi_e_ee);
929929

930930
float cos_thetaCS = 999, phiCS = 999.f;
931931
o2::aod::pwgem::dilepton::utils::pairutil::getAngleCS<false>(t1, t2, leptonM1, leptonM2, beamE1, beamE2, beamP1, beamP2, cos_thetaCS, phiCS);
932932

933933
if (t1.sign() * t2.sign() < 0) { // ULS
934-
fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hs"), v12.M(), v12.Pt(), pair_dca, aco, asym, abs(dphi_e_ee), abs(cos_thetaCS), weight);
934+
fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hs"), v12.M(), v12.Pt(), pair_dca, aco, asym, std::fabs(dphi_e_ee), std::fabs(cos_thetaCS), weight);
935935
} else if (t1.sign() > 0 && t2.sign() > 0) { // LS++
936-
fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hs"), v12.M(), v12.Pt(), pair_dca, aco, asym, abs(dphi_e_ee), abs(cos_thetaCS), weight);
936+
fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hs"), v12.M(), v12.Pt(), pair_dca, aco, asym, std::fabs(dphi_e_ee), std::fabs(cos_thetaCS), weight);
937937
} else if (t1.sign() < 0 && t2.sign() < 0) { // LS--
938-
fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hs"), v12.M(), v12.Pt(), pair_dca, aco, asym, abs(dphi_e_ee), abs(cos_thetaCS), weight);
938+
fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hs"), v12.M(), v12.Pt(), pair_dca, aco, asym, std::fabs(dphi_e_ee), std::fabs(cos_thetaCS), weight);
939939
}
940940
} else if (cfgAnalysisType == static_cast<int>(o2::aod::pwgem::dilepton::utils::pairutil::DileptonAnalysisType::kFlowV2) || cfgAnalysisType == static_cast<int>(o2::aod::pwgem::dilepton::utils::pairutil::DileptonAnalysisType::kFlowV3)) {
941941
std::array<float, 2> q2ft0m = {collision.q2xft0m(), collision.q2yft0m()};
@@ -984,11 +984,11 @@ struct Dilepton {
984984
o2::math_utils::bringToPMPi(phiCS);
985985

986986
if (t1.sign() * t2.sign() < 0) { // ULS
987-
fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hs"), v12.M(), v12.Pt(), pair_dca, abs(cos_thetaCS), abs(phiCS), weight);
987+
fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hs"), v12.M(), v12.Pt(), pair_dca, std::fabs(cos_thetaCS), std::fabs(phiCS), weight);
988988
} else if (t1.sign() > 0 && t2.sign() > 0) { // LS++
989-
fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hs"), v12.M(), v12.Pt(), pair_dca, abs(cos_thetaCS), abs(phiCS), weight);
989+
fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hs"), v12.M(), v12.Pt(), pair_dca, std::fabs(cos_thetaCS), std::fabs(phiCS), weight);
990990
} else if (t1.sign() < 0 && t2.sign() < 0) { // LS--
991-
fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hs"), v12.M(), v12.Pt(), pair_dca, abs(cos_thetaCS), abs(phiCS), weight);
991+
fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hs"), v12.M(), v12.Pt(), pair_dca, std::fabs(cos_thetaCS), std::fabs(phiCS), weight);
992992
}
993993

994994
} else if (cfgAnalysisType == static_cast<int>(o2::aod::pwgem::dilepton::utils::pairutil::DileptonAnalysisType::kVM)) {
@@ -1558,7 +1558,7 @@ struct Dilepton {
15581558
if (collision.sel8()) {
15591559
fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 10.0);
15601560
}
1561-
if (abs(collision.posZ()) < 10.0) {
1561+
if (std::fabs(collision.posZ()) < 10.0) {
15621562
fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 11.0);
15631563
}
15641564
if (collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) {

0 commit comments

Comments
 (0)