diff --git a/EventFiltering/PWGHF/HFFilterHelpers.h b/EventFiltering/PWGHF/HFFilterHelpers.h index 13bcfa93fa1..288cdf8fac5 100644 --- a/EventFiltering/PWGHF/HFFilterHelpers.h +++ b/EventFiltering/PWGHF/HFFilterHelpers.h @@ -2004,7 +2004,7 @@ inline void HfFilterHelper::setTpcRecalibMaps(o2::framework::Service(calibList->FindObject(mapNames[iMap].data())); + mHistMapPiPrKaDe[iMap] = dynamic_cast(calibList->FindObject(mapNames[iMap].data())); if (!mHistMapPiPrKaDe[iMap]) { LOG(fatal) << "Cannot find histogram: " << mapNames[iMap].data(); return; diff --git a/EventFiltering/PWGJE/jetFilter.cxx b/EventFiltering/PWGJE/jetFilter.cxx index d9f9f153333..a74c146e86b 100644 --- a/EventFiltering/PWGJE/jetFilter.cxx +++ b/EventFiltering/PWGJE/jetFilter.cxx @@ -98,7 +98,7 @@ struct jetFilter { void init(o2::framework::InitContext&) { triggerJetR = TMath::Nint(cfgJetR * 100.0f); - trackSelection = jetderiveddatautilities::initialiseTrackSelection(static_cast(trackSelections)); + trackSelection = jetderiveddatautilities::initialiseTrackSelection(trackSelections); eventSelectionBits = jetderiveddatautilities::initialiseEventSelectionBits(static_cast(evSel)); spectra.add("fCollZpos", "collision z position", HistType::kTH1F, diff --git a/EventFiltering/PWGUD/diffractionBCFilter.cxx b/EventFiltering/PWGUD/diffractionBCFilter.cxx index b72c026e0e4..74d4672f981 100644 --- a/EventFiltering/PWGUD/diffractionBCFilter.cxx +++ b/EventFiltering/PWGUD/diffractionBCFilter.cxx @@ -112,11 +112,11 @@ struct tracksWGTInBCs { LOGF(debug, " Number of BCs %d", atr.bc().size()); if (atr.bc().size() > 0) { auto firstCompatibleBC = atr.bc().begin().globalBC(); - closestBC = (uint64_t)(firstCompatibleBC + - (track.trackTime() / o2::constants::lhc::LHCBunchSpacingNS)); + closestBC = static_cast(firstCompatibleBC + + (track.trackTime() / o2::constants::lhc::LHCBunchSpacingNS)); // update tracksInBCList LOGF(debug, "closestBC %d", closestBC); - tracksInBCList[closestBC].emplace_back((int32_t)track.globalIndex()); + tracksInBCList[closestBC].emplace_back(static_cast(track.globalIndex())); } } else { // registry.get(HIST("barrelTracks"))->Fill(2., 1.); @@ -128,7 +128,7 @@ struct tracksWGTInBCs { // update tracksInBCList LOGF(debug, "closestBC %d", closestBC); - tracksInBCList[closestBC].emplace_back((int32_t)track.globalIndex()); + tracksInBCList[closestBC].emplace_back(static_cast(track.globalIndex())); } } LOGF(debug, "track finished.\n"); @@ -195,12 +195,12 @@ struct tracksWGTInBCs { LOGF(debug, " Number of BCs %d", aftr.bc().size()); if (aftr.bc().size() > 0) { auto firstCompatibleBC = aftr.bc().begin().globalBC(); - closestBC = (uint64_t)(firstCompatibleBC + - (fwdTrack.trackTime() / o2::constants::lhc::LHCBunchSpacingNS)); + closestBC = static_cast(firstCompatibleBC + + (fwdTrack.trackTime() / o2::constants::lhc::LHCBunchSpacingNS)); // update fwdTracksWGTInBCList LOGF(debug, "closestBC %d", closestBC); - fwdTracksWGTInBCList[closestBC].emplace_back((int32_t)fwdTrack.globalIndex()); + fwdTracksWGTInBCList[closestBC].emplace_back(static_cast(fwdTrack.globalIndex())); } } else { // registry.get(HIST("forwardTracks"))->Fill(2., 1.); @@ -212,7 +212,7 @@ struct tracksWGTInBCs { // update fwdTracksWGTInBCList LOGF(debug, "closestBC %d", closestBC); - fwdTracksWGTInBCList[closestBC].emplace_back((int32_t)fwdTrack.globalIndex()); + fwdTracksWGTInBCList[closestBC].emplace_back(static_cast(fwdTrack.globalIndex())); } } LOGF(debug, "FwdTrack finished.\n"); @@ -282,7 +282,7 @@ struct DGBCFilterRun3 { void init(InitContext&) { - diffCuts = (DGCutparHolder)DGCuts; + diffCuts = DGCutparHolder(DGCuts); } // some general Collisions and Tracks filter diff --git a/EventFiltering/PWGUD/diffractionFilter.cxx b/EventFiltering/PWGUD/diffractionFilter.cxx index b9fed2f424d..83bc848612e 100644 --- a/EventFiltering/PWGUD/diffractionFilter.cxx +++ b/EventFiltering/PWGUD/diffractionFilter.cxx @@ -89,13 +89,13 @@ struct DGFilterRun3 { { // reset collision counter collCounter = 0; - verbose = (int64_t)Verbose; + verbose = static_cast(Verbose); if (verbose <= 0) { verbose = 1000000000000; } // cut holder - diffCuts = (DGCutparHolder)diffCutsHolder; + diffCuts = DGCutparHolder(diffCutsHolder); // create histograms // stat diff --git a/EventFiltering/macros/cefpOutputChecker.C b/EventFiltering/macros/cefpOutputChecker.C index 48295a1746e..f6c4ffd78e5 100644 --- a/EventFiltering/macros/cefpOutputChecker.C +++ b/EventFiltering/macros/cefpOutputChecker.C @@ -21,18 +21,18 @@ void cefpOutputChecker(std::string histoFile = "AnalysisResults.root", std::string treeFile = "AO2D.root") { TFile referenceFile(histoFile.data()); - TH1* refScalers = (TH1*)referenceFile.Get("central-event-filter-task/scalers/mScalers"); - TH1* refFilters = (TH1*)referenceFile.Get("central-event-filter-task/scalers/mFiltered"); + TH1* refScalers = dynamic_cast(referenceFile.Get("central-event-filter-task/scalers/mScalers")); + TH1* refFilters = dynamic_cast(referenceFile.Get("central-event-filter-task/scalers/mFiltered")); TFile outputFile("cefpOutputChecker.root", "recreate"); - TH1* newFilters = (TH1*)refFilters->Clone("newFilters"); - TH1* newScalers = (TH1*)refScalers->Clone("newScalers"); + TH1* newFilters = dynamic_cast(refFilters->Clone("newFilters")); + TH1* newScalers = dynamic_cast(refScalers->Clone("newScalers")); newFilters->Reset(); newScalers->Reset(); TFile inputFile(treeFile.data()); for (auto key : *(inputFile.GetListOfKeys())) { - TTree* cefpTree = (TTree*)inputFile.Get(Form("%s/O2cefpdecision", key->GetName())); + TTree* cefpTree = dynamic_cast(inputFile.Get(Form("%s/O2cefpdecision", key->GetName()))); if (!cefpTree) continue; ULong64_t fCefpSelected, fCefpTriggered; diff --git a/EventFiltering/macros/checkBCrangesSkimming.C b/EventFiltering/macros/checkBCrangesSkimming.C index d7379030956..4224297f570 100644 --- a/EventFiltering/macros/checkBCrangesSkimming.C +++ b/EventFiltering/macros/checkBCrangesSkimming.C @@ -620,28 +620,28 @@ void checkBCrangesSkimming(std::string AnaFileName = "AnalysisResults.root", std TH1D *hOriginalSinglesRatio, *hOriginalDoublesRatio, *hOriginalMultiplesRatio; TH1D *hSkimmedSinglesRatio, *hSkimmedDoublesRatio, *hSkimmedMultiplesRatio; - hTriggerEff = reinterpret_cast(hSkimmedTotal.Clone("hTriggerEff")); + hTriggerEff = dynamic_cast(hSkimmedTotal.Clone("hTriggerEff")); hTriggerEff->SetTitle((runNumber + " skimmed efficiency;; Skimmed / Original").data()); hTriggerEff->Divide(&hOriginalTotal); hTriggerMatchesRatio.Divide(&hOriginalSingles); hTriggerSingleMatchesRatio.Divide(&hOriginalSingles); - hOriginalSinglesRatio = reinterpret_cast(hOriginalSingles.Clone("hOriginalSinglesRatio")); + hOriginalSinglesRatio = dynamic_cast(hOriginalSingles.Clone("hOriginalSinglesRatio")); hOriginalSinglesRatio->SetTitle((runNumber + " Original;;Singles / Total").data()); hOriginalSinglesRatio->Divide(&hOriginalTotal); - hOriginalDoublesRatio = reinterpret_cast(hOriginalDoubles.Clone("hOriginalDoublesRatio")); + hOriginalDoublesRatio = dynamic_cast(hOriginalDoubles.Clone("hOriginalDoublesRatio")); hOriginalDoublesRatio->SetTitle((runNumber + " Original;;Doubles / Total").data()); hOriginalDoublesRatio->Divide(&hOriginalTotal); - hOriginalMultiplesRatio = reinterpret_cast(hOriginalMultiples.Clone("hOriginalMultiplesRatio")); + hOriginalMultiplesRatio = dynamic_cast(hOriginalMultiples.Clone("hOriginalMultiplesRatio")); hOriginalMultiplesRatio->SetTitle((runNumber + " Original;;Multiples / Total").data()); hOriginalMultiplesRatio->Divide(&hOriginalTotal); - hSkimmedSinglesRatio = reinterpret_cast(hSkimmedSingles.Clone("hSkimmedSinglesRatio")); + hSkimmedSinglesRatio = dynamic_cast(hSkimmedSingles.Clone("hSkimmedSinglesRatio")); hSkimmedSinglesRatio->SetTitle((runNumber + " Skimmed;;Singles / Total").data()); hSkimmedSinglesRatio->Divide(&hSkimmedTotal); - hSkimmedDoublesRatio = reinterpret_cast(hSkimmedDoubles.Clone("hSkimmedDoublesRatio")); + hSkimmedDoublesRatio = dynamic_cast(hSkimmedDoubles.Clone("hSkimmedDoublesRatio")); hSkimmedDoublesRatio->SetTitle((runNumber + " Skimmed;;Doubles / Total").data()); hSkimmedDoublesRatio->Divide(&hSkimmedTotal); - hSkimmedMultiplesRatio = reinterpret_cast(hSkimmedMultiples.Clone("hSkimmedMultiplesRatio")); + hSkimmedMultiplesRatio = dynamic_cast(hSkimmedMultiples.Clone("hSkimmedMultiplesRatio")); hSkimmedMultiplesRatio->SetTitle((runNumber + " Skimmed;;Multiples / Total").data()); hSkimmedMultiplesRatio->Divide(&hSkimmedTotal); diff --git a/EventFiltering/macros/checkSkimming.C b/EventFiltering/macros/checkSkimming.C index 34d58a803fe..6f1961fb7bd 100644 --- a/EventFiltering/macros/checkSkimming.C +++ b/EventFiltering/macros/checkSkimming.C @@ -124,7 +124,7 @@ void checkSkimming(const std::string& listName = "period.txt", bool skipDownscal std::string original_path = line.substr(0, pos); std::string skimmed_path = line.substr(pos + 1); checkSkimming(original_path, skimmed_path, outputFile, skipDownscaled); - TH1* hRatio = (TH1*)gDirectory->Get("hRatio"); + TH1* hRatio = dynamic_cast(gDirectory->Get("hRatio")); hRatio->Draw(); std::string suffix = counter == 0 ? "(" : (counter == lineCounter - 1 ? ")" : ""); c1.Print((periodName + ".pdf" + suffix).data()); diff --git a/EventFiltering/macros/getMenu.C b/EventFiltering/macros/getMenu.C index 6e7e480f587..2166cf4635d 100644 --- a/EventFiltering/macros/getMenu.C +++ b/EventFiltering/macros/getMenu.C @@ -69,7 +69,7 @@ std::vector getMenuForPeriod(std::string period) TGrid::Connect("alien://"); TFile* scalersFile = TFile::Open((std::string("alien://") + firstLine).data(), "READ"); - TH1D* counters = (TH1D*)scalersFile->Get("central-event-filter-task/scalers/mFiltered"); + TH1D* counters = dynamic_cast(scalersFile->Get("central-event-filter-task/scalers/mFiltered")); TAxis* axis = counters->GetXaxis(); std::vector binLabels(axis->GetNbins() - 2); diff --git a/EventFiltering/macros/selectivityPlot.C b/EventFiltering/macros/selectivityPlot.C index c7f710fe42d..7847c320744 100644 --- a/EventFiltering/macros/selectivityPlot.C +++ b/EventFiltering/macros/selectivityPlot.C @@ -45,7 +45,7 @@ void selectivityPlot(int runNumber = 550781, const TString& inputfile = "Analysi Canvas_1->SetFrameBorderMode(0); TFile* file = new TFile(inputfile.Data()); - TH1D* mFiltered = (TH1D*)file->Get("central-event-filter-task/scalers/mFiltered"); + TH1D* mFiltered = dynamic_cast(file->Get("central-event-filter-task/scalers/mFiltered")); double nEvents = mFiltered->GetBinContent(1); mFiltered->Scale(1. / nEvents); mFiltered->SetLineColor(2); diff --git a/EventFiltering/macros/uploadOTSobjects.C b/EventFiltering/macros/uploadOTSobjects.C index e9982fafaaa..378526c7a3f 100644 --- a/EventFiltering/macros/uploadOTSobjects.C +++ b/EventFiltering/macros/uploadOTSobjects.C @@ -67,15 +67,15 @@ void uploadOTSobjects(std::string inputList, const std::string& passName, bool u auto orbitResetTimestamp = (*ctp)[0]; path = useAlien ? "alien://" + path : path; std::unique_ptr scalersFile{TFile::Open((path + "/AnalysisResults_fullrun.root").data(), "READ")}; - TH1* scalers = static_cast(scalersFile->Get("central-event-filter-task/scalers/mScalers")); - TH1* filters = static_cast(scalersFile->Get("central-event-filter-task/scalers/mFiltered")); + TH1* scalers = dynamic_cast(scalersFile->Get("central-event-filter-task/scalers/mScalers")); + TH1* filters = dynamic_cast(scalersFile->Get("central-event-filter-task/scalers/mFiltered")); api.storeAsTFile(scalers, baseCCDBpath + "FilterCounters", metadata, duration.first, duration.second + 1); api.storeAsTFile(filters, baseCCDBpath + "SelectionCounters", metadata, duration.first, duration.second + 1); - TH1* hCounterTVX = static_cast(scalersFile->Get("bc-selection-task/hCounterTVX")); + TH1* hCounterTVX = dynamic_cast(scalersFile->Get("bc-selection-task/hCounterTVX")); if (!hCounterTVX) { - hCounterTVX = static_cast(scalersFile->Get("lumi-task/hCounterTVX")); + hCounterTVX = dynamic_cast(scalersFile->Get("lumi-task/hCounterTVX")); if (!hCounterTVX) { - hCounterTVX = static_cast(scalersFile->Get("eventselection-run3/luminosity/hCounterTVX")); + hCounterTVX = dynamic_cast(scalersFile->Get("eventselection-run3/luminosity/hCounterTVX")); if (!hCounterTVX) { std::cout << "No hCounterTVX histogram found in the file, skipping upload for run " << runString << std::endl; continue; @@ -88,7 +88,7 @@ void uploadOTSobjects(std::string inputList, const std::string& passName, bool u std::unique_ptr bcRangesFile{TFile::Open((path + "/bcRanges_fullrun.root").data(), "READ")}; int Nmax = 0; for (auto key : *(bcRangesFile->GetListOfKeys())) { - TTree* cefpTree = static_cast(bcRangesFile->Get(Form("%s/selectedBC", key->GetName()))); + TTree* cefpTree = dynamic_cast(bcRangesFile->Get(Form("%s/selectedBC", key->GetName()))); if (!cefpTree) continue; ZorroHelper bci; @@ -134,7 +134,7 @@ void uploadOTSobjects(std::string inputList, const std::string& passName, bool u auto bcNext{nextHelper.bcAOD < nextHelper.bcEvSel ? nextHelper.bcAOD : nextHelper.bcEvSel}; if (bcNext - bcEnd > 2001 / o2::constants::lhc::LHCBunchSpacingMUS) { /// ensure a gap of 2ms between chunks chunk.insert(chunk.begin(), zorroHelpers.begin() + helperIndex, zorroHelpers.begin() + endIndex + 1); - endTS = (orbitResetTimestamp + int64_t(bcEnd * o2::constants::lhc::LHCBunchSpacingNS * 1e-3)) / 1000 + 1; + endTS = (orbitResetTimestamp + static_cast(bcEnd * o2::constants::lhc::LHCBunchSpacingNS * 1e-3)) / 1000 + 1; break; } bcEnd = nextHelper.bcAOD > nextHelper.bcEvSel ? nextHelper.bcAOD : nextHelper.bcEvSel;