8 double deltaX = rangeX.second - rangeX.first;
9 double deltaY = rangeY.second - rangeY.first;
10 double length = hypot(deltaX, deltaY);
14 int min_i, max_i, min_j, max_j;
15 if (rangeX.first < rangeX.second) {
16 min_i = (
int)ceil(rangeX.first / stepX);
17 max_i = (
int)floor(rangeX.second / stepX) + 1;
19 min_i = (
int)ceil(rangeX.second / stepX);
20 max_i = (
int)floor(rangeX.first / stepX) + 1;
22 if (rangeY.first < rangeY.second) {
23 min_j = (
int)ceil(rangeY.first / stepY);
24 max_j = (
int)floor(rangeY.second / stepY) + 1;
26 min_j = (
int)ceil(rangeY.second / stepY);
27 max_j = (
int)floor(rangeY.first / stepY) + 1;
30 int steps = max_i - min_i + max_j - min_j + 2;
31 std::vector<position>
v;
35 v.push_back(
position(0., rangeX.first, rangeY.first));
37 for (
int i = min_i;
i < max_i; ++
i) {
39 y = rangeY.first + (x - rangeX.first) * deltaY / deltaX;
40 f = std::fabs((x - rangeX.first) / deltaX);
43 for (
int i = min_j;
i < max_j; ++
i) {
45 x = rangeX.first + (y - rangeY.first) * deltaX / deltaY;
46 f = std::fabs((y - rangeY.first) / deltaY);
49 v.push_back(
position(1., rangeX.second, rangeY.second));
52 std::sort(v.begin(), v.end());
55 std::vector<position>
result;
56 result.push_back(v.front());
57 for (
int i = 1,
s = v.size();
i <
s; ++
i) {
58 double mx = (v[
i].x + v[
i - 1].x) / 2.;
59 double my = (v[
i].y + v[
i - 1].y) / 2.;
60 double df = (v[
i].f - v[
i - 1].f);
63 result.push_back(
position(df, mx, my));
93 for (
size_t i = 0,
s = v.size();
i <
s; ++
i) {
102 const Range&
x,
const Range&
y,
const std::vector<double>&
weight,
double norm,
unsigned int colour) {
106 for (
size_t i = 0,
s = v.size();
i <
s; ++
i) {
120 (*m_normalization)[
i] = 1.;
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
std::vector< position > splitSegment(Range x, Range y) const
split a segment into a vector of points
std::vector< std::shared_ptr< Histogram > > m_histograms
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
void check_weight(const std::vector< double > &weight) noexcept(false)
check the weights passed as an std::vector have the correct size
std::shared_ptr< ColorMap > m_colormap
std::shared_ptr< Histogram > m_normalization
static int position[264][3]
void fill(double x, double y, const std::vector< double > &weight, double norm)
fill one point
void normalize(void)
normalize the histograms
std::pair< double, double > Range