00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef RAR_BASEPDF
00011 #define RAR_BASEPDF
00012
00013 #define NCOLORS 11
00014
00015 #include <string>
00016 using namespace std;
00017
00018 #include "TList.h"
00019 #include "TString.h"
00020 #include "TObject.h"
00021
00022 #include "RooFitCore/RooBinning.hh"
00023 #include "RooFitCore/RooCategory.hh"
00024 #include "RooFitCore/RooConstVar.hh"
00025 #include "RooFitCore/RooExtendPdf.hh"
00026 #include "RooFitCore/RooGenericPdf.hh"
00027 #include "RooFitCore/RooSimultaneous.hh"
00028
00029 #include "RooRarFit/rarConfig.hh"
00030 #include "RooRarFit/rarDatasets.hh"
00031
00032 class rarMLFitter;
00033
00039 class rarBasePdf : public rarConfig {
00040
00041 public:
00042 rarBasePdf();
00043 rarBasePdf(const char *configFile,const char*configSec,const char*configStr,
00044 rarDatasets *theDatasets, RooDataSet *theData,
00045 const char *name, const char *title);
00046 virtual ~rarBasePdf();
00047
00049 virtual TString getVarSec() {return _paramSec;}
00050
00053 virtual RooArgSet *getPrimaryObs() {return _datasets->getPrimaryObs();}
00054
00057 virtual RooArgSet *getAddOnCols() {return _datasets->getAddOnCols();}
00058
00064 virtual RooDataSet *getData(const char * ) {return _theData;}
00065
00068 virtual rarDatasets *getDatasets() const {return _datasets;}
00069
00072 virtual TString getPdfType() {return _pdfType;}
00073
00076 virtual RooAbsPdf *getPdf() {return _thePdf;}
00077 virtual RooAbsPdf *getPdfWOvar(RooArgList ignoredObs);
00078 virtual RooAbsPdf *getDPdfWvar(RooRealVar *theVar);
00079 virtual RooAbsPdf *getSimPdf(RooSimultaneous *simPdf=0, RooAbsPdf *srcPdf=0);
00080
00083 virtual void setFitter(rarMLFitter *theFitter) {_theFitter=theFitter;}
00086 virtual rarMLFitter *getFitter() {return _theFitter;}
00087
00090 virtual void setSimPdf(RooSimultaneous *simPdf) {_theSimPdf=simPdf;}
00091 virtual void setCondObss(RooArgSet condObsSet);
00092 virtual void setFitData(RooDataSet *theData=0);
00093 virtual RooArgSet getParams();
00094
00095 virtual void preAction();
00096 virtual RooArgSet getArgSet(TString paramNames, Bool_t useRead=kFALSE,
00097 RooArgSet *fullSet=0);
00098 virtual void doPdfFit(TString pdfList="");
00099 virtual void attachDataSet(const RooAbsData &data);
00100 virtual Bool_t isNegativeValue();
00101 virtual RooPlot *doPdfPlot(TList &plotList, TString pdfList="");
00102 virtual RooArgSet getCorrCoeffs();
00103 virtual Double_t getCorrCoeff(const TString pn1, const TString pn2);
00104 virtual RooAbsPdf *getProtGen();
00105 virtual Bool_t protGenIsDummy() {return _theProtGen==_myDummyPdf;}
00106
00107 virtual void setControlBit(TString controlBitStr, TString bitConfigStr="",
00108 TString configSec="");
00109 virtual void setControlBits(TString controlBitsStr);
00110 virtual Bool_t getControlBit(TString controlBitStr);
00111
00112 static Int_t getColor(Int_t i);
00113
00114 protected:
00115 virtual void init();
00116 virtual void addProtVars();
00117 virtual void addProtVars(TString configName, RooArgSet &protVars);
00119 virtual void setVarSec(TString paramSec) {_paramSec=paramSec;}
00120 virtual void addToParams(RooRealVar *theVar);
00121 virtual void addToObs(RooRealVar *theVar);
00122 virtual RooArgList *getFormulaArgs(rarStrParser fStrParser);
00123 virtual Double_t getFormulaVal(TString varStr);
00124 virtual rarBasePdf *createPdfs(TString Comps="Comps", TList *pdfList=0,
00125 RooAbsCollection *PDFs=0, TString secName="");
00126 virtual Bool_t matchCatType(RooCatType *catN, RooCatType *catO);
00127 virtual void saveFracName(TString fracName);
00128 virtual Bool_t isFracName(TString fracName);
00129
00130 virtual RooBinning *getRange(RooRealVar *theVar, TString rPrefix,
00131 Double_t &min, Double_t &max,
00132 const Char_t *sec=0, Int_t *nBins=0);
00133 virtual void saveCorrCoeffs(RooFitResult *fr);
00134 virtual Bool_t saveCorrCoeff(TString corrCoefName, Double_t corrCoef,
00135 Bool_t saveTrivial=kFALSE);
00136 virtual TString getCorrCoefName(const TString pn1, const TString pn2) const;
00137 virtual void doXPdfFit(TString pdfList="");
00138 virtual RooPlot *doXPdfPlot(TList &plotList, TString pdfList="");
00139 virtual RooPlot *doParamsOnPlot(RooPlot* frame, RooArgSet *params=0,
00140 Int_t sigDigits=2, Option_t *options="NELU",
00141 Double_t xmin=0.65, Double_t xmax=0.99,
00142 Double_t ymax=0.95);
00143 virtual RooPlot *doChi2OnPlot(RooPlot *frame);
00144
00145 TString _pdfType;
00146
00147 RooArgSet _obsSet;
00148 RooArgSet _fObsSet;
00149
00150 rarDatasets *_datasets;
00151 RooDataSet *_theData;
00152 RooArgSet _protDataVars;
00153 RooArgSet _conditionalObs;
00154 RooArgSet _condObss;
00155
00156 RooAbsPdf *_thePdf;
00157 RooArgList _subPdfs;
00158 RooAbsPdf *_theProtGen;
00159 RooArgList _protGenPdfs;
00160 RooSimultaneous *_thisSimPdf;
00161 RooSimultaneous *_thisSimPdfWOP;
00162 RooSimultaneous *_theSimPdf;
00163 Int_t _nxPdf;
00164 TList _xPdfList;
00165 RooAbsPdf *_myDummyPdf;
00166 RooArgSet _corrCoeffs;
00167 static RooGenericPdf _dummyPdf;
00168 static RooConstVar _dummyExpEvt;
00169 static RooExtendPdf _dummyExtPdf;
00170 static RooCategory _compCat;
00171 static Int_t _rarColors[NCOLORS];
00172 static rarMLFitter *_theFitter;
00173 static TString _fracNames;
00174
00175 TString _paramSec;
00176 RooArgSet _params;
00177 RooArgList _coeffs;
00178 RooArgSet _xParams;
00179 string _afterFitSaverStr;
00180
00181 TString _controlStr;
00182
00183 private:
00184 rarBasePdf(const rarBasePdf&);
00185 ClassDef(rarBasePdf, 0)
00186 ;
00187 };
00188
00189 #endif