Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooBarlowBeestonLL.cxx
Go to the documentation of this file.
1// @(#)root/roostats:$Id$
2// Author: Kyle Cranmer, George Lewis
3/*************************************************************************
4 * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. *
5 * All rights reserved. *
6 * *
7 * For the licensing terms see $ROOTSYS/LICENSE. *
8 * For the list of contributors see $ROOTSYS/README/CREDITS. *
9 *************************************************************************/
10
11//////////////////////////////////////////////////////////////////////////////
12/** \class RooStats::HistFactory::RooBarlowBeestonLL
13 * \ingroup HistFactory
14//
15// Class RooBarlowBeestonLL implements the profile likelihood estimator for
16// a given likelihood and set of parameters of interest. The value return by
17// RooBarlowBeestonLL is the input likelihood nll minimized w.r.t all nuisance parameters
18// (which are all parameters except for those listed in the constructor) minus
19// the -log(L) of the best fit. Note that this function is slow to evaluate
20// as a MIGRAD minimization step is executed for each function evaluation
21*/
22
23#include <stdexcept>
24#include <cmath>
25#include <iostream>
26
28#include "RooAbsReal.h"
29#include "RooMsgService.h"
30#include "RooRealVar.h"
31
33#include "RooCategory.h"
34#include "RooSimultaneous.h"
35#include "RooArgList.h"
36
39
40#include <TMath.h>
41
42using namespace std ;
43
45
46
47////////////////////////////////////////////////////////////////////////////////
48
50 RooAbsReal("RooBarlowBeestonLL","RooBarlowBeestonLL"),
51 _nll()
52// _obs("paramOfInterest","Parameters of interest",this),
53// _par("nuisanceParam","Nuisance parameters",this,false,false),
54{
55 // Default constructor
56 // Should only be used by proof.
57}
58
59
60////////////////////////////////////////////////////////////////////////////////
61
63 RooAbsReal& nllIn /*, const RooArgSet& observables*/) :
64 RooAbsReal(name,title),
65 _nll("input","-log(L) function",this,nllIn)
66 // _obs("paramOfInterest","Parameters of interest",this),
67 // _par("nuisanceParam","Nuisance parameters",this,false,false),
68{
69 // Constructor of profile likelihood given input likelihood nll w.r.t
70 // the given set of variables. The input log likelihood is minimized w.r.t
71 // to all other variables of the likelihood at each evaluation and the
72 // value of the global log likelihood minimum is always subtracted.
73
74 // Determine actual parameters and observables
75 /*
76 std::unique_ptr<RooArgSet> actualObs{nllIn.getObservables(observables)};
77 std::unique_ptr<RooArgSet> actualPars{nllIn.getParameters(observables)};
78
79 _obs.add(*actualObs) ;
80 _par.add(*actualPars) ;
81 */
82}
83
84
85
86////////////////////////////////////////////////////////////////////////////////
87
89 RooAbsReal(other,name),
90 _nll("nll",this,other._nll),
91 // _obs("obs",this,other._obs),
92 // _par("par",this,other._par),
93 _paramFixed(other._paramFixed)
94{
95 // Copy constructor
96
97 // _paramAbsMin.addClone(other._paramAbsMin) ;
98 // _obsAbsMin.addClone(other._obsAbsMin) ;
99
100}
101
102
103////////////////////////////////////////////////////////////////////////////////
104
106 for (auto const *var : static_range_cast<RooRealVar *>(*bin_center)) {
107 RooRealVar* target = (RooRealVar*) observables->find(var->GetName()) ;
108 target->setVal(var->getVal()) ;
109 }
110}
111
112
113////////////////////////////////////////////////////////////////////////////////
114
116 bool verbose=false;
117
118 if(!_data) {
119 std::cout << "Error: Must initialize data before initializing cache" << std::endl;
120 throw std::runtime_error("Uninitialized Data");
121 }
122 if(!_pdf) {
123 std::cout << "Error: Must initialize model pdf before initializing cache" << std::endl;
124 throw std::runtime_error("Uninitialized model pdf");
125 }
126
127 // Get the data bin values for all channels and bins
128 std::map< std::string, std::vector<double> > ChannelBinDataMap;
129 getDataValuesForObservables( ChannelBinDataMap, _data, _pdf );
130
131 // Get a list of constraint terms
132 RooArgList obsTerms;
133 RooArgList constraints;
134 RooArgSet* obsSet = std::unique_ptr<RooArgSet>{_pdf->getObservables(*_data)}.release();
135 FactorizeHistFactoryPdf(*obsSet, *_pdf, obsTerms, constraints);
136
137 if( obsTerms.empty() ) {
138 std::cout << "Error: Found no observable terms with pdf: " << _pdf->GetName()
139 << " using dataset: " << _data->GetName() << std::endl;
140 return;
141 }
142 if( constraints.empty() ) {
143 std::cout << "Error: Found no constraint terms with pdf: " << _pdf->GetName()
144 << " using dataset: " << _data->GetName() << std::endl;
145 return;
146 }
147
148 // Loop over the channels
149 RooSimultaneous* simPdf = (RooSimultaneous*) _pdf;
150 RooCategory* channelCat = (RooCategory*) (&simPdf->indexCat());
151 for (const auto& nameIdx : *channelCat) {
152
153 // Warning: channel cat name is not necessarily the same name
154 // as the pdf's (for example, if someone does edits)
155 RooAbsPdf* channelPdf = simPdf->getPdf(nameIdx.first.c_str());
156 std::string channel_name = channelPdf->GetName();
157
158 // First, we check if this channel uses Stat Uncertainties:
159 RooArgList* gammas = nullptr;
160 ParamHistFunc* param_func=nullptr;
161 bool hasStatUncert = getStatUncertaintyFromChannel( channelPdf, param_func, gammas );
162 if( ! hasStatUncert ) {
163 if(verbose) {
164 std::cout << "Channel: " << channel_name
165 << " doesn't have statistical uncertainties"
166 << std::endl;
167 }
168 continue;
169 }
170 else {
171 if(verbose) std::cout << "Found ParamHistFunc: " << param_func->GetName() << std::endl;
172 }
173
174 // Now, loop over the bins in this channel
175 // To Do: Check that the index convention
176 // still works for 2-d (ie matches the
177 // convention in ParamHistFunc, etc)
178 int num_bins = param_func->numBins();
179
180 // Initialize the vector to the number of bins, allowing
181 // us to skip gamma's if they are constant
182
183 std::vector<BarlowCache> temp_cache( num_bins );
184 bool channel_has_stat_uncertainty=false;
185
186 for( Int_t bin_index = 0; bin_index < num_bins; ++bin_index ) {
187
188 // Create a cache object
189 BarlowCache cache;
190
191 // Get the gamma for this bin, and skip if it's constant
192 RooRealVar* gamma_stat = dynamic_cast<RooRealVar*>(&(param_func->getParameter(bin_index)));
193 if(!gamma_stat) throw std::runtime_error("ParamHistFunc contains non-RooRealVar, not supported in RooBarlowBeestonLL");
194 if( gamma_stat->isConstant() ) {
195 if(verbose) std::cout << "Ignoring constant gamma: " << gamma_stat->GetName() << std::endl;
196 continue;
197 }
198 else {
199 cache.hasStatUncert=true;
200 channel_has_stat_uncertainty=true;
201 cache.gamma = gamma_stat;
202 _statUncertParams.insert( gamma_stat->GetName() );
203 }
204
205 // Store a snapshot of the bin center
206 RooArgSet* bin_center = (RooArgSet*) param_func->get( bin_index )->snapshot();
207 cache.bin_center = bin_center;
208 cache.observables = obsSet;
209
210 cache.binVolume = param_func->binVolume();
211
212 // Delete this part, simply a comment
213 RooArgList obs_list( *(cache.bin_center) );
214
215 // Get the gamma's constraint term
216 RooAbsReal* pois_mean = nullptr;
217 RooRealVar* tau = nullptr;
218 getStatUncertaintyConstraintTerm( &constraints, gamma_stat, pois_mean, tau );
219 if( !tau || !pois_mean ) {
220 std::cout << "Failed to find pois mean or tau parameter for " << gamma_stat->GetName() << std::endl;
221 }
222 else {
223 if(verbose) std::cout << "Found pois mean and tau for parameter: " << gamma_stat->GetName()
224 << " tau: " << tau->GetName() << " " << tau->getVal()
225 << " pois_mean: " << pois_mean->GetName() << " " << pois_mean->getVal()
226 << std::endl;
227 }
228
229 cache.tau = tau;
230 cache.nom_pois_mean = pois_mean;
231
232 // Get the RooRealSumPdf
233 RooAbsPdf* sum_pdf = getSumPdfFromChannel( channelPdf );
234 if( sum_pdf == nullptr ) {
235 std::cout << "Failed to find RooRealSumPdf in channel " << channel_name
236 << ", therefor skipping this channel for analytic uncertainty minimization"
237 << std::endl;
238 channel_has_stat_uncertainty=false;
239 break;
240 }
241 cache.sumPdf = sum_pdf;
242
243 // And set the data value for this bin
244 if( ChannelBinDataMap.find(channel_name) == ChannelBinDataMap.end() ) {
245 std::cout << "Error: channel with name: " << channel_name
246 << " not found in BinDataMap" << std::endl;
247 throw runtime_error("BinDataMap");
248 }
249 double nData = ChannelBinDataMap[channel_name].at(bin_index);
250 cache.nData = nData;
251
252 temp_cache.at(bin_index) = cache;
253 //_barlowCache[channel_name].at(bin_index) = cache;
254
255 } // End: Loop over bins
256
257 if( channel_has_stat_uncertainty ) {
258 std::cout << "Adding channel: " << channel_name
259 << " to the barlow cache" << std::endl;
260 _barlowCache[channel_name] = temp_cache;
261 }
262
263
264 } // End: Loop over channels
265
266
267
268 // Successfully initialized the cache
269 // Printing some info
270 /*
271 std::map< std::string, std::vector< BarlowCache > >::iterator iter_cache;
272 for( iter_cache = _barlowCache.begin(); iter_cache != _barlowCache.end(); ++iter_cache ) {
273
274 std::string channel_name = (*iter_cache).first;
275 std::vector< BarlowCache >& channel_cache = (*iter_cache).second;
276
277
278 for( unsigned int i = 0; i < channel_cache.size(); ++i ) {
279 BarlowCache& bin_cache = channel_cache.at(i);
280
281
282 RooRealVar* gamma = bin_cache.gamma;
283 RooRealVar* tau = bin_cache.tau;
284 RooAbsReal* pois_mean = bin_cache.nom_pois_mean;
285 RooAbsPdf* sum_pdf = (RooAbsPdf*) bin_cache.sumPdf;
286 double binVolume = bin_cache.binVolume;
287
288
289 if( !bin_cache.hasStatUncert ) {
290 std::cout << "Barlow Cache for Channel: " << channel_name
291 << " Bin: " << i
292 << " NO STAT UNCERT"
293 << std::endl;
294 }
295 else {
296 std::cout << "Barlow Cache for Channel: " << channel_name
297 << " Bin: " << i
298 << " gamma: " << gamma->GetName()
299 << " tau: " << tau->GetName()
300 << " pois_mean: " << pois_mean->GetName()
301 << " sum_pdf: " << sum_pdf->GetName()
302 << " binVolume: " << binVolume
303 << std::endl;
304 }
305
306 }
307 }
308 */
309
310}
311
312
313////////////////////////////////////////////////////////////////////////////////
314
316 RooArgSet& outputSet,
317 bool stripDisconnected) const {
318 bool errorInBaseCall = RooAbsArg::getParameters( depList, outputSet, stripDisconnected );
319
320 RooArgSet toRemove;
321 toRemove.reserve( _statUncertParams.size());
322
323 for (auto const& arg : outputSet) {
324
325 // If there is a gamma in the name,
326 // strip it from the list of dependencies
327
328 if( _statUncertParams.find(arg->GetName()) != _statUncertParams.end() ) {
329 toRemove.add( *arg );
330 }
331 }
332
333 for( auto& arg : toRemove) outputSet.remove( *arg, true );
334
335 return errorInBaseCall || false;
336
337}
338
339
340/*
341////////////////////////////////////////////////////////////////////////////////
342
343const RooArgSet& RooStats::HistFactory::RooBarlowBeestonLL::bestFitParams() const
344{
345 validateAbsMin() ;
346 return _paramAbsMin ;
347}
348
349
350////////////////////////////////////////////////////////////////////////////////
351
352const RooArgSet& RooStats::HistFactory::RooBarlowBeestonLL::bestFitObs() const
353{
354 validateAbsMin() ;
355 return _obsAbsMin ;
356}
357*/
358
359
360
361////////////////////////////////////////////////////////////////////////////////
362/// Optimized implementation of createProfile for profile likelihoods.
363/// Return profile of original function in terms of stated parameters
364/// of interest rather than profiling recursively.
365
366/*
367RooAbsReal* RooStats::HistFactory::RooBarlowBeestonLL::createProfile(const RooArgSet& paramsOfInterest)
368{
369 return nll().createProfile(paramsOfInterest) ;
370}
371*/
372
373
374/*
375void RooStats::HistFactory::RooBarlowBeestonLL::FactorizePdf(const RooArgSet &observables, RooAbsPdf &pdf, RooArgList &obsTerms, RooArgList &constraints) const {
376 // utility function to factorize constraint terms from a pdf
377 // (from G. Petrucciani)
378 const std::type_info & id = typeid(pdf);
379 if (id == typeid(RooProdPdf)) {
380 RooProdPdf *prod = dynamic_cast<RooProdPdf *>(&pdf);
381 RooArgList list(prod->pdfList());
382 for (int i = 0, n = list.getSize(); i < n; ++i) {
383 RooAbsPdf *pdfi = (RooAbsPdf *) list.at(i);
384 FactorizePdf(observables, *pdfi, obsTerms, constraints);
385 }
386 } else if (id == typeid(RooSimultaneous) ) { //|| id == typeid(RooSimultaneousOpt)) {
387 RooSimultaneous *sim = dynamic_cast<RooSimultaneous *>(&pdf);
388 std::unique_ptr<RooAbsCategoryLValue> cat{(RooAbsCategoryLValue *) sim->indexCat().Clone()};
389 for (int ic = 0, nc = cat->numBins((const char *)0); ic < nc; ++ic) {
390 cat->setBin(ic);
391 FactorizePdf(observables, *sim->getPdf(cat->getLabel()), obsTerms, constraints);
392 }
393 } else if (pdf.dependsOn(observables)) {
394 if (!obsTerms.contains(pdf)) obsTerms.add(pdf);
395 } else {
396 if (!constraints.contains(pdf)) constraints.add(pdf);
397 }
398}
399*/
400
401
402
403////////////////////////////////////////////////////////////////////////////////
404
406{
407 // Loop over the channels (keys to the map)
408 //clock_t time_before_setVal, time_after_setVal;
409 //time_before_setVal=clock();
410 std::map< std::string, std::vector< BarlowCache > >::iterator iter_cache;
411 for( iter_cache = _barlowCache.begin(); iter_cache != _barlowCache.end(); ++iter_cache ) {
412
413 std::string channel_name = (*iter_cache).first;
414 std::vector< BarlowCache >& channel_cache = (*iter_cache).second;
415
416 /* Slower way to find the channel vector:
417 // Get the vector of bin uncertainty caches for this channel
418 if( _barlowCache.find( channel_name ) == _barlowCache.end() ) {
419 std::cout << "Error: channel: " << channel_name
420 << " not found in barlow Cache" << std::endl;
421 throw runtime_error("Channel not in barlow cache");
422 }
423
424 std::vector< BarlowCache >& channel_cache = _barlowCache[ channel_name ];
425 */
426
427 // Loop over the bins in the cache
428 // Set all gamma's to 0
429 for( unsigned int i = 0; i < channel_cache.size(); ++i ) {
430 BarlowCache& bin_cache = channel_cache.at(i);
431 if( !bin_cache.hasStatUncert ) continue;
432 RooRealVar* gamma = bin_cache.gamma;
433 gamma->setVal(0.0);
434 }
435 std::vector< double > nu_b_vec( channel_cache.size() );
436 for( unsigned int i = 0; i < channel_cache.size(); ++i ) {
437 BarlowCache& bin_cache = channel_cache.at(i);
438 if( !bin_cache.hasStatUncert ) continue;
439
440 RooAbsPdf* sum_pdf = (RooAbsPdf*) bin_cache.sumPdf;
441 RooArgSet* obsSet = bin_cache.observables;
442 double binVolume = bin_cache.binVolume;
443
444 bin_cache.SetBinCenter();
445 double nu_b = sum_pdf->getVal(*obsSet)*sum_pdf->expectedEvents(*obsSet)*binVolume;
446 nu_b_vec.at(i) = nu_b;
447 }
448
449 // Loop over the bins in the cache
450 // Set all gamma's to 1
451 for( unsigned int i = 0; i < channel_cache.size(); ++i ) {
452 BarlowCache& bin_cache = channel_cache.at(i);
453 if( !bin_cache.hasStatUncert ) continue;
454 RooRealVar* gamma = bin_cache.gamma;
455 gamma->setVal(1.0);
456 }
457 std::vector< double > nu_b_stat_vec( channel_cache.size() );
458 for( unsigned int i = 0; i < channel_cache.size(); ++i ) {
459 BarlowCache& bin_cache = channel_cache.at(i);
460 if( !bin_cache.hasStatUncert ) continue;
461
462 RooAbsPdf* sum_pdf = (RooAbsPdf*) bin_cache.sumPdf;
463 RooArgSet* obsSet = bin_cache.observables;
464 double binVolume = bin_cache.binVolume;
465
466 bin_cache.SetBinCenter();
467 double nu_b_stat = sum_pdf->getVal(*obsSet)*sum_pdf->expectedEvents(*obsSet)*binVolume - nu_b_vec.at(i);
468 nu_b_stat_vec.at(i) = nu_b_stat;
469 }
470 //time_after_setVal=clock();
471
472 // Done with the first loops.
473 // Now evaluating the function
474
475 //clock_t time_before_eval, time_after_eval;
476
477 // Loop over the bins in the cache
478 //time_before_eval=clock();
479 for( unsigned int i = 0; i < channel_cache.size(); ++i ) {
480
481 BarlowCache& bin_cache = channel_cache.at(i);
482
483 if( !bin_cache.hasStatUncert ) {
484 //std::cout << "Bin: " << i << " of " << channel_cache.size()
485 // << " in channel: " << channel_name
486 // << " doesn't have stat uncertainties" << std::endl;
487 continue;
488 }
489
490 // Set the observable to the bin center
491 bin_cache.SetBinCenter();
492
493 // Get the cached objects
494 RooRealVar* gamma = bin_cache.gamma;
495 RooRealVar* tau = bin_cache.tau;
496 RooAbsReal* pois_mean = bin_cache.nom_pois_mean;
497 //RooAbsPdf* sum_pdf = (RooAbsPdf*) bin_cache.sumPdf;
498 //RooArgSet* obsSet = bin_cache.observables;
499 //double binVolume = bin_cache.binVolume;
500
501 // Get the values necessary for
502 // the analytic minimization
503 double nu_b = nu_b_vec.at(i);
504 double nu_b_stat = nu_b_stat_vec.at(i);
505
506 double tau_val = tau->getVal();
507 double nData = bin_cache.nData;
508 double m_val = pois_mean->getVal();
509
510 // Initialize the minimized value of gamma
511 double gamma_hat_hat = 1.0;
512
513 // Check that the quadratic term is > 0
514 if(nu_b_stat > 0.00000001) {
515
516 double A = nu_b_stat*nu_b_stat + tau_val*nu_b_stat;
517 double B = nu_b*tau_val + nu_b*nu_b_stat - nData*nu_b_stat - m_val*nu_b_stat;
518 double C = -1*m_val*nu_b;
519
520 double discrim = B*B-4*A*C;
521
522 if( discrim < 0 ) {
523 std::cout << "Warning: Discriminant (B*B - 4AC) < 0" << std::endl;
524 std::cout << "Warning: Taking B*B - 4*A*C == 0" << std::endl;
525 discrim=0;
526 //throw runtime_error("BarlowBeestonLL::evaluate() : B*B - 4AC < 0");
527 }
528 if( A <= 0 ) {
529 std::cout << "Warning: A <= 0" << std::endl;
530 throw runtime_error("BarlowBeestonLL::evaluate() : A < 0");
531 }
532
533 gamma_hat_hat = ( -1*B + TMath::Sqrt(discrim) ) / (2*A);
534 }
535
536 // If the quadratic term is 0, we simply
537 // use a linear equation
538 else {
539 gamma_hat_hat = m_val/tau_val;
540 }
541
542 // Check for NAN
543 if( TMath::IsNaN(gamma_hat_hat) ) {
544 std::cout << "ERROR: gamma hat hat is NAN" << std::endl;
545 throw runtime_error("BarlowBeestonLL::evaluate() : gamma hat hat is NAN");
546 }
547
548 if( gamma_hat_hat <= 0 ) {
549 std::cout << "WARNING: gamma hat hat <= 0. Setting to 0" << std::endl;
550 gamma_hat_hat = 0;
551 }
552
553 /*
554 std::cout << "n: " << bin_cache.nData << " "
555 << "nu_stat: " << nu_b_stat << " "
556 << "nu: " << nu_b << " "
557 << "tau: " << tau->getVal() << " "
558 << "m: " << pois_mean->getVal() << " "
559 << "A: " << A << " "
560 << "B: " << B << " "
561 << "C: " << C << " "
562 << "gamma hat hat: " << gamma_hat_hat
563 << std::endl;
564 */
565
566 gamma->setVal( gamma_hat_hat );
567
568 }
569
570 //time_after_eval=clock();
571
572 //float time_setVal = ((float) time_after_setVal - (float) time_before_setVal) / ((float) CLOCKS_PER_SEC);
573 //float time_eval = ((float) time_after_eval - (float) time_before_eval) / ((float) CLOCKS_PER_SEC);
574
575 /*
576 std::cout << "Barlow timing for channel: " << channel_name
577 << " SetVal: " << time_setVal
578 << " Eval: " << time_eval
579 << std::endl;
580 */
581 }
582
583
584 return _nll;
585
586}
587
588
589
590/*
591////////////////////////////////////////////////////////////////////////////////
592/// Check that parameters and likelihood value for 'best fit' are still valid. If not,
593/// because the best fit has never been calculated, or because constant parameters have
594/// changed value or parameters have changed const/float status, the minimum is recalculated
595
596void RooStats::HistFactory::RooBarlowBeestonLL::validateAbsMin() const
597{
598 // Check if constant status of any of the parameters have changed
599 if (_absMinValid) {
600 _piter->Reset() ;
601 RooAbsArg* par ;
602 while((par=(RooAbsArg*)_piter->Next())) {
603 if (_paramFixed[par->GetName()] != par->isConstant()) {
604 cxcoutI(Minimization) << "RooStats::HistFactory::RooBarlowBeestonLL::evaluate(" << GetName() << ") constant status of parameter " << par->GetName() << " has changed from "
605 << (_paramFixed[par->GetName()]?"fixed":"floating") << " to " << (par->isConstant()?"fixed":"floating")
606 << ", recalculating absolute minimum" << endl ;
607 _absMinValid = false ;
608 break ;
609 }
610 }
611 }
612
613
614 // If we don't have the absolute minimum w.r.t all observables, calculate that first
615 if (!_absMinValid) {
616
617 cxcoutI(Minimization) << "RooStats::HistFactory::RooBarlowBeestonLL::evaluate(" << GetName() << ") determining minimum likelihood for current configurations w.r.t all observable" << endl ;
618
619
620 // Save current values of non-marginalized parameters
621 std::unique_ptr<RooArgSet> obsStart{(RooArgSet*) _obs.snapshot(false)};
622
623 // Start from previous global minimum
624 if (_paramAbsMin.getSize()>0) {
625 const_cast<RooSetProxy&>(_par).assignValueOnly(_paramAbsMin) ;
626 }
627 if (_obsAbsMin.getSize()>0) {
628 const_cast<RooSetProxy&>(_obs).assignValueOnly(_obsAbsMin) ;
629 }
630
631 // Find minimum with all observables floating
632 const_cast<RooSetProxy&>(_obs).setAttribAll("Constant",false) ;
633 _minuit->migrad() ;
634
635 // Save value and remember
636 _absMin = _nll ;
637 _absMinValid = true ;
638
639 // Save parameter values at abs minimum as well
640 _paramAbsMin.removeAll() ;
641
642 // Only store non-constant parameters here!
643 std::unique_ptr<RooArgSet> tmp{(RooArgSet*) _par.selectByAttrib("Constant",false)};
644 _paramAbsMin.addClone(*tmp) ;
645
646 _obsAbsMin.addClone(_obs) ;
647
648 // Save constant status of all parameters
649 _piter->Reset() ;
650 RooAbsArg* par ;
651 while((par=(RooAbsArg*)_piter->Next())) {
652 _paramFixed[par->GetName()] = par->isConstant() ;
653 }
654
655 if (dologI(Minimization)) {
656 cxcoutI(Minimization) << "RooStats::HistFactory::RooBarlowBeestonLL::evaluate(" << GetName() << ") minimum found at (" ;
657
658 RooAbsReal* arg ;
659 bool first=true ;
660 _oiter->Reset() ;
661 while ((arg=(RooAbsReal*)_oiter->Next())) {
662 ccxcoutI(Minimization) << (first?"":", ") << arg->GetName() << "=" << arg->getVal() ;
663 first=false ;
664 }
665 ccxcoutI(Minimization) << ")" << endl ;
666 }
667
668 // Restore original parameter values
669 const_cast<RooSetProxy&>(_obs) = *obsStart ;
670
671 }
672}
673*/
#define ClassImp(name)
Definition Rtypes.h:377
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
char name[80]
Definition TGX11.cxx:110
A class which maps the current values of a RooRealVar (or a set of RooRealVars) to one of a number of...
const RooArgSet * get(Int_t masterIdx) const
Int_t numBins() const
RooAbsReal & getParameter() const
double binVolume() const
bool isConstant() const
Check if the "Constant" attribute is set.
Definition RooAbsArg.h:363
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...
virtual bool remove(const RooAbsArg &var, bool silent=false, bool matchByNameOnly=false)
Remove the specified argument from our list.
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
void reserve(Storage_t::size_type count)
Abstract interface for all probability density functions.
Definition RooAbsPdf.h:40
virtual double expectedEvents(const RooArgSet *nset) const
Return expected number of events to be used in calculation of extended likelihood.
Abstract base class for objects that represent a real value and implements functionality common to al...
Definition RooAbsReal.h:59
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
Definition RooAbsReal.h:103
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition RooArgList.h:22
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:55
RooArgSet * snapshot(bool deepCopy=true) const
Use RooAbsCollection::snapshot(), but return as RooArgSet.
Definition RooArgSet.h:178
Object to represent discrete states.
Definition RooCategory.h:28
RooRealVar represents a variable that can be changed from the outside.
Definition RooRealVar.h:37
Facilitates simultaneous fitting of multiple PDFs to subsets of a given dataset.
RooAbsPdf * getPdf(RooStringView catName) const
Return the p.d.f associated with the given index category name.
const RooAbsCategoryLValue & indexCat() 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...
const char * GetName() const override
Returns name of object.
Definition TNamed.h:47
bool getStatUncertaintyFromChannel(RooAbsPdf *channel, ParamHistFunc *&paramfunc, 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)
Bool_t IsNaN(Double_t x)
Definition TMath.h:892
Double_t Sqrt(Double_t x)
Returns the square root of x.
Definition TMath.h:662