Skip to content

Commit afc6a46

Browse files
matarzilclaude
andcommitted
Fix remaining code-check findings: unused members, dead code, const-correctness
Removes the dead kSphMin constant and yLead variable, adds [[maybe_unused]] to the struct members and bookChannel lambda parameters that are only referenced inside the disabled histogram-budget blocks, and adds const to those same lambda parameters per cppcheck's constParameterReference suggestion. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YbYBgosEJaDJTkCuqAtNHk
1 parent 4b4b132 commit afc6a46

1 file changed

Lines changed: 27 additions & 26 deletions

File tree

‎PWGCF/TwoParticleCorrelations/Tasks/twoParticleCorrelationsMultSpher.cxx‎

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,13 @@
2727
///
2828
/// \author Madalina Tarzila
2929

30-
#include <Framework/ASoAHelpers.h>
30+
#include <Framework/AnalysisDataModel.h>
3131
#include <Framework/AnalysisTask.h>
32+
#include <Framework/Configurable.h>
33+
#include <Framework/HistogramRegistry.h>
34+
#include <Framework/HistogramSpec.h>
35+
#include <Framework/InitContext.h>
36+
#include <Framework/OutputObjHeader.h>
3237
#include <Framework/runDataProcessing.h>
3338

3439
// Reco headers — compiled but used only by processReco (switched off for now)
@@ -45,6 +50,7 @@
4550
#include <TMath.h>
4651
#include <TString.h>
4752

