29 std::string channelPdfName = channelPdf->
GetName();
30 std::string ChannelName = channelPdfName.substr(6, channelPdfName.size() );
38 if(
verbose) std::cout <<
"Getting the RooRealSumPdf for the channel: "
39 << sim_channel->
GetName() << std::endl;
41 std::string channelPdfName = sim_channel->
GetName();
42 std::string ChannelName = channelPdfName.substr(6, channelPdfName.size() );
46 std::string realSumPdfName = ChannelName +
"_model";
50 bool FoundSumPdf=
false;
53 std::string NodeClassName = sum_pdf_arg->
ClassName();
54 if( NodeClassName == std::string(
"RooRealSumPdf") ) {
62 std::cout <<
"Failed to find RooRealSumPdf for channel: " << sim_channel->
GetName() << std::endl;
69 if(
verbose) std::cout <<
"Found RooRealSumPdf: " << sum_pdf->
GetName() << std::endl;
82 const std::type_info &
id =
typeid(pdf);
86 for (
int i = 0,
n = list.
getSize(); i <
n; ++i) {
93 for (
int ic = 0, nc = cat->
numBins((
const char *)0); ic < nc; ++ic) {
101 if (!constraints.
contains(pdf)) constraints.
add(pdf);
190 bool FoundParamHistFunc=
false;
193 std::string NodeName = paramfunc_arg->
GetName();
194 std::string NodeClassName = paramfunc_arg->
ClassName();
195 if( NodeClassName != std::string(
"ParamHistFunc") )
continue;
196 if( NodeName.find(
"mc_stat_") != std::string::npos ) {
197 FoundParamHistFunc=
true;
202 if( ! FoundParamHistFunc || !paramfunc ) {
203 if(
verbose) std::cout <<
"Failed to find ParamHistFunc for channel: " << channel->
GetName() << std::endl;
235 if( strcmp(temp->
ClassName(),
"RooCategory")==0){
241 if(!cat) std::cout <<
"didn't find category"<< std::endl;
242 else std::cout <<
"found category"<< std::endl;
261 std::string ChannelName = pdftmp->
GetName();
262 if(
verbose) std::cout <<
"Getting data for channel: " << ChannelName << std::endl;
263 ChannelBinDataMap[ ChannelName ] = std::vector<double>();
286 for(
int i=1; i<=histForN->
GetNbinsX(); ++i){
288 if(
verbose) std::cout <<
"n" << i <<
" = " <<
n << std::endl;
289 ChannelBinDataMap[ ChannelName ].push_back(
n );
315 bool FoundConstraintTerm=
false;
318 std::string TermName = term_constr->
GetName();
322 if( term_constr->
dependsOn( *gamma_stat) ) {
323 if( TermName.find(
"_constraint")!=std::string::npos ) {
324 FoundConstraintTerm=
true;
325 constraintTerm = (
RooAbsPdf*) term_constr;
330 if( FoundConstraintTerm==
false ) {
331 std::cout <<
"Error: Couldn't find constraint term for parameter: " << gamma_stat->
GetName()
332 <<
" among constraints: " << constraints->
GetName() << std::endl;
333 constraints->
Print(
"V");
334 throw std::runtime_error(
"Failed to find Gamma ConstraintTerm");
352 bool FoundNomMean=
false;
356 std::string serverName = term_pois->
GetName();
358 if( serverName.find(
"nom_")!=std::string::npos ) {
363 if( !FoundNomMean || !pois_nom ) {
364 std::cout <<
"Error: Did not find Nominal Pois Mean parameter in gamma constraint term PoissonMean: "
365 << constraintTerm->
GetName() << std::endl;
366 throw std::runtime_error(
"Failed to find Nom Pois Mean");
369 if(
verbose) std::cout <<
"Found Poisson 'data' term: " << pois_nom->
GetName() << std::endl;
378 bool FoundPoissonMean =
false;
379 while(( pois_mean_arg = (
RooAbsArg*) iter_constr->
Next() )) {
380 std::string serverName = pois_mean_arg->
GetName();
381 if( pois_mean_arg->
dependsOn( *gamma_stat ) ) {
382 FoundPoissonMean=
true;
387 if( !FoundPoissonMean || !pois_mean_arg ) {
388 std::cout <<
"Error: Did not find PoissonMean parameter in gamma constraint term: "
389 << constraintTerm->
GetName() << std::endl;
390 throw std::runtime_error(
"Failed to find PoissonMean");
394 if(
verbose) std::cout <<
"Found Poisson 'mean' term: " << pois_mean_arg->
GetName() << std::endl;
403 std::string serverName = term_in_product->
GetName();
405 if( serverName.find(
"_tau")!=std::string::npos ) {
410 if( !FoundTau || !tau ) {
411 std::cout <<
"Error: Did not find Tau parameter in gamma constraint term PoissonMean: "
412 << pois_mean_arg->
GetName() << std::endl;
413 throw std::runtime_error(
"Failed to find Tau");
416 if(
verbose) std::cout <<
"Found Poisson 'tau' term: " << tau->
GetName() << std::endl;
A class which maps the current values of a RooRealVar (or a set of RooRealVars) to one of a number of...
const RooArgList & paramList() const
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
RooArgSet * getObservables(const RooArgSet &set, Bool_t valueOnly=kTRUE) const
Return the observables of this pdf given a set of observables.
Bool_t dependsOn(const RooAbsCollection &serverList, const RooAbsArg *ignoreArg=0, Bool_t valueOnly=kFALSE) const
Test whether we depend on (ie, are served by) any object in the specified collection.
virtual TObject * Clone(const char *newname=0) const
Make a clone of an object using the Streamer facility.
virtual void Print(Option_t *options=0) const
Print TNamed name and title.
RooArgSet * getComponents() const
TIterator * serverIterator() const R__SUGGEST_ALTERNATIVE("Use servers() and begin()
RooAbsCategoryLValue is the common abstract base class for objects that represent a discrete value th...
virtual void setBin(Int_t ibin, const char *rangeName=0)
Set category to i-th fit bin, which is the i-th registered state.
virtual Int_t numBins(const char *rangeName) const
Returm the number of fit bins ( = number of types )
TIterator * typeIterator() const
Return iterator over all defined states.
virtual const char * getLabel() const
Return label string of current state.
Bool_t contains(const RooAbsArg &var) const
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
RooAbsArg * first() const
virtual void Print(Option_t *options=0) const
This method must be overridden when a class wants to print itself.
const char * GetName() const
Returns name of object.
TIterator * createIterator(Bool_t dir=kIterForward) const R__SUGGEST_ALTERNATIVE("begin()
TIterator-style iteration over contained elements.
RooAbsData is the common abstract base class for binned and unbinned datasets.
virtual const RooArgSet * get() const
virtual TList * split(const RooAbsCategory &splitCat, Bool_t createEmptyDataSets=kFALSE) const
Split dataset into subsets based on states of given splitCat in this dataset.
TH1 * createHistogram(const char *name, const RooAbsRealLValue &xvar, 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
Calls createHistogram(const char *name, const RooAbsRealLValue& xvar, const RooLinkedList& argList) c...
virtual void Print(Option_t *options=0) const
Print TNamed name and title.
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooAbsArg * at(Int_t idx) const
Return object at given index, or nullptr if index is out of range.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
RooCatType is an auxilary class for RooAbsCategory and defines a a single category state.
RooCategory represents a fundamental (non-derived) discrete value object.
RooProdPdf is an efficient implementation of a product of PDFs of the form.
const RooArgList & pdfList() const
RooRealVar represents a fundamental (non-derived) real valued object.
RooSimultaneous facilitates simultaneous fitting of multiple PDFs to subsets of a given dataset.
const RooAbsCategoryLValue & indexCat() const
RooAbsPdf * getPdf(const char *catName) const
Return the p.d.f associated with the given index category name.
RooSimultaneous facilitates simultaneous fitting of multiple PDFs to subsets of a given dataset.
virtual void Print(Option_t *option="") const
Default print for collections, calls Print(option, 1).
virtual Int_t GetNbinsX() const
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
Iterator abstract base class.
virtual TObject * Next()=0
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
virtual const char * GetName() const
Returns name of object.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
bool getStatUncertaintyFromChannel(RooAbsPdf *channel, ParamHistFunc *¶mfunc, RooArgList *gammaList)
void FactorizeHistFactoryPdf(const RooArgSet &, RooAbsPdf &, RooArgList &, RooArgList &)
void getDataValuesForObservables(std::map< std::string, std::vector< double > > &ChannelBinDataMap, RooAbsData *data, RooAbsPdf *simPdf)
RooAbsPdf * getSumPdfFromChannel(RooAbsPdf *channel)
int getStatUncertaintyConstraintTerm(RooArgList *constraints, RooRealVar *gamma_stat, RooAbsReal *&pois_mean, RooRealVar *&tau)
std::string channelNameFromPdf(RooAbsPdf *channelPdf)
Namespace for the RooStats classes.