Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions PWGEM/PhotonMeson/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ add_subdirectory(Core)

add_subdirectory(Tasks)
add_subdirectory(TableProducer)

#add_subdirectory(Legacy)
1 change: 0 additions & 1 deletion PWGEM/PhotonMeson/Core/DalitzEECut.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include "PWGEM/Dilepton/Utils/PairUtilities.h"

#include <CommonConstants/PhysicsConstants.h>
#include <Framework/ASoA.h>
#include <Framework/Concepts.h>

#include <Math/Vector4D.h> // IWYU pragma: keep (do not replace with Math/Vector4Dfwd.h)
Expand Down
2 changes: 1 addition & 1 deletion PWGEM/PhotonMeson/Core/EMCPhotonCut.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <cstddef>
#include <string>

std::array<std::string, static_cast<std::size_t>(EMCPhotonCut::EMCPhotonCuts::kNCuts)> EMCPhotonCut::mCutNames = {"Definition", "Energy", "NCell", "M02", "Timing", "TrackMatching", "SecTrackMatching", "Exotic"};
const std::array<std::string, static_cast<std::size_t>(EMCPhotonCut::EMCPhotonCuts::kNCuts)> EMCPhotonCut::mCutNames = {"Definition", "Energy", "NCell", "M02", "Timing", "TrackMatching", "SecTrackMatching", "Exotic"};

