9 typedef std::pair<double,double>
pair;
10 typedef std::vector<pair>
array;
16 N( 1 + h->GetNbinsX()),
18 {
for(
int i=0;
i<
N;
i++) {
19 const double H = h->GetBinContent(
i) + (!
head.empty()?
head.back().second:0);
20 const double T = h->GetBinContent(N-
i) + (!
tail.empty()?
tail.back().second:0);
21 if(H)
head.push_back(
pair( h->GetBinWidth(
i) + h->GetBinLowEdge(
i) ,
H));
22 if(T)
tail.push_back(
pair( h->GetBinLowEdge(N-
i),
T));
32 const double f = frac<0.5 ? frac : 1-
frac ;
34 begin( ( (frac<0.5) == fromHead ) ?
head.begin() :
tail.begin()),
35 end( ( (frac<0.5) == fromHead ) ?
head.end() :
tail.end()),
40 if(
bin==begin )
return pair(-1,0);
45 binPPrev(
prev(binPrev,begin));
48 DX( binNext->first - binPPrev->first ),
49 DY( (binNext->second - binPPrev->second)/Total ),
51 dX(
bin->first - binPrev->first ),
52 dY( (
bin->second - binPrev->second)/Total ),
54 avgX( (
bin->first + binPrev->first) /2 ),
55 avgY( (
bin->second + binPrev->second) /(2*Total) ),
57 x_q( avgX + dX/dY * ( f - avgY ) ),
58 xerr_q(
std::max(fabs(DX/DY),fabs(dX/dY)) *
sqrt(f*(1-f)/Total) );
60 return pair(x_q,xerr_q);
66 while( binPrev > begin &&
74 while( binNext<end-1 &&
75 (++binNext)->
second == bin->second)
T next(T bin, T end) const
pair operator[](const double frac) const
pair operator()(const double frac) const
std::pair< double, double > pair
U second(std::pair< T, U > const &p)
bin
set the eta bin as selection string.
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::vector< pair > array