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/RooFormulaVar.hh"
00027 #include "RooFitCore/RooProdPdf.hh"
00028 #include "RooFitCore/RooRealVar.hh"
00029 #include "RooFitCore/RooStringVar.hh"
00030
00031 #include "RooFitModels/RooBifurGauss.hh"
00032
00033 #include "RooRarFit/rarBifurGauss.hh"
00034
00035 ClassImp(rarBifurGauss)
00036 ;
00037
00041 rarBifurGauss::rarBifurGauss()
00042 : rarBasePdf(),
00043 _x(0), _parSymLevel(0), _peak(0), _sigL(0), _sigR(0)
00044 {
00045 init();
00046 }
00047
00060 rarBifurGauss::rarBifurGauss(const char *configFile,
00061 const char *configSec,
00062 const char *configStr,
00063 rarDatasets *theDatasets,
00064 RooDataSet *theData,
00065 const char *name, const char *title)
00066 : rarBasePdf(configFile, configSec, configStr,
00067 theDatasets, theData, name, title),
00068 _x(0), _parSymLevel(0), _peak(0), _sigL(0), _sigR(0)
00069 {
00070 init();
00071 }
00072
00073 rarBifurGauss::~rarBifurGauss()
00074 {
00075 }
00076
00082 void rarBifurGauss::init()
00083 {
00084 cout<<"init of rarBifurGauss for "<<GetName()<<":"<<endl;
00085
00086
00087 _x=createAbsReal("x", "observable"); assert(_x);
00088 RooRealVar *x=(RooRealVar *)RooArgList(_obsSet).at(0); assert(x);
00089
00090 if ("BGGauss"==_pdfType) _parSymLevel=1;
00091
00092 _parSymLevel=atoi(readConfStr("parSymLevel", Form("%d", _parSymLevel),
00093 getVarSec()));
00094 if (_parSymLevel<0) _parSymLevel=0;
00095 if (_parSymLevel>3) _parSymLevel=3;
00096
00097 if (0==_parSymLevel) {
00098 _peak=createAbsReal("peak", "#mu", (x->getMin()+x->getMax())/2,
00099 x->getMin(), x->getMax(), _x->getUnit());
00100 _sigL=createAbsReal("sigL", "#sigma_{L}", .1, 0.,
00101 (x->getMax()-x->getMin())/2,_x->getUnit());
00102 _sigR=createAbsReal("sigR", "#sigma_{R}", .1, 0.,
00103 (x->getMax()-x->getMin())/2,_x->getUnit());
00104 } else {
00105 createAbsReal("mean", "#mu", (x->getMin()+x->getMax())/2,
00106 x->getMin(), x->getMax(), _x->getUnit());
00107 createAbsReal("rms", "#sigma", .1, 0.,(x->getMax()-x->getMin())/2,
00108 _x->getUnit());
00109 createAbsReal("asym", "A", 0., -1., 1.);
00110 }
00111 if (1==_parSymLevel) {
00112 createAbsReal("Cmean", "sqrt(8/pi)", sqrt(8./3.14159265), "RooConstVar");
00113 _peak=(RooAbsReal*)
00114 createAbsVar("peak RooFormulaVar @0-@3*@1*@2 mean rms asym Cmean");
00115 _sigL=(RooAbsReal*)createAbsVar("sigL RooFormulaVar @0*(1-@1) rms asym");
00116 _sigR=(RooAbsReal*)createAbsVar("sigR RooFormulaVar @0*(1+@1) rms asym");
00117 } else if (2==_parSymLevel) {
00118 createAbsReal("Cmean", "sqrt(8/pi)", sqrt(8./3.14159265), "RooConstVar");
00119 createAbsReal("CA2", "3/2 - 4/pi", .5*(3. - 8./3.14159265), "RooConstVar");
00120 _peak=(RooAbsReal*)
00121 createAbsVar(Form("%s %s", "peak RooFormulaVar",
00122 "@0-@3*@1*@2*(1-@4*@2*@2) mean rms asym Cmean CA2"));
00123 _sigL=(RooAbsReal*)
00124 createAbsVar("sigL RooFormulaVar @0*(1-@2*@1*@1)*(1-@1) rms asym CA2");
00125 _sigR=(RooAbsReal*)
00126 createAbsVar("sigR RooFormulaVar @0*(1-@2*@1*@1)*(1+@1) rms asym CA2");
00127 } else if (3==_parSymLevel) {
00128 createAbsReal("CA2x3", "(3*pi-8)/8", (3.*3.14159265-8.)/8., "RooConstVar");
00129 createAbsReal("CAx3", "sqrt(pi/8)", sqrt(3.14159265/8.), "RooConstVar");
00130 _peak=(RooAbsReal*)
00131 createAbsVar(Form("%s %s %s", "peak RooFormulaVar",
00132 "@0-@2/@1/@1/sqrt(1+@3*(@2/@1/@1/@1)*(@2/@1/@1/@1))",
00133 "mean rms asym CA2x3"));
00134 _sigL=(RooAbsReal*)
00135 createAbsVar(Form("%s %s%s %s", "sigL RooFormulaVar",
00136 "@0*(1-@2*@1/@0/@0/@0)/sqrt(1+@3*(@1/@0/@0/@0)",
00137 "*(@1/@0/@0/@0))", "rms asym CAx3 CA2x3"));
00138 _sigR=(RooAbsReal*)
00139 createAbsVar(Form("%s %s%s %s", "sigR RooFormulaVar",
00140 "@0*(1+@2*@1/@0/@0/@0)/sqrt(1+@3*(@1/@0/@0/@0)",
00141 "*(@1/@0/@0/@0))", "rms asym CAx3 CA2x3"));
00142 }
00143 _params.Print("v");
00144
00145
00146 _thePdf=new RooBifurGauss(Form("the_%s", GetName()), _pdfType+" "+GetTitle(),
00147 *_x, *_peak, *_sigL, *_sigR);
00148 }