Skip to content

Commit dc0f8a3

Browse files
committed
Fix casts
Fixes C-style, redundant, wrong, and dangerous casts (found by Clang-Tidy and cpplint). - Remove redundant casts. (`readability-redundant-casting`) - Remove `const_cast`. (`cppcoreguidelines-pro-type-const-cast`) - Replace C-style casts with `static_cast`. (`google-readability-casting`, cpplint: `readability/casting`) - Replace unsafe C-style casts with `dynamic_cast`. (`cppcoreguidelines-pro-type-cstyle-cast`) - Replace `static_cast` in downcasts with `dynamic_cast`. (`cppcoreguidelines-pro-type-static-cast-downcast`) - Replace `reinterpret_cast` with `static_cast` or `dynamic_cast`. (`cppcoreguidelines-pro-type-reinterpret-cast`) - Replace two-step casting through `void*` with `reinterpret_cast`. (`bugprone-casting-through-void`)
1 parent 7900bb8 commit dc0f8a3

127 files changed

Lines changed: 930 additions & 930 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎PWGCF/Core/CorrelationContainer.cxx‎

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ CorrelationContainer::CorrelationContainer(const CorrelationContainer& c) : TNam
155155
// CorrelationContainer copy constructor
156156
//
157157

158-
((CorrelationContainer&)c).Copy(*this);
158+
c.Copy(*this);
159159
}
160160

