Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 60181
b: "refs/heads/CMSSW_6_2_X_SLHC"
c: 743b9d8
h: "refs/heads/CMSSW_6_2_X_SLHC"
i:
  60179: 1759ac9
  • Loading branch information
Gregory Alfred Schott committed Feb 17, 2009
1 parent ed22a3d commit c039215
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
refs/heads/gh-pages: 4bec1f03ca2f14e90d0ca17351c4d42d84ec2c82
"refs/heads/CMSSW_6_2_X_SLHC": 17992d59c070cafaa90efb8bf827ae2618a61a2b
"refs/heads/CMSSW_6_2_X_SLHC": 743b9d82ced5639d0ef3a72516ce8de6986d16ca
16 changes: 14 additions & 2 deletions trunk/PhysicsTools/RooStatsCms/interface/RscBaseModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

/**
\class RscBaseModel
$Revision: 1.3 $
$Date: 2008/10/24 11:11:45 $
$Revision: 1.1 $
$Date: 2009/01/06 12:18:37 $
\author G. Schott (gregory.Schott<at>cern.ch), Danilo Piparo - Universitaet Karlsruhe
The distribution is defined in the datacard. An example for a Gaussian
Expand Down Expand Up @@ -88,6 +88,7 @@ class RscBaseModel : public RscAbsPdfBuilder {
RooRealVar* sigma2;
/// Double gaussian distribution parameter
RooRealVar* frac;

/// 4 gaussian distribution parameter
RooRealVar* mean3;
/// 4 gaussian distribution parameter
Expand Down Expand Up @@ -125,6 +126,17 @@ class RscBaseModel : public RscAbsPdfBuilder {
/// Polynomial distribution parameter
RooRealVar* coef_7;

// BifurGaus
RooRealVar* sigmaL;
RooRealVar* sigmaR;

// CBShape+Gaussian
RooRealVar* m0;
RooRealVar* alpha;
RooRealVar* n;
RooRealVar* gmean;
RooRealVar* gsigma;

// BreitWigner
/// Gaussian / BreitWigner distribution parameter
RooRealVar* width;
Expand Down
79 changes: 75 additions & 4 deletions trunk/PhysicsTools/RooStatsCms/src/RscBaseModel.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#include "RooAddPdf.h"
#include "RooBifurGauss.h"
#include "RooCBShape.h"
#include "RooExponential.h"
#include "RooGaussian.h"
#include "RooPolynomial.h"
Expand Down Expand Up @@ -41,6 +43,8 @@ RscBaseModel::RscBaseModel(TString theName, RooRealVar& theVar, RooArgSet* discV
model.defineType("histo");
model.defineType("yieldonly");
model.defineType("flat");
model.defineType("CBShapeGaussian");
model.defineType("BifurGauss");

model.setLabel("none");

Expand Down Expand Up @@ -83,6 +87,14 @@ void RscBaseModel::buildPdf() {
// _thePdf = new RooPolynomial((_name+"_flatHist").Data(),"Flat Histogram",*x,RooArgList(*coef_0,*coef_1));

}
else if (model=="CBShapeGaussian") {
RooCBShape* cbshape = new RooCBShape(_name+"_cbshape","CBShape",*x,*m0,*sigma,*alpha,*n);
RooGaussian* gaussian = new RooGaussian(_name+"_gaussian","Gaussian",*x,*gmean,*gsigma);
_thePdf = new RooAddPdf(_name,"CBShapeGaussian",*cbshape,*gaussian,*frac);
}
else if (model=="BifurGauss") {
_thePdf = new RooBifurGauss(_name,"BifurGauss",*x,*mean,*sigmaL,*sigmaR);
}
else if (model=="gauss") {
_thePdf = new RooGaussian(_name,"gaussian",*x,*mean,*sigma);
}
Expand Down Expand Up @@ -342,10 +354,63 @@ void RscBaseModel::readDataCard() {
getDataCard(),
coef_7,0);
}

if (model=="histo")
RooArgSet(fileName,dataName)
.readFromFile(getDataCard(), 0, _name);
if (model=="histo") {
RooArgSet(fileName,dataName).readFromFile(getDataCard(), 0, _name);
}
if (model=="BifurGauss") {
readParameter(_name+"_mean",
"mean",
_name,
getDataCard(),
mean,0);
readParameter(_name+"_sigmaL",
"sigmaL",
_name,
getDataCard(),
sigmaL,0);
readParameter(_name+"_sigmaR",
"sigmaR",
_name,
getDataCard(),
sigmaR,0);
}
if (model=="CBShapeGaussian") {
readParameter(_name+"_m0",
"m0",
_name,
getDataCard(),
m0,0);
readParameter(_name+"_sigma",
"sigma",
_name,
getDataCard(),
sigma,0);
readParameter(_name+"_alpha",
"alpha",
_name,
getDataCard(),
alpha,0);
readParameter(_name+"_n",
"n",
_name,
getDataCard(),
n,0);
readParameter(_name+"_gmean",
"gmean",
_name,
getDataCard(),
gmean,0);
readParameter(_name+"_gsigma",
"gsigma",
_name,
getDataCard(),
gsigma,0);
readParameter(_name+"_frac",
"frac",
_name,
getDataCard(),
frac,0);
}
}
}

Expand All @@ -363,6 +428,12 @@ void RscBaseModel::writeDataCard(ostream& out) {
if (model=="dblgauss") RooArgSet(*mean1,*sigma1,*mean2,*sigma2,*frac)
.writeToStream(out,false);

if (model=="CBShapeGaussian") RooArgSet(*m0,*sigma,*alpha,*n,*gmean,*gsigma,*frac)
.writeToStream(out,false);

if (model=="BifurGauss") RooArgSet(*mean,*sigmaL,*sigmaR)
.writeToStream(out,false);

if (model=="exponential") RooArgSet(*slope)
.writeToStream(out,false);

Expand Down

0 comments on commit c039215

Please sign in to comment.