26 std::string channelPdfName = channelPdf->
GetName();
27 std::string ChannelName = channelPdfName.substr(6, channelPdfName.size() );
35 if(verbose) std::cout <<
"Getting the RooRealSumPdf for the channel: "
36 << sim_channel->
GetName() << std::endl;
38 std::string channelPdfName = sim_channel->
GetName();
39 std::string ChannelName = channelPdfName.substr(6, channelPdfName.size() );
43 std::string realSumPdfName = ChannelName +
"_model";
47 bool FoundSumPdf=
false;
50 std::string NodeClassName = sum_pdf_arg->
ClassName();
51 if( NodeClassName == std::string(
"RooRealSumPdf") ) {
59 std::cout <<
"Failed to find RooRealSumPdf for channel: " << sim_channel->
GetName() << std::endl;
66 if(verbose) std::cout <<
"Found RooRealSumPdf: " << sum_pdf->
GetName() << std::endl;
79 const std::type_info &
id =
typeid(pdf);
83 for (
int i = 0,
n = list.getSize(); i <
n; ++i) {
90 for (
int ic = 0, nc = cat->
numBins((
const char *)0); ic < nc; ++ic) {
98 if (!constraints.
contains(pdf)) constraints.
add(pdf);
187 bool FoundParamHistFunc=
false;
190 std::string NodeName = paramfunc_arg->
GetName();
191 std::string NodeClassName = paramfunc_arg->
ClassName();
192 if( NodeClassName != std::string(
"ParamHistFunc") )
continue;
193 if( NodeName.find(
"mc_stat_") != std::string::npos ) {
194 FoundParamHistFunc=
true;
199 if( ! FoundParamHistFunc || !paramfunc ) {
200 if(verbose) std::cout <<
"Failed to find ParamHistFunc for channel: " << channel->
GetName() << std::endl;
209 if(verbose) gammaList->
Print(
"V");
232 if( strcmp(temp->
ClassName(),
"RooCategory")==0){
238 if(!cat) std::cout <<
"didn't find category"<< std::endl;
239 else std::cout <<
"found category"<< std::endl;
245 if(verbose) dataByCategory->
Print();
258 std::string ChannelName = pdftmp->
GetName();
259 if(verbose) std::cout <<
"Getting data for channel: " << ChannelName << std::endl;
260 ChannelBinDataMap[ ChannelName ] = std::vector<double>();
263 if(verbose) dataForChan->Print();
268 if(verbose) obs->
Print();
282 TH1* histForN = dataForChan->createHistogram(
"HhstForN",*obs);
283 for(
int i=1; i<=histForN->
GetNbinsX(); ++i){
285 if(verbose) std::cout <<
"n" << i <<
" = " << n << std::endl;
286 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;
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
int getStatUncertaintyConstraintTerm(RooArgList *constraints, RooRealVar *gamma_stat, RooAbsReal *&pois_mean, RooRealVar *&tau)
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
TIterator * serverIterator() const
bool getStatUncertaintyFromChannel(RooAbsPdf *channel, ParamHistFunc *¶mfunc, RooArgList *gammaList)
RooArgSet * getObservables(const RooArgSet &set, Bool_t valueOnly=kTRUE) const
const RooAbsCategoryLValue & indexCat() const
Bool_t contains(const RooAbsArg &var) const
std::string channelNameFromPdf(RooAbsPdf *channelPdf)
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
virtual Int_t GetNbinsX() const
RooAbsPdf * getPdf(const char *catName) const
Return the p.d.f associated with the given index category name.
Iterator abstract base class.
RooAbsArg * first() const
virtual void Print(Option_t *options=0) const
Print TNamed name and title.
std::map< std::string, std::string >::const_iterator iter
TIterator * createIterator(Bool_t dir=kIterForward) const
virtual const RooArgSet * get() const
virtual const char * ClassName() const
Returns name of class to which the object belongs.
virtual Int_t numBins(const char *rangeName) const
Returm the number of fit bins ( = number of types )
virtual void Print(Option_t *options=0) const
This method must be overridden when a class wants to print itself.
void getDataValuesForObservables(std::map< std::string, std::vector< double > > &ChannelBinDataMap, RooAbsData *data, RooAbsPdf *simPdf)
virtual const char * GetName() const
Returns name of object.
virtual void Print(Option_t *option="") const
Default print for collections, calls Print(option, 1).
Namespace for the RooStats classes.
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
virtual TObject * Clone(const char *newname=0) const
Make a clone of an object using the Streamer facility.
RooArgSet * getComponents() 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.
const RooArgList & paramList() const
RooAbsPdf is the abstract interface for all probability density functions The class provides hybrid a...
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 TObject * Next()=0
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 const char * getLabel() const
Return label string of current state.
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
const RooArgList & pdfList() const
RooAbsPdf * getSumPdfFromChannel(RooAbsPdf *channel)
virtual const Text_t * GetName() const
Returns name of object.
void FactorizeHistFactoryPdf(const RooArgSet &, RooAbsPdf &, RooArgList &, RooArgList &)
TIterator * typeIterator() const
Return iterator over all defined states.
const char * GetName() const
Returns name of object.