25 #include <momemta/Types.h> 34 template <
class T> std::vector<typename T::Scalar> toVector(
const T& v) {
35 return {v.E(), v.Px(), v.Py(), v.Pz()};
48 std::vector<std::size_t> get_permutations(
const std::vector<T>& from,
const std::vector<T>& to) {
50 std::vector<std::size_t> p(from.size());
52 std::transform(from.begin(), from.end(), p.begin(), [&from, &to](
const T& item) -> std::size_t {
53 return std::distance(to.begin(), std::find(to.begin(), to.end(), item));
68 void apply_permutations(std::vector<T>& vec, std::vector<std::size_t>
const& p) {
69 std::vector<T> sorted_vec(p.size());
70 std::transform(p.begin(), p.end(), sorted_vec.begin(), [&vec](
int i) {
return vec[i]; });
83 LorentzVector getRandom4Vector(
double maxE,
double m=0);
85 std::string demangle(
const char* name);
89 inline unsigned int createFlagsBitset(
char verbosity,
bool subregion,
bool retainStateFile,
90 unsigned int level,
bool smoothing,
91 bool takeOnlyGridFromFile) {
93 unsigned int flags = 0;
95 static unsigned int opt_subregion = 0x04;
96 static unsigned int opt_smoothing = 0x08;
97 static unsigned int opt_retainStateFile = 0x10;
98 static unsigned int opt_takeOnlyGridFromFile = 0x20;
101 flags |= level | verbosity;
103 flags |= opt_subregion;
105 flags |= opt_smoothing;
107 flags |= opt_retainStateFile;
108 if (takeOnlyGridFromFile)
109 flags |= opt_takeOnlyGridFromFile;