#ifndef ROOSTATS_CombinedCalculator
#define ROOSTATS_CombinedCalculator
#ifndef ROOSTATS_IntervalCalculator
#include "RooStats/IntervalCalculator.h"
#endif
#ifndef ROOSTATS_HypoTestCalculator
#include "RooStats/HypoTestCalculator.h"
#endif
#ifndef ROO_ABS_PDF
#include "RooAbsPdf.h"
#endif
#ifndef ROO_ABS_DATA
#include "RooAbsData.h"
#endif
#ifndef ROO_ARG_SET
#include "RooArgSet.h"
#endif
#ifndef ROO_WORKSPACE
#include "RooWorkspace.h"
#endif
namespace RooStats {
class CombinedCalculator : public IntervalCalculator, public HypoTestCalculator {
public:
CombinedCalculator(){
fWS = 0;
fNullParams = 0;
fAlternateParams = 0;
fPOI = 0;
fNuisParams = 0;
fOwnsWorkspace = false;
}
CombinedCalculator(RooWorkspace& ws, RooAbsData& data, RooAbsPdf& pdf, RooArgSet& paramsOfInterest,
Double_t size = 0.05, RooArgSet* nullParams = 0, RooArgSet* altParams = 0){
SetWorkspace(ws);
SetData(data);
SetPdf(pdf);
SetParameters(paramsOfInterest);
SetSize(size);
if(nullParams )
SetNullParameters(*nullParams);
else
SetNullParameters(paramsOfInterest);
if (altParams) SetAlternateParameters(*altParams);
fOwnsWorkspace = false;
}
CombinedCalculator(RooAbsData& data, RooAbsPdf& pdf, RooArgSet& paramsOfInterest,
Double_t size = 0.05, RooArgSet* nullParams = 0, RooArgSet* altParams = 0){
fWS = new RooWorkspace();
fOwnsWorkspace = true;
SetData(data);
SetPdf(pdf);
SetParameters(paramsOfInterest);
SetSize(size);
if(nullParams )
SetNullParameters(*nullParams);
else
SetNullParameters(paramsOfInterest);
if (altParams) SetAlternateParameters(*altParams);
}
virtual ~CombinedCalculator() {
if( fOwnsWorkspace && fWS) delete fWS;
}
virtual ConfInterval* GetInterval() const = 0;
virtual HypoTestResult* GetHypoTest() const = 0;
virtual void SetSize(Double_t size) {fSize = size;}
virtual void SetConfidenceLevel(Double_t cl) {fSize = 1.-cl;}
virtual Double_t Size() const {return fSize;}
virtual Double_t ConfidenceLevel() const {return 1.-fSize;}
virtual void SetWorkspace(RooWorkspace & ws) {
if (!fWS)
fWS = &ws;
else{
RooMsgService::instance().setGlobalKillBelow(RooMsgService::ERROR) ;
fWS->merge(ws);
RooMsgService::instance().setGlobalKillBelow(RooMsgService::DEBUG) ;
}
}
virtual void SetData(RooAbsData & data) {
if (!fWS) {
fWS = new RooWorkspace();
fOwnsWorkspace = true;
}
if (! fWS->data( data.GetName() ) ){
RooMsgService::instance().setGlobalKillBelow(RooMsgService::ERROR) ;
fWS->import(data);
RooMsgService::instance().setGlobalKillBelow(RooMsgService::DEBUG) ;
}
SetData( data.GetName() );
};
virtual void SetPdf(RooAbsPdf& pdf) {
if (!fWS)
fWS = new RooWorkspace();
if (! fWS->pdf( pdf.GetName() ) ){
RooMsgService::instance().setGlobalKillBelow(RooMsgService::ERROR) ;
fWS->import(pdf);
RooMsgService::instance().setGlobalKillBelow(RooMsgService::DEBUG) ;
}
SetPdf( pdf.GetName() );
}
virtual void SetCommonPdf(RooAbsPdf& pdf) { SetPdf(pdf);}
virtual void SetNullPdf(RooAbsPdf& pdf) { SetPdf(pdf);}
virtual void SetAlternatePdf(RooAbsPdf& pdf) { SetPdf(pdf);}
virtual void SetPdf(const char* name) {fPdfName = name;}
virtual void SetData(const char* name){fDataName = name;}
virtual void SetParameters(RooArgSet& set) {fPOI = &set;}
virtual void SetNuisanceParameters(RooArgSet& set) {fNuisParams = &set;}
virtual void SetNullPdf(const char* name) {SetPdf(name);}
virtual void SetAlternatePdf(const char* name) {SetPdf(name);}
virtual void SetCommonPdf(const char* name) {SetPdf(name);}
virtual void SetNullParameters(RooArgSet& set) {fNullParams = &set;}
virtual void SetAlternateParameters(RooArgSet& set) {fAlternateParams = &set;}
protected:
Double_t fSize;
RooWorkspace* fWS;
const char* fPdfName;
const char* fDataName;
RooArgSet* fNullParams;
RooArgSet* fAlternateParams;
RooArgSet* fPOI;
RooArgSet* fNuisParams;
Bool_t fOwnsWorkspace;
ClassDef(CombinedCalculator,1)
};
}
#endif
Last change: Wed Dec 17 08:53:05 2008
Last generated: 2008-12-17 08:53
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.