92 Double_t lowRange = 0., highRange = 200.;
95 RooRealVar invMass(
"invMass",
"M_{inv}", lowRange, highRange,
"GeV");
96 RooRealVar isolation(
"isolation",
"isolation", 0., 20.,
"GeV");
102 std::cout <<
"make z model" << std::endl;
104 RooRealVar mZ(
"mZ",
"Z Mass", 91.2, lowRange, highRange);
105 RooRealVar sigmaZ(
"sigmaZ",
"Width of Gaussian", 2, 0, 10,
"GeV");
106 RooGaussian mZModel(
"mZModel",
"Z+jets Model", invMass, mZ, sigmaZ);
115 RooConstVar zIsolDecayConst(
"zIsolDecayConst",
"z isolation decay constant", -1);
116 RooExponential zIsolationModel(
"zIsolationModel",
"z isolation model", isolation, zIsolDecayConst);
124 std::cout <<
"make qcd model" << std::endl;
130 RooRealVar qcdMassDecayConst(
"qcdMassDecayConst",
"Decay const for QCD mass spectrum", -0.01, -100, 100,
"1/GeV");
131 RooExponential qcdMassModel(
"qcdMassModel",
"qcd Mass Model", invMass, qcdMassDecayConst);
137 RooConstVar qcdIsolDecayConst(
"qcdIsolDecayConst",
"Et resolution constant", -.1);
138 RooExponential qcdIsolationModel(
"qcdIsolationModel",
"QCD isolation model", isolation, qcdIsolDecayConst);
141 RooProdPdf qcdModel(
"qcdModel",
"2-d model for QCD",
RooArgSet(qcdMassModel, qcdIsolationModel));
148 RooRealVar zYield(
"zYield",
"fitted yield for Z", 50, 0., 1000);
149 RooRealVar qcdYield(
"qcdYield",
"fitted yield for QCD", 100, 0., 1000);
152 std::cout <<
"make full model" << std::endl;
156 model.graphVizTree(
"fullModel.dot");
158 std::cout <<
"import model" << std::endl;
169 Int_t nEvents = 1000;
177 std::cout <<
"make data set and import to workspace" << std::endl;
187 std::cout <<
"Calculate sWeights" << std::endl;
212 std::cout <<
"\n\n------------------------------------------\nThe dataset before creating sWeights:\n";
221 std::cout <<
"\n\nThe dataset after creating sWeights:\n";
226 std::cout <<
"\n\n------------------------------------------\n\nCheck SWeights:" << std::endl;
228 std::cout << std::endl
229 <<
"Yield of Z is\t" << zYield->
getVal() <<
". From sWeights it is "
232 std::cout <<
"Yield of QCD is\t" << qcdYield->
getVal() <<
". From sWeights it is "
236 for (
Int_t i = 0; i < 10; i++) {
237 std::cout <<
"z Weight for event " << i << std::right << std::setw(12) << sData->
GetSWeight(i,
"zYield") <<
" qcd Weight"
242 std::cout << std::endl;
245 std::cout <<
"import new dataset with sWeights" << std::endl;
246 ws->import(*data,
Rename(
"dataWithSWeights"));
256 std::cout <<
"make plots" << std::endl;
287 leg.AddEntry(frame->
findObject(
"FullModel"),
"Full model",
"L");
289 leg.AddEntry(frame->
findObject(
"QCDModel"),
"QCD model",
"L");
290 leg.SetBorderSize(0);
293 frame->
SetTitle(
"Fit of model to discriminating variable");
315 frame2->
SetTitle(
"Isolation distribution with s weights to project out Z");
327 frame3->
SetTitle(
"Isolation distribution with s weights to project out QCD");
virtual void Print(Option_t *options=0) const
Print TNamed name and title.
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
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())
See RooAbsPdf::generate(const RooArgSet&,const RooCmdArg&,const RooCmdArg&,const RooCmdArg&,...
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.
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
Helper calling plotOn(RooPlot*, RooLinkedList&) const.
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
Create a new RooPlot on the heap with a drawing frame initialized for this object,...
Double_t getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
RooAddPdf is an efficient implementation of a sum of PDFs of the form.
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
RooConstVar represent a constant real-valued object.
RooDataSet is a container class to hold unbinned data.
virtual const RooArgSet * get(Int_t index) const override
Return RooArgSet with coordinates of event 'index'.
static RooMsgService & instance()
Return reference to singleton instance.
void setGlobalKillBelow(RooFit::MsgLevel level)
void setSilentMode(Bool_t flag)
A RooPlot is a plot frame and a container for graphics objects within that frame.
void SetTitle(const char *name)
Set the title of the RooPlot to 'title'.
TObject * findObject(const char *name, const TClass *clas=0) const
Find the named object in our list of items and return a pointer to it.
virtual void Draw(Option_t *options=0)
Draw this plot and all of the elements it contains.
RooProdPdf is an efficient implementation of a product of PDFs of the form.
RooRealVar represents a variable that can be changed from the outside.
A class to calculate "sWeights" used to create an "sPlot".
Double_t GetYieldFromSWeight(const char *sVariable) const
Sum the SWeights for a particular species over all events.
Double_t GetSWeight(Int_t numEvent, const char *sVariable) const
Retrieve an s weight.
Double_t GetSumOfEventSWeight(Int_t numEvent) const
Sum the SWeights for a particular event.
The RooWorkspace is a persistable container for RooFit projects.
TVirtualPad * cd(Int_t subpadnumber=0) override
Set current canvas & pad.
This class displays a legend box (TPaveText) containing several legend entries.
virtual const char * GetTitle() const
Returns title of object.
virtual const char * GetName() const
Returns name of object.
void Divide(Int_t nx=1, Int_t ny=1, Float_t xmargin=0.01, Float_t ymargin=0.01, Int_t color=0) override
Automatic pad generation by division.
RooCmdArg Rename(const char *suffix)
RooCmdArg Extended(Bool_t flag=kTRUE)
RooCmdArg DataError(Int_t)
RooCmdArg Components(const RooArgSet &compSet)
RooCmdArg LineColor(Color_t color)
RooCmdArg LineStyle(Style_t style)
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
Namespace for the RooStats classes.