Skip to content

Commit 5de13ca

Browse files
committed
Fix casts
Fixes C-style, redundant, wrong, and dangerous casts (found by Clang-Tidy and cpplint). - Remove redundant casts. (`readability-redundant-casting`) - Remove `const_cast`. (`cppcoreguidelines-pro-type-const-cast`) - Replace C-style casts with `static_cast`. (`google-readability-casting`, cpplint: `readability/casting`) - Replace unsafe C-style casts with `dynamic_cast`. (`cppcoreguidelines-pro-type-cstyle-cast`) - Replace `static_cast` in downcasts with `dynamic_cast`. (`cppcoreguidelines-pro-type-static-cast-downcast`) - Replace `reinterpret_cast` with `static_cast` or `dynamic_cast`. (`cppcoreguidelines-pro-type-reinterpret-cast`) - Replace two-step casting through `void*` with `reinterpret_cast`. (`bugprone-casting-through-void`)
1 parent 7900bb8 commit 5de13ca

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎Tools/KFparticle/qaKFEventTrack.cxx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ struct qaKFEventTrack {
247247
template <typename T1, typename T2, typename T3, typename T4>
248248
void writeVarTree(const T1& /*kfpTrackPi*/, const T2& KFPion, const T2& KFPV, const T3& track, const int source, const int pVContrib, const int runNumber, const T4& collision)
249249
{
250-
const double pseudoRndm = track.pt() * 1000. - (int64_t)(track.pt() * 1000);
250+
const double pseudoRndm = track.pt() * 1000. - static_cast<int64_t>(track.pt() * 1000);
251251
if (pseudoRndm < d_DwnSmplFact) {
252252
if (writeTree) {
253253
/// Filling the tree
@@ -629,7 +629,7 @@ struct qaKFEvent {
629629
if (!isSelectedCollision(collisionIndex)) {
630630
continue;
631631
}
632-
timeColl = uint64_t((bc.globalBC() - bc0) * o2::constants::lhc::LHCBunchSpacingNS) + collisionIndex.collisionTime();
632+
timeColl = static_cast<uint64_t>((bc.globalBC() - bc0) * o2::constants::lhc::LHCBunchSpacingNS) + collisionIndex.collisionTime();
633633
writeVarTreeColl(collisionIndex, timeColl, bc.timestamp(), collisionIndex.collisionTime(), tfID);
634634
}
635635
}

‎Tools/KFparticle/qaKFParticleLc.cxx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ struct qaKFParticleLc {
416416
float chi2geo = KFLc.GetChi2() / KFLc.GetNDF();
417417
float normdecayLength = KFLc_PV.GetDecayLength() / KFLc_PV.GetErrDecayLength();
418418
float chi2topo = KFLc_PV.GetChi2() / KFLc_PV.GetNDF();
419-
const double pseudoRndm = trackKa.pt() * 1000. - (int64_t)(trackKa.pt() * 1000);
419+
const double pseudoRndm = trackKa.pt() * 1000. - static_cast<int64_t>(trackKa.pt() * 1000);
420420
if (pseudoRndm < d_DwnSmplFact) {
421421
/// Filling the D0 tree
422422
rowKFLc(runNumber,

0 commit comments

Comments
 (0)