FCCAnalyses
Loading...
Searching...
No Matches
LinkSource.h
Go to the documentation of this file.
1#ifndef SOURCE_LINK_ANALYZERS_H
2#define SOURCE_LINK_ANALYZERS_H
3
4// EDM4hep
5#include "edm4hep/RecoMCParticleLinkCollection.h"
6
7namespace FCCAnalyses ::PodioSource ::Link {
14struct selPDG {
15 const int m_pdg;
16
17 explicit selPDG(const int pdg) : m_pdg(pdg){};
18
19 template <typename T> T operator()(const T &inLinkColl) {
20 T result;
21 result.setSubsetCollection();
22
23 for (const auto &link : inLinkColl) {
24 const auto &particle = link.getTo();
25 if (particle.getPDG() == m_pdg) {
26 result.push_back(link);
27 }
28 }
29
30 return result;
31 }
32};
33
40struct selAbsPDG {
41 const int m_pdg;
42
43 explicit selAbsPDG(const int pdg) : m_pdg(pdg) {
44 if (m_pdg < 0) {
45 throw std::invalid_argument("FCCAnalyses::PodioSource::Link::sel_absPDG: "
46 "Received negative value!");
47 }
48 };
49
50 template <typename T> auto operator()(const T &inLinkColl) {
51 T result;
52 result.setSubsetCollection();
53
54 for (const auto &link : inLinkColl) {
55 const auto &particle = link.getTo();
56 if (std::abs(particle.getPDG()) == m_pdg) {
57 result.push_back(link);
58 }
59 }
60
61 return result;
62 };
63};
64
72 const int m_status;
73
74 explicit selGenStatus(const int status) : m_status(status){};
75
76 template <typename T> T operator()(const T &inLinkColl) {
77 T result;
78 result.setSubsetCollection();
79
80 for (const auto &link : inLinkColl) {
81 const auto &particle = link.getTo();
82 if (particle.getGeneratorStatus() == m_status) {
83 result.push_back(link);
84 }
85 }
86
87 return result;
88 }
89};
90} // namespace FCCAnalyses::PodioSource::Link
91
92#endif /* SOURCE_LINK_ANALYZERS_H */
FCC analyzers collection.
Definition Algorithms.h:15