// RooDLLSignificanceMCSModule is an add-on modules to RooMCStudy that
// calculates the significance of a signal by comparing the likelihood of
// a fit fit with a given parameter floating with a fit with that given
// parameter fixed to a nominal value (usually zero). The difference in
// the -log(L) of those two fits can be interpreted as the probability
// that a statistical background fluctation may result in a signal as large
// or larger than the signal observed. This interpretation is contingent
// on underlying normal sampling distributions and a MC study is a good way
// to test that assumption.
// END_HTML
#include "Riostream.h"
#include "RooDataSet.h"
#include "RooRealVar.h"
#include "TString.h"
#include "RooFit.h"
#include "RooFitResult.h"
#include "RooDLLSignificanceMCSModule.h"
#include "RooMsgService.h"
ClassImp(RooDLLSignificanceMCSModule)
;
RooDLLSignificanceMCSModule::RooDLLSignificanceMCSModule(const RooRealVar& param, Double_t nullHypoValue) :
RooAbsMCStudyModule(Form("RooDLLSignificanceMCSModule_%s",param.GetName()),Form("RooDLLSignificanceMCSModule_%s",param.GetName())),
_parName(param.GetName()),
_data(0), _nll0h(0), _dll0h(0), _sig0h(0), _nullValue(nullHypoValue)
{
}
RooDLLSignificanceMCSModule::RooDLLSignificanceMCSModule(const char* parName, Double_t nullHypoValue) :
RooAbsMCStudyModule(Form("RooDLLSignificanceMCSModule_%s",parName),Form("RooDLLSignificanceMCSModule_%s",parName)),
_parName(parName),
_data(0), _nll0h(0), _dll0h(0), _sig0h(0), _nullValue(nullHypoValue)
{
}
RooDLLSignificanceMCSModule::RooDLLSignificanceMCSModule(const RooDLLSignificanceMCSModule& other) :
RooAbsMCStudyModule(other),
_parName(other._parName),
_data(0), _nll0h(0), _dll0h(0), _sig0h(0), _nullValue(other._nullValue)
{
}
RooDLLSignificanceMCSModule:: ~RooDLLSignificanceMCSModule()
{
if (_nll0h) {
delete _nll0h ;
}
if (_dll0h) {
delete _dll0h ;
}
if (_sig0h) {
delete _sig0h ;
}
if (_data) {
delete _data ;
}
}
Bool_t RooDLLSignificanceMCSModule::initializeInstance()
{
if (!fitParams()->find(_parName.c_str())) {
coutE(InputArguments) << "RooDLLSignificanceMCSModule::initializeInstance:: ERROR: No parameter named " << _parName << " in RooMCStudy!" << endl ;
return kFALSE ;
}
TString nll0hName = Form("nll_nullhypo_%s",_parName.c_str()) ;
TString nll0hTitle = Form("-log(L) with null hypothesis for param %s",_parName.c_str()) ;
_nll0h = new RooRealVar(nll0hName.Data(),nll0hTitle.Data(),0) ;
TString dll0hName = Form("dll_nullhypo_%s",_parName.c_str()) ;
TString dll0hTitle = Form("-log(L) difference w.r.t null hypo for param %s",_parName.c_str()) ;
_dll0h = new RooRealVar(dll0hName.Data(),dll0hTitle.Data(),0) ;
TString sig0hName = Form("significance_nullhypo_%s",_parName.c_str()) ;
TString sig0hTitle = Form("Gaussian signficiance of Delta(-log(L)) w.r.t null hypo for param %s",_parName.c_str()) ;
_sig0h = new RooRealVar(sig0hName.Data(),sig0hTitle.Data(),-10,100) ;
_data = new RooDataSet("DeltaLLSigData","Additional data for Delta(-log(L)) study",RooArgSet(*_nll0h,*_dll0h,*_sig0h)) ;
return kTRUE ;
}
Bool_t RooDLLSignificanceMCSModule::initializeRun(Int_t )
{
_data->reset() ;
return kTRUE ;
}
RooDataSet* RooDLLSignificanceMCSModule::finalizeRun()
{
return _data ;
}
Bool_t RooDLLSignificanceMCSModule::processAfterFit(Int_t )
{
RooRealVar* par = static_cast<RooRealVar*>(fitParams()->find(_parName.c_str())) ;
par->setVal(_nullValue) ;
par->setConstant(kTRUE) ;
RooFitResult* frnull = refit() ;
par->setConstant(kFALSE) ;
_nll0h->setVal(frnull->minNll()) ;
Double_t deltaLL = (frnull->minNll() - nllVar()->getVal()) ;
Double_t signif = deltaLL>0 ? sqrt(2*deltaLL) : -sqrt(-2*deltaLL) ;
_sig0h->setVal(signif) ;
_dll0h->setVal(deltaLL) ;
_data->add(RooArgSet(*_nll0h,*_dll0h,*_sig0h)) ;
delete frnull ;
return kTRUE ;
}
Last change: Thu Nov 13 09:42:39 2008
Last generated: 2008-11-13 09:42
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.