Skip to content

Commit 38e05a0

Browse files
committed
fix static analysis and code quality check errors
1 parent a5e9275 commit 38e05a0

1 file changed

Lines changed: 23 additions & 17 deletions

File tree

PWGCF/EbyEFluctuations/Tasks/FactorialMomentsTask.cxx

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,12 @@
4747
#include <cmath>
4848
#include <cstdlib>
4949
#include <memory>
50-
#include <string_view>
50+
5151
#include <vector>
5252

5353
using namespace o2;
5454
using namespace o2::framework;
5555
using namespace o2::framework::expressions;
56-
TH1D* tmpFqErr[6][5][52];
57-
float collisionZ = 0.f;
5856
struct FactorialMomentsTask {
5957
Configurable<bool> useITS{"useITS", false, "Select tracks with ITS"};
6058
Configurable<bool> useTPC{"useTPC", false, "Select tracks with TPC"};
@@ -167,9 +165,10 @@ struct FactorialMomentsTask {
167165
},
168166
OutputObjHandlingPolicy::AnalysisObject,
169167
true};
170-
const double dcaxyMaxTrackPar0 = 0.0105;
171-
const double dcaxyMaxTrackPar1 = 0.035;
172-
const double dcaxyMaxTrackPar2 = 1.1;
168+
float collisionZ = 0.f;
169+
double dcaxyMaxTrackPar0 = 0.0105;
170+
double dcaxyMaxTrackPar1 = 0.035;
171+
double dcaxyMaxTrackPar2 = 1.1;
173172
static const int nBins = 52;
174173
double kMinCharge = 1e-6;
175174
static const int nfqOrder = 6;
@@ -182,6 +181,7 @@ struct FactorialMomentsTask {
182181
std::array<std::array<double, nBins>, 5> binConEvent{};
183182
std::array<std::array<std::array<double, nBins>, 5>, 6> binConEventSampled{};
184183
std::array<std::array<std::array<int, nBins>, 5>, nfqOrder> nSubsamples{};
184+
std::array<std::array<std::array<TH1D*, nBins>, 5>, nfqOrder> tmpFqErr{};
185185
std::vector<std::shared_ptr<TH2>> mHistArrReset;
186186
std::vector<std::shared_ptr<TH1>> mHistArrQA;
187187
std::vector<std::shared_ptr<TH3>> mHistArrEff;
@@ -200,7 +200,7 @@ struct FactorialMomentsTask {
200200
ptCuts.value[2 * i + 1] = 0;
201201
}
202202
}
203-
AxisSpec axisPt[5] = {{100, -0.01, 3 * ptCuts.value[1], ""}, {100, -0.01, 3 * ptCuts.value[3], ""}, {100, -0.01, 3 * ptCuts.value[5], ""}, {100, -0.01, 3 * ptCuts.value[7], ""}, {100, -0.01, 3 * ptCuts.value[9], ""}}; // pT axis
203+
std::array<AxisSpec, 5> axisPt = {AxisSpec{100, -0.01, 3 * ptCuts.value[1], ""}, AxisSpec{100, -0.01, 3 * ptCuts.value[3], ""}, AxisSpec{100, -0.01, 3 * ptCuts.value[5], ""}, AxisSpec{100, -0.01, 3 * ptCuts.value[7], ""}, AxisSpec{100, -0.01, 3 * ptCuts.value[9], ""}}; // pT axis
204204
auto mEventSelected = std::get<std::shared_ptr<TH1>>(histos.add("mEventSelected", "eventSelected", HistType::kTH1D, {{7, 0.5, 8.5}}));
205205
mEventSelected->GetXaxis()->SetBinLabel(0, "all");
206206
mEventSelected->GetXaxis()->SetBinLabel(1, "sel8");
@@ -283,7 +283,7 @@ struct FactorialMomentsTask {
283283
for (int iPt = 0; iPt < numPt; ++iPt) {
284284
for (int iM = 0; iM < nBins; ++iM) {
285285
binContent = 0;
286-
double sumfqBin[6] = {0};
286+
std::array<double, 6> sumfqBin{0.};
287287

288288
for (int iEta = 1; iEta <= hist[iPt * nBins + iM]->GetNbinsX(); ++iEta) {
289289
for (int iPhi = 1; iPhi <= hist[iPt * nBins + iM]->GetNbinsY(); ++iPhi) {
@@ -293,7 +293,7 @@ struct FactorialMomentsTask {
293293
for (int iq = 0; iq < nfqOrder; ++iq) {
294294
double fqBin = 0;
295295
if (binconVal >= iq + 2) {
296-
fqBin = TMath::Factorial(binconVal) / (TMath::Factorial(binconVal - (iq + 2)));
296+
fqBin = TMath::Factorial(static_cast<Int_t>(binconVal)) / (TMath::Factorial(static_cast<Int_t>(binconVal) - (iq + 2)));
297297
}
298298
if (std::isnan(fqBin)) {
299299
break;
@@ -384,12 +384,15 @@ struct FactorialMomentsTask {
384384
fqEvent = {{{{{0, 0, 0, 0, 0, 0}}}}};
385385
binConEvent = {{{0, 0, 0, 0, 0}}};
386386
for (auto const& track : tracks) {
387-
if (useITS && !track.hasITS())
387+
if (useITS && !track.hasITS()) {
388388
continue;
389-
if (useTPC && !track.hasTPC())
389+
}
390+
if (useTPC && !track.hasTPC()) {
390391
continue;
391-
if (useGlobal && !track.isGlobalTrack())
392+
}
393+
if (useGlobal && !track.isGlobalTrack()) {
392394
continue;
395+
}
393396

394397
if (std::fabs(track.dcaXY()) < (dcaxyMaxTrackPar0 + dcaxyMaxTrackPar1 / std::pow(track.pt(), dcaxyMaxTrackPar2))) {
395398
histos.fill(HIST("mCollID"), track.collisionId());
@@ -464,12 +467,15 @@ struct FactorialMomentsTask {
464467
fqEvent = {{{{{0, 0, 0, 0, 0, 0}}}}};
465468
binConEvent = {{{0, 0, 0, 0, 0}}};
466469
for (auto const& track : colltracks) {
467-
if (useITS && !track.hasITS())
470+
if (useITS && !track.hasITS()) {
468471
continue;
469-
if (useTPC && !track.hasTPC())
472+
}
473+
if (useTPC && !track.hasTPC()) {
470474
continue;
471-
if (useGlobal && !track.isGlobalTrack())
475+
}
476+
if (useGlobal && !track.isGlobalTrack()) {
472477
continue;
478+
}
473479
if (std::fabs(track.dcaXY()) < (dcaxyMaxTrackPar0 + dcaxyMaxTrackPar1 / std::pow(track.pt(), dcaxyMaxTrackPar2))) {
474480
histos.fill(HIST("mCollID"), track.collisionId());
475481
histos.fill(HIST("mEta"), track.eta());
@@ -538,7 +544,7 @@ struct FactorialMomentsTask {
538544
BCsWithRun2Info const&)
539545
{
540546
auto bc = coll.bc_as<BCsWithRun2Info>();
541-
if (!(bc.eventCuts() & BIT(aod::Run2EventCuts::kAliEventCutsAccepted))) {
547+
if (!(static_cast<bool>(bc.eventCuts() & BIT(aod::Run2EventCuts::kAliEventCutsAccepted)))) {
542548
return;
543549
}
544550
if (coll.centRun2V0M() < centLimits.value[0] || coll.centRun2V0M() > centLimits.value[1]) {
@@ -666,4 +672,4 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
666672
return WorkflowSpec{
667673
adaptAnalysisTask<FactorialMomentsTask>(cfgc),
668674
};
669-
}
675+
}

0 commit comments

Comments
 (0)