diff --git a/PWGEM/PhotonMeson/CMakeLists.txt b/PWGEM/PhotonMeson/CMakeLists.txt index 1ff6de24294..f23f9fb3690 100644 --- a/PWGEM/PhotonMeson/CMakeLists.txt +++ b/PWGEM/PhotonMeson/CMakeLists.txt @@ -14,3 +14,5 @@ add_subdirectory(Core) add_subdirectory(Tasks) add_subdirectory(TableProducer) + +#add_subdirectory(Legacy) diff --git a/PWGEM/PhotonMeson/Core/DalitzEECut.h b/PWGEM/PhotonMeson/Core/DalitzEECut.h index 09df413654a..0e04d27f7d1 100644 --- a/PWGEM/PhotonMeson/Core/DalitzEECut.h +++ b/PWGEM/PhotonMeson/Core/DalitzEECut.h @@ -20,7 +20,6 @@ #include "PWGEM/Dilepton/Utils/PairUtilities.h" #include -#include #include #include // IWYU pragma: keep (do not replace with Math/Vector4Dfwd.h) diff --git a/PWGEM/PhotonMeson/Core/EMCPhotonCut.cxx b/PWGEM/PhotonMeson/Core/EMCPhotonCut.cxx index a58973f9446..b46f1a11b32 100644 --- a/PWGEM/PhotonMeson/Core/EMCPhotonCut.cxx +++ b/PWGEM/PhotonMeson/Core/EMCPhotonCut.cxx @@ -23,7 +23,7 @@ #include #include -std::array(EMCPhotonCut::EMCPhotonCuts::kNCuts)> EMCPhotonCut::mCutNames = {"Definition", "Energy", "NCell", "M02", "Timing", "TrackMatching", "SecTrackMatching", "Exotic"}; +const std::array(EMCPhotonCut::EMCPhotonCuts::kNCuts)> EMCPhotonCut::mCutNames = {"Definition", "Energy", "NCell", "M02", "Timing", "TrackMatching", "SecTrackMatching", "Exotic"}; void EMCPhotonCut::SetClusterizer(const std::string& clusterDefinitionString) { diff --git a/PWGEM/PhotonMeson/Core/EMCPhotonCut.h b/PWGEM/PhotonMeson/Core/EMCPhotonCut.h index 86227bfe02c..5567ca37c5f 100644 --- a/PWGEM/PhotonMeson/Core/EMCPhotonCut.h +++ b/PWGEM/PhotonMeson/Core/EMCPhotonCut.h @@ -17,6 +17,7 @@ #define PWGEM_PHOTONMESON_CORE_EMCPHOTONCUT_H_ #include "PWGEM/PhotonMeson/Core/EMBitFlags.h" +#include "PWGEM/PhotonMeson/DataModel/EventTables.h" // IWYU pragma: keep #include "PWGEM/PhotonMeson/DataModel/gammaTables.h" #include @@ -29,6 +30,7 @@ #include +#include #include #include #include @@ -61,7 +63,7 @@ concept IsNonLinContainer = o2::soa::is_table && requires(T t) { }; template -concept IsTrackIterator = o2::soa::is_iterator && requires(T t) { +concept IsFullTrackIterator = o2::soa::is_iterator && !o2::soa::is_filtered_iterator && requires(T t) { // Check that the *elements* of the container have the required methods: { t.deltaEta() } -> std::same_as; { t.deltaPhi() } -> std::same_as; @@ -70,7 +72,7 @@ concept IsTrackIterator = o2::soa::is_iterator && requires(T t) { }; template -concept IsTrackContainer = o2::soa::is_table && requires(T t) { +concept IsFullTrackContainer = o2::soa::is_table && o2::soa::is_not_filtered_table && requires(T t) { // Check that the *elements* of the container have the required methods: { t.begin().deltaEta() } -> std::same_as; { t.begin().deltaPhi() } -> std::same_as; @@ -134,7 +136,7 @@ class EMCPhotonCut const std::string& getName() const { return name; } const std::string& getTitle() const { return title; } - static std::array(EMCPhotonCut::EMCPhotonCuts::kNCuts)> mCutNames; + static const std::array(EMCPhotonCut::EMCPhotonCuts::kNCuts)> mCutNames; static constexpr auto getClusterId(o2::soa::is_iterator auto const& t) { @@ -198,18 +200,18 @@ class EMCPhotonCut /// \brief performs check if track is matched with given cluster /// \param cluster cluster to be checked /// \param emcmatchedtrack matched track iterator - /// \param emcmatchedtrackEnd matched track end iterator + /// \param nMatchedTracks number of matched tracks /// \param GetEtaCut lambda to get the eta cut value /// \param GetPhiCut lambda to get the phi cut value /// \param applyEoverP bool to check if E/p should be checked (for secondaries we do not check this!) - bool checkTrackMatching(o2::soa::is_iterator auto const& cluster, IsTrackIterator auto& emcmatchedtrack, o2::soa::RowViewSentinel const emcmatchedtrackEnd, bool applyEoverP, auto GetEtaCut, auto GetPhiCut, o2::framework::HistogramRegistry* fRegistry = nullptr, TrackType trackType = TrackType::kPrimary) const + bool checkTrackMatching(o2::soa::is_iterator auto const& cluster, IsFullTrackIterator auto& emcmatchedtrack, int64_t const nMatchedTracks, bool applyEoverP, auto GetEtaCut, auto GetPhiCut, o2::framework::HistogramRegistry* fRegistry = nullptr, TrackType trackType = TrackType::kPrimary) const { // advance to cluster - while (emcmatchedtrack != emcmatchedtrackEnd && getClusterId(emcmatchedtrack) < cluster.globalIndex()) { + while (emcmatchedtrack.globalIndex() < nMatchedTracks && getClusterId(emcmatchedtrack) < cluster.globalIndex()) { ++emcmatchedtrack; } // all matched tracks have been checked - if (emcmatchedtrack == emcmatchedtrackEnd) { + if (emcmatchedtrack.globalIndex() >= nMatchedTracks) { return true; } // if all remaining tracks are beyond this cluster, it survives @@ -217,7 +219,7 @@ class EMCPhotonCut return true; } // iterate over tracks belonging to this cluster - while (emcmatchedtrack != emcmatchedtrackEnd && getClusterId(emcmatchedtrack) == cluster.globalIndex()) { + while (emcmatchedtrack.globalIndex() < nMatchedTracks && getClusterId(emcmatchedtrack) == cluster.globalIndex()) { const auto dEta = emcmatchedtrack.deltaEta(); const auto dPhi = emcmatchedtrack.deltaPhi(); const auto fdEta = std::fabs(emcmatchedtrack.deltaEta()); @@ -286,18 +288,18 @@ class EMCPhotonCut /// \brief check if given clusters survives all cuts /// \param flags EMBitFlags where results will be stored /// \param cluster cluster table to check - /// \param matchedTracks matched primary tracks table - /// \param matchedSecondaries matched secondary tracks table + /// \param matchedTracks matched primary tracks table. HAS TO BE FULL TABLE! + /// \param matchedSecondaries matched secondary tracks table. HAS TO BE FULL TABLE! /// \param fRegistry o2::framework::HistogramRegistry pointer of the main task - void AreSelectedRunning(EMBitFlags& flags, o2::soa::is_table auto const& clusters, IsTrackContainer auto const& emcmatchedtracks, IsTrackContainer auto const& secondaries, o2::framework::HistogramRegistry* fRegistry = nullptr) const + void AreSelectedRunning(EMBitFlags& flags, o2::soa::is_table auto const& clusters, IsFullTrackContainer auto const& emcmatchedtracks, IsFullTrackContainer auto const& secondaries, o2::framework::HistogramRegistry* fRegistry = nullptr) const { if (clusters.size() <= 0) { return; } auto emcmatchedtrackIter = emcmatchedtracks.begin(); - auto emcmatchedtrackEnd = emcmatchedtracks.end(); + int64_t nMatchedTracks = emcmatchedtracks.size(); auto secondaryIter = secondaries.begin(); - auto secondaryEnd = secondaries.end(); + int64_t nSecondaryTracks = secondaries.size(); size_t iCluster = 0; const bool doQA = mDoQA && fRegistry != nullptr; @@ -309,7 +311,7 @@ class EMCPhotonCut if (doQA) { fillBeforeClusterHistogram(cluster, fRegistry); } - if (!IsSelectedRunning(cluster, emcmatchedtrackIter, emcmatchedtrackEnd, secondaryIter, secondaryEnd, fRegistry)) { + if (!IsSelectedRunning(cluster, emcmatchedtrackIter, nMatchedTracks, secondaryIter, nSecondaryTracks, fRegistry)) { flags.set(iCluster); } else if (doQA) { fillAfterClusterHistogram(cluster, fRegistry); @@ -329,11 +331,11 @@ class EMCPhotonCut /// \brief check if given cluster survives all cuts /// \param cluster cluster to check /// \param emcmatchedtrackIter current iterator of matched primary tracks - /// \param emcmatchedtrackEnd end iterator of matched primary tracks + /// \param nMatchedTracks number of matched primary tracks /// \param secondaryIter current iterator of matched secondary tracks - /// \param secondaryEnd end iterator of matched secondary tracks + /// \param nSecondaryTracks number of matched secondary tracks /// \return true if cluster survives all cuts else false - bool IsSelectedRunning(o2::soa::is_iterator auto const& cluster, IsTrackIterator auto& emcmatchedtrackIter, o2::soa::RowViewSentinel const emcmatchedtrackEnd, IsTrackIterator auto& secondaryIter, o2::soa::RowViewSentinel const secondaryEnd, o2::framework::HistogramRegistry* fRegistry = nullptr) const + bool IsSelectedRunning(o2::soa::is_iterator auto const& cluster, IsFullTrackIterator auto& emcmatchedtrackIter, int64_t const nMatchedTracks, IsFullTrackIterator auto& secondaryIter, int64_t const nSecondaryTracks, o2::framework::HistogramRegistry* fRegistry = nullptr) const { const bool doQA = mDoQA && fRegistry != nullptr; if (!IsSelectedEMCalRunning(EMCPhotonCuts::kDefinition, cluster)) { @@ -366,13 +368,13 @@ class EMCPhotonCut } return false; } - if (mUseTM && (!IsSelectedEMCalRunning(EMCPhotonCuts::kTM, cluster, emcmatchedtrackIter, emcmatchedtrackEnd, fRegistry))) { + if (mUseTM && (!IsSelectedEMCalRunning(EMCPhotonCuts::kTM, cluster, emcmatchedtrackIter, nMatchedTracks, fRegistry))) { if (doQA) { fRegistry->fill(HIST("QA/Cluster/hClusterQualityCuts"), static_cast(EMCPhotonCuts::kTM) + 1, cluster.e()); } return false; } - if (mUseSecondaryTM && (!IsSelectedEMCalRunning(EMCPhotonCuts::kSecondaryTM, cluster, secondaryIter, secondaryEnd, fRegistry))) { + if (mUseSecondaryTM && (!IsSelectedEMCalRunning(EMCPhotonCuts::kSecondaryTM, cluster, secondaryIter, nSecondaryTracks, fRegistry))) { if (doQA) { fRegistry->fill(HIST("QA/Cluster/hClusterQualityCuts"), static_cast(EMCPhotonCuts::kSecondaryTM) + 1, cluster.e()); } @@ -437,16 +439,16 @@ class EMCPhotonCut /// \param cut enum of the cluster cut to check /// \param cluster cluster to check /// \param matchedTrackIter current iterator of matched primary or secondary tracks - /// \param matchedTrackEnd end iterator of matched primary or secondary tracks + /// \param nMatchedTracks number of matched primary or secondary tracks /// \return true if cluster survives cut else false - bool IsSelectedEMCalRunning(const EMCPhotonCuts& cut, o2::soa::is_iterator auto const& cluster, IsTrackIterator auto& matchedTrackIter, o2::soa::RowViewSentinel const matchedTrackEnd, o2::framework::HistogramRegistry* fRegistry = nullptr) const + bool IsSelectedEMCalRunning(const EMCPhotonCuts& cut, o2::soa::is_iterator auto const& cluster, IsFullTrackIterator auto& matchedTrackIter, int64_t const nMatchedTracks, o2::framework::HistogramRegistry* fRegistry = nullptr) const { switch (cut) { case EMCPhotonCuts::kTM: - return checkTrackMatching(cluster, matchedTrackIter, matchedTrackEnd, true, [this](float pt) { return GetTrackMatchingEta(pt); }, [this](float pt) { return GetTrackMatchingPhi(pt); }, fRegistry, TrackType::kPrimary); + return checkTrackMatching(cluster, matchedTrackIter, nMatchedTracks, true, [this](float pt) { return GetTrackMatchingEta(pt); }, [this](float pt) { return GetTrackMatchingPhi(pt); }, fRegistry, TrackType::kPrimary); case EMCPhotonCuts::kSecondaryTM: - return checkTrackMatching(cluster, matchedTrackIter, matchedTrackEnd, false, [this](float pt) { return GetSecTrackMatchingEta(pt); }, [this](float pt) { return GetSecTrackMatchingPhi(pt); }, fRegistry, TrackType::kSecondary); + return checkTrackMatching(cluster, matchedTrackIter, nMatchedTracks, false, [this](float pt) { return GetSecTrackMatchingEta(pt); }, [this](float pt) { return GetSecTrackMatchingPhi(pt); }, fRegistry, TrackType::kSecondary); default: return true; @@ -518,7 +520,7 @@ class EMCPhotonCut return mMinTime <= cluster.time() && cluster.time() <= mMaxTime; case EMCPhotonCuts::kTM: { - if constexpr (IsTrackContainer) { + if constexpr (IsFullTrackContainer) { for (const auto& emcmatchedtrack : emcmatchedtracks) { auto dEta = std::fabs(emcmatchedtrack.deltaEta()); auto dPhi = std::fabs(emcmatchedtrack.deltaPhi()); @@ -551,7 +553,7 @@ class EMCPhotonCut return true; // when we don't have any tracks the cluster should always survive the TM cut! } case EMCPhotonCuts::kSecondaryTM: { - if constexpr (IsTrackContainer) { + if constexpr (IsFullTrackContainer) { for (const auto& emcmatchedtrack : emcmatchedtracks) { auto dEta = std::fabs(emcmatchedtrack.deltaEta()); auto dPhi = std::fabs(emcmatchedtrack.deltaPhi()); diff --git a/PWGEM/PhotonMeson/Core/PHOSPhotonCut.cxx b/PWGEM/PhotonMeson/Core/PHOSPhotonCut.cxx index 1fc60c9e30f..2170f15b4e8 100644 --- a/PWGEM/PhotonMeson/Core/PHOSPhotonCut.cxx +++ b/PWGEM/PhotonMeson/Core/PHOSPhotonCut.cxx @@ -17,11 +17,10 @@ #include -#include +#include +#include -ClassImp(PHOSPhotonCut); - -const char* PHOSPhotonCut::mCutNames[static_cast(PHOSPhotonCut::PHOSPhotonCuts::kNCuts)] = {"Energy", "Dispersion", "CPV"}; +const std::array(PHOSPhotonCut::PHOSPhotonCuts::kNCuts)> PHOSPhotonCut::mCutNames = {"Energy", "Dispersion", "CPV"}; void PHOSPhotonCut::SetEnergyRange(float min, float max) { diff --git a/PWGEM/PhotonMeson/Core/PHOSPhotonCut.h b/PWGEM/PhotonMeson/Core/PHOSPhotonCut.h index db448562f61..1fd7e753a6f 100644 --- a/PWGEM/PhotonMeson/Core/PHOSPhotonCut.h +++ b/PWGEM/PhotonMeson/Core/PHOSPhotonCut.h @@ -16,9 +16,10 @@ #ifndef PWGEM_PHOTONMESON_CORE_PHOSPHOTONCUT_H_ #define PWGEM_PHOTONMESON_CORE_PHOSPHOTONCUT_H_ -#include #include +#include +#include #include class PHOSPhotonCut @@ -34,10 +35,10 @@ class PHOSPhotonCut kNCuts }; - const std::string getName() const { return name; } - const std::string getTitle() const { return title; } + [[nodiscard]] const std::string& getName() const { return name; } + [[nodiscard]] const std::string& getTitle() const { return title; } - static const char* mCutNames[static_cast(PHOSPhotonCuts::kNCuts)]; + static const std::array(PHOSPhotonCuts::kNCuts)> mCutNames; // Temporary function to check if track passes selection criteria. To be replaced by framework filters. template @@ -55,10 +56,10 @@ class PHOSPhotonCut } // only temporary solution to avoid noisy channels. - if (-1.20 + 10.2 * sqrt(cluster.e()) < cluster.nCells()) { + if (-1.20 + 10.2 * std::sqrt(cluster.e()) < cluster.nCells()) { return false; } - if (cluster.nCells() < -3.04 + 3.14 * sqrt(cluster.e())) { + if (cluster.nCells() < -3.04 + 3.14 * std::sqrt(cluster.e())) { return false; } @@ -81,8 +82,6 @@ class PHOSPhotonCut return cls.e() >= mMinEnergy && cls.e() <= mMaxEnergy; case PHOSPhotonCuts::kDispersion: - return true; - case PHOSPhotonCuts::kCPV: return true; diff --git a/PWGEM/PhotonMeson/Core/PairCut.cxx b/PWGEM/PhotonMeson/Core/PairCut.cxx index 5bf8273cb39..24f50ef2c23 100644 --- a/PWGEM/PhotonMeson/Core/PairCut.cxx +++ b/PWGEM/PhotonMeson/Core/PairCut.cxx @@ -17,11 +17,11 @@ #include -#include +#include +#include +#include -ClassImp(PairCut); - -const char* PairCut::mCutNames[static_cast(PairCut::PairCuts::kNCuts)] = {"Asym"}; +const std::array(PairCut::PairCuts::kNCuts)> PairCut::mCutNames = {"Asym"}; void PairCut::SetAsymRange(float min, float max) { diff --git a/PWGEM/PhotonMeson/Core/PairCut.h b/PWGEM/PhotonMeson/Core/PairCut.h index 63dfddf2bd4..aa03cb19ed8 100644 --- a/PWGEM/PhotonMeson/Core/PairCut.h +++ b/PWGEM/PhotonMeson/Core/PairCut.h @@ -16,6 +16,9 @@ #ifndef PWGEM_PHOTONMESON_CORE_PAIRCUT_H_ #define PWGEM_PHOTONMESON_CORE_PAIRCUT_H_ +#include +#include +#include #include class PairCut @@ -30,19 +33,15 @@ class PairCut kNCuts }; - const std::string getName() const { return name; } - const std::string getTitle() const { return title; } + [[nodiscard]] const std::string& getName() const { return name; } + [[nodiscard]] const std::string& getTitle() const { return title; } - static const char* mCutNames[static_cast(PairCuts::kNCuts)]; + static const std::array(PairCuts::kNCuts)> mCutNames; template bool IsSelected(G1 const& g1, G2 const& g2) const { - if (!IsSelectedPair(g1, g2, PairCuts::kAsym)) { - return false; - } - - return true; + return IsSelectedPair(g1, g2, PairCuts::kAsym); } // template @@ -51,7 +50,7 @@ class PairCut { switch (cut) { case PairCuts::kAsym: { - float asym = abs(g1.e() - g2.e()) / (g1.e() + g2.e()); + float asym = std::abs(g1.e() - g2.e()) / (g1.e() + g2.e()); // float asym = abs(g1.p() - g2.p()) / (g1.p() + g2.p()); return mMinAsym < asym && asym < mMaxAsym; } diff --git a/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h b/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h index 5da73b42f97..e1db2a28d7b 100644 --- a/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h +++ b/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h @@ -41,9 +41,10 @@ #include #include #include -#include +#include #include #include +#include #include #include #include @@ -82,9 +83,6 @@ enum AlphaMesonCutOption { template struct Pi0EtaToGammaGamma { o2::framework::Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - o2::framework::Configurable grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"}; - o2::framework::Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; - o2::framework::Configurable skipGRPOquery{"skipGRPOquery", true, "skip grpo query"}; o2::framework::Configurable d_bz_input{"d_bz_input", -999, "bz field in kG, -999 is automatic"}; o2::framework::Configurable ndiff_bc_mix{"ndiff_bc_mix", 594, "difference in global BC required in mixed events"}; @@ -273,10 +271,10 @@ struct Pi0EtaToGammaGamma { //--------------------------------------------------------------------------- // Preslices and partitions o2::framework::SliceCache cache; - o2::framework::PresliceOptional>> perCollision_pcm = o2::aod::v0photonkf::pmeventId; - o2::framework::PresliceOptional> perCollision_emc = o2::aod::emccluster::pmeventId; - o2::framework::PresliceOptional> perCollision_phos = o2::aod::phoscluster::pmeventId; - o2::framework::PresliceOptional>> perCollision_electron = o2::aod::emprimaryelectronda::pmeventId; + o2::framework::PresliceOptional perCollision_pcm = o2::aod::v0photonkf::pmeventId; + o2::framework::PresliceOptional perCollision_emc = o2::aod::emccluster::pmeventId; + o2::framework::PresliceOptional perCollision_phos = o2::aod::phoscluster::pmeventId; + o2::framework::PresliceOptional perCollision_electron = o2::aod::emprimaryelectronda::pmeventId; o2::framework::PresliceOptional perEMCClusterMT = o2::aod::mintm::minClusterId; o2::framework::PresliceOptional perEMCClusterMS = o2::aod::mintm::minClusterId; @@ -454,45 +452,33 @@ struct Pi0EtaToGammaGamma { ccdb->setFatalWhenNull(false); } - template + template void initCCDB(TCollision const& collision) { if (mRunNumber == collision.runNumber()) { return; } + if (mRunNumber == collision.runNumber()) { + return; + } // In case override, don't proceed, please - no CCDB access required - if (d_bz_input > -990) { + if (d_bz_input > -990) { // o2-linter: disable=magic-number (override value) d_bz = d_bz_input; o2::parameters::GRPMagField grpmag; - if (std::fabs(d_bz) > 1e-5) { - grpmag.setL3Current(30000.f / (d_bz / 5.0f)); + if (std::fabs(d_bz) > 1e-5) { // o2-linter: disable=magic-number (override value) + grpmag.setL3Current(30000.f / (d_bz / 5.0f)); // o2-linter: disable=magic-number (override value) } + o2::base::Propagator::initFieldFromGRP(&grpmag); mRunNumber = collision.runNumber(); return; } - auto run3grp_timestamp = collision.timestamp(); - 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(); - LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; - } else { - grpmag = ccdb->getForTimeStamp(grpmagPath, run3grp_timestamp); - if (!grpmag) { - LOG(fatal) << "Got nullptr from CCDB for path " << grpmagPath << " of object GRPMagField and " << grpPath << " of object GRPObject for timestamp " << run3grp_timestamp; - } - // Fetch magnetic field from ccdb for current collision - d_bz = std::lround(5.f * grpmag->getL3Current() / 30000.f); - LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; - } + o2::base::Propagator::initFieldFromGRP(&collision.grpMagField()); + // Fetch magnetic field from ccdb for current collision + d_bz = collision.grpMagField().getNominalL3Field(); + LOG(info) << "Retrieved GRP for timestamp " << collision.timestamp() << " with magnetic field of " << d_bz << " kZG"; fV0PhotonCut.SetD_Bz(d_bz); - mRunNumber = collision.runNumber(); } ~Pi0EtaToGammaGamma() @@ -670,7 +656,7 @@ struct Pi0EtaToGammaGamma { } /// \brief Calculate background (using rotation background method only for EMCal!) - template + template void RotationBackground(const ROOT::Math::PtEtaPhiMVector& meson, ROOT::Math::PtEtaPhiMVector photon1, ROOT::Math::PtEtaPhiMVector photon2, TPhotons const& photons_coll, unsigned int ig1, unsigned int ig2, float eventWeight) { // if less than 3 clusters are present skip event since we need at least 3 clusters @@ -1156,7 +1142,7 @@ struct Pi0EtaToGammaGamma { o2::framework::expressions::Filter prefilter_primaryelectron = ifnode(dileptoncuts.cfg_apply_cuts_from_prefilter_derived.node(), o2::aod::emprimaryelectron::pfbderived == static_cast(0), true); int ndf = 0; - void processAnalysis(o2::soa::Filtered> const& collisions, Types const&... args) + void processAnalysis(o2::soa::Filtered> const& collisions, Types const&... args) { // LOGF(info, "ndf = %d", ndf); if constexpr (pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPCMPCM) { @@ -1193,7 +1179,7 @@ struct Pi0EtaToGammaGamma { PROCESS_SWITCH(Pi0EtaToGammaGamma, processAnalysis, "process pair analysis", true); // using FilteredMyCollisionsWithJJMC = o2::soa::Filtered, o2::aod::EMEventsWeight>>; - void processAnalysisJJMC(o2::soa::Filtered, o2::aod::EMEventsWeight>> const& collisions, Types const&... args) + void processAnalysisJJMC(o2::soa::Filtered> const& collisions, Types const&... args) { // LOGF(info, "ndf = %d", ndf); if constexpr (pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPCMPCM) { diff --git a/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h b/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h index a8270f7abc6..ea43bd54900 100644 --- a/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h +++ b/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h @@ -40,7 +40,8 @@ #include #include #include -#include +#include +#include #include #include #include @@ -78,9 +79,6 @@ enum AlphaMesonCutOption { template struct Pi0EtaToGammaGammaMC { o2::framework::Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - o2::framework::Configurable grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"}; - o2::framework::Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; - o2::framework::Configurable skipGRPOquery{"skipGRPOquery", true, "skip grpo query"}; o2::framework::Configurable d_bz_input{"d_bz_input", -999, "bz field in kG, -999 is automatic"}; o2::framework::Configurable cfgQvecEstimator{"cfgQvecEstimator", 0, "FT0M:0, FT0A:1, FT0C:2"}; @@ -309,45 +307,33 @@ struct Pi0EtaToGammaGammaMC { ccdb->setFatalWhenNull(false); } - template + template void initCCDB(TCollision const& collision) { if (mRunNumber == collision.runNumber()) { return; } + if (mRunNumber == collision.runNumber()) { + return; + } // In case override, don't proceed, please - no CCDB access required - if (d_bz_input > -990) { + if (d_bz_input > -990) { // o2-linter: disable=magic-number (override value) d_bz = d_bz_input; o2::parameters::GRPMagField grpmag; - if (std::fabs(d_bz) > 1e-5) { - grpmag.setL3Current(30000.f / (d_bz / 5.0f)); + if (std::fabs(d_bz) > 1e-5) { // o2-linter: disable=magic-number (override value) + grpmag.setL3Current(30000.f / (d_bz / 5.0f)); // o2-linter: disable=magic-number (override value) } + o2::base::Propagator::initFieldFromGRP(&grpmag); mRunNumber = collision.runNumber(); return; } - auto run3grp_timestamp = collision.timestamp(); - 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(); - LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; - } else { - grpmag = ccdb->getForTimeStamp(grpmagPath, run3grp_timestamp); - if (!grpmag) { - LOG(fatal) << "Got nullptr from CCDB for path " << grpmagPath << " of object GRPMagField and " << grpPath << " of object GRPObject for timestamp " << run3grp_timestamp; - } - // Fetch magnetic field from ccdb for current collision - d_bz = std::lround(5.f * grpmag->getL3Current() / 30000.f); - LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; - } + o2::base::Propagator::initFieldFromGRP(&collision.grpMagField()); + // Fetch magnetic field from ccdb for current collision + d_bz = collision.grpMagField().getNominalL3Field(); + LOG(info) << "Retrieved GRP for timestamp " << collision.timestamp() << " with magnetic field of " << d_bz << " kZG"; fV0PhotonCut.SetD_Bz(d_bz); - mRunNumber = collision.runNumber(); } ~Pi0EtaToGammaGammaMC() @@ -483,10 +469,10 @@ struct Pi0EtaToGammaGammaMC { } o2::framework::SliceCache cache; - o2::framework::PresliceOptional>> perCollision_pcm = o2::aod::v0photonkf::pmeventId; - o2::framework::PresliceOptional> perCollision_emc = o2::aod::emccluster::pmeventId; - o2::framework::PresliceOptional> perCollision_phos = o2::aod::phoscluster::pmeventId; - o2::framework::PresliceOptional>> perCollision_electron = o2::aod::emprimaryelectronda::pmeventId; + o2::framework::PresliceOptional perCollision_pcm = o2::aod::v0photonkf::pmeventId; + o2::framework::PresliceOptional perCollision_emc = o2::aod::emccluster::pmeventId; + o2::framework::PresliceOptional perCollision_phos = o2::aod::phoscluster::pmeventId; + o2::framework::PresliceOptional perCollision_electron = o2::aod::emprimaryelectronda::pmeventId; o2::framework::PresliceOptional perEMCClusterMT = o2::aod::mintm::minClusterId; o2::framework::PresliceOptional perEMCClusterMS = o2::aod::mintm::minClusterId; @@ -510,7 +496,7 @@ struct Pi0EtaToGammaGammaMC { return s.fV0PhotonCut; } - template + template static bool applyCut(Self& s, Photon const& g) { return s.fV0PhotonCut.template IsSelected>(g); @@ -544,10 +530,10 @@ struct Pi0EtaToGammaGammaMC { } // EMCal version has optional tables for matched tracks (global and secondaries) - template - static bool applyCut(Self& s, Cluster const& c, TMatchedTracks const& emcmatchedtracks = nullptr, TMatchedSecondaries const& secondaries = nullptr) + template + static bool applyCut(Self& s, Cluster const& cluster, TMatchedTracks const& emcmatchedtracks = nullptr, TMatchedSecondaries const& secondaries = nullptr) { - return s.fEMCCut.IsSelected(c, emcmatchedtracks, secondaries); + return s.fEMCCut.IsSelected(cluster, emcmatchedtracks, secondaries); } }; @@ -565,10 +551,10 @@ struct Pi0EtaToGammaGammaMC { return s.fPHOSCut; } - template - static bool applyCut(Self& s, Cluster const& c) + template + static bool applyCut(Self& s, Cluster const& cluster) { - return s.fPHOSCut.IsSelected(c); + return s.fPHOSCut.IsSelected(cluster); } }; @@ -586,7 +572,7 @@ struct Pi0EtaToGammaGammaMC { } // Dalitz version has two tracks as argument + B_z - template + template static bool applyCut(Self& s, Track1 const& track1, Track2 const& track2, float bz) { return s.fDileptonCut.IsSelected(track1, track2, bz); @@ -969,9 +955,9 @@ struct Pi0EtaToGammaGammaMC { } o2::framework::PresliceUnsorted perMcCollision = o2::aod::emmcparticle::emmceventId; - o2::framework::PresliceUnsorted> rec_perMcCollision = o2::aod::emmceventlabel::emmceventId; + o2::framework::PresliceUnsorted rec_perMcCollision = o2::aod::emmceventlabel::emmceventId; - template + template void runGenInfo(TCollisions const& collisions, TMCCollisions const& mccollisions, TMCParticles const& /*mcparticles*/) { // loop over mc stack and fill histograms for pure MC truth signals @@ -1022,7 +1008,7 @@ struct Pi0EtaToGammaGammaMC { o2::framework::expressions::Filter prefilter_pcm = ifnode(pcmcuts.cfg_apply_cuts_from_prefilter_derived.node(), o2::aod::v0photonkf::pfbderived == static_cast(0), true); o2::framework::expressions::Filter prefilter_primaryelectron = ifnode(dileptoncuts.cfg_apply_cuts_from_prefilter_derived.node(), o2::aod::emprimaryelectron::pfbderived == static_cast(0), true); - void processAnalysis(o2::soa::Filtered> const& collisions, o2::soa::Join const& mccollisions, o2::aod::EMMCParticles const& mcparticles, Types const&... args) + void processAnalysis(o2::soa::Filtered> const& collisions, o2::soa::Join const& mccollisions, o2::aod::EMMCParticles const& mcparticles, Types const&... args) { if constexpr (pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPCMPCM) { auto&& [v0photons, v0legs] = std::forward_as_tuple(args...); @@ -1058,7 +1044,7 @@ struct Pi0EtaToGammaGammaMC { PROCESS_SWITCH(Pi0EtaToGammaGammaMC, processAnalysis, "process pair analysis", true); // using FilteredMyCollisionsWithJJMC = o2::soa::Filtered, o2::aod::EMEventsWeight>>; - void processAnalysisJJMC(o2::soa::Filtered, o2::aod::EMEventsWeight>> const& collisions, o2::soa::Join const& mccollisions, o2::aod::EMMCParticles const& mcparticles, Types const&... args) + void processAnalysisJJMC(o2::soa::Filtered> const& collisions, o2::soa::Join const& mccollisions, o2::aod::EMMCParticles const& mcparticles, Types const&... args) { if constexpr (pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPCMPCM) { auto&& [v0photons, v0legs] = std::forward_as_tuple(args...); diff --git a/PWGEM/PhotonMeson/Core/TaggingPi0.h b/PWGEM/PhotonMeson/Core/TaggingPi0.h index 59adf8f0def..e81d5e3ba9c 100644 --- a/PWGEM/PhotonMeson/Core/TaggingPi0.h +++ b/PWGEM/PhotonMeson/Core/TaggingPi0.h @@ -37,11 +37,13 @@ #include #include #include -#include +#include +#include #include #include #include #include +#include #include #include #include @@ -54,6 +56,7 @@ #include #include +#include #include #include #include @@ -64,7 +67,7 @@ #include #include -using MyCollisions = o2::soa::Join; +using MyCollisions = o2::soa::Join; using MyCollision = MyCollisions::iterator; using MyCollisionsWithJJMC = o2::soa::Join; @@ -85,9 +88,6 @@ using MyEMCCluster = MyEMCClusters::iterator; template struct TaggingPi0 { o2::framework::Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - o2::framework::Configurable grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"}; - o2::framework::Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; - o2::framework::Configurable skipGRPOquery{"skipGRPOquery", true, "skip grpo query"}; o2::framework::Configurable d_bz_input{"d_bz_input", -999, "bz field in kG, -999 is automatic"}; o2::framework::Configurable ndiff_bc_mix{"ndiff_bc_mix", 594, "difference in global BC required in mixed events"}; @@ -213,8 +213,8 @@ struct TaggingPi0 { // } phoscuts; 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::array event_types = {"before/", "after/"}; + static constexpr std::array event_pair_types = {"same/", "mix/"}; std::vector zvtx_bin_edges; std::vector cent_bin_edges; @@ -222,9 +222,9 @@ struct TaggingPi0 { std::vector occ_bin_edges; 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&) { @@ -262,51 +262,40 @@ struct TaggingPi0 { ccdb->setFatalWhenNull(false); } - template + template void initCCDB(TCollision const& collision) { if (mRunNumber == collision.runNumber()) { return; } + if (mRunNumber == collision.runNumber()) { + return; + } // In case override, don't proceed, please - no CCDB access required - if (d_bz_input > -990) { + if (d_bz_input > -990) { // o2-linter: disable=magic-number (override value) d_bz = d_bz_input; o2::parameters::GRPMagField grpmag; - if (std::fabs(d_bz) > 1e-5) { - grpmag.setL3Current(30000.f / (d_bz / 5.0f)); + if (std::fabs(d_bz) > 1e-5) { // o2-linter: disable=magic-number (override value) + grpmag.setL3Current(30000.f / (d_bz / 5.0f)); // o2-linter: disable=magic-number (override value) } + o2::base::Propagator::initFieldFromGRP(&grpmag); mRunNumber = collision.runNumber(); return; } - auto run3grp_timestamp = collision.timestamp(); - o2::parameters::GRPObject* grpo = 0x0; - o2::parameters::GRPMagField* grpmag = 0x0; - if (!skipGRPOquery) - grpo = ccdb->getForTimeStamp(grpPath, run3grp_timestamp); - if (grpo) { - // Fetch magnetic field from ccdb for current collision - d_bz = grpo->getNominalL3Field(); - LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; - } else { - grpmag = ccdb->getForTimeStamp(grpmagPath, run3grp_timestamp); - if (!grpmag) { - LOG(fatal) << "Got nullptr from CCDB for path " << grpmagPath << " of object GRPMagField and " << grpPath << " of object GRPObject for timestamp " << run3grp_timestamp; - } - // Fetch magnetic field from ccdb for current collision - d_bz = std::lround(5.f * grpmag->getL3Current() / 30000.f); - LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; - } - mRunNumber = collision.runNumber(); + o2::base::Propagator::initFieldFromGRP(&collision.grpMagField()); + // Fetch magnetic field from ccdb for current collision + d_bz = collision.grpMagField().getNominalL3Field(); + LOG(info) << "Retrieved GRP for timestamp " << collision.timestamp() << " with magnetic field of " << d_bz << " kZG"; } ~TaggingPi0() { delete emh1; - emh1 = 0x0; + emh1 = nullptr; delete emh2; - emh2 = 0x0; + emh2 = nullptr; used_photonIds_per_col.clear(); used_photonIds_per_col.shrink_to_fit(); @@ -449,7 +438,7 @@ struct TaggingPi0 { std::vector> used_dileptonIds_per_col; // std::map, uint64_t> map_mixed_eventId_to_globalBC; - template + template void runPairing(TCollisions const& collisions, TPhotons1 const& photons1, TPhotons2 const& photons2, TSubInfos1 const&, TSubInfos2 const&, @@ -469,7 +458,7 @@ struct TaggingPi0 { continue; } - 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; } @@ -506,9 +495,7 @@ struct TaggingPi0 { } 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/TaggingPi0MC.h b/PWGEM/PhotonMeson/Core/TaggingPi0MC.h index 1334a89bf98..e6248abe388 100644 --- a/PWGEM/PhotonMeson/Core/TaggingPi0MC.h +++ b/PWGEM/PhotonMeson/Core/TaggingPi0MC.h @@ -38,11 +38,13 @@ #include #include #include -#include +#include +#include #include #include #include #include +#include #include #include #include @@ -55,6 +57,7 @@ #include #include +#include #include #include #include @@ -62,7 +65,7 @@ #include #include -using MyCollisions = o2::soa::Join; +using MyCollisions = o2::soa::Join; using MyCollision = MyCollisions::iterator; using MyCollisionsWithJJMC = o2::soa::Join; @@ -89,9 +92,6 @@ using MyMCElectron = MyMCElectrons::iterator; template struct TaggingPi0MC { o2::framework::Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - o2::framework::Configurable grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"}; - o2::framework::Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; - o2::framework::Configurable skipGRPOquery{"skipGRPOquery", true, "skip grpo query"}; o2::framework::Configurable d_bz_input{"d_bz_input", -999, "bz field in kG, -999 is automatic"}; o2::framework::Configurable cfgQvecEstimator{"cfgQvecEstimator", 0, "FT0M:0, FT0A:1, FT0C:2"}; @@ -209,15 +209,15 @@ struct TaggingPi0MC { // } phoscuts; 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 parnames[2] = {"Pi0/", "Eta/"}; + static constexpr std::array event_types = {"before/", "after/"}; + static constexpr std::array event_pair_types = {"same/", "mix/"}; + static constexpr std::array parnames = {"Pi0/", "Eta/"}; o2::ccdb::CcdbApi ccdbApi; - o2::framework::Service ccdb; - int mRunNumber; - float d_bz; - TF1* f1fd_k0s_to_pi0; + o2::framework::Service ccdb{}; + int mRunNumber = 0; + float d_bz = 0; + TF1* f1fd_k0s_to_pi0 = nullptr; void init(o2::framework::InitContext&) { @@ -239,49 +239,38 @@ struct TaggingPi0MC { ccdb->setFatalWhenNull(false); } - template + template void initCCDB(TCollision const& collision) { if (mRunNumber == collision.runNumber()) { return; } + if (mRunNumber == collision.runNumber()) { + return; + } // In case override, don't proceed, please - no CCDB access required - if (d_bz_input > -990) { + if (d_bz_input > -990) { // o2-linter: disable=magic-number (override value) d_bz = d_bz_input; o2::parameters::GRPMagField grpmag; - if (std::fabs(d_bz) > 1e-5) { - grpmag.setL3Current(30000.f / (d_bz / 5.0f)); + if (std::fabs(d_bz) > 1e-5) { // o2-linter: disable=magic-number (override value) + grpmag.setL3Current(30000.f / (d_bz / 5.0f)); // o2-linter: disable=magic-number (override value) } + o2::base::Propagator::initFieldFromGRP(&grpmag); mRunNumber = collision.runNumber(); return; } - auto run3grp_timestamp = collision.timestamp(); - o2::parameters::GRPObject* grpo = 0x0; - o2::parameters::GRPMagField* grpmag = 0x0; - if (!skipGRPOquery) - grpo = ccdb->getForTimeStamp(grpPath, run3grp_timestamp); - if (grpo) { - // Fetch magnetic field from ccdb for current collision - d_bz = grpo->getNominalL3Field(); - LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; - } else { - grpmag = ccdb->getForTimeStamp(grpmagPath, run3grp_timestamp); - if (!grpmag) { - LOG(fatal) << "Got nullptr from CCDB for path " << grpmagPath << " of object GRPMagField and " << grpPath << " of object GRPObject for timestamp " << run3grp_timestamp; - } - // Fetch magnetic field from ccdb for current collision - d_bz = std::lround(5.f * grpmag->getL3Current() / 30000.f); - LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; - } - mRunNumber = collision.runNumber(); + o2::base::Propagator::initFieldFromGRP(&collision.grpMagField()); + // Fetch magnetic field from ccdb for current collision + d_bz = collision.grpMagField().getNominalL3Field(); + LOG(info) << "Retrieved GRP for timestamp " << collision.timestamp() << " with magnetic field of " << d_bz << " kZG"; } ~TaggingPi0MC() { delete f1fd_k0s_to_pi0; - f1fd_k0s_to_pi0 = 0x0; + f1fd_k0s_to_pi0 = nullptr; } void addHistogrms() @@ -418,7 +407,7 @@ struct TaggingPi0MC { o2::framework::Partition positrons = o2::aod::emprimaryelectron::sign > int8_t(0) && static_cast(dileptoncuts.cfg_min_pt_track) < o2::aod::track::pt&& nabs(o2::aod::track::eta) < static_cast(dileptoncuts.cfg_max_eta_track) && static_cast(dileptoncuts.cfg_min_TPCNsigmaEl) < o2::aod::pidtpc::tpcNSigmaEl&& o2::aod::pidtpc::tpcNSigmaEl < static_cast(dileptoncuts.cfg_max_TPCNsigmaEl); o2::framework::Partition electrons = o2::aod::emprimaryelectron::sign < int8_t(0) && static_cast(dileptoncuts.cfg_min_pt_track) < o2::aod::track::pt && nabs(o2::aod::track::eta) < static_cast(dileptoncuts.cfg_max_eta_track) && static_cast(dileptoncuts.cfg_min_TPCNsigmaEl) < o2::aod::pidtpc::tpcNSigmaEl && o2::aod::pidtpc::tpcNSigmaEl < static_cast(dileptoncuts.cfg_max_TPCNsigmaEl); - template + template void runTruePairing(TCollisions const& collisions, TPhotons1 const& photons1, TPhotons2 const& photons2, TSubInfos1 const&, TSubInfos2 const&, @@ -438,7 +427,7 @@ struct TaggingPi0MC { continue; } - 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; } diff --git a/PWGEM/PhotonMeson/Core/V0PhotonCut.h b/PWGEM/PhotonMeson/Core/V0PhotonCut.h index 369d3a55521..1921a71c79b 100644 --- a/PWGEM/PhotonMeson/Core/V0PhotonCut.h +++ b/PWGEM/PhotonMeson/Core/V0PhotonCut.h @@ -36,6 +36,7 @@ #include #include +#include #include #include #include @@ -837,23 +838,20 @@ class V0PhotonCut : public TNamed return std::pow(v0.alpha() / mMaxAlpha, 2) + std::pow(v0.qtarm() / mMaxQt, 2) < 1.0; // TODO: implement fully - case V0PhotonCuts::kPsiPair: { - if constexpr (requires { v0.psipair(); }) { - // return (std::fabs(v0.psipair() < 0.18f * std::exp( -0.55f * v0.chiSquareNDF()))); - return true; - } else { - return true; - } - } - + case V0PhotonCuts::kPsiPair: + // if constexpr (requires { v0.psipair(); }) { + // return (std::fabs(v0.psipair() < 0.18f * std::exp( -0.55f * v0.chiSquareNDF()))); + // } else { + // return true; + // } // TODO: implement fully - case V0PhotonCuts::kPhiV: { - if constexpr (requires { v0.phiv(); }) { - return true; - } else { - return true; - } - } + case V0PhotonCuts::kPhiV: + return true; + // if constexpr (requires { v0.phiv(); }) { + // return true; + // } else { + // return true; + // } case V0PhotonCuts::kRxy: { if (v0.v0radius() < mMinRxy || mMaxRxy < v0.v0radius()) { @@ -922,7 +920,7 @@ class V0PhotonCut : public TNamed return !(dxy > margin_xy); } case V0PhotonCuts::kIsTooClose: { - if (mRejectMask.size() == 0) { + if (mRejectMask.empty()) { return true; } return (mRejectMask[v0.globalIndex()] == 0); diff --git a/PWGEM/PhotonMeson/DataModel/EventTables.h b/PWGEM/PhotonMeson/DataModel/EventTables.h index 05e1541493b..7bbd2a761dc 100644 --- a/PWGEM/PhotonMeson/DataModel/EventTables.h +++ b/PWGEM/PhotonMeson/DataModel/EventTables.h @@ -10,21 +10,25 @@ // or submit itself to any jurisdiction. /// \file EventTables.h -/// \brief This header provides the table definitions to store photon meson event tables +/// \brief This header provides the table definitions to store photon meson event tables and ccdb tables /// \author Marvin Hemmer (marvin.hemmer@cern.ch) - Goethe University Frankfurt +#ifndef PWGEM_PHOTONMESON_DATAMODEL_EVENTTABLES_H_ +#define PWGEM_PHOTONMESON_DATAMODEL_EVENTTABLES_H_ + #include "Common/CCDB/EventSelectionParams.h" #include "Common/DataModel/EventSelection.h" +#include +#include #include -#include +#include // IWYU pragma: keep +#include // IWYU pragma: keep -#include -#include +#include // for BIT -#ifndef PWGEM_PHOTONMESON_DATAMODEL_EVENTTABLES_H_ -#define PWGEM_PHOTONMESON_DATAMODEL_EVENTTABLES_H_ +#include namespace o2::aod { @@ -72,6 +76,36 @@ DECLARE_SOA_TABLE(PMEvents, "AOD", "PMEVENT", //! Main event information table using PMEvent = PMEvents::iterator; +namespace ccdbPcm +{ +// NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init) +DECLARE_SOA_CCDB_COLUMN(GRPMagField, grpMagField, o2::parameters::GRPMagField, "GLO/Config/GRPMagField"); //! +} // namespace ccdbPcm + +/// Full table — join with aod::BCsWithTimestamps to obtain all four objects. +DECLARE_SOA_TIMESTAMPED_TABLE(PcmObjects, aod::Timestamps, o2::aod::timestamp::Timestamp, 0, "PCMOBJECTS", //! + ccdbPcm::GRPMagField); + +namespace em::ccdbMagField +{ +// NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init) +DECLARE_SOA_CCDB_COLUMN(GRPMagField, grpMagField, o2::parameters::GRPMagField, "GLO/Config/GRPMagField"); //! +} // namespace em::ccdbMagField + +/// Full table — join with aod::BCsWithTimestamps to obtain all four objects. +DECLARE_SOA_TIMESTAMPED_TABLE(EmMagFields, aod::PMEvents, o2::aod::timestamp::Timestamp, 0, "EMMAGFIELDS", //! + em::ccdbMagField::GRPMagField); + +namespace em::ccdbEmcal +{ +// NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init) +DECLARE_SOA_CCDB_COLUMN(BadChannelMap, badChannelMap, o2::emcal::BadChannelMap, "EMC/Calib/BadChannelMap"); //! EMCal BadChannelMap for EmEvents +} // namespace em::ccdbEmcal + +/// Full table — join with aod::BCsWithTimestamps to obtain all four objects. +DECLARE_SOA_TIMESTAMPED_TABLE(EmEmcalObjects, aod::PMEvents, o2::aod::timestamp::Timestamp, 0, "EMEMCALOBJECTS", //! + em::ccdbEmcal::BadChannelMap); + } // namespace o2::aod #endif // PWGEM_PHOTONMESON_DATAMODEL_EVENTTABLES_H_ diff --git a/PWGEM/PhotonMeson/DataModel/GammaTablesRedux.h b/PWGEM/PhotonMeson/DataModel/GammaTablesRedux.h index d9d2485206d..b989535162b 100644 --- a/PWGEM/PhotonMeson/DataModel/GammaTablesRedux.h +++ b/PWGEM/PhotonMeson/DataModel/GammaTablesRedux.h @@ -19,7 +19,6 @@ #include "PWGEM/PhotonMeson/DataModel/gammaTables.h" -#include #include #include @@ -121,11 +120,11 @@ DECLARE_SOA_INDEX_COLUMN(MinCluster, minCluster); //! } // namespace mintm DECLARE_SOA_TABLE(MinMTracks, "AOD", "MINMTRACK", //! - mintm::MinClusterId, mincluster::StoredDeltaPhi, mincluster::StoredDeltaEta, mincluster::StoredP, mincluster::StoredPt, + o2::soa::Index<>, mintm::MinClusterId, mincluster::StoredDeltaPhi, mincluster::StoredDeltaEta, mincluster::StoredP, mincluster::StoredPt, mincluster::DeltaPhi, mincluster::DeltaEta, mincluster::TrackP, mincluster::TrackPt); DECLARE_SOA_TABLE(MinMSTracks, "AOD", "MINMSTRACK", //! - mintm::MinClusterId, mincluster::StoredDeltaPhi, mincluster::StoredDeltaEta, mincluster::StoredP, mincluster::StoredPt, + o2::soa::Index<>, mintm::MinClusterId, mincluster::StoredDeltaPhi, mincluster::StoredDeltaEta, mincluster::StoredP, mincluster::StoredPt, mincluster::DeltaPhi, mincluster::DeltaEta, mincluster::TrackP, mincluster::TrackPt); } // namespace o2::aod diff --git a/PWGEM/PhotonMeson/DataModel/bcWiseTables.h b/PWGEM/PhotonMeson/DataModel/bcWiseTables.h index 4f64bf08fb0..e1effd5871f 100644 --- a/PWGEM/PhotonMeson/DataModel/bcWiseTables.h +++ b/PWGEM/PhotonMeson/DataModel/bcWiseTables.h @@ -8,19 +8,21 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// + /// \file bcWiseTables.h -/// /// \brief This header provides the table definitions to store very lightweight EMCal clusters per BC -/// /// \author Nicolas Strangmann (nicolas.strangmann@cern.ch) - Goethe University Frankfurt -/// #ifndef PWGEM_PHOTONMESON_DATAMODEL_BCWISETABLES_H_ #define PWGEM_PHOTONMESON_DATAMODEL_BCWISETABLES_H_ +#include #include +#include // IWYU pragma: keep +#include // IWYU pragma: keep + +#include #include #include #include @@ -48,7 +50,7 @@ enum Observable { }; // Values in tables are stored in downscaled format to save disk space -const float downscalingFactors[nObservables]{ +constexpr std::array downscalingFactors{ 1E0, // Cluster definition 1E3, // Cluster energy 1E4, // Cluster eta @@ -97,6 +99,17 @@ DECLARE_SOA_DYNAMIC_COLUMN(ZVtx, zVtx, [](int16_t storedzvtx) -> float { return DECLARE_SOA_TABLE(BCWiseCollisions, "AOD", "BCWISECOLL", //! table of skimmed EMCal clusters o2::soa::Index<>, BCWiseBCId, bcwisecollision::StoredZVtx, bcwisecollision::ZVtx); +// ccdbMgr.getSpecific("GLO/Config/GRPLHCIF", timeStamp, metadata); +namespace bcwiseCcdb +{ +// NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init) +DECLARE_SOA_CCDB_COLUMN(GrpLhcFData, grpLhcFData, o2::parameters::GRPLHCIFData, "GLO/Config/GRPLHCIF"); //! GRPLHCIFData for BC Timestamps +} // namespace bcwiseCcdb + +/// Full table — join with aod::BCsWithTimestamps to obtain all four objects. +DECLARE_SOA_TIMESTAMPED_TABLE(BcLhcIfObjects, aod::Timestamps, o2::aod::timestamp::Timestamp, 0, "BCLHCIFOBJECTS", //! + bcwiseCcdb::GrpLhcFData); + namespace bcwisecluster { DECLARE_SOA_COLUMN(StoredDefinition, storedDefinition, int8_t); //! cluster definition, see EMCALClusterDefinition.h diff --git a/PWGEM/PhotonMeson/DataModel/gammaTables.h b/PWGEM/PhotonMeson/DataModel/gammaTables.h index ca46c23329f..33dca54b611 100644 --- a/PWGEM/PhotonMeson/DataModel/gammaTables.h +++ b/PWGEM/PhotonMeson/DataModel/gammaTables.h @@ -14,7 +14,7 @@ /// \author D. Sekihata, daiki.sekihata@cern.ch; Marvin Hemmer (marvin.hemmer@cern.ch) - Goethe University Frankfurt #include "PWGEM/Dilepton/DataModel/dileptonTables.h" -#include "PWGEM/PhotonMeson/DataModel/EventTables.h" +#include "PWGEM/PhotonMeson/DataModel/EventTables.h" // IWYU pragma: keep (needed) #include "Common/Core/RecoDecay.h" #include "Common/DataModel/CaloClusters.h" @@ -23,7 +23,6 @@ #include "Common/DataModel/TrackSelectionTables.h" #include -#include #include #include diff --git a/PWGEM/PhotonMeson/DataModel/mcV0Tables.h b/PWGEM/PhotonMeson/DataModel/mcV0Tables.h index 95b560a7501..dc2d99d7d2f 100644 --- a/PWGEM/PhotonMeson/DataModel/mcV0Tables.h +++ b/PWGEM/PhotonMeson/DataModel/mcV0Tables.h @@ -15,7 +15,7 @@ #ifndef PWGEM_PHOTONMESON_DATAMODEL_MCV0TABLES_H_ #define PWGEM_PHOTONMESON_DATAMODEL_MCV0TABLES_H_ -#include +#include #include diff --git a/PWGEM/PhotonMeson/Legacy/CMakeLists.txt b/PWGEM/PhotonMeson/Legacy/CMakeLists.txt new file mode 100644 index 00000000000..eb838a12cd8 --- /dev/null +++ b/PWGEM/PhotonMeson/Legacy/CMakeLists.txt @@ -0,0 +1,40 @@ +# Copyright 2019-2020 CERN and copyright holders of ALICE O2. +# See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +# All rights not expressly granted are reserved. +# +# This software is distributed under the terms of the GNU General Public +# License v3 (GPL Version 3), copied verbatim in the file "COPYING". +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization +# or submit itself to any jurisdiction. + +o2physics_add_dpl_workflow(skimmer-gamma-conversion + SOURCES skimmerGammaConversion.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2::DCAFitter O2Physics::AnalysisCore KFParticle::KFParticle + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(skimmer-gamma-conversion-truthonlymc + SOURCES skimmerGammaConversionTruthOnlyMc.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(skimmer-dalitz-ee + SOURCES skimmerDalitzEE.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(create-pcm + SOURCES createPCM.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2::DCAFitter O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(gammaconversions + SOURCES gammaConversions.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(gammaconversionstruthonlymc + SOURCES gammaConversionsTruthOnlyMc.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2Physics::AnalysisCore + COMPONENT_NAME Analysis) diff --git a/PWGEM/PhotonMeson/Legacy/README.md b/PWGEM/PhotonMeson/Legacy/README.md new file mode 100644 index 00000000000..c275f700cbb --- /dev/null +++ b/PWGEM/PhotonMeson/Legacy/README.md @@ -0,0 +1,4 @@ +# Legacy + +This is a collection of old code. +Instead of just removing it we want to preserve the code here, while excluding it from compilation to reduce unecessary compile time. diff --git a/PWGEM/PhotonMeson/TableProducer/createPCM.cxx b/PWGEM/PhotonMeson/Legacy/createPCM.cxx similarity index 100% rename from PWGEM/PhotonMeson/TableProducer/createPCM.cxx rename to PWGEM/PhotonMeson/Legacy/createPCM.cxx diff --git a/PWGEM/PhotonMeson/Tasks/gammaConversions.cxx b/PWGEM/PhotonMeson/Legacy/gammaConversions.cxx similarity index 99% rename from PWGEM/PhotonMeson/Tasks/gammaConversions.cxx rename to PWGEM/PhotonMeson/Legacy/gammaConversions.cxx index 5f51e8914bd..d2833791f39 100644 --- a/PWGEM/PhotonMeson/Tasks/gammaConversions.cxx +++ b/PWGEM/PhotonMeson/Legacy/gammaConversions.cxx @@ -15,7 +15,7 @@ /// \note legacy code, please use the Pi0EtaToGammaGamma tasks for the standard neutral meson analysis. /// dependencies: o2-analysis-lf-lambdakzerobuilder -#include "PWGEM/PhotonMeson/Tasks/gammaConversions.h" +#include "PWGEM/PhotonMeson/Legacy/gammaConversions.h" #include "PWGEM/PhotonMeson/DataModel/EventTables.h" #include "PWGEM/PhotonMeson/DataModel/gammaTables.h" diff --git a/PWGEM/PhotonMeson/Tasks/gammaConversions.h b/PWGEM/PhotonMeson/Legacy/gammaConversions.h similarity index 97% rename from PWGEM/PhotonMeson/Tasks/gammaConversions.h rename to PWGEM/PhotonMeson/Legacy/gammaConversions.h index 4e985ad524d..085ffe7c137 100644 --- a/PWGEM/PhotonMeson/Tasks/gammaConversions.h +++ b/PWGEM/PhotonMeson/Legacy/gammaConversions.h @@ -13,8 +13,8 @@ /// \brief contains type definitions for gammaConversions.cxx /// \author stephan.friedrich.stiefelmaier@cern.ch -#ifndef PWGEM_PHOTONMESON_TASKS_GAMMACONVERSIONS_H_ -#define PWGEM_PHOTONMESON_TASKS_GAMMACONVERSIONS_H_ +#ifndef PWGEM_PHOTONMESON_LEGACY_GAMMACONVERSIONS_H_ +#define PWGEM_PHOTONMESON_LEGACY_GAMMACONVERSIONS_H_ #include #include @@ -177,4 +177,4 @@ struct tHistoRegistry { tHistoFolderCTV mV0{mPath + "V0/"}; }; -#endif // PWGEM_PHOTONMESON_TASKS_GAMMACONVERSIONS_H_ +#endif // PWGEM_PHOTONMESON_LEGACY_GAMMACONVERSIONS_H_ diff --git a/PWGEM/PhotonMeson/Tasks/gammaConversionsTruthOnlyMc.cxx b/PWGEM/PhotonMeson/Legacy/gammaConversionsTruthOnlyMc.cxx similarity index 100% rename from PWGEM/PhotonMeson/Tasks/gammaConversionsTruthOnlyMc.cxx rename to PWGEM/PhotonMeson/Legacy/gammaConversionsTruthOnlyMc.cxx diff --git a/PWGEM/PhotonMeson/TableProducer/skimmerDalitzEE.cxx b/PWGEM/PhotonMeson/Legacy/skimmerDalitzEE.cxx similarity index 99% rename from PWGEM/PhotonMeson/TableProducer/skimmerDalitzEE.cxx rename to PWGEM/PhotonMeson/Legacy/skimmerDalitzEE.cxx index f522e113386..fc64bbba7fd 100644 --- a/PWGEM/PhotonMeson/TableProducer/skimmerDalitzEE.cxx +++ b/PWGEM/PhotonMeson/Legacy/skimmerDalitzEE.cxx @@ -9,6 +9,7 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +/// \file skimmerDalitzEE /// \brief write relevant information for dalitz ee analysis to an AO2D.root file. This file is then the only necessary input to perform pcm analysis. /// \author daiki.sekihata@cern.ch @@ -22,6 +23,7 @@ #include #include #include +#include #include #include #include diff --git a/PWGEM/PhotonMeson/TableProducer/skimmerGammaConversion.cxx b/PWGEM/PhotonMeson/Legacy/skimmerGammaConversion.cxx similarity index 100% rename from PWGEM/PhotonMeson/TableProducer/skimmerGammaConversion.cxx rename to PWGEM/PhotonMeson/Legacy/skimmerGammaConversion.cxx diff --git a/PWGEM/PhotonMeson/TableProducer/skimmerGammaConversionTruthOnlyMc.cxx b/PWGEM/PhotonMeson/Legacy/skimmerGammaConversionTruthOnlyMc.cxx similarity index 100% rename from PWGEM/PhotonMeson/TableProducer/skimmerGammaConversionTruthOnlyMc.cxx rename to PWGEM/PhotonMeson/Legacy/skimmerGammaConversionTruthOnlyMc.cxx diff --git a/PWGEM/PhotonMeson/TableProducer/CMakeLists.txt b/PWGEM/PhotonMeson/TableProducer/CMakeLists.txt index 99bccdf5c49..4cc5fb529b5 100644 --- a/PWGEM/PhotonMeson/TableProducer/CMakeLists.txt +++ b/PWGEM/PhotonMeson/TableProducer/CMakeLists.txt @@ -11,26 +11,11 @@ add_subdirectory(Converters) -o2physics_add_dpl_workflow(skimmer-gamma-conversion - SOURCES skimmerGammaConversion.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2::DCAFitter O2Physics::AnalysisCore KFParticle::KFParticle - COMPONENT_NAME Analysis) - -o2physics_add_dpl_workflow(skimmer-gamma-conversion-truthonlymc - SOURCES skimmerGammaConversionTruthOnlyMc.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore - COMPONENT_NAME Analysis) - o2physics_add_dpl_workflow(photon-conversion-builder SOURCES photonconversionbuilder.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::DCAFitter O2Physics::AnalysisCore O2Physics::MLCore KFParticle::KFParticle O2Physics::TPCDriftManager COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(create-pcm - SOURCES createPCM.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2::DCAFitter O2Physics::AnalysisCore - COMPONENT_NAME Analysis) - o2physics_add_dpl_workflow(create-emevent-photon SOURCES createEMEventPhoton.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGJECore @@ -61,11 +46,6 @@ o2physics_add_dpl_workflow(skimmer-primary-electron-from-dalitzee PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(skimmer-dalitz-ee - SOURCES skimmerDalitzEE.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore - COMPONENT_NAME Analysis) - o2physics_add_dpl_workflow(non-lin-producer SOURCES nonLinProducer.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGEMPhotonMesonCore diff --git a/PWGEM/PhotonMeson/TableProducer/associateMCinfoPhoton.cxx b/PWGEM/PhotonMeson/TableProducer/associateMCinfoPhoton.cxx index 94d7e81b609..786e373470c 100644 --- a/PWGEM/PhotonMeson/TableProducer/associateMCinfoPhoton.cxx +++ b/PWGEM/PhotonMeson/TableProducer/associateMCinfoPhoton.cxx @@ -20,6 +20,7 @@ #include "Common/DataModel/EventSelection.h" #include +#include #include #include #include diff --git a/PWGEM/PhotonMeson/TableProducer/bcWiseClusterSkimmer.cxx b/PWGEM/PhotonMeson/TableProducer/bcWiseClusterSkimmer.cxx index d8eae0d3617..f180622e9c0 100644 --- a/PWGEM/PhotonMeson/TableProducer/bcWiseClusterSkimmer.cxx +++ b/PWGEM/PhotonMeson/TableProducer/bcWiseClusterSkimmer.cxx @@ -12,7 +12,6 @@ /// \file bcWiseClusterSkimmer.cxx /// \brief This task creates minimalistic skimmed tables containing EMC clusters and centrality information /// \author Nicolas Strangmann (nicolas.strangmann@cern.ch) - Goethe University Frankfurt -/// #include "PWGEM/PhotonMeson/DataModel/bcWiseTables.h" #include "PWGEM/PhotonMeson/Utils/MCUtilities.h" @@ -28,7 +27,6 @@ #include #include #include -#include #include #include #include @@ -48,6 +46,7 @@ #include #include +#include #include #include #include @@ -65,7 +64,7 @@ using namespace o2::constants::physics; using MyCollisions = soa::Join; using MyMCCollisions = soa::Join; -using MyBCs = soa::Join; +using MyBCs = soa::Join; using SelectedUniqueClusters = soa::Filtered; // Clusters from collisions with only one collision in the BC using SelectedUniqueMCClusters = soa::Filtered>; // Clusters from collisions with only one collision in the BC @@ -103,7 +102,6 @@ struct bcWiseClusterSkimmer { ConfigurableAxis cfgMultiplicityBinning{"cfgMultiplicityBinning", {1000, 0, 10000}, "Binning used for the binning of the number of particles in the event"}; aod::rctsel::RCTFlagsChecker isFT0EMCGoodRCTChecker{aod::rctsel::kFT0Bad, aod::rctsel::kEMCBad}; - parameters::GRPLHCIFData* mLHCIFdata = nullptr; int mRunNumber = -1; ctpRateFetcher mRateFetcher; @@ -121,9 +119,10 @@ struct bcWiseClusterSkimmer { { const int nEventBins = 6; mHistManager.add("nBCs", "Number of BCs;;#bf{#it{N}_{BCs}}", HistType::kTH1F, {{nEventBins, -0.5, 5.5}}); - const TString binLabels[nEventBins] = {"All", "FT0", "TVX", "kTVXinEMC", "Cell", "HasMCColl"}; - for (int iBin = 0; iBin < nEventBins; iBin++) + const std::array binLabels = {"All", "FT0", "TVX", "kTVXinEMC", "Cell", "HasMCColl"}; + for (int iBin = 0; iBin < nEventBins; iBin++) { mHistManager.get(HIST("nBCs"))->GetXaxis()->SetBinLabel(iBin + 1, binLabels[iBin]); + } mHistManager.add("CentralityVsGenMultiplicity", "Centrality vs number of generated MC particles;Centrality;#bf{#it{N}_{gen}}", HistType::kTH2F, {{102, 0., 102}, cfgMultiplicityBinning}); mHistManager.add("CentralityFT0CVsM", "Centrality of FT0C vs FT0M;FT0C Cent;FT0M Cent", HistType::kTH2F, {{102, 0., 102}, {102, 0., 102}}); @@ -145,8 +144,9 @@ struct bcWiseClusterSkimmer { LOG(info) << "| Min gen pt: pT > " << cfgMinPtGen; o2::emcal::Geometry::GetInstanceFromRunNumber(300000); - if (cfgRequireGoodRCTQuality) + if (cfgRequireGoodRCTQuality) { isFT0EMCGoodRCTChecker.init({aod::rctsel::kFT0Bad, aod::rctsel::kEMCBad}); + } } /// \brief Process EMCAL clusters (either ambigous or unique) @@ -196,27 +196,32 @@ struct bcWiseClusterSkimmer { int daughterId = aod::pwgem::photonmeson::utils::mcutil::FindMotherInChain(clusterInducer, mcParticles, std::vector{111, 221}); if (daughterId > 0) { mesonMCIndex = mcParticles.iteratorAt(daughterId).mothersIds()[0]; - if (mcParticles.iteratorAt(mesonMCIndex).pt() < cfgMinPtGen) + if (mcParticles.iteratorAt(mesonMCIndex).pt() < cfgMinPtGen) { mesonMCIndex = -1; + } } - if (mesonMCIndex != -1) + if (mesonMCIndex != -1) { break; - if (cfgOnlyCheckFirstTrueContributor) + } + if (cfgOnlyCheckFirstTrueContributor) { break; + } } bool isEta = false; if (mesonMCIndex >= 0) { if (mcParticles.iteratorAt(mesonMCIndex).pdgCode() == PDG_t::kPi0) { - if (fMapPi0Index.find(mesonMCIndex) != fMapPi0Index.end()) // Some pi0s might not be found (not gg decay or too large y) - mesonMCIndex = fMapPi0Index[mesonMCIndex]; // If pi0 was stored in table, change index from the MC index to the pi0 index from this task - else // If pi0 was not stored, treat photon as if not from pi0 + if (fMapPi0Index.contains(mesonMCIndex)) { // Some pi0s might not be found (not gg decay or too large y) + mesonMCIndex = fMapPi0Index[mesonMCIndex]; // If pi0 was stored in table, change index from the MC index to the pi0 index from this task + } else { // If pi0 was not stored, treat photon as if not from pi0 mesonMCIndex = -1; + } } else if (mcParticles.iteratorAt(mesonMCIndex).pdgCode() == Pdg::kEta) { isEta = true; - if (fMapEtaIndex.find(mesonMCIndex) != fMapEtaIndex.end()) // Some etas might not be found (not gg decay or too large y) - mesonMCIndex = fMapEtaIndex[mesonMCIndex]; // If eta was stored in table, change index from the MC index to the eta index from this task - else // If eta was not stored, treat photon as if not from eta + if (fMapEtaIndex.contains(mesonMCIndex)) { // Some etas might not be found (not gg decay or too large y) + mesonMCIndex = fMapEtaIndex[mesonMCIndex]; // If eta was stored in table, change index from the MC index to the eta index from this task + } else { // If eta was not stored, treat photon as if not from eta mesonMCIndex = -1; + } } else { mesonMCIndex = -1; // Not a pi0 or eta } @@ -227,37 +232,21 @@ struct bcWiseClusterSkimmer { bool isBCSelected(const auto& bc) { - if (cfgRequirekTVXinEMC && !bc.alias_bit(kTVXinEMC)) + if (cfgRequirekTVXinEMC && !bc.alias_bit(kTVXinEMC)) { return false; - if (cfgRequireGoodRCTQuality && !isFT0EMCGoodRCTChecker(bc)) + } + if (cfgRequireGoodRCTQuality && !isFT0EMCGoodRCTChecker(bc)) { return false; + } return true; } - void setLHCIFData(const auto& bc) - { - if (mRunNumber == bc.runNumber()) - return; - - auto& ccdbMgr = o2::ccdb::BasicCCDBManager::instance(); - uint64_t timeStamp = bc.timestamp(); - - std::map metadata; - mLHCIFdata = ccdbMgr.getSpecific("GLO/Config/GRPLHCIF", timeStamp, metadata); - if (mLHCIFdata == nullptr) - LOG(fatal) << "GRPLHCIFData not in database, timestamp:" << timeStamp; - mRunNumber = bc.runNumber(); - LOG(info) << "LHCIF data fetched for run " << mRunNumber << " and timestamp " << timeStamp; - - return; - } - double calculateMu(const auto& bc) { auto& ccdbMgr = o2::ccdb::BasicCCDBManager::instance(); uint64_t timeStamp = bc.timestamp(); - auto bfilling = mLHCIFdata->getBunchFilling(); + auto bfilling = bc.grpLhcFData().getBunchFilling(); double nbc = bfilling.getFilledBCs().size(); double tvxRate = mRateFetcher.fetch(&ccdbMgr, timeStamp, bc.runNumber(), "T0VTX"); double nTriggersPerFilledBC = tvxRate / nbc / o2::constants::lhc::LHCRevFreq; @@ -290,25 +279,29 @@ struct bcWiseClusterSkimmer { bool haskTVXinEMC = bc.alias_bit(kTVXinEMC); bool hasEMCCell = cellsInBC.size() > 0; mHistManager.fill(HIST("nBCs"), 0); - if (hasFoundFT0) + if (hasFoundFT0) { mHistManager.fill(HIST("nBCs"), 1); - if (hasTVX) + } + if (hasTVX) { mHistManager.fill(HIST("nBCs"), 2); - if (haskTVXinEMC) + } + if (haskTVXinEMC) { mHistManager.fill(HIST("nBCs"), 3); - if (hasEMCCell) + } + if (hasEMCCell) { mHistManager.fill(HIST("nBCs"), 4); - if (hasMCCollision) + } + if (hasMCCollision) { mHistManager.fill(HIST("nBCs"), 5); + } - if (cfgStoreMu || cfgStoreTime) - setLHCIFData(bc); double mu = cfgStoreMu ? calculateMu(bc) : 0.; - float timeSinceSOF = cfgStoreTime ? (bc.timestamp() - mLHCIFdata->getFillNumberTime()) / 1e3 : 0.; // Convert to seconds + float timeSinceSOF = cfgStoreTime ? (bc.timestamp() - bc.grpLhcFData().getFillNumberTime()) / 1e3 : 0.; // Convert to seconds float ft0Amp = hasFoundFT0 ? bc.foundFT0().sumAmpA() + bc.foundFT0().sumAmpC() : 0.; double centralityOfCollision = 101.5; - if (collisionsInBC.size() > 0) + if (collisionsInBC.size() > 0) { centralityOfCollision = collisionsInBC.iteratorAt(0).centFT0C(); + } double centralityOfBC = bc.centFT0C(); mHistManager.fill(HIST("BCCentVsCollCent"), centralityOfBC, centralityOfCollision); @@ -316,19 +309,22 @@ struct bcWiseClusterSkimmer { bcTable(hasFoundFT0, hasTVX, haskTVXinEMC, hasEMCCell, convertForStorage(centralityOfBC, kCent), convertForStorage(bc.centFT0M(), kCent), convertForStorage(ft0Amp, kFT0Amp), convertForStorage(mu, kMu), convertForStorage(timeSinceSOF, kTimeSinceSOF)); - for (const auto& collision : collisionsInBC) + for (const auto& collision : collisionsInBC) { collisionTable(bcTable.lastIndex(), convertForStorage(collision.posZ(), kZVtx)); + } } template bool isGammaGammaDecay(TMCParticle const& mcParticle, TMCParticles const& mcParticles) { auto daughtersIds = mcParticle.daughtersIds(); - if (daughtersIds.size() != 2) + if (daughtersIds.size() != 2) { return false; + } for (const auto& daughterId : daughtersIds) { - if (mcParticles.iteratorAt(daughterId).pdgCode() != PDG_t::kGamma) + if (mcParticles.iteratorAt(daughterId).pdgCode() != PDG_t::kGamma) { return false; + } } return true; } @@ -337,19 +333,22 @@ struct bcWiseClusterSkimmer { bool isAccepted(TMCParticle const& mcParticle, TMCParticles const& mcParticles) { auto daughtersIds = mcParticle.daughtersIds(); - if (daughtersIds.size() != 2) + if (daughtersIds.size() != 2) { return false; + } for (const auto& daughterId : daughtersIds) { - if (mcParticles.iteratorAt(daughterId).pdgCode() != PDG_t::kGamma) + if (mcParticles.iteratorAt(daughterId).pdgCode() != PDG_t::kGamma) { return false; + } int iCellID = -1; try { iCellID = emcal::Geometry::GetInstance()->GetAbsCellIdFromEtaPhi(mcParticles.iteratorAt(daughterId).eta(), mcParticles.iteratorAt(daughterId).phi()); - } catch (emcal::InvalidPositionException& e) { + } catch (const emcal::InvalidPositionException& e) { iCellID = -1; } - if (iCellID == -1) + if (iCellID == -1) { return false; + } } return true; } @@ -357,8 +356,9 @@ struct bcWiseClusterSkimmer { void processData(MyBCs const& bcs, MyCollisions const& collisions, aod::FT0s const&, SelectedCells const& cells, SelectedUniqueClusters const& uClusters, SelectedAmbiguousClusters const& aClusters) { for (const auto& bc : bcs) { - if (!isBCSelected(bc)) + if (!isBCSelected(bc)) { continue; + } auto collisionsInBC = collisions.sliceBy(perFoundBC, bc.globalIndex()); auto cellsInBC = cells.sliceBy(cellsPerBC, bc.globalIndex()); @@ -381,8 +381,9 @@ struct bcWiseClusterSkimmer { void processMC(MyBCs const& bcs, MyMCCollisions const& collisions, aod::McCollisions const& mcCollisions, aod::FT0s const&, SelectedCells const& cells, SelectedUniqueMCClusters const& uClusters, SelectedAmbiguousMCClusters const& aClusters, aod::McParticles const& mcParticles) { for (const auto& bc : bcs) { - if (!isBCSelected(bc)) + if (!isBCSelected(bc)) { continue; + } auto collisionsInBC = collisions.sliceBy(perFoundBC, bc.globalIndex()); auto cellsInBC = cells.sliceBy(cellsPerBC, bc.globalIndex()); @@ -392,13 +393,15 @@ struct bcWiseClusterSkimmer { for (const auto& mcCollision : mcCollisionsBC) { mHistManager.fill(HIST("MCZVtx"), mcCollision.posZ()); - if (bc.selection_bit(aod::evsel::kIsTriggerTVX)) + if (bc.selection_bit(aod::evsel::kIsTriggerTVX)) { mHistManager.fill(HIST("MCZVtx_TVX"), mcCollision.posZ()); + } auto mcParticlesInColl = mcParticles.sliceBy(perMcCollision, mcCollision.globalIndex()); mHistManager.fill(HIST("CentralityVsGenMultiplicity"), bc.centFT0M(), mcParticlesInColl.size()); for (const auto& mcParticle : mcParticlesInColl) { - if (std::abs(mcParticle.y()) > cfgRapidityCut || !isGammaGammaDecay(mcParticle, mcParticles) || mcParticle.pt() < cfgMinPtGen) + if (std::abs(mcParticle.y()) > cfgRapidityCut || !isGammaGammaDecay(mcParticle, mcParticles) || mcParticle.pt() < cfgMinPtGen) { continue; + } bool isPrimary = mcParticle.isPhysicalPrimary() || mcParticle.producedByGenerator(); bool isFromWD = (aod::pwgem::photonmeson::utils::mcutil::IsFromWD(mcCollision, mcParticle, mcParticles)) > 0; @@ -428,4 +431,7 @@ struct bcWiseClusterSkimmer { PROCESS_SWITCH(bcWiseClusterSkimmer, processMC, "Run skimming for MC", false); }; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; } +WorkflowSpec defineDataProcessing(ConfigContext const& context) +{ + return WorkflowSpec{adaptAnalysisTask(context)}; +} diff --git a/PWGEM/PhotonMeson/TableProducer/createEMEventPhoton.cxx b/PWGEM/PhotonMeson/TableProducer/createEMEventPhoton.cxx index e45078da5ad..4a3ab9a1a91 100644 --- a/PWGEM/PhotonMeson/TableProducer/createEMEventPhoton.cxx +++ b/PWGEM/PhotonMeson/TableProducer/createEMEventPhoton.cxx @@ -25,6 +25,7 @@ #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/Qvectors.h" +#include #include #include #include @@ -37,7 +38,6 @@ #include #include -#include #include #include #include @@ -54,19 +54,13 @@ using MyCollisions = soa::Join; // centrality table has dependency on multiplicity table. using MyCollisionsCentQvec = soa::Join; -// using MyCollisionsWithSWT = soa::Join; -// using MyCollisionsWithSWT_Cent = soa::Join; // centrality table has dependency on multiplicity table. -// using MyCollisionsWithSWT_Cent_Qvec = soa::Join; - using MyCollisionsMC = soa::Join; using MyCollisionsMCCent = soa::Join; // centrality table has dependency on multiplicity table. using MyCollisionsMCCentQvec = soa::Join; struct CreateEMEventPhoton { - // Produces embc; Produces event; Produces eventalias; - // Produces eventCov; Produces eventMult; Produces eventCent; Produces eventQvec; @@ -81,12 +75,6 @@ struct CreateEMEventPhoton { kEvent_JJ = 3, }; - // CCDB options - // Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - // Configurable grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"}; - // Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; - // Configurable skipGRPOquery{"skipGRPOquery", true, "skip grpo query"}; - // Configurable dBzInput{"d_bz", -999, "bz field, -999 is automatic"}; Configurable needEMCTrigger{"needEMCTrigger", false, "flag to only save events which have kTVXinEMC trigger bit. To reduce PbPb derived data size"}; Configurable needPHSTrigger{"needPHSTrigger", false, "flag to only save events which have kTVXinPHOS trigger bit. To reduce PbPb derived data size"}; Configurable enableJJHistograms{"enableJJHistograms", false, "flag to fill JJ QA histograms for outlier rejection"}; @@ -104,58 +92,9 @@ struct CreateEMEventPhoton { } } - int mRunNumber; - // float dBz; - // Service ccdb; - - template - void initCCDB(TBC const& bc) - { - if (mRunNumber == bc.runNumber()) { - return; - } - - // // In case override, don't proceed, please - no CCDB access required - // if (dBzInput > -990) { - // dBz = dBzInput; - // o2::parameters::GRPMagField grpmag; - // if (std::fabs(dBz) > 1e-5) { - // grpmag.setL3Current(30000.f / (dBz / 5.0f)); - // } - // mRunNumber = bc.runNumber(); - // return; - // } - - // auto run3GRPTimestamp = bc.timestamp(); - // o2::parameters::GRPObject* grpo = 0x0; - // o2::parameters::GRPMagField* grpmag = 0x0; - // if (!skipGRPOquery) - // grpo = ccdb->getForTimeStamp(grpPath, run3GRPTimestamp); - // if (grpo) { - // // Fetch magnetic field from ccdb for current collision - // dBz = grpo->getNominalL3Field(); - // LOG(info) << "Retrieved GRP for timestamp " << run3GRPTimestamp << " with magnetic field of " << dBz << " kZG"; - // } else { - // grpmag = ccdb->getForTimeStamp(grpmagPath, run3GRPTimestamp); - // if (!grpmag) { - // LOG(fatal) << "Got nullptr from CCDB for path " << grpmagPath << " of object GRPMagField and " << grpPath << " of object GRPObject for timestamp " << run3GRPTimestamp; - // } - // // Fetch magnetic field from ccdb for current collision - // dBz = std::lround(5.f * grpmag->getL3Current() / 30000.f); - // LOG(info) << "Retrieved GRP for timestamp " << run3GRPTimestamp << " with magnetic field of " << dBz << " kZG"; - // } - mRunNumber = bc.runNumber(); - } - template void skimEvent(TCollisions const& collisions, TBCs const&) { - // for (const auto& bc : bcs) { - // if (bc.selection_bit(o2::aod::evsel::kIsTriggerTVX)) { - // embc(bc.selection_raw(), bc.rct_raw()); // TVX is fired. - // } - // } // end of bc loop - for (const auto& collision : collisions) { if constexpr (isMC) { if (!collision.has_mcCollision()) { @@ -163,9 +102,7 @@ struct CreateEMEventPhoton { } } - // auto bc = collision.template foundBC_as(); auto bc = collision.template bc_as(); // use this for Zorro - initCCDB(bc); if (needEMCTrigger && !collision.alias_bit(kTVXinEMC)) { continue; @@ -175,7 +112,7 @@ struct CreateEMEventPhoton { } if (collision.selection_bit(o2::aod::evsel::kIsTriggerTVX)) { - int16_t posZint16 = static_cast(collision.posZ() * 100.f); + auto posZint16 = static_cast(collision.posZ() * 100.f); if (posZint16 == 0.f) { if (collision.posZ() < 0) { posZint16 = -1; @@ -183,9 +120,7 @@ struct CreateEMEventPhoton { posZint16 = +1; } } - if constexpr (eventtype == EMEventType::kEvent) { - event_norm_info(collision.selection_raw(), collision.rct_raw(), posZint16, static_cast(105.f * 500.f)); - } else if constexpr (eventtype == EMEventType::kEvent_Cent || eventtype == EMEventType::kEvent_Cent_Qvec) { + if constexpr (eventtype == EMEventType::kEvent_Cent || eventtype == EMEventType::kEvent_Cent_Qvec) { event_norm_info(collision.selection_raw(), collision.rct_raw(), posZint16, static_cast(collision.centFT0C() * 500.f)); } else { event_norm_info(collision.selection_raw(), collision.rct_raw(), posZint16, static_cast(105.f * 500.f)); @@ -200,14 +135,6 @@ struct CreateEMEventPhoton { continue; } - // if constexpr (isTriggerAnalysis) { - // if (collision.triggerMask_raw() == 0) { - // continue; - // } else { - // emswtbit(collision.triggerMask_raw()); - // } - // } - const float qDefault = 999.f; // default value for q vectors if not obtained registry.fill(HIST("hEventCounter"), 1); @@ -229,11 +156,7 @@ struct CreateEMEventPhoton { eventWeights(1.f); } - if constexpr (eventtype == EMEventType::kEvent) { - eventCent(105.f, 105.f, 105.f); - eventQvec(qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, - qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault); - } else if constexpr (eventtype == EMEventType::kEvent_Cent) { + if constexpr (eventtype == EMEventType::kEvent_Cent) { eventCent(collision.centFT0M(), collision.centFT0A(), collision.centFT0C()); eventQvec(qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault); @@ -260,7 +183,7 @@ struct CreateEMEventPhoton { using MyJJCollisions = soa::Join; - void fillEventWeights(MyCollisionsMC const& collisions, MyJJCollisions const&, MyBCs const&, aod::FullMCParticleLevelJets const& jets) + void fillEventWeights(MyCollisionsMC const& collisions, MyJJCollisions const&, aod::FullMCParticleLevelJets const& jets) { for (const auto& collision : collisions) { if (!collision.has_mcCollision()) { @@ -270,9 +193,6 @@ struct CreateEMEventPhoton { continue; } - auto bc = collision.template foundBC_as(); - initCCDB(bc); - auto mcCollision = collision.mcCollision_as(); // Outlier rejection: Set weight to 0 for events with large pTJet/pTHard @@ -280,8 +200,9 @@ struct CreateEMEventPhoton { auto jetsInThisCollision = jets.sliceBy(perCollision_jet, mcCollision.globalIndex()); float collisionWeight = mcCollision.weight(); for (const auto& jet : jetsInThisCollision) { - if (jet.pt() > maxpTJetOverpTHard * mcCollision.ptHard()) + if (jet.pt() > maxpTJetOverpTHard * mcCollision.ptHard()) { collisionWeight = 0.f; + } registry.fill(HIST("hJJ_pTHardVsJetpT"), mcCollision.ptHard(), jet.pt()); } @@ -336,7 +257,7 @@ struct CreateEMEventPhoton { void processEventJJMC(MyCollisionsMC const& collisions, MyJJCollisions const& mcCollisions, MyBCs const& bcs, aod::FullMCParticleLevelJets const& jets) { skimEvent(collisions, bcs); - fillEventWeights(collisions, mcCollisions, bcs, jets); + fillEventWeights(collisions, mcCollisions, jets); } PROCESS_SWITCH(CreateEMEventPhoton, processEventJJMC, "process event info", false); @@ -419,10 +340,10 @@ struct AssociatePhotonToEMEvent { // PROCESS_SWITCH(AssociatePhotonToEMEvent, processChargedTrack, "process indexing for charged tracks", false); PROCESS_SWITCH(AssociatePhotonToEMEvent, processDummy, "process dummy", true); }; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +WorkflowSpec defineDataProcessing(ConfigContext const& context) { return WorkflowSpec{ - adaptAnalysisTask(cfgc, TaskName{"create-emevent-photon"}), - adaptAnalysisTask(cfgc, TaskName{"associate-photon-to-emevent"}), + adaptAnalysisTask(context, TaskName{"create-emevent-photon"}), + adaptAnalysisTask(context, TaskName{"associate-photon-to-emevent"}), }; } diff --git a/PWGEM/PhotonMeson/TableProducer/nonLinProducer.cxx b/PWGEM/PhotonMeson/TableProducer/nonLinProducer.cxx index 05695b42850..74aa9d98e11 100644 --- a/PWGEM/PhotonMeson/TableProducer/nonLinProducer.cxx +++ b/PWGEM/PhotonMeson/TableProducer/nonLinProducer.cxx @@ -21,6 +21,7 @@ #include "PWGEM/PhotonMeson/Utils/emcalHistoDefinitions.h" #include +#include #include #include #include @@ -48,7 +49,7 @@ struct NonLinProducer { enum CentralityEstimator : uint8_t { None = 0, - CFT0A = 1, + CFT0A, CFT0C, CFT0M, NCentralityEstimators @@ -77,7 +78,7 @@ struct NonLinProducer { EMNonLin::Context emNonLinContextEMC; EMNonLin::Context emNonLinContextPCM; - o2::framework::Service ccdb; + o2::framework::Service ccdb{}; TMatrixD* emcalMatrix = nullptr; TMatrixD* pcmMatrix = nullptr; @@ -246,8 +247,8 @@ struct NonLinProducer { PROCESS_SWITCH(NonLinProducer, processPCMDummy, "Createdumy Non Lin table for PCM.", true); }; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +WorkflowSpec defineDataProcessing(ConfigContext const& context) { - WorkflowSpec workflow{adaptAnalysisTask(cfgc)}; + WorkflowSpec workflow{adaptAnalysisTask(context)}; return workflow; } diff --git a/PWGEM/PhotonMeson/TableProducer/photonconversionbuilder.cxx b/PWGEM/PhotonMeson/TableProducer/photonconversionbuilder.cxx index 7535143e3d4..fbaf3238eeb 100644 --- a/PWGEM/PhotonMeson/TableProducer/photonconversionbuilder.cxx +++ b/PWGEM/PhotonMeson/TableProducer/photonconversionbuilder.cxx @@ -22,6 +22,7 @@ #include "PWGEM/PhotonMeson/Core/EmMlResponsePCM.h" #include "PWGEM/PhotonMeson/Core/V0PhotonCandidate.h" #include "PWGEM/PhotonMeson/Core/V0PhotonCut.h" +#include "PWGEM/PhotonMeson/DataModel/EventTables.h" #include "PWGEM/PhotonMeson/DataModel/gammaTables.h" #include "PWGEM/PhotonMeson/Utils/PCMUtilities.h" #include "PWGEM/PhotonMeson/Utils/TrackSelection.h" @@ -39,10 +40,10 @@ #include #include #include -#include #include #include #include +#include #include #include #include @@ -90,6 +91,7 @@ using std::array; using MyCollisions = soa::Join; // using MyCollisionsWithSWT = soa::Join; using MyCollisionsMC = soa::Join; +using MyBCs = soa::Join; using MyTracksIU = soa::Join; using MyTracksIUMC = soa::Join; @@ -161,11 +163,8 @@ struct PhotonConversionBuilder { // CCDB options Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"}; - Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; Configurable lutPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"}; Configurable geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; - Configurable skipGRPOquery{"skipGRPOquery", true, "skip grpo query"}; // Operation and minimisation criteria Configurable d_bz_input{"d_bz", -999, "bz field, -999 is automatic"}; @@ -451,12 +450,11 @@ struct PhotonConversionBuilder { } } - void initCCDB(aod::BCsWithTimestamps::iterator const& bc) + void initCCDB(MyBCs::iterator const& bc) { if (mRunNumber == bc.runNumber()) { return; } - // In case override, don't proceed, please - no CCDB access required if (d_bz_input > -990) { // o2-linter: disable=magic-number (override value) d_bz = d_bz_input; @@ -470,26 +468,10 @@ struct PhotonConversionBuilder { } auto run3grp_timestamp = bc.timestamp(); - o2::parameters::GRPObject* grpo = nullptr; - o2::parameters::GRPMagField* grpmag = nullptr; - if (!skipGRPOquery) { - grpo = ccdb->getForTimeStamp(grpPath, run3grp_timestamp); - } - if (grpo != nullptr) { - o2::base::Propagator::initFieldFromGRP(grpo); - // Fetch magnetic field from ccdb for current collision - d_bz = grpo->getNominalL3Field(); - LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; - } else { - grpmag = ccdb->getForTimeStamp(grpmagPath, run3grp_timestamp); - if (grpmag == nullptr) { - LOG(fatal) << "Got nullptr from CCDB for path " << grpmagPath << " of object GRPMagField and " << grpPath << " of object GRPObject for timestamp " << run3grp_timestamp; - } - o2::base::Propagator::initFieldFromGRP(grpmag); - // Fetch magnetic field from ccdb for current collision - d_bz = std::lround(5.f * grpmag->getL3Current() / 30000.f); - LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; - } + o2::base::Propagator::initFieldFromGRP(&bc.grpMagField()); + // Fetch magnetic field from ccdb for current collision + d_bz = bc.grpMagField().getNominalL3Field(); + LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; mRunNumber = bc.runNumber(); if (useMatCorrType == 2) { // o2-linter: disable=magic-number (material budget correction) @@ -503,7 +485,7 @@ struct PhotonConversionBuilder { mVDriftMgr.init(&ccdb->instance()); } - void updateCCDB(aod::BCsWithTimestamps::iterator const& bc) + void updateCCDB(MyBCs::iterator const& bc) { auto timestamp = bc.timestamp(); @@ -1095,7 +1077,7 @@ struct PhotonConversionBuilder { nv0_map[collision.globalIndex()] = 0; - const auto& bc = collision.template foundBC_as(); + const auto& bc = collision.template foundBC_as(); initCCDB(bc); registry.fill(HIST("hCollisionCounter"), 1); @@ -1736,20 +1718,20 @@ struct PhotonConversionBuilder { } } - void processRec(MyCollisions const& collisions, FilteredV0s const& v0s, MyTracksIU const& tracks, aod::BCsWithTimestamps const& bcs) + void processRec(MyCollisions const& collisions, FilteredV0s const& v0s, MyTracksIU const& tracks, MyBCs const& bcs) { build(collisions, v0s, tracks, bcs); } PROCESS_SWITCH(PhotonConversionBuilder, processRec, "process reconstructed info for data", true); - // void processRec_SWT(MyCollisionsWithSWT const& collisions, FilteredV0s const& v0s, MyTracksIU const& tracks, aod::BCsWithTimestamps const& bcs) + // void processRec_SWT(MyCollisionsWithSWT const& collisions, FilteredV0s const& v0s, MyTracksIU const& tracks, MyBCs const& bcs) // { // build(collisions, v0s, tracks, bcs); // } // PROCESS_SWITCH(PhotonConversionBuilder, processRec_SWT, "process reconstructed info for data", false); void processMC(MyCollisionsMC const& collisions, FilteredV0s const& v0s, MyTracksIUMC const& tracks, - aod::BCsWithTimestamps const& bcs, aod::McParticles const& mcparticles) + MyBCs const& bcs, aod::McParticles const& mcparticles) { DedupDiag diag; build(collisions, v0s, tracks, bcs, &diag); @@ -1757,13 +1739,13 @@ struct PhotonConversionBuilder { } PROCESS_SWITCH(PhotonConversionBuilder, processMC, "process reconstructed info for MC", false); - void processRec_OnlyIfDielectron(soa::Join const& collisions, FilteredV0s const& v0s, MyTracksIU const& tracks, aod::BCsWithTimestamps const& bcs) + void processRec_OnlyIfDielectron(soa::Join const& collisions, FilteredV0s const& v0s, MyTracksIU const& tracks, MyBCs const& bcs) { build(collisions, v0s, tracks, bcs); } PROCESS_SWITCH(PhotonConversionBuilder, processRec_OnlyIfDielectron, "process reconstructed info for data", false); - // void processRec_SWT_OnlyIfDielectron(soa::Join const& collisions, FilteredV0s const& v0s, MyTracksIU const& tracks, aod::BCsWithTimestamps const& bcs) + // void processRec_SWT_OnlyIfDielectron(soa::Join const& collisions, FilteredV0s const& v0s, MyTracksIU const& tracks, MyBCs const& bcs) // { // build(collisions, v0s, tracks, bcs); // } diff --git a/PWGEM/PhotonMeson/TableProducer/skimmerGammaCalo.cxx b/PWGEM/PhotonMeson/TableProducer/skimmerGammaCalo.cxx index d749a06f9c3..e82c3284c4c 100644 --- a/PWGEM/PhotonMeson/TableProducer/skimmerGammaCalo.cxx +++ b/PWGEM/PhotonMeson/TableProducer/skimmerGammaCalo.cxx @@ -22,6 +22,7 @@ #include "Common/CCDB/TriggerAliases.h" #include "Common/DataModel/EventSelection.h" +#include #include #include #include diff --git a/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryElectronFromDalitzEE.cxx b/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryElectronFromDalitzEE.cxx index 57e97892f7c..215f4a29f49 100644 --- a/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryElectronFromDalitzEE.cxx +++ b/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryElectronFromDalitzEE.cxx @@ -14,6 +14,7 @@ /// \author daiki.sekihata@cern.ch #include "PWGEM/Dilepton/Utils/PairUtilities.h" +#include "PWGEM/PhotonMeson/DataModel/EventTables.h" #include "PWGEM/PhotonMeson/DataModel/gammaTables.h" #include "Common/Core/PID/PIDTOFParamService.h" @@ -27,8 +28,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -64,6 +65,7 @@ using namespace o2::constants::physics; using MyCollisions = soa::Join; using MyCollisionsWithSWT = soa::Join; +using MyBCs = soa::Join; using MyCollisionsMC = soa::Join; using MyTracks = soa::Join -990) { // o2-linter: disable=magic-number (check against some default number) dBz = dBzInput; o2::parameters::GRPMagField grpmag; if (std::fabs(dBz) > 1e-5) { // o2-linter: disable=magic-number (check against some default number) - grpmag.setL3Current(30000.f / (dBz / 5.0f)); // o2-linter: disable=magic-number (values to calculate the magnetic field) + grpmag.setL3Current(30000.f / (dBz / 5.0f)); // o2-linter: disable=magic-number (override value) } o2::base::Propagator::initFieldFromGRP(&grpmag); - mRunNumber = bc.runNumber(); return; } auto run3grpTimestamp = bc.timestamp(); - o2::parameters::GRPObject* grpo = nullptr; - o2::parameters::GRPMagField* grpmag = nullptr; - if (!skipGRPOquery) { - grpo = ccdb->getForTimeStamp(grpPath, run3grpTimestamp); - } - if (grpo) { - o2::base::Propagator::initFieldFromGRP(grpo); - // Fetch magnetic field from ccdb for current collision - dBz = grpo->getNominalL3Field(); - LOG(info) << "Retrieved GRP for timestamp " << run3grpTimestamp << " with magnetic field of " << dBz << " kZG"; - } else { - grpmag = ccdb->getForTimeStamp(grpmagPath, run3grpTimestamp); - if (!grpmag) { - LOG(fatal) << "Got nullptr from CCDB for path " << grpmagPath << " of object GRPMagField and " << grpPath << " of object GRPObject for timestamp " << run3grpTimestamp; - } - o2::base::Propagator::initFieldFromGRP(grpmag); - // Fetch magnetic field from ccdb for current collision - dBz = std::lround(5.f * grpmag->getL3Current() / 30000.f); - LOG(info) << "Retrieved GRP for timestamp " << run3grpTimestamp << " with magnetic field of " << dBz << " kZG"; - } - mRunNumber = bc.runNumber(); + + dBz = bc.grpMagField().getNominalL3Field(); + LOG(info) << "Retrieved GRP for timestamp " << run3grpTimestamp << " with magnetic field of " << dBz << " kZG"; } template @@ -714,7 +697,7 @@ struct skimmerPrimaryElectronFromDalitzEE { std::map, float> mapTOFBetaReassociated; // map pair(collisionId, trackId) -> tof beta // ---------- for data ---------- - void processRec(MyCollisions const& collisions, aod::BCsWithTimestamps const& bcs, MyTracks const& tracks, aod::V0PhotonsKF const& v0photons, aod::TrackAssoc const& trackIndices) + void processRec(MyCollisions const& collisions, MyBCs const& bcs, MyTracks const& tracks, aod::V0PhotonsKF const& v0photons, aod::TrackAssoc const& trackIndices) { initCCDB(bcs.iteratorAt(0)); mTOFResponse->processSetup(bcs.iteratorAt(0)); @@ -765,7 +748,7 @@ struct skimmerPrimaryElectronFromDalitzEE { } PROCESS_SWITCH(skimmerPrimaryElectronFromDalitzEE, processRec, "process reconstructed info only", false); // standalone - // void processRec_SWT(MyCollisionsWithSWT const& collisions, aod::BCsWithTimestamps const& bcs, MyTracks const& tracks, aod::V0PhotonsKF const& v0photons, aod::TrackAssoc const& trackIndices) + // void processRec_SWT(MyCollisionsWithSWT const& collisions, MyBCs const& bcs, MyTracks const& tracks, aod::V0PhotonsKF const& v0photons, aod::TrackAssoc const& trackIndices) // { // initCCDB(bcs.iteratorAt(0)); @@ -825,7 +808,7 @@ struct skimmerPrimaryElectronFromDalitzEE { Partition posTracksMC = o2::aod::track::signed1Pt > 0.f; Partition negTracksMC = o2::aod::track::signed1Pt < 0.f; // ---------- for MC ---------- - void processMC(MyCollisionsMC const& collisions, aod::McCollisions const&, aod::BCsWithTimestamps const& bcs, MyTracksMC const& tracks, aod::V0PhotonsKF const& v0photons, aod::TrackAssoc const& trackIndices) + void processMC(MyCollisionsMC const& collisions, aod::McCollisions const&, MyBCs const& bcs, MyTracksMC const& tracks, aod::V0PhotonsKF const& v0photons, aod::TrackAssoc const& trackIndices) { uint64_t nCollisSel = 0; uint64_t nNoMcColl = 0; diff --git a/PWGEM/PhotonMeson/Tasks/CMakeLists.txt b/PWGEM/PhotonMeson/Tasks/CMakeLists.txt index 3a4fa2f5139..328f039590f 100644 --- a/PWGEM/PhotonMeson/Tasks/CMakeLists.txt +++ b/PWGEM/PhotonMeson/Tasks/CMakeLists.txt @@ -11,16 +11,6 @@ add_subdirectory(Converters) -o2physics_add_dpl_workflow(gammaconversions - SOURCES gammaConversions.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2Physics::AnalysisCore - COMPONENT_NAME Analysis) - -o2physics_add_dpl_workflow(gammaconversionstruthonlymc - SOURCES gammaConversionsTruthOnlyMc.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2Physics::AnalysisCore - COMPONENT_NAME Analysis) - o2physics_add_dpl_workflow(emcal-pi0-qc SOURCES emcalPi0Qc.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::EMCALBase O2::EMCALCalib O2Physics::AnalysisCore diff --git a/PWGEM/PhotonMeson/Tasks/CheckMCV0.cxx b/PWGEM/PhotonMeson/Tasks/CheckMCV0.cxx index b0ad9fea148..035cf6b905e 100644 --- a/PWGEM/PhotonMeson/Tasks/CheckMCV0.cxx +++ b/PWGEM/PhotonMeson/Tasks/CheckMCV0.cxx @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include diff --git a/PWGEM/PhotonMeson/Tasks/HeavyNeutralMeson.cxx b/PWGEM/PhotonMeson/Tasks/HeavyNeutralMeson.cxx index a92e1888049..be4f24a77e5 100644 --- a/PWGEM/PhotonMeson/Tasks/HeavyNeutralMeson.cxx +++ b/PWGEM/PhotonMeson/Tasks/HeavyNeutralMeson.cxx @@ -31,6 +31,7 @@ #include #include +#include #include #include #include @@ -90,10 +91,10 @@ enum PIDLimits { kTPCMin, const std::vector speciesName{"pion"}; // ToDo include charged pions const std::vector pTCutsName{"Pt min", "Pt max", "P TOF thres"}; const std::vector pidCutsName{"TPC min", "TPC max", "TPCTOF max", "ITS min", "ITS max"}; -const float pidcutsTable[kNTracksPID][kNPIDLimits]{{-4.f, 4.f, 4.f, -99.f, 99.f}}; -const float ptcutsTable[kNTracksPID][3]{{0.35f, 6.f, 0.75f}}; -const float nClusterMinTPC[1][kNTracksPID]{{80.0f}}; -const float nClusterMinITS[1][kNTracksPID]{{4}}; +constexpr std::array, kNTracksPID> pidcutsTable{{{-4.f, 4.f, 4.f, -99.f, 99.f}}}; +constexpr std::array, kNTracksPID> ptcutsTable{{{0.35f, 6.f, 0.75f}}}; +constexpr std::array, 1> nClusterMinTPC{{{80.0f}}}; +constexpr std::array, 1> nClusterMinITS{{{4.f}}}; } // namespace hnm @@ -111,19 +112,19 @@ struct HeavyNeutralMeson { Configurable confEvtRequireSel8{"confEvtRequireSel8", false, "Evt sel: check for offline selection (sel8)"}; // ---> Track selection - Configurable> cfgPtCuts{"cfgPtCuts", {hnm::ptcutsTable[0], 1, 3, hnm::speciesName, hnm::pTCutsName}, "Track pT selections"}; + Configurable> cfgPtCuts{"cfgPtCuts", {hnm::ptcutsTable[0].data(), 1, 3, hnm::speciesName, hnm::pTCutsName}, "Track pT selections"}; Configurable cfgTrkEta{"cfgTrkEta", 0.9, "Eta"}; - Configurable> cfgTPCNClustersMin{"cfgTPCNClustersMin", {hnm::nClusterMinTPC[0], 1, 1, std::vector{"TPCNClusMin"}, hnm::speciesName}, "Mininum of TPC Clusters"}; + Configurable> cfgTPCNClustersMin{"cfgTPCNClustersMin", {hnm::nClusterMinTPC[0].data(), 1, 1, std::vector{"TPCNClusMin"}, hnm::speciesName}, "Mininum of TPC Clusters"}; Configurable cfgTrkTPCfCls{"cfgTrkTPCfCls", 0.83, "Minimum fraction of crossed rows over findable clusters"}; Configurable cfgTrkTPCcRowsMin{"cfgTrkTPCcRowsMin", 70, "Minimum number of crossed TPC rows"}; Configurable cfgTrkTPCsClsSharedFrac{"cfgTrkTPCsClsSharedFrac", 1.f, "Fraction of shared TPC clusters"}; - Configurable> cfgTrkITSnclsMin{"cfgTrkITSnclsMin", {hnm::nClusterMinITS[0], 1, 1, std::vector{"Cut"}, hnm::speciesName}, "Minimum number of ITS clusters"}; + Configurable> cfgTrkITSnclsMin{"cfgTrkITSnclsMin", {hnm::nClusterMinITS[0].data(), 1, 1, std::vector{"Cut"}, hnm::speciesName}, "Minimum number of ITS clusters"}; Configurable cfgTrkDCAxyMax{"cfgTrkDCAxyMax", 0.15, "Maximum DCA_xy"}; Configurable cfgTrkDCAzMax{"cfgTrkDCAzMax", 0.3, "Maximum DCA_z"}; Configurable cfgTrkMaxChi2PerClusterTPC{"cfgTrkMaxChi2PerClusterTPC", 4.0f, "Minimal track selection: max allowed chi2 per TPC cluster"}; // 4.0 is default of global tracks on 20.01.2023 Configurable cfgTrkMaxChi2PerClusterITS{"cfgTrkMaxChi2PerClusterITS", 36.0f, "Minimal track selection: max allowed chi2 per ITS cluster"}; // 36.0 is default of global tracks on 20.01.2023 - Configurable> cfgPIDCuts{"cfgPIDCuts", {hnm::pidcutsTable[0], 1, hnm::kNPIDLimits, hnm::speciesName, hnm::pidCutsName}, "Femtopartner PID nsigma selections"}; // PID selections + Configurable> cfgPIDCuts{"cfgPIDCuts", {hnm::pidcutsTable[0].data(), 1, hnm::kNPIDLimits, hnm::speciesName, hnm::pidCutsName}, "Femtopartner PID nsigma selections"}; // PID selections // ---> Configurables to allow for a shift in eta/phi of EMCal clusters to better align with extrapolated TPC tracks Configurable cfgDoEMCShift{"cfgDoEMCShift", false, "Apply SM-wise shift in eta and phi to EMCal clusters to align with TPC tracks"}; @@ -137,9 +138,9 @@ struct HeavyNeutralMeson { Configurable cfgHNMMassCorrection{"cfgHNMMassCorrection", 1, "Use GG PDG mass to correct HNM mass (0 = off, 1 = subDeltaPi0, 2 = subLambda)"}; // ---> Mass windows for the selection of heavy neutral mesons (also based on mass of their light neutral meson decay daughter) - static constexpr float DefaultMassWindows[2][4] = {{0., 0.4, 0.6, 1.}, {0.4, 0.8, 0.8, 1.2}}; - Configurable> cfgMassWindowOmega{"cfgMassWindowOmega", {DefaultMassWindows[0], 4, {"pi0_min", "pi0_max", "omega_min", "omega_max"}}, "Mass window for selected omegas and their decay pi0"}; - Configurable> cfgMassWindowEtaPrime{"cfgMassWindowEtaPrime", {DefaultMassWindows[1], 4, {"eta_min", "eta_max", "etaprime_min", "etaprime_max"}}, "Mass window for selected eta' and their decay eta"}; + static constexpr std::array, 2> DefaultMassWindows{{{0., 0.4, 0.6, 1.}, {0.4, 0.8, 0.8, 1.2}}}; + Configurable> cfgMassWindowOmega{"cfgMassWindowOmega", {DefaultMassWindows[0].data(), 4, {"pi0_min", "pi0_max", "omega_min", "omega_max"}}, "Mass window for selected omegas and their decay pi0"}; + Configurable> cfgMassWindowEtaPrime{"cfgMassWindowEtaPrime", {DefaultMassWindows[1].data(), 4, {"eta_min", "eta_max", "etaprime_min", "etaprime_max"}}, "Mass window for selected eta' and their decay eta"}; Configurable cfgMaxMultiplicity{"cfgMaxMultiplicity", 5000, "Maximum number of tracks in a collision (can be used to increase the S/B -> Very experimental)"}; Configurable cfgMinGGPtOverHNMPt{"cfgMinGGPtOverHNMPt", 0., "Minimum ratio of the pT of the gamma gamma pair over the pT of the HNM (can be used to increase the S/B)"}; @@ -147,9 +148,9 @@ struct HeavyNeutralMeson { HistogramRegistry mHistManager{"HeavyNeutralMesonHistograms", {}, OutputObjHandlingPolicy::AnalysisObject}; // Prepare vectors for different species - std::vector vGGs; - std::vector vHNMs; - std::vector etaPrimeEMC, etaPrimePCM, omegaEMC, omegaPCM, proton, antiproton, deuteron, antideuteron, pion, antipion; + std::vector mvGGs; + std::vector mvHNMs; + std::vector etaPrimeEMC, etaPrimePCM, omegaEMC, omegaPCM, pion, antipion; float mMassProton = constants::physics::MassProton; float mMassDeuteron = constants::physics::MassDeuteron; float mMassOmega = 0.782; @@ -162,30 +163,42 @@ struct HeavyNeutralMeson { template bool isSelectedTrack(T const& track, hnm::TracksPID partSpecies) { - if (track.pt() < cfgPtCuts->get(partSpecies, "Pt min")) + if (track.pt() < cfgPtCuts->get(partSpecies, "Pt min")) { return false; - if (track.pt() > cfgPtCuts->get(partSpecies, "Pt max")) + } + if (track.pt() > cfgPtCuts->get(partSpecies, "Pt max")) { return false; - if (std::abs(track.eta()) > cfgTrkEta) + } + if (std::abs(track.eta()) > cfgTrkEta) { return false; - if (track.tpcNClsFound() < cfgTPCNClustersMin->get("TPCNClusMin", partSpecies)) + } + if (track.tpcNClsFound() < cfgTPCNClustersMin->get("TPCNClusMin", partSpecies)) { return false; - if (track.tpcCrossedRowsOverFindableCls() < cfgTrkTPCfCls) + } + if (track.tpcCrossedRowsOverFindableCls() < cfgTrkTPCfCls) { return false; - if (track.tpcNClsCrossedRows() < cfgTrkTPCcRowsMin) + } + if (track.tpcNClsCrossedRows() < cfgTrkTPCcRowsMin) { return false; - if (track.tpcFractionSharedCls() > cfgTrkTPCsClsSharedFrac) + } + if (track.tpcFractionSharedCls() > cfgTrkTPCsClsSharedFrac) { return false; - if (track.itsNCls() < cfgTrkITSnclsMin->get(static_cast(0), partSpecies)) + } + if (track.itsNCls() < cfgTrkITSnclsMin->get(static_cast(0), partSpecies)) { return false; - if (std::abs(track.dcaXY()) > cfgTrkDCAxyMax) + } + if (std::abs(track.dcaXY()) > cfgTrkDCAxyMax) { return false; - if (std::abs(track.dcaZ()) > cfgTrkDCAzMax) + } + if (std::abs(track.dcaZ()) > cfgTrkDCAzMax) { return false; - if (track.tpcChi2NCl() > cfgTrkMaxChi2PerClusterTPC) + } + if (track.tpcChi2NCl() > cfgTrkMaxChi2PerClusterTPC) { return false; - if (track.itsChi2NCl() > cfgTrkMaxChi2PerClusterITS) + } + if (track.itsChi2NCl() > cfgTrkMaxChi2PerClusterITS) { return false; + } return true; } @@ -237,8 +250,9 @@ struct HeavyNeutralMeson { mHistManager.add("Event/nClustersVsV0s", "Number of clusters and V0s in the collision;#bf{#it{N}_{clusters}};#bf{#it{N}_{V0s}}", HistType::kTH2F, {{26, -0.5, 25.5}, {26, -0.5, 25.5}}); mHistManager.add("Event/nEMCalEvents", "Number of collisions with a certain combination of EMCal triggers;;#bf{#it{N}_{collisions}}", HistType::kTH1F, {{5, -0.5, 4.5}}); std::vector nEventTitles = {"Cells & kTVXinEMC", "Cells & L0", "Cells & !kTVXinEMC & !L0", "!Cells & kTVXinEMC", "!Cells & L0"}; - for (size_t iBin = 0; iBin < nEventTitles.size(); iBin++) + for (size_t iBin = 0; iBin < nEventTitles.size(); iBin++) { mHistManager.get(HIST("Event/nEMCalEvents"))->GetXaxis()->SetBinLabel(iBin + 1, nEventTitles[iBin].data()); + } mHistManager.add("Event/fMultiplicityBefore", "Multiplicity of all processed events;#bf{#it{N}_{tracks}};#bf{#it{N}_{collisions}}", HistType::kTH1F, {{500, 0, 500}}); mHistManager.add("Event/fMultiplicityAfter", "Multiplicity after event cuts;#bf{#it{N}_{tracks}};#bf{#it{N}_{collisions}}", HistType::kTH1F, {{500, 0, 500}}); mHistManager.add("Event/fZvtxBefore", "Zvtx of all processed events;#bf{z_{vtx} (cm)};#bf{#it{N}_{collisions}}", HistType::kTH1F, {{500, -15, 15}}); @@ -265,8 +279,8 @@ struct HeavyNeutralMeson { mHistManager.add("TrackCuts/TPCSignal/fTPCSignalAnti", "TPCSignalP;#bf{#it{p} (GeV/#it{c})};dE/dx", {HistType::kTH2F, {{500, 0.0f, 6.0f}, {2000, -100.f, 500.f}}}); const int nTrackSpecies = 2; // x2 because of anti particles - const char* particleSpecies[nTrackSpecies] = {"Pion", "AntiPion"}; - const char* particleSpeciesLatex[nTrackSpecies] = {"#pi^{+}", "#pi^{-}"}; + std::array particleSpecies = {"Pion", "AntiPion"}; + std::array particleSpeciesLatex = {"#pi^{+}", "#pi^{-}"}; for (int iParticle = 0; iParticle < nTrackSpecies; iParticle++) { mHistManager.add(Form("TrackCuts/TracksBefore/fMomCorrelationAfterCuts%s", particleSpecies[iParticle]), "fMomCorrelation;#bf{#it{p} (GeV/#it{c})};#bf{#it{p}_{TPC} (GeV/#it{c})}", {HistType::kTH2F, {{500, 0.0f, 20.0f}, {500, 0.0f, 20.0f}}}); @@ -346,8 +360,9 @@ struct HeavyNeutralMeson { mHistManager.fill(HIST("Event/fZvtxBefore"), collision.posZ()); // Ensure evts are consistent with Sel8 and Vtx-z selection - if (!isSelectedEvent(collision)) + if (!isSelectedEvent(collision)) { return; + } // QA accepted evts mHistManager.fill(HIST("Event/fMultiplicityAfter"), collision.multNTracksPV()); @@ -356,7 +371,7 @@ struct HeavyNeutralMeson { // clean vecs pion.clear(); antipion.clear(); - vHNMs.clear(); + mvHNMs.clear(); // vGGs vector is cleared in reconstructGGs. // ---------------------------------> EMCal event QA <---------------------------------- @@ -366,16 +381,21 @@ struct HeavyNeutralMeson { bool iskTVXinEMC = collision.foundBC_as().alias_bit(kTVXinEMC); bool isL0Triggered = collision.foundBC_as().alias_bit(kEMC7) || collision.foundBC_as().alias_bit(kEG1) || collision.foundBC_as().alias_bit(kEG2); - if (bcHasEMCCells && iskTVXinEMC) + if (bcHasEMCCells && iskTVXinEMC) { mHistManager.fill(HIST("Event/nEMCalEvents"), 0); - if (bcHasEMCCells && isL0Triggered) + } + if (bcHasEMCCells && isL0Triggered) { mHistManager.fill(HIST("Event/nEMCalEvents"), 1); - if (bcHasEMCCells && !iskTVXinEMC && !isL0Triggered) + } + if (bcHasEMCCells && !iskTVXinEMC && !isL0Triggered) { mHistManager.fill(HIST("Event/nEMCalEvents"), 2); - if (!bcHasEMCCells && iskTVXinEMC) + } + if (!bcHasEMCCells && iskTVXinEMC) { mHistManager.fill(HIST("Event/nEMCalEvents"), 3); - if (!bcHasEMCCells && isL0Triggered) + } + if (!bcHasEMCCells && isL0Triggered) { mHistManager.fill(HIST("Event/nEMCalEvents"), 4); + } // --------------------------------> Process Photons <---------------------------------- // - Slice clusters and V0s by collision ID to get the ones in this collision @@ -388,9 +408,9 @@ struct HeavyNeutralMeson { std::vector vGammas; hnmutilities::storeGammasInVector(clustersInThisCollision, v0sInThisCollision, vGammas, emcEtaShift, emcPhiShift); - hnmutilities::reconstructGGs(vGammas, vGGs); + hnmutilities::reconstructGGs(vGammas, mvGGs); vGammas.clear(); - processGGs(vGGs); + processGGs(mvGGs); // ------------------------------> Loop over all tracks <------------------------------- // - Sort them into vectors based on PID ((anti)protons, (anti)deuterons, (anti)pions) @@ -482,7 +502,7 @@ struct HeavyNeutralMeson { for (const auto& posPion : pion) { for (const auto& negPion : antipion) { ROOT::Math::PtEtaPhiMVector vecPiPlPiMi = posPion + negPion; - hnmutilities::reconstructHeavyNeutralMesons(vecPiPlPiMi, vGGs, vHNMs); + hnmutilities::reconstructHeavyNeutralMesons(vecPiPlPiMi, mvGGs, mvHNMs); mHistManager.fill(HIST("HNM/Before/PiPlPiMi/fInvMassVsPt"), vecPiPlPiMi.M(), vecPiPlPiMi.pt()); mHistManager.fill(HIST("HNM/Before/PiPlPiMi/fEta"), vecPiPlPiMi.eta()); @@ -503,7 +523,7 @@ struct HeavyNeutralMeson { // ---------------------------> Process HNM candidates <-------------------------------- // - Fill invMassVsPt histograms separated into HNM types (based on GG mass) and gamma reco method // ------------------------------------------------------------------------------------- - processHNMs(vHNMs); + processHNMs(mvHNMs); } /// \brief Loop over the GG candidates, fill the mass/pt histograms and set the isPi0/isEta flags based on the reconstructed mass @@ -607,4 +627,7 @@ struct HeavyNeutralMeson { } }; -WorkflowSpec defineDataProcessing(o2::framework::ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; } +WorkflowSpec defineDataProcessing(o2::framework::ConfigContext const& context) +{ + return WorkflowSpec{adaptAnalysisTask(context)}; +} diff --git a/PWGEM/PhotonMeson/Tasks/MaterialBudget.cxx b/PWGEM/PhotonMeson/Tasks/MaterialBudget.cxx index 2ecfd14711d..5baa0ebf6bc 100644 --- a/PWGEM/PhotonMeson/Tasks/MaterialBudget.cxx +++ b/PWGEM/PhotonMeson/Tasks/MaterialBudget.cxx @@ -26,6 +26,7 @@ #include #include +#include #include #include #include @@ -122,11 +123,11 @@ struct MaterialBudget { HistogramRegistry registry{"output", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; - static constexpr std::string_view ItsClsNames[] = { + static constexpr std::array ItsClsNames{ "ITSCls0", "ITSCls1", "ITSCls2", "ITSCls3", "ITSCls4", "ITSCls5", "ITSCls6", "ITSCls7"}; - static constexpr std::string_view EventTypes[2] = {"before/", "after/"}; + static constexpr std::array EventTypes{"before/", "after/"}; Configurable cfgPlotBremsstrahlung{"cfgPlotBremsstrahlung", false, "produce plots to study Bremsstrahlung"}; Configurable cfgPlotResolution{"cfgPlotResolution", false, "produce plots to study resolution"}; @@ -136,7 +137,6 @@ struct MaterialBudget { Configurable cfgPlotMBCollisions{"cfgPlotMBCollisions", false, "produce plots to study material distribution if collision association is wrong"}; ConfigurableAxis binsPt{"binsPt", {VARIABLE_WIDTH, 0.0, 0.1, 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, 2.0}, ""}; - const AxisSpec axisPt{binsPt, "#it{p}_{T} [GeV/c]"}; EMPhotonEventCut fEMEventCut; struct : ConfigurableGroup { @@ -317,7 +317,7 @@ struct MaterialBudget { void addhistograms() { - + const AxisSpec axisPt{binsPt, "#it{p}_{T} [GeV/c]"}; auto hCollisionCounter = registry.add("Event/before/hCollisionCounter", "collision counter;;Number of events", kTH1F, {{10, 0.5, 10.5}}, false); hCollisionCounter->GetXaxis()->SetBinLabel(1, "all"); hCollisionCounter->GetXaxis()->SetBinLabel(2, "No TF border"); @@ -608,43 +608,59 @@ struct MaterialBudget { template void fillITSClsNeg(HistogramRegistry& reg, float value) { - if constexpr (N == 0) // o2-linter: disable=magic-number (just numbers for ITS cluster) + if constexpr (N == 0) { // o2-linter: disable=magic-number (just numbers for ITS cluster) reg.fill(HIST("ITSHits/Neg/ITSCls0"), value); - if constexpr (N == 1) // o2-linter: disable=magic-number (just numbers for ITS cluster) + } + if constexpr (N == 1) { // o2-linter: disable=magic-number (just numbers for ITS cluster) reg.fill(HIST("ITSHits/Neg/ITSCls1"), value); - if constexpr (N == 2) // o2-linter: disable=magic-number (just numbers for ITS cluster) + } + if constexpr (N == 2) { // o2-linter: disable=magic-number (just numbers for ITS cluster) reg.fill(HIST("ITSHits/Neg/ITSCls2"), value); - if constexpr (N == 3) // o2-linter: disable=magic-number (just numbers for ITS cluster) + } + if constexpr (N == 3) { // o2-linter: disable=magic-number (just numbers for ITS cluster) reg.fill(HIST("ITSHits/Neg/ITSCls3"), value); - if constexpr (N == 4) // o2-linter: disable=magic-number (just numbers for ITS cluster) + } + if constexpr (N == 4) { // o2-linter: disable=magic-number (just numbers for ITS cluster) reg.fill(HIST("ITSHits/Neg/ITSCls4"), value); - if constexpr (N == 5) // o2-linter: disable=magic-number (just numbers for ITS cluster) + } + if constexpr (N == 5) { // o2-linter: disable=magic-number (just numbers for ITS cluster) reg.fill(HIST("ITSHits/Neg/ITSCls5"), value); - if constexpr (N == 6) // o2-linter: disable=magic-number (just numbers for ITS cluster) + } + if constexpr (N == 6) { // o2-linter: disable=magic-number (just numbers for ITS cluster) reg.fill(HIST("ITSHits/Neg/ITSCls6"), value); - if constexpr (N == 7) // o2-linter: disable=magic-number (just numbers for ITS cluster) + } + if constexpr (N == 7) { // o2-linter: disable=magic-number (just numbers for ITS cluster) reg.fill(HIST("ITSHits/Neg/ITSCls7"), value); + } } template void fillITSClsPos(HistogramRegistry& reg, float value) { - if constexpr (N == 0) // o2-linter: disable=magic-number (just numbers for ITS cluster) + if constexpr (N == 0) { // o2-linter: disable=magic-number (just numbers for ITS cluster) reg.fill(HIST("ITSHits/Pos/ITSCls0"), value); - if constexpr (N == 1) // o2-linter: disable=magic-number (just numbers for ITS cluster) + } + if constexpr (N == 1) { // o2-linter: disable=magic-number (just numbers for ITS cluster) reg.fill(HIST("ITSHits/Pos/ITSCls1"), value); - if constexpr (N == 2) // o2-linter: disable=magic-number (just numbers for ITS cluster) + } + if constexpr (N == 2) { // o2-linter: disable=magic-number (just numbers for ITS cluster) reg.fill(HIST("ITSHits/Pos/ITSCls2"), value); - if constexpr (N == 3) // o2-linter: disable=magic-number (just numbers for ITS cluster) + } + if constexpr (N == 3) { // o2-linter: disable=magic-number (just numbers for ITS cluster) reg.fill(HIST("ITSHits/Pos/ITSCls3"), value); - if constexpr (N == 4) // o2-linter: disable=magic-number (just numbers for ITS cluster) + } + if constexpr (N == 4) { // o2-linter: disable=magic-number (just numbers for ITS cluster) reg.fill(HIST("ITSHits/Pos/ITSCls4"), value); - if constexpr (N == 5) // o2-linter: disable=magic-number (just numbers for ITS cluster) + } + if constexpr (N == 5) { // o2-linter: disable=magic-number (just numbers for ITS cluster) reg.fill(HIST("ITSHits/Pos/ITSCls5"), value); - if constexpr (N == 6) // o2-linter: disable=magic-number (just numbers for ITS cluster) + } + if constexpr (N == 6) { // o2-linter: disable=magic-number (just numbers for ITS cluster) reg.fill(HIST("ITSHits/Pos/ITSCls6"), value); - if constexpr (N == 7) // o2-linter: disable=magic-number (just numbers for ITS cluster) + } + if constexpr (N == 7) { // o2-linter: disable=magic-number (just numbers for ITS cluster) reg.fill(HIST("ITSHits/Pos/ITSCls7"), value); + } } template @@ -847,7 +863,7 @@ struct MaterialBudget { { 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; } @@ -983,24 +999,33 @@ struct MaterialBudget { if (pdgNeg == kElectron && pdgPos == kPositron) { return 1; } - if (pdgNeg == kElectron && pdgPos == kPiPlus) + if (pdgNeg == kElectron && pdgPos == kPiPlus) { return 2; - if (pdgNeg == kPiMinus && pdgPos == kPositron) + } + if (pdgNeg == kPiMinus && pdgPos == kPositron) { return 3; - if (pdgNeg == kKMinus && pdgPos == kPositron) + } + if (pdgNeg == kKMinus && pdgPos == kPositron) { return 4; - if (pdgNeg == kElectron && pdgPos == kKPlus) + } + if (pdgNeg == kElectron && pdgPos == kKPlus) { return 5; - if (pdgNeg == kProtonBar && pdgPos == kProton) + } + if (pdgNeg == kProtonBar && pdgPos == kProton) { return 6; - if (pdgNeg == kKMinus && pdgPos == kKPlus) + } + if (pdgNeg == kKMinus && pdgPos == kKPlus) { return 7; - if (pdgNeg == kPiMinus && pdgPos == kProton) + } + if (pdgNeg == kPiMinus && pdgPos == kProton) { return 8; - if (pdgNeg == kProtonBar && pdgPos == kPiPlus) + } + if (pdgNeg == kProtonBar && pdgPos == kPiPlus) { return 9; - if (pdgNeg == kMuonMinus && pdgPos == kMuonPlus) + } + if (pdgNeg == kMuonMinus && pdgPos == kMuonPlus) { return 10; + } return 11; } @@ -1017,7 +1042,7 @@ struct MaterialBudget { { for (const auto& collision : filteredCollisions) { - const float centralities[3] = { + const std::array centralities = { collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; @@ -1235,7 +1260,6 @@ struct MaterialBudget { registry.fill(HIST("Bremsstrahlung/relativeResoPtWOBrems"), trk.pt(), trk.pt() * std::sqrt(trk.c1Pt21Pt2())); - bool isFirst = true; for (const auto& dId : mc.daughtersIds()) { if (dId < 0 || dId >= mcparticles.size()) { continue; @@ -1259,9 +1283,7 @@ struct MaterialBudget { registry.fill(HIST("Bremsstrahlung/EnergyLossXY"), daughter.vx(), daughter.vy()); registry.fill(HIST("Bremsstrahlung/EnergyLossXYWeigh"), daughter.vx(), daughter.vy(), daughter.e()); - if (isFirst) { - registry.fill(HIST("Bremsstrahlung/relativeResoPtWBrems"), trk.pt(), trk.pt() * std::sqrt(trk.c1Pt21Pt2())); - } + registry.fill(HIST("Bremsstrahlung/relativeResoPtWBrems"), trk.pt(), trk.pt() * std::sqrt(trk.c1Pt21Pt2())); registry.fill(HIST("Bremsstrahlung/Sigma1PtVsR"), r, trk.sigma1Pt()); @@ -1279,7 +1301,6 @@ struct MaterialBudget { } registry.fill(HIST("Bremsstrahlung/NBrem"), nBrem); - isFirst = false; } } @@ -1289,8 +1310,8 @@ struct MaterialBudget { PROCESS_SWITCH(MaterialBudget, processBremsstrahlung, "process material budget", false); }; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +WorkflowSpec defineDataProcessing(ConfigContext const& context) { return WorkflowSpec{ - adaptAnalysisTask(cfgc)}; + adaptAnalysisTask(context)}; } diff --git a/PWGEM/PhotonMeson/Tasks/MaterialBudgetMC.cxx b/PWGEM/PhotonMeson/Tasks/MaterialBudgetMC.cxx index 83fa58c4b84..30bf1e1d469 100644 --- a/PWGEM/PhotonMeson/Tasks/MaterialBudgetMC.cxx +++ b/PWGEM/PhotonMeson/Tasks/MaterialBudgetMC.cxx @@ -30,6 +30,7 @@ #include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" +#include #include #include #include @@ -83,7 +84,7 @@ struct MaterialBudgetMC { Configurable fConfigEMEventCut{"cfgEMEventCut", "minbias", "em event cut"}; // only 1 event cut per wagon EMPhotonEventCut fEMEventCut; - static constexpr std::string_view event_types[2] = {"before", "after"}; + static constexpr std::array event_types = {"before", "after"}; OutputObj fOutputEvent{"Event"}; OutputObj fOutputV0{"V0"}; @@ -109,36 +110,37 @@ struct MaterialBudgetMC { TString ev_cut_name = fConfigEMEventCut.value; fEMEventCut = *eventcuts::GetCut(ev_cut_name.Data()); - fOutputEvent.setObject(reinterpret_cast(fMainList->FindObject("Event"))); - fOutputV0.setObject(reinterpret_cast(fMainList->FindObject("V0"))); - fOutputPair.setObject(reinterpret_cast(fMainList->FindObject("Pair"))); - fOutputGen.setObject(reinterpret_cast(fMainList->FindObject("Generated"))); + fOutputEvent.setObject(dynamic_cast(fMainList->FindObject("Event"))); + fOutputV0.setObject(dynamic_cast(fMainList->FindObject("V0"))); + fOutputPair.setObject(dynamic_cast(fMainList->FindObject("Pair"))); + fOutputGen.setObject(dynamic_cast(fMainList->FindObject("Generated"))); } template - void add_pair_histograms(THashList* list_pair, const std::string pairname, TCuts1 const& tagcuts, TCuts2 const& probecuts, TCuts3 const& cuts3) + void add_pair_histograms(THashList* list_pair, std::string const& pairname, TCuts1 const& tagcuts, TCuts2 const& probecuts, TCuts3 const& cuts3) { for (const auto& tagcut : tagcuts) { for (const auto& probecut : probecuts) { - std::string cutname1 = tagcut.getName(); - std::string cutname2 = probecut.getName(); + std::string const& cutname1 = tagcut.getName(); + std::string const& cutname2 = probecut.getName(); - THashList* list_pair_subsys = reinterpret_cast(list_pair->FindObject(pairname.data())); - std::string photon_cut_name = cutname1 + "_" + cutname2; + auto* list_pair_subsys = dynamic_cast(list_pair->FindObject(pairname.data())); + std::string photon_cut_name = cutname1; + photon_cut_name.append("_").append(cutname2); o2::aod::pwgem::photon::histogram::AddHistClass(list_pair_subsys, photon_cut_name.data()); - THashList* list_pair_subsys_photoncut = reinterpret_cast(list_pair_subsys->FindObject(photon_cut_name.data())); + auto* list_pair_subsys_photoncut = dynamic_cast(list_pair_subsys->FindObject(photon_cut_name.data())); for (const auto& cut3 : cuts3) { std::string pair_cut_name = cut3.getName(); o2::aod::pwgem::photon::histogram::AddHistClass(list_pair_subsys_photoncut, pair_cut_name.data()); - THashList* list_pair_subsys_paircut = reinterpret_cast(list_pair_subsys_photoncut->FindObject(pair_cut_name.data())); + auto* list_pair_subsys_paircut = dynamic_cast(list_pair_subsys_photoncut->FindObject(pair_cut_name.data())); o2::aod::pwgem::photon::histogram::DefineHistograms(list_pair_subsys_paircut, "material_budget_study", "Pair"); } // end of cut3 loop pair cut } // end of probecut loop } // end of tagcut loop } - static constexpr std::string_view pairnames[9] = {"PCMPCM", "PHOSPHOS", "EMCEMC", "PCMPHOS", "PCMEMC", "PCMDalitzEE", "PCMDalitzMuMu", "PHOSEMC", "DalitzEEDalitzEE"}; + static constexpr std::array pairnames = {"PCMPCM", "PHOSPHOS", "EMCEMC", "PCMPHOS", "PCMEMC", "PCMDalitzEE", "PCMDalitzMuMu", "PHOSEMC", "DalitzEEDalitzEE"}; void addhistograms() { fMainList->SetOwner(true); @@ -146,13 +148,13 @@ struct MaterialBudgetMC { // create sub lists first. o2::aod::pwgem::photon::histogram::AddHistClass(fMainList, "Event"); - THashList* list_ev = reinterpret_cast(fMainList->FindObject("Event")); + auto* list_ev = dynamic_cast(fMainList->FindObject("Event")); o2::aod::pwgem::photon::histogram::AddHistClass(fMainList, "Pair"); - THashList* list_pair = reinterpret_cast(fMainList->FindObject("Pair")); + auto* list_pair = dynamic_cast(fMainList->FindObject("Pair")); o2::aod::pwgem::photon::histogram::AddHistClass(fMainList, "V0"); - THashList* list_v0 = reinterpret_cast(fMainList->FindObject("V0")); + auto* list_v0 = dynamic_cast(fMainList->FindObject("V0")); // for V0s for (const auto& cut : fProbeCuts) { @@ -164,9 +166,9 @@ struct MaterialBudgetMC { for (const auto& pairname : fPairNames) { LOGF(info, "Enabled pairs = %s", pairname.data()); - THashList* list_ev_pair = reinterpret_cast(o2::aod::pwgem::photon::histogram::AddHistClass(list_ev, pairname.data())); + THashList* list_ev_pair = o2::aod::pwgem::photon::histogram::AddHistClass(list_ev, pairname.data()); for (const auto& evtype : event_types) { - THashList* list_ev_type = reinterpret_cast(o2::aod::pwgem::photon::histogram::AddHistClass(list_ev_pair, evtype.data())); + THashList* list_ev_type = o2::aod::pwgem::photon::histogram::AddHistClass(list_ev_pair, evtype.data()); o2::aod::pwgem::photon::histogram::DefineHistograms(list_ev_type, "Event", evtype.data()); } @@ -179,7 +181,7 @@ struct MaterialBudgetMC { } // end of pair name loop o2::aod::pwgem::photon::histogram::AddHistClass(fMainList, "Generated"); - THashList* list_gen = reinterpret_cast(fMainList->FindObject("Generated")); + auto* list_gen = dynamic_cast(fMainList->FindObject("Generated")); o2::aod::pwgem::photon::histogram::DefineHistograms(list_gen, "Generated", ""); } @@ -245,12 +247,12 @@ struct MaterialBudgetMC { template void fillsinglephoton(TEvents const& collisions, TPhotons const& photons, TPreslice const& perCollision, TCuts const& cuts, TLegs const& /*legs*/, TMCParticles const& mcparticles, TMCEvents const&) { - THashList* list_ev_pair_before = static_cast(fMainList->FindObject("Event")->FindObject(pairnames[pairtype].data())->FindObject(event_types[0].data())); - THashList* list_ev_pair_after = static_cast(fMainList->FindObject("Event")->FindObject(pairnames[pairtype].data())->FindObject(event_types[1].data())); - THashList* list_v0 = static_cast(fMainList->FindObject("V0")); - double value[4] = {0.f}; + auto* list_ev_pair_before = dynamic_cast(fMainList->FindObject("Event")->FindObject(pairnames[pairtype].data())->FindObject(event_types[0].data())); + auto* list_ev_pair_after = dynamic_cast(fMainList->FindObject("Event")->FindObject(pairnames[pairtype].data())->FindObject(event_types[1].data())); + auto* list_v0 = dynamic_cast(fMainList->FindObject("V0")); + std::array value = {0.f}; for (const auto& collision : collisions) { - 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; } @@ -260,8 +262,8 @@ struct MaterialBudgetMC { continue; } o2::aod::pwgem::photon::histogram::FillHistClass(list_ev_pair_after, "", collision); - reinterpret_cast(list_ev_pair_before->FindObject("hCollisionCounter"))->Fill("accepted", 1.f); - reinterpret_cast(list_ev_pair_after->FindObject("hCollisionCounter"))->Fill("accepted", 1.f); + dynamic_cast(list_ev_pair_before->FindObject("hCollisionCounter"))->Fill("accepted", 1.f); + dynamic_cast(list_ev_pair_after->FindObject("hCollisionCounter"))->Fill("accepted", 1.f); auto photons_coll = photons.sliceBy(perCollision, collision.globalIndex()); for (const auto& cut : cuts) { @@ -293,7 +295,7 @@ struct MaterialBudgetMC { value[1] = photon.v0radius(); value[2] = RecoDecay::constrainAngle(phi_cp); value[3] = eta_cp; - reinterpret_cast(list_v0->FindObject(cut.getName().c_str())->FindObject("hs_conv_point"))->Fill(value); + dynamic_cast(list_v0->FindObject(cut.getName().c_str())->FindObject("hs_conv_point"))->Fill(value.data()); } // end of photon loop } // end of cut loop @@ -304,10 +306,10 @@ struct MaterialBudgetMC { template void TruePairing(TEvents const& collisions, TPhotons1 const& photons1, TPhotons2 const& photons2, TPreslice1 const& perCollision1, TPreslice2 const& perCollision2, TCuts1 const& tagcuts, TCuts2 const& probecuts, TPairCuts const& paircuts, TLegs const& /*legs*/, TMCParticles const& mcparticles, TMCEvents const&) { - THashList* list_pair_ss = static_cast(fMainList->FindObject("Pair")->FindObject(pairnames[pairtype].data())); + auto* list_pair_ss = dynamic_cast(fMainList->FindObject("Pair")->FindObject(pairnames[pairtype].data())); for (const auto& collision : collisions) { - 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; } @@ -318,7 +320,7 @@ struct MaterialBudgetMC { auto photons1_coll = photons1.sliceBy(perCollision1, collision.globalIndex()); auto photons2_coll = photons2.sliceBy(perCollision2, collision.globalIndex()); - double value[6] = {0.f}; + std::array value{0.}; float phi_cp2 = 0.f, eta_cp2 = 0.f; for (const auto& tagcut : tagcuts) { for (const auto& probecut : probecuts) { @@ -386,7 +388,7 @@ struct MaterialBudgetMC { value[3] = g2.v0radius(); value[4] = RecoDecay::constrainAngle(phi_cp2); value[5] = eta_cp2; - reinterpret_cast(list_pair_ss->FindObject(Form("%s_%s", tagcut.getName().c_str(), probecut.getName().c_str()))->FindObject(paircut.getName().c_str())->FindObject("hs_conv_point_same"))->Fill(value); + dynamic_cast(list_pair_ss->FindObject(Form("%s_%s", tagcut.getName().c_str(), probecut.getName().c_str()))->FindObject(paircut.getName().c_str())->FindObject("hs_conv_point_same"))->Fill(value.data()); } // end of pair cut loop } // end of g2 loop } // end of g1 loop @@ -413,30 +415,30 @@ struct MaterialBudgetMC { // all MC tracks which belong to the MC event corresponding to the current reconstructed event for (const auto& collision : grouped_collisions) { - 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; } auto mccollision = collision.emmcevent(); // LOGF(info, "mccollision.globalIndex() = %d", mccollision.globalIndex()); - reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hCollisionCounter"))->Fill(1.0); - reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hZvtx_before"))->Fill(mccollision.posZ()); + dynamic_cast(fMainList->FindObject("Generated")->FindObject("hCollisionCounter"))->Fill(1.0); + dynamic_cast(fMainList->FindObject("Generated")->FindObject("hZvtx_before"))->Fill(mccollision.posZ()); if (!collision.sel8()) { continue; } - reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hCollisionCounter"))->Fill(2.0); + dynamic_cast(fMainList->FindObject("Generated")->FindObject("hCollisionCounter"))->Fill(2.0); if (collision.numContrib() < 0.5) { continue; } - reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hCollisionCounter"))->Fill(3.0); + dynamic_cast(fMainList->FindObject("Generated")->FindObject("hCollisionCounter"))->Fill(3.0); if (std::abs(collision.posZ()) > 10.0) { continue; } - reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hCollisionCounter"))->Fill(4.0); - reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hZvtx_after"))->Fill(mccollision.posZ()); + dynamic_cast(fMainList->FindObject("Generated")->FindObject("hCollisionCounter"))->Fill(4.0); + dynamic_cast(fMainList->FindObject("Generated")->FindObject("hZvtx_after"))->Fill(mccollision.posZ()); } // end of collision loop } @@ -447,8 +449,8 @@ struct MaterialBudgetMC { PROCESS_SWITCH(MaterialBudgetMC, processDummy, "Dummy function", true); }; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +WorkflowSpec defineDataProcessing(ConfigContext const& context) { return WorkflowSpec{ - adaptAnalysisTask(cfgc, TaskName{"material-budget-mc"})}; + adaptAnalysisTask(context, TaskName{"material-budget-mc"})}; } diff --git a/PWGEM/PhotonMeson/Tasks/OmegaMesonEMC.cxx b/PWGEM/PhotonMeson/Tasks/OmegaMesonEMC.cxx index 587546ff802..7fd90cde096 100644 --- a/PWGEM/PhotonMeson/Tasks/OmegaMesonEMC.cxx +++ b/PWGEM/PhotonMeson/Tasks/OmegaMesonEMC.cxx @@ -8,13 +8,10 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// + /// \file OmegaMesonEMC.cxx -/// /// \brief This code loops over collisions to reconstruct heavy mesons (omega or eta') using EMCal clusters -/// /// \author Nicolas Strangmann (nicolas.strangmann@cern.ch) - Goethe University Frankfurt -/// #include "PWGEM/PhotonMeson/Utils/HNMUtilities.h" #include "PWGJE/DataModel/EMCALMatchedCollisions.h" @@ -29,6 +26,7 @@ #include #include +#include #include #include #include @@ -75,7 +73,7 @@ enum TrackCuts { kpT, const std::vector chargedPionMinMaxName{"Min", "Max"}; const std::vector chargedPionCutsName{"pT", "eta", "TPC sigma"}; -const float chargedPionCutsTable[kTrackCuts][2]{{0.35f, 20.f}, {-.8f, .8f}, {-4.f, 4.f}}; +[[maybe_unused]] const std::array, kTrackCuts> chargedPionCutsTable{{{0.35f, 20.f}, {-.8f, .8f}, {-4.f, 4.f}}}; } // namespace hnm @@ -97,7 +95,7 @@ struct OmegaMesonEMC { Configurable confEvtRequireNoSameBunchPileUp{"confEvtRequireNoSameBunchPileUp", false, "Evt sel: check for no same bunch pile-up"}; // ---> Track selection - Configurable> cfgChargedPionCuts{"cfgChargedPionCuts", {hnm::chargedPionCutsTable[0], 3, 2, hnm::chargedPionCutsName, hnm::chargedPionMinMaxName}, "Charged pion track cuts"}; + Configurable> cfgChargedPionCuts{"cfgChargedPionCuts", {hnm::chargedPionCutsTable[0].data(), 3, 2, hnm::chargedPionCutsName, hnm::chargedPionMinMaxName}, "Charged pion track cuts"}; Configurable cfgTPCNClustersMin{"cfgTPCNClustersMin", 80, "Mininum of TPC Clusters"}; Configurable cfgTrkTPCfCls{"cfgTrkTPCfCls", 0.83, "Minimum fraction of crossed rows over findable clusters"}; Configurable cfgTrkTPCcRowsMin{"cfgTrkTPCcRowsMin", 70, "Minimum number of crossed TPC rows"}; @@ -120,8 +118,8 @@ struct OmegaMesonEMC { Configurable cfgHNMMassCorrection{"cfgHNMMassCorrection", 1, "Use GG PDG mass to correct HNM mass (0 = off, 1 = subDeltaPi0, 2 = subLambda)"}; // ---> Mass windows for the selection of heavy neutral mesons (also based on mass of their light neutral meson decay daughter) - static constexpr float DefaultMassWindows[2] = {0.11, 0.16}; - Configurable> cfgMassWindowPi0{"cfgMassWindowPi0", {DefaultMassWindows, 2, {"min", "max"}}, "Mass window for selected decay pi0"}; + static constexpr std::array DefaultMassWindows{0.11, 0.16}; + Configurable> cfgMassWindowPi0{"cfgMassWindowPi0", {DefaultMassWindows.data(), 2, {"min", "max"}}, "Mass window for selected decay pi0"}; Configurable cfgMaxMultiplicity{"cfgMaxMultiplicity", 5000, "Maximum number of tracks in a collision (can be used to increase the S/B -> Very experimental)"}; Configurable cfgMinGGPtOverHNMPt{"cfgMinGGPtOverHNMPt", 0., "Minimum ratio of the pT of the gamma gamma pair over the pT of the HNM (can be used to increase the S/B)"}; @@ -142,16 +140,21 @@ struct OmegaMesonEMC { template bool isSelectedTrack(T const& track) { - if (track.tpcNClsFound() < cfgTPCNClustersMin) + if (track.tpcNClsFound() < cfgTPCNClustersMin) { return false; - if (track.tpcCrossedRowsOverFindableCls() < cfgTrkTPCfCls) + } + if (track.tpcCrossedRowsOverFindableCls() < cfgTrkTPCfCls) { return false; - if (track.tpcNClsCrossedRows() < cfgTrkTPCcRowsMin) + } + if (track.tpcNClsCrossedRows() < cfgTrkTPCcRowsMin) { return false; - if (track.tpcFractionSharedCls() > cfgTrkTPCsClsSharedFrac) + } + if (track.tpcFractionSharedCls() > cfgTrkTPCsClsSharedFrac) { return false; - if (track.itsNCls() < cfgTrkITSnclsMin) + } + if (track.itsNCls() < cfgTrkITSnclsMin) { return false; + } return true; } @@ -168,8 +171,9 @@ struct OmegaMesonEMC { { mHistManager.add("Event/nEMCalEvents", "Number of collisions with a certain combination of EMCal triggers;;#bf{#it{N}_{collisions}}", HistType::kTH1F, {{5, -0.5, 4.5}}); std::vector nEventTitles = {"Cells & kTVXinEMC", "Cells & L0", "Cells & !kTVXinEMC & !L0", "!Cells & kTVXinEMC", "!Cells & L0"}; - for (size_t iBin = 0; iBin < nEventTitles.size(); iBin++) + for (size_t iBin = 0; iBin < nEventTitles.size(); iBin++) { mHistManager.get(HIST("Event/nEMCalEvents"))->GetXaxis()->SetBinLabel(iBin + 1, nEventTitles[iBin].data()); + } mHistManager.add("Event/fMultiplicity", "Multiplicity after event cuts;#bf{#it{N}_{tracks}};#bf{#it{N}_{collisions}}", HistType::kTH1F, {{500, 0, 500}}); mHistManager.add("Event/fZvtx", "Zvtx after event cuts;#bf{z_{vtx} (cm)};#bf{#it{N}_{collisions}}", HistType::kTH1F, {{300, -15, 15}}); @@ -177,8 +181,8 @@ struct OmegaMesonEMC { mHistManager.add("GG/invMassVsPt_selected", "Invariant mass and pT of gg candidates;#bf{#it{M}^{#gamma#gamma} (GeV/#it{c}^{2})};#bf{#it{p}_{T}^{#gamma#gamma} (GeV/#it{c})}", HistType::kTH2F, {{400, 0., 0.8}, {250, 0., 25.}}); const int nTrackSpecies = 2; // x2 because of anti particles - const char* particleSpecies[nTrackSpecies] = {"Pion", "AntiPion"}; - const char* particleSpeciesLatex[nTrackSpecies] = {"#pi^{+}", "#pi^{-}"}; + std::array particleSpecies = {"Pion", "AntiPion"}; + std::array particleSpeciesLatex = {"#pi^{+}", "#pi^{-}"}; for (int iParticle = 0; iParticle < nTrackSpecies; iParticle++) { mHistManager.add(Form("TrackCuts/%s/fPt", particleSpecies[iParticle]), Form("%s transverse momentum;#bf{#it{p}_{T}^{%s} (GeV/#it{c})};#bf{#it{N}^{%s}}", particleSpecies[iParticle], particleSpeciesLatex[iParticle], particleSpeciesLatex[iParticle]), HistType::kTH1F, {{500, 0, 10}}); @@ -230,27 +234,37 @@ struct OmegaMesonEMC { bool iskTVXinEMC = foundBC.alias_bit(kTVXinEMC); bool isL0Triggered = foundBC.alias_bit(kEMC7) || foundBC.alias_bit(kDMC7) || foundBC.alias_bit(kEG1) || foundBC.alias_bit(kEG2); - if (confEvtRequireSel8 && !collision.sel8()) + if (confEvtRequireSel8 && !collision.sel8()) { return; // Skip this collision if sel8 trigger bit is not set - if (confEvtRequirekTVXinEMC && !iskTVXinEMC) + } + if (confEvtRequirekTVXinEMC && !iskTVXinEMC) { return; // Skip this collision if kTVXinEMC trigger bit is not set - if (confEvtRequireL0 && !isL0Triggered) + } + if (confEvtRequireL0 && !isL0Triggered) { return; // Skip this collision if L0 trigger bit is not set - if (confEvtRequireGoodZVertex && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) + } + if (confEvtRequireGoodZVertex && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { return; // Skip this collision if good z-vertex condition is not met - if (confEvtRequireNoSameBunchPileUp && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) + } + if (confEvtRequireNoSameBunchPileUp && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { return; // Skip this collision if no same bunch pileup condition is not met + } - if (bcHasEMCCells && iskTVXinEMC) + if (bcHasEMCCells && iskTVXinEMC) { mHistManager.fill(HIST("Event/nEMCalEvents"), 0); - if (bcHasEMCCells && isL0Triggered) + } + if (bcHasEMCCells && isL0Triggered) { mHistManager.fill(HIST("Event/nEMCalEvents"), 1); - if (bcHasEMCCells && !iskTVXinEMC && !isL0Triggered) + } + if (bcHasEMCCells && !iskTVXinEMC && !isL0Triggered) { mHistManager.fill(HIST("Event/nEMCalEvents"), 2); - if (!bcHasEMCCells && iskTVXinEMC) + } + if (!bcHasEMCCells && iskTVXinEMC) { mHistManager.fill(HIST("Event/nEMCalEvents"), 3); - if (!bcHasEMCCells && isL0Triggered) + } + if (!bcHasEMCCells && isL0Triggered) { mHistManager.fill(HIST("Event/nEMCalEvents"), 4); + } mHistManager.fill(HIST("Event/fMultiplicity"), collision.multNTracksPV()); mHistManager.fill(HIST("Event/fZvtx"), collision.posZ()); @@ -285,8 +299,9 @@ struct OmegaMesonEMC { // - Fill QA histograms for all tracks and per particle species // ------------------------------------------------------------------------------------- for (const auto& track : tracks) { - if (!isSelectedTrack(track)) - continue; // Skip tracks that do not pass the selection criteria + if (!isSelectedTrack(track)) { + continue; // Skip tracks that do not pass the selection criteria + } if (track.sign() > 0) { // Positive charge -> Particles pion.emplace_back(track.pt(), track.eta(), track.phi(), constants::physics::MassPionCharged); @@ -355,4 +370,7 @@ struct OmegaMesonEMC { } }; -WorkflowSpec defineDataProcessing(o2::framework::ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc, TaskName{"omega-meson-emc"})}; } +WorkflowSpec defineDataProcessing(o2::framework::ConfigContext const& context) +{ + return WorkflowSpec{adaptAnalysisTask(context, TaskName{"omega-meson-emc"})}; +} diff --git a/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaEMCEMC.cxx b/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaEMCEMC.cxx index a57661b5805..b5a82a7ac55 100644 --- a/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaEMCEMC.cxx +++ b/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaEMCEMC.cxx @@ -29,9 +29,9 @@ using namespace o2::aod::pwgem::photonmeson::photonpair; using MyEMCClusters = soa::Join; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +WorkflowSpec defineDataProcessing(ConfigContext const& context) { return WorkflowSpec{ - adaptAnalysisTask>(cfgc, TaskName{"pi0eta-to-gammagamma-emcemc"}), + adaptAnalysisTask>(context, TaskName{"pi0eta-to-gammagamma-emcemc"}), }; } diff --git a/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaMCEMCEMC.cxx b/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaMCEMCEMC.cxx index da93889b9db..0857f27f1a5 100644 --- a/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaMCEMCEMC.cxx +++ b/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaMCEMCEMC.cxx @@ -29,9 +29,9 @@ using namespace o2::aod::pwgem::photonmeson::photonpair; using MyEMCClusters = soa::Join; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +WorkflowSpec defineDataProcessing(ConfigContext const& context) { return WorkflowSpec{ - adaptAnalysisTask>(cfgc, TaskName{"pi0eta-to-gammagamma-mc-emcemc"}), + adaptAnalysisTask>(context, TaskName{"pi0eta-to-gammagamma-mc-emcemc"}), }; } diff --git a/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaMCPCMDalitzEE.cxx b/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaMCPCMDalitzEE.cxx index 573b8d0224e..67e7e83ad21 100644 --- a/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaMCPCMDalitzEE.cxx +++ b/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaMCPCMDalitzEE.cxx @@ -17,7 +17,7 @@ #include "PWGEM/PhotonMeson/DataModel/gammaTables.h" #include "PWGEM/PhotonMeson/Utils/PairUtilities.h" -#include +#include #include #include @@ -30,9 +30,9 @@ using MyV0Photons = soa::Filtered; using MyMCElectrons = soa::Filtered>; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +WorkflowSpec defineDataProcessing(ConfigContext const& context) { return WorkflowSpec{ - adaptAnalysisTask>(cfgc, TaskName{"pi0eta-to-gammagamma-mc-pcmdalitzee"}), + adaptAnalysisTask>(context, TaskName{"pi0eta-to-gammagamma-mc-pcmdalitzee"}), }; } diff --git a/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaMCPCMPCM.cxx b/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaMCPCMPCM.cxx index 9ec33da1389..5b6ec38bfe8 100644 --- a/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaMCPCMPCM.cxx +++ b/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaMCPCMPCM.cxx @@ -18,7 +18,7 @@ #include "PWGEM/PhotonMeson/DataModel/gammaTables.h" #include "PWGEM/PhotonMeson/Utils/PairUtilities.h" -#include +#include #include #include @@ -30,9 +30,9 @@ using namespace o2::aod::pwgem::photonmeson::photonpair; using MyV0Photons = o2::soa::Filtered>; using MyMCV0Legs = soa::Join; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +WorkflowSpec defineDataProcessing(ConfigContext const& context) { return WorkflowSpec{ - adaptAnalysisTask>(cfgc, TaskName{"pi0eta-to-gammagamma-mc-pcmpcm"}), + adaptAnalysisTask>(context, TaskName{"pi0eta-to-gammagamma-mc-pcmpcm"}), }; } diff --git a/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaMCPCMPCMML.cxx b/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaMCPCMPCMML.cxx index 1f2f76d6499..45c9fd499af 100644 --- a/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaMCPCMPCMML.cxx +++ b/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaMCPCMPCMML.cxx @@ -17,7 +17,7 @@ #include "PWGEM/PhotonMeson/DataModel/gammaTables.h" #include "PWGEM/PhotonMeson/Utils/PairUtilities.h" -#include +#include #include #include @@ -29,9 +29,9 @@ using namespace o2::aod::pwgem::photonmeson::photonpair; using MyV0Photons = o2::soa::Filtered>; using MyMCV0Legs = soa::Join; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +WorkflowSpec defineDataProcessing(ConfigContext const& context) { return WorkflowSpec{ - adaptAnalysisTask>(cfgc, TaskName{"pi0eta-to-gammagamma-mc-pcmpcm"}), + adaptAnalysisTask>(context, TaskName{"pi0eta-to-gammagamma-mc-pcmpcm"}), }; } diff --git a/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaPCMDalitzEE.cxx b/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaPCMDalitzEE.cxx index 810be128a00..dcaed33ccec 100644 --- a/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaPCMDalitzEE.cxx +++ b/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaPCMDalitzEE.cxx @@ -17,7 +17,7 @@ #include "PWGEM/PhotonMeson/DataModel/gammaTables.h" #include "PWGEM/PhotonMeson/Utils/PairUtilities.h" -#include +#include #include #include @@ -30,9 +30,9 @@ using namespace o2::aod::pwgem::photonmeson::photonpair; using MyV0Photons = Filtered>; using MyPrimaryElectrons = Filtered>; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +WorkflowSpec defineDataProcessing(ConfigContext const& context) { return WorkflowSpec{ - adaptAnalysisTask>(cfgc, TaskName{"pi0eta-to-gammagamma-pcmdalitzee"}), + adaptAnalysisTask>(context, TaskName{"pi0eta-to-gammagamma-pcmdalitzee"}), }; } diff --git a/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaPCMEMC.cxx b/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaPCMEMC.cxx index 678d0f21f47..8b135111b22 100644 --- a/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaPCMEMC.cxx +++ b/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaPCMEMC.cxx @@ -30,9 +30,9 @@ using namespace o2::aod::pwgem::photonmeson::photonpair; using MyV0Photons = Filtered>; using MyEMCClusters = soa::Join; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +WorkflowSpec defineDataProcessing(ConfigContext const& context) { return WorkflowSpec{ - adaptAnalysisTask>(cfgc, TaskName{"pi0eta-to-gammagamma-pcmemc"}), + adaptAnalysisTask>(context, TaskName{"pi0eta-to-gammagamma-pcmemc"}), }; } diff --git a/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaPCMPCM.cxx b/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaPCMPCM.cxx index a19c2ac5be0..03fa790e8fb 100644 --- a/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaPCMPCM.cxx +++ b/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaPCMPCM.cxx @@ -29,9 +29,9 @@ using namespace o2::aod::pwgem::photonmeson::photonpair; using MyV0Photons = o2::soa::Filtered>; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +WorkflowSpec defineDataProcessing(ConfigContext const& context) { return WorkflowSpec{ - adaptAnalysisTask>(cfgc, TaskName{"pi0eta-to-gammagamma-pcmpcm"}), + adaptAnalysisTask>(context, TaskName{"pi0eta-to-gammagamma-pcmpcm"}), }; } diff --git a/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaPCMPCMML.cxx b/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaPCMPCMML.cxx index 2d0fa9f2120..4901f219908 100644 --- a/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaPCMPCMML.cxx +++ b/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaPCMPCMML.cxx @@ -28,9 +28,9 @@ using namespace o2::aod::pwgem::photonmeson::photonpair; using MyV0Photons = o2::soa::Filtered>; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +WorkflowSpec defineDataProcessing(ConfigContext const& context) { return WorkflowSpec{ - adaptAnalysisTask>(cfgc, TaskName{"pi0eta-to-gammagamma-pcmpcm"}), + adaptAnalysisTask>(context, TaskName{"pi0eta-to-gammagamma-pcmpcm"}), }; } diff --git a/PWGEM/PhotonMeson/Tasks/SinglePhoton.cxx b/PWGEM/PhotonMeson/Tasks/SinglePhoton.cxx index 04b7dbb7a26..26815f26ad5 100644 --- a/PWGEM/PhotonMeson/Tasks/SinglePhoton.cxx +++ b/PWGEM/PhotonMeson/Tasks/SinglePhoton.cxx @@ -28,6 +28,7 @@ #include "Common/Core/RecoDecay.h" #include "Common/DataModel/Centrality.h" +#include #include #include #include @@ -92,7 +93,7 @@ struct SinglePhoton { Configurable fConfigEMEventCut{"cfgEMEventCut", "minbias", "em event cut"}; // only 1 event cut per wagon EMPhotonEventCut fEMEventCut; - static constexpr std::string_view event_types[2] = {"before", "after"}; + static constexpr std::array event_types = {"before", "after"}; OutputObj fOutputEvent{"Event"}; OutputObj fOutputPhoton{"Photon"}; // single photon @@ -116,19 +117,19 @@ struct SinglePhoton { TString ev_cut_name = fConfigEMEventCut.value; fEMEventCut = *eventcuts::GetCut(ev_cut_name.Data()); - fOutputEvent.setObject(reinterpret_cast(fMainList->FindObject("Event"))); - fOutputPhoton.setObject(reinterpret_cast(fMainList->FindObject("Photon"))); + fOutputEvent.setObject(dynamic_cast(fMainList->FindObject("Event"))); + fOutputPhoton.setObject(dynamic_cast(fMainList->FindObject("Photon"))); } template - void add_histograms(THashList* list_photon, const std::string detname, TCuts1 const& cuts1) + void add_histograms(THashList* list_photon, std::string const& detname, TCuts1 const& cuts1) { for (auto& cut1 : cuts1) { - std::string cutname1 = cut1.getName(); + std::string const& cutname1 = cut1.getName(); - THashList* list_photon_subsys = reinterpret_cast(list_photon->FindObject(detname.data())); + auto* list_photon_subsys = dynamic_cast(list_photon->FindObject(detname.data())); o2::aod::pwgem::photon::histogram::AddHistClass(list_photon_subsys, cutname1.data()); - THashList* list_photon_subsys_cut = reinterpret_cast(list_photon_subsys->FindObject(cutname1.data())); + auto* list_photon_subsys_cut = dynamic_cast(list_photon_subsys->FindObject(cutname1.data())); if (cfgDoFlow) { o2::aod::pwgem::photon::histogram::DefineHistograms(list_photon_subsys_cut, "singlephoton", "qvector"); } else { @@ -138,7 +139,7 @@ struct SinglePhoton { } // end of cut1 loop } - static constexpr std::string_view detnames[3] = {"PCM", "PHOS", "EMC"}; + static constexpr std::array detnames = {"PCM", "PHOS", "EMC"}; void addhistograms() { fMainList->SetOwner(true); @@ -146,18 +147,18 @@ struct SinglePhoton { // create sub lists first. o2::aod::pwgem::photon::histogram::AddHistClass(fMainList, "Event"); - THashList* list_ev = reinterpret_cast(fMainList->FindObject("Event")); + auto* list_ev = dynamic_cast(fMainList->FindObject("Event")); o2::aod::pwgem::photon::histogram::AddHistClass(fMainList, "Photon"); - THashList* list_photon = reinterpret_cast(fMainList->FindObject("Photon")); + auto* list_photon = dynamic_cast(fMainList->FindObject("Photon")); - for (auto& detname : fDetNames) { + for (const auto& detname : fDetNames) { LOGF(info, "Enabled detector = %s", detname.data()); o2::aod::pwgem::photon::histogram::AddHistClass(list_ev, detname.data()); - THashList* list_ev_det = reinterpret_cast(list_ev->FindObject(detname.data())); + auto* list_ev_det = dynamic_cast(list_ev->FindObject(detname.data())); for (const auto& evtype : event_types) { - THashList* list_ev_det_type = reinterpret_cast(o2::aod::pwgem::photon::histogram::AddHistClass(list_ev_det, evtype.data())); + THashList* list_ev_det_type = o2::aod::pwgem::photon::histogram::AddHistClass(list_ev_det, evtype.data()); if (cfgDoFlow) { o2::aod::pwgem::photon::histogram::DefineHistograms(list_ev_det_type, "Event", "qvector"); } else { @@ -226,7 +227,7 @@ struct SinglePhoton { const char* cutname = cutString.c_str(); LOGF(info, "add EMC cut : %s", cutname); if (std::strcmp(cutname, "custom") == 0) { - EMCPhotonCut* custom_cut = new EMCPhotonCut(cutname, cutname); + auto* custom_cut = new EMCPhotonCut(cutname, cutname); custom_cut->SetMinE(EMC_minE); custom_cut->SetMinNCell(EMC_minNCell); custom_cut->SetM02Range(EMC_minM02, EMC_maxM02); @@ -268,9 +269,9 @@ struct SinglePhoton { template void FillPhoton(TEvents const& collisions, TPhotons1 const& photons1, TPreslice1 const& perCollision1, TCuts1 const& cuts1, TV0Legs const&) { - THashList* list_ev_before = static_cast(fMainList->FindObject("Event")->FindObject(detnames[photontype].data())->FindObject(event_types[0].data())); - THashList* list_ev_after = static_cast(fMainList->FindObject("Event")->FindObject(detnames[photontype].data())->FindObject(event_types[1].data())); - THashList* list_photon_det = static_cast(fMainList->FindObject("Photon")->FindObject(detnames[photontype].data())); + auto* list_ev_before = dynamic_cast(fMainList->FindObject("Event")->FindObject(detnames[photontype].data())->FindObject(event_types[0].data())); + auto* list_ev_after = dynamic_cast(fMainList->FindObject("Event")->FindObject(detnames[photontype].data())->FindObject(event_types[1].data())); + auto* list_photon_det = dynamic_cast(fMainList->FindObject("Photon")->FindObject(detnames[photontype].data())); for (auto& collision : collisions) { if (photontype == EMDetType::kPHOS && !collision.alias_bit(triggerAliases::kTVXinPHOS)) { @@ -280,7 +281,7 @@ struct SinglePhoton { 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; } @@ -300,8 +301,8 @@ struct SinglePhoton { } else { o2::aod::pwgem::photon::histogram::FillHistClass(list_ev_after, "", collision); } - reinterpret_cast(list_ev_before->FindObject("hCollisionCounter"))->Fill("accepted", 1.f); - reinterpret_cast(list_ev_after->FindObject("hCollisionCounter"))->Fill("accepted", 1.f); + dynamic_cast(list_ev_before->FindObject("hCollisionCounter"))->Fill("accepted", 1.f); + dynamic_cast(list_ev_after->FindObject("hCollisionCounter"))->Fill("accepted", 1.f); std::array q2ft0m = {collision.q2xft0m(), collision.q2yft0m()}; std::array q2ft0a = {collision.q2xft0a(), collision.q2yft0a()}; std::array q2ft0c = {collision.q2xft0c(), collision.q2yft0c()}; @@ -309,7 +310,7 @@ struct SinglePhoton { auto photons1_coll = photons1.sliceBy(perCollision1, collision.globalIndex()); for (auto& cut : cuts1) { - THashList* list_photon_det_cut = static_cast(list_photon_det->FindObject(cut.getName().c_str())); + auto* list_photon_det_cut = dynamic_cast(list_photon_det->FindObject(cut.getName().c_str())); for (auto& photon : photons1_coll) { if (!IsSelected(photon, cut)) { continue; @@ -319,16 +320,16 @@ struct SinglePhoton { } if (cfgDoFlow) { std::array u2_photon = {std::cos(2 * photon.phi()), std::sin(2 * photon.phi())}; - reinterpret_cast(list_photon_det_cut->FindObject("hPt_SPQ2FT0M"))->Fill(photon.pt(), RecoDecay::dotProd(u2_photon, q2ft0m)); - reinterpret_cast(list_photon_det_cut->FindObject("hPt_SPQ2FT0A"))->Fill(photon.pt(), RecoDecay::dotProd(u2_photon, q2ft0a)); - reinterpret_cast(list_photon_det_cut->FindObject("hPt_SPQ2FT0C"))->Fill(photon.pt(), RecoDecay::dotProd(u2_photon, q2ft0c)); - // reinterpret_cast(list_photon_det_cut->FindObject("hPt_SPQ2FV0A"))->Fill(photon.pt(), RecoDecay::dotProd(u2_photon, q2fv0a)); + dynamic_cast(list_photon_det_cut->FindObject("hPt_SPQ2FT0M"))->Fill(photon.pt(), RecoDecay::dotProd(u2_photon, q2ft0m)); + dynamic_cast(list_photon_det_cut->FindObject("hPt_SPQ2FT0A"))->Fill(photon.pt(), RecoDecay::dotProd(u2_photon, q2ft0a)); + dynamic_cast(list_photon_det_cut->FindObject("hPt_SPQ2FT0C"))->Fill(photon.pt(), RecoDecay::dotProd(u2_photon, q2ft0c)); + // dynamic_cast(list_photon_det_cut->FindObject("hPt_SPQ2FV0A"))->Fill(photon.pt(), RecoDecay::dotProd(u2_photon, q2fv0a)); } else { - reinterpret_cast(list_photon_det_cut->FindObject("hPt"))->Fill(photon.pt()); + dynamic_cast(list_photon_det_cut->FindObject("hPt"))->Fill(photon.pt()); } - reinterpret_cast(list_photon_det_cut->FindObject("hY"))->Fill(photon.eta()); - reinterpret_cast(list_photon_det_cut->FindObject("hPhi"))->Fill(photon.phi()); + dynamic_cast(list_photon_det_cut->FindObject("hY"))->Fill(photon.eta()); + dynamic_cast(list_photon_det_cut->FindObject("hPhi"))->Fill(photon.phi()); } // end of photon loop } // end of cut loop } // end of collision loop @@ -359,8 +360,8 @@ struct SinglePhoton { PROCESS_SWITCH(SinglePhoton, processDummy, "Dummy function", true); }; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +WorkflowSpec defineDataProcessing(ConfigContext const& context) { return WorkflowSpec{ - adaptAnalysisTask(cfgc, TaskName{"single-photon"})}; + adaptAnalysisTask(context, TaskName{"single-photon"})}; } diff --git a/PWGEM/PhotonMeson/Tasks/SinglePhotonMC.cxx b/PWGEM/PhotonMeson/Tasks/SinglePhotonMC.cxx index b3ed44f54c2..40918d54757 100644 --- a/PWGEM/PhotonMeson/Tasks/SinglePhotonMC.cxx +++ b/PWGEM/PhotonMeson/Tasks/SinglePhotonMC.cxx @@ -28,6 +28,7 @@ #include "Common/CCDB/TriggerAliases.h" #include "Common/DataModel/Centrality.h" +#include #include #include #include @@ -38,7 +39,6 @@ #include #include -#include #include #include #include @@ -80,7 +80,7 @@ struct SinglePhotonMC { Configurable fConfigEMEventCut{"cfgEMEventCut", "minbias", "em event cut"}; // only 1 event cut per wagon EMPhotonEventCut fEMEventCut; - static constexpr std::string_view event_types[2] = {"before", "after"}; + static constexpr std::array event_types = {"before", "after"}; OutputObj fOutputEvent{"Event"}; OutputObj fOutputPhoton{"Photon"}; // single photon @@ -88,8 +88,8 @@ struct SinglePhotonMC { THashList* fMainList = new THashList(); std::vector fPCMCuts; - std::vector fPHOSCuts; - std::vector fEMCCuts; + // std::vector fPHOSCuts; + // std::vector fEMCCuts; std::vector fDetNames; void init(InitContext& context) @@ -103,25 +103,25 @@ struct SinglePhotonMC { TString ev_cut_name = fConfigEMEventCut.value; fEMEventCut = *eventcuts::GetCut(ev_cut_name.Data()); - fOutputEvent.setObject(reinterpret_cast(fMainList->FindObject("Event"))); - fOutputPhoton.setObject(reinterpret_cast(fMainList->FindObject("Photon"))); - fOutputGen.setObject(reinterpret_cast(fMainList->FindObject("Generated"))); + fOutputEvent.setObject(dynamic_cast(fMainList->FindObject("Event"))); + fOutputPhoton.setObject(dynamic_cast(fMainList->FindObject("Photon"))); + fOutputGen.setObject(dynamic_cast(fMainList->FindObject("Generated"))); } template - void add_photon_histograms(THashList* list_photon, const std::string detname, TCuts1 const& cuts1) + void add_photon_histograms(THashList* list_photon, std::string const& detname, TCuts1 const& cuts1) { for (auto& cut1 : cuts1) { std::string cutname1 = cut1.GetName(); - THashList* list_photon_subsys = reinterpret_cast(list_photon->FindObject(detname.data())); + auto* list_photon_subsys = dynamic_cast(list_photon->FindObject(detname.data())); o2::aod::pwgem::photon::histogram::AddHistClass(list_photon_subsys, cutname1.data()); - THashList* list_photon_subsys_cut = reinterpret_cast(list_photon_subsys->FindObject(cutname1.data())); + auto* list_photon_subsys_cut = dynamic_cast(list_photon_subsys->FindObject(cutname1.data())); o2::aod::pwgem::photon::histogram::DefineHistograms(list_photon_subsys_cut, "singlephoton", "mc"); } // end of cut1 loop } - static constexpr std::string_view detnames[3] = {"PCM", "PHOS", "EMC"}; + static constexpr std::array detnames = {"PCM", "PHOS", "EMC"}; void addhistograms() { fMainList->SetOwner(true); @@ -129,22 +129,22 @@ struct SinglePhotonMC { // create sub lists first. o2::aod::pwgem::photon::histogram::AddHistClass(fMainList, "Event"); - THashList* list_ev = reinterpret_cast(fMainList->FindObject("Event")); + auto* list_ev = dynamic_cast(fMainList->FindObject("Event")); o2::aod::pwgem::photon::histogram::AddHistClass(fMainList, "Photon"); - THashList* list_photon = reinterpret_cast(fMainList->FindObject("Photon")); + auto* list_photon = dynamic_cast(fMainList->FindObject("Photon")); o2::aod::pwgem::photon::histogram::AddHistClass(fMainList, "Generated"); - THashList* list_gen = reinterpret_cast(fMainList->FindObject("Generated")); + auto* list_gen = dynamic_cast(fMainList->FindObject("Generated")); o2::aod::pwgem::photon::histogram::DefineHistograms(list_gen, "Generated", "Photon"); - for (auto& detname : fDetNames) { + for (const auto& detname : fDetNames) { LOGF(info, "Enabled detector = %s", detname.data()); o2::aod::pwgem::photon::histogram::AddHistClass(list_ev, detname.data()); - THashList* list_ev_det = reinterpret_cast(list_ev->FindObject(detname.data())); + auto* list_ev_det = dynamic_cast(list_ev->FindObject(detname.data())); for (const auto& evtype : event_types) { - THashList* list_ev_det_type = reinterpret_cast(o2::aod::pwgem::photon::histogram::AddHistClass(list_ev_det, evtype.data())); + THashList* list_ev_det_type = o2::aod::pwgem::photon::histogram::AddHistClass(list_ev_det, evtype.data()); o2::aod::pwgem::photon::histogram::DefineHistograms(list_ev_det_type, "Event", evtype.data()); } @@ -194,9 +194,9 @@ struct SinglePhotonMC { template void FillTruePhoton(TEvents const& collisions, TPhotons1 const& photons1, TPreslice1 const& perCollision1, TCuts1 const& cuts1, TV0Legs const&, TMCParticles const& mcparticles, TMCEvents const&) { - THashList* list_ev_before = static_cast(fMainList->FindObject("Event")->FindObject(detnames[photontype].data())->FindObject(event_types[0].data())); - THashList* list_ev_after = static_cast(fMainList->FindObject("Event")->FindObject(detnames[photontype].data())->FindObject(event_types[1].data())); - THashList* list_photon_det = static_cast(fMainList->FindObject("Photon")->FindObject(detnames[photontype].data())); + auto* list_ev_before = dynamic_cast(fMainList->FindObject("Event")->FindObject(detnames[photontype].data())->FindObject(event_types[0].data())); + auto* list_ev_after = dynamic_cast(fMainList->FindObject("Event")->FindObject(detnames[photontype].data())->FindObject(event_types[1].data())); + auto* list_photon_det = dynamic_cast(fMainList->FindObject("Photon")->FindObject(detnames[photontype].data())); for (auto& collision : collisions) { if (photontype == EMDetType::kPHOS && !collision.alias_bit(triggerAliases::kTVXinPHOS)) { @@ -206,7 +206,7 @@ struct SinglePhotonMC { 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; } @@ -216,12 +216,12 @@ struct SinglePhotonMC { continue; } o2::aod::pwgem::photon::histogram::FillHistClass(list_ev_after, "", collision); - reinterpret_cast(list_ev_before->FindObject("hCollisionCounter"))->Fill("accepted", 1.f); - reinterpret_cast(list_ev_after->FindObject("hCollisionCounter"))->Fill("accepted", 1.f); + dynamic_cast(list_ev_before->FindObject("hCollisionCounter"))->Fill("accepted", 1.f); + dynamic_cast(list_ev_after->FindObject("hCollisionCounter"))->Fill("accepted", 1.f); auto photons1_coll = photons1.sliceBy(perCollision1, collision.globalIndex()); for (auto& cut : cuts1) { - THashList* list_photon_det_cut = static_cast(list_photon_det->FindObject(cut.getName().c_str())); + auto* list_photon_det_cut = dynamic_cast(list_photon_det->FindObject(cut.getName().c_str())); for (auto& photon : photons1_coll) { if (!IsSelected(photon, cut)) { continue; @@ -229,9 +229,9 @@ struct SinglePhotonMC { if (abs(photon.eta()) > maxY) { continue; } - reinterpret_cast(list_photon_det_cut->FindObject("hPt"))->Fill(photon.pt()); - reinterpret_cast(list_photon_det_cut->FindObject("hY"))->Fill(photon.eta()); - reinterpret_cast(list_photon_det_cut->FindObject("hPhi"))->Fill(photon.phi()); + dynamic_cast(list_photon_det_cut->FindObject("hPt"))->Fill(photon.pt()); + dynamic_cast(list_photon_det_cut->FindObject("hY"))->Fill(photon.eta()); + dynamic_cast(list_photon_det_cut->FindObject("hPhi"))->Fill(photon.phi()); int photonid = -1; if constexpr (photontype == EMDetType::kPCM) { @@ -256,17 +256,17 @@ struct SinglePhotonMC { continue; } } - reinterpret_cast(list_photon_det_cut->FindObject("hPt_Photon_Primary"))->Fill(photon.pt()); - reinterpret_cast(list_photon_det_cut->FindObject("hY_Photon_Primary"))->Fill(photon.eta()); - reinterpret_cast(list_photon_det_cut->FindObject("hPhi_Photon_Primary"))->Fill(photon.phi()); + dynamic_cast(list_photon_det_cut->FindObject("hPt_Photon_Primary"))->Fill(photon.pt()); + dynamic_cast(list_photon_det_cut->FindObject("hY_Photon_Primary"))->Fill(photon.eta()); + dynamic_cast(list_photon_det_cut->FindObject("hPhi_Photon_Primary"))->Fill(photon.phi()); } else if (IsFromWD(mcphoton.emmcevent(), mcphoton, mcparticles) > 0) { - reinterpret_cast(list_photon_det_cut->FindObject("hPt_Photon_FromWD"))->Fill(photon.pt()); - reinterpret_cast(list_photon_det_cut->FindObject("hY_Photon_FromWD"))->Fill(photon.eta()); - reinterpret_cast(list_photon_det_cut->FindObject("hPhi_Photon_FromWD"))->Fill(photon.phi()); + dynamic_cast(list_photon_det_cut->FindObject("hPt_Photon_FromWD"))->Fill(photon.pt()); + dynamic_cast(list_photon_det_cut->FindObject("hY_Photon_FromWD"))->Fill(photon.eta()); + dynamic_cast(list_photon_det_cut->FindObject("hPhi_Photon_FromWD"))->Fill(photon.phi()); } else { - reinterpret_cast(list_photon_det_cut->FindObject("hPt_Photon_hs"))->Fill(photon.pt()); - reinterpret_cast(list_photon_det_cut->FindObject("hY_Photon_hs"))->Fill(photon.eta()); - reinterpret_cast(list_photon_det_cut->FindObject("hPhi_Photon_hs"))->Fill(photon.phi()); + dynamic_cast(list_photon_det_cut->FindObject("hPt_Photon_hs"))->Fill(photon.pt()); + dynamic_cast(list_photon_det_cut->FindObject("hY_Photon_hs"))->Fill(photon.eta()); + dynamic_cast(list_photon_det_cut->FindObject("hPhi_Photon_hs"))->Fill(photon.phi()); } } // end of photon loop @@ -297,29 +297,29 @@ struct SinglePhotonMC { // loop over mc stack and fill histograms for pure MC truth signals // all MC tracks which belong to the MC event corresponding to the current reconstructed event for (auto& collision : grouped_collisions) { - 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; } auto mccollision = collision.emmcevent(); - reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hCollisionCounter"))->Fill(1.0); - reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hZvtx_before"))->Fill(mccollision.posZ()); + dynamic_cast(fMainList->FindObject("Generated")->FindObject("hCollisionCounter"))->Fill(1.0); + dynamic_cast(fMainList->FindObject("Generated")->FindObject("hZvtx_before"))->Fill(mccollision.posZ()); if (!collision.sel8()) { continue; } - reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hCollisionCounter"))->Fill(2.0); + dynamic_cast(fMainList->FindObject("Generated")->FindObject("hCollisionCounter"))->Fill(2.0); if (collision.numContrib() < 0.5) { continue; } - reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hCollisionCounter"))->Fill(3.0); + dynamic_cast(fMainList->FindObject("Generated")->FindObject("hCollisionCounter"))->Fill(3.0); if (abs(collision.posZ()) > 10.0) { continue; } - reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hCollisionCounter"))->Fill(4.0); - reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hZvtx_after"))->Fill(mccollision.posZ()); + dynamic_cast(fMainList->FindObject("Generated")->FindObject("hCollisionCounter"))->Fill(4.0); + dynamic_cast(fMainList->FindObject("Generated")->FindObject("hZvtx_after"))->Fill(mccollision.posZ()); auto mctracks_coll = mcparticles.sliceBy(perMcCollision, collision.emmceventId()); for (auto& mctrack : mctracks_coll) { @@ -328,9 +328,9 @@ struct SinglePhotonMC { } if (abs(mctrack.pdgCode()) == 22 && (mctrack.isPhysicalPrimary() || mctrack.producedByGenerator())) { - reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hPt_Photon"))->Fill(mctrack.pt()); - reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hY_Photon"))->Fill(mctrack.y()); - reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hPhi_Photon"))->Fill(mctrack.phi()); + dynamic_cast(fMainList->FindObject("Generated")->FindObject("hPt_Photon"))->Fill(mctrack.pt()); + dynamic_cast(fMainList->FindObject("Generated")->FindObject("hY_Photon"))->Fill(mctrack.y()); + dynamic_cast(fMainList->FindObject("Generated")->FindObject("hPhi_Photon"))->Fill(mctrack.phi()); } } } @@ -344,8 +344,8 @@ struct SinglePhotonMC { PROCESS_SWITCH(SinglePhotonMC, processDummy, "Dummy function", true); }; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +WorkflowSpec defineDataProcessing(ConfigContext const& context) { return WorkflowSpec{ - adaptAnalysisTask(cfgc, TaskName{"single-photon-mc"})}; + adaptAnalysisTask(context, TaskName{"single-photon-mc"})}; } diff --git a/PWGEM/PhotonMeson/Tasks/TagAndProbe.cxx b/PWGEM/PhotonMeson/Tasks/TagAndProbe.cxx index b99d863cf06..8de6e48e99e 100644 --- a/PWGEM/PhotonMeson/Tasks/TagAndProbe.cxx +++ b/PWGEM/PhotonMeson/Tasks/TagAndProbe.cxx @@ -31,6 +31,7 @@ #include "Common/DataModel/EventSelection.h" #include +#include #include #include #include @@ -48,17 +49,15 @@ #include #include +#include #include #include #include -#include #include #include #include #include -#include - using namespace o2; using namespace o2::aod; using namespace o2::framework; @@ -89,7 +88,7 @@ struct TagAndProbe { Configurable fConfigEMEventCut{"cfgEMEventCut", "minbias", "em event cut"}; // only 1 event cut per wagon EMPhotonEventCut fEMEventCut; - static constexpr std::string_view event_types[2] = {"before", "after"}; + static constexpr std::array event_types = {"before", "after"}; OutputObj fOutputEvent{"Event"}; OutputObj fOutputPair{"Pair"}; // 2-photon pair @@ -126,48 +125,49 @@ struct TagAndProbe { TString ev_cut_name = fConfigEMEventCut.value; fEMEventCut = *eventcuts::GetCut(ev_cut_name.Data()); - fOutputEvent.setObject(reinterpret_cast(fMainList->FindObject("Event"))); - fOutputPair.setObject(reinterpret_cast(fMainList->FindObject("Pair"))); + fOutputEvent.setObject(dynamic_cast(fMainList->FindObject("Event"))); + fOutputPair.setObject(dynamic_cast(fMainList->FindObject("Pair"))); } template - void add_pair_histograms(THashList* list_pair, const std::string pairname, TTagCut const& tagcut, TProbeCuts const& probecuts, TPairCuts const& paircuts) + void add_pair_histograms(THashList* list_pair, const std::string& pairname, TTagCut const& tagcut, TProbeCuts const& probecuts, TPairCuts const& paircuts) { - std::string cutname1 = tagcut.getName(); + const std::string& cutname1 = tagcut.getName(); for (auto& cut2 : probecuts) { - std::string cutname2 = cut2.getName(); - std::string photon_cut_name = cutname1 + "_" + cutname2; + const std::string& cutname2 = cut2.getName(); + std::string photon_cut_name = cutname1; + photon_cut_name.append("_").append(cutname2); THashList* list_pair_subsys_photoncut = o2::aod::pwgem::photon::histogram::AddHistClass(list_pair, photon_cut_name.data()); for (auto& cut3 : paircuts) { std::string pair_cut_name = cut3.getName(); o2::aod::pwgem::photon::histogram::AddHistClass(list_pair_subsys_photoncut, pair_cut_name.data()); - THashList* list_pair_subsys_paircut = reinterpret_cast(list_pair_subsys_photoncut->FindObject(pair_cut_name.data())); + auto* list_pair_subsys_paircut = dynamic_cast(list_pair_subsys_photoncut->FindObject(pair_cut_name.data())); o2::aod::pwgem::photon::histogram::DefineHistograms(list_pair_subsys_paircut, "tag_and_probe", pairname.data()); } // end of cut3 loop pair cut } // end of cut2 loop } - static constexpr std::string_view pairnames[6] = {"PCMPCM", "PHOSPHOS", "EMCEMC", "PCMPHOS", "PCMEMC", "PHOSEMC"}; + static constexpr std::array pairnames = {"PCMPCM", "PHOSPHOS", "EMCEMC", "PCMPHOS", "PCMEMC", "PHOSEMC"}; void addhistograms() { fMainList->SetOwner(true); fMainList->SetName("fMainList"); o2::aod::pwgem::photon::histogram::AddHistClass(fMainList, "Event"); - THashList* list_ev = reinterpret_cast(fMainList->FindObject("Event")); + auto* list_ev = dynamic_cast(fMainList->FindObject("Event")); o2::aod::pwgem::photon::histogram::AddHistClass(fMainList, "Pair"); - THashList* list_pair = reinterpret_cast(fMainList->FindObject("Pair")); + auto* list_pair = dynamic_cast(fMainList->FindObject("Pair")); // create sub lists first. - for (auto& pairname : fPairNames) { + for (const auto& pairname : fPairNames) { LOGF(info, "Enabled pairs = %s", pairname.data()); - THashList* list_ev_pair = reinterpret_cast(o2::aod::pwgem::photon::histogram::AddHistClass(list_ev, pairname.data())); + THashList* list_ev_pair = o2::aod::pwgem::photon::histogram::AddHistClass(list_ev, pairname.data()); for (const auto& evtype : event_types) { - THashList* list_ev_type = reinterpret_cast(o2::aod::pwgem::photon::histogram::AddHistClass(list_ev_pair, evtype.data())); + THashList* list_ev_type = o2::aod::pwgem::photon::histogram::AddHistClass(list_ev_pair, evtype.data()); o2::aod::pwgem::photon::histogram::DefineHistograms(list_ev_type, "Event", evtype.data()); } @@ -254,12 +254,12 @@ struct TagAndProbe { template void SameEventPairing(TEvents const& collisions, TPhotons1 const& photons1, TPhotons2 const& photons2, TPreslice1 const& perCollision1, TPreslice2 const& perCollision2, TTagCut const& tagcut, TProbeCuts const& probecuts, TPairCuts const& paircuts, TLegs const& /*legs*/) { - THashList* list_ev_pair_before = static_cast(fMainList->FindObject("Event")->FindObject(pairnames[pairtype].data())->FindObject(event_types[0].data())); - THashList* list_ev_pair_after = static_cast(fMainList->FindObject("Event")->FindObject(pairnames[pairtype].data())->FindObject(event_types[1].data())); - THashList* list_pair_ss = static_cast(fMainList->FindObject("Pair")->FindObject(pairnames[pairtype].data())); + auto* list_ev_pair_before = dynamic_cast(fMainList->FindObject("Event")->FindObject(pairnames[pairtype].data())->FindObject(event_types[0].data())); + auto* list_ev_pair_after = dynamic_cast(fMainList->FindObject("Event")->FindObject(pairnames[pairtype].data())->FindObject(event_types[1].data())); + auto* list_pair_ss = dynamic_cast(fMainList->FindObject("Pair")->FindObject(pairnames[pairtype].data())); for (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; } @@ -276,8 +276,8 @@ struct TagAndProbe { continue; } o2::aod::pwgem::photon::histogram::FillHistClass(list_ev_pair_after, "", collision); - reinterpret_cast(list_ev_pair_before->FindObject("hCollisionCounter"))->Fill("accepted", 1.f); - reinterpret_cast(list_ev_pair_after->FindObject("hCollisionCounter"))->Fill("accepted", 1.f); + dynamic_cast(list_ev_pair_before->FindObject("hCollisionCounter"))->Fill("accepted", 1.f); + dynamic_cast(list_ev_pair_after->FindObject("hCollisionCounter"))->Fill("accepted", 1.f); auto photons1_coll = photons1.sliceBy(perCollision1, collision.globalIndex()); auto photons2_coll = photons2.sliceBy(perCollision2, collision.globalIndex()); @@ -315,7 +315,7 @@ struct TagAndProbe { if (abs(v12.Rapidity()) > maxY) { continue; } - reinterpret_cast(list_pair_ss->FindObject(Form("%s_%s", tagcut.getName().c_str(), probecut.getName().c_str()))->FindObject(paircut.getName().c_str())->FindObject("hMggPt_Probe_Same"))->Fill(v12.M(), v2.Pt()); + dynamic_cast(list_pair_ss->FindObject(Form("%s_%s", tagcut.getName().c_str(), probecut.getName().c_str()))->FindObject(paircut.getName().c_str())->FindObject("hMggPt_Probe_Same"))->Fill(v12.M(), v2.Pt()); if constexpr (pairtype == PairType::kPCMPCM) { if (!probecut.template IsSelected(g2)) { @@ -331,7 +331,7 @@ struct TagAndProbe { } } - reinterpret_cast(list_pair_ss->FindObject(Form("%s_%s", tagcut.getName().c_str(), probecut.getName().c_str()))->FindObject(paircut.getName().c_str())->FindObject("hMggPt_PassingProbe_Same"))->Fill(v12.M(), v2.Pt()); + dynamic_cast(list_pair_ss->FindObject(Form("%s_%s", tagcut.getName().c_str(), probecut.getName().c_str()))->FindObject(paircut.getName().c_str())->FindObject("hMggPt_PassingProbe_Same"))->Fill(v12.M(), v2.Pt()); if constexpr (pairtype == PairType::kEMCEMC) { RotationBackground(v12, v1, v2, photons2_coll, g1.globalIndex(), g2.globalIndex(), probecut, paircut); @@ -356,12 +356,12 @@ struct TagAndProbe { template void MixedEventPairing(TEvents const& collisions, TPhotons1 const& photons1, TPhotons2 const& photons2, TPreslice1 const& perCollision1, TPreslice2 const& perCollision2, TTagCut const& tagcut, TProbeCuts const& probecuts, TPairCuts const& paircuts, TLegs const& /*legs*/, TMixedBinning const& colBinning) { - THashList* list_pair_ss = static_cast(fMainList->FindObject("Pair")->FindObject(pairnames[pairtype].data())); + auto* list_pair_ss = dynamic_cast(fMainList->FindObject("Pair")->FindObject(pairnames[pairtype].data())); for (auto& [collision1, collision2] : soa::selfCombinations(colBinning, ndepth, -1, collisions, collisions)) { // internally, CombinationsStrictlyUpperIndexPolicy(collisions, collisions) is called. - const float centralities1[3] = {collision1.centFT0M(), collision1.centFT0A(), collision1.centFT0C()}; - const float centralities2[3] = {collision2.centFT0M(), collision2.centFT0A(), collision2.centFT0C()}; + const std::array centralities1 = {collision1.centFT0M(), collision1.centFT0A(), collision1.centFT0C()}; + const std::array centralities2 = {collision2.centFT0M(), collision2.centFT0A(), collision2.centFT0C()}; if (centralities1[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities1[cfgCentEstimator]) { continue; @@ -406,7 +406,7 @@ struct TagAndProbe { if (abs(v12.Rapidity()) > maxY) { continue; } - reinterpret_cast(list_pair_ss->FindObject(Form("%s_%s", tagcut.getName().c_str(), probecut.getName().c_str()))->FindObject(paircut.getName().c_str())->FindObject("hMggPt_Probe_Mixed"))->Fill(v12.M(), v2.Pt()); + dynamic_cast(list_pair_ss->FindObject(Form("%s_%s", tagcut.getName().c_str(), probecut.getName().c_str()))->FindObject(paircut.getName().c_str())->FindObject("hMggPt_Probe_Mixed"))->Fill(v12.M(), v2.Pt()); if constexpr (pairtype == PairType::kPCMPCM) { if (!probecut.template IsSelected(g2)) { @@ -422,7 +422,7 @@ struct TagAndProbe { } } - reinterpret_cast(list_pair_ss->FindObject(Form("%s_%s", tagcut.getName().c_str(), probecut.getName().c_str()))->FindObject(paircut.getName().c_str())->FindObject("hMggPt_PassingProbe_Mixed"))->Fill(v12.M(), v2.Pt()); + dynamic_cast(list_pair_ss->FindObject(Form("%s_%s", tagcut.getName().c_str(), probecut.getName().c_str()))->FindObject(paircut.getName().c_str())->FindObject("hMggPt_PassingProbe_Mixed"))->Fill(v12.M(), v2.Pt()); } // end of probe cut loop } // end of pair cut loop @@ -484,10 +484,10 @@ struct TagAndProbe { // LOG(info) << "openingAngle2_2 = " << openingAngle2_2; if (openingAngle1 > minOpenAngle) { - reinterpret_cast(fMainList->FindObject("Pair")->FindObject("EMCEMC")->FindObject(Form("%s_%s", cut.getName().c_str(), cut.getName().c_str()))->FindObject(paircut.getName().c_str())->FindObject("hMggPt_Same_RotatedBkg"))->Fill(mother1.M(), mother1.Pt()); + dynamic_cast(fMainList->FindObject("Pair")->FindObject("EMCEMC")->FindObject(Form("%s_%s", cut.getName().c_str(), cut.getName().c_str()))->FindObject(paircut.getName().c_str())->FindObject("hMggPt_Same_RotatedBkg"))->Fill(mother1.M(), mother1.Pt()); } if (openingAngle2 > minOpenAngle) { - reinterpret_cast(fMainList->FindObject("Pair")->FindObject("EMCEMC")->FindObject(Form("%s_%s", cut.getName().c_str(), cut.getName().c_str()))->FindObject(paircut.getName().c_str())->FindObject("hMggPt_Same_RotatedBkg"))->Fill(mother2.M(), mother2.Pt()); + dynamic_cast(fMainList->FindObject("Pair")->FindObject("EMCEMC")->FindObject(Form("%s_%s", cut.getName().c_str(), cut.getName().c_str()))->FindObject(paircut.getName().c_str())->FindObject("hMggPt_Same_RotatedBkg"))->Fill(mother2.M(), mother2.Pt()); } } } @@ -529,8 +529,8 @@ struct TagAndProbe { PROCESS_SWITCH(TagAndProbe, processDummy, "Dummy function", true); }; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +WorkflowSpec defineDataProcessing(ConfigContext const& context) { return WorkflowSpec{ - adaptAnalysisTask(cfgc, TaskName{"tag-and-probe"})}; + adaptAnalysisTask(context, TaskName{"tag-and-probe"})}; } diff --git a/PWGEM/PhotonMeson/Tasks/dalitzEEQC.cxx b/PWGEM/PhotonMeson/Tasks/dalitzEEQC.cxx index f33e70e1b86..43f82e92041 100644 --- a/PWGEM/PhotonMeson/Tasks/dalitzEEQC.cxx +++ b/PWGEM/PhotonMeson/Tasks/dalitzEEQC.cxx @@ -48,6 +48,7 @@ #include // IWYU pragma: keep (do not replace with Math/Vector4Dfwd.h) #include +#include #include #include #include diff --git a/PWGEM/PhotonMeson/Tasks/emcalBcWiseGammaGamma.cxx b/PWGEM/PhotonMeson/Tasks/emcalBcWiseGammaGamma.cxx index 0db7a6cc899..a189ecc8466 100644 --- a/PWGEM/PhotonMeson/Tasks/emcalBcWiseGammaGamma.cxx +++ b/PWGEM/PhotonMeson/Tasks/emcalBcWiseGammaGamma.cxx @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -34,6 +35,7 @@ #include #include +#include #include #include #include diff --git a/PWGEM/PhotonMeson/Tasks/emcalPhotonMcTask.cxx b/PWGEM/PhotonMeson/Tasks/emcalPhotonMcTask.cxx index 21c9c55f980..27f17c4d352 100644 --- a/PWGEM/PhotonMeson/Tasks/emcalPhotonMcTask.cxx +++ b/PWGEM/PhotonMeson/Tasks/emcalPhotonMcTask.cxx @@ -28,10 +28,9 @@ #include #include #include -#include -#include #include #include +#include #include #include #include @@ -56,6 +55,7 @@ #include #include +#include #include #include #include @@ -190,9 +190,6 @@ struct EmcalPhotonMcTask { Produces convTagCandidates; Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"}; - Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; - Configurable skipGRPOquery{"skipGRPOquery", true, "skip grpo query"}; Configurable writeTable{"writeTable", true, "write table for ML."}; Configurable> classPrescale{"classPrescale", {1, 1, 700, 25, 1, 350, 15, 1, 1, 35, 2, 1, 1, 1, 1, 1, 1000}, "prescale factor per TruthClass, indexed 0..10 matching the enum order"}; Configurable bkgPrescaleSeed{"bkgPrescaleSeed", 42, "seed for the background-prescale RNG"}; @@ -266,7 +263,7 @@ struct EmcalPhotonMcTask { using EMCalPhotons = soa::Join; - using Colls = soa::Join; + using Colls = soa::Join; using McColls = o2::soa::Join; using McParticles = EMMCParticles; @@ -414,27 +411,12 @@ struct EmcalPhotonMcTask { if (mRunNumber == collision.runNumber()) { return; } - - auto run3GrpTimestamp = collision.timestamp(); - o2::parameters::GRPObject* grpo = nullptr; - o2::parameters::GRPMagField* grpmag = nullptr; - if (!skipGRPOquery) { - grpo = ccdb->getForTimeStamp(grpPath, run3GrpTimestamp); - } - if (grpo) { - // Fetch magnetic field from ccdb for current collision - dBz = grpo->getNominalL3Field(); - LOG(info) << "Retrieved GRP for timestamp " << run3GrpTimestamp << " with magnetic field of " << dBz << " kZG"; - } else { - grpmag = ccdb->getForTimeStamp(grpmagPath, run3GrpTimestamp); - if (!grpmag) { - LOG(fatal) << "Got nullptr from CCDB for path " << grpmagPath << " of object GRPMagField and " << grpPath << " of object GRPObject for timestamp " << run3GrpTimestamp; - } - // Fetch magnetic field from ccdb for current collision - dBz = std::lround(5.f * grpmag->getL3Current() / 30000.f); - LOG(info) << "Retrieved GRP for timestamp " << run3GrpTimestamp << " with magnetic field of " << dBz << " kZG"; - } mRunNumber = collision.runNumber(); + + auto run3grp_timestamp = collision.timestamp(); + // Fetch magnetic field from ccdb for current collision + dBz = collision.grpMagField().getNominalL3Field(); + LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << dBz << " kZG"; } template diff --git a/PWGEM/PhotonMeson/Tasks/emcalPi0Qc.cxx b/PWGEM/PhotonMeson/Tasks/emcalPi0Qc.cxx index 98bcc1533fd..4bd7e5fe9e0 100644 --- a/PWGEM/PhotonMeson/Tasks/emcalPi0Qc.cxx +++ b/PWGEM/PhotonMeson/Tasks/emcalPi0Qc.cxx @@ -50,7 +50,7 @@ #include #include -#include +#include #include #include #include @@ -69,33 +69,33 @@ using MyBCs = o2::soa::Join; struct Photon { Photon(float eta_tmp, float phi_tmp, float energy_tmp, int clusid = 0, uint8_t sm_tmp = 0) + : eta(eta_tmp), + phi(phi_tmp), + energy(energy_tmp), + theta(2.f * std::atan2(std::exp(-eta), 1)), + px(energy * std::sin(theta) * std::cos(phi)), + py(energy * std::sin(theta) * std::sin(phi)), + pz(energy * std::cos(theta)), + pt(std::sqrt(px * px + py * py)), + photon(px, py, pz, energy), + id(clusid), + sm(sm_tmp), + onDCal(phi < 6 && phi > 4) // o2-linter: disable=magic-number (DCal phi range) { - eta = eta_tmp; - phi = phi_tmp; - energy = energy_tmp; - theta = 2 * std::atan2(std::exp(-eta), 1); - px = energy * std::sin(theta) * std::cos(phi); - py = energy * std::sin(theta) * std::sin(phi); - pz = energy * std::cos(theta); - pt = std::sqrt(px * px + py * py); - photon.SetPxPyPzE(px, py, pz, energy); - id = clusid; - sm = sm_tmp; - onDCal = (phi < 6 && phi > 4); } - ROOT::Math::PxPyPzEVector photon; - float pt; - float px; - float py; - float pz; float eta; float phi; float energy; float theta; + float px; + float py; + float pz; + float pt; + ROOT::Math::PxPyPzEVector photon; int id; uint8_t sm; - bool onDCal; // Checks whether photon is in phi region of the DCal, otherwise: EMCal + bool onDCal{phi < 6 && phi > 4}; // Checks whether photon is in phi region of the DCal, otherwise: EMCal }; enum SubGeneratorId { @@ -104,29 +104,27 @@ enum SubGeneratorId { }; struct Meson { - Meson(Photon p1, Photon p2) : pgamma1(p1), - pgamma2(p2) + Meson(Photon const& p1, Photon const& p2) : pgamma1(p1), pgamma2(p2), pMeson(p1.photon + p2.photon) { - pMeson = p1.photon + p2.photon; } Photon pgamma1; Photon pgamma2; ROOT::Math::PxPyPzEVector pMeson; - float getMass() const { return pMeson.M(); } - float getPt() const { return pMeson.Pt(); } - float getOpeningAngle() const + [[nodiscard]] float getMass() const { return pMeson.M(); } + [[nodiscard]] float getPt() const { return pMeson.Pt(); } + [[nodiscard]] float getOpeningAngle() const { float cosAngle = pgamma1.photon.Vect().Dot(pgamma2.photon.Vect()) / (pgamma1.photon.P() * pgamma2.photon.P()); float angle = std::acos(std::clamp(cosAngle, -1.0f, 1.0f)); return angle; } - ROOT::Math::PxPyPzEVector getMathVector() const { return pMeson; } + [[nodiscard]] ROOT::Math::PxPyPzEVector getMathVector() const { return pMeson; } }; struct EventMixVec { - void addEvent(std::vector vecGamma) + void addEvent(std::vector const& vecGamma) { if (vecEvtMix.size() < nEVtMixSize) { vecEvtMix.push_back(vecGamma); @@ -148,9 +146,9 @@ struct EmcalPi0Qc { // configurable parameters // TODO adapt mDoEventSel switch to also allow selection of other triggers (e.g. EMC7) - Configurable mDoEventSel{"mDoEventSel", 0, "demand kINT7"}; - Configurable mRequireCaloReadout{"mRequireCaloReadout", 0, "require kTVXinEMC"}; - Configurable mRequireEMCalCells{"mRequireEMCalCells", 0, "require at least one EMC cell in each collision"}; + Configurable mDoEventSel{"mDoEventSel", false, "demand kINT7"}; + Configurable mRequireCaloReadout{"mRequireCaloReadout", false, "require kTVXinEMC"}; + Configurable mRequireEMCalCells{"mRequireEMCalCells", false, "require at least one EMC cell in each collision"}; Configurable mVetoBCID{"mVetoBCID", "", "BC ID(s) to be excluded, this should be used as an alternative to the event selection"}; Configurable mSelectBCID{"mSelectBCID", "all", "BC ID(s) to be included, this should be used as an alternative to the event selection"}; Configurable mVertexCut{"mVertexCut", -1, "apply z-vertex cut with value in cm"}; @@ -162,8 +160,8 @@ struct EmcalPi0Qc { Configurable mMinNCellsCut{"mMinNCellsCut", 1, "apply min cluster number of cell cut"}; Configurable mMinOpenAngleCut{"mMinOpenAngleCut", 0.0202, "apply min opening angle cut"}; Configurable mClusterDefinition{"mClusterDefinition", "kV3Default", "cluster definition to be selected, e.g. V3Default"}; - Configurable mSplitEMCalDCal{"mSplitEMCalDCal", 0, "Create and fill inv mass histograms for photons on EMCal and DCal individually"}; - Configurable mDoSumw2{"mDoSumw2", 1, "enable Sumw2 for all histograms"}; + Configurable mSplitEMCalDCal{"mSplitEMCalDCal", false, "Create and fill inv mass histograms for photons on EMCal and DCal individually"}; + Configurable mDoSumw2{"mDoSumw2", true, "enable Sumw2 for all histograms"}; std::vector mVetoBCIDs; std::vector mSelectBCIDs; @@ -296,10 +294,10 @@ struct EmcalPi0Qc { mHistManager.add(Form("mesonInvMassVsTimeStamp/mesonInvMassVsTimeStampSM%d", ism), Form("invariant mass vs collision timestamp in Supermodule %d", ism), HistType::kTH2F, {invmassAxis, collisionTimeAxis}, mDoSumw2.value); } - if (mVetoBCID->length()) { + if (!mVetoBCID->empty()) { std::stringstream parser(mVetoBCID.value); std::string token; - int bcid; + int bcid = -1; while (std::getline(parser, token, ',')) { bcid = std::stoi(token); LOG(info) << "Veto BCID " << bcid; @@ -309,7 +307,7 @@ struct EmcalPi0Qc { if (mSelectBCID.value != "all") { std::stringstream parser(mSelectBCID.value); std::string token; - int bcid; + int bcid = -1; while (std::getline(parser, token, ',')) { bcid = std::stoi(token); LOG(info) << "Select BCID " << bcid; @@ -327,9 +325,9 @@ struct EmcalPi0Qc { template void supermoduleHistHelperPhoton(float time, float m02, int NCell, float timeSinceSOR) { - static constexpr std::string_view ClusterTimeHistSM[20] = {"clusterTimeVsTimeStamp/clusterTimeVsTimeStampSM0", "clusterTimeVsTimeStamp/clusterTimeVsTimeStampSM1", "clusterTimeVsTimeStamp/clusterTimeVsTimeStampSM2", "clusterTimeVsTimeStamp/clusterTimeVsTimeStampSM3", "clusterTimeVsTimeStamp/clusterTimeVsTimeStampSM4", "clusterTimeVsTimeStamp/clusterTimeVsTimeStampSM5", "clusterTimeVsTimeStamp/clusterTimeVsTimeStampSM6", "clusterTimeVsTimeStamp/clusterTimeVsTimeStampSM7", "clusterTimeVsTimeStamp/clusterTimeVsTimeStampSM8", "clusterTimeVsTimeStamp/clusterTimeVsTimeStampSM9", "clusterTimeVsTimeStamp/clusterTimeVsTimeStampSM10", "clusterTimeVsTimeStamp/clusterTimeVsTimeStampSM11", "clusterTimeVsTimeStamp/clusterTimeVsTimeStampSM12", "clusterTimeVsTimeStamp/clusterTimeVsTimeStampSM13", "clusterTimeVsTimeStamp/clusterTimeVsTimeStampSM14", "clusterTimeVsTimeStamp/clusterTimeVsTimeStampSM15", "clusterTimeVsTimeStamp/clusterTimeVsTimeStampSM16", "clusterTimeVsTimeStamp/clusterTimeVsTimeStampSM17", "clusterTimeVsTimeStamp/clusterTimeVsTimeStampSM18", "clusterTimeVsTimeStamp/clusterTimeVsTimeStampSM19"}; - static constexpr std::string_view ClusterNcellHistSM[20] = {"clusterNcellVsTimeStamp/clusterNCellVsTimeStampSM0", "clusterNcellVsTimeStamp/clusterNCellVsTimeStampSM1", "clusterNcellVsTimeStamp/clusterNCellVsTimeStampSM2", "clusterNcellVsTimeStamp/clusterNCellVsTimeStampSM3", "clusterNcellVsTimeStamp/clusterNCellVsTimeStampSM4", "clusterNcellVsTimeStamp/clusterNCellVsTimeStampSM5", "clusterNcellVsTimeStamp/clusterNCellVsTimeStampSM6", "clusterNcellVsTimeStamp/clusterNCellVsTimeStampSM7", "clusterNcellVsTimeStamp/clusterNCellVsTimeStampSM8", "clusterNcellVsTimeStamp/clusterNCellVsTimeStampSM9", "clusterNcellVsTimeStamp/clusterNCellVsTimeStampSM10", "clusterNcellVsTimeStamp/clusterNCellVsTimeStampSM11", "clusterNcellVsTimeStamp/clusterNCellVsTimeStampSM12", "clusterNcellVsTimeStamp/clusterNCellVsTimeStampSM13", "clusterNcellVsTimeStamp/clusterNCellVsTimeStampSM14", "clusterNcellVsTimeStamp/clusterNCellVsTimeStampSM15", "clusterNcellVsTimeStamp/clusterNCellVsTimeStampSM16", "clusterNcellVsTimeStamp/clusterNCellVsTimeStampSM17", "clusterNcellVsTimeStamp/clusterNCellVsTimeStampSM18", "clusterNcellVsTimeStamp/clusterNCellVsTimeStampSM19"}; - static constexpr std::string_view ClusterM02HistSM[20] = {"clusterM02VsTimeStamp/clusterM02VsTimeStampSM0", "clusterM02VsTimeStamp/clusterM02VsTimeStampSM1", "clusterM02VsTimeStamp/clusterM02VsTimeStampSM2", "clusterM02VsTimeStamp/clusterM02VsTimeStampSM3", "clusterM02VsTimeStamp/clusterM02VsTimeStampSM4", "clusterM02VsTimeStamp/clusterM02VsTimeStampSM5", "clusterM02VsTimeStamp/clusterM02VsTimeStampSM6", "clusterM02VsTimeStamp/clusterM02VsTimeStampSM7", "clusterM02VsTimeStamp/clusterM02VsTimeStampSM8", "clusterM02VsTimeStamp/clusterM02VsTimeStampSM9", "clusterM02VsTimeStamp/clusterM02VsTimeStampSM10", "clusterM02VsTimeStamp/clusterM02VsTimeStampSM11", "clusterM02VsTimeStamp/clusterM02VsTimeStampSM12", "clusterM02VsTimeStamp/clusterM02VsTimeStampSM13", "clusterM02VsTimeStamp/clusterM02VsTimeStampSM14", "clusterM02VsTimeStamp/clusterM02VsTimeStampSM15", "clusterM02VsTimeStamp/clusterM02VsTimeStampSM16", "clusterM02VsTimeStamp/clusterM02VsTimeStampSM17", "clusterM02VsTimeStamp/clusterM02VsTimeStampSM18", "clusterM02VsTimeStamp/clusterM02VsTimeStampSM19"}; + static constexpr std::array ClusterTimeHistSM = {"clusterTimeVsTimeStamp/clusterTimeVsTimeStampSM0", "clusterTimeVsTimeStamp/clusterTimeVsTimeStampSM1", "clusterTimeVsTimeStamp/clusterTimeVsTimeStampSM2", "clusterTimeVsTimeStamp/clusterTimeVsTimeStampSM3", "clusterTimeVsTimeStamp/clusterTimeVsTimeStampSM4", "clusterTimeVsTimeStamp/clusterTimeVsTimeStampSM5", "clusterTimeVsTimeStamp/clusterTimeVsTimeStampSM6", "clusterTimeVsTimeStamp/clusterTimeVsTimeStampSM7", "clusterTimeVsTimeStamp/clusterTimeVsTimeStampSM8", "clusterTimeVsTimeStamp/clusterTimeVsTimeStampSM9", "clusterTimeVsTimeStamp/clusterTimeVsTimeStampSM10", "clusterTimeVsTimeStamp/clusterTimeVsTimeStampSM11", "clusterTimeVsTimeStamp/clusterTimeVsTimeStampSM12", "clusterTimeVsTimeStamp/clusterTimeVsTimeStampSM13", "clusterTimeVsTimeStamp/clusterTimeVsTimeStampSM14", "clusterTimeVsTimeStamp/clusterTimeVsTimeStampSM15", "clusterTimeVsTimeStamp/clusterTimeVsTimeStampSM16", "clusterTimeVsTimeStamp/clusterTimeVsTimeStampSM17", "clusterTimeVsTimeStamp/clusterTimeVsTimeStampSM18", "clusterTimeVsTimeStamp/clusterTimeVsTimeStampSM19"}; + static constexpr std::array ClusterNcellHistSM = {"clusterNcellVsTimeStamp/clusterNCellVsTimeStampSM0", "clusterNcellVsTimeStamp/clusterNCellVsTimeStampSM1", "clusterNcellVsTimeStamp/clusterNCellVsTimeStampSM2", "clusterNcellVsTimeStamp/clusterNCellVsTimeStampSM3", "clusterNcellVsTimeStamp/clusterNCellVsTimeStampSM4", "clusterNcellVsTimeStamp/clusterNCellVsTimeStampSM5", "clusterNcellVsTimeStamp/clusterNCellVsTimeStampSM6", "clusterNcellVsTimeStamp/clusterNCellVsTimeStampSM7", "clusterNcellVsTimeStamp/clusterNCellVsTimeStampSM8", "clusterNcellVsTimeStamp/clusterNCellVsTimeStampSM9", "clusterNcellVsTimeStamp/clusterNCellVsTimeStampSM10", "clusterNcellVsTimeStamp/clusterNCellVsTimeStampSM11", "clusterNcellVsTimeStamp/clusterNCellVsTimeStampSM12", "clusterNcellVsTimeStamp/clusterNCellVsTimeStampSM13", "clusterNcellVsTimeStamp/clusterNCellVsTimeStampSM14", "clusterNcellVsTimeStamp/clusterNCellVsTimeStampSM15", "clusterNcellVsTimeStamp/clusterNCellVsTimeStampSM16", "clusterNcellVsTimeStamp/clusterNCellVsTimeStampSM17", "clusterNcellVsTimeStamp/clusterNCellVsTimeStampSM18", "clusterNcellVsTimeStamp/clusterNCellVsTimeStampSM19"}; + static constexpr std::array ClusterM02HistSM = {"clusterM02VsTimeStamp/clusterM02VsTimeStampSM0", "clusterM02VsTimeStamp/clusterM02VsTimeStampSM1", "clusterM02VsTimeStamp/clusterM02VsTimeStampSM2", "clusterM02VsTimeStamp/clusterM02VsTimeStampSM3", "clusterM02VsTimeStamp/clusterM02VsTimeStampSM4", "clusterM02VsTimeStamp/clusterM02VsTimeStampSM5", "clusterM02VsTimeStamp/clusterM02VsTimeStampSM6", "clusterM02VsTimeStamp/clusterM02VsTimeStampSM7", "clusterM02VsTimeStamp/clusterM02VsTimeStampSM8", "clusterM02VsTimeStamp/clusterM02VsTimeStampSM9", "clusterM02VsTimeStamp/clusterM02VsTimeStampSM10", "clusterM02VsTimeStamp/clusterM02VsTimeStampSM11", "clusterM02VsTimeStamp/clusterM02VsTimeStampSM12", "clusterM02VsTimeStamp/clusterM02VsTimeStampSM13", "clusterM02VsTimeStamp/clusterM02VsTimeStampSM14", "clusterM02VsTimeStamp/clusterM02VsTimeStampSM15", "clusterM02VsTimeStamp/clusterM02VsTimeStampSM16", "clusterM02VsTimeStamp/clusterM02VsTimeStampSM17", "clusterM02VsTimeStamp/clusterM02VsTimeStampSM18", "clusterM02VsTimeStamp/clusterM02VsTimeStampSM19"}; mHistManager.fill(HIST(ClusterTimeHistSM[supermoduleID]), time, timeSinceSOR, mWeight); mHistManager.fill(HIST(ClusterNcellHistSM[supermoduleID]), NCell, timeSinceSOR, mWeight); mHistManager.fill(HIST(ClusterM02HistSM[supermoduleID]), m02, timeSinceSOR, mWeight); @@ -338,7 +336,7 @@ struct EmcalPi0Qc { template void supermoduleHistHelperMeson(float minv, float timeSinceSOR) { - static constexpr std::string_view MesonInvMassHistSM[20] = {"mesonInvMassVsTimeStamp/mesonInvMassVsTimeStampSM0", "mesonInvMassVsTimeStamp/mesonInvMassVsTimeStampSM1", "mesonInvMassVsTimeStamp/mesonInvMassVsTimeStampSM2", "mesonInvMassVsTimeStamp/mesonInvMassVsTimeStampSM3", "mesonInvMassVsTimeStamp/mesonInvMassVsTimeStampSM4", "mesonInvMassVsTimeStamp/mesonInvMassVsTimeStampSM5", "mesonInvMassVsTimeStamp/mesonInvMassVsTimeStampSM6", "mesonInvMassVsTimeStamp/mesonInvMassVsTimeStampSM7", "mesonInvMassVsTimeStamp/mesonInvMassVsTimeStampSM8", "mesonInvMassVsTimeStamp/mesonInvMassVsTimeStampSM9", "mesonInvMassVsTimeStamp/mesonInvMassVsTimeStampSM10", "mesonInvMassVsTimeStamp/mesonInvMassVsTimeStampSM11", "mesonInvMassVsTimeStamp/mesonInvMassVsTimeStampSM12", "mesonInvMassVsTimeStamp/mesonInvMassVsTimeStampSM13", "mesonInvMassVsTimeStamp/mesonInvMassVsTimeStampSM14", "mesonInvMassVsTimeStamp/mesonInvMassVsTimeStampSM15", "mesonInvMassVsTimeStamp/mesonInvMassVsTimeStampSM16", "mesonInvMassVsTimeStamp/mesonInvMassVsTimeStampSM17", "mesonInvMassVsTimeStamp/mesonInvMassVsTimeStampSM18", "mesonInvMassVsTimeStamp/mesonInvMassVsTimeStampSM19"}; + static constexpr std::array MesonInvMassHistSM = {"mesonInvMassVsTimeStamp/mesonInvMassVsTimeStampSM0", "mesonInvMassVsTimeStamp/mesonInvMassVsTimeStampSM1", "mesonInvMassVsTimeStamp/mesonInvMassVsTimeStampSM2", "mesonInvMassVsTimeStamp/mesonInvMassVsTimeStampSM3", "mesonInvMassVsTimeStamp/mesonInvMassVsTimeStampSM4", "mesonInvMassVsTimeStamp/mesonInvMassVsTimeStampSM5", "mesonInvMassVsTimeStamp/mesonInvMassVsTimeStampSM6", "mesonInvMassVsTimeStamp/mesonInvMassVsTimeStampSM7", "mesonInvMassVsTimeStamp/mesonInvMassVsTimeStampSM8", "mesonInvMassVsTimeStamp/mesonInvMassVsTimeStampSM9", "mesonInvMassVsTimeStamp/mesonInvMassVsTimeStampSM10", "mesonInvMassVsTimeStamp/mesonInvMassVsTimeStampSM11", "mesonInvMassVsTimeStamp/mesonInvMassVsTimeStampSM12", "mesonInvMassVsTimeStamp/mesonInvMassVsTimeStampSM13", "mesonInvMassVsTimeStamp/mesonInvMassVsTimeStampSM14", "mesonInvMassVsTimeStamp/mesonInvMassVsTimeStampSM15", "mesonInvMassVsTimeStamp/mesonInvMassVsTimeStampSM16", "mesonInvMassVsTimeStamp/mesonInvMassVsTimeStampSM17", "mesonInvMassVsTimeStamp/mesonInvMassVsTimeStampSM18", "mesonInvMassVsTimeStamp/mesonInvMassVsTimeStampSM19"}; mHistManager.fill(HIST(MesonInvMassHistSM[supermoduleID]), minv, timeSinceSOR, mWeight); } @@ -491,7 +489,7 @@ struct EmcalPi0Qc { auto cellIter = cells.begin(); auto bcIter = bcs.begin(); - int runNumber = bcIter.runNumber(); + int runNumber = 0; std::unordered_map cellGlobalBCs; // Build map of number of cells for corrected BCs using global BCs // used later in the determination whether a BC has EMC cell content (for speed reason) @@ -608,7 +606,7 @@ struct EmcalPi0Qc { { auto cellIter = cells.begin(); auto bcIter = bcs.begin(); - int runNumber = bcIter.runNumber(); + int runNumber = 0; std::unordered_map cellGlobalBCs; // Build map of number of cells for corrected BCs using global BCs // used later in the determination whether a BC has EMC cell content (for speed reason) @@ -748,7 +746,7 @@ struct EmcalPi0Qc { LOG(info) << "Event rejected because of veto BCID " << eventIR.bc; return; } - if (mSelectBCIDs.size() && (std::find(mSelectBCIDs.begin(), mSelectBCIDs.end(), eventIR.bc) == mSelectBCIDs.end())) { + if (!mSelectBCIDs.empty() && (std::find(mSelectBCIDs.begin(), mSelectBCIDs.end(), eventIR.bc) == mSelectBCIDs.end())) { return; } mHistManager.fill(HIST("eventBCSelected"), eventIR.bc); @@ -803,8 +801,9 @@ struct EmcalPi0Qc { fillClusterQAHistos(cluster); - if (clusterRejectedByCut(cluster)) + if (clusterRejectedByCut(cluster)) { continue; + } fillClusterQAHistos(cluster); @@ -819,15 +818,15 @@ struct EmcalPi0Qc { { // In this implementation the cluster properties are directly loaded from the flat table, // in the future one should consider using the AnalysisCluster object to work with after loading. - static constexpr std::string_view ClusterQAHistEnergy[2] = {"ClustersBeforeCuts/clusterE", "ClustersAfterCuts/clusterE"}; - static constexpr std::string_view ClusterQAHistEnergySimpleBinning[2] = {"ClustersBeforeCuts/clusterE_SimpleBinning", "ClustersAfterCuts/clusterE_SimpleBinning"}; - static constexpr std::string_view ClusterQAHistTime[2] = {"ClustersBeforeCuts/clusterTime", "ClustersAfterCuts/clusterTime"}; - static constexpr std::string_view ClusterQAHistEtaPhi[2] = {"ClustersBeforeCuts/clusterEtaPhi", "ClustersAfterCuts/clusterEtaPhi"}; - static constexpr std::string_view ClusterQAHistM02[2] = {"ClustersBeforeCuts/clusterM02", "ClustersAfterCuts/clusterM02"}; - static constexpr std::string_view ClusterQAHistM20[2] = {"ClustersBeforeCuts/clusterM20", "ClustersAfterCuts/clusterM20"}; - static constexpr std::string_view ClusterQAHistNLM[2] = {"ClustersBeforeCuts/clusterNLM", "ClustersAfterCuts/clusterNLM"}; - static constexpr std::string_view ClusterQAHistNCells[2] = {"ClustersBeforeCuts/clusterNCells", "ClustersAfterCuts/clusterNCells"}; - static constexpr std::string_view ClusterQAHistDistanceToBadChannel[2] = {"ClustersBeforeCuts/clusterDistanceToBadChannel", "ClustersAfterCuts/clusterDistanceToBadChannel"}; + static constexpr std::array ClusterQAHistEnergy = {"ClustersBeforeCuts/clusterE", "ClustersAfterCuts/clusterE"}; + static constexpr std::array ClusterQAHistEnergySimpleBinning = {"ClustersBeforeCuts/clusterE_SimpleBinning", "ClustersAfterCuts/clusterE_SimpleBinning"}; + static constexpr std::array ClusterQAHistTime = {"ClustersBeforeCuts/clusterTime", "ClustersAfterCuts/clusterTime"}; + static constexpr std::array ClusterQAHistEtaPhi = {"ClustersBeforeCuts/clusterEtaPhi", "ClustersAfterCuts/clusterEtaPhi"}; + static constexpr std::array ClusterQAHistM02 = {"ClustersBeforeCuts/clusterM02", "ClustersAfterCuts/clusterM02"}; + static constexpr std::array ClusterQAHistM20 = {"ClustersBeforeCuts/clusterM20", "ClustersAfterCuts/clusterM20"}; + static constexpr std::array ClusterQAHistNLM = {"ClustersBeforeCuts/clusterNLM", "ClustersAfterCuts/clusterNLM"}; + static constexpr std::array ClusterQAHistNCells = {"ClustersBeforeCuts/clusterNCells", "ClustersAfterCuts/clusterNCells"}; + static constexpr std::array ClusterQAHistDistanceToBadChannel = {"ClustersBeforeCuts/clusterDistanceToBadChannel", "ClustersAfterCuts/clusterDistanceToBadChannel"}; mHistManager.fill(HIST(ClusterQAHistEnergy[BeforeCuts]), cluster.energy(), mWeight); mHistManager.fill(HIST(ClusterQAHistEnergySimpleBinning[BeforeCuts]), cluster.energy(), mWeight); mHistManager.fill(HIST(ClusterQAHistTime[BeforeCuts]), cluster.time(), mWeight); @@ -872,8 +871,9 @@ struct EmcalPi0Qc { LOG(debug) << "processMesons " << mPhotons.size(); // if less then 2 clusters are found, skip event - if (mPhotons.size() < 2) + if (mPhotons.size() < 2) { return; + } // loop over all photon combinations and build meson candidates for (unsigned int ig1 = 0; ig1 < mPhotons.size(); ++ig1) { @@ -933,7 +933,6 @@ struct EmcalPi0Qc { lvRotationPion = meson.getMathVector(); // calculate rotation axis and matrix - lvRotationPion = lvRotationPhoton1 + lvRotationPhoton2; ROOT::Math::AxisAngle rotationAxis(lvRotationPion.Vect(), rotationAngle); ROOT::Math::Rotation3D rotationMatrix(rotationAxis); @@ -973,7 +972,7 @@ struct EmcalPi0Qc { } } - void calculateMixedBack(Photon gamma) + void calculateMixedBack(Photon const& gamma) { for (unsigned int i = 0; i < evtMix.vecEvtMix.size(); ++i) { for (unsigned int ig1 = 0; ig1 < evtMix.vecEvtMix[i].size(); ++ig1) { @@ -1005,7 +1004,7 @@ struct EmcalPi0Qc { result.emplace_back(0.10 * i); } else if (i < 140) { result.emplace_back(10. + 0.25 * (i - 100)); - } else if (i < 180) { + } else if (i < 179) { result.emplace_back(20. + 1.00 * (i - 140)); } else { result.emplace_back(maxPt); @@ -1015,10 +1014,10 @@ struct EmcalPi0Qc { } }; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +WorkflowSpec defineDataProcessing(ConfigContext const& context) { WorkflowSpec workflow{ - adaptAnalysisTask(cfgc, TaskName{"EmcalPi0QcAssociate"}, SetDefaultProcesses{{{"processCollision", true}, {"processCollisionMC", false}, {"processAmbiguous", false}}}), // o2-linter: disable=name/o2-task (adapted multiple times) - adaptAnalysisTask(cfgc, TaskName{"EmcalPi0QcAmbiguous"}, SetDefaultProcesses{{{"processCollision", false}, {"processCollisionMC", false}, {"processAmbiguous", true}}})}; // o2-linter: disable=name/o2-task (adapted multiple times) + adaptAnalysisTask(context, TaskName{"EmcalPi0QcAssociate"}, SetDefaultProcesses{{{"processCollision", true}, {"processCollisionMC", false}, {"processAmbiguous", false}}}), // o2-linter: disable=name/o2-task (adapted multiple times) + adaptAnalysisTask(context, TaskName{"EmcalPi0QcAmbiguous"}, SetDefaultProcesses{{{"processCollision", false}, {"processCollisionMC", false}, {"processAmbiguous", true}}})}; // o2-linter: disable=name/o2-task (adapted multiple times) return workflow; } diff --git a/PWGEM/PhotonMeson/Tasks/emcalQC.cxx b/PWGEM/PhotonMeson/Tasks/emcalQC.cxx index 5a793f86aa9..def4442d5d5 100644 --- a/PWGEM/PhotonMeson/Tasks/emcalQC.cxx +++ b/PWGEM/PhotonMeson/Tasks/emcalQC.cxx @@ -25,6 +25,7 @@ #include "Common/CCDB/EventSelectionParams.h" #include "Common/CCDB/TriggerAliases.h" +#include #include #include #include diff --git a/PWGEM/PhotonMeson/Tasks/mcGeneratorStudies.cxx b/PWGEM/PhotonMeson/Tasks/mcGeneratorStudies.cxx index fc390c4ce65..6aebaf77f63 100644 --- a/PWGEM/PhotonMeson/Tasks/mcGeneratorStudies.cxx +++ b/PWGEM/PhotonMeson/Tasks/mcGeneratorStudies.cxx @@ -8,18 +8,15 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// + /// \file mcGeneratorStudies.cxx -/// /// \brief Task that produces the generated pT spectrum of a given particle for MC studies based on on the fly MC simulations -/// /// \author Nicolas Strangmann (nicolas.strangmann@cern.ch) - Goethe University Frankfurt -/// -#include #include #include #include +#include #include #include #include @@ -49,10 +46,11 @@ struct MCGeneratorStudies { int nParticles = mcParticles.size(); mHistManager.fill(HIST("Multiplicity"), nParticles); for (auto& mcParticle : mcParticles) { - if (mcParticle.pdgCode() == cfgSelectedParticleCode && std::abs(mcParticle.y()) < cfgRapidityCut) + if (mcParticle.pdgCode() == cfgSelectedParticleCode && std::abs(mcParticle.y()) < cfgRapidityCut) { mHistManager.fill(HIST("YieldVsMultiplicity"), mcParticle.pt(), nParticles); + } } } }; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc, TaskName{"mc-generator-studies"})}; } +WorkflowSpec defineDataProcessing(ConfigContext const& context) { return WorkflowSpec{adaptAnalysisTask(context, TaskName{"mc-generator-studies"})}; } diff --git a/PWGEM/PhotonMeson/Tasks/pcmQC.cxx b/PWGEM/PhotonMeson/Tasks/pcmQC.cxx index 4f2740fed70..1b161a8976a 100644 --- a/PWGEM/PhotonMeson/Tasks/pcmQC.cxx +++ b/PWGEM/PhotonMeson/Tasks/pcmQC.cxx @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include diff --git a/PWGEM/PhotonMeson/Tasks/pcmQCMC.cxx b/PWGEM/PhotonMeson/Tasks/pcmQCMC.cxx index bdcd338d4aa..dc432d670e5 100644 --- a/PWGEM/PhotonMeson/Tasks/pcmQCMC.cxx +++ b/PWGEM/PhotonMeson/Tasks/pcmQCMC.cxx @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -778,7 +779,7 @@ struct PCMQCMC { if (cfgResolDetailPlots) { fRegistry.fill(HIST("Generated/hPtEtaPhi"), mctrack.pt(), mctrack.eta(), mctrack.phi()); // fill for all generated photons before any kinematic cut } - if (mctrack.daughtersIds().size() == 0) { + if (mctrack.daughtersIds().empty()) { continue; } auto daughter = mcparticles.iteratorAt(mctrack.daughtersIds()[0]); // choose ele or pos. diff --git a/PWGEM/PhotonMeson/Tasks/photonResoTask.cxx b/PWGEM/PhotonMeson/Tasks/photonResoTask.cxx index f7c80f9b6d1..0df8f54af2a 100644 --- a/PWGEM/PhotonMeson/Tasks/photonResoTask.cxx +++ b/PWGEM/PhotonMeson/Tasks/photonResoTask.cxx @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -65,9 +66,9 @@ using namespace o2::aod::pwgem::photon; enum CentralityEstimator { None = 0, CFT0A = 1, - CFT0C, - CFT0M, - NCentralityEstimators + CFT0C = 2, + CFT0M = 3, + NCentralityEstimators = 4 }; enum class MapLevel { @@ -78,8 +79,6 @@ enum class MapLevel { }; struct PhotonResoTask { - static constexpr float MinEnergy = 0.7f; - o2::framework::Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; o2::framework::Configurable grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"}; o2::framework::Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; @@ -94,7 +93,7 @@ struct PhotonResoTask { ConfigurableAxis thnConfigAxisPhiRelative{"thnConfigAxisPhiRelative", {300, -1., 2.}, "(phi rec - phi true) / phi true axis"}; ConfigurableAxis thnConfigAxisCent{"thnConfigAxisCent", {20, 0., 100.}, "centrality axis for the current event"}; ConfigurableAxis thnConfigAxisMult{"thnConfigAxisMult", {60, 0., 60000.}, "multiplicity axis for the current event"}; - Configurable useCent{"useCent", 0, "flag to enable usage of centrality instead of multiplicity as axis."}; + Configurable useCent{"useCent", false, "flag to enable usage of centrality instead of multiplicity as axis."}; EMPhotonEventCut fEMEventCut; struct : ConfigurableGroup { @@ -199,7 +198,7 @@ struct PhotonResoTask { HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; - o2::framework::Service ccdb; + o2::framework::Service ccdb{}; int mRunNumber{-1}; float dBz{0.f}; @@ -366,8 +365,9 @@ struct PhotonResoTask { auto run3GrpTimestamp = collision.timestamp(); o2::parameters::GRPObject* grpo = nullptr; o2::parameters::GRPMagField* grpmag = nullptr; - if (!skipGRPOquery) + if (!skipGRPOquery) { grpo = ccdb->getForTimeStamp(grpPath, run3GrpTimestamp); + } if (grpo) { // Fetch magnetic field from ccdb for current collision dBz = grpo->getNominalL3Field(); @@ -491,7 +491,7 @@ struct PhotonResoTask { if (!(emcFlags.test(photonEMC.globalIndex()))) { continue; } - if (photonEMC.emmcparticleIds().size() <= 0) { + if (photonEMC.emmcparticleIds().empty()) { // this is a cluster with just noise, skip continue; } @@ -602,7 +602,7 @@ struct PhotonResoTask { registry.fill(HIST("mesonQA/hInvMassPt"), vMeson.M(), vMeson.Pt()); } - if (g1.emmcparticleIds().size() <= 0 || g2.emmcparticleIds().size() <= 0) { + if (g1.emmcparticleIds().empty() || g2.emmcparticleIds().empty()) { // there is a cluster which is just noise, skip continue; } @@ -642,7 +642,7 @@ struct PhotonResoTask { }; // End struct PhotonResoTask -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +WorkflowSpec defineDataProcessing(ConfigContext const& context) { - return WorkflowSpec{adaptAnalysisTask(cfgc)}; + return WorkflowSpec{adaptAnalysisTask(context)}; } diff --git a/PWGEM/PhotonMeson/Tasks/photonhbt.cxx b/PWGEM/PhotonMeson/Tasks/photonhbt.cxx index 5f4cff7784f..3b42ca4d27b 100644 --- a/PWGEM/PhotonMeson/Tasks/photonhbt.cxx +++ b/PWGEM/PhotonMeson/Tasks/photonhbt.cxx @@ -3699,8 +3699,8 @@ struct Photonhbt { std::set> usedLegs; for (const int& i : order) { const int c = perCollision ? allCands[i].collisionId : -1; - if (usedLegs.contains({c, allCands[i].posTrackId}) > 0 || - usedLegs.contains({c, allCands[i].negTrackId}) > 0) { + if (usedLegs.contains({c, allCands[i].posTrackId}) || + usedLegs.contains({c, allCands[i].negTrackId})) { continue; // a leg is already owned by an earlier (preferred) candidate } usedLegs.insert({c, allCands[i].posTrackId}); diff --git a/PWGEM/PhotonMeson/Tasks/prefilterPhoton.cxx b/PWGEM/PhotonMeson/Tasks/prefilterPhoton.cxx index 65eee81181e..8c1b1ed5bcb 100644 --- a/PWGEM/PhotonMeson/Tasks/prefilterPhoton.cxx +++ b/PWGEM/PhotonMeson/Tasks/prefilterPhoton.cxx @@ -29,10 +29,10 @@ #include #include #include -#include #include #include #include +#include #include #include #include @@ -47,6 +47,7 @@ #include // IWYU pragma: keep (do not replace with Math/Vector4Dfwd.h) #include +#include #include #include #include @@ -60,7 +61,7 @@ using namespace o2::framework::expressions; using namespace o2::soa; using namespace o2::aod::pwgem::photonmeson::photonpair; -using MyCollisions = soa::Join; +using MyCollisions = soa::Join; using MyCollision = MyCollisions::iterator; using MyV0Photons = soa::Join; @@ -75,9 +76,6 @@ struct prefilterPhoton { // Configurables Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"}; - Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; - Configurable skipGRPOquery{"skipGRPOquery", true, "skip grpo query"}; Configurable d_bz_input{"d_bz_input", -999, "bz field in kG, -999 is automatic"}; Configurable cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"}; @@ -180,9 +178,9 @@ struct prefilterPhoton { HistogramRegistry fRegistry{"output", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; o2::ccdb::CcdbApi ccdbApi; - Service ccdb; - int mRunNumber; - float d_bz; + Service ccdb{}; + int mRunNumber = 0; + float dBz = 0; void init(InitContext& /*context*/) { @@ -191,7 +189,7 @@ struct prefilterPhoton { addhistograms(); mRunNumber = 0; - d_bz = 0; + dBz = 0; ccdb->setURL(ccdburl); ccdb->setCaching(true); @@ -199,7 +197,7 @@ struct prefilterPhoton { ccdb->setFatalWhenNull(false); } - ~prefilterPhoton() {} + ~prefilterPhoton() = default; template void initCCDB(TCollision const& collision) @@ -207,37 +205,21 @@ struct prefilterPhoton { if (mRunNumber == collision.runNumber()) { return; } + mRunNumber = collision.runNumber(); // In case override, don't proceed, please - no CCDB access required if (d_bz_input > -990) { - d_bz = d_bz_input; + dBz = d_bz_input; o2::parameters::GRPMagField grpmag; - if (fabs(d_bz) > 1e-5) { - grpmag.setL3Current(30000.f / (d_bz / 5.0f)); + if (fabs(dBz) > 1e-5) { + grpmag.setL3Current(30000.f / (dBz / 5.0f)); } - mRunNumber = collision.runNumber(); - return; } auto run3grp_timestamp = collision.timestamp(); - o2::parameters::GRPObject* grpo = 0x0; - o2::parameters::GRPMagField* grpmag = 0x0; - if (!skipGRPOquery) - grpo = ccdb->getForTimeStamp(grpPath, run3grp_timestamp); - if (grpo) { - // Fetch magnetic field from ccdb for current collision - d_bz = grpo->getNominalL3Field(); - LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; - } else { - grpmag = ccdb->getForTimeStamp(grpmagPath, run3grp_timestamp); - if (!grpmag) { - LOG(fatal) << "Got nullptr from CCDB for path " << grpmagPath << " of object GRPMagField and " << grpPath << " of object GRPObject for timestamp " << run3grp_timestamp; - } - // Fetch magnetic field from ccdb for current collision - d_bz = std::lround(5.f * grpmag->getL3Current() / 30000.f); - LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; - } - mRunNumber = collision.runNumber(); + // Fetch magnetic field from ccdb for current collision + dBz = collision.grpMagField().getNominalL3Field(); + LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << dBz << " kZG"; } void addhistograms() @@ -350,7 +332,7 @@ struct prefilterPhoton { if constexpr (pairtype == PairType::kPCMPCM) { 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()}; bool is_cent_ok = true; if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { is_cent_ok = false; @@ -385,7 +367,7 @@ struct prefilterPhoton { } else if constexpr (pairtype == PairType::kPCMDalitzEE) { 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()}; bool is_cent_ok = true; if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { is_cent_ok = false; @@ -448,7 +430,7 @@ struct prefilterPhoton { ROOT::Math::PtEtaPhiMVector v_pos(pos2.pt(), pos2.eta(), pos2.phi(), o2::constants::physics::MassElectron); ROOT::Math::PtEtaPhiMVector v_ele(ele2.pt(), ele2.eta(), ele2.phi(), o2::constants::physics::MassElectron); ROOT::Math::PtEtaPhiMVector v_ee = v_pos + v_ele; - if (!(dileptoncuts.cfg_min_mee < v_ee.M() && v_ee.M() < dileptoncuts.cfg_max_mee)) { + if (!(dileptoncuts.cfg_min_mee < v_ee.M()) || !(v_ee.M() < dileptoncuts.cfg_max_mee)) { continue; } ROOT::Math::PtEtaPhiMVector veeg = v_gamma + v_pos + v_ele; @@ -474,7 +456,7 @@ struct prefilterPhoton { ROOT::Math::PtEtaPhiMVector v_pos(pos2.pt(), pos2.eta(), pos2.phi(), o2::constants::physics::MassElectron); ROOT::Math::PtEtaPhiMVector v_ele(ele2.pt(), ele2.eta(), ele2.phi(), o2::constants::physics::MassElectron); ROOT::Math::PtEtaPhiMVector v_ee = v_pos + v_ele; - float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(pos2.px(), pos2.py(), pos2.pz(), ele2.px(), ele2.py(), ele2.pz(), pos2.sign(), ele2.sign(), d_bz); + float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(pos2.px(), pos2.py(), pos2.pz(), ele2.px(), ele2.py(), ele2.pz(), pos2.sign(), ele2.sign(), dBz); fRegistry.fill(HIST("Pair/PCMDalitzEE/before/hMvsPhiV"), phiv, v_ee.M()); if (v_ee.M() < phiv * dileptoncuts.cfg_phiv_slope + dileptoncuts.cfg_phiv_intercept) { @@ -501,7 +483,7 @@ struct prefilterPhoton { // check pfb. if constexpr (pairtype == PairType::kPCMPCM) { for (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; } @@ -530,7 +512,7 @@ struct prefilterPhoton { } else if constexpr (pairtype == PairType::kPCMDalitzEE) { for (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; } @@ -583,8 +565,8 @@ struct prefilterPhoton { ROOT::Math::PtEtaPhiMVector v_pos(pos2.pt(), pos2.eta(), pos2.phi(), o2::constants::physics::MassElectron); ROOT::Math::PtEtaPhiMVector v_ele(ele2.pt(), ele2.eta(), ele2.phi(), o2::constants::physics::MassElectron); ROOT::Math::PtEtaPhiMVector v_ee = v_pos + v_ele; - float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(pos2.px(), pos2.py(), pos2.pz(), ele2.px(), ele2.py(), ele2.pz(), pos2.sign(), ele2.sign(), d_bz); - if (!(dileptoncuts.cfg_min_mee < v_ee.M() && v_ee.M() < dileptoncuts.cfg_max_mee)) { + float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(pos2.px(), pos2.py(), pos2.pz(), ele2.px(), ele2.py(), ele2.pz(), pos2.sign(), ele2.sign(), dBz); + if (!(dileptoncuts.cfg_min_mee < v_ee.M()) || !(v_ee.M() < dileptoncuts.cfg_max_mee)) { continue; } ROOT::Math::PtEtaPhiMVector veeg = v_gamma + v_pos + v_ele; @@ -643,7 +625,7 @@ struct prefilterPhoton { PROCESS_SWITCH(prefilterPhoton, processDummyElectron, "dummy for electrons", true); }; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +WorkflowSpec defineDataProcessing(ConfigContext const& context) { - return WorkflowSpec{adaptAnalysisTask(cfgc, TaskName{"prefilter-photon"})}; + return WorkflowSpec{adaptAnalysisTask(context, TaskName{"prefilter-photon"})}; } diff --git a/PWGEM/PhotonMeson/Tasks/taskFlowReso.cxx b/PWGEM/PhotonMeson/Tasks/taskFlowReso.cxx index 65b3ab804df..6c4b0ecaed8 100644 --- a/PWGEM/PhotonMeson/Tasks/taskFlowReso.cxx +++ b/PWGEM/PhotonMeson/Tasks/taskFlowReso.cxx @@ -22,7 +22,7 @@ #include "Common/Core/RecoDecay.h" #include -#include +#include #include #include #include diff --git a/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx b/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx index f882510c241..db7281218ba 100644 --- a/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx +++ b/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx @@ -254,18 +254,18 @@ struct TaskPi0FlowEMC { int runBefore = -1; static constexpr float MaxPhiEMCal = 3.5f; + static constexpr uint16_t MaxPhiEMCalUint = static_cast(INT16_MAX); // Maximum value currently useable for partitions for some weird reason, but luckily enough // Filter clusterFilter = aod::skimmedcluster::time >= emccuts.cfgEMCminTime && aod::skimmedcluster::time <= emccuts.cfgEMCmaxTime && aod::skimmedcluster::m02 >= emccuts.cfgEMCminM02 && aod::skimmedcluster::m02 <= emccuts.cfgEMCmaxM02 && aod::skimmedcluster::e >= emccuts.cfgEMCminE; Filter collisionFilter = (nabs(aod::collision::posZ) <= eventcuts.cfgZvtxMax) && (aod::evsel::ft0cOccupancyInTimeRange <= eventcuts.cfgFT0COccupancyMax) && (aod::evsel::ft0cOccupancyInTimeRange >= eventcuts.cfgFT0COccupancyMin); // using FilteredEMCalPhotons = soa::Filtered>; using EMCalPhotons = soa::Join; using PCMPhotons = soa::Join; - using FilteredCollsWithQvecs = soa::Filtered>; - using CollsWithQvecs = soa::Join; - using Colls = soa::Join; + using FilteredCollsWithQvecs = soa::Filtered>; + using Colls = soa::Join; - Partition emcalPhotons = aod::mincluster::storedPhi < static_cast(std::lround(MaxPhiEMCal * emcdownscaling::downscalingFactors[emcdownscaling::kPhi])); - Partition dcalPhotons = aod::mincluster::storedPhi >= static_cast(std::lround(MaxPhiEMCal * emcdownscaling::downscalingFactors[emcdownscaling::kPhi])); + Partition emcalPhotons = aod::mincluster::storedPhi < MaxPhiEMCalUint; + Partition dcalPhotons = aod::mincluster::storedPhi >= MaxPhiEMCalUint; static constexpr std::size_t NQVecEntries = 6; @@ -697,13 +697,12 @@ struct TaskPi0FlowEMC { return false; } - bool isCellMasked(int cellID) + template + bool isCellMasked(int cellID, TCollision const& collision) { bool masked = false; - if (mBadChannels) { - auto maskStatus = mBadChannels->getChannelStatus(cellID); - masked = (maskStatus != o2::emcal::BadChannelMap::MaskType_t::GOOD_CELL); - } + auto maskStatus = collision.badChannelMap().getChannelStatus(cellID); + masked = (maskStatus != o2::emcal::BadChannelMap::MaskType_t::GOOD_CELL); return masked; } @@ -712,8 +711,6 @@ struct TaskPi0FlowEMC { { // Load EMCal geometry emcalGeom = o2::emcal::Geometry::GetInstanceFromRunNumber(collision.runNumber()); - // Load Bad Channel map - mBadChannels = ccdb->getForTimeStamp("EMC/Calib/BadChannelMap", collision.timestamp()); lookupTable1D.fill(-1); double binWidthEta = (etaMax - EtaMin) / NBinsEta; double binWidthPhi = (phiMax - PhiMin) / NBinsPhi; @@ -733,7 +730,7 @@ struct TaskPi0FlowEMC { // Check conditions for the cell if (isTooCloseToEdge(cellID, 1)) { lookupTable1D[getIndex(iEta, iPhi)] = 2; // Edge - } else if (isCellMasked(cellID)) { + } else if (isCellMasked(cellID, collision)) { lookupTable1D[getIndex(iEta, iPhi)] = 1; // Bad } else { lookupTable1D[getIndex(iEta, iPhi)] = 0; // Good @@ -1086,7 +1083,7 @@ struct TaskPi0FlowEMC { } // Pi0 from EMCal - void processEMCal(CollsWithQvecs const& collisions, EMCalPhotons const& clusters, MinMTracks const& matchedPrims, MinMSTracks const& matchedSeconds) + void processEMCal(Colls const& collisions, EMCalPhotons const& clusters, MinMTracks const& matchedPrims, MinMSTracks const& matchedSeconds) { if (clusters.size() <= 0) { LOG(info) << "Skipping DF because there are not photons!"; @@ -1235,7 +1232,7 @@ struct TaskPi0FlowEMC { PROCESS_SWITCH(TaskPi0FlowEMC, processEMCalMixed, "Process EMCal Pi0 mixed event candidates", false); // PCM-EMCal same event - void processEMCalPCMC(CollsWithQvecs const& collisions, EMCalPhotons const& clusters, PCMPhotons const& photons, aod::V0Legs const&, MinMTracks const& matchedPrims, MinMSTracks const& matchedSeconds) + void processEMCalPCMC(Colls const& collisions, EMCalPhotons const& clusters, PCMPhotons const& photons, aod::V0Legs const&, MinMTracks const& matchedPrims, MinMSTracks const& matchedSeconds) { if (clusters.size() <= 0 && photons.size() <= 0) { LOG(info) << "Skipping DF because there are not photons!"; @@ -1327,7 +1324,7 @@ struct TaskPi0FlowEMC { PROCESS_SWITCH(TaskPi0FlowEMC, processEMCalPCMC, "Process neutral meson flow using PCM-EMC same event", false); // PCM-EMCal mixed event - void processEMCalPCMMixed(CollsWithQvecs const& collisions, EMCalPhotons const& clusters, PCMPhotons const& pcmPhotons, aod::V0Legs const&, MinMTracks const& matchedPrims, MinMSTracks const& matchedSeconds) + void processEMCalPCMMixed(Colls const& collisions, EMCalPhotons const& clusters, PCMPhotons const& pcmPhotons, aod::V0Legs const&, MinMTracks const& matchedPrims, MinMSTracks const& matchedSeconds) { if (clusters.size() <= 0 && pcmPhotons.size() <= 0) { LOG(info) << "Skipping DF because there are not photons!"; @@ -1339,7 +1336,7 @@ struct TaskPi0FlowEMC { auto associatedTables = std::make_tuple(clusters, pcmPhotons); - Pair pairPCMEMC{binningOnPositions, mixingConfig.cfgMixingDepth, -1, collisions, associatedTables, &cache}; // indicates that mixingConfig.cfgMixingDepth events should be mixed and under/overflow (-1) to be ignored + Pair pairPCMEMC{binningOnPositions, mixingConfig.cfgMixingDepth, -1, collisions, associatedTables, &cache}; // indicates that mixingConfig.cfgMixingDepth events should be mixed and under/overflow (-1) to be ignored EMBitFlags emcFlags(clusters.size()); if (clusters.size() > 0) { @@ -1422,7 +1419,7 @@ struct TaskPi0FlowEMC { PROCESS_SWITCH(TaskPi0FlowEMC, processEMCalPCMMixed, "Process neutral meson flow using PCM-EMC mixed event", false); // Pi0 from EMCal - void processM02(CollsWithQvecs const& collisions, EMCalPhotons const& clusters, MinMTracks const& matchedPrims, MinMSTracks const& matchedSeconds) + void processM02(Colls const& collisions, EMCalPhotons const& clusters, MinMTracks const& matchedPrims, MinMSTracks const& matchedSeconds) { if (clusters.size() <= 0) { LOG(info) << "Skipping DF because there are not photons!"; @@ -1479,7 +1476,7 @@ struct TaskPi0FlowEMC { PROCESS_SWITCH(TaskPi0FlowEMC, processM02, "Process single EMCal clusters as function of M02", false); // Pi0 from EMCal - void processPCM(CollsWithQvecs const& collisions, PCMPhotons const& photons, aod::V0Legs const&) + void processPCM(Colls const& collisions, PCMPhotons const& photons, aod::V0Legs const&) { if (photons.size() <= 0) { LOG(info) << "Skipping DF because there are not photons!"; diff --git a/PWGEM/PhotonMeson/Utils/ClusterHistograms.h b/PWGEM/PhotonMeson/Utils/ClusterHistograms.h index 4d770d120e3..73aece33282 100644 --- a/PWGEM/PhotonMeson/Utils/ClusterHistograms.h +++ b/PWGEM/PhotonMeson/Utils/ClusterHistograms.h @@ -19,7 +19,6 @@ #include "PWGEM/PhotonMeson/Core/EMCPhotonCut.h" #include -#include #include #include #include @@ -131,7 +130,7 @@ inline void fillClusterHistograms(o2::framework::HistogramRegistry* fRegistry, T } } - if constexpr (HasPrimaries && IsTrackContainer) { + if constexpr (HasPrimaries && IsFullTrackContainer) { for (const auto& primTrack : primTracks) { if (do2DQA) { fillTrackQA2D(fRegistry, HIST(ClusterTypes[cls_id]), e, primTrack.deltaEta(), primTrack.deltaPhi(), primTrack.trackP(), primTrack.trackPt(), weight); @@ -141,7 +140,7 @@ inline void fillClusterHistograms(o2::framework::HistogramRegistry* fRegistry, T } } - if constexpr (HasSecondaries && IsTrackContainer) { + if constexpr (HasSecondaries && IsFullTrackContainer) { for (const auto& secTrack : secTracks) { const auto trackP = secTrack.trackP(); if (do2DQA) { @@ -167,11 +166,11 @@ inline void fillClusterHistograms(o2::framework::HistogramRegistry* fRegistry, T // primary matched tracks are stored directly inside cluster fRegistry->fill(HIST(ClusterTypes[cls_id]) + HIST("hNTracks"), cluster.deltaEta().size(), weight); - } else if constexpr (HasPrimaries && IsTrackContainer) { + } else if constexpr (HasPrimaries && IsFullTrackContainer) { // primary matched tracks are stored as their own table fRegistry->fill(HIST(ClusterTypes[cls_id]) + HIST("hNTracks"), primTracks.size(), weight); } - if constexpr (HasSecondaries && IsTrackContainer) { + if constexpr (HasSecondaries && IsFullTrackContainer) { // secondary matched tracks are stored as their own table fRegistry->fill(HIST(ClusterTypes[cls_id]) + HIST("hNSecTracks"), secTracks.size(), weight); } diff --git a/PWGEM/PhotonMeson/Utils/EventHistograms.h b/PWGEM/PhotonMeson/Utils/EventHistograms.h index 78d09e75533..e63216a4821 100644 --- a/PWGEM/PhotonMeson/Utils/EventHistograms.h +++ b/PWGEM/PhotonMeson/Utils/EventHistograms.h @@ -19,13 +19,13 @@ #include "Common/CCDB/EventSelectionParams.h" #include "Common/CCDB/TriggerAliases.h" -#include #include #include #include #include +#include #include namespace o2::aod::pwgem::photonmeson::utils::eventhistogram diff --git a/PWGEM/PhotonMeson/Utils/HNMUtilities.h b/PWGEM/PhotonMeson/Utils/HNMUtilities.h index 9b25201ba54..d8c7698e185 100644 --- a/PWGEM/PhotonMeson/Utils/HNMUtilities.h +++ b/PWGEM/PhotonMeson/Utils/HNMUtilities.h @@ -21,7 +21,6 @@ #include "PWGEM/PhotonMeson/Utils/PairUtilities.h" #include -#include #include #include diff --git a/PWGEM/PhotonMeson/Utils/NMHistograms.h b/PWGEM/PhotonMeson/Utils/NMHistograms.h index 0f9ce03767a..ac361d9783e 100644 --- a/PWGEM/PhotonMeson/Utils/NMHistograms.h +++ b/PWGEM/PhotonMeson/Utils/NMHistograms.h @@ -19,7 +19,6 @@ #include "PWGEM/PhotonMeson/Utils/MCUtilities.h" #include -#include #include #include #include diff --git a/PWGEM/PhotonMeson/Utils/PCMUtilities.h b/PWGEM/PhotonMeson/Utils/PCMUtilities.h index 29000d78de0..8c88d20ccad 100644 --- a/PWGEM/PhotonMeson/Utils/PCMUtilities.h +++ b/PWGEM/PhotonMeson/Utils/PCMUtilities.h @@ -21,7 +21,6 @@ #include #include -#include #include #include #include diff --git a/PWGEM/PhotonMeson/Utils/PairUtilities.h b/PWGEM/PhotonMeson/Utils/PairUtilities.h index 0ae25250e0f..691013f8100 100644 --- a/PWGEM/PhotonMeson/Utils/PairUtilities.h +++ b/PWGEM/PhotonMeson/Utils/PairUtilities.h @@ -18,7 +18,6 @@ #include "Common/Core/RecoDecay.h" #include -#include #include #include diff --git a/PWGEM/PhotonMeson/Utils/TrackSelection.h b/PWGEM/PhotonMeson/Utils/TrackSelection.h index c511a00a0b0..0b9b70b0090 100644 --- a/PWGEM/PhotonMeson/Utils/TrackSelection.h +++ b/PWGEM/PhotonMeson/Utils/TrackSelection.h @@ -16,7 +16,6 @@ #ifndef PWGEM_PHOTONMESON_UTILS_TRACKSELECTION_H_ #define PWGEM_PHOTONMESON_UTILS_TRACKSELECTION_H_ -#include #include #include