-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
258 additions
and
48 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#ifndef ASSOCIATION_ANALYZERS_H | ||
#define ASSOCIATION_ANALYZERS_H | ||
|
||
// EDM4hep | ||
#include "edm4hep/MCRecoParticleAssociationCollection.h" | ||
|
||
|
||
namespace FCCAnalyses :: Association { | ||
/** | ||
* \brief Analyzer to select associations with a mcparticle with a | ||
* specified PDG ID. | ||
* | ||
* \param pdg Desired PDG ID of the partile. | ||
*/ | ||
struct sel_PDG { | ||
sel_PDG(const int pdg); | ||
const int m_pdg; | ||
template <typename T> | ||
T operator() ( | ||
const T& inAssocColl); | ||
}; | ||
|
||
|
||
/** | ||
* \brief Analyzer to select associations with a mcparticle with a | ||
* specified absolute value of PDG ID. | ||
* | ||
* \param pdg Desired absolute value of PDG ID of the partile. | ||
*/ | ||
struct sel_absPDG { | ||
const int m_pdg; | ||
|
||
sel_absPDG(const int pdg) : m_pdg(pdg) { | ||
if (m_pdg < 0) { | ||
throw std::invalid_argument( | ||
"Association::sel_absPDG: Received negative value!"); | ||
} | ||
}; | ||
|
||
template <typename T> | ||
auto operator() (const T& inAssocColl) { | ||
T result; | ||
result.setSubsetCollection(); | ||
|
||
for (const auto& assoc: inAssocColl) { | ||
const auto& particle = assoc.getSim(); | ||
if (std::abs(particle.getPDG()) == m_pdg) { | ||
result.push_back(assoc); | ||
} | ||
} | ||
|
||
return result; | ||
}; | ||
}; | ||
|
||
|
||
/** | ||
* \brief Analyzer to select associations with a mcparticle with a | ||
* specified generator status. | ||
* | ||
* \param pdg Desired generator status of the partile. | ||
*/ | ||
struct sel_genStatus { | ||
sel_genStatus(const int status); | ||
const int m_status; | ||
template <typename T> | ||
T operator() ( | ||
const T& inAssocColl); | ||
}; | ||
} /* FCCAnalyses::Association */ | ||
|
||
#endif /* ASSOCIATION_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
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,68 @@ | ||
#include "FCCAnalyses/Association.h" | ||
|
||
// std | ||
#include <cstdlib> | ||
#include <cmath> | ||
|
||
|
||
namespace FCCAnalyses :: Association { | ||
sel_PDG::sel_PDG(const int pdg) : m_pdg(pdg) {}; | ||
|
||
template <typename T> | ||
T sel_PDG::operator() (const T& inAssocColl) { | ||
T result; | ||
result.setSubsetCollection(); | ||
|
||
for (const auto& assoc: inAssocColl) { | ||
const auto& particle = assoc.getSim(); | ||
if (particle.getPDG() == m_pdg) { | ||
result.push_back(assoc); | ||
} | ||
} | ||
|
||
return result; | ||
} | ||
|
||
|
||
/* | ||
sel_absPDG::sel_absPDG(const int pdg) : m_pdg(pdg) { | ||
if (m_pdg < 0) { | ||
throw std::invalid_argument( | ||
"Association::sel_absPDG: Received negative value!"); | ||
} | ||
} | ||
template <typename T> | ||
auto sel_absPDG::operator() (const T& inAssocColl) { | ||
T result; | ||
result.setSubsetCollection(); | ||
for (const auto& assoc: inAssocColl) { | ||
const auto& particle = assoc.getSim(); | ||
if (std::abs(particle.getPDG()) == m_pdg) { | ||
result.push_back(assoc); | ||
} | ||
} | ||
return result; | ||
} | ||
*/ | ||
|
||
|
||
sel_genStatus::sel_genStatus(const int status) : m_status(status) {}; | ||
|
||
template <typename T> | ||
T sel_genStatus::operator() (const T& inAssocColl) { | ||
T result; | ||
result.setSubsetCollection(); | ||
|
||
for (const auto& assoc: inAssocColl) { | ||
const auto& particle = assoc.getSim(); | ||
if (particle.getGeneratorStatus() == m_status) { | ||
result.push_back(assoc); | ||
} | ||
} | ||
|
||
return result; | ||
} | ||
} /* FCCAnalyses::Association */ |
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.