68 TList likelihoodFactors;
73 new RooRealVar(muName,
"masterSignal",1., 0., 3.);
79 std::stringstream str;
82 new RooRealVar((
"expected_s"+str.str()).c_str(),(
"expected_s"+str.str()).c_str(),sig[
i], 0., 2*sig[
i]);
86 new RooProduct((
"s"+str.str()).c_str(),(
"s"+str.str()).c_str(),
RooArgSet(*masterSignal, *expectedSignal));
89 new RooRealVar((
"b"+str.str()).c_str(),(
"b"+str.str()).c_str(), .5, 0.,1.);
91 new RooRealVar((
"tau"+str.str()).c_str(),(
"tau"+str.str()).c_str(), .5, 0., 1.);
95 new RooAddition((
"splusb"+str.str()).c_str(),(
"s"+str.str()+
"+"+
"b"+str.str()).c_str(),
100 new RooRealVar((
"x"+str.str()).c_str(),(
"x"+str.str()).c_str(), 0.5 , 0., 1.);
102 new RooRealVar((
"y"+str.str()).c_str(),(
"y"+str.str()).c_str(), 0.5, 0., 1.);
106 new RooPoisson((
"sigRegion"+str.str()).c_str(),(
"sigRegion"+str.str()).c_str(), *
x,*splusb);
110 new RooPoisson((
"sideband"+str.str()).c_str(),(
"sideband"+str.str()).c_str(), *
y,*bTau,
true);
112 likelihoodFactors.
Add(sigRegion);
113 likelihoodFactors.
Add(sideband);
117 RooArgSet likelihoodFactorSet(likelihoodFactors);
118 RooProdPdf joint(pdfName,
"joint", likelihoodFactorSet );
136 std::vector<double> mainMeas(nbins);
140 mainMeas[
i] = sig[
i] + back[
i];
142 return AddData(&mainMeas[0], back, back_syst, nbins, ws, dsName);
153 std::vector<double> mainMeas(nbins);
154 std::vector<double> sideband(nbins);
156 mainMeas[
i] = sigExp[
i] + backExp[
i];
157 sideband[
i] = backExp[
i]*tau[
i];
178 double value,
double maximum)
184 x->setMax( std::max(
x->getMax(), 10*
value ) );
200 TList observablesCollection;
203 std::vector<double> xForTree(nbins);
204 std::vector<double> yForTree(nbins);
208 std::stringstream str;
213 double err = back_syst[
i];
214 double _tau = (1.0 + sqrt(1 + 4 * err * err))/ (2. * err * err)/ back[
i];
218 oocoutW(ws,ObjectHandling) <<
"NumberCountingPdfFactory: changed value of " << tau->
GetName() <<
" to " << tau->
getVal() <<
219 " to be consistent with background and its uncertainty. " <<
220 " Also stored these values of tau into workspace with name . " << (std::string{tau->
GetName()}+dsName).c_str() <<
221 " if you test with a different dataset, you should adjust tau appropriately.\n"<< std::endl;
223 ws->
import(*(
static_cast<RooRealVar*
>(tau->
clone( (std::string{tau->GetName()}+dsName).c_str() )) ) );
232 observablesCollection.
Add(
x);
233 observablesCollection.
Add(
y);
235 xForTree[
i] = mainMeas[
i];
236 yForTree[
i] = back[
i]*_tau;
238 tree->Branch((
"x"+str.str()).c_str(), &xForTree[
i] ,(
"x"+str.str()+
"/D").c_str());
239 tree->Branch((
"y"+str.str()).c_str(), &yForTree[
i] ,(
"y"+str.str()+
"/D").c_str());
241 ws->
var(
"b"+str.str())->
setMax( 1.2*back[
i]+MaxSigma*(sqrt(back[
i])+back[
i]*back_syst[
i]) );
272 TList observablesCollection;
276 std::vector<double> xForTree(nbins);
277 std::vector<double> yForTree(nbins);
282 std::stringstream str;
285 double _tau = tauForTree[
i];
286 double back_syst = 1./sqrt(sideband[
i]);
287 double back = (sideband[
i]/_tau);
292 oocoutW(ws,ObjectHandling) <<
"NumberCountingPdfFactory: changed value of " << tau->
GetName() <<
" to " << tau->
getVal() <<
293 " to be consistent with background and its uncertainty. " <<
294 " Also stored these values of tau into workspace with name . " << (std::string{tau->
GetName()}+dsName).c_str() <<
295 " if you test with a different dataset, you should adjust tau appropriately.\n"<< std::endl;
297 ws->
import(*(
static_cast<RooRealVar*
>(tau->
clone( (std::string{tau->GetName()}+dsName).c_str() )) ) );
307 observablesCollection.
Add(
x);
308 observablesCollection.
Add(
y);
310 xForTree[
i] = mainMeas[
i];
311 yForTree[
i] = sideband[
i];
313 tree->Branch((
"x"+str.str()).c_str(), &xForTree[
i] ,(
"x"+str.str()+
"/D").c_str());
314 tree->Branch((
"y"+str.str()).c_str(), &yForTree[
i] ,(
"y"+str.str()+
"/D").c_str());
316 ws->
var(
"b"+str.str())->
setMax( 1.2*back+MaxSigma*(sqrt(back)+back*back_syst) );
322 RooArgList observableList{observablesCollection};
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
void setConstant(bool value=true)
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
Calculates the sum of a set of RooAbsReal terms, or when constructed with two sets,...
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Container class to hold unbinned data.
static RooMsgService & instance()
Return reference to singleton instance.
void setGlobalKillBelow(RooFit::MsgLevel level)
Efficient implementation of a product of PDFs of the form.
Represents the product of a given set of RooAbsReal objects.
Variable that can be changed from the outside.
void setVal(double value) override
Set value of variable to 'value'.
TObject * clone(const char *newname) const override
void setMax(const char *name, double value)
Set maximum of name range to given value.
A factory for building PDFs and data for a number counting combination.
void AddDataWithSideband(double *mainMeas, double *sideband, double *tau, Int_t nbins, RooWorkspace *ws, const char *dsName="ExpectedNumberCountingData")
Arguments are an array of expected signal, expected background, and relative background uncertainty (...
void AddModel(double *sigExp, Int_t nchan, RooWorkspace *ws, const char *pdfName="CombinedPdf", const char *masterSignalName="masterSignal")
This method produces a PDF for N channels with uncorrelated background uncertainty.
void AddData(double *mainMeas, double *bkgMeas, double *db, Int_t nbins, RooWorkspace *ws, const char *dsName="NumberCountingData")
Arguments are an array of results from a main measurement, a measured background, and relative backgr...
void AddExpData(double *sigExp, double *bkgExp, double *db, Int_t nbins, RooWorkspace *ws, const char *dsName="ExpectedNumberCountingData")
Arguments are an array of expected signal, expected background, and relative background uncertainty (...
RooRealVar * SafeObservableCreation(RooWorkspace *ws, const char *varName, double value)
need to be careful here that the range of observable in the dataset is consistent with the one in the...
void AddExpDataWithSideband(double *sigExp, double *bkgExp, double *tau, Int_t nbins, RooWorkspace *ws, const char *dsName="NumberCountingData")
Arguments are an array of expected signal, expected background, and relative ratio of background expe...
Persistable container for RooFit projects.
RooRealVar * var(RooStringView name) const
Retrieve real-valued variable (RooRealVar) with given name. A null pointer is returned if not found.
bool import(const RooAbsArg &arg, const RooCmdArg &arg1={}, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={}, const RooCmdArg &arg6={}, const RooCmdArg &arg7={}, const RooCmdArg &arg8={}, const RooCmdArg &arg9={})
Import a RooAbsArg object, e.g.
void Add(TObject *obj) override
const char * GetName() const override
Returns name of object.
A TTree represents a columnar dataset.
RooCmdArg Import(const char *state, TH1 &histo)