44 using namespace RooFit ;
45 using namespace RooStats ;
92 Double_t lowRange = 00, highRange = 200;
95 RooRealVar invMass(
"invMass",
"M_{inv}", lowRange, highRange,
"GeV");
96 RooRealVar isolation(
"isolation",
"isolation", 0., 20.,
"GeV");
103 std::cout <<
"make z model" << std::endl;
105 RooRealVar mZ(
"mZ",
"Z Mass", 91.2, lowRange, highRange);
106 RooRealVar sigmaZ(
"sigmaZ",
"Width of Gaussian", 2,0,10,
"GeV");
107 RooGaussian mZModel(
"mZModel",
"Z+jets Model", invMass, mZ, sigmaZ);
117 "z isolation decay constant", -1);
118 RooExponential zIsolationModel(
"zIsolationModel",
"z isolation model",
119 isolation, zIsolDecayConst);
122 RooProdPdf zModel(
"zModel",
"4-d model for Z",
128 std::cout <<
"make qcd model" << std::endl;
134 RooRealVar qcdMassDecayConst(
"qcdMassDecayConst",
135 "Decay const for QCD mass spectrum",
136 -0.01, -100, 100,
"1/GeV");
138 invMass, qcdMassDecayConst);
146 "Et resolution constant", -.1);
147 RooExponential qcdIsolationModel(
"qcdIsolationModel",
"QCD isolation model",
148 isolation, qcdIsolDecayConst);
151 RooProdPdf qcdModel(
"qcdModel",
"2-d model for QCD",
152 RooArgSet(qcdMassModel, qcdIsolationModel));
159 RooRealVar zYield(
"zYield",
"fitted yield for Z",50 ,0.,1000) ;
160 RooRealVar qcdYield(
"qcdYield",
"fitted yield for QCD", 100 ,0.,1000) ;
163 std::cout <<
"make full model" << std::endl;
164 RooAddPdf model(
"model",
"z+qcd background models",
172 std::cout <<
"import model" << std::endl;
190 std::cout <<
"make data set and import to workspace" << std::endl;
200 std::cout <<
"Calculate sWeights" << std::endl;
214 RooRealVar* qcdMassDecayConst = ws->
var(
"qcdMassDecayConst");
225 *data, model,
RooArgList(*zYield,*qcdYield) );
230 std::cout <<
"Check SWeights:" << std::endl;
233 std::cout << std::endl <<
"Yield of Z is "
234 << zYield->
getVal() <<
". From sWeights it is "
238 std::cout <<
"Yield of QCD is "
239 << qcdYield->
getVal() <<
". From sWeights it is "
243 for(
Int_t i=0; i < 10; i++)
245 std::cout <<
"z Weight " << sData->
GetSWeight(i,
"zYield")
246 <<
" qcd Weight " << sData->
GetSWeight(i,
"qcdYield")
251 std::cout << std::endl;
254 std::cout <<
"import new dataset with sWeights" << std::endl;
264 std::cout <<
"make plots" << std::endl;
267 TCanvas* cdata =
new TCanvas(
"sPlot",
"sPlot demo", 400, 600);
294 frame->
SetTitle(
"Fit of model to discriminating variable");
315 frame2->
SetTitle(
"isolation distribution for Z");
327 frame3->
SetTitle(
"isolation distribution for QCD");
virtual const char * GetTitle() const
Returns title of object.
RooCmdArg LineColor(Color_t color)
RooAbsData * data(const char *name) const
Retrieve dataset (binned or unbinned) with given name. A null pointer is returned if not found...
void AddData(RooWorkspace *)
RooProdPdf is an efficient implementation of a product of PDFs of the form.
Double_t GetSumOfEventSWeight(Int_t numEvent) const
void MakePlots(RooWorkspace *)
void AddModel(RooWorkspace *)
void SetTitle(const char *name)
Set the title of the RooPlot to 'title'.
static RooMsgService & instance()
Return reference to singleton instance.
RooCmdArg Extended(Bool_t flag=kTRUE)
Double_t GetYieldFromSWeight(const char *sVariable) const
RooAbsPdf * pdf(const char *name) const
Retrieve p.d.f (RooAbsPdf) with given name. A null pointer is returned if not found.
RooCmdArg DataError(Int_t)
RooCmdArg LineStyle(Style_t style)
RooConstVar represent a constant real-valued object.
Double_t getVal(const RooArgSet *set=0) const
virtual RooPlot * plotOn(RooPlot *frame, const RooCmdArg &arg1=RooCmdArg::none(), const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none(), const RooCmdArg &arg6=RooCmdArg::none(), const RooCmdArg &arg7=RooCmdArg::none(), const RooCmdArg &arg8=RooCmdArg::none()) const
Plot dataset on specified frame.
void graphVizTree(const char *fileName, const char *delimiter="\n", bool useTitle=false, bool useLatex=false)
Create a GraphViz .dot file visualizing the expression tree headed by this RooAbsArg object...
RooRealVar represents a fundamental (non-derived) real valued object.
virtual RooPlot * plotOn(RooPlot *frame, const RooCmdArg &arg1=RooCmdArg::none(), const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none(), const RooCmdArg &arg6=RooCmdArg::none(), const RooCmdArg &arg7=RooCmdArg::none(), const RooCmdArg &arg8=RooCmdArg::none(), const RooCmdArg &arg9=RooCmdArg::none(), const RooCmdArg &arg10=RooCmdArg::none()) const
Plot (project) PDF on specified frame.
void setConstant(Bool_t value=kTRUE)
virtual const char * GetName() const
Returns name of object.
RooCmdArg Rename(const char *suffix)
void setSilentMode(Bool_t flag)
RooPlot * frame(const RooCmdArg &arg1, const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none(), const RooCmdArg &arg6=RooCmdArg::none(), const RooCmdArg &arg7=RooCmdArg::none(), const RooCmdArg &arg8=RooCmdArg::none()) const
RooDataSet is a container class to hold unbinned data.
Double_t GetSWeight(Int_t numEvent, const char *sVariable) const
RooRealVar * var(const char *name) const
Retrieve real-valued variable (RooRealVar) with given name. A null pointer is returned if not found...
A RooPlot is a plot frame and a container for graphics objects within that frame. ...
RooCmdArg Components(const RooArgSet &compSet)
RooAbsPdf is the abstract interface for all probability density functions The class provides hybrid a...
Bool_t import(const RooAbsArg &arg, const RooCmdArg &arg1=RooCmdArg(), const RooCmdArg &arg2=RooCmdArg(), const RooCmdArg &arg3=RooCmdArg(), const RooCmdArg &arg4=RooCmdArg(), const RooCmdArg &arg5=RooCmdArg(), const RooCmdArg &arg6=RooCmdArg(), const RooCmdArg &arg7=RooCmdArg(), const RooCmdArg &arg8=RooCmdArg(), const RooCmdArg &arg9=RooCmdArg())
Import a RooAbsArg object, e.g.
RooDataSet * generate(const RooArgSet &whatVars, Int_t nEvents, const RooCmdArg &arg1, const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none())
Generate a new dataset containing the specified variables with events sampled from our distribution...
virtual RooFitResult * fitTo(RooAbsData &data, const RooCmdArg &arg1=RooCmdArg::none(), const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none(), const RooCmdArg &arg6=RooCmdArg::none(), const RooCmdArg &arg7=RooCmdArg::none(), const RooCmdArg &arg8=RooCmdArg::none())
Fit PDF to given dataset.
This class calculates sWeights used to create an sPlot.
virtual const RooArgSet * get(Int_t index) const
Return RooArgSet with coordinates of event 'index'.
void DoSPlot(RooWorkspace *)
The RooWorkspace is a persistable container for RooFit projects.
virtual void Draw(Option_t *options=0)
Draw this plot and all of the elements it contains.