Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
kjvbrt committed Sep 20, 2024
1 parent 7bb7979 commit 2050c6e
Show file tree
Hide file tree
Showing 5 changed files with 548 additions and 603 deletions.
153 changes: 73 additions & 80 deletions analyzers/dataframe/FCCAnalyses/LinkSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,96 +4,89 @@
// EDM4hep
#include "edm4hep/RecoMCParticleLinkCollection.h"


namespace FCCAnalyses :: Source :: Link {
/**
* \brief Analyzer to select links where the MC particle has a specified PDG
* ID.
*
* \param[in] pdg Desired PDG ID of the MC particle.
*/
struct sel_PDG {
const int m_pdg;

explicit sel_PDG(const int pdg) : m_pdg(pdg) {};

template <typename T>
T operator() (const T& inLinkColl) {
T result;
result.setSubsetCollection();

for (const auto& link: inLinkColl) {
const auto& particle = link.getTo();
if (particle.getPDG() == m_pdg) {
result.push_back(link);
}
namespace FCCAnalyses ::Source ::Link {
/**
* \brief Analyzer to select links where the MC particle has a specified PDG
* ID.
*
* \param[in] pdg Desired PDG ID of the MC particle.
*/
struct sel_PDG {
const int m_pdg;

explicit sel_PDG(const int pdg) : m_pdg(pdg){};

template <typename T> T operator()(const T &inLinkColl) {
T result;
result.setSubsetCollection();

for (const auto &link : inLinkColl) {
const auto &particle = link.getTo();
if (particle.getPDG() == m_pdg) {
result.push_back(link);
}
}

return result;
return result;
}
};

/**
* \brief Analyzer to select links where MC particle has a specified absolute
* value of PDG ID.
*
* \param pdg[in] Desired absolute value of PDG ID of the MC particle.
*/
struct sel_absPDG {
const int m_pdg;

explicit sel_absPDG(const int pdg) : m_pdg(pdg) {
if (m_pdg < 0) {
throw std::invalid_argument(
"FCCAnalyses::Source::Link::sel_absPDG: Received negative value!");
}
};

template <typename T> auto operator()(const T &inLinkColl) {
T result;
result.setSubsetCollection();


/**
* \brief Analyzer to select links where MC particle has a specified absolute
* value of PDG ID.
*
* \param pdg[in] Desired absolute value of PDG ID of the MC particle.
*/
struct sel_absPDG {
const int m_pdg;

explicit sel_absPDG(const int pdg) : m_pdg(pdg) {
if (m_pdg < 0) {
throw std::invalid_argument(
"FCCAnalyses::Source::Link::sel_absPDG: Received negative value!");
}
};

template <typename T>
auto operator() (const T& inLinkColl) {
T result;
result.setSubsetCollection();

for (const auto& link: inLinkColl) {
const auto& particle = link.getTo();
if (std::abs(particle.getPDG()) == m_pdg) {
result.push_back(link);
}
for (const auto &link : inLinkColl) {
const auto &particle = link.getTo();
if (std::abs(particle.getPDG()) == m_pdg) {
result.push_back(link);
}
}

return result;
};
return result;
};


/**
* \brief Analyzer to select links where the MC particle has a specified
* generator status.
*
* \param status[in] Desired generator status of the particle.
*/
struct sel_genStatus {
const int m_status;

explicit sel_genStatus(const int status) : m_status(status) {};

template <typename T>
T operator() (const T& inLinkColl) {
T result;
result.setSubsetCollection();

for (const auto& link: inLinkColl) {
const auto& particle = link.getTo();
if (particle.getGeneratorStatus() == m_status) {
result.push_back(link);
}
};

/**
* \brief Analyzer to select links where the MC particle has a specified
* generator status.
*
* \param status[in] Desired generator status of the particle.
*/
struct sel_genStatus {
const int m_status;

explicit sel_genStatus(const int status) : m_status(status){};

template <typename T> T operator()(const T &inLinkColl) {
T result;
result.setSubsetCollection();

for (const auto &link : inLinkColl) {
const auto &particle = link.getTo();
if (particle.getGeneratorStatus() == m_status) {
result.push_back(link);
}

return result;
}
};
} /* FCCAnalyses::Source::Link */

return result;
}
};
} // namespace FCCAnalyses::Source::Link

#endif /* SOURCE_LINK_ANALYZERS_H */
Loading

0 comments on commit 2050c6e

Please sign in to comment.