00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00014
00015
00016
00017
00018
00019
00020 #include "RooRarFit/rarVersion.hh"
00021
00022 #include "Riostream.h"
00023
00024 #include "RooFitCore/RooArgList.hh"
00025 #include "RooFitCore/RooDataSet.hh"
00026 #include "RooFitCore/RooProdPdf.hh"
00027 #include "RooFitCore/RooRealVar.hh"
00028 #include "RooFitCore/RooStringVar.hh"
00029
00030 #include "RooFitModels/Roo2DKeysPdf.hh"
00031 #include "RooFitModels/RooKeysPdf.hh"
00032
00033 #include "RooRarFit/rarKeys.hh"
00034
00035 ClassImp(rarKeys)
00036 ;
00037
00041 rarKeys::rarKeys()
00042 : rarBasePdf(),
00043 _x(0), _y(0), _rho(1.), _keysOption("")
00044 {
00045 init();
00046 }
00047
00060 rarKeys::rarKeys(const char *configFile, const char *configSec,
00061 const char *configStr,
00062 rarDatasets *theDatasets, RooDataSet *theData,
00063 const char *name, const char *title)
00064 : rarBasePdf(configFile, configSec, configStr,
00065 theDatasets, theData, name, title),
00066 _x(0), _y(0), _rho(1.), _keysOption("")
00067 {
00068 init();
00069 }
00070
00071 rarKeys::~rarKeys()
00072 {
00073 }
00074
00084 void rarKeys::init()
00085 {
00086 cout<<"init of rarKeys for "<<GetName()<<":"<<endl;
00087
00088
00089 setControlBits("noPdfFit");
00090
00091
00092 _x=createAbsReal("x", "observable"); assert(_x);
00093 if ("2DKeys"==_pdfType) {
00094 _y=createAbsReal("y", "observable"); assert(_y);
00095 }
00096
00097 if (!_theData) {
00098 cout<<" No dataset for Keys Pdf"<<endl;
00099 exit(-1);
00100 }
00101
00102 _rho=atof(readConfStr("rho", "1.", getVarSec()));
00103 _keysOption=readConfStr("keysOption", "", getVarSec());
00104
00105
00106 if ("2DKeys"==_pdfType) {
00107 _thePdf=new Roo2DKeysPdf(Form("the_%s", GetName()),_pdfType+" "+GetTitle(),
00108 *_x, *_y, *_theData, _keysOption, _rho);
00109 } else {
00110
00111 RooKeysPdf::Mirror mirror=RooKeysPdf::NoMirror;
00112 if ("NoMirror"==_keysOption) mirror=RooKeysPdf::NoMirror;
00113 else if ("MirrorLeft"==_keysOption) mirror=RooKeysPdf::MirrorLeft;
00114 else if ("MirrorRight"==_keysOption) mirror=RooKeysPdf::MirrorRight;
00115 else if ("MirrorBoth"==_keysOption) mirror=RooKeysPdf::MirrorBoth;
00116 else if ("MirrorAsymLeft"==_keysOption) mirror=RooKeysPdf::MirrorAsymLeft;
00117 else if ("MirrorAsymLeftRight"==_keysOption)
00118 mirror=RooKeysPdf::MirrorAsymLeftRight;
00119 else if ("MirrorAsymRight"==_keysOption)mirror=RooKeysPdf::MirrorAsymRight;
00120 else if ("MirrorLeftAsymRight"==_keysOption)
00121 mirror=RooKeysPdf::MirrorLeftAsymRight;
00122 else if ("MirrorAsymBoth"==_keysOption) mirror=RooKeysPdf::MirrorAsymBoth;
00123 else mirror=RooKeysPdf::NoMirror;
00124 _thePdf=new RooKeysPdf(Form("the_%s", GetName()), _pdfType+" "+GetTitle(),
00125 *_x, *_theData, mirror, _rho);
00126 }
00127 }
00128
00137 void rarKeys::setFitData(RooDataSet *theData)
00138 {
00139 RooDataSet *oldData=_theData;
00140
00141 rarBasePdf::setFitData(theData);
00142 if (_theData==oldData) return;
00143
00144 if ("Keys"==_pdfType) ((RooKeysPdf*)_thePdf)->LoadDataSet(*_theData);
00145 if ("2DKeys"==_pdfType)
00146 ((Roo2DKeysPdf*)_thePdf)->loadDataSet(*_theData, _keysOption);
00147 }