161161
//____________________________________________________________________
@@ -195,7 +195,7 @@ CorrelationContainer& CorrelationContainer::operator=(const CorrelationContainer
195195
// assigment operator
196196

197197
if (this != &c) {
198-
((CorrelationContainer&)c).Copy(*this);
198+
c.Copy(*this);
199199
}
200200

201201
return *this;
@@ -206,7 +206,7 @@ void CorrelationContainer::Copy(TObject& c) const
206206
{
207207
// copy function
208208

209-
CorrelationContainer& target = (CorrelationContainer&)c;
209+
CorrelationContainer& target = dynamic_cast<CorrelationContainer&>(c);
210210

211211
if (mPairHist) {
212212
target.mPairHist = dynamic_cast<StepTHn*>(mPairHist->Clone());
@@ -423,7 +423,7 @@ void CorrelationContainer::getHistsZVtxMult(CorrelationContainer::CFStep step, F
423423

424424
Int_t dimensions[] = {4, 0, 5, 3};
425425
THnBase* tmpTrackHist = sparse->ProjectionND(4, dimensions, "E");
426-
*eventHist = (TH2*)mTriggerHist->getTHn(step)->Projection(1, 2); // NOTE the syntax is Projection(Y, X) --> produces a histogram where x = axis 2 (vertex) and y = axis 1 (multiplicity)
426+
*eventHist = static_cast<TH2*>(mTriggerHist->getTHn(step)->Projection(1, 2)); // NOTE the syntax is Projection(Y, X) --> produces a histogram where x = axis 2 (vertex) and y = axis 1 (multiplicity)
427427
// convert to THn
428428
*trackHist = changeToThn(tmpTrackHist);
429429
delete tmpTrackHist;
@@ -523,7 +523,7 @@ TH2* CorrelationContainer::getSumOfRatios(CorrelationContainer* mixed, Correlati
523523
Int_t nCorrelationFunctions = 0;
524524

525525
getHistsZVtxMult(step, ptTriggerMin, ptTriggerMax, &trackSameAll, &eventSameAll);
526-
mixed->getHistsZVtxMult((stepForMixed == -1) ? step : (CFStep)stepForMixed, ptTriggerMin, ptTriggerMax, &trackMixedAll, &eventMixedAll);
526+
mixed->getHistsZVtxMult((stepForMixed == -1) ? step : static_cast<CFStep>(stepForMixed), ptTriggerMin, ptTriggerMax, &trackMixedAll, &eventMixedAll);
527527

528528
// If we ask for histograms from step8 (TTR cut applied) there is a hole at 0,0; so this cannot be used for the
529529
// mixed-event normalization. If step6 is available, the normalization factor is read out from that one.
@@ -728,7 +728,7 @@ TH2* CorrelationContainer::getSumOfRatios(CorrelationContainer* mixed, Correlati
728728
*/
729729

730730
if (!totalTracks) {
731-
totalTracks = (TH2*)tracksSame->Clone("totalTracks");
731+
totalTracks = dynamic_cast<TH2*>(tracksSame->Clone("totalTracks"));
732732
} else {
733733
totalTracks->Add(tracksSame);
734734
}
@@ -766,7 +766,7 @@ TH2* CorrelationContainer::getSumOfRatios(CorrelationContainer* mixed, Correlati
766766
}
767767
}
768768
if (trigger != nullptr) {
769-
*trigger = (Int_t)totalEvents;
769+
*trigger = static_cast<Int_t>(totalEvents);
770770
}
771771

772772
// normalizate to dphi width
@@ -836,7 +836,7 @@ THnBase* CorrelationContainer::getTrackEfficiencyND(EfficiencyStep step1, Effici
836836
resetBinLimits(sourceContainer->getTHn(step1));
837837
resetBinLimits(sourceContainer->getTHn(step2));
838838

839-
THnBase* clone = (THnBase*)measured->Clone();
839+
THnBase* clone = dynamic_cast<THnBase*>(measured->Clone());
840840

841841
clone->Divide(measured, generated, 1, 1, "B");
842842

@@ -936,7 +936,7 @@ TH1* CorrelationContainer::getTrackEfficiency(EfficiencyStep step1, EfficiencySt
936936

937937
if (mPtMax > mPtMin) {
938938
// TODO this is just checking up to 15 for now
939-
Float_t ptMax = TMath::Min((Float_t)15., mPtMax);
939+
Float_t ptMax = TMath::Min(static_cast<Float_t>(15.), mPtMax);
940940
if (axis1 == 1) {
941941
binBegin[0] = generated->GetXaxis()->FindBin(mPtMin);
942942
binEnd[0] = generated->GetXaxis()->FindBin(ptMax);
@@ -1010,7 +1010,7 @@ TH1* CorrelationContainer::getTrackEfficiency(EfficiencyStep step1, EfficiencySt
10101010
measured = new TH2D(Form("%s_rebinned", tmp->GetName()), tmp->GetTitle(), axis->GetNbins(), axis->GetXbins()->GetArray(), tmp->GetNbinsY(), tmp->GetYaxis()->GetXbins()->GetArray());
10111011
for (Int_t x = 1; x <= tmp->GetNbinsX(); x++) {
10121012
for (Int_t y = 1; y <= tmp->GetNbinsY(); y++) {
1013-
((TH2*)measured)->Fill(tmp->GetXaxis()->GetBinCenter(x), tmp->GetYaxis()->GetBinCenter(y), tmp->GetBinContent(x, y));
1013+
(dynamic_cast<TH2*>(measured))->Fill(tmp->GetXaxis()->GetBinCenter(x), tmp->GetYaxis()->GetBinCenter(y), tmp->GetBinContent(x, y));
10141014
measured->SetBinError(x, y, 0); // cannot trust bin error, set to 0
10151015
}
10161016
}
@@ -1020,7 +1020,7 @@ TH1* CorrelationContainer::getTrackEfficiency(EfficiencyStep step1, EfficiencySt
10201020
generated = new TH2D(Form("%s_rebinned", tmp->GetName()), tmp->GetTitle(), axis->GetNbins(), axis->GetXbins()->GetArray(), tmp->GetNbinsY(), tmp->GetYaxis()->GetXbins()->GetArray());
10211021
for (Int_t x = 1; x <= tmp->GetNbinsX(); x++) {
10221022
for (Int_t y = 1; y <= tmp->GetNbinsY(); y++) {
1023-
((TH2*)generated)->Fill(tmp->GetXaxis()->GetBinCenter(x), tmp->GetYaxis()->GetBinCenter(y), tmp->GetBinContent(x, y));
1023+
(dynamic_cast<TH2*>(generated))->Fill(tmp->GetXaxis()->GetBinCenter(x), tmp->GetYaxis()->GetBinCenter(y), tmp->GetBinContent(x, y));
10241024
generated->SetBinError(x, y, 0); // cannot trust bin error, set to 0
10251025
}
10261026
}
@@ -1170,14 +1170,14 @@ TH1* CorrelationContainer::getBias(EfficiencyStep step1, EfficiencyStep step2, c
11701170
resetBinLimits(mTriggerHist->getTHn(step2), 3);
11711171
setBinLimits(tmp->getTHn(step2));
11721172

1173-
TH1D* events1 = (TH1D*)mTriggerHist->getTHn(step1)->Projection(0);
1174-
TH3D* hist1 = (TH3D*)tmp->getTHn(step1)->Projection(0, tmp->getNVar() - 1, 2);
1173+
TH1D* events1 = mTriggerHist->getTHn(step1)->Projection(0);
1174+
TH3D* hist1 = tmp->getTHn(step1)->Projection(0, tmp->getNVar() - 1, 2);
11751175
if (weighting == 0) {
11761176
weightHistogram(hist1, events1);
11771177
}
11781178

1179-
TH1D* events2 = (TH1D*)mTriggerHist->getTHn(step2)->Projection(0);
1180-
TH3D* hist2 = (TH3D*)tmp->getTHn(step2)->Projection(0, tmp->getNVar() - 1, 2);
1179+
TH1D* events2 = mTriggerHist->getTHn(step2)->Projection(0);
1180+
TH3D* hist2 = tmp->getTHn(step2)->Projection(0, tmp->getNVar() - 1, 2);
11811181
if (weighting == 0) {
11821182
weightHistogram(hist2, events2);
11831183
}
@@ -1430,7 +1430,7 @@ void CorrelationContainer::symmetrizepTBins()
14301430
}
14311431

14321432
// for symmetric bins
1433-
THnBase* source = (THnBase*)target->Clone();
1433+
THnBase* source = dynamic_cast<THnBase*>(target->Clone());
14341434

14351435
// axes: 0 delta eta; 1 pT,a; 2 pT,t; 3 centrality; 4 delta phi; 5 vtx-z
14361436
for (Int_t i3 = 1; i3 <= target->GetAxis(3)->GetNbins(); i3++) {
@@ -1573,7 +1573,7 @@ void CorrelationContainer::extendTrackingEfficiency(Bool_t verbose)
15731573
new TCanvas;
15741574
proj->DrawCopy();
15751575
}
1576-
if ((Int_t)proj->Fit("pol0", (verbose) ? "+" : "Q0+", "SAME", fitRangeBegin, fitRangeEnd) == 0) {
1576+
if (static_cast<Int_t>(proj->Fit("pol0", (verbose) ? "+" : "Q0+", "SAME", fitRangeBegin, fitRangeEnd)) == 0) {
15771577
target[i] = proj->GetFunction("pol0")->GetParameter(0);
15781578
} else {
15791579
target[i] = 0;

‎PWGCF/EbyEFluctuations/Tasks/NetProtonCumulants.cxx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ struct NetProtonCumulants_Table_QA {
7070

7171
// Filter command***********
7272
Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex;
73-
Filter trackFilter = (nabs(aod::track::eta) < 0.8f) && (aod::track::pt > cfgCutPtLower) && (aod::track::pt < 5.0f) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t)true)) && (aod::track::tpcChi2NCl < cfgCutTpcChi2NCl);
73+
Filter trackFilter = (nabs(aod::track::eta) < 0.8f) && (aod::track::pt > cfgCutPtLower) && (aod::track::pt < 5.0f) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == static_cast<uint8_t>(true))) && (aod::track::tpcChi2NCl < cfgCutTpcChi2NCl);
7474

7575
// Connect to ccdb
7676
Service<ccdb::BasicCCDBManager> ccdb;

‎PWGCF/EbyEFluctuations/Tasks/RobustFluctuationObservables.cxx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1699,7 +1699,7 @@ struct RobustFluctuationObservables {
16991699
histosEvent.fill(HIST("h2D_diffFoundBC_vs_BC"), collBC, diffFoundBC_vs_BC);
17001700

17011701
if (collision.has_foundBC())
1702-
histosEvent.fill(HIST("h2D_diffFoundBC_vs_BC_inTF"), collBC, static_cast<int64_t>(foundBcInTF) - static_cast<int64_t>(bcInTF));
1702+
histosEvent.fill(HIST("h2D_diffFoundBC_vs_BC_inTF"), collBC, foundBcInTF - bcInTF);
17031703

17041704
// with FT0 conditions
17051705
if (isFT0) {

‎PWGCF/EbyEFluctuations/Tasks/antiprotonCumulantsMc.cxx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ struct AntiprotonCumulantsMc {
110110

111111
// Filter command for rec (data)***********
112112
Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex;
113-
Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtLower) && (aod::track::pt < 5.0f) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t) true)) && (aod::track::tpcChi2NCl < cfgCutTpcChi2NCl) && (aod::track::itsChi2NCl < cfgCutItsChi2NCl) && (nabs(aod::track::dcaZ) < cfgCutDCAz) && (nabs(aod::track::dcaXY) < cfgCutDCAxy);
113+
Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtLower) && (aod::track::pt < 5.0f) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == static_cast<uint8_t>(true))) && (aod::track::tpcChi2NCl < cfgCutTpcChi2NCl) && (aod::track::itsChi2NCl < cfgCutItsChi2NCl) && (nabs(aod::track::dcaZ) < cfgCutDCAz) && (nabs(aod::track::dcaXY) < cfgCutDCAxy);
114114

115115
// filtering collisions and tracks for real data***********
116116
using AodCollisions = soa::Filtered<soa::Join<aod::Collisions, aod::EvSels, aod::CentFV0As, aod::CentFT0Ms, aod::CentFT0As, aod::CentFT0Cs, aod::CentFDDMs>>;
@@ -138,8 +138,8 @@ struct AntiprotonCumulantsMc {
138138
ccdb->setCreatedNotAfter(ccdbNoLaterThan.value);
139139
LOGF(info, "Getting object %s", ccdbPath.value.data());
140140
TList* lst = ccdb->getForTimeStamp<TList>(ccdbPath.value, ccdbNoLaterThan.value);
141-
hRatio2DEtaVsPtProton = reinterpret_cast<TH2F*>(lst->FindObject("hRatio2DEtaVsPtProton"));
142-
hRatio2DEtaVsPtAntiproton = reinterpret_cast<TH2F*>(lst->FindObject("hRatio2DEtaVsPtAntiproton"));
141+
hRatio2DEtaVsPtProton = dynamic_cast<TH2F*>(lst->FindObject("hRatio2DEtaVsPtProton"));
142+
hRatio2DEtaVsPtAntiproton = dynamic_cast<TH2F*>(lst->FindObject("hRatio2DEtaVsPtAntiproton"));
143143
if (!hRatio2DEtaVsPtProton || !hRatio2DEtaVsPtAntiproton)
144144
LOGF(info, "FATAL!! could not get efficiency---------> check");
145145
}

‎PWGCF/EbyEFluctuations/Tasks/eventMeanPtId.cxx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ struct EventMeanPtId {
186186
// ccdb->setCreatedNotAfter(ccdbNoLaterThan.value);
187187
// LOGF(info, "Getting object %s", ccdbPath.value.data());
188188
TList* lst = ccdb->getForTimeStamp<TList>(cfgPathCCDB.value, 1);
189-
ptHistogramAllchargeRec = reinterpret_cast<TH2D*>(lst->FindObject("hPtEta_rec"));
189+
ptHistogramAllchargeRec = dynamic_cast<TH2D*>(lst->FindObject("hPtEta_rec"));
190190
}
191191
std::vector<double> ptBinning = {0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4.0};
192192
AxisSpec vtxZAxis = {100, -20.0, 20.0, "Z (cm)"};

‎PWGCF/EbyEFluctuations/Tasks/kaonIsospinFluctuations.cxx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2440,8 +2440,8 @@ struct KaonIsospinFluctuations {
24402440

24412441
void processSim(MyMcCollisions const& mcCollisions, aod::McParticles const& mcParticles)
24422442
{
2443-
auto finalParticleIdList = (std::vector<int>)cfgFinalParticleIdList;
2444-
auto nonFinalParticleIdList = (std::vector<int>)cfgNonFinalParticleIdList;
2443+
auto finalParticleIdList = std::vector<int>(cfgFinalParticleIdList);
2444+
auto nonFinalParticleIdList = std::vector<int>(cfgNonFinalParticleIdList);
24452445
std::sort(finalParticleIdList.begin(), finalParticleIdList.end());
24462446
std::sort(nonFinalParticleIdList.begin(), nonFinalParticleIdList.end());
24472447

‎PWGCF/EbyEFluctuations/Tasks/netprotcumulants.cxx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ struct NetProtCumulants {
175175

176176
// Filter command for rec (data)***********
177177
Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex;
178-
Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtLower) && (aod::track::pt < 5.0f) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t)true)) && (aod::track::tpcChi2NCl < cfgCutTpcChi2NCl) && (aod::track::itsChi2NCl < cfgCutItsChi2NCl) && (nabs(aod::track::dcaZ) < cfgCutDCAz) && (nabs(aod::track::dcaXY) < cfgCutDCAxy);
178+
Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtLower) && (aod::track::pt < 5.0f) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == static_cast<uint8_t>(true))) && (aod::track::tpcChi2NCl < cfgCutTpcChi2NCl) && (aod::track::itsChi2NCl < cfgCutItsChi2NCl) && (nabs(aod::track::dcaZ) < cfgCutDCAz) && (nabs(aod::track::dcaXY) < cfgCutDCAxy);
179179

180180
// filtering collisions and tracks for real data***********
181181
using AodCollisions = soa::Filtered<soa::Join<aod::Collisions, aod::EvSels, aod::CentFV0As, aod::CentFT0Ms, aod::CentFT0As, aod::CentFT0Cs, aod::CentFDDMs>>;
@@ -203,8 +203,8 @@ struct NetProtCumulants {
203203
ccdb->setCreatedNotAfter(ccdbNoLaterThan.value);
204204
LOGF(info, "Getting object %s", ccdbPath.value.data());
205205
TList* lst = ccdb->getForTimeStamp<TList>(ccdbPath.value, ccdbNoLaterThan.value);
206-
hRatio2DEtaVsPtProton = reinterpret_cast<TH2F*>(lst->FindObject("hRatio2DEtaVsPtProton"));
207-
hRatio2DEtaVsPtAntiproton = reinterpret_cast<TH2F*>(lst->FindObject("hRatio2DEtaVsPtAntiproton"));
206+
hRatio2DEtaVsPtProton = dynamic_cast<TH2F*>(lst->FindObject("hRatio2DEtaVsPtProton"));
207+
hRatio2DEtaVsPtAntiproton = dynamic_cast<TH2F*>(lst->FindObject("hRatio2DEtaVsPtAntiproton"));
208208
if (!hRatio2DEtaVsPtProton || !hRatio2DEtaVsPtAntiproton)
209209
LOGF(info, "FATAL!! could not get efficiency---------> check");
210210
}

‎PWGCF/EbyEFluctuations/Tasks/netprotonCumulantsMc.cxx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ struct NetprotonCumulantsMc {
110110

111111
// Filter command for rec (data)***********
112112
Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex;
113-
Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtLower) && (aod::track::pt < 5.0f) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t) true)) && (aod::track::tpcChi2NCl < cfgCutTpcChi2NCl) && (aod::track::itsChi2NCl < cfgCutItsChi2NCl) && (nabs(aod::track::dcaZ) < cfgCutDCAz) && (nabs(aod::track::dcaXY) < cfgCutDCAxy);
113+
Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtLower) && (aod::track::pt < 5.0f) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == static_cast<uint8_t>(true))) && (aod::track::tpcChi2NCl < cfgCutTpcChi2NCl) && (aod::track::itsChi2NCl < cfgCutItsChi2NCl) && (nabs(aod::track::dcaZ) < cfgCutDCAz) && (nabs(aod::track::dcaXY) < cfgCutDCAxy);
114114

