diff --git a/PWGLF/Tasks/GlobalEventProperties/flattenictyPikp.cxx b/PWGLF/Tasks/GlobalEventProperties/flattenictyPikp.cxx index 49df0d00d32..5bfd8ff0712 100644 --- a/PWGLF/Tasks/GlobalEventProperties/flattenictyPikp.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/flattenictyPikp.cxx @@ -63,12 +63,12 @@ #include +#include + #include #include -#include #include #include -#include #include #include #include @@ -94,7 +94,7 @@ static constexpr float Cone = 1.0f; static constexpr int CmaxRingsFV0 = 5; static constexpr int CnCellsFV0 = 48; static constexpr int CinnerFV0 = 32; -static constexpr float Cfv0IndexPhi[5] = {0., 8., 16., 24., 32.}; +const std::array cFV0IndexPhi{0, 8, 16, 24, 32}; static constexpr float CmaxEtaFV0 = 5.1; static constexpr float CminEtaFV0 = 2.2; static constexpr float CdEtaFV0 = (CmaxEtaFV0 - CminEtaFV0) / CmaxRingsFV0; @@ -102,26 +102,28 @@ auto static constexpr CminAccFT0A = 3.5f; auto static constexpr CmaxAccFT0A = 4.9f; auto static constexpr CminAccFT0C = -3.3f; auto static constexpr CmaxAccFT0C = -2.1f; + // PID names static constexpr int CprocessIdWeak = 4; static constexpr int Ncharges = 2; static constexpr o2::track::PID::ID Npart = 5; static constexpr o2::track::PID::ID NpartChrg = Npart * Ncharges; -static constexpr int PDGs[] = {11, 13, 211, 321, 2212}; -static constexpr int PidSgn[NpartChrg] = {11, 13, 211, 321, 2212, -11, -13, -211, -321, -2212}; -static constexpr const char* Pid[Npart] = {"el", "mu", "pi", "ka", "pr"}; -static constexpr const char* PidChrg[NpartChrg] = {"e^{-}", "#mu^{-}", "#pi^{+}", "K^{+}", "p", "e^{+}", "#mu^{+}", "#pi^{-}", "K^{-}", "#bar{p}"}; -static constexpr std::string_view CspeciesAll[Npart] = {"El", "Mu", "Pi", "Ka", "Pr"}; +const std::array pDGs{11, 13, 211, 321, 2212}; +const std::array pIdSgn{11, 13, 211, 321, 2212, -11, -13, -211, -321, -2212}; +const std::array pID{"el", "mu", "pi", "ka", "pr"}; +const std::array pIdChrg{"e^{-}", "#mu^{-}", "#pi^{+}", "K^{+}", "p", "e^{+}", "#mu^{+}", "#pi^{-}", "K^{-}", "#bar{p}"}; +static constexpr std::array CspeciesAll{"El", "Mu", "Pi", "Ka", "Pr"}; + // histogram naming -static constexpr std::string_view PidDir[] = {"el/", "pi/", "pr/"}; -static constexpr std::string_view V0Dir[] = {"Ga/", "K0s/", "La/", "ALa/"}; -static constexpr std::string_view Ccharge[] = {"all/", "pos/", "neg/"}; +static constexpr std::array PidDir{"el/", "pi/", "pr/"}; +static constexpr std::array V0Dir{"Ga/", "K0s/", "La/", "ALa/"}; +static constexpr std::array Ccharge{"all/", "pos/", "neg/"}; static constexpr std::string_view Cprefix = "Tracks/"; static constexpr std::string_view CprefixCleanTof = "Tracks/CleanTof/"; static constexpr std::string_view CprefixCleanV0 = "Tracks/CleanV0/"; static constexpr std::string_view CprefixV0qa = "Tracks/V0qa/"; -static constexpr std::string_view Cstatus[] = {"preSel/", "postSel/"}; -static constexpr std::string_view CstatCalib[] = {"preCalib/", "postCalib/"}; +static constexpr std::array Cstatus{"preSel/", "postSel/"}; +static constexpr std::array CstatCalib{"preCalib/", "postCalib/"}; static constexpr std::string_view CdEdxMcRecPrim = "/hdEdxMcRecPrim"; static constexpr std::string_view CdEdxMcRecPrimF = "Tracks/{}/hdEdxMcRecPrim"; static constexpr std::string_view CdEdxMcRecPrimSel = "/hdEdxMcRecPrimSel"; @@ -221,31 +223,6 @@ struct MultE { static constexpr int CmultTPC = 2; }; -std::array rhoLatticeFV0{0}; -std::array fv0AmplitudeWoCalib{0}; -std::array, NpartChrg> hPtGenRecEvt{}; -std::array, NpartChrg> hPtGenPrimRecEvt{}; -std::array, NpartChrg> hPtGenRecEvtGtZero{}; -std::array, NpartChrg> hPtGenPrimRecEvtGtZero{}; -std::array, NpartChrg> hPtEffRec{}; -std::array, NpartChrg> hPtEffGen{}; -std::array, NpartChrg> hPtEffRecGoodCollPrim{}; -std::array, NpartChrg> hPtEffRecGoodCollWeak{}; -std::array, NpartChrg> hPtEffRecGoodCollMat{}; -std::array, NpartChrg> hPtEffGenPrim{}; -std::array, NpartChrg> hPtEffGenWeak{}; -std::array, NpartChrg> hPtEffGenMat{}; -std::array, NpartChrg> hPtEffGenPrimEvtSelGen{}; -std::array, NpartChrg> hPtEffGenWeakEvtSelGen{}; -std::array, NpartChrg> hPtEffGenMatEvtSelGen{}; - -std::array, NpartChrg> hDCAxyRecBadCollPrim{}; -std::array, NpartChrg> hDCAxyRecBadCollWeak{}; -std::array, NpartChrg> hDCAxyRecBadCollMat{}; -std::array, NpartChrg> hPtVsDCAxyRecGoodCollPrim{}; -std::array, NpartChrg> hPtVsDCAxyRecGoodCollWeak{}; -std::array, NpartChrg> hPtVsDCAxyRecGoodCollMat{}; - struct FlattenictyPikp { HistogramRegistry registryData{"registryData", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; @@ -253,11 +230,11 @@ struct FlattenictyPikp { HistogramRegistry registryQC{"registryQC", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; OutputObj listEfficiency{"Efficiency"}; - Service pdg; + Service pdg{}; - std::vector fv0AmplCorr{}; + std::vector fv0AmplCorr; TProfile2D* zVtxMap = nullptr; - float magField; + float magField{0.}; int runNumber{-1}; o2::parameters::GRPMagField* grpmag = nullptr; @@ -265,7 +242,7 @@ struct FlattenictyPikp { Configurable applyCalibGain{"applyCalibGain", false, "equalize detector amplitudes"}; Configurable applyCalibVtx{"applyCalibVtx", false, "equalize Amp vs vtx"}; Configurable applyCalibDeDx{"applyCalibDeDx", false, "calibration of dedx signal"}; - Configurable applyCalibDeDxFromCCDB{"applyCalibDeDxFromCCDB", false, "use CCDB-based calibration of dedx signal"}; + Configurable applyCalibDeDxFromCCDB{"applyCalibDeDxFromCCDB", true, "use CCDB-based calibration of dedx signal"}; Configurable cfgFillTrackQaHist{"cfgFillTrackQaHist", false, "fill track QA histograms"}; Configurable cfgFillNclVsPhiCutQaHist{"cfgFillNclVsPhiCutQaHist", false, "fill TPC cluster vs geometrical cut QA histograms"}; Configurable cfgFilldEdxCalibHist{"cfgFilldEdxCalibHist", false, "fill dEdx calibration histograms"}; @@ -290,8 +267,7 @@ struct FlattenictyPikp { Configurable cfgGainEqCcdbPath{"cfgGainEqCcdbPath", "Users/g/gbencedi/flattenicity/GainEq", "CCDB path for gain equalization constants"}; Configurable cfgVtxEqCcdbPath{"cfgVtxEqCcdbPath", "Users/g/gbencedi/flattenicity/ZvtxEq", "CCDB path for z-vertex equalization constants"}; Configurable cfgDeDxCalibCcdbPath{"cfgDeDxCalibCcdbPath", "Users/g/gbencedi/flattenicity/dEdxCalib", "CCDB path for dEdx calibration"}; - Configurable cfgUseCcdbForRun{"cfgUseCcdbForRun", true, "Get ccdb object based on run number instead of timestamp"}; - Configurable cfgStoreThnSparse{"cfgStoreThnSparse", false, "Store histograms as THnSparse"}; + Configurable cfgStoreThnSparse{"cfgStoreThnSparse", true, "Store histograms as THnSparse"}; struct : ConfigurableGroup { Configurable cfgCustomTVX{"cfgCustomTVX", false, "Ask for custom TVX instead of sel8"}; @@ -372,7 +348,7 @@ struct FlattenictyPikp { // standad parameters for V0 selection Configurable cfgV0etamin{"cfgV0etamin", -0.8f, "min eta of V0s"}; Configurable cfgV0etamax{"cfgV0etamax", +0.8f, "max eta of V0s"}; - Configurable cfgminNCrossedRowsTPC{"cfgminNCrossedRowsTPC", 70.f, "Additional cut on the minimum number of crossed rows in the TPC"}; + Configurable cfgminNCrossedRowsTPC{"cfgminNCrossedRowsTPC", 70, "Additional cut on the minimum number of crossed rows in the TPC"}; Configurable cfgApplyV0sNclFound{"cfgApplyV0sNclFound", false, "Apply cut on TPC Found clusters"}; Configurable cfgV0NclTPCMin{"cfgV0NclTPCMin", 135.0f, "Minimum of number of TPC found clusters"}; Configurable cfgApplyV0sNclPID{"cfgApplyV0sNclPID", true, "Apply cut on TPC PID clusters"}; @@ -408,7 +384,7 @@ struct FlattenictyPikp { Configurable cfgdEdxPlateauSel{"cfgdEdxPlateauSel", 50, "dEdx selection sensitivity for electrons"}; } v0SelOpt; - Service ccdb; + Service ccdb{}; struct : ConfigurableGroup { Configurable cfgMagField{"cfgMagField", 99999, "Configurable magnetic field;default CCDB will be queried"}; Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; @@ -447,7 +423,7 @@ struct FlattenictyPikp { Configurable requireITS{"requireITS", true, "Additional cut on the ITS requirement"}; Configurable requireTPC{"requireTPC", true, "Additional cut on the TPC requirement"}; Configurable requireGoldenChi2{"requireGoldenChi2", true, "Additional cut on the GoldenChi2"}; - Configurable minNCrossedRowsTPC{"minNCrossedRowsTPC", 70.f, "Additional cut on the minimum number of crossed rows in the TPC"}; + Configurable minNCrossedRowsTPC{"minNCrossedRowsTPC", 70, "Additional cut on the minimum number of crossed rows in the TPC"}; Configurable minNCrossedRowsOverFindableClustersTPC{"minNCrossedRowsOverFindableClustersTPC", 0.8f, "Additional cut on the minimum value of the ratio between crossed rows and findable clusters in the TPC"}; Configurable maxChi2PerClusterTPC{"maxChi2PerClusterTPC", 4.f, "Additional cut on the maximum value of the chi2 per cluster in the TPC"}; Configurable maxChi2PerClusterITS{"maxChi2PerClusterITS", 36.f, "Additional cut on the maximum value of the chi2 per cluster in the ITS"}; @@ -463,6 +439,28 @@ struct FlattenictyPikp { std::vector> fEDeDxVsEta; std::vector> vecParamsPLA; + std::array, NpartChrg> hPtGenRecEvt{}; + std::array, NpartChrg> hPtGenPrimRecEvt{}; + std::array, NpartChrg> hPtGenRecEvtGtZero{}; + std::array, NpartChrg> hPtGenPrimRecEvtGtZero{}; + std::array, NpartChrg> hPtEffRec{}; + std::array, NpartChrg> hPtEffGen{}; + std::array, NpartChrg> hPtEffRecGoodCollPrim{}; + std::array, NpartChrg> hPtEffRecGoodCollWeak{}; + std::array, NpartChrg> hPtEffRecGoodCollMat{}; + std::array, NpartChrg> hPtEffGenPrim{}; + std::array, NpartChrg> hPtEffGenWeak{}; + std::array, NpartChrg> hPtEffGenMat{}; + std::array, NpartChrg> hPtEffGenPrimEvtSelGen{}; + std::array, NpartChrg> hPtEffGenWeakEvtSelGen{}; + std::array, NpartChrg> hPtEffGenMatEvtSelGen{}; + std::array, NpartChrg> hDCAxyRecBadCollPrim{}; + std::array, NpartChrg> hDCAxyRecBadCollWeak{}; + std::array, NpartChrg> hDCAxyRecBadCollMat{}; + std::array, NpartChrg> hPtVsDCAxyRecGoodCollPrim{}; + std::array, NpartChrg> hPtVsDCAxyRecGoodCollWeak{}; + std::array, NpartChrg> hPtVsDCAxyRecGoodCollMat{}; + using MyCollisions = soa::Join; using Colls = soa::Join; using CollsGen = soa::Join; @@ -498,9 +496,6 @@ struct FlattenictyPikp { targetVec.emplace_back(vecParamsMIPposEtaN); targetVec.emplace_back(vecParamsMIPnegEtaN); targetVec.emplace_back(vecParamsMIPallEtaN); - if (!vecParamsMIP.size()) { - LOG(info) << "size of " << name << "is zero."; - } } else { targetVec.emplace_back(vecParamsPLAposEtaP); targetVec.emplace_back(vecParamsPLAnegEtaP); @@ -508,9 +503,9 @@ struct FlattenictyPikp { targetVec.emplace_back(vecParamsPLAposEtaN); targetVec.emplace_back(vecParamsPLAnegEtaN); targetVec.emplace_back(vecParamsPLAallEtaN); - if (!vecParamsPLA.size()) { - LOG(info) << "size of " << name << "is zero."; - } + } + if (vecParamsMIP.empty() || vecParamsPLA.empty()) { + LOG(info) << "size of " << name << "is zero."; } }; addVec(vecParamsMIP, "vecParamsMIP", true); @@ -704,7 +699,7 @@ struct FlattenictyPikp { } if (cfgFillDCAxyHist) { for (int i = 0; i < Npart; i++) { - registryData.add({fmt::format(CpTvsDCAxyF.data(), CspeciesAll[i]).c_str(), "; mult; flat; #it{p} (GeV/#it{c}); DCA_{xy} (cm)", {kTHnSparseF, {multAxis, flatAxis, ptAxis, dcaXYAxis}}}); + registryData.add({fmt::format(CpTvsDCAxyF.data(), CspeciesAll[i].data()).c_str(), "; mult; flat; #it{p} (GeV/#it{c}); DCA_{xy} (cm)", {kTHnSparseF, {multAxis, flatAxis, ptAxis, dcaXYAxis}}}); } } } @@ -782,11 +777,11 @@ struct FlattenictyPikp { registryMC.add("Events/hCentVsFlatRecINELgt0wRecEvtSel", "Gen evt w/ Nrec > 0 + Evt sel; mult; flat", {kTH2F, {multAxis, flatAxis}}); for (int i = 0; i < Npart; ++i) { // Signal loss - registryMC.add({fmt::format(CpTgenPrimSgnF.data(), CspeciesAll[i]).c_str(), "Gen evt w/o Evt sel; Gen Nch (|#eta|<0.8); flat; #it{p}_{T} (GeV/#it{c})", {kTHnSparseF, {nChAxis, flatAxis, ptAxis}}}); - registryMC.add({fmt::format(CpTrecCollPrimSgnF.data(), CspeciesAll[i]).c_str(), "Gen Nch w/ Nrec > 0; Gen Nch (|#eta|<0.8); flat; #it{p}_{T} (GeV/#it{c})", {kTHnSparseF, {nChAxis, flatAxis, ptAxis}}}); + registryMC.add({fmt::format(CpTgenPrimSgnF.data(), CspeciesAll[i].data()).c_str(), "Gen evt w/o Evt sel; Gen Nch (|#eta|<0.8); flat; #it{p}_{T} (GeV/#it{c})", {kTHnSparseF, {nChAxis, flatAxis, ptAxis}}}); + registryMC.add({fmt::format(CpTrecCollPrimSgnF.data(), CspeciesAll[i].data()).c_str(), "Gen Nch w/ Nrec > 0; Gen Nch (|#eta|<0.8); flat; #it{p}_{T} (GeV/#it{c})", {kTHnSparseF, {nChAxis, flatAxis, ptAxis}}}); // Closure test - registryMC.add({fmt::format(CpTmcClosureGenPrimF.data(), CspeciesAll[i]).c_str(), "Gen evt w/o Evt sel; Gen Nch (|#eta|<0.8); flat; #it{p}_{T} (GeV/#it{c})", {kTHnSparseF, {nChAxis, flatAxis, ptAxis}}}); - registryMC.add({fmt::format(CpTmcClosureRecF.data(), CspeciesAll[i]).c_str(), "Gen Nch w/ Nrec > 0 + Evt. sel; Gen Nch (|#eta|<0.8); flat; #it{p}_{T} (GeV/#it{c})", {kTHnSparseF, {nChAxis, flatAxis, ptAxis}}}); + registryMC.add({fmt::format(CpTmcClosureGenPrimF.data(), CspeciesAll[i].data()).c_str(), "Gen evt w/o Evt sel; Gen Nch (|#eta|<0.8); flat; #it{p}_{T} (GeV/#it{c})", {kTHnSparseF, {nChAxis, flatAxis, ptAxis}}}); + registryMC.add({fmt::format(CpTmcClosureRecF.data(), CspeciesAll[i].data()).c_str(), "Gen Nch w/ Nrec > 0 + Evt. sel; Gen Nch (|#eta|<0.8); flat; #it{p}_{T} (GeV/#it{c})", {kTHnSparseF, {nChAxis, flatAxis, ptAxis}}}); } if (cfgFillNclVsPhiCutQaHist) { registryMC.add("Tracks/postSel/hPtPhi", "; #it{p}_{T} (GeV/#it{c}); fmod(#varphi,#pi/9)", {kTH2F, {ptAxis, phiAxisMod}}); @@ -800,7 +795,7 @@ struct FlattenictyPikp { registryMC.addClone("Tracks/postSel/", "Tracks/preSel/"); for (int i = 0; i < NpartChrg; i++) { - const std::string strID = Form("/%s/%s", (i < Npart) ? "pos" : "neg", Pid[i % Npart]); + const std::string strID = Form("/%s/%s", (i < Npart) ? "pos" : "neg", pID[i % Npart]); hPtGenRecEvt[i] = registryMC.add("Tracks/hPtGenRecEvt" + strID, "Gen evt w/ Nrec > 0; mult; flat; #it{p}_{T} (GeV/#it{c})", kTHnSparseF, {multAxis, flatAxis, ptAxis}); hPtGenPrimRecEvt[i] = registryMC.add("Tracks/hPtGenPrimRecEvt" + strID, "Gen evt w/ Nrec > 0 (primary); mult; flat; #it{p}_{T} (GeV/#it{c})", kTHnSparseF, {multAxis, flatAxis, ptAxis}); hPtGenRecEvtGtZero[i] = registryMC.add("Tracks/hPtGenRecEvtGtZero" + strID, "Gen evt w/ Nrec > 0; mult; flat; #it{p}_{T} (GeV/#it{c})", kTHnSparseF, {multAxis, flatAxis, ptAxis}); @@ -823,15 +818,15 @@ struct FlattenictyPikp { } for (int i = 0; i < Npart; i++) { - registryMC.add({fmt::format(CpTeffGenPrimRecEvtF.data(), CspeciesAll[i]).c_str(), "Gen evt w/ Nrec > 0; mult; flat; #it{p}_{T} (GeV/#it{c})", {kTHnSparseF, {multAxis, flatAxis, ptAxis}}}); - registryMC.add({fmt::format(CpTeffPrimRecEvtF.data(), CspeciesAll[i]).c_str(), "Gen evt w/ Nrec > 0 + Evt sel; mult; flat; #it{p}_{T} (GeV/#it{c})", {kTHnSparseF, {multAxis, flatAxis, ptAxis}}}); - registryMC.add({fmt::format(CpTvsDCAxyAllF.data(), CspeciesAll[i]).c_str(), "; mult; flat; #it{p}_{T} (GeV/#it{c}); DCA_{xy} (cm)", {kTHnSparseF, {multAxis, flatAxis, ptAxis, dcaXYAxis}}}); - registryMC.add({fmt::format(CpTvsDCAxyPrimAllF.data(), CspeciesAll[i]).c_str(), "; mult; flat; #it{p}_{T} (GeV/#it{c}); DCA_{xy} (cm)", {kTHnSparseF, {multAxis, flatAxis, ptAxis, dcaXYAxis}}}); - registryMC.add({fmt::format(CpTvsDCAxyWeakAllF.data(), CspeciesAll[i]).c_str(), "; mult; flat; #it{p}_{T} (GeV/#it{c}); DCA_{xy} (cm)", {kTHnSparseF, {multAxis, flatAxis, ptAxis, dcaXYAxis}}}); - registryMC.add({fmt::format(CpTvsDCAxyMatAllF.data(), CspeciesAll[i]).c_str(), "; mult; flat; #it{p}_{T} (GeV/#it{c}); DCA_{xy} (cm)", {kTHnSparseF, {multAxis, flatAxis, ptAxis, dcaXYAxis}}}); - registryMC.add({fmt::format(CdEdxMcRecPrimF.data(), CspeciesAll[i]).c_str(), "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {kTHnSparseF, {etaAxis, multAxis, flatAxis, pAxis, dEdxAxis}}}); - registryMC.add({fmt::format(CdEdxMcRecPrimSelF.data(), CspeciesAll[i]).c_str(), "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {kTHnSparseF, {etaAxis, multAxis, flatAxis, pAxis, dEdxAxis}}}); - registryMC.add({fmt::format(CEtaVsPtVsPMcRecPrimSelF.data(), CspeciesAll[i]).c_str(), "; #eta; #it{p}_{T} (GeV/#it{c}); #it{p} (GeV/#it{c})", {kTHnSparseF, {etaAxis, ptAxis, pAxis}}}); + registryMC.add({fmt::format(CpTeffGenPrimRecEvtF.data(), CspeciesAll[i].data()).c_str(), "Gen evt w/ Nrec > 0; mult; flat; #it{p}_{T} (GeV/#it{c})", {kTHnSparseF, {multAxis, flatAxis, ptAxis}}}); + registryMC.add({fmt::format(CpTeffPrimRecEvtF.data(), CspeciesAll[i].data()).c_str(), "Gen evt w/ Nrec > 0 + Evt sel; mult; flat; #it{p}_{T} (GeV/#it{c})", {kTHnSparseF, {multAxis, flatAxis, ptAxis}}}); + registryMC.add({fmt::format(CpTvsDCAxyAllF.data(), CspeciesAll[i].data()).c_str(), "; mult; flat; #it{p}_{T} (GeV/#it{c}); DCA_{xy} (cm)", {kTHnSparseF, {multAxis, flatAxis, ptAxis, dcaXYAxis}}}); + registryMC.add({fmt::format(CpTvsDCAxyPrimAllF.data(), CspeciesAll[i].data()).c_str(), "; mult; flat; #it{p}_{T} (GeV/#it{c}); DCA_{xy} (cm)", {kTHnSparseF, {multAxis, flatAxis, ptAxis, dcaXYAxis}}}); + registryMC.add({fmt::format(CpTvsDCAxyWeakAllF.data(), CspeciesAll[i].data()).c_str(), "; mult; flat; #it{p}_{T} (GeV/#it{c}); DCA_{xy} (cm)", {kTHnSparseF, {multAxis, flatAxis, ptAxis, dcaXYAxis}}}); + registryMC.add({fmt::format(CpTvsDCAxyMatAllF.data(), CspeciesAll[i].data()).c_str(), "; mult; flat; #it{p}_{T} (GeV/#it{c}); DCA_{xy} (cm)", {kTHnSparseF, {multAxis, flatAxis, ptAxis, dcaXYAxis}}}); + registryMC.add({fmt::format(CdEdxMcRecPrimF.data(), CspeciesAll[i].data()).c_str(), "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {kTHnSparseF, {etaAxis, multAxis, flatAxis, pAxis, dEdxAxis}}}); + registryMC.add({fmt::format(CdEdxMcRecPrimSelF.data(), CspeciesAll[i].data()).c_str(), "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {kTHnSparseF, {etaAxis, multAxis, flatAxis, pAxis, dEdxAxis}}}); + registryMC.add({fmt::format(CEtaVsPtVsPMcRecPrimSelF.data(), CspeciesAll[i].data()).c_str(), "; #eta; #it{p}_{T} (GeV/#it{c}); #it{p} (GeV/#it{c})", {kTHnSparseF, {etaAxis, ptAxis, pAxis}}}); } // Hash list for efficiency @@ -854,11 +849,10 @@ struct FlattenictyPikp { { fv0AmplCorr.clear(); fv0AmplCorr = {}; - std::string fullPathCalibGain; - std::string fullPathCalibVtx; - std::string fullPathCalibDeDxMip; - std::string fullPathCalibDeDxPlateau; - auto timestamp = bc.timestamp(); + // std::string fullPathCalibGain{}; + // std::string fullPathCalibVtx{}; + // std::string fullPathCalibDeDxMip{}; + // std::string fullPathCalibDeDxPlateau{}; auto runnumber = bc.runNumber(); if (trkSelOpt.cfgRejectTrkAtTPCSector || v0SelOpt.cfgRejectV0sAtTPCSector) { @@ -870,9 +864,9 @@ struct FlattenictyPikp { LOG(info) << "Retrieved GRP for run " << runnumber << " with magnetic field of " << magField << " kZG"; } if (applyCalibGain) { - fullPathCalibGain = cfgGainEqCcdbPath; + std::string fullPathCalibGain = cfgGainEqCcdbPath; fullPathCalibGain += "/FV0"; - const auto* objfv0Gain = getForTsOrRun>(fullPathCalibGain, timestamp, runnumber); + const auto* objfv0Gain = ccdb->getForRun>(fullPathCalibGain, runnumber); if (!objfv0Gain) { for (auto i{0u}; i < CnCellsFV0; i++) { fv0AmplCorr.push_back(1.); @@ -883,49 +877,53 @@ struct FlattenictyPikp { } } if (applyCalibVtx) { - fullPathCalibVtx = cfgVtxEqCcdbPath; + std::string fullPathCalibVtx = cfgVtxEqCcdbPath; fullPathCalibVtx += "/FV0"; - zVtxMap = getForTsOrRun(fullPathCalibVtx, timestamp, runnumber); + zVtxMap = ccdb->getForRun(fullPathCalibVtx, runnumber); } if (applyCalibDeDxFromCCDB) { - fullPathCalibDeDxMip = cfgDeDxCalibCcdbPath; - fullPathCalibDeDxMip += "/MIP"; - fullPathCalibDeDxPlateau = cfgDeDxCalibCcdbPath; - fullPathCalibDeDxPlateau += "/Plateau"; + std::string fullPathCalibDeDxMip = cfgDeDxCalibCcdbPath; if (!fullPathCalibDeDxMip.empty()) { - dedxcalib.lCalibObjects = getForTsOrRun(fullPathCalibDeDxMip, timestamp, runnumber); - if (dedxcalib.lCalibObjects) { - LOG(info) << "CCDB objects loaded successfully"; - dedxcalib.hMIPcalibPos = static_cast(dedxcalib.lCalibObjects->FindObject("hMIPcalibPos")); - dedxcalib.hMIPcalibNeg = static_cast(dedxcalib.lCalibObjects->FindObject("hMIPcalibNeg")); - dedxcalib.hMIPcalibAll = static_cast(dedxcalib.lCalibObjects->FindObject("hMIPcalibAll")); - dedxcalib.lCalibLoaded = true; - if (!dedxcalib.hMIPcalibPos || !dedxcalib.hMIPcalibNeg || !dedxcalib.hMIPcalibAll) { - LOGF(error, "Problem loading CCDB objects! Please check"); - dedxcalib.lCalibLoaded = false; - } - } else { - LOGF(fatal, "Could not load hMIPcalib from %s", fullPathCalibDeDxMip.c_str()); - dedxcalib.lCalibLoaded = false; - } + fullPathCalibDeDxMip += "/MIP"; } + std::string fullPathCalibDeDxPlateau = cfgDeDxCalibCcdbPath; if (!fullPathCalibDeDxPlateau.empty()) { - dedxcalib.lCalibObjects = getForTsOrRun(fullPathCalibDeDxPlateau, timestamp, runnumber); - if (dedxcalib.lCalibObjects) { - LOG(info) << "CCDB objects loaded successfully"; - dedxcalib.hPlateauCalibPos = static_cast(dedxcalib.lCalibObjects->FindObject("hPlateauCalibPos")); - dedxcalib.hPlateauCalibNeg = static_cast(dedxcalib.lCalibObjects->FindObject("hPlateauCalibNeg")); - dedxcalib.hPlateauCalibAll = static_cast(dedxcalib.lCalibObjects->FindObject("hPlateauCalibAll")); - dedxcalib.lCalibLoaded = true; - if (!dedxcalib.hPlateauCalibPos || !dedxcalib.hPlateauCalibNeg || !dedxcalib.hPlateauCalibAll) { - LOGF(error, "Problem loading CCDB objects! Please check"); - dedxcalib.lCalibLoaded = false; - } - } else { - LOGF(fatal, "Could not load hPlateauCalib from %s", fullPathCalibDeDxPlateau.c_str()); + fullPathCalibDeDxPlateau += "/Plateau"; + } + // if (!fullPathCalibDeDxMip.empty()) { + dedxcalib.lCalibObjects = ccdb->getForRun(fullPathCalibDeDxMip, runnumber); + if (dedxcalib.lCalibObjects) { + LOG(info) << "CCDB objects loaded successfully"; + dedxcalib.hMIPcalibPos = dynamic_cast(dedxcalib.lCalibObjects->FindObject("hMIPcalibPos")); + dedxcalib.hMIPcalibNeg = dynamic_cast(dedxcalib.lCalibObjects->FindObject("hMIPcalibNeg")); + dedxcalib.hMIPcalibAll = dynamic_cast(dedxcalib.lCalibObjects->FindObject("hMIPcalibAll")); + dedxcalib.lCalibLoaded = true; + if (!dedxcalib.hMIPcalibPos || !dedxcalib.hMIPcalibNeg || !dedxcalib.hMIPcalibAll) { + LOGF(error, "Problem loading CCDB objects! Please check"); + dedxcalib.lCalibLoaded = false; } + } else { + LOGF(fatal, "Could not load hMIPcalib from %s", fullPathCalibDeDxMip.c_str()); + dedxcalib.lCalibLoaded = false; + } + // } + // if (!fullPathCalibDeDxPlateau.empty()) { + dedxcalib.lCalibObjects = ccdb->getForRun(fullPathCalibDeDxPlateau, runnumber); + if (dedxcalib.lCalibObjects) { + LOG(info) << "CCDB objects loaded successfully"; + dedxcalib.hPlateauCalibPos = dynamic_cast(dedxcalib.lCalibObjects->FindObject("hPlateauCalibPos")); + dedxcalib.hPlateauCalibNeg = dynamic_cast(dedxcalib.lCalibObjects->FindObject("hPlateauCalibNeg")); + dedxcalib.hPlateauCalibAll = dynamic_cast(dedxcalib.lCalibObjects->FindObject("hPlateauCalibAll")); + dedxcalib.lCalibLoaded = true; + if (!dedxcalib.hPlateauCalibPos || !dedxcalib.hPlateauCalibNeg || !dedxcalib.hPlateauCalibAll) { + LOGF(error, "Problem loading CCDB objects! Please check"); + dedxcalib.lCalibLoaded = false; + } + } else { + LOGF(fatal, "Could not load hPlateauCalib from %s", fullPathCalibDeDxPlateau.c_str()); } + // } } } @@ -945,9 +943,9 @@ struct FlattenictyPikp { bool isPID(const P& mcParticle) { static_assert(pidSgn == CnullInt || pidSgn == ConeInt); - static_assert(id > CnullInt || id < Npart); + static_assert(id > CnullInt && id < Npart); constexpr int Cidx = id + pidSgn * Npart; - return mcParticle.pdgCode() == PidSgn[Cidx]; + return mcParticle.pdgCode() == pIdSgn[Cidx]; } template @@ -1163,31 +1161,32 @@ struct FlattenictyPikp { if (selectTypeV0s(collision, v0, posTrack, negTrack) == kGa) { // Gamma selection fillV0QA(v0, posTrack); fillV0QA(v0, negTrack); + // float dEdxPosGa{-1.}, dEdxNegGa{-1.}; if (applyCalibDeDx) { if (cfgFillChrgTypeV0s) { if (applyCalibDeDxFromCCDB) { - const float dEdxPosGa = dedxcalib.hMIPcalibPos->GetBinContent(dedxcalib.hMIPcalibPos->FindBin(posTrack.eta())); - const float dEdxNegGa = dedxcalib.hMIPcalibNeg->GetBinContent(dedxcalib.hMIPcalibNeg->FindBin(negTrack.eta())); + float dEdxPosGa = dedxcalib.hMIPcalibPos->GetBinContent(dedxcalib.hMIPcalibPos->FindBin(posTrack.eta())); + float dEdxNegGa = dedxcalib.hMIPcalibNeg->GetBinContent(dedxcalib.hMIPcalibNeg->FindBin(negTrack.eta())); if (std::abs(dEdxPos - dEdxPosGa) >= v0SelOpt.cfgdEdxPlateauSel || std::abs(dEdxNeg - dEdxNegGa) >= v0SelOpt.cfgdEdxPlateauSel) { continue; } } else { - const float dEdxPosGa = getCalibration(fEDeDxVsEta, posTrack); - const float dEdxNegGa = getCalibration(fEDeDxVsEta, negTrack); + float dEdxPosGa = getCalibration(fEDeDxVsEta, posTrack); + float dEdxNegGa = getCalibration(fEDeDxVsEta, negTrack); if (std::abs(dEdxPos - dEdxPosGa) >= v0SelOpt.cfgdEdxPlateauSel || std::abs(dEdxNeg - dEdxNegGa) >= v0SelOpt.cfgdEdxPlateauSel) { continue; } } } else { if (applyCalibDeDxFromCCDB) { - const float dEdxPosGa = dedxcalib.hPlateauCalibAll->GetBinContent(dedxcalib.hPlateauCalibAll->FindBin(posTrack.eta())); - const float dEdxNegGa = dedxcalib.hPlateauCalibAll->GetBinContent(dedxcalib.hPlateauCalibAll->FindBin(negTrack.eta())); + float dEdxPosGa = dedxcalib.hPlateauCalibAll->GetBinContent(dedxcalib.hPlateauCalibAll->FindBin(posTrack.eta())); + float dEdxNegGa = dedxcalib.hPlateauCalibAll->GetBinContent(dedxcalib.hPlateauCalibAll->FindBin(negTrack.eta())); if (std::abs(dEdxPos - dEdxPosGa) >= v0SelOpt.cfgdEdxPlateauSel || std::abs(dEdxNeg - dEdxNegGa) >= v0SelOpt.cfgdEdxPlateauSel) { continue; } } else { - const float dEdxPosGa = getCalibration(fEDeDxVsEta, posTrack); - const float dEdxNegGa = getCalibration(fEDeDxVsEta, negTrack); + float dEdxPosGa = getCalibration(fEDeDxVsEta, posTrack); + float dEdxNegGa = getCalibration(fEDeDxVsEta, negTrack); if (std::abs(dEdxPos - dEdxPosGa) >= v0SelOpt.cfgdEdxPlateauSel || std::abs(dEdxNeg - dEdxNegGa) >= v0SelOpt.cfgdEdxPlateauSel) { continue; } @@ -1363,9 +1362,6 @@ struct FlattenictyPikp { return false; } registryMC.fill(HIST("Events/hNchTVX"), nChrgMc, 1.5); - if (nChrgMc == CnullInt) { - return false; - } return true; } @@ -1394,15 +1390,17 @@ struct FlattenictyPikp { return nTrk; } - void phiMod(float& phimodn, const int& mag, const int& charge) + void phiMod(float& phimodn, const float& mag, const int& charge) { - if (mag < Cnull) // for negative polarity field + if (mag < Cnull) { // for negative polarity field phimodn = o2::constants::math::TwoPI - phimodn; - if (charge < Cnull) // for negative charge + } + if (charge < Cnull) { // for negative charge phimodn = o2::constants::math::TwoPI - phimodn; - if (phimodn < Cnull) + } + if (phimodn < Cnull) { LOGF(warning, "phi < Cnull: %g", phimodn); - + } phimodn += o2::constants::math::PI / 18.0f; // to center gap in the middle phimodn = std::fmod(phimodn, o2::constants::math::PI / 9.0f); } @@ -1477,34 +1475,28 @@ struct FlattenictyPikp { template int selectTypeV0s(C const& collision, T1 const& v0, T2 const& postrk, T2 const& negtrk) { - const float dMassK0s = std::abs(v0.mK0Short() - o2::constants::physics::MassK0Short); - const float dMassL = std::abs(v0.mLambda() - o2::constants::physics::MassLambda0); - const float dMassAL = std::abs(v0.mAntiLambda() - o2::constants::physics::MassLambda0); - const float dMassG = std::abs(v0.mGamma() - o2::constants::physics::MassGamma); - bool isMassG = false; bool isMassK0s = false; bool isMassL = false; bool isMassAL = false; - if (dMassK0s > v0SelOpt.cfgdmassK && dMassL > v0SelOpt.cfgdmassL && dMassAL > v0SelOpt.cfgdmassL && dMassG < v0SelOpt.cfgdmassG) { + if (std::abs(v0.mK0Short() - o2::constants::physics::MassK0Short) > v0SelOpt.cfgdmassK && std::abs(v0.mLambda() - o2::constants::physics::MassLambda0) > v0SelOpt.cfgdmassL && std::abs(v0.mAntiLambda() - o2::constants::physics::MassLambda0) > v0SelOpt.cfgdmassL && std::abs(v0.mGamma() - o2::constants::physics::MassGamma) < v0SelOpt.cfgdmassG) { isMassG = true; } - if (dMassK0s < v0SelOpt.cfgdmassK && dMassL > v0SelOpt.cfgdmassL && dMassAL > v0SelOpt.cfgdmassL && dMassG > v0SelOpt.cfgdmassG) { + if (std::abs(v0.mK0Short() - o2::constants::physics::MassK0Short) < v0SelOpt.cfgdmassK && std::abs(v0.mLambda() - o2::constants::physics::MassLambda0) > v0SelOpt.cfgdmassL && std::abs(v0.mAntiLambda() - o2::constants::physics::MassLambda0) > v0SelOpt.cfgdmassL && std::abs(v0.mGamma() - o2::constants::physics::MassGamma) > v0SelOpt.cfgdmassG) { isMassK0s = true; } - if (dMassK0s > v0SelOpt.cfgdmassK && dMassL < v0SelOpt.cfgdmassL && dMassG > v0SelOpt.cfgdmassG) { + if (std::abs(v0.mK0Short() - o2::constants::physics::MassK0Short) > v0SelOpt.cfgdmassK && std::abs(v0.mLambda() - o2::constants::physics::MassLambda0) < v0SelOpt.cfgdmassL && std::abs(v0.mGamma() - o2::constants::physics::MassGamma) > v0SelOpt.cfgdmassG) { isMassL = true; } - if (dMassK0s > v0SelOpt.cfgdmassK && dMassAL < v0SelOpt.cfgdmassL && dMassG > v0SelOpt.cfgdmassG) { + if (std::abs(v0.mK0Short() - o2::constants::physics::MassK0Short) > v0SelOpt.cfgdmassK && std::abs(v0.mAntiLambda() - o2::constants::physics::MassLambda0) < v0SelOpt.cfgdmassL && std::abs(v0.mGamma() - o2::constants::physics::MassGamma) > v0SelOpt.cfgdmassG) { isMassAL = true; } // Gamma selection - const float yGamma = RecoDecay::y(std::array{v0.px(), v0.py(), v0.pz()}, o2::constants::physics::MassGamma); if (isMassG) { - if (std::abs(yGamma) < v0SelOpt.cfgV0Ymax) { // rapidity cut - if (std::abs(v0.alpha()) < v0SelOpt.cfgArmPodGammasalpha && v0.qtarm() < v0SelOpt.cfgArmPodGammasqT) { // + if (std::abs(RecoDecay::y(std::array{v0.px(), v0.py(), v0.pz()}, o2::constants::physics::MassGamma)) < v0SelOpt.cfgV0Ymax) { // rapidity cut + if (std::abs(v0.alpha()) < v0SelOpt.cfgArmPodGammasalpha && v0.qtarm() < v0SelOpt.cfgArmPodGammasqT) { // if (postrk.hasTPC() && std::abs(postrk.tpcNSigmaEl()) < v0SelOpt.cfgNsigmaElTPC) { if (postrk.hasTOF() && std::abs(postrk.tofNSigmaEl()) < v0SelOpt.cfgNsigmaElTOF) { return kGa; @@ -1811,93 +1803,93 @@ struct FlattenictyPikp { { int iRing = -1; - if (i_ch >= Cfv0IndexPhi[0] && i_ch < Cfv0IndexPhi[1]) { - if (i_ch < Cfv0IndexPhi[0] + 4) { + if (i_ch >= cFV0IndexPhi[0] && i_ch < cFV0IndexPhi[1]) { + if (i_ch < cFV0IndexPhi[0] + 4) { iRing = i_ch; } else { - if (i_ch == Cfv0IndexPhi[1] - 1) { + if (i_ch == cFV0IndexPhi[1] - 1) { iRing = i_ch - 3; // 4; - } else if (i_ch == Cfv0IndexPhi[1] - 2) { + } else if (i_ch == cFV0IndexPhi[1] - 2) { iRing = i_ch - 1; // 5; - } else if (i_ch == Cfv0IndexPhi[1] - 3) { + } else if (i_ch == cFV0IndexPhi[1] - 3) { iRing = i_ch + 1; // 6; - } else if (i_ch == Cfv0IndexPhi[1] - 4) { + } else if (i_ch == cFV0IndexPhi[1] - 4) { iRing = i_ch + 3; // 7; } } - } else if (i_ch >= Cfv0IndexPhi[1] && i_ch < Cfv0IndexPhi[2]) { - if (i_ch < Cfv0IndexPhi[2] - 4) { + } else if (i_ch >= cFV0IndexPhi[1] && i_ch < cFV0IndexPhi[2]) { + if (i_ch < cFV0IndexPhi[2] - 4) { iRing = i_ch; } else { - if (i_ch == Cfv0IndexPhi[2] - 1) { + if (i_ch == cFV0IndexPhi[2] - 1) { iRing = i_ch - 3; // 12; - } else if (i_ch == Cfv0IndexPhi[2] - 2) { + } else if (i_ch == cFV0IndexPhi[2] - 2) { iRing = i_ch - 1; // 13; - } else if (i_ch == Cfv0IndexPhi[2] - 3) { + } else if (i_ch == cFV0IndexPhi[2] - 3) { iRing = i_ch + 1; // 14; - } else if (i_ch == Cfv0IndexPhi[2] - 4) { + } else if (i_ch == cFV0IndexPhi[2] - 4) { iRing = i_ch + 3; // 15; } } - } else if (i_ch >= Cfv0IndexPhi[2] && i_ch < Cfv0IndexPhi[3]) { - if (i_ch < Cfv0IndexPhi[3] - 4) { + } else if (i_ch >= cFV0IndexPhi[2] && i_ch < cFV0IndexPhi[3]) { + if (i_ch < cFV0IndexPhi[3] - 4) { iRing = i_ch; } else { - if (i_ch == Cfv0IndexPhi[3] - 1) { + if (i_ch == cFV0IndexPhi[3] - 1) { iRing = i_ch - 3; // 20; - } else if (i_ch == Cfv0IndexPhi[3] - 2) { + } else if (i_ch == cFV0IndexPhi[3] - 2) { iRing = i_ch - 1; // 21; - } else if (i_ch == Cfv0IndexPhi[3] - 3) { + } else if (i_ch == cFV0IndexPhi[3] - 3) { iRing = i_ch + 1; // 22; - } else if (i_ch == Cfv0IndexPhi[3] - 4) { + } else if (i_ch == cFV0IndexPhi[3] - 4) { iRing = i_ch + 3; // 23; } } - } else if (i_ch >= Cfv0IndexPhi[3] && i_ch < Cfv0IndexPhi[4]) { - if (i_ch < Cfv0IndexPhi[3] + 4) { + } else if (i_ch >= cFV0IndexPhi[3] && i_ch < cFV0IndexPhi[4]) { + if (i_ch < cFV0IndexPhi[3] + 4) { iRing = i_ch; } else { - if (i_ch == Cfv0IndexPhi[4] - 5) { + if (i_ch == cFV0IndexPhi[4] - 5) { iRing = i_ch - 3; // 28; - } else if (i_ch == Cfv0IndexPhi[4] - 6) { + } else if (i_ch == cFV0IndexPhi[4] - 6) { iRing = i_ch - 1; // 29; - } else if (i_ch == Cfv0IndexPhi[4] - 7) { + } else if (i_ch == cFV0IndexPhi[4] - 7) { iRing = i_ch + 1; // 30; - } else if (i_ch == Cfv0IndexPhi[4] - 8) { + } else if (i_ch == cFV0IndexPhi[4] - 8) { iRing = i_ch + 3; // 31; } } - } else if (i_ch == Cfv0IndexPhi[4]) { - iRing = Cfv0IndexPhi[4]; - } else if (i_ch == Cfv0IndexPhi[4] + 8) { + } else if (i_ch == cFV0IndexPhi[4]) { + iRing = cFV0IndexPhi[4]; + } else if (i_ch == cFV0IndexPhi[4] + 8) { iRing = i_ch - 7; // 33; - } else if (i_ch == Cfv0IndexPhi[4] + 1) { + } else if (i_ch == cFV0IndexPhi[4] + 1) { iRing = i_ch + 1; // 34; - } else if (i_ch == Cfv0IndexPhi[4] + 9) { + } else if (i_ch == cFV0IndexPhi[4] + 9) { iRing = i_ch - 6; // 35; - } else if (i_ch == Cfv0IndexPhi[4] + 2) { + } else if (i_ch == cFV0IndexPhi[4] + 2) { iRing = i_ch + 2; // 36; - } else if (i_ch == Cfv0IndexPhi[4] + 10) { + } else if (i_ch == cFV0IndexPhi[4] + 10) { iRing = i_ch - 5; // 37; - } else if (i_ch == Cfv0IndexPhi[4] + 3) { + } else if (i_ch == cFV0IndexPhi[4] + 3) { iRing = i_ch + 3; // 38; - } else if (i_ch == Cfv0IndexPhi[4] + 11) { + } else if (i_ch == cFV0IndexPhi[4] + 11) { iRing = i_ch - 4; // 39; - } else if (i_ch == Cfv0IndexPhi[4] + 15) { + } else if (i_ch == cFV0IndexPhi[4] + 15) { iRing = i_ch - 7; // 40; - } else if (i_ch == Cfv0IndexPhi[4] + 7) { + } else if (i_ch == cFV0IndexPhi[4] + 7) { iRing = i_ch + 2; // 41; - } else if (i_ch == Cfv0IndexPhi[4] + 14) { + } else if (i_ch == cFV0IndexPhi[4] + 14) { iRing = i_ch - 4; // 42; - } else if (i_ch == Cfv0IndexPhi[4] + 6) { + } else if (i_ch == cFV0IndexPhi[4] + 6) { iRing = i_ch + 5; // 43; - } else if (i_ch == Cfv0IndexPhi[4] + 13) { + } else if (i_ch == cFV0IndexPhi[4] + 13) { iRing = i_ch - 1; // 44; - } else if (i_ch == Cfv0IndexPhi[4] + 5) { + } else if (i_ch == cFV0IndexPhi[4] + 5) { iRing = i_ch + 8; // 45; - } else if (i_ch == Cfv0IndexPhi[4] + 12) { + } else if (i_ch == cFV0IndexPhi[4] + 12) { iRing = i_ch + 2; // 46; - } else if (i_ch == Cfv0IndexPhi[4] + 4) { + } else if (i_ch == cFV0IndexPhi[4] + 4) { iRing = i_ch + 11; // 47; } return iRing; @@ -1976,13 +1968,12 @@ struct FlattenictyPikp { template float fillFlat(C const& collision) { - rhoLatticeFV0.fill(0); - fv0AmplitudeWoCalib.fill(0); + float oneMinusFlat{9999}; if (collision.has_foundFV0()) { auto fv0 = collision.foundFV0(); - std::bitset<8> fV0Triggers = fv0.triggerMask(); - bool isOkFV0OrA = fV0Triggers[o2::fit::Triggers::bitA]; - if (isOkFV0OrA) { + if (TESTBIT(fv0.triggerMask(), o2::fit::Triggers::bitA)) { + std::array rhoLatticeFV0{0.}; + std::array fv0AmplitudeWoCalib{0.}; for (std::size_t ich = 0; ich < fv0.channel().size(); ich++) { float amplCh = fv0.amplitude()[ich]; int chv0 = fv0.channel()[ich]; @@ -2021,13 +2012,10 @@ struct FlattenictyPikp { } } float flattenicityFV0 = calcFlatenicity(rhoLatticeFV0); - return 1. - flattenicityFV0; - } else { - return 9999; + oneMinusFlat = 1. - flattenicityFV0; } - } else { - return 9999; } + return oneMinusFlat; } template @@ -2111,8 +2099,8 @@ struct FlattenictyPikp { float maxPhi = 0; float dPhi = 0; - float etaMinFV0bins[CmaxRingsFV0] = {0.0}; - float etaMaxFV0bins[CmaxRingsFV0] = {0.0}; + std::array etaMinFV0bins{0.}; + std::array etaMaxFV0bins{0.}; for (int i = 0; i < CmaxRingsFV0; ++i) { etaMaxFV0bins[i] = CmaxEtaFV0 - i * CdEtaFV0; if (i < CmaxRingsFV0 - 1) { @@ -2122,7 +2110,7 @@ struct FlattenictyPikp { } } - rhoLatticeFV0.fill(0); + std::array rhoLatticeFV0{0.}; std::vector vNch; float nChFV0{0}; for (const auto& mcPart : mcparts) { @@ -2178,8 +2166,8 @@ struct FlattenictyPikp { { AxisSpec ptAxis{binOpt.axisPt, "#it{p}_{T} (GeV/#it{c})"}; constexpr int ChistIdx = id + pidSgn * Npart; - auto idx = static_cast(id); - const std::string strID = Form("/%s/%s", (pidSgn == CnullInt && id < Npart) ? "pos" : "neg", Pid[idx]); + auto idx = id; + const std::string strID = Form("/%s/%s", (pidSgn == CnullInt && id < Npart) ? "pos" : "neg", pID[idx]); hPtEffRec[ChistIdx] = registryMC.add("Tracks/hPtEffRec" + strID, " ; #it{p}_{T} (GeV/#it{c})", kTH1F, {ptAxis}); hPtEffGen[ChistIdx] = registryMC.add("Tracks/hPtEffGen" + strID, " ; #it{p}_{T} (GeV/#it{c})", kTH1F, {ptAxis}); } @@ -2188,14 +2176,14 @@ struct FlattenictyPikp { void initEfficiency() { static_assert(pidSgn == CnullInt || pidSgn == ConeInt); - static_assert(id > CnullInt || id < Npart); + static_assert(id > CnullInt && id < Npart); constexpr int Cidx = id + pidSgn * Npart; - const TString partName = PidChrg[Cidx]; - THashList* lhash = new THashList(); + const TString partName = pIdChrg[Cidx]; + auto lhash = new THashList(); lhash->SetName(partName); listEfficiency->Add(lhash); - auto bookEff = [&](const TString eName, auto h) { + auto bookEff = [&](const TString& eName, const auto& h) { const TAxis* axis = h->GetXaxis(); TString eTitle = h->GetTitle(); eTitle.ReplaceAll("Numerator", "").Strip(TString::kBoth); @@ -2212,15 +2200,15 @@ struct FlattenictyPikp { { static_assert(pidSgn == CnullInt || pidSgn == ConeInt); constexpr int ChistIdx = id + pidSgn * Npart; - const char* partName = PidChrg[ChistIdx]; - THashList* lhash = static_cast(listEfficiency->FindObject(partName)); + const char* partName = pIdChrg[ChistIdx]; + auto lhash = dynamic_cast(listEfficiency->FindObject(partName)); if (!lhash) { LOG(warning) << "No efficiency object found for particle " << partName; return; } - auto fillEff = [&](const TString eName, auto num, auto den) { - TEfficiency* eff = static_cast(lhash->FindObject(eName)); + auto fillEff = [&](const TString& eName, const auto& num, const auto& den) { + auto eff = dynamic_cast(lhash->FindObject(eName)); if (!eff) { LOG(warning) << "Cannot find TEfficiency " << eName; return; @@ -2429,7 +2417,7 @@ struct FlattenictyPikp { }); static_for<0, 4>([&](auto i) { constexpr int Cidx = i.value; - if (std::fabs(particle.pdgCode()) == PDGs[Cidx]) { + if (std::fabs(particle.pdgCode()) == pDGs[Cidx]) { registryMC.fill(HIST(Cprefix) + HIST(CspeciesAll[Cidx]) + HIST(CpTrecCollPrimSgn), multMC, flatMC, particle.pt()); // Sgn loss num registryMC.fill(HIST(Cprefix) + HIST(CspeciesAll[Cidx]) + HIST(CpTeffGenPrimRecEvt), multRecGt1, flatRec, particle.pt()); // Tracking eff. den } @@ -2488,7 +2476,7 @@ struct FlattenictyPikp { }); static_for<0, 4>([&](auto i) { constexpr int Cidx = i.value; - if (std::fabs(particle.pdgCode()) == PDGs[Cidx]) { + if (std::fabs(particle.pdgCode()) == pDGs[Cidx]) { if (!particle.isPhysicalPrimary()) { if (particle.getProcess() == CprocessIdWeak) { registryMC.fill(HIST(Cprefix) + HIST(CspeciesAll[Cidx]) + HIST(CpTvsDCAxyWeakAll), multRecGt1, flatRec, track.pt(), track.dcaXY()); @@ -2506,7 +2494,7 @@ struct FlattenictyPikp { static_for<0, 4>([&](auto i) { constexpr int Cidx = i.value; if (std::sqrt(std::pow(std::fabs(o2::aod::pidutils::tpcNSigma(track)), 2) + std::pow(std::fabs(o2::aod::pidutils::tofNSigma(track)), 2) < trkSelOpt.cfgDcaNsigmaCombinedMax)) { - if (std::fabs(particle.pdgCode()) == PDGs[Cidx]) { + if (std::fabs(particle.pdgCode()) == pDGs[Cidx]) { if (particle.isPhysicalPrimary()) { registryMC.fill(HIST(Cprefix) + HIST(CspeciesAll[Cidx]) + HIST(CdEdxMcRecPrimSel), track.eta(), multRecGt1, flatRec, track.p(), track.tpcSignal()); registryMC.fill(HIST(Cprefix) + HIST(CspeciesAll[Cidx]) + HIST(CEtaVsPtVsPMcRecPrimSel), track.eta(), track.pt(), track.p()); @@ -2585,7 +2573,7 @@ struct FlattenictyPikp { constexpr int Cidx = i.value; // LOG(debug) << "fillMCGen for pidSgn '" << pidSgn << "' and id '" << static_cast(id) << " with index " << ChistIdx; if (particle.isPhysicalPrimary()) { - if (std::fabs(particle.pdgCode()) == PDGs[Cidx]) { + if (std::fabs(particle.pdgCode()) == pDGs[Cidx]) { registryMC.fill(HIST(Cprefix) + HIST(CspeciesAll[Cidx]) + HIST(CpTgenPrimSgn), multMC, flatMC, particle.pt()); // Sgn loss den registryMC.fill(HIST(Cprefix) + HIST(CspeciesAll[Cidx]) + HIST(CpTmcClosureGenPrim), multMC, flatMC, particle.pt()); // closure } @@ -2594,16 +2582,6 @@ struct FlattenictyPikp { } } PROCESS_SWITCH(FlattenictyPikp, processMC, "process MC", false); - - template - ObjType* getForTsOrRun(std::string const& fullPath, int64_t timestamp, int runNumber) - { - if (cfgUseCcdbForRun) { - return ccdb->getForRun(fullPath, runNumber); - } else { - return ccdb->getForTimeStamp(fullPath, timestamp); - } - } }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)