From 250033f7d63292115db3d0f4df5c3fb3e961507b Mon Sep 17 00:00:00 2001 From: cnkoster Date: Thu, 13 Aug 2026 16:04:00 +0200 Subject: [PATCH 1/2] Fix more linter issues --- PWGCF/Flow/TableProducer/zdcQVectors.cxx | 26 +++++++++++++--- .../EventPlane/src/spectatorPlaneTutorial.cxx | 30 ++++++++++--------- 2 files changed, 38 insertions(+), 18 deletions(-) diff --git a/PWGCF/Flow/TableProducer/zdcQVectors.cxx b/PWGCF/Flow/TableProducer/zdcQVectors.cxx index d82e83b052c..cfc6ba9ebb2 100644 --- a/PWGCF/Flow/TableProducer/zdcQVectors.cxx +++ b/PWGCF/Flow/TableProducer/zdcQVectors.cxx @@ -55,7 +55,7 @@ #include #include -#define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable NAME{#NAME, DEFAULT, HELP}; +#define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable NAME{#NAME, (DEFAULT), (HELP)}; using namespace o2; using namespace o2::framework; @@ -200,7 +200,7 @@ struct ZdcQVectors { std::unique_ptr fMultCutHigh = nullptr; std::unique_ptr fMultMultPVCut = nullptr; - Service ccdb; + Service ccdb{}; // keep track of calibration histos for each given step and iteration struct Calib { @@ -713,7 +713,13 @@ struct ZdcQVectors { hist = dynamic_cast(list->FindObject(Form("%s", objName))); } else if (cm == kTimestamp) { auto list = dynamic_cast(cal.calibList[cm]->FindObject(Form("it%i_step%i", iteration, step))); + if (!list) { + LOGF(fatal, "No calibration list for iteration %i and step %i", iteration, step); + } hist = dynamic_cast(list->FindObject(Form("%s", objName))); + if (!hist) { + LOGF(fatal, "No calibration histo for iteration %i and step %i -> %s", iteration, step, objName); + } } else if (cm == kRec) { auto list = dynamic_cast(cal.calibList[cm]->FindObject(Form("it%i_step%i", iteration, step))); if (!list) { @@ -733,12 +739,15 @@ struct ZdcQVectors { if (hist->InheritsFrom("TProfile2D")) { // needed for energy calibration! auto h = dynamic_cast(hist); + if(h){ TString name = h->GetName(); int binrunnumber = h->GetXaxis()->FindBin(TString::Format("%d", cal.runnumber)); int bin = h->GetYaxis()->FindBin(cal.centrality); calibConstant = h->GetBinContent(binrunnumber, bin); + } } else if (hist->InheritsFrom("TProfile")) { auto h = dynamic_cast(hist); + if(h){ TString name = h->GetName(); int bin{}; if (name.Contains("mean_vx")) { @@ -760,9 +769,11 @@ struct ZdcQVectors { bin = h->GetXaxis()->FindBin(cal.timestamp); } calibConstant = h->GetBinContent(bin); + } } else if (hist->InheritsFrom("THnSparse")) { std::vector sparsePars; auto h = dynamic_cast(hist); + if(h){ sparsePars.push_back(h->GetAxis(0)->FindBin(cal.centrality)); sparsePars.push_back(h->GetAxis(1)->FindBin(cal.v[0])); sparsePars.push_back(h->GetAxis(2)->FindBin(cal.v[1])); @@ -783,6 +794,7 @@ struct ZdcQVectors { delete tempProj; } + } return calibConstant; } @@ -1157,8 +1169,14 @@ struct ZdcQVectors { if (!cfgCCDBdir_Shift.value.empty() && !cal.isShiftProfileFound) { LOGF(info, "Getting shift profile from CCDB for runnumber: %d", runnumber); TList* hcorrList = ccdb->getForTimeStamp(cfgCCDBdir_Shift.value, foundBC.timestamp()); - cal.shiftprofileC = dynamic_cast(hcorrList->FindObject("ShiftZDCC")); - cal.shiftprofileA = dynamic_cast(hcorrList->FindObject("ShiftZDCA")); + auto shiftProfileC = dynamic_cast(hcorrList->FindObject("ShiftZDCC")); + if(shiftProfileC) { + cal.shiftprofileC = shiftProfileC; + } + auto shiftProfileA = dynamic_cast(hcorrList->FindObject("ShiftZDCA")); + if(shiftProfileA) { + cal.shiftprofileA = shiftProfileA; + } if (!cal.shiftprofileC || !cal.shiftprofileA) { LOGF(error, "Shift profile not found in CCDB for runnumber: %d", runnumber); cal.isShiftProfileFound = false; diff --git a/Tutorials/PWGCF/EventPlane/src/spectatorPlaneTutorial.cxx b/Tutorials/PWGCF/EventPlane/src/spectatorPlaneTutorial.cxx index d99a16fb996..4c9e35fa23c 100644 --- a/Tutorials/PWGCF/EventPlane/src/spectatorPlaneTutorial.cxx +++ b/Tutorials/PWGCF/EventPlane/src/spectatorPlaneTutorial.cxx @@ -102,8 +102,8 @@ struct SpectatorPlaneTutorial { AxisSpec axisEta = {64, -1.6, 1.6, "#eta"}; AxisSpec axisEtaVn = {8, -.8, .8, "#eta"}; AxisSpec axisCent = {90, 0, 90, "Centrality(%)"}; - AxisSpec axisPhiPlane = {100, -constants::math::PI, constants::math::PI, "#Psi"}; - AxisSpec axisQQ = {100, -0.2, 0.2, "#LT Q_{X}^{A}Q_{Y}^{C} #GT"}; + AxisSpec axisPhiPlane = {40, -constants::math::PI, constants::math::PI, "#Psi"}; + AxisSpec axisQQ = {10, -0.2, 0.2, "#LT Q_{X}^{A}Q_{Y}^{C} #GT"}; std::vector ptbinning = {0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.2, 2.4, 2.6, 2.8, 3, 3.5, 4, 5, 6, 8, 10}; AxisSpec axisPt = {ptbinning, "#it{p}_{T} GeV/#it{c}"}; @@ -127,13 +127,13 @@ struct SpectatorPlaneTutorial { registry.add("CalibHistos/hEvPlaneRes", "Event Plane Resolution; #Events; Event Plane Resolution", {HistType::kTProfile, {axisCent}}); // Flow Histograms - registry.add("flow/v1A", "", {HistType::kTProfile, {axisPt}}); - registry.add("flow/v1C", "", {HistType::kTProfile, {axisPt}}); + registry.add("flow/v1A", "", {HistType::kTProfile, {axisEtaVn}}); + registry.add("flow/v1C", "", {HistType::kTProfile, {axisEtaVn}}); - registry.add("flow/vnAxCxUxMH", "", {HistType::kTProfile, {axisCent}}); - registry.add("flow/vnAyCyUxMH", "", {HistType::kTProfile, {axisCent}}); - registry.add("flow/vnAxCyUyMH", "", {HistType::kTProfile, {axisCent}}); - registry.add("flow/vnAyCxUyMH", "", {HistType::kTProfile, {axisCent}}); + registry.add("flow/v2AxCxUxMH", "", {HistType::kTProfile, {axisCent}}); + registry.add("flow/v2AyCyUxMH", "", {HistType::kTProfile, {axisCent}}); + registry.add("flow/v2AxCyUyMH", "", {HistType::kTProfile, {axisCent}}); + registry.add("flow/v2AyCxUyMH", "", {HistType::kTProfile, {axisCent}}); } void process(ZDCCollisions::iterator const& collision, aod::BCsWithTimestamps const&, UsedTracks const& tracks) @@ -147,7 +147,7 @@ struct SpectatorPlaneTutorial { float centMin = 0; float centMax = 80; - if (centrality > centMax || centrality < centMin) + if (centrality >= centMax || centrality < centMin) return; if (collision.isSelected() == false) @@ -174,10 +174,10 @@ struct SpectatorPlaneTutorial { // Fill the q-vector correlations registry.fill(HIST("qAqCXY"), centrality, qxA * qxC + qyA * qyC); - double corrQQx = 1; - double corrQQy = 1; - double corrQQ = 1; - double evPlaneRes = 1; + double corrQQx = 1.0; + double corrQQy = 1.0; + double corrQQ = 1.0 ; + double evPlaneRes = 1.0; // Get QQ-correlations from CCDB if (cfgCCDBdir_QQ.value.empty() == false) { @@ -200,7 +200,6 @@ struct SpectatorPlaneTutorial { } for (const auto& track : tracks) { - // constrain angle to 0 -> [0,0+2pi] auto phi = RecoDecay::constrainAngle(track.phi(), 0); @@ -210,6 +209,9 @@ struct SpectatorPlaneTutorial { double uxMH = std::cos(2 * phi); double uyMH = std::sin(2 * phi); + if(corrQQ==0 || corrQQx==0 || corrQQy==0) + continue; + double v1A = (uy * qyA + ux * qxA) / std::sqrt(std::fabs(corrQQ)); double v1C = (uy * qyC + ux * qxC) / std::sqrt(std::fabs(corrQQ)); From 2ea5452f490746ddbfb248e5e3d612c5cccc8b11 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Thu, 13 Aug 2026 14:04:43 +0000 Subject: [PATCH 2/2] Please consider the following formatting changes --- PWGCF/Flow/TableProducer/zdcQVectors.cxx | 94 +++++++++---------- .../EventPlane/src/spectatorPlaneTutorial.cxx | 4 +- 2 files changed, 49 insertions(+), 49 deletions(-) diff --git a/PWGCF/Flow/TableProducer/zdcQVectors.cxx b/PWGCF/Flow/TableProducer/zdcQVectors.cxx index cfc6ba9ebb2..8bfc52a1d3a 100644 --- a/PWGCF/Flow/TableProducer/zdcQVectors.cxx +++ b/PWGCF/Flow/TableProducer/zdcQVectors.cxx @@ -739,61 +739,61 @@ struct ZdcQVectors { if (hist->InheritsFrom("TProfile2D")) { // needed for energy calibration! auto h = dynamic_cast(hist); - if(h){ - TString name = h->GetName(); - int binrunnumber = h->GetXaxis()->FindBin(TString::Format("%d", cal.runnumber)); - int bin = h->GetYaxis()->FindBin(cal.centrality); - calibConstant = h->GetBinContent(binrunnumber, bin); + if (h) { + TString name = h->GetName(); + int binrunnumber = h->GetXaxis()->FindBin(TString::Format("%d", cal.runnumber)); + int bin = h->GetYaxis()->FindBin(cal.centrality); + calibConstant = h->GetBinContent(binrunnumber, bin); } } else if (hist->InheritsFrom("TProfile")) { auto h = dynamic_cast(hist); - if(h){ - TString name = h->GetName(); - int bin{}; - if (name.Contains("mean_vx")) { - bin = h->GetXaxis()->FindBin(cal.v[0]); - } - if (name.Contains("mean_vy")) { - bin = h->GetXaxis()->FindBin(cal.v[1]); - } - if (name.Contains("mean_vz")) { - bin = h->GetXaxis()->FindBin(cal.v[2]); - } - if (name.Contains("mean_cent")) { - bin = h->GetXaxis()->FindBin(cal.centrality); - } - if (name.Contains("vertex")) { - bin = h->GetXaxis()->FindBin(TString::Format("%i", cal.runnumber)); - } - if (name.Contains("timestamp")) { - bin = h->GetXaxis()->FindBin(cal.timestamp); + if (h) { + TString name = h->GetName(); + int bin{}; + if (name.Contains("mean_vx")) { + bin = h->GetXaxis()->FindBin(cal.v[0]); + } + if (name.Contains("mean_vy")) { + bin = h->GetXaxis()->FindBin(cal.v[1]); + } + if (name.Contains("mean_vz")) { + bin = h->GetXaxis()->FindBin(cal.v[2]); + } + if (name.Contains("mean_cent")) { + bin = h->GetXaxis()->FindBin(cal.centrality); + } + if (name.Contains("vertex")) { + bin = h->GetXaxis()->FindBin(TString::Format("%i", cal.runnumber)); + } + if (name.Contains("timestamp")) { + bin = h->GetXaxis()->FindBin(cal.timestamp); + } + calibConstant = h->GetBinContent(bin); } - calibConstant = h->GetBinContent(bin); - } } else if (hist->InheritsFrom("THnSparse")) { std::vector sparsePars; auto h = dynamic_cast(hist); - if(h){ - sparsePars.push_back(h->GetAxis(0)->FindBin(cal.centrality)); - sparsePars.push_back(h->GetAxis(1)->FindBin(cal.v[0])); - sparsePars.push_back(h->GetAxis(2)->FindBin(cal.v[1])); - sparsePars.push_back(h->GetAxis(3)->FindBin(cal.v[2])); - - for (std::size_t i = 0; i < sparsePars.size(); i++) { - h->GetAxis(i)->SetRange(sparsePars[i], sparsePars[i]); - } + if (h) { + sparsePars.push_back(h->GetAxis(0)->FindBin(cal.centrality)); + sparsePars.push_back(h->GetAxis(1)->FindBin(cal.v[0])); + sparsePars.push_back(h->GetAxis(2)->FindBin(cal.v[1])); + sparsePars.push_back(h->GetAxis(3)->FindBin(cal.v[2])); + + for (std::size_t i = 0; i < sparsePars.size(); i++) { + h->GetAxis(i)->SetRange(sparsePars[i], sparsePars[i]); + } - auto tempProj = h->Projection(4); - calibConstant = tempProj->GetMean(); + auto tempProj = h->Projection(4); + calibConstant = tempProj->GetMean(); - if (tempProj->GetEntries() < cfgMinEntriesSparseBin) { - LOGF(debug, "1 entry in sparse bin! Not used... (increase binsize)"); - calibConstant = 0; - cal.isSelected = false; - } + if (tempProj->GetEntries() < cfgMinEntriesSparseBin) { + LOGF(debug, "1 entry in sparse bin! Not used... (increase binsize)"); + calibConstant = 0; + cal.isSelected = false; + } - delete tempProj; - } + delete tempProj; + } } return calibConstant; @@ -1170,11 +1170,11 @@ struct ZdcQVectors { LOGF(info, "Getting shift profile from CCDB for runnumber: %d", runnumber); TList* hcorrList = ccdb->getForTimeStamp(cfgCCDBdir_Shift.value, foundBC.timestamp()); auto shiftProfileC = dynamic_cast(hcorrList->FindObject("ShiftZDCC")); - if(shiftProfileC) { + if (shiftProfileC) { cal.shiftprofileC = shiftProfileC; } auto shiftProfileA = dynamic_cast(hcorrList->FindObject("ShiftZDCA")); - if(shiftProfileA) { + if (shiftProfileA) { cal.shiftprofileA = shiftProfileA; } if (!cal.shiftprofileC || !cal.shiftprofileA) { diff --git a/Tutorials/PWGCF/EventPlane/src/spectatorPlaneTutorial.cxx b/Tutorials/PWGCF/EventPlane/src/spectatorPlaneTutorial.cxx index 4c9e35fa23c..b7a8074f013 100644 --- a/Tutorials/PWGCF/EventPlane/src/spectatorPlaneTutorial.cxx +++ b/Tutorials/PWGCF/EventPlane/src/spectatorPlaneTutorial.cxx @@ -176,7 +176,7 @@ struct SpectatorPlaneTutorial { double corrQQx = 1.0; double corrQQy = 1.0; - double corrQQ = 1.0 ; + double corrQQ = 1.0; double evPlaneRes = 1.0; // Get QQ-correlations from CCDB @@ -209,7 +209,7 @@ struct SpectatorPlaneTutorial { double uxMH = std::cos(2 * phi); double uyMH = std::sin(2 * phi); - if(corrQQ==0 || corrQQx==0 || corrQQy==0) + if (corrQQ == 0 || corrQQx == 0 || corrQQy == 0) continue; double v1A = (uy * qyA + ux * qxA) / std::sqrt(std::fabs(corrQQ));