Skip to content

[RF] copy-paste barlow-beeston to new class with explicit Conway name #18090

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions roofit/histfactory/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ ROOT_STANDARD_LIBRARY_PACKAGE(HistFactory
RooStats/HistFactory/PiecewiseInterpolation.h
RooStats/HistFactory/PreprocessFunction.h
RooStats/HistFactory/RooBarlowBeestonLL.h
RooStats/HistFactory/RooBarlowBeestonLLConway.h
RooStats/HistFactory/Sample.h
RooStats/HistFactory/Systematics.h
${HISTFACTORY_XML_HEADERS}
Expand All @@ -61,6 +62,7 @@ ROOT_STANDARD_LIBRARY_PACKAGE(HistFactory
src/PiecewiseInterpolation.cxx
src/PreprocessFunction.cxx
src/RooBarlowBeestonLL.cxx
src/RooBarlowBeestonLLConway.cxx
src/Sample.cxx
src/Systematics.cxx
${HISTFACTORY_XML_SOURCES}
Expand Down
1 change: 1 addition & 0 deletions roofit/histfactory/inc/LinkDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#pragma link C++ class RooStats::HistFactory::FlexibleInterpVar+ ;
#pragma link C++ class RooStats::HistFactory::HistoToWorkspaceFactoryFast+ ;
#pragma link C++ class RooStats::HistFactory::RooBarlowBeestonLL+ ;
#pragma link C++ class RooStats::HistFactory::RooBarlowBeestonLLConway+ ;
#pragma link C++ class RooStats::HistFactory::HistFactoryNavigation+ ;

#pragma link C++ class RooStats::HistFactory::Measurement+ ;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// @(#)root/roostats:$Id$
// Author: George Lewis, Kyle Cranmer
/*************************************************************************
* Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/

#ifndef ROOBARLOWBEESTONLLCONWAY
#define ROOBARLOWBEESTONLLCONWAY

#include "RooAbsReal.h"
#include "RooRealProxy.h"
#include "RooSetProxy.h"
#include <map>
#include <set>
#include <string>
#include <vector>

namespace RooStats{
namespace HistFactory{

class RooBarlowBeestonLLConway : public RooAbsReal {
public:

RooBarlowBeestonLLConway(const char *name, const char *title, RooAbsReal& nll /*, const RooArgSet& observables*/);
RooBarlowBeestonLLConway(const RooBarlowBeestonLLConway& other, const char* name=nullptr) ;
TObject* clone(const char* newname) const override { return new RooBarlowBeestonLLConway(*this,newname); }

// A simple class to store the
// necessary objects for a
// single gamma in a single channel
class BarlowCache {
public:
bool hasStatUncert = false;
RooRealVar* gamma = nullptr;
RooArgSet* observables = nullptr;
RooArgSet* bin_center = nullptr; // Snapshot
RooRealVar* tau = nullptr;
RooAbsReal* nom_pois_mean = nullptr;
RooAbsReal* sumPdf = nullptr;
double nData = -1;
double binVolume = 0;
void SetBinCenter() const;
};

void initializeBarlowCache();
bool getParameters(const RooArgSet* depList, RooArgSet& outputSet, bool stripDisconnected=true) const override;
RooAbsReal& nll() { return const_cast<RooAbsReal&>(_nll.arg()) ; }
void setPdf(RooAbsPdf* pdf) { _pdf = pdf; }
void setDataset(RooAbsData* data) { _data = data; }

protected:

RooRealProxy _nll ; ///< Input -log(L) function
RooAbsPdf* _pdf = nullptr;
RooAbsData* _data = nullptr;
mutable std::map< std::string, std::vector< BarlowCache > > _barlowCache;
mutable std::set< std::string > _statUncertParams;
mutable std::map<std::string,bool> _paramFixed ; ///< Parameter constant status at last time of use
double evaluate() const override ;

private:

// Real-valued function representing a Barlow-Beeston minimized profile likelihood of external (likelihood) function with Conway approximation
ClassDefOverride(RooStats::HistFactory::RooBarlowBeestonLLConway,0)
};

}
}

#endif
Loading
Loading