9 typedef std::pair<double, double>
pair;
10 typedef std::vector<pair>
array;
16 for (
int i = 0;
i <
N;
i++) {
17 const double H = h->GetBinContent(
i) + (!
head.empty() ?
head.back().second : 0);
18 const double T = h->GetBinContent(N -
i) + (!
tail.empty() ?
tail.back().second : 0);
20 head.push_back(
pair(h->GetBinWidth(
i) + h->GetBinLowEdge(
i),
H));
22 tail.push_back(
pair(h->GetBinLowEdge(N -
i),
T));
31 const double f = frac < 0.5 ? frac : 1 -
frac;
32 array::const_iterator
begin(((frac < 0.5) == fromHead) ?
head.begin() :
tail.begin()),
41 array::const_iterator binNext(
next(
bin,
end)), binPrev(
prev(
bin, begin)), binPPrev(
prev(binPrev, begin));
43 const double DX(binNext->first - binPPrev->first), DY((binNext->second - binPPrev->second) / Total),
45 dX(
bin->first - binPrev->first), dY((
bin->second - binPrev->second) / Total),
47 avgX((
bin->first + binPrev->first) / 2), avgY((
bin->second + binPrev->second) / (2 * Total)),
49 x_q(avgX + dX / dY * (f - avgY)), xerr_q(
std::max(fabs(DX / DY), fabs(dX / dY)) *
sqrt(f * (1 - f) / Total));
51 return pair(x_q, xerr_q);
57 while (binPrev > begin && (binPrev - 1)->
second == (bin - 1)->
second)
65 while (binNext < end - 1 && (++binNext)->
second == bin->second)
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
T next(T bin, T end) const
pair operator[](const double frac) const
pair operator()(const double frac) const
U second(std::pair< T, U > const &p)
pair fromHead(const double frac) const
pair calculateQ(const double frac, const bool fromHead) const
T prev(T bin, T begin) const
pair fromTail(const double frac) const
std::pair< double, double > pair
std::vector< pair > array