53+
#include <algorithm>
4854
#include <array>
4955
#include <cmath>
5056
#include <deque>
@@ -69,7 +75,6 @@ static constexpr const char* kPidNames[kNPidSpecies] = {"unid", "pion", "kaon",
6975
// Sphericity classes
7076
// ============================================================
7177
static constexpr int nSphClasses = 4;
72-
static constexpr double kSphMin[nSphClasses] = {0.0, 0.3, 0.6, 0.0};
7378
static constexpr double kSphMax[nSphClasses] = {0.3, 0.6, 1.0, 1.0};
7479
static constexpr const char* kSphLabels[nSphClasses] =
7580
{"jetty", "intermediate", "isotropic", "all"};
@@ -148,8 +153,8 @@ struct myExampleTask {
148153
float phi;
149154
float eta;
150155
float pt;
151-
float y; // rapidity (from mass + kinematics); = eta for unidentified
152-
int pdg; // PDG code: used only for SE sparse/TH2; 0 for reco
156+
[[maybe_unused]] float y; // rapidity (from mass + kinematics); = eta for unidentified
157+
int pdg; // PDG code: used only for SE sparse/TH2; 0 for reco
153158
};
154159

155160
// ----------------------------------------------------------------
@@ -236,7 +241,7 @@ struct myExampleTask {
236241
// pid 1-3 correspond to kPion=1, kKaon=2, kProton=3.
237242
// ----------------------------------------------------------------
238243
static constexpr int nPidStudy = 4; // all + pion + kaon + proton
239-
static constexpr const char* kPidStudyLabels[nPidStudy] = {"all", "pion", "kaon", "proton"};
244+
[[maybe_unused]] static constexpr const char* kPidStudyLabels[nPidStudy] = {"all", "pion", "kaon", "proton"};
240245

241246
// pT (all selected tracks) × multBin — MC e Reco separati
242247
std::array<std::array<std::shared_ptr<TH2>, nPidStudy>, nSphClasses> hPt_sph_pid_MC{};
@@ -432,12 +437,10 @@ struct myExampleTask {
432437
{
433438
if (sph <= 0.)
434439
return -1;
435-
if (sph <= 0.3)
436-
return 0;
437-
if (sph <= 0.6)
438-
return 1;
439-
if (sph <= 1.0)
440-
return 2;
440+
for (int ic = 0; ic < nSphClasses - 1; ++ic) {
441+
if (sph <= kSphMax[ic])
442+
return ic;
443+
}
441444
return -1;
442445
}
443446

@@ -556,17 +559,17 @@ struct myExampleTask {
556559
std::shared_ptr<TH2>& hNtrig_,
557560
std::array<std::shared_ptr<TH2>, nPidCorr>& hNtrigPID_,
558561
std::array<std::shared_ptr<TH1>, nMultBins>& hSphMult_,
559-
std::array<std::array<std::shared_ptr<TH2>, nPidStudy>, nSphClasses>& hPt_sph_pid_,
560-
std::array<std::array<std::shared_ptr<TH2>, nPidStudy>, nSphClasses>& hPtLead_sph_pid_,
561-
std::array<std::array<std::shared_ptr<TH2>, nPidStudy>, nSphClasses>& hPtAssoc_sph_pid_,
562-
std::array<std::shared_ptr<TH2>, nPidStudy>& hSph_vs_mult_pid_,
563-
std::array<std::shared_ptr<TH2>, nPidStudy>& hMult_vs_sph_pid_,
564-
std::array<std::shared_ptr<TH2>, nPidStudy>& hSphTrack_vs_mult_pid_,
565-
std::array<std::shared_ptr<TH2>, nPidStudy>& hMultTrack_vs_sph_pid_,
566-
std::array<std::shared_ptr<TH2>, nPidStudy>& hSphLead_vs_mult_pid_,
567-
std::array<std::shared_ptr<TH2>, nPidStudy>& hMultLead_vs_sph_pid_,
568-
std::array<std::shared_ptr<TH2>, nPidStudy>& hMultReal_vs_sph_pid_,
569-
std::shared_ptr<TH2>& hMultReal_vs_pid_) {
562+
[[maybe_unused]] const std::array<std::array<std::shared_ptr<TH2>, nPidStudy>, nSphClasses>& hPt_sph_pid_,
563+
[[maybe_unused]] const std::array<std::array<std::shared_ptr<TH2>, nPidStudy>, nSphClasses>& hPtLead_sph_pid_,
564+
[[maybe_unused]] const std::array<std::array<std::shared_ptr<TH2>, nPidStudy>, nSphClasses>& hPtAssoc_sph_pid_,
565+
[[maybe_unused]] const std::array<std::shared_ptr<TH2>, nPidStudy>& hSph_vs_mult_pid_,
566+
[[maybe_unused]] const std::array<std::shared_ptr<TH2>, nPidStudy>& hMult_vs_sph_pid_,
567+
[[maybe_unused]] const std::array<std::shared_ptr<TH2>, nPidStudy>& hSphTrack_vs_mult_pid_,
568+
[[maybe_unused]] const std::array<std::shared_ptr<TH2>, nPidStudy>& hMultTrack_vs_sph_pid_,
569+
[[maybe_unused]] const std::array<std::shared_ptr<TH2>, nPidStudy>& hSphLead_vs_mult_pid_,
570+
[[maybe_unused]] const std::array<std::shared_ptr<TH2>, nPidStudy>& hMultLead_vs_sph_pid_,
571+
[[maybe_unused]] const std::array<std::shared_ptr<TH2>, nPidStudy>& hMultReal_vs_sph_pid_,
572+
[[maybe_unused]] const std::shared_ptr<TH2>& hMultReal_vs_pid_) {
570573
// QA
571574
// evSel bins: 1=read 2=zvtx 3=multBin 4=zvtxBin 5=leadPt 6=ST_valid 7=sphClass 8=SE_filled
572575
auto hQA = histos.add<TH1>(Form("evSel_%s", suf), Form("Event selection (%s)", suf), HistType::kTH1D, {{8, 0.5, 8.5}});
@@ -851,7 +854,7 @@ struct myExampleTask {
851854
std::vector<TrackSimple> selTracks;
852855
selTracks.reserve(64);
853856
int leadIdx = -1;
854-
double pTlead = -1., phiLead = 0., etaLead = 0., yLead = 0.;
857+
double pTlead = -1., phiLead = 0., etaLead = 0.;
855858

856859
for (const auto& p : mcParticles) {
857860
if (!p.isPhysicalPrimary())
@@ -890,7 +893,6 @@ struct myExampleTask {
890893
pTlead = p.pt();
891894
phiLead = p.phi();
892895
etaLead = p.eta();
893-
yLead = rap;
894896
leadIdx = idx;
895897
}
896898
}
@@ -1201,7 +1203,7 @@ struct myExampleTask {
12011203
std::vector<TrackSimple> selTracks;
12021204
selTracks.reserve(64);
12031205
int leadIdx = -1;
1204-
double pTlead = -1., phiLead = 0., etaLead = 0., yLead = 0.;
1206+
double pTlead = -1., phiLead = 0., etaLead = 0.;
12051207

12061208
for (const auto& track : tracks) {
12071209
hTrackCutDebug_Reco->Fill(1); // seen
@@ -1265,7 +1267,6 @@ struct myExampleTask {
12651267
pTlead = track.pt();
12661268
phiLead = track.phi();
12671269
etaLead = track.eta();
1268-
yLead = rap;
12691270
leadIdx = idx;
12701271
}
12711272
}

0 commit comments

Comments
 (0)