GammaCombo  Rev:Unversioneddirectory
Public Member Functions | Private Member Functions | Private Attributes | List of all members
CLIntervalMaker Class Reference

Class that makes CL intervals from 1-CL histograms. More...

#include <CLIntervalMaker.h>

Collaboration diagram for CLIntervalMaker:
Collaboration graph
[legend]

Public Member Functions

void calcCLintervals ()
 Calculate the CL intervals. More...
 
 CLIntervalMaker (OptParser *arg, const TH1F &pvalues)
 
void findMaxima (float pValueThreshold)
 Finds the maxima of the _pvalue histogram and fills _clintervals1sigma and _clintervals2sigma. More...
 
vector< CLInterval > & getClintervals1sigma ()
 
vector< CLInterval > & getClintervals2sigma ()
 
void print ()
 
void provideMorePreciseMaximum (float value, TString method)
 Add a maximum (e.g. More...
 
 ~CLIntervalMaker ()
 

Private Member Functions

bool binsOnSameSide (int i, float y) const
 Check if the two bins i and (i+1) of the _pvalues histogram are on the same side of y. More...
 
float binToValue (int bin) const
 
int checkNeighboringBins (int i, float y) const
 Tries to find a bin i such that the two bins i and (i+1) are not on the same side of y. More...
 
void findRawIntervals (float pvalue, vector< CLInterval > &clis)
 Finds the raw interval boundaries corresponding to the provided p-value The raw intervals are just connected sections where all bins of the p-value histogram _pvalues lie above the given threshold. More...
 
void findRawIntervalsForCentralValues (float pvalue, vector< CLInterval > &clis)
 Find the interval boundaries corresponding to the central values already saved in _clintervals1sigma or _clintervals2sigma, and to the number of sigmas given. More...
 
void improveIntervalsLine (vector< CLInterval > &clis) const
 Improve the intervals through an interpolation with a straight line. More...
 
void improveIntervalsPol2fit (vector< CLInterval > &clis) const
 Improve the intervals through an fit with a pol2. More...
 
bool interpolateLine (const TH1F *h, int i, float y, float &val) const
 Find an interpolated x value near a certain bin position of a histogram that is the best estimate for h(x)=y. More...
 
bool interpolatePol2fit (const TH1F *h, int i, float y, float central, bool upper, float &val, float &err) const
 Find an interpolated x value near a certain bin position of a histogram that is the best estimate for h(x)=y. More...
 
bool isInInterval (int binid, float pvalue) const
 Checks if a bin is in a CL interval: it is, when it's pvalue is above the provided threshold. More...
 
float pq (float p0, float p1, float p2, float y, int whichSol) const
 Solve a quadratic equation by means of a modified pq formula:

\[x^2 + \frac{p_1}{p_2} x + \frac{p_0-y}{p2} = 0\]

. More...

 
void removeBadIntervals ()
 Remove bad intervals, where findRawIntervalsForCentralValues() couldn't find interval boundaries corresponding to the central value and pvalue given. More...
 
bool similarMaximumExists (float value) const
 
void storeRawInterval (int binidLo, int binidHi, float pvalue, vector< CLInterval > &clis)
 Stores a confidence interval found by findRawIntervalsForCentralValues(). More...
 
int valueToBin (float val) const
 

Private Attributes

OptParser_arg
 command line arguments More...
 
vector< CLInterval_clintervals1sigma
 1 sigma intervals More...
 
vector< CLInterval_clintervals2sigma
 2 sigma intervals More...
 
const TH1F & _pvalues
 the pvalue histogram More...
 

Detailed Description

Class that makes CL intervals from 1-CL histograms.

Definition at line 23 of file CLIntervalMaker.h.

Constructor & Destructor Documentation

§ CLIntervalMaker()

CLIntervalMaker::CLIntervalMaker ( OptParser arg,
const TH1F &  pvalues 
)

Definition at line 3 of file CLIntervalMaker.cpp.

§ ~CLIntervalMaker()

CLIntervalMaker::~CLIntervalMaker ( )

Definition at line 12 of file CLIntervalMaker.cpp.

Member Function Documentation

§ binsOnSameSide()

bool CLIntervalMaker::binsOnSameSide ( int  i,
float  y 
) const
private

Check if the two bins i and (i+1) of the _pvalues histogram are on the same side of y.

Parameters
i- bin
y- y value
Returns
- true if i and i+1 are on the same side

Definition at line 245 of file CLIntervalMaker.cpp.

§ binToValue()

float CLIntervalMaker::binToValue ( int  bin) const
private

Definition at line 503 of file CLIntervalMaker.cpp.

§ calcCLintervals()

void CLIntervalMaker::calcCLintervals ( )

Calculate the CL intervals.

Definition at line 522 of file CLIntervalMaker.cpp.

§ checkNeighboringBins()

int CLIntervalMaker::checkNeighboringBins ( int  i,
float  y 
) const
private

Tries to find a bin i such that the two bins i and (i+1) are not on the same side of y.

If i does already satisfy the requirement, i is returned. Else also the left and right neighbor of i are checked, and returned if they satisfy the requirement.

Parameters
i- bin ID of _pvalues histogram
y- y value
Returns
- bin ID of _pvalues histogram

Definition at line 261 of file CLIntervalMaker.cpp.

§ findMaxima()

void CLIntervalMaker::findMaxima ( float  pValueThreshold)

Finds the maxima of the _pvalue histogram and fills _clintervals1sigma and _clintervals2sigma.

Only accepts maxima that are not similar to existing ones, that were, e.g., set by addMaximum().

Parameters
pValueThreshold- ignore maxima under this pvalue threshold to reject low statistics plugin crap

Definition at line 51 of file CLIntervalMaker.cpp.

§ findRawIntervals()

void CLIntervalMaker::findRawIntervals ( float  pvalue,
vector< CLInterval > &  clis 
)
private

Finds the raw interval boundaries corresponding to the provided p-value The raw intervals are just connected sections where all bins of the p-value histogram _pvalues lie above the given threshold.

Parameters
pvalue- pvalue of the intervals to find
clis- saves intervals into this vector of confidence intervals, usually _clintervals1sigma or _clintervals2sigma

Definition at line 151 of file CLIntervalMaker.cpp.

§ findRawIntervalsForCentralValues()

void CLIntervalMaker::findRawIntervalsForCentralValues ( float  pvalue,
vector< CLInterval > &  clis 
)
private

Find the interval boundaries corresponding to the central values already saved in _clintervals1sigma or _clintervals2sigma, and to the number of sigmas given.

Saves the result into the intevals in _clintervals1sigma or _clintervals2sigma.

Parameters
pvalue- pvalue of the intervals to find
clis- list of confidence intervals holding the central value

Definition at line 185 of file CLIntervalMaker.cpp.

§ getClintervals1sigma()

vector<CLInterval>& CLIntervalMaker::getClintervals1sigma ( )
inline

Definition at line 31 of file CLIntervalMaker.h.

§ getClintervals2sigma()

vector<CLInterval>& CLIntervalMaker::getClintervals2sigma ( )
inline

Definition at line 32 of file CLIntervalMaker.h.

§ improveIntervalsLine()

void CLIntervalMaker::improveIntervalsLine ( vector< CLInterval > &  clis) const
private

Improve the intervals through an interpolation with a straight line.

Parameters
clis- list of confidence intervals holding the central value and min and max boundaries

Definition at line 304 of file CLIntervalMaker.cpp.

§ improveIntervalsPol2fit()

void CLIntervalMaker::improveIntervalsPol2fit ( vector< CLInterval > &  clis) const
private

Improve the intervals through an fit with a pol2.

Parameters
clis- list of confidence intervals holding the central value and min and max boundaries

Definition at line 336 of file CLIntervalMaker.cpp.

§ interpolateLine()

bool CLIntervalMaker::interpolateLine ( const TH1F *  h,
int  i,
float  y,
float &  val 
) const
private

Find an interpolated x value near a certain bin position of a histogram that is the best estimate for h(x)=y.

Interpolates by means of a straight line between two known points.

Parameters
h- the histogram to be interpolated
i- interpolate around this bin. Must be a bin such that i and i+1 are above and below val
y- the y position we want to find the interpolated x for
val- Return value: interpolated x position
Returns
true if successful

Definition at line 283 of file CLIntervalMaker.cpp.

§ interpolatePol2fit()

bool CLIntervalMaker::interpolatePol2fit ( const TH1F *  h,
int  i,
float  y,
float  central,
bool  upper,
float &  val,
float &  err 
) const
private

Find an interpolated x value near a certain bin position of a histogram that is the best estimate for h(x)=y.

Interpolates by means of fitting a second grade polynomial to up to five adjacent points. Because that's giving us two solutions, we use the central value and knowledge about if it is supposed to be an upper or lower boundary to pick one.

Parameters
h- the histogram to be interpolated
i- interpolate around this bin. Must be a bin such that i and i+1 are above and below val
y- the y position we want to find the interpolated x for
central- Central value of the solution we're trying to get the CL interval for.
upper- Set to true if we're computing an upper interval boundary.
val- Return value: interpolated x position
err- Return value: estimated interpolation error
Returns
true, if inpterpolation was performed, false, if conditions were not met

Definition at line 389 of file CLIntervalMaker.cpp.

§ isInInterval()

bool CLIntervalMaker::isInInterval ( int  binid,
float  pvalue 
) const
private

Checks if a bin is in a CL interval: it is, when it's pvalue is above the provided threshold.

Parameters
binid- bin id of _pvalues histogram
pvalue- the p value threshold
Returns
- true, if bin is in interval

Definition at line 98 of file CLIntervalMaker.cpp.

§ pq()

float CLIntervalMaker::pq ( float  p0,
float  p1,
float  p2,
float  y,
int  whichSol 
) const
private

Solve a quadratic equation by means of a modified pq formula:

\[x^2 + \frac{p_1}{p_2} x + \frac{p_0-y}{p2} = 0\]

.

Definition at line 367 of file CLIntervalMaker.cpp.

§ print()

void CLIntervalMaker::print ( )

Definition at line 509 of file CLIntervalMaker.cpp.

§ provideMorePreciseMaximum()

void CLIntervalMaker::provideMorePreciseMaximum ( float  value,
TString  method 
)

Add a maximum (e.g.

found by the Prob method) to calculate the confidence intervals around it.

Parameters
value- parameter value at the maximum
method- details on how this maximum was found

Definition at line 22 of file CLIntervalMaker.cpp.

§ removeBadIntervals()

void CLIntervalMaker::removeBadIntervals ( )
private

Remove bad intervals, where findRawIntervalsForCentralValues() couldn't find interval boundaries corresponding to the central value and pvalue given.

Definition at line 223 of file CLIntervalMaker.cpp.

§ similarMaximumExists()

bool CLIntervalMaker::similarMaximumExists ( float  value) const
private

§ storeRawInterval()

void CLIntervalMaker::storeRawInterval ( int  binidLo,
int  binidHi,
float  pvalue,
vector< CLInterval > &  clis 
)
private

Stores a confidence interval found by findRawIntervalsForCentralValues().

Parameters
binidHi- bin id of _pvalues histogram
binidLo- bin id of _pvalues histogram
pvalue- p-value threshold, accept points into interval if their p-value is above
clis- vector of confidence intervals, usually _clintervals1sigma or _clintervals2sigma

Definition at line 111 of file CLIntervalMaker.cpp.

§ valueToBin()

int CLIntervalMaker::valueToBin ( float  val) const
private

Definition at line 497 of file CLIntervalMaker.cpp.

Member Data Documentation

§ _arg

OptParser* CLIntervalMaker::_arg
private

command line arguments

Definition at line 54 of file CLIntervalMaker.h.

§ _clintervals1sigma

vector<CLInterval> CLIntervalMaker::_clintervals1sigma
private

1 sigma intervals

Definition at line 56 of file CLIntervalMaker.h.

§ _clintervals2sigma

vector<CLInterval> CLIntervalMaker::_clintervals2sigma
private

2 sigma intervals

Definition at line 57 of file CLIntervalMaker.h.

§ _pvalues

const TH1F& CLIntervalMaker::_pvalues
private

the pvalue histogram

Definition at line 55 of file CLIntervalMaker.h.


The documentation for this class was generated from the following files: