Skip to content

Commit 2a44fa0

Browse files
authored
[PWGCF] Pow -> product (#10194)
1 parent 669c7f8 commit 2a44fa0

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

PWGCF/Femto3D/Core/femto3dPairTask.h

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,9 @@ bool FemtoPair<TrackType>::IsClosePair(const float& deta, const float& dphi, con
257257
return true;
258258
if (_magfield1 * _magfield2 == 0)
259259
return true;
260-
if (std::pow(std::fabs(GetEtaDiff()) / deta, 2) + std::pow(std::fabs(GetPhiStarDiff(radius)) / dphi, 2) < 1.0f)
260+
const float relEtaDiff = GetEtaDiff() / deta;
261+
const float relPhiStarDiff = GetPhiStarDiff(radius) / dphi;
262+
if ((relEtaDiff * relEtaDiff + relPhiStarDiff * relPhiStarDiff) < 1.0f)
261263
return true;
262264
// if (std::fabs(GetEtaDiff()) < deta && std::fabs(GetPhiStarDiff(radius)) < dphi)
263265
// return true;
@@ -272,7 +274,9 @@ bool FemtoPair<TrackType>::IsClosePair(const float& deta, const float& dphi) con
272274
return true;
273275
if (_magfield1 * _magfield2 == 0)
274276
return true;
275-
if (std::pow(std::fabs(GetEtaDiff()) / deta, 2) + std::pow(std::fabs(GetAvgPhiStarDiff()) / dphi, 2) < 1.0f)
277+
const float relEtaDiff = GetEtaDiff() / deta;
278+
const float relPhiStarDiff = GetAvgPhiStarDiff() / dphi;
279+
if ((relEtaDiff * relEtaDiff + relPhiStarDiff * relPhiStarDiff) < 1.0f)
276280
return true;
277281
// if (std::fabs(GetEtaDiff()) < deta && std::fabs(GetPhiStarDiff(radius)) < dphi)
278282
// return true;
@@ -291,7 +295,9 @@ float FemtoPair<TrackType>::GetAvgSep() const
291295
float res = 0.0;
292296

293297
for (const auto& radius : TPCradii) {
294-
res += sqrt(pow(2.0 * radius * sin(0.5 * GetPhiStarDiff(radius)), 2) + pow(2.0 * radius * sin(0.5 * dtheta), 2));
298+
const float dRtrans = 2.0 * radius * sin(0.5 * GetPhiStarDiff(radius));
299+
const float dRlong = 2.0 * radius * sin(0.5 * dtheta);
300+
res += sqrt(dRtrans * dRtrans + dRlong * dRlong);
295301
}
296302

297303
return 100.0 * res / TPCradii.size();
@@ -308,7 +314,7 @@ float FemtoPair<TrackType>::GetAvgPhiStarDiff() const
308314
float res = 0.0;
309315

310316
for (const auto& radius : TPCradii) {
311-
auto dphi = GetPhiStarDiff(radius);
317+
const float dphi = GetPhiStarDiff(radius);
312318
res += fabs(dphi) > o2::constants::math::PI ? (1.0 - 2.0 * o2::constants::math::PI / fabs(dphi)) * dphi : dphi;
313319
}
314320

@@ -360,8 +366,9 @@ float FemtoPair<TrackType>::GetKt() const
360366
return -1000;
361367
if (_PDG1 * _PDG2 == 0)
362368
return -1000;
363-
364-
return 0.5 * std::sqrt(std::pow(_first->px() + _second->px(), 2) + std::pow(_first->py() + _second->py(), 2));
369+
const float px = _first->px() + _second->px();
370+
const float py = _first->py() + _second->py();
371+
return 0.5 * std::sqrt(px * px + py * py);
365372
}
366373

367374
template <typename TrackType>

0 commit comments

Comments
 (0)