diff --git a/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h b/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h index 6fcaf345f9b..f871586d5fa 100644 --- a/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h +++ b/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h @@ -266,10 +266,10 @@ struct Pi0EtaToGammaGamma { std::vector occ_bin_edges; o2::ccdb::CcdbApi ccdbApi; - o2::framework::Service ccdb; - int mRunNumber; - float d_bz; - o2::emcal::Geometry* emcalGeom; + o2::framework::Service ccdb{}; + int mRunNumber = -1; + float d_bz = 0; + o2::emcal::Geometry* emcalGeom = nullptr; //--------------------------------------------------------------------------- // In the following are tags defined which help to select the correct preslice and cuts @@ -435,10 +435,11 @@ struct Pi0EtaToGammaGamma { } auto run3grp_timestamp = collision.timestamp(); - o2::parameters::GRPObject* grpo = 0x0; - o2::parameters::GRPMagField* grpmag = 0x0; - if (!skipGRPOquery) + o2::parameters::GRPObject* grpo = nullptr; + o2::parameters::GRPMagField* grpmag = nullptr; + if (!skipGRPOquery) { grpo = ccdb->getForTimeStamp(grpPath, run3grp_timestamp); + } if (grpo) { // Fetch magnetic field from ccdb for current collision d_bz = grpo->getNominalL3Field(); @@ -459,9 +460,9 @@ struct Pi0EtaToGammaGamma { ~Pi0EtaToGammaGamma() { delete emh1; - emh1 = 0x0; + emh1 = nullptr; delete emh2; - emh2 = 0x0; + emh2 = nullptr; used_photonIds_per_col.clear(); used_photonIds_per_col.shrink_to_fit(); @@ -522,8 +523,7 @@ struct Pi0EtaToGammaGamma { fV0PhotonCut.SetNClassesMl(pcmcuts.cfg_nclasses_ml); fV0PhotonCut.SetMlTimestampCCDB(pcmcuts.cfg_timestamp_ccdb); fV0PhotonCut.SetCcdbUrl(ccdburl); - CentType mCentralityTypeMlEnum; - mCentralityTypeMlEnum = static_cast(cfgCentEstimator.value); + auto mCentralityTypeMlEnum = static_cast(cfgCentEstimator.value); fV0PhotonCut.SetCentralityTypeMl(mCentralityTypeMlEnum); fV0PhotonCut.SetCutDirMl(pcmcuts.cfg_cut_dir_ml); fV0PhotonCut.SetMlModelPathsCCDB(pcmcuts.cfg_model_paths_ccdb); @@ -617,9 +617,7 @@ struct Pi0EtaToGammaGamma { int iRowLast = 24; if (emcalGeom->GetSMType(iSupMod) == o2::emcal::EMCALSMType::EMCAL_HALF) { iRowLast /= 2; // 2/3 sm case - } else if (emcalGeom->GetSMType(iSupMod) == o2::emcal::EMCALSMType::EMCAL_THIRD) { - iRowLast /= 3; // 1/3 sm case - } else if (emcalGeom->GetSMType(iSupMod) == o2::emcal::EMCALSMType::DCAL_EXT) { + } else if (emcalGeom->GetSMType(iSupMod) == o2::emcal::EMCALSMType::EMCAL_THIRD || emcalGeom->GetSMType(iSupMod) == o2::emcal::EMCALSMType::DCAL_EXT) { iRowLast /= 3; // 1/3 sm case } @@ -693,7 +691,6 @@ struct Pi0EtaToGammaGamma { fRegistry.fill(HIST("Pair/rotation/hs"), mother2.M(), mother2.Pt(), eventWeight); } } - return; } /// \brief function to run the photon pairing @@ -732,7 +729,7 @@ struct Pi0EtaToGammaGamma { continue; } - const float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; + const std::array centralities = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; fV0PhotonCut.SetCentrality(centralities[cfgCentEstimator]); if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { continue; @@ -770,9 +767,7 @@ struct Pi0EtaToGammaGamma { } int occbin = -1; - if (cfgOccupancyEstimator == 0) { - occbin = lower_bound(occ_bin_edges.begin(), occ_bin_edges.end(), collision.ft0cOccupancyInTimeRange()) - occ_bin_edges.begin() - 1; - } else if (cfgOccupancyEstimator == 1) { + if (cfgOccupancyEstimator == 1) { occbin = lower_bound(occ_bin_edges.begin(), occ_bin_edges.end(), collision.trackOccupancyInTimeRange()) - occ_bin_edges.begin() - 1; } else { occbin = lower_bound(occ_bin_edges.begin(), occ_bin_edges.end(), collision.ft0cOccupancyInTimeRange()) - occ_bin_edges.begin() - 1; diff --git a/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h b/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h index 61a8a51729c..95873165f71 100644 --- a/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h +++ b/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h @@ -228,16 +228,16 @@ struct Pi0EtaToGammaGammaMC { o2::framework::Configurable cfg_min_Ecluster{"cfg_min_Ecluster", 0.3, "Minimum cluster energy for PHOS in GeV"}; } phoscuts; - TF1* f1fd_k0s_to_pi0; + TF1* f1fd_k0s_to_pi0 = nullptr; o2::framework::HistogramRegistry fRegistry{"output", {}, o2::framework::OutputObjHandlingPolicy::AnalysisObject, false, false}; // static constexpr std::string_view event_types[2] = {"before/", "after/"}; // static constexpr std::string_view event_pair_types[2] = {"same/", "mix/"}; - static constexpr std::string_view kParnames[2] = {"Pi0/", "Eta/"}; + static constexpr std::array kParnames = {"Pi0/", "Eta/"}; o2::ccdb::CcdbApi ccdbApi; - o2::framework::Service ccdb; - int mRunNumber; - float d_bz; + o2::framework::Service ccdb{}; + int mRunNumber = 0; + float d_bz = 0; void init(o2::framework::InitContext&) { @@ -291,10 +291,11 @@ struct Pi0EtaToGammaGammaMC { } auto run3grp_timestamp = collision.timestamp(); - o2::parameters::GRPObject* grpo = 0x0; - o2::parameters::GRPMagField* grpmag = 0x0; - if (!skipGRPOquery) + o2::parameters::GRPObject* grpo = nullptr; + o2::parameters::GRPMagField* grpmag = nullptr; + if (!skipGRPOquery) { grpo = ccdb->getForTimeStamp(grpPath, run3grp_timestamp); + } if (grpo) { // Fetch magnetic field from ccdb for current collision d_bz = grpo->getNominalL3Field(); @@ -315,7 +316,7 @@ struct Pi0EtaToGammaGammaMC { ~Pi0EtaToGammaGammaMC() { delete f1fd_k0s_to_pi0; - f1fd_k0s_to_pi0 = 0x0; + f1fd_k0s_to_pi0 = nullptr; } void DefineEMEventCut() @@ -370,8 +371,7 @@ struct Pi0EtaToGammaGammaMC { fV0PhotonCut.SetNClassesMl(pcmcuts.cfg_nclasses_ml); fV0PhotonCut.SetMlTimestampCCDB(pcmcuts.cfg_timestamp_ccdb); fV0PhotonCut.SetCcdbUrl(ccdburl); - CentType mCentralityTypeMlEnum; - mCentralityTypeMlEnum = static_cast(cfgCentEstimator.value); + auto mCentralityTypeMlEnum = static_cast(cfgCentEstimator.value); fV0PhotonCut.SetCentralityTypeMl(mCentralityTypeMlEnum); fV0PhotonCut.SetCutDirMl(pcmcuts.cfg_cut_dir_ml); fV0PhotonCut.SetMlModelPathsCCDB(pcmcuts.cfg_model_paths_ccdb); @@ -597,7 +597,7 @@ struct Pi0EtaToGammaGammaMC { continue; } - const float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; + const std::array centralities = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; fV0PhotonCut.SetCentrality(centralities[cfgCentEstimator]); if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { continue; @@ -730,10 +730,11 @@ struct Pi0EtaToGammaGammaMC { } if (g1mc.globalIndex() == g2mc.globalIndex()) { - if (o2::aod::pwgem::dilepton::utils::mcutil::getMotherPDGCode(g1mc, mcparticles) == PDG_t::kPi0) + if (o2::aod::pwgem::dilepton::utils::mcutil::getMotherPDGCode(g1mc, mcparticles) == PDG_t::kPi0) { fRegistry.fill(HIST("Pair/Pi0/hs_FromSameGamma"), v12.M(), v12.Pt(), wpair); - else if (o2::aod::pwgem::dilepton::utils::mcutil::getMotherPDGCode(g1mc, mcparticles) == o2::constants::physics::Pdg::kEta) + } else if (o2::aod::pwgem::dilepton::utils::mcutil::getMotherPDGCode(g1mc, mcparticles) == o2::constants::physics::Pdg::kEta) { fRegistry.fill(HIST("Pair/Eta/hs_FromSameGamma"), v12.M(), v12.Pt(), wpair); + } continue; } @@ -951,7 +952,7 @@ struct Pi0EtaToGammaGammaMC { continue; } - float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; + std::array centralities = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { continue; } diff --git a/PWGEM/PhotonMeson/Core/V0PhotonCut.cxx b/PWGEM/PhotonMeson/Core/V0PhotonCut.cxx index 42f774b4e65..cc4539141c2 100644 --- a/PWGEM/PhotonMeson/Core/V0PhotonCut.cxx +++ b/PWGEM/PhotonMeson/Core/V0PhotonCut.cxx @@ -74,7 +74,7 @@ void V0PhotonCut::SetAPRange(float max_alpha, float max_qt) } void V0PhotonCut::SetMaxMeePsiPairDep(std::function psiDepCut) { - mMaxMeePsiPairDep = psiDepCut; + mMaxMeePsiPairDep = std::move(psiDepCut); LOG(info) << "V0 Photon Cut, set max mee psi pair dep: " << mMaxMeePsiPairDep(0.1); } void V0PhotonCut::SetRxyRange(float min, float max, float midL, float midH) @@ -209,7 +209,7 @@ void V0PhotonCut::SetMaxDcaZ(float maxDcaZ) void V0PhotonCut::SetMaxDcaXYPtDep(std::function ptDepCut) { - mMaxDcaXYPtDep = ptDepCut; + mMaxDcaXYPtDep = std::move(ptDepCut); LOG(info) << "V0 Photon Cut, set max DCA xy pt dep: " << mMaxDcaXYPtDep(1.0); } @@ -341,9 +341,9 @@ void V0PhotonCut::SetNClassesMl(int nClasses) LOG(info) << "V0 Photon Cut, set number of classes ML: " << mNClassesMl; } -void V0PhotonCut::SetNamesInputFeatures(const std::vector& featureNames) +void V0PhotonCut::SetNamesInputFeatures(const std::vector& namesInputFeaturesVec) { - mNamesInputFeatures = featureNames; + mNamesInputFeatures = namesInputFeaturesVec; mMlInputFeatures.reserve(mNamesInputFeatures.size()); LOG(info) << "V0 Photon Cut, set ML input feature names with size:" << mNamesInputFeatures.size(); } diff --git a/PWGEM/PhotonMeson/Core/V0PhotonCut.h b/PWGEM/PhotonMeson/Core/V0PhotonCut.h index 2b3bab76ac7..d5c8e30e236 100644 --- a/PWGEM/PhotonMeson/Core/V0PhotonCut.h +++ b/PWGEM/PhotonMeson/Core/V0PhotonCut.h @@ -46,11 +46,7 @@ #include #include -namespace o2::analysis -{ - -// namespace per channel -namespace em_cuts_ml +namespace o2::analysis::em_cuts_ml { // direction of the cut enum CutDirection { @@ -64,7 +60,7 @@ static constexpr int NBins = 12; static constexpr int NBinsPt = 12; static constexpr int NCutScores = 2; // default values for the pT bin edges, offset by 1 from the bin numbers in cuts array -constexpr double BinsPt[NBinsPt + 1] = { +constexpr std::array BinsPt = { 0., 0.25, 0.5, @@ -78,9 +74,9 @@ constexpr double BinsPt[NBinsPt + 1] = { 20., 50., 100.}; -const auto vecBinsPt = std::vector{BinsPt, BinsPt + NBinsPt + 1}; +const auto vecBinsPt = std::vector{BinsPt.begin(), BinsPt.end()}; static constexpr int NBinsCent = 11; -constexpr double BinsCent[NBinsCent + 1] = { +constexpr std::array BinsCent = { 0., 5, 10, @@ -93,30 +89,29 @@ constexpr double BinsCent[NBinsCent + 1] = { 80, 90, 100.}; -const auto vecBinsCent = std::vector{BinsCent, BinsCent + NBinsCent + 1}; +const auto vecBinsCent = std::vector{BinsCent.begin(), BinsCent.end()}; // default values for the ML model paths, one model per pT bin static const std::vector modelPaths = { ""}; // default values for the cut directions -constexpr int CutDir[NCutScores] = {CutGreater, CutSmaller}; -const auto vecCutDir = std::vector{CutDir, CutDir + NCutScores}; +constexpr std::array CutDir = {CutGreater, CutSmaller}; +const auto vecCutDir = std::vector{CutDir.begin(), CutDir.end()}; // default values for the cuts -constexpr double Cuts[NBins][NCutScores] = { - {0.5, 0.5}, - {0.5, 0.5}, - {0.5, 0.5}, - {0.5, 0.5}, - {0.5, 0.5}, - {0.5, 0.5}, - {0.5, 0.5}, - {0.5, 0.5}, - {0.5, 0.5}, - {0.5, 0.5}, - {0.5, 0.5}, - {0.5, 0.5}}; +constexpr std::array, NBins> Cuts = {{{0.5, 0.5}, + {0.5, 0.5}, + {0.5, 0.5}, + {0.5, 0.5}, + {0.5, 0.5}, + {0.5, 0.5}, + {0.5, 0.5}, + {0.5, 0.5}, + {0.5, 0.5}, + {0.5, 0.5}, + {0.5, 0.5}, + {0.5, 0.5}}}; // row labels static const std::vector labelsPt = { @@ -148,9 +143,8 @@ static const std::vector labelsCent = { // column labels static const std::vector labelsCutScore = {"score background", "score primary photons"}; -} // namespace em_cuts_ml -} // namespace o2::analysis +} // namespace o2::analysis::em_cuts_ml namespace o2::analysis::em::v0 { @@ -214,8 +208,8 @@ class V0PhotonCut : public TNamed kRadAndAngle = 2 }; - const std::string getName() const { return name; } - const std::string getTitle() const { return title; } + const std::string& getName() const { return name; } + const std::string& getTitle() const { return title; } /// \brief add histograms to registry /// \param fRegistry pointer to histogram registry @@ -307,7 +301,7 @@ class V0PhotonCut : public TNamed void fillBeforePhotonHistogram(TV0 const& v0, TLeg1 const& pos, TLeg2 const& ele, o2::framework::HistogramRegistry* fRegistry = nullptr) const { - if (mDoQA == false || fRegistry == nullptr) { + if (!mDoQA || fRegistry == nullptr) { return; } @@ -337,7 +331,7 @@ class V0PhotonCut : public TNamed void fillAfterPhotonHistogram(TV0 const& v0, TLeg1 const& pos, TLeg2 const& ele, o2::framework::HistogramRegistry* fRegistry = nullptr) const { - if (mDoQA == false || fRegistry == nullptr) { + if (!mDoQA || fRegistry == nullptr) { return; } @@ -1018,7 +1012,7 @@ class V0PhotonCut : public TNamed int binsNCent = static_cast(mBinsCentMl.size()) - 1; int binsN = binsNPt * binsNCent; if (binsN * static_cast(mCutDirMl.size()) != static_cast(mCutsMlFlat.size())) { - LOG(fatal) << "Mismatch in number of bins and cuts provided for 2D ML application: binsN * mCutDirMl: " << int(binsN) * int(mCutDirMl.size()) << " bins vs. mCutsMlFlat: " << mCutsMlFlat.size() << " cuts"; + LOG(fatal) << "Mismatch in number of bins and cuts provided for 2D ML application: binsN * mCutDirMl: " << binsN * static_cast(mCutDirMl.size()) << " bins vs. mCutsMlFlat: " << mCutsMlFlat.size() << " cuts"; } if (binsN != static_cast(mOnnxFileNames.size())) { LOG(fatal) << "Mismatch in number of bins and ONNX files provided for 2D ML application: binsN " << binsN << " bins vs. mOnnxFileNames: " << mOnnxFileNames.size() << " ONNX files"; @@ -1064,7 +1058,7 @@ class V0PhotonCut : public TNamed mEmMlResponse->init(); } - const std::span getBDTValue() const + std::span getBDTValue() const { return mMlBDTScores; } @@ -1178,7 +1172,7 @@ class V0PhotonCut : public TNamed float mMaxPCA{2.f}; float mMaxChi2KF{1e+10}; float mMaxMarginZ{7.f}; - std::function mMaxMeePsiPairDep{}; // max mee as a function of psipair + std::function mMaxMeePsiPairDep; // max mee as a function of psipair bool mIsOnWwireIB{false}; bool mIsOnWwireOB{false}; bool mRejectITSib{false}; @@ -1186,7 +1180,7 @@ class V0PhotonCut : public TNamed float mMinV0DistSquared{1.}; // for TooCloseV0Cut: cut value when using squared distance between conversion points float mDeltaR{6.}; // for TooCloseV0Cut: V0PhotonCut::TooCloseCuts::kRadAndAngle when deltaR < this -> compare chi2 float mMinOpeningAngle{0.02}; // for TooCloseV0Cut: V0PhotonCut::TooCloseCuts::kRadAndAngle when opening angle < this -> compare chi2 - mutable std::vector mRejectMask{}; + mutable std::vector mRejectMask; // ML cuts bool mApplyMlCuts{false}; @@ -1208,9 +1202,9 @@ class V0PhotonCut : public TNamed std::vector mCutsMlFlat{std::vector{0.5}}; o2::analysis::EmMlResponsePCM* mEmMlResponse{nullptr}; mutable bool mIsSelectedMl{false}; - mutable std::vector mOutputML{}; - mutable std::vector mMlInputFeatures{}; - mutable std::span mMlBDTScores{}; + mutable std::vector mOutputML; + mutable std::vector mMlInputFeatures; + mutable std::span mMlBDTScores; CentType mCentralityTypeMl{CentType::CentFT0C}; mutable V0PhotonCandidate mV0PhotonForMl; @@ -1232,9 +1226,9 @@ class V0PhotonCut : public TNamed float mMinChi2PerClusterITS{-1e10f}, mMaxChi2PerClusterITS{1e10f}; // max its fit chi2 per ITS cluster float mMinMeanClusterSizeITS{-1e10f}, mMaxMeanClusterSizeITS{1e10f}; // max x cos(Lmabda) - float mMaxDcaXY{1e10f}; // max dca in xy plane - float mMaxDcaZ{1e10f}; // max dca in z direction - std::function mMaxDcaXYPtDep{}; // max dca in xy plane as function of pT + float mMaxDcaXY{1e10f}; // max dca in xy plane + float mMaxDcaZ{1e10f}; // max dca in z direction + std::function mMaxDcaXYPtDep; // max dca in xy plane as function of pT bool mRequireITSTPC{false}; bool mRequireITSonly{false}; bool mRequireTPConly{false}; diff --git a/PWGEM/PhotonMeson/Tasks/pcmQC.cxx b/PWGEM/PhotonMeson/Tasks/pcmQC.cxx index eb5cc707f0d..47052298f51 100644 --- a/PWGEM/PhotonMeson/Tasks/pcmQC.cxx +++ b/PWGEM/PhotonMeson/Tasks/pcmQC.cxx @@ -143,10 +143,10 @@ struct PCMQC { } pcmcuts; o2::ccdb::CcdbApi ccdbApi; - o2::framework::Service ccdb; - int mRunNumber; - float d_bz; - static constexpr std::string_view event_types[2] = {"before/", "after/"}; + o2::framework::Service ccdb{}; + int mRunNumber = 0; + float d_bz = 0; + static constexpr std::array event_types = {"before/", "after/"}; HistogramRegistry fRegistry{"output", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; void init(InitContext&) @@ -183,10 +183,11 @@ struct PCMQC { } auto run3grp_timestamp = collision.timestamp(); - o2::parameters::GRPObject* grpo = 0x0; - o2::parameters::GRPMagField* grpmag = 0x0; - if (!skipGRPOquery) + o2::parameters::GRPObject* grpo = nullptr; + o2::parameters::GRPMagField* grpmag = nullptr; + if (!skipGRPOquery) { grpo = ccdb->getForTimeStamp(grpPath, run3grp_timestamp); + } if (grpo) { // Fetch magnetic field from ccdb for current collision d_bz = grpo->getNominalL3Field(); @@ -349,8 +350,7 @@ struct PCMQC { fV0PhotonCut.SetNClassesMl(pcmcuts.cfg_nclasses_ml); fV0PhotonCut.SetMlTimestampCCDB(pcmcuts.cfg_timestamp_ccdb); fV0PhotonCut.SetCcdbUrl(ccdburl); - CentType mCentralityTypeMlEnum; - mCentralityTypeMlEnum = static_cast(cfgCentEstimator.value); + auto mCentralityTypeMlEnum = static_cast(cfgCentEstimator.value); fV0PhotonCut.SetCentralityTypeMl(mCentralityTypeMlEnum); fV0PhotonCut.SetCutDirMl(pcmcuts.cfg_cut_dir_ml); fV0PhotonCut.SetMlModelPathsCCDB(pcmcuts.cfg_model_paths_ccdb); @@ -496,7 +496,7 @@ struct PCMQC { { for (const auto& collision : collisions) { initCCDB(collision); - const float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; + const std::array centralities = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { continue; } @@ -519,7 +519,7 @@ struct PCMQC { continue; } fillV0Info(v0); - for (auto& leg : {pos, ele}) { + for (const auto& leg : {pos, ele}) { fillV0LegInfo(leg); } if (pcmcuts.cfg_dEdx_postcalibration) { @@ -548,8 +548,8 @@ struct PCMQC { PROCESS_SWITCH(PCMQC, processDummy, "Dummy function", false); }; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +WorkflowSpec defineDataProcessing(ConfigContext const& context) { return WorkflowSpec{ - adaptAnalysisTask(cfgc, TaskName{"pcm-qc"})}; + adaptAnalysisTask(context, TaskName{"pcm-qc"})}; } diff --git a/PWGEM/PhotonMeson/Tasks/pcmQCMC.cxx b/PWGEM/PhotonMeson/Tasks/pcmQCMC.cxx index 954897c8eec..e7c1ce2a34b 100644 --- a/PWGEM/PhotonMeson/Tasks/pcmQCMC.cxx +++ b/PWGEM/PhotonMeson/Tasks/pcmQCMC.cxx @@ -9,7 +9,7 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// \file MaterialBudget.cxx +/// \file pcmQCMC.cxx /// \brief This code runs loop over v0 photons for PCM QC in MC. /// \author Daiki Sekihata, daiki.sekihata@cern.ch @@ -161,12 +161,12 @@ struct PCMQCMC { } pcmcuts; o2::ccdb::CcdbApi ccdbApi; - o2::framework::Service ccdb; - int mRunNumber; - float d_bz; + o2::framework::Service ccdb{}; + int mRunNumber = 0; + float d_bz = 0; HistogramRegistry fRegistry{"output", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; - static constexpr std::string_view event_types[2] = {"before/", "after/"}; - static constexpr std::string_view mcphoton_types[5] = {"primary/", "fromWD/", "fromHS/", "fromPi0Dalitz/", "fromEtaDalitz/"}; + static constexpr std::array event_types = {"before/", "after/"}; + static constexpr std::array mcphoton_types = {"primary/", "fromWD/", "fromHS/", "fromPi0Dalitz/", "fromEtaDalitz/"}; void init(InitContext&) { @@ -202,10 +202,11 @@ struct PCMQCMC { } auto run3grp_timestamp = collision.timestamp(); - o2::parameters::GRPObject* grpo = 0x0; - o2::parameters::GRPMagField* grpmag = 0x0; - if (!skipGRPOquery) + o2::parameters::GRPObject* grpo = nullptr; + o2::parameters::GRPMagField* grpmag = nullptr; + if (!skipGRPOquery) { grpo = ccdb->getForTimeStamp(grpPath, run3grp_timestamp); + } if (grpo) { // Fetch magnetic field from ccdb for current collision d_bz = grpo->getNominalL3Field(); @@ -226,6 +227,7 @@ struct PCMQCMC { void addhistograms() { std::vector ptbins; + ptbins.reserve(72); for (int i = 0; i < 2; i++) { ptbins.emplace_back(0.05 * (i - 0) + 0.0); // from 0 to 0.05 GeV/c, every 0.05 GeV/c } @@ -433,8 +435,7 @@ struct PCMQCMC { fV0PhotonCut.SetNClassesMl(pcmcuts.cfg_nclasses_ml); fV0PhotonCut.SetMlTimestampCCDB(pcmcuts.cfg_timestamp_ccdb); fV0PhotonCut.SetCcdbUrl(ccdburl); - CentType mCentralityTypeMlEnum; - mCentralityTypeMlEnum = static_cast(cfgCentEstimator.value); + auto mCentralityTypeMlEnum = static_cast(cfgCentEstimator.value); fV0PhotonCut.SetCentralityTypeMl(mCentralityTypeMlEnum); fV0PhotonCut.SetCutDirMl(pcmcuts.cfg_cut_dir_ml); fV0PhotonCut.SetMlModelPathsCCDB(pcmcuts.cfg_model_paths_ccdb); @@ -609,7 +610,7 @@ struct PCMQCMC { { for (const auto& collision : collisions) { initCCDB(collision); - const float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; + const std::array centralities = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { continue; } @@ -752,7 +753,7 @@ struct PCMQCMC { // all MC tracks which belong to the MC event corresponding to the current reconstructed event for (const auto& collision : collisions) { - const float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; + const std::array centralities = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { continue; } @@ -812,8 +813,8 @@ struct PCMQCMC { PROCESS_SWITCH(PCMQCMC, processDummy, "Dummy function", true); }; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +WorkflowSpec defineDataProcessing(ConfigContext const& context) { return WorkflowSpec{ - adaptAnalysisTask(cfgc, TaskName{"pcm-qc-mc"})}; + adaptAnalysisTask(context, TaskName{"pcm-qc-mc"})}; }