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;
254 for (
const auto& nameIdx : *channelCat) {
259 std::string ChannelName = pdftmp->
GetName();
260 if(
verbose) std::cout <<
"Getting data for channel: " << ChannelName << std::endl;
261 ChannelBinDataMap[ ChannelName ] = std::vector<double>();
284 for(
int i=1; i<=histForN->
GetNbinsX(); ++i){
286 if(
verbose) std::cout <<
"n" << i <<
" = " <<
n << std::endl;
287 ChannelBinDataMap[ ChannelName ].push_back(
n );
312 bool FoundConstraintTerm=
false;
315 std::string TermName = term_constr->
GetName();
319 if( term_constr->
dependsOn( *gamma_stat) ) {
320 if( TermName.find(
"_constraint")!=std::string::npos ) {
321 FoundConstraintTerm=
true;
322 constraintTerm = (
RooAbsPdf*) term_constr;
327 if( FoundConstraintTerm==
false ) {
328 std::cout <<
"Error: Couldn't find constraint term for parameter: " << gamma_stat->
GetName()
329 <<
" among constraints: " << constraints->
GetName() << std::endl;
330 constraints->
Print(
"V");
331 throw std::runtime_error(
"Failed to find Gamma ConstraintTerm");
349 bool FoundNomMean=
false;
353 std::string serverName = term_pois->
GetName();
355 if( serverName.find(
"nom_")!=std::string::npos ) {
360 if( !FoundNomMean || !pois_nom ) {
361 std::cout <<
"Error: Did not find Nominal Pois Mean parameter in gamma constraint term PoissonMean: "
362 << constraintTerm->
GetName() << std::endl;
363 throw std::runtime_error(
"Failed to find Nom Pois Mean");
366 if(
verbose) std::cout <<
"Found Poisson 'data' term: " << pois_nom->
GetName() << std::endl;
375 bool FoundPoissonMean =
false;
376 while(( pois_mean_arg = (
RooAbsArg*) iter_constr->
Next() )) {
377 std::string serverName = pois_mean_arg->
GetName();
378 if( pois_mean_arg->
dependsOn( *gamma_stat ) ) {
379 FoundPoissonMean=
true;
384 if( !FoundPoissonMean || !pois_mean_arg ) {
385 std::cout <<
"Error: Did not find PoissonMean parameter in gamma constraint term: "
386 << constraintTerm->
GetName() << std::endl;
387 throw std::runtime_error(
"Failed to find PoissonMean");
391 if(
verbose) std::cout <<
"Found Poisson 'mean' term: " << pois_mean_arg->
GetName() << std::endl;
400 std::string serverName = term_in_product->
GetName();
402 if( serverName.find(
"_tau")!=std::string::npos ) {
407 if( !FoundTau || !tau ) {
408 std::cout <<
"Error: Did not find Tau parameter in gamma constraint term PoissonMean: "
409 << pois_mean_arg->
GetName() << std::endl;
410 throw std::runtime_error(
"Failed to find Tau");
413 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 the object to the defaultPrintStream().
RooArgSet * getComponents() const
TIterator * serverIterator() const
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
Return the number of fit bins ( = number of types )
virtual const char * getCurrentLabel() const
Return label string of current state.
Bool_t contains(const RooAbsArg &var) const
Check if collection contains an argument with the same name as var.
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
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.
RooCategory is an object to represent discrete states.
RooProdPdf is an efficient implementation of a product of PDFs of the form.
const RooArgList & pdfList() const
RooRealVar represents a variable that can be changed from the outside.
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.