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;
212 if(verbose) gammaList->
Print(
"V");
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;
247 std::cerr <<
"Category not found"<< std::endl;
253 if(verbose) dataByCategory->
Print();
259 for (
const auto& nameIdx : *channelCat) {
264 std::string ChannelName = pdftmp->
GetName();
265 if(verbose) std::cout <<
"Getting data for channel: " << ChannelName << std::endl;
266 ChannelBinDataMap[ ChannelName ] = std::vector<double>();
269 if(verbose) dataForChan->
Print();
274 if(verbose) obs->
Print();
289 for(
int i=1; i<=histForN->
GetNbinsX(); ++i){
291 if(verbose) std::cout <<
"n" << i <<
" = " <<
n << std::endl;
292 ChannelBinDataMap[ ChannelName ].push_back(
n );
299 delete dataByCategory;
317 bool FoundConstraintTerm=
false;
320 std::string TermName = term_constr->
GetName();
324 if( term_constr->
dependsOn( *gamma_stat) ) {
325 if( TermName.find(
"_constraint")!=std::string::npos ) {
326 FoundConstraintTerm=
true;
327 constraintTerm = (
RooAbsPdf*) term_constr;
332 if( FoundConstraintTerm==
false ) {
333 std::cout <<
"Error: Couldn't find constraint term for parameter: " << gamma_stat->
GetName()
334 <<
" among constraints: " << constraints->
GetName() << std::endl;
335 constraints->
Print(
"V");
336 throw std::runtime_error(
"Failed to find Gamma ConstraintTerm");
354 bool FoundNomMean=
false;
358 std::string serverName = term_pois->
GetName();
360 if( serverName.find(
"nom_")!=std::string::npos ) {
365 if( !FoundNomMean || !pois_nom ) {
366 std::cout <<
"Error: Did not find Nominal Pois Mean parameter in gamma constraint term PoissonMean: "
367 << constraintTerm->
GetName() << std::endl;
368 throw std::runtime_error(
"Failed to find Nom Pois Mean");
371 if(verbose) std::cout <<
"Found Poisson 'data' term: " << pois_nom->
GetName() << std::endl;
379 bool FoundPoissonMean =
false;
381 std::string serverName = pois_mean_arg->
GetName();
382 if( pois_mean_arg->
dependsOn( *gamma_stat ) ) {
383 FoundPoissonMean=
true;
388 if( !FoundPoissonMean || !pois_mean_arg ) {
389 std::cout <<
"Error: Did not find PoissonMean parameter in gamma constraint term: "
390 << constraintTerm->
GetName() << std::endl;
391 throw std::runtime_error(
"Failed to find PoissonMean");
395 if(verbose) std::cout <<
"Found Poisson 'mean' term: " << pois_mean_arg->
GetName() << std::endl;
402 std::string serverName = term_in_product->
GetName();
404 if( serverName.find(
"_tau")!=std::string::npos ) {
409 if( !FoundTau || !tau ) {
410 std::cout <<
"Error: Did not find Tau parameter in gamma constraint term PoissonMean: "
411 << pois_mean_arg->
GetName() << std::endl;
412 throw std::runtime_error(
"Failed to find Tau");
415 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 and a "shape" in RooFi...
RooArgSet * getObservables(const RooArgSet &set, Bool_t valueOnly=kTRUE) const
Given a set of possible observables, return the observables that this PDF depends on.
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
Create a RooArgSet with all components (branch nodes) of the expression tree headed by this object.
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=nullptr) 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.
virtual void Print(Option_t *options=0) const
Print TNamed name and title.
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...
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).
TH1 is the base class of all histogram classes in ROOT.
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 void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
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.