Skip to content

Commit

Permalink
Fix casting
Browse files Browse the repository at this point in the history
  • Loading branch information
vkucera committed Nov 15, 2023
1 parent bb6e421 commit a5bf3c7
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions exec/utils_validation.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Int_t MakePlots(const VecSpecVecSpec& vecSpecVecSpec, TString pathFileO2 = "Anal
auto vecSpec = std::get<1>(specVecSpec); // list of histogram specs.
int nPadsX = std::get<2>(specVecSpec); // number of horizontal pads
int nPadsY = std::get<3>(specVecSpec); // number of vertical pads
Printf("\nProcessing histogram list: %s (%d)", nameSpec.Data(), (int)vecSpec.size());
Printf("\nProcessing histogram list: %s (%lu)", nameSpec.Data(), vecSpec.size());
if (nPadsX * nPadsY < vecSpec.size()) {
Printf("Not enough pads (%d)", nPadsX * nPadsY);
return 1;
Expand All @@ -109,7 +109,7 @@ Int_t MakePlots(const VecSpecVecSpec& vecSpecVecSpec, TString pathFileO2 = "Anal
projAx = std::get<6>(spec);

// Get AliPhysics histogram.
hAli = (TH1F*)lAli->FindObject(nameHisAli.Data());
hAli = reinterpret_cast<TH1F*>(lAli->FindObject(nameHisAli.Data()));
if (!hAli) {
printf("Failed to load %s from %s\n", nameHisAli.Data(), pathFileAli.Data());
return 1;
Expand All @@ -124,18 +124,18 @@ Int_t MakePlots(const VecSpecVecSpec& vecSpecVecSpec, TString pathFileO2 = "Anal

if (oO2->InheritsFrom("TH3")) {
if (projAx == "x") {
hO2 = ((TH3D*)oO2)->ProjectionX();
hO2 = (reinterpret_cast<TH3D*>(oO2))->ProjectionX();
} else if (projAx == "y") {
hO2 = ((TH3D*)oO2)->ProjectionY();
hO2 = (reinterpret_cast<TH3D*>(oO2))->ProjectionY();
}
} else if (oO2->InheritsFrom("TH2")) {
if (projAx == "x") {
hO2 = ((TH2D*)oO2)->ProjectionX();
hO2 = (reinterpret_cast<TH2D*>(oO2))->ProjectionX();
} else if (projAx == "y") {
hO2 = ((TH2D*)oO2)->ProjectionY();
hO2 = (reinterpret_cast<TH2D*>(oO2))->ProjectionY();
}
} else {
hO2 = (TH1D*)oO2;
hO2 = reinterpret_cast<TH1D*>(oO2);
}

Printf("%d (%s, %s): bins: %d, %d, ranges: %g-%g, %g-%g",
Expand Down Expand Up @@ -171,9 +171,9 @@ Int_t MakePlots(const VecSpecVecSpec& vecSpecVecSpec, TString pathFileO2 = "Anal
// Ratio
if (doRatio) {
auto padR = canRat->cd(index + 1);
hRatio = (TH1F*)hO2->Clone(Form("hRatio%d", index));
hRatio = reinterpret_cast<TH1F*>(hO2->Clone(Form("hRatio%d", index)));
hRatio->Divide(hAli);
hRatio->SetTitle(Form("Entries ratio: %g;%s;O^{2}/Ali", (double)nO2 / (double)nAli, labelAxis.Data()));
hRatio->SetTitle(Form("Entries ratio: %g;%s;O^{2}/Ali", static_cast<float>(nO2) / static_cast<float>(nAli), labelAxis.Data()));
yMin = hRatio->GetMinimum(0);
yMax = hRatio->GetMaximum();
SetHistogram(hRatio, yMin, yMax, marginRLow, marginRHigh, logScaleR);
Expand Down

0 comments on commit a5bf3c7

Please sign in to comment.