Skip to content
Open
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
6 changes: 2 additions & 4 deletions PWGJE/Core/JetCandidateUtilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
if (!particle.has_daughters()) {
return false;
}
for (auto daughter : particle.template daughters_as<typename std::decay_t<T>::parent_t>()) {

Check failure on line 148 in PWGJE/Core/JetCandidateUtilities.h

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
if (daughter.globalIndex() == globalIndex) {
return true;
}
Expand Down Expand Up @@ -188,15 +188,13 @@
auto matchedParticle(const T& candidate, const U& tracks, const V& particles)
{
if constexpr (jethfutilities::isHFCandidate<T>()) {
bool isMatched = false;
return jethfutilities::matchedHFParticle(candidate, tracks, particles, isMatched);
return jethfutilities::matchedHFParticle(candidate, tracks, particles);
} else if constexpr (jetv0utilities::isV0Candidate<T>()) {
return jetv0utilities::matchedV0Particle(candidate, tracks, particles);
} else if constexpr (jetdqutilities::isDielectronCandidate<T>()) {
return jetdqutilities::matchedDielectronParticle(candidate, tracks, particles);
} else {
bool isMatched = false;
return jethfutilities::matchedHFParticle(candidate, tracks, particles, isMatched); // this is a dummy output which should never be triggered
return jethfutilities::matchedHFParticle(candidate, tracks, particles); // this is a dummy output which should never be triggered
}
}

Expand Down
146 changes: 72 additions & 74 deletions PWGJE/Core/JetDQUtilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,74 @@ constexpr bool isDielectronMcTable()
return isDielectronMcCandidate<typename T::iterator>() || isDielectronMcCandidate<typename T::filtered_iterator>();
}

/**
* returns the PDG of the candidate based on Dielectron Table
*
* @param candidate dielectron candidate that is being checked
*/
template <typename T>
int getDielectronCandidatePDG(T const& /*candidate*/)
{
if constexpr (isDielectronCandidate<T>() || isDielectronMcCandidate<T>()) {
return static_cast<int>(o2::constants::physics::Pdg::kJPsi);
} else {
return 0;
}
}

/**
* returns the PDG of the candidates in the table type
*/
template <typename T>
int getDielectronTablePDG()
{
if constexpr (isDielectronTable<T>() || isDielectronMcTable<T>()) {
return static_cast<int>(o2::constants::physics::Pdg::kJPsi);
} else {
return 0;
}
}

/**
* returns the mass of the candidate based on Dielectron Table
*
* @param candidate dielectron candidate that is being checked
*/
template <typename T>
float getDielectronCandidatePDGMass(T const& /*candidate*/)
{
if constexpr (isDielectronCandidate<T>() || isDielectronMcCandidate<T>()) {
return static_cast<float>(o2::constants::physics::MassJPsi);
} else {
return -1.0;
}
}

/**
* returns the mass of the candidates in the table type
*
*/
template <typename T>
float getDielectronTablePDGMass()
{
if constexpr (isDielectronTable<T>() || isDielectronMcTable<T>()) {
return static_cast<float>(o2::constants::physics::MassJPsi);
} else {
return -1.0;
}
}

/**
* returns the mass of the candidate based on Dielectron Table
*
* @param candidate dielectron candidate that is being checked
*/
template <typename T>
float getDielectronCandidateInvariantMass(T const& candidate)
{
return candidate.mass();
}

/**
* returns true if the candidate is matched to a reconstructed level candidate with the correct decay
* * @param candidate candidate that is being checked
Expand Down Expand Up @@ -117,10 +185,9 @@ bool isDielectronDaughterTrack(T& track, U& candidate)
* @param particles particle table
*/
template <typename T, typename U, typename V>
auto matchedDielectronParticleId(const T& candidate, const U& /*tracks*/, const V& /*particles*/)
auto matchedDielectronParticleId(const T& candidate, const U& /*tracks*/, const V& particles)
{
const auto candidateDaughterParticle = candidate.template prong1_as<U>().template mcParticle_as<V>();
return candidateDaughterParticle.template mothers_first_as<V>().globalIndex(); // can we get the Id directly?
return RecoDecay::getMother(particles, candidate.template prong0_as<U>().template mcParticle_as<V>(), getDielectronCandidatePDG(candidate), true);
Comment thread
nzardosh marked this conversation as resolved.
}

/**
Expand All @@ -131,10 +198,9 @@ auto matchedDielectronParticleId(const T& candidate, const U& /*tracks*/, const
* @param particles particle table
*/
template <typename T, typename U, typename V>
auto matchedDielectronParticle(const T& candidate, const U& /*tracks*/, const V& /*particles*/)
auto matchedDielectronParticle(const T& candidate, const U& /*tracks*/, const V& particles)
{
const auto candidateDaughterParticle = candidate.template prong1_as<U>().template mcParticle_as<V>();
return candidateDaughterParticle.template mothers_first_as<V>();
return particles.iteratorAt(RecoDecay::getMother(particles, candidate.template prong0_as<U>().template mcParticle_as<V>(), getDielectronCandidatePDG(candidate), true));
}

/**
Expand Down Expand Up @@ -195,74 +261,6 @@ int getDielectronMcCandidateCollisionId(T const& candidate)
}
}

/**
* returns the PDG of the candidate based on Dielectron Table
*
* @param candidate dielectron candidate that is being checked
*/
template <typename T>
int getDielectronCandidatePDG(T const& /*candidate*/)
{
if constexpr (isDielectronCandidate<T>() || isDielectronMcCandidate<T>()) {
return static_cast<int>(o2::constants::physics::Pdg::kJPsi);
} else {
return 0;
}
}

/**
* returns the PDG of the candidates in the table type
*/
template <typename T>
int getDielectronTablePDG()
{
if constexpr (isDielectronTable<T>() || isDielectronMcTable<T>()) {
return static_cast<int>(o2::constants::physics::Pdg::kJPsi);
} else {
return 0;
}
}

/**
* returns the mass of the candidate based on Dielectron Table
*
* @param candidate dielectron candidate that is being checked
*/
template <typename T>
float getDielectronCandidatePDGMass(T const& /*candidate*/)
{
if constexpr (isDielectronCandidate<T>() || isDielectronMcCandidate<T>()) {
return static_cast<float>(o2::constants::physics::MassJPsi);
} else {
return -1.0;
}
}

/**
* returns the mass of the candidates in the table type
*
*/
template <typename T>
float getDielectronTablePDGMass()
{
if constexpr (isDielectronTable<T>() || isDielectronMcTable<T>()) {
return static_cast<float>(o2::constants::physics::MassJPsi);
} else {
return -1.0;
}
}

/**
* returns the mass of the candidate based on Dielectron Table
*
* @param candidate dielectron candidate that is being checked
*/
template <typename T>
float getDielectronCandidateInvariantMass(T const& candidate)
{
return candidate.mass();
}

template <typename T, typename U>
bool isDielectronParticle(T const& particles, U const& particle)
{
Expand Down
Loading
Loading