// RooEfficiency is a PDF helper class to fit efficiencies parameterized
// by a supplied function F.
//
// Given a dataset with a category C that determines if a given
// event is accepted or rejected for the efficiency to be measured,
// this class evaluates as F if C is 'accept' and as (1-F) if
// C is 'reject'. Values of F below 0 and above 1 are clipped.
// F may have an arbitrary number of dependents and parameters
// END_HTML
#include "RooFit.h"
#include "RooEfficiency.h"
#include "RooEfficiency.h"
#include "RooStreamParser.h"
#include "RooArgList.h"
ClassImp(RooEfficiency)
;
RooEfficiency::RooEfficiency(const char *name, const char *title, const RooAbsReal& effFunc, const RooAbsCategory& cat, const char* sigCatName) :
RooAbsPdf(name,title),
_cat("cat","Signal/Background category",this,(RooAbsCategory&)cat),
_effFunc("effFunc","Efficiency modeling function",this,(RooAbsReal&)effFunc),
_sigCatName(sigCatName)
{
}
RooEfficiency::RooEfficiency(const RooEfficiency& other, const char* name) :
RooAbsPdf(other, name),
_cat("cat",this,other._cat),
_effFunc("effFunc",this,other._effFunc),
_sigCatName(other._sigCatName)
{
}
RooEfficiency::~RooEfficiency()
{
}
Double_t RooEfficiency::evaluate() const
{
Double_t effFuncVal = _effFunc ;
if (_effFunc>1) {
effFuncVal = 1.0 ;
} else if (_effFunc<0) {
effFuncVal = 0.0 ;
}
if (_cat.label() == _sigCatName) {
return effFuncVal ;
} else {
return 1 - effFuncVal ;
}
}
Int_t RooEfficiency::getAnalyticalIntegral(RooArgSet& allVars, RooArgSet& analVars, const char* ) const
{
if (matchArgs(allVars,analVars,_cat)) return 1 ;
return 0 ;
}
Double_t RooEfficiency::analyticalIntegral(Int_t code, const char* ) const
{
assert(code==1) ;
return 1.0 ;
}
Last change: Mon Aug 25 11:36:25 2008
Last generated: 2008-08-25 11:36
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.