File indexing completed on 2025-11-03 10:03:38
0001 
0002 
0003 
0004 
0005 
0006 
0007 
0008 
0009 
0010 
0011 
0012 #ifndef ROOPROFILELL
0013 #define ROOPROFILELL
0014 
0015 #include "RooAbsReal.h"
0016 #include "RooMinimizer.h"
0017 #include "RooRealProxy.h"
0018 #include "RooSetProxy.h"
0019 #include <map>
0020 #include <string>
0021 
0022 class RooProfileLL : public RooAbsReal {
0023 public:
0024 
0025   RooProfileLL(const char *name, const char *title, RooAbsReal& nll, const RooArgSet& observables);
0026   RooProfileLL(const RooProfileLL& other, const char* name=nullptr) ;
0027   TObject* clone(const char* newname=nullptr) const override { return new RooProfileLL(*this,newname); }
0028 
0029   void setAlwaysStartFromMin(bool flag) { _startFromMin = flag ; }
0030   bool alwaysStartFromMin() const { return _startFromMin ; }
0031 
0032   RooMinimizer* minimizer() { if (!_minimizer) initializeMinimizer(); return _minimizer.get() ; }
0033   RooAbsReal& nll() { return const_cast<RooAbsReal&>(_nll.arg()) ; }
0034   const RooArgSet& bestFitParams() const ;
0035   const RooArgSet& bestFitObs() const ;
0036 
0037   RooFit::OwningPtr<RooAbsReal> createProfile(const RooArgSet& paramsOfInterest) override ;
0038 
0039   bool redirectServersHook(const RooAbsCollection& , bool , bool , bool ) override ;
0040 
0041   void clearAbsMin() { _absMinValid = false ; }
0042 
0043   Int_t numEval() const { return _neval ; }
0044 
0045 
0046 protected:
0047 
0048   void validateAbsMin() const ;
0049   void initializeMinimizer() const ;
0050 
0051   RooRealProxy _nll ;    
0052   RooSetProxy _obs ;     
0053   RooSetProxy _par ;     
0054   bool _startFromMin = true; 
0055 
0056   mutable std::unique_ptr<RooMinimizer> _minimizer = nullptr ; 
0057 
0058   mutable bool _absMinValid = false; 
0059   mutable double _absMin = 0.0; 
0060   mutable RooArgSet _paramAbsMin ; 
0061   mutable RooArgSet _obsAbsMin ; 
0062   mutable std::map<std::string,bool> _paramFixed ; 
0063   mutable Int_t _neval = 0; 
0064   double evaluate() const override ;
0065 
0066 
0067 private:
0068 
0069   ClassDefOverride(RooProfileLL,0) 
0070 };
0071 
0072 #endif