void EMCPhotonCut::SetClusterizer(const std::string& clusterDefinitionString)
{
Expand Down
52 changes: 27 additions & 25 deletions PWGEM/PhotonMeson/Core/EMCPhotonCut.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <CommonConstants/MathConstants.h>
Expand All @@ -29,6 +30,7 @@

#include <sys/types.h>

#include <array>
#include <cmath>
#include <concepts>
#include <cstddef>
Expand Down Expand Up @@ -61,7 +63,7 @@ concept IsNonLinContainer = o2::soa::is_table<T> && requires(T t) {
};

template <typename T>
concept IsTrackIterator = o2::soa::is_iterator<T> && requires(T t) {
concept IsFullTrackIterator = o2::soa::is_iterator<T> && !o2::soa::is_filtered_iterator<T> && requires(T t) {
// Check that the *elements* of the container have the required methods:
{ t.deltaEta() } -> std::same_as<float>;
{ t.deltaPhi() } -> std::same_as<float>;
Expand All @@ -70,7 +72,7 @@ concept IsTrackIterator = o2::soa::is_iterator<T> && requires(T t) {
};

template <typename T>
concept IsTrackContainer = o2::soa::is_table<T> && requires(T t) {
concept IsFullTrackContainer = o2::soa::is_table<T> && o2::soa::is_not_filtered_table<T> && requires(T t) {
// Check that the *elements* of the container have the required methods:
{ t.begin().deltaEta() } -> std::same_as<float>;
{ t.begin().deltaPhi() } -> std::same_as<float>;
Expand Down Expand Up @@ -134,7 +136,7 @@ class EMCPhotonCut
const std::string& getName() const { return name; }
const std::string& getTitle() const { return title; }

static std::array<std::string, static_cast<std::size_t>(EMCPhotonCut::EMCPhotonCuts::kNCuts)> mCutNames;
static const std::array<std::string, static_cast<std::size_t>(EMCPhotonCut::EMCPhotonCuts::kNCuts)> mCutNames;

static constexpr auto getClusterId(o2::soa::is_iterator auto const& t)
{
Expand Down Expand Up @@ -198,26 +200,26 @@ 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
if (getClusterId(emcmatchedtrack) > cluster.globalIndex()) {
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());
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand All @@ -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)) {
Expand Down Expand Up @@ -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<int>(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<int>(EMCPhotonCuts::kSecondaryTM) + 1, cluster.e());
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -518,7 +520,7 @@ class EMCPhotonCut
return mMinTime <= cluster.time() && cluster.time() <= mMaxTime;

case EMCPhotonCuts::kTM: {
if constexpr (IsTrackContainer<TMatchedTracks>) {
if constexpr (IsFullTrackContainer<TMatchedTracks>) {
for (const auto& emcmatchedtrack : emcmatchedtracks) {
auto dEta = std::fabs(emcmatchedtrack.deltaEta());
auto dPhi = std::fabs(emcmatchedtrack.deltaPhi());
Expand Down Expand Up @@ -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<TMatchedTracks>) {
if constexpr (IsFullTrackContainer<TMatchedTracks>) {
for (const auto& emcmatchedtrack : emcmatchedtracks) {
auto dEta = std::fabs(emcmatchedtrack.deltaEta());
auto dPhi = std::fabs(emcmatchedtrack.deltaPhi());
Expand Down
7 changes: 3 additions & 4 deletions PWGEM/PhotonMeson/Core/PHOSPhotonCut.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@

#include <Framework/Logger.h>

#include <Rtypes.h>
#include <array>
#include <string>

ClassImp(PHOSPhotonCut);

const char* PHOSPhotonCut::mCutNames[static_cast<int>(PHOSPhotonCut::PHOSPhotonCuts::kNCuts)] = {"Energy", "Dispersion", "CPV"};
const std::array<std::string, static_cast<int>(PHOSPhotonCut::PHOSPhotonCuts::kNCuts)> PHOSPhotonCut::mCutNames = {"Energy", "Dispersion", "CPV"};

void PHOSPhotonCut::SetEnergyRange(float min, float max)
{
Expand Down
15 changes: 7 additions & 8 deletions PWGEM/PhotonMeson/Core/PHOSPhotonCut.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
#ifndef PWGEM_PHOTONMESON_CORE_PHOSPHOTONCUT_H_
#define PWGEM_PHOTONMESON_CORE_PHOSPHOTONCUT_H_

#include <Framework/ASoA.h>
#include <Framework/Concepts.h>

#include <array>
#include <cmath>
#include <string>

class PHOSPhotonCut
Expand All @@ -34,10 +35,10 @@
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<int>(PHOSPhotonCuts::kNCuts)];
static const std::array<std::string, static_cast<int>(PHOSPhotonCuts::kNCuts)> mCutNames;

// Temporary function to check if track passes selection criteria. To be replaced by framework filters.
template <o2::soa::is_iterator Cluster>
Expand All @@ -55,17 +56,17 @@
}

// 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())) {

Check failure on line 62 in PWGEM/PhotonMeson/Core/PHOSPhotonCut.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
return false;
}

if (cluster.m20() < 0.1 || 2.0 < cluster.m20()) {

Check failure on line 66 in PWGEM/PhotonMeson/Core/PHOSPhotonCut.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
return false;
}
if (cluster.m02() > 4.0) {

Check failure on line 69 in PWGEM/PhotonMeson/Core/PHOSPhotonCut.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
return false;
}

Expand All @@ -81,8 +82,6 @@
return cls.e() >= mMinEnergy && cls.e() <= mMaxEnergy;

case PHOSPhotonCuts::kDispersion:
return true;

case PHOSPhotonCuts::kCPV:
return true;

Expand Down
8 changes: 4 additions & 4 deletions PWGEM/PhotonMeson/Core/PairCut.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@

#include <Framework/Logger.h>

#include <Rtypes.h>
#include <array>
#include <cstddef>
#include <string>

ClassImp(PairCut);

const char* PairCut::mCutNames[static_cast<int>(PairCut::PairCuts::kNCuts)] = {"Asym"};
const std::array<std::string, static_cast<std::size_t>(PairCut::PairCuts::kNCuts)> PairCut::mCutNames = {"Asym"};

void PairCut::SetAsymRange(float min, float max)
{
Expand Down
17 changes: 8 additions & 9 deletions PWGEM/PhotonMeson/Core/PairCut.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
#ifndef PWGEM_PHOTONMESON_CORE_PAIRCUT_H_
#define PWGEM_PHOTONMESON_CORE_PAIRCUT_H_

#include <array>
#include <cmath>
#include <cstddef>
#include <string>

class PairCut
Expand All @@ -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<int>(PairCuts::kNCuts)];
static const std::array<std::string, static_cast<std::size_t>(PairCuts::kNCuts)> mCutNames;

template <typename G1, typename G2>
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 <typename U1, typename U2, typename G1, typename G2>
Expand All @@ -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;
}
Expand Down
Loading
Loading