76 for(
Int_t i=0; i<nbins; ++i){
78 std::stringstream str;
81 new RooRealVar((
"expected_s"+str.str()).c_str(),(
"expected_s"+str.str()).c_str(),sig[i], 0., 2*sig[i]);
88 new RooRealVar((
"b"+str.str()).c_str(),(
"b"+str.str()).c_str(), .5, 0.,1.);
90 new RooRealVar((
"tau"+str.str()).c_str(),(
"tau"+str.str()).c_str(), .5, 0., 1.);
94 new RooAddition((
"splusb"+str.str()).c_str(),(
"s"+str.str()+
"+"+
"b"+str.str()).c_str(),
99 new RooRealVar((
"x"+str.str()).c_str(),(
"x"+str.str()).c_str(), 0.5 , 0., 1.);
101 new RooRealVar((
"y"+str.str()).c_str(),(
"y"+str.str()).c_str(), 0.5, 0., 1.);
105 new RooPoisson((
"sigRegion"+str.str()).c_str(),(
"sigRegion"+str.str()).c_str(), *
x,*
splusb);
109 new RooPoisson((
"sideband"+str.str()).c_str(),(
"sideband"+str.str()).c_str(), *
y,*
bTau,
true);
135 std::vector<double>
mainMeas(nbins);
138 for(
Int_t i=0; i<nbins; ++i){
152 std::vector<double>
mainMeas(nbins);
153 std::vector<double>
sideband(nbins);
154 for(
Int_t i=0; i<nbins; ++i){
183 x->setMax( std::max(
x->getMax(), 10*
value ) );
202 std::vector<double>
xForTree(nbins);
203 std::vector<double>
yForTree(nbins);
206 for(
Int_t i=0; i<nbins; ++i){
207 std::stringstream str;
213 double _tau = (1.0 + sqrt(1 + 4 * err * err))/ (2. * err * err)/ back[i];
215 RooRealVar* tau = SafeObservableCreation(ws, (
"tau"+str.str()).c_str(), _tau );
217 oocoutW(ws,ObjectHandling) <<
"NumberCountingPdfFactory: changed value of " << tau->
GetName() <<
" to " << tau->
getVal() <<
218 " to be consistent with background and its uncertainty. " <<
219 " Also stored these values of tau into workspace with name . " << (std::string{tau->
GetName()}+
dsName).c_str() <<
220 " if you test with a different dataset, you should adjust tau appropriately.\n"<< std::endl;
229 RooRealVar*
y = SafeObservableCreation(ws, (
"y"+str.str()).c_str(), back[i]*_tau );
237 tree->Branch((
"x"+str.str()).c_str(), &
xForTree[i] ,(
"x"+str.str()+
"/D").c_str());
238 tree->Branch((
"y"+str.str()).c_str(), &
yForTree[i] ,(
"y"+str.str()+
"/D").c_str());
241 ws->
var(
"b"+str.str())->
setVal( back[i] );
275 std::vector<double>
xForTree(nbins);
276 std::vector<double>
yForTree(nbins);
280 for(
Int_t i=0; i<nbins; ++i){
281 std::stringstream str;
289 RooRealVar* tau = SafeObservableCreation(ws, (
"tau"+str.str()).c_str(), _tau );
291 oocoutW(ws,ObjectHandling) <<
"NumberCountingPdfFactory: changed value of " << tau->
GetName() <<
" to " << tau->
getVal() <<
292 " to be consistent with background and its uncertainty. " <<
293 " Also stored these values of tau into workspace with name . " << (std::string{tau->
GetName()}+
dsName).c_str() <<
294 " if you test with a different dataset, you should adjust tau appropriately.\n"<< std::endl;
312 tree->Branch((
"x"+str.str()).c_str(), &
xForTree[i] ,(
"x"+str.str()+
"/D").c_str());
313 tree->Branch((
"y"+str.str()).c_str(), &
yForTree[i] ,(
"y"+str.str()+
"/D").c_str());
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
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.
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.
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.
const char * GetName() const override
Returns name of object.
A TTree represents a columnar dataset.
RooCmdArg Import(const char *state, TH1 &histo)