115115
// filtering collisions and tracks for real data***********
116116
using AodCollisions = soa::Filtered<soa::Join<aod::Collisions, aod::EvSels, aod::CentFV0As, aod::CentFT0Ms, aod::CentFT0As, aod::CentFT0Cs, aod::CentFDDMs>>;
@@ -138,8 +138,8 @@ struct NetprotonCumulantsMc {
138138
ccdb->setCreatedNotAfter(ccdbNoLaterThan.value);
139139
LOGF(info, "Getting object %s", ccdbPath.value.data());
140140
TList* lst = ccdb->getForTimeStamp<TList>(ccdbPath.value, ccdbNoLaterThan.value);
141-
hRatio2DEtaVsPtProton = reinterpret_cast<TH2F*>(lst->FindObject("hRatio2DEtaVsPtProton"));
142-
hRatio2DEtaVsPtAntiproton = reinterpret_cast<TH2F*>(lst->FindObject("hRatio2DEtaVsPtAntiproton"));
141+
hRatio2DEtaVsPtProton = dynamic_cast<TH2F*>(lst->FindObject("hRatio2DEtaVsPtProton"));
142+
hRatio2DEtaVsPtAntiproton = dynamic_cast<TH2F*>(lst->FindObject("hRatio2DEtaVsPtAntiproton"));
143143
if (!hRatio2DEtaVsPtProton || !hRatio2DEtaVsPtAntiproton)
144144
LOGF(info, "FATAL!! could not get efficiency---------> check");
145145
}

