Skip to content

Commit 1223729

Browse files
authored
[PWGCF] lambdaSpinPolarization.cxx: fix clang-tidy code-check errors from the previous version (#18229)
1 parent d4cc190 commit 1223729

1 file changed

Lines changed: 20 additions & 22 deletions

File tree

‎PWGCF/TwoParticleCorrelations/Tasks/lambdaSpinPolarization.cxx‎

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,9 @@
3030
#include <CommonConstants/MathConstants.h>
3131
#include <CommonConstants/PhysicsConstants.h>
3232
#include <Framework/ASoA.h>
33-
#include <Framework/ASoAHelpers.h>
3433
#include <Framework/AnalysisDataModel.h>
3534
#include <Framework/AnalysisHelpers.h>
3635
#include <Framework/AnalysisTask.h>
37-
#include <Framework/BinningPolicy.h>
3836
#include <Framework/Configurable.h>
3937
#include <Framework/HistogramRegistry.h>
4038
#include <Framework/HistogramSpec.h>
@@ -45,7 +43,6 @@
4543

4644
#include <TAxis.h>
4745
#include <TH1.h>
48-
#include <TH2.h>
4946
#include <THnBase.h>
5047
#include <TList.h>
5148
#include <TNamed.h>
@@ -1389,7 +1386,7 @@ struct LambdaSpinPolarization {
13891386

13901387
uint64_t pairOrderSeed = 0;
13911388
std::array<std::unique_ptr<THnBase>, 4> kinWeightMaps{};
1392-
std::vector<TAxis> legAxesRef{};
1389+
std::vector<TAxis> legAxesRef;
13931390
bool kinWeightsLoaded = false;
13941391

13951392
struct SharedDauCand {
@@ -1450,8 +1447,8 @@ struct LambdaSpinPolarization {
14501447
{
14511448
for (auto const& cand : event) {
14521449
const int64_t seq = seqBase + static_cast<int64_t>(slots.size());
1453-
slots.push_back(Slot{cand, NoSeq});
1454-
auto [it, isNew] = cells[cand.species()].try_emplace(cellKey(cand), Cell{seq, seq});
1450+
slots.push_back(Slot{.cand = cand, .next = NoSeq});
1451+
auto [it, isNew] = cells[cand.species()].try_emplace(cellKey(cand), Cell{.head = seq, .tail = seq});
14551452
if (!isNew) {
14561453
slot(it->second.tail).next = seq;
14571454
it->second.tail = seq;
@@ -1554,16 +1551,16 @@ struct LambdaSpinPolarization {
15541551

15551552
Grid grid{};
15561553
int maxEvents = 0;
1557-
std::deque<Slot> slots{};
1558-
std::deque<int> nPerEvent{};
1554+
std::deque<Slot> slots;
1555+
std::deque<int> nPerEvent;
15591556
int64_t seqBase = 0;
15601557
std::array<std::unordered_map<int64_t, Cell>, 2> cells{};
15611558
};
15621559

1563-
std::vector<RollingPool> mePools{};
1564-
std::vector<RollingPool> mePoolsGen{};
1565-
TAxis mePoolAxisCent{};
1566-
TAxis mePoolAxisVz{};
1560+
std::vector<RollingPool> mePools;
1561+
std::vector<RollingPool> mePoolsGen;
1562+
TAxis mePoolAxisCent;
1563+
TAxis mePoolAxisVz;
15671564

15681565
void init(InitContext const&)
15691566
{
@@ -1589,7 +1586,8 @@ struct LambdaSpinPolarization {
15891586
legAxesRef.emplace_back(static_cast<int>(edges.size()) - 1, edges.data());
15901587
}
15911588

1592-
if (!(cMassHistMin.value < cMassAccMin.value && cMassAccMax.value < cMassHistMax.value)) {
1589+
const bool massAxesContainWindow = cMassHistMin.value < cMassAccMin.value && cMassAccMax.value < cMassHistMax.value;
1590+
if (!massAxesContainWindow) {
15931591
LOGF(fatal, "The mass axes [%.4f, %.4f] must be wider than the accepted mass window [%.4f, %.4f]", cMassHistMin.value, cMassHistMax.value, cMassAccMin.value, cMassAccMax.value);
15941592
}
15951593
for (auto const& edge : {cMassAccMin.value, cMassAccMax.value}) {
@@ -1610,18 +1608,18 @@ struct LambdaSpinPolarization {
16101608
mePoolAxisCent.Set(static_cast<int>(centEdges.size()) - 1, centEdges.data());
16111609
mePoolAxisVz.Set(static_cast<int>(vzEdges.size()) - 1, vzEdges.data());
16121610

1613-
static constexpr std::array<double, 3> PoolSizeSteps = {1., 2., 5.};
1614-
static constexpr double PoolSizeDecade = 10.;
1615-
const double depth = std::max(1, cMEPoolDepth.value);
1611+
static constexpr std::array<int64_t, 3> PoolSizeSteps = {1, 2, 5};
1612+
static constexpr int64_t PoolSizeDecade = 10;
1613+
const int64_t depth = std::max(1, cMEPoolDepth.value);
16161614
std::vector<double> poolSizeEdges = {0.};
1617-
for (double decade = 1.; decade < depth; decade *= PoolSizeDecade) {
1615+
for (int64_t decade = 1; decade < depth; decade *= PoolSizeDecade) {
16181616
for (auto const& step : PoolSizeSteps) {
16191617
if (step * decade < depth) {
1620-
poolSizeEdges.push_back(step * decade);
1618+
poolSizeEdges.push_back(static_cast<double>(step * decade));
16211619
}
16221620
}
16231621
}
1624-
poolSizeEdges.push_back(depth);
1622+
poolSizeEdges.push_back(static_cast<double>(depth));
16251623
const AxisSpec axisPoolSize(poolSizeEdges, "events in the pool");
16261624

16271625
std::vector<std::string> mixQaDirs;
@@ -1658,7 +1656,7 @@ struct LambdaSpinPolarization {
16581656
grid.nRap = std::max(1, static_cast<int>(std::ceil((cMaxRap.value - cMinRap.value) / grid.cellRap)));
16591657
grid.nPhi = std::max(1, static_cast<int>(std::floor(TwoPI / cMaxDeltaPhi.value)));
16601658
grid.cellPhi = TwoPI / static_cast<float>(grid.nPhi);
1661-
const auto nPools = static_cast<std::size_t>(mePoolAxisCent.GetNbins() * mePoolAxisVz.GetNbins());
1659+
const auto nPools = static_cast<std::size_t>(mePoolAxisCent.GetNbins()) * static_cast<std::size_t>(mePoolAxisVz.GetNbins());
16621660
if (doprocessDataRecoMixed) {
16631661
mePools.assign(nPools, RollingPool(grid, cMEPoolDepth.value));
16641662
}
@@ -1968,7 +1966,7 @@ struct LambdaSpinPolarization {
19681966
return;
19691967
}
19701968
auto const* guard = dynamic_cast<TNamed const*>(list->FindObject("kinWeightGuardStatus"));
1971-
if (guard && !TString(guard->GetTitle()).BeginsWith("OK")) {
1969+
if (guard != nullptr && !TString(guard->GetTitle()).BeginsWith("OK")) {
19721970
LOGF(fatal, "Kinematic weights at %s are flagged by their builder: %s", cKinWeightCcdbPath.value.c_str(), guard->GetTitle());
19731971
return;
19741972
}
@@ -1979,7 +1977,7 @@ struct LambdaSpinPolarization {
19791977
LOGF(fatal, "Kinematic weights: %s is missing, or its axes differ from KinW/*/hLeg2_%s (pT, y, phi) of this configuration", name.c_str(), std::string(PairTag[i]).c_str());
19801978
return;
19811979
}
1982-
kinWeightMaps[i].reset(static_cast<THnBase*>(map->Clone()));
1980+
kinWeightMaps[i].reset(dynamic_cast<THnBase*>(map->Clone()));
19831981
}
19841982
auto const* form = dynamic_cast<TNamed const*>(list->FindObject("kinWeightForm"));
19851983
kinWeightsLoaded = true;

0 commit comments

Comments
 (0)