CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

MaximalValue Class Reference

#include <CompMethods.h>

List of all members.

Public Member Functions

 MaximalValue (double val, double err)
double spread (TH1F &hist)
double spreadError (TH1F &hist)
double value (TH1F &hist)
double valueError (TH1F &hist)
 ~MaximalValue ()

Private Member Functions

std::pair< int, int > contour (TH1F &, double &)
double spread (TH1F &hist, double frac)

Private Attributes

double err_
double val_

Detailed Description

Definition at line 14 of file CompMethods.h.


Constructor & Destructor Documentation

MaximalValue::MaximalValue ( double  val,
double  err 
) [inline]

Definition at line 18 of file CompMethods.h.

:val_(val), err_(err){};
MaximalValue::~MaximalValue ( ) [inline]

Definition at line 19 of file CompMethods.h.

{};

Member Function Documentation

std::pair< int, int > MaximalValue::contour ( TH1F &  hist,
double &  frac 
) [private]

Definition at line 79 of file CompMethods.cc.

References cropTnPTrees::frac.

{
  int idx=hist.GetMaximumBin(), jdx=hist.GetMaximumBin();
  if(0<=frac && frac<=1){
    while( hist.GetBinContent(idx)/hist.GetMaximum()>frac) --idx;
    while( hist.GetBinContent(jdx)/hist.GetMaximum()>frac) ++jdx;
  }
  return std::pair<int, int>(idx, jdx);
}
double MaximalValue::spread ( TH1F &  hist) [inline]

Definition at line 22 of file CompMethods.h.

References spread().

Referenced by FitHist::fillTargetHistogramBin(), spread(), spreadError(), and valueError().

{ return spread(hist, 0.5); };
double MaximalValue::spread ( TH1F &  hist,
double  frac 
) [inline, private]

Definition at line 28 of file CompMethods.h.

{ return std::fabs(hist.GetBinCenter(contour(hist, frac).second)-hist.GetBinCenter(contour(hist, frac).first)); };
double MaximalValue::spreadError ( TH1F &  hist) [inline]

Definition at line 23 of file CompMethods.h.

References err_, and spread().

Referenced by FitHist::fillTargetHistogramBin().

{ return std::fabs(spread(hist, 0.5-err_)-spread(hist, 0.5+err_))/2; };
double MaximalValue::value ( TH1F &  hist) [inline]

Definition at line 20 of file CompMethods.h.

Referenced by FitHist::fillTargetHistogramBin().

{ return hist.GetBinCenter(hist.GetMaximumBin()); };
double MaximalValue::valueError ( TH1F &  hist) [inline]

Definition at line 21 of file CompMethods.h.

References spread(), and val_.

Referenced by FitHist::fillTargetHistogramBin().

{ return spread(hist, val_); };

Member Data Documentation

double MaximalValue::err_ [private]

Definition at line 33 of file CompMethods.h.

Referenced by spreadError().

double MaximalValue::val_ [private]

Definition at line 28 of file CompMethods.h.

Referenced by valueError().