‎PWGCF/EbyEFluctuations/Tasks/v0ptHadPiKaProt.cxx‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ struct V0ptHadPiKaProt {
285285
ccdb->setCreatedNotAfter(ccdbNoLaterThan.value);
286286
LOGF(info, "Getting object %s", ccdbPath.value.data());
287287
TList* lst = ccdb->getForTimeStamp<TList>(ccdbPath.value, ccdbNoLaterThan.value);
288-
hWeightPhiFunctionVzEtaPhi = reinterpret_cast<TH3D*>(lst->FindObject("hWeightPhiFunctionVzEtaPhi"));
288+
hWeightPhiFunctionVzEtaPhi = dynamic_cast<TH3D*>(lst->FindObject("hWeightPhiFunctionVzEtaPhi"));
289289
if (!hWeightPhiFunctionVzEtaPhi)
290290
LOGF(info, "FATAL!! could not get phi weights---------> check");
291291
}
@@ -299,10 +299,10 @@ struct V0ptHadPiKaProt {
299299
ccdb->setCreatedNotAfter(ccdbNoLaterThanPtEff.value);
300300
LOGF(info, "Getting object %s", ccdbPathPtEff.value.data());
301301
TList* lst = ccdb->getForTimeStamp<TList>(ccdbPathPtEff.value, ccdbNoLaterThanPtEff.value);
302-
hEffAllCharged = reinterpret_cast<TH1D*>(lst->FindObject("hEffAllCharged"));
303-
hEffPion = reinterpret_cast<TH1D*>(lst->FindObject("hEffPion"));
304-
hEffKaon = reinterpret_cast<TH1D*>(lst->FindObject("hEffKaon"));
305-
hEffProton = reinterpret_cast<TH1D*>(lst->FindObject("hEffProton"));
302+
hEffAllCharged = dynamic_cast<TH1D*>(lst->FindObject("hEffAllCharged"));
303+
hEffPion = dynamic_cast<TH1D*>(lst->FindObject("hEffPion"));
304+
hEffKaon = dynamic_cast<TH1D*>(lst->FindObject("hEffKaon"));
305+
hEffProton = dynamic_cast<TH1D*>(lst->FindObject("hEffProton"));
306306
if (!hEffAllCharged || !hEffPion || !hEffKaon || !hEffProton)
307307
LOGF(info, "FATAL!! could not get efficiency files---------> !!! check !!!");
308308
}

‎PWGCF/Femto3D/Core/femto3dPairTask.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,14 @@ Type getBinIndex(float const& value, std::vector<float> const& binning, int cons
102102
for (unsigned int i = 0; i < binning.size() - 1; i++) {
103103
if (value >= binning[i] && binning[i + 1] > value) {
104104
if (NsubBins < 2) {
105-
res = (Type)i;
105+
res = static_cast<Type>(i);
106106
break;
107107
} else {
108108
float subBinWidth = (binning[i + 1] - binning[i]) / NsubBins;
109109
int subBin = std::floor((value - binning[i]) / subBinWidth);
110110
int delimeter = std::pow(10, std::to_string(NsubBins).size());
111111

112-
res = (Type)i + (Type)subBin / delimeter;
112+
res = static_cast<Type>(i) + static_cast<Type>(subBin) / delimeter;
113113
break;
114114
}
115115
}

0 commit comments

Comments
 (0)