forked from HEP-FCC/FCCAnalyses
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'HEP-FCC:master' into master
- Loading branch information
Showing
48 changed files
with
2,038 additions
and
189 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ __pycache__/ | |
# Editors | ||
*~ | ||
.vimlocal | ||
.cache/ | ||
|
||
# Distribution / packaging | ||
.Python | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
#ifndef SOURCE_LINK_ANALYZERS_H | ||
#define SOURCE_LINK_ANALYZERS_H | ||
|
||
// EDM4hep | ||
#include "edm4hep/RecoMCParticleLinkCollection.h" | ||
|
||
namespace FCCAnalyses ::PodioSource ::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 selPDG { | ||
const int m_pdg; | ||
|
||
explicit selPDG(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; | ||
} | ||
}; | ||
|
||
/** | ||
* \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 selAbsPDG { | ||
const int m_pdg; | ||
|
||
explicit selAbsPDG(const int pdg) : m_pdg(pdg) { | ||
if (m_pdg < 0) { | ||
throw std::invalid_argument("FCCAnalyses::PodioSource::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); | ||
} | ||
} | ||
|
||
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 selGenStatus { | ||
const int m_status; | ||
|
||
explicit selGenStatus(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; | ||
} | ||
}; | ||
} // namespace FCCAnalyses::PodioSource::Link | ||
|
||
#endif /* SOURCE_LINK_ANALYZERS_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.