50 _nll(
"input",
"-log(L) function",
this,
nllIn)
78 _paramFixed(
other._paramFixed)
93 target->setVal(var->getVal()) ;
104 std::cout <<
"Error: Must initialize data before initializing cache" << std::endl;
105 throw std::runtime_error(
"Uninitialized Data");
108 std::cout <<
"Error: Must initialize model pdf before initializing cache" << std::endl;
109 throw std::runtime_error(
"Uninitialized model pdf");
119 RooArgSet*
obsSet = std::unique_ptr<RooArgSet>{_pdf->getObservables(*_data)}.release();
123 std::cout <<
"Error: Found no observable terms with pdf: " << _pdf->GetName()
124 <<
" using dataset: " << _data->GetName() << std::endl;
127 if( constraints.
empty() ) {
128 std::cout <<
"Error: Found no constraint terms with pdf: " << _pdf->GetName()
129 <<
" using dataset: " << _data->GetName() << std::endl;
147 if( ! hasStatUncert ) {
150 <<
" doesn't have statistical uncertainties"
156 if(verbose) std::cout <<
"Found ParamHistFunc: " <<
param_func->GetName() << std::endl;
178 if(!
gamma_stat)
throw std::runtime_error(
"ParamHistFunc contains non-RooRealVar, not supported in RooBarlowBeestonLL");
180 if(verbose) std::cout <<
"Ignoring constant gamma: " <<
gamma_stat->GetName() << std::endl;
187 _statUncertParams.insert(
gamma_stat->GetName() );
205 std::cout <<
"Failed to find pois mean or tau parameter for " <<
gamma_stat->GetName() << std::endl;
209 std::cout <<
"Found pois mean and tau for parameter: " <<
gamma_stat->GetName() <<
" tau: " << tau->
GetName()
221 std::cout <<
"Failed to find RooRealSumPdf in channel " <<
channel_name
222 <<
", therefor skipping this channel for analytic uncertainty minimization"
231 std::cout <<
"Error: channel with name: " <<
channel_name
232 <<
" not found in BinDataMap" << std::endl;
233 throw std::runtime_error(
"BinDataMap");
245 <<
" to the barlow cache" << std::endl;
307 toRemove.reserve( _statUncertParams.size());
314 if( _statUncertParams.find(arg->GetName()) != _statUncertParams.end() ) {
329const RooArgSet& RooStats::HistFactory::RooBarlowBeestonLL::bestFitParams() const
332 return _paramAbsMin ;
338const RooArgSet& RooStats::HistFactory::RooBarlowBeestonLL::bestFitObs() const
396 std::map< std::string, std::vector< BarlowCache > >::iterator
iter_cache;
400 std::vector< BarlowCache >&
channel_cache = (*iter_cache).second;
504 double C = -1*m_val*
nu_b;
509 std::cout <<
"Warning: Discriminant (B*B - 4AC) < 0" << std::endl;
510 std::cout <<
"Warning: Taking B*B - 4*A*C == 0" << std::endl;
515 std::cout <<
"Warning: A <= 0" << std::endl;
516 throw std::runtime_error(
"BarlowBeestonLL::evaluate() : A < 0");
530 std::cout <<
"ERROR: gamma hat hat is NAN" << std::endl;
531 throw std::runtime_error(
"BarlowBeestonLL::evaluate() : gamma hat hat is NAN");
535 std::cout <<
"WARNING: gamma hat hat <= 0. Setting to 0" << std::endl;
582void RooStats::HistFactory::RooBarlowBeestonLL::validateAbsMin() const
584 // Check if constant status of any of the parameters have changed
588 while((par=(RooAbsArg*)_piter->Next())) {
589 if (_paramFixed[par->GetName()] != par->isConstant()) {
590 cxcoutI(Minimization) << "RooStats::HistFactory::RooBarlowBeestonLL::evaluate(" << GetName() << ") constant status of parameter " << par->GetName() << " has changed from "
591 << (_paramFixed[par->GetName()]?"fixed":"floating") << " to " << (par->isConstant()?"fixed":"floating")
592 << ", recalculating absolute minimum" << std::endl ;
593 _absMinValid = false ;
600 // If we don't have the absolute minimum w.r.t all observables, calculate that first
603 cxcoutI(Minimization) << "RooStats::HistFactory::RooBarlowBeestonLL::evaluate(" << GetName() << ") determining minimum likelihood for current configurations w.r.t all observable" << std::endl ;
606 // Save current values of non-marginalized parameters
607 std::unique_ptr<RooArgSet> obsStart{(RooArgSet*) _obs.snapshot(false)};
609 // Start from previous global minimum
610 if (_paramAbsMin.size()>0) {
611 const_cast<RooSetProxy&>(_par).assignValueOnly(_paramAbsMin) ;
613 if (_obsAbsMin.size()>0) {
614 const_cast<RooSetProxy&>(_obs).assignValueOnly(_obsAbsMin) ;
617 // Find minimum with all observables floating
618 const_cast<RooSetProxy&>(_obs).setAttribAll("Constant",false) ;
621 // Save value and remember
623 _absMinValid = true ;
625 // Save parameter values at abs minimum as well
626 _paramAbsMin.removeAll() ;
628 // Only store non-constant parameters here!
629 std::unique_ptr<RooArgSet> tmp{_par.selectByAttrib("Constant",false)};
630 _paramAbsMin.addClone(*tmp) ;
632 _obsAbsMin.addClone(_obs) ;
634 // Save constant status of all parameters
637 while((par=(RooAbsArg*)_piter->Next())) {
638 _paramFixed[par->GetName()] = par->isConstant() ;
641 if (dologI(Minimization)) {
642 cxcoutI(Minimization) << "RooStats::HistFactory::RooBarlowBeestonLL::evaluate(" << GetName() << ") minimum found at (" ;
647 while ((arg=(RooAbsReal*)_oiter->Next())) {
648 ccxcoutI(Minimization) << (first?"":", ") << arg->GetName() << "=" << arg->getVal() ;
651 ccxcoutI(Minimization) << ")" << std::endl ;
654 // Restore original parameter values
655 const_cast<RooSetProxy&>(_obs) = *obsStart ;
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 char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t target
A class which maps the current values of a RooRealVar (or a set of RooRealVars) to one of a number of...
const_iterator begin() const
const_iterator end() const
RooFit::OwningPtr< RooArgSet > getParameters(const RooAbsData *data, bool stripDisconnected=true) const
Create a list of leaf nodes in the arg tree starting with ourself as top node that don't match any of...
Abstract interface for all probability density functions.
Abstract base class for objects that represent a real value and implements functionality common to al...
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Object to represent discrete states.
Variable that can be changed from the outside.
Facilitates simultaneous fitting of multiple PDFs to subsets of a given dataset.
RooAbsReal * nom_pois_mean
void SetBinCenter() const
Class RooBarlowBeestonLL implements the profile likelihood estimator for a given likelihood and set o...
double evaluate() const override
Optimized implementation of createProfile for profile likelihoods.
bool getParameters(const RooArgSet *depList, RooArgSet &outputSet, bool stripDisconnected=true) const override
Fills a list with leaf nodes in the arg tree starting with ourself as top node that don't match any o...
void initializeBarlowCache()
RooBarlowBeestonLL(const char *name, const char *title, RooAbsReal &nll)
const char * GetName() const override
Returns name of object.
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)