19 #include <momemta/Module.h> 23 #include <momemta/config.h> 24 #include <momemta/ParameterSet.h> 25 #include <momemta/Solution.h> 34 #define CALL(X) { for (auto& m: path.modules()) \ 117 solutions = pool->get<SolutionCollection>(parameters.get<
InputTag>(
"solutions"));
119 path = parameters.get<
Path>(
"path");
127 CALL(beginIntegration);
131 CALL(endIntegration);
134 LOG(info) <<
"Time spent evaluating modules of looper " << name() <<
":";
135 for (
auto it: m_timings) {
136 LOG(info) <<
" " << it.first->name() <<
": " << duration_cast<duration<double>>(it.second).count() <<
"s";
149 virtual Status
work()
override {
154 auto status = Status::OK;
157 for (
const auto& s: *solutions) {
161 *particles = s.values;
162 *jacobian = s.jacobian;
164 for (
auto& m: path.modules()) {
166 auto start = high_resolution_clock::now();
168 auto module_status = m->work();
170 m_timings[m.get()] += high_resolution_clock::now() - start;
173 if (module_status == Status::OK)
175 else if (module_status == Status::NEXT)
178 status = module_status;
183 if (status != Status::OK)
199 std::shared_ptr<std::vector<LorentzVector>> particles = produce<std::vector<LorentzVector>>(
"particles");
200 std::shared_ptr<double> jacobian = produce<double>(
"jacobian");
203 std::unordered_map<Module*, std::chrono::high_resolution_clock::duration> m_timings;
A module looping over a set of solutions.
virtual void beginIntegration() override
Called once at the beginning of the integration.
virtual void beginPoint() override
Called once when a new PS point is started.
virtual Status work() override
Main function.
Parent class for all the modules.
A class encapsulating a lua table.
virtual void endIntegration() override
Called once at the end of the integration.
virtual void endPoint() override
Called once when a PS point is finished.
virtual void configure() override
Called once at the beginning of the job.