-
Notifications
You must be signed in to change notification settings - Fork 7
/
isolation.h
77 lines (55 loc) · 2.12 KB
/
isolation.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// -*- mode: c++; -*-
#ifndef ISOLATION_H_
#define ISOLATION_H_
#include <algorithm>
namespace {
// ROOT ACLiC weirdness is preventing delta_vs_iso from being
// declared const
double frixione_iso_max_x_e_eps(std::vector<std::pair<
double, double> >
delta_vs_iso,
double delta_0, double n)
{
if (delta_vs_iso.empty()) {
return 0;
}
std::sort(delta_vs_iso.begin(), delta_vs_iso.end());
double sum_iso = 0;
double max_x_e_eps = -INFINITY;
const double one_cos_delta_0 = 1 - cos(delta_0);
for (std::vector<std::pair<double, double> >::
const_iterator iterator = delta_vs_iso.begin();
iterator != delta_vs_iso.end(); iterator++) {
const double delta = iterator->first;
sum_iso += iterator->second;
const double x_e_eps = sum_iso *
pow(one_cos_delta_0 / (1 - cos(delta)), n);
max_x_e_eps = std::max(max_x_e_eps, x_e_eps);
}
return max_x_e_eps;
}
double anti_frixione_iso_max_x_e_eps(std::vector<std::pair<
double, double> >
delta_vs_iso,
double delta_0, double n)
{
if (delta_vs_iso.empty()) {
return 0;
}
std::sort(delta_vs_iso.begin(), delta_vs_iso.end());
double sum_iso = 0;
double min_x_e_eps = INFINITY;
const double one_cos_delta_0 = 1 - cos(delta_0);
for (std::vector<std::pair<double, double> >::
const_iterator iterator = delta_vs_iso.begin();
iterator != delta_vs_iso.end(); iterator++) {
const double delta = iterator->first;
sum_iso += iterator->second;
const double x_e_eps = sum_iso *
pow(one_cos_delta_0 / (1 - cos(delta)), n);
min_x_e_eps = std::min(min_x_e_eps, x_e_eps);
}
return min_x_e_eps;
}
}
#endif // ISOLATION_H_