LDMX Software
EventWeights.cxx
1//
2// Created by Wesley Ketchum on 4/28/24.
3//
4
5#include "SimCore/Event/EventWeights.h"
6
7#include <iostream>
8
9namespace ldmx {
10
11std::map<EventWeights::VariationType, double>
12EventWeights::getVariationsNthWeight(size_t i_w) const {
13 std::map<EventWeights::VariationType, double> i_weights_map;
14 for (auto const &v : this->variations_map_)
15 i_weights_map[v.first] = v.second.at(i_w);
16 return i_weights_map;
17}
18
19void EventWeights::clear() {
20 weights_.clear();
21 variations_map_.clear();
22}
23
24std::ostream &operator<<(std::ostream &o, const EventWeights &ew) {
25 o << "Num weights: " << ew.getNumWeights() << std::endl;
26 for (size_t i_w = 0; i_w < ew.getNumWeights(); ++i_w) {
27 o << "\t" << i_w << ": weight=" << ew.getNthWeight(i_w);
28 for (auto const &v : ew.getVariationsNthWeight(i_w)) {
29 o << "\n\t var_type=" << v.first << ", var_value=" << v.second;
30 }
31 o << std::endl;
32 }
33
34 return o;
35}
36
37} // namespace ldmx