19 #include <momemta/ParameterSet.h> 20 #include <momemta/Module.h> 21 #include <momemta/Types.h> 65 m_ps_point = get<double>(parameters.get<
InputTag>(
"ps_point"));
67 auto particle_tags = parameters.get<std::vector<InputTag>>(
"inputs");
68 for (
auto& t: particle_tags)
69 m_inputs.push_back(get<LorentzVector>(t));
71 std::vector<uint32_t> tmp(m_inputs.size());
72 std::iota(tmp.begin(), tmp.end(), 0);
75 perm_indices.push_back(tmp);
76 }
while (std::next_permutation(tmp.begin(), tmp.end()));
78 (*m_output).resize(m_inputs.size());
81 virtual Status
work()
override {
82 double psPoint = *m_ps_point;
84 size_t chosen_perm = std::lround(psPoint * (perm_indices.size() - 1));
86 for (
size_t i = 0; i < m_inputs.size(); i++)
87 (*m_output)[i] = *m_inputs[perm_indices[chosen_perm][i]];
93 std::vector<std::vector<uint32_t>> perm_indices;
97 std::vector<Value<LorentzVector>> m_inputs;
100 std::shared_ptr<std::vector<LorentzVector>> m_output = produce<std::vector<LorentzVector>>(
"output");
Parent class for all the modules.
A class encapsulating a lua table.
virtual Status work() override
Main function.
Apply random permutations to a set of inputs.
Module(PoolPtr pool, const std::string &name)
Constructor.