76using std::cerr, std::string, std::make_unique, std::vector;
87#define NaN std::numeric_limits<double>::quiet_NaN()
96template <
typename Test,
template <
typename...>
class Ref>
100template <
template <
typename...>
class Ref,
typename... Args>
111template <
class MatrixT>
116 return mat.GetNrows();
122template <
class MatrixT>
125 if (!stream.good()) {
131 stream << std::setprecision(RooFit::SuperFloatPrecision::digits10) <<
matrix(i,
j) <<
"\t";
133 stream <<
matrix(i,
j) <<
"\t";
143template <
class MatrixT>
146 std::ofstream of(
fname);
148 cerr <<
"unable to read file '" <<
fname <<
"'!" << std::endl;
157#pragma GCC diagnostic push
158#pragma GCC diagnostic ignored "-Wshadow"
159#pragma GCC diagnostic ignored "-Wunused-local-typedefs"
160#include <boost/numeric/ublas/io.hpp>
161#include <boost/numeric/ublas/lu.hpp>
162#include <boost/numeric/ublas/matrix.hpp>
163#include <boost/numeric/ublas/matrix_expression.hpp>
164#include <boost/numeric/ublas/symmetric.hpp>
165#include <boost/numeric/ublas/triangular.hpp>
166#include <boost/operators.hpp>
168#pragma GCC diagnostic pop
170typedef boost::numeric::ublas::matrix<RooFit::SuperFloat>
Matrix;
177 for (
size_t i = 0; i <
mat.size1(); ++i) {
178 for (
size_t j = 0;
j <
mat.size2(); ++
j) {
179 std::cout << std::setprecision(RooFit::SuperFloatPrecision::digits10) <<
mat(i,
j) <<
" ,\t";
181 std::cout << std::endl;
199 return boost::numeric::ublas::identity_matrix<RooFit::SuperFloat>(
n);
209 for (
size_t i = 0; i <
n; ++i) {
210 for (
size_t j = 0;
j <
n; ++
j) {
224 for (
size_t i = 0; i <
n; ++i) {
225 for (
size_t j = 0;
j <
n; ++
j) {
246 boost::numeric::ublas::permutation_matrix<size_t>
pm(
size(
matrix));
252 std::stringstream
ss;
258 }
catch (boost::numeric::ublas::internal_logic &error) {
315 std::cerr <<
" matrix is not invertible!" << std::endl;
320 for (
size_t i = 0; i <
n; ++i) {
321 for (
size_t j = 0;
j <
n; ++
j) {
343typedef std::map<int, std::unique_ptr<RooAbsReal>> FormulaList;
351 retval.ReplaceAll(
"/",
"_");
352 retval.ReplaceAll(
"^",
"");
353 retval.ReplaceAll(
"*",
"X");
354 retval.ReplaceAll(
"[",
"");
355 retval.ReplaceAll(
"]",
"");
365 std::stringstream
ss;
370 ss <<
itr->GetName();
380template <
class A,
class B>
383 a =
static_cast<A
>(
b);
388template <
class MatrixT>
391 std::vector<std::vector<RooFit::SuperFloat>>
matrix;
392 std::vector<RooFit::SuperFloat>
line;
393 while (!stream.eof()) {
394 if (stream.peek() ==
'\n') {
402 while (stream.peek() ==
' ' || stream.peek() ==
'\t') {
405 if (stream.peek() ==
'\n') {
411 for (
size_t i = 0; i <
matrix.size(); ++i) {
413 std::cerr <<
"matrix read from stream doesn't seem to be square!" << std::endl;
415 for (
size_t j = 0;
j <
matrix[i].size(); ++
j) {
425template <
class MatrixT>
428 std::ifstream in(
fname);
430 std::cerr <<
"unable to read file '" <<
fname <<
"'!" << std::endl;
447 const std::string
s_coup(
h_pc->GetXaxis()->GetBinLabel(
ibx));
486 std::cerr <<
"Error: unable to access data from folder '" <<
folderName <<
"' from file '" <<
inFile->GetName()
487 <<
"'!" << std::endl;
503template <
class AObjType>
516 <<
"'. contents are:";
519 while ((
f =
static_cast<TFolder *
>(next()))) {
522 std::cerr <<
errstr.str() << std::endl;
536 const std::string &key =
"param_card",
bool notFoundError =
true)
549 const std::vector<std::string> &names,
const std::string &key =
"param_card",
bool notFoundError =
true)
554 for (
size_t i = 0; i < names.size(); i++) {
555 const std::string
name(names[i]);
572 if (!file || !file->
IsOpen()) {
575 std::cerr <<
"could not open file '" <<
filename <<
"'!" << std::endl;
617 for (
auto itr : couplings) {
628 for (
const auto &
v :
vec) {
636template <
class T1,
class T2>
655 if (val >
p->getMax()) {
659 std::cerr <<
": parameter " <<
p->GetName() <<
" out of bounds: " << val <<
" > " <<
p->getMax() << std::endl;
666 std::cerr <<
": parameter " <<
p->GetName() <<
" out of bounds: " << val <<
" < " <<
p->getMin() << std::endl;
679template <
class T1,
class T2>
682 for (
auto itr : args) {
695template <
class T1,
class T2>
700 for (
auto itr : args) {
709 const std::string param(
paramit.first);
729 for (
auto itr : args) {
738 for (
int i = 1; i <=
ax->GetNbins(); ++i) {
756 for (
auto itr : parameters) {
797 std::vector<double> bins;
798 for (
int i = 1; i <
n + 1; ++i) {
811 auto dh = std::make_unique<RooDataHist>(
histname.Data(),
histname.Data(), vars, hist.get());
839 physics.addOwned(std::move(obj));
861 TPair *pair =
dynamic_cast<TPair *
>(obj.get());
868 errstr <<
"Error: unable to retrieve cross section '" <<
varname <<
"' from folder '" <<
sample;
881 xs->setConstant(
true);
888 xs->setError(error->GetVal());
909 std::cerr <<
"cannot morph objects of class 'TPair' if parameter is not "
940 for (
size_t i = 0; i <
morphfunc.size(); ++i) {
978 for (
auto const &
vertex : vertices) {
982 for (
auto citr : couplings) {
986 std::cerr <<
"encountered invalid list of couplings in vertex!" << std::endl;
1000template <
class MatrixT,
class T1,
class T2>
1011 std::cout <<
"unable to set parameters for sample " <<
sample <<
"!" << std::endl;
1015 std::cout <<
"unable to set parameters for sample " <<
sample <<
"!" << std::endl;
1019 for (
auto const &formula :
formulas) {
1020 if (!formula.second) {
1021 std::cerr <<
"Error: invalid formula encountered!" << std::endl;
1023 matrix(row, col) = formula.second->getVal();
1037 std::stringstream
ss;
1038 ss <<
"matrix is not square, consistency check failed: " <<
inputParameters.size() <<
" samples, "
1039 <<
formulas.size() <<
" expressions:" << std::endl;
1040 ss <<
"formulas: " << std::endl;
1041 for (
auto const &formula :
formulas) {
1042 ss << formula.second->GetTitle() << std::endl;
1044 ss <<
"samples: " << std::endl;
1048 std::cerr <<
ss.str() << std::endl;
1062 for (
size_t i = 0; i < dim; ++i) {
1063 for (
size_t j = 0;
j < dim; ++
j) {
1076template <
class List>
1083 std::cerr <<
"detected name conflict: cannot use sample '" <<
sample
1084 <<
"' - a parameter with the same name of type '" << arg->
ClassName() <<
"' is present in set '"
1085 << args.GetName() <<
"'!" << std::endl;
1097 const std::vector<std::vector<std::string>> &nonInterfering)
1117 std::cerr <<
"unable to set parameters for sample '" <<
sample <<
"'!" << std::endl;
1121 std::cerr <<
"internal error, number of operators inconsistent!" << std::endl;
1127 for (
auto itr1 : couplings) {
1129 if (
obj0->getVal() != 0) {
1136 for (
auto itr2 : flags) {
1143 if (
flag->second == 0.) {
1158 for (
size_t i = 0; i <
morphfunc.size(); ++i) {
1163 for (
const auto &
group : nonInterfering) {
1175 reason =
"blacklisted interference term!";
1186 for (
int k = 0; k <
exponent; ++k) {
1188 if (
coupling->getAttribute(
"NewPhysics")) {
1195 reason =
"coupling " +
cname +
" was listed as leading-order-only";
1207 for (
auto itr : flags) {
1211 TString sval(obj->getStringAttribute(
"NewPhysics"));
1212 int val = atoi(
sval);
1216 reason =
"flag " + std::string(obj->GetName()) +
" is zero";
1225 const auto name = std::string(
mfname) +
"_pol" + std::to_string(i);
1238 const RooArgList &flags,
const std::vector<std::vector<std::string>> &nonInterfering)
1242 for (
const auto &vertices :
diagrams) {
1251 <<
"no formulas are non-zero, check if any if your couplings is floating and missing from your param_cards!"
1254 throw std::runtime_error(
errorMsg);
1271 std::stringstream title;
1292inline std::map<std::string, std::string>
1297 std::map<std::string, std::string> weights;
1300 std::stringstream str;
1308 str << val <<
"*(" <<
formulait.second->GetTitle() <<
")";
1312 weights[
sample] = str.str();
1347 args.
add(*(it.second));
1358 const std::vector<std::vector<std::string>> &nonInterfering,
const RooArgList &flags)
1361 std::vector<std::vector<RooArgList *>>
diagrams;
1375 template <
class List>
1383 std::cerr <<
"input matrix is empty, please provide suitable input samples!" << std::endl;
1396 oocxcoutW((
TObject *)
nullptr, Eval) <<
"Warning: The matrix inversion seems to be unstable. This can "
1397 "be a result to input samples that are not sufficiently "
1398 "different to provide any morphing power."
1401 oocxcoutW((
TObject *)
nullptr, Eval) <<
"Warning: Some weights are excessively large. This can be a "
1402 "result to input samples that are not sufficiently different to "
1403 "provide any morphing power."
1407 "encoded in your samples to cross-check:"
1444 std::cerr <<
"invalid bin width given!" << std::endl;
1448 std::cerr <<
"invalid observable given!" << std::endl;
1469 std::cerr <<
"unable to access physics object for " <<
prodname << std::endl;
1476 std::cerr <<
"unable to access weight object for " <<
prodname << std::endl;
1483 allowNegativeYields =
true;
1485 if (!allowNegativeYields) {
1490 max->addOwnedComponents(std::move(prod));
1503 std::cerr <<
"unable to access observable" << std::endl;
1506 std::cerr <<
"unable to access bin width" << std::endl;
1509 std::cerr <<
"no operators listed" << std::endl;
1512 std::cerr <<
"unable to access weight objects" << std::endl;
1518 std::cout.precision(std::numeric_limits<double>::digits);
1536 std::cerr <<
"Matrix inversion succeeded, but no observable was "
1537 "supplied. quitting..."
1661 <<
" does not match expected name " <<
obsname << std::endl;
1666 auto binWidth = std::make_unique<RooRealVar>(
sbw.Data(),
sbw.Data(), 1.);
1668 binWidth->setVal(
bw);
1669 binWidth->setConstant(
true);
1688 const size_t n(
size(cache->_inverse));
1694 coutE(ObjectHandling) <<
Form(
"unable to access formula for sample '%s'!",
sample.c_str()) << std::endl;
1697 cxcoutP(ObjectHandling) <<
"updating formula for sample '" <<
sample <<
"'" << std::endl;
1703 if (std::isnan(val)) {
1705 coutE(ObjectHandling) <<
"refusing to propagate NaN!" << std::endl;
1708 << val << std::endl;
1749 cxcoutP(InputArguments) <<
"initializing physics inputs from file " << file->
GetName() <<
" with object name(s) '"
1750 <<
obsName <<
"'" << std::endl;
1754 std::cerr <<
"unable to locate object '" <<
obsName <<
"' in folder '" << folderNames.front() <<
"'!"
1758 std::string classname = obj->ClassName();
1762 if (classname.find(
"TH1") != std::string::npos) {
1765 }
else if (classname.find(
"RooHistFunc") != std::string::npos ||
1766 classname.find(
"RooParamHistFunc") != std::string::npos ||
1767 classname.find(
"PiecewiseInterpolation") != std::string::npos) {
1769 }
else if (classname.find(
"TParameter<double>") != std::string::npos) {
1771 }
else if (classname.find(
"TParameter<float>") != std::string::npos) {
1773 }
else if (classname.find(
"TPair") != std::string::npos) {
1777 std::cerr <<
"cannot morph objects of class '" <<
mode->GetName() <<
"'!" << std::endl;
1788 std::cout << param.first <<
" = " << param.second;
1790 std::cout <<
" (const)";
1791 std::cout << std::endl;
1803 std::cout <<
folder << std::endl;
1843 std::vector<RooListProxy *> vertices;
1845 vertices.push_back(
new RooListProxy(
"!couplings",
"set of couplings in the vertex",
this,
true,
false));
1857 std::vector<RooListProxy *> vertices;
1859 cxcoutP(InputArguments) <<
"prod/dec couplings provided" << std::endl;
1863 new RooListProxy(
"!production",
"set of couplings in the production vertex",
this,
true,
false));
1864 vertices.push_back(
new RooListProxy(
"!decay",
"set of couplings in the decay vertex",
this,
true,
false));
1870 cxcoutP(InputArguments) <<
"adding non-own operators" << std::endl;
1885 std::stringstream
name;
1886 name <<
"noInterference";
1887 for (
auto c : nonInterfering) {
1891 for (
auto c : nonInterfering) {
1902 for (
size_t i = 0; i < nonInterfering.size(); ++i) {
1915 coutE(InputArguments) <<
"unable to open file '" <<
filename <<
"'!" << std::endl;
1922 auto nNP0 = std::make_unique<RooRealVar>(
"nNP0",
"nNP0", 1., 0, 1.);
1923 nNP0->setStringAttribute(
"NewPhysics",
"0");
1924 nNP0->setConstant(
true);
1926 auto nNP1 = std::make_unique<RooRealVar>(
"nNP1",
"nNP1", 1., 0, 1.);
1927 nNP1->setStringAttribute(
"NewPhysics",
"1");
1928 nNP1->setConstant(
true);
1930 auto nNP2 = std::make_unique<RooRealVar>(
"nNP2",
"nNP2", 1., 0, 1.);
1931 nNP2->setStringAttribute(
"NewPhysics",
"2");
1932 nNP2->setConstant(
true);
1934 auto nNP3 = std::make_unique<RooRealVar>(
"nNP3",
"nNP3", 1., 0, 1.);
1935 nNP3->setStringAttribute(
"NewPhysics",
"3");
1936 nNP3->setConstant(
true);
1938 auto nNP4 = std::make_unique<RooRealVar>(
"nNP4",
"nNP4", 1., 0, 1.);
1939 nNP4->setStringAttribute(
"NewPhysics",
"4");
1940 nNP4->setConstant(
true);
1951 _observables(
other._observables.GetName(),
this,
other._observables),
1953 _config(
other._config)
1955 for (
size_t j = 0;
j <
other._diagrams.size(); ++
j) {
1956 std::vector<RooListProxy *>
diagram;
1957 for (
size_t i = 0; i <
other._diagrams[
j].size(); ++i) {
1987 _observables(
"observable",
"morphing observable",
this,
true,
false),
1988 _binWidths(
"binWidths",
"set of bin width objects",
this,
true,
false)
2013 std::vector<bool> prod;
2014 std::vector<bool> dec;
2015 for (
int i = 0; i <
nboth; ++i) {
2016 prod.push_back(
true);
2017 dec.push_back(
true);
2019 for (
int i = 0; i <
nprod; ++i) {
2020 prod.push_back(
true);
2021 dec.push_back(
false);
2023 for (
int i = 0; i <
ndec; ++i) {
2024 prod.push_back(
false);
2025 dec.push_back(
true);
2041 for (
auto vertex : vertices) {
2055std::map<std::string, std::string>
2057 const std::vector<std::vector<std::string>> &
vertices_str)
2060 std::vector<RooArgList *> vertices;
2065 for (
const auto &
c :
vtx) {
2068 auto couplingOwner = std::make_unique<RooRealVar>(
c.c_str(),
c.c_str(), 1., 0., 10.);
2074 vertices.push_back(&
vertex);
2083std::map<std::string, std::string>
2085 const std::vector<RooArgList *> &vertices,
RooArgList &couplings)
2093std::map<std::string, std::string>
2095 const std::vector<RooArgList *> &vertices,
RooArgList &couplings,
2097 const std::vector<std::vector<std::string>> &nonInterfering)
2104 std::cerr <<
"input matrix is empty, please provide suitable input samples!" << std::endl;
2116 const std::vector<RooArgList *> &vertices,
RooArgList &couplings,
2119 const std::vector<std::vector<std::string>> &nonInterfering)
2126 std::cerr <<
"input matrix is empty, please provide suitable input samples!" << std::endl;
2139 const std::vector<RooArgList *> &vertices,
RooArgList &couplings)
2154 coutE(Eval) <<
"unable to retrieve morphing function" << std::endl;
2157 std::unique_ptr<RooArgSet> args{
mf->getComponents()};
2162 for (
auto itr : *args) {
2188 return dynamic_cast<RooAbsReal *
>(cache->_weights.find(
wname.c_str()));
2224 double val = obj->
getVal();
2243 coutE(InputArguments) <<
"unable to open file '" <<
filename <<
"'!" << std::endl;
2270 cache->_inverse =
m;
2273 coutE(InputArguments) <<
"unable to open file '" <<
filename <<
"'!" << std::endl;
2288 coutE(Caching) <<
"unable to create cache!" << std::endl;
2307 coutE(Caching) <<
"unable to create cache!" << std::endl;
2332 cxcoutP(Caching) <<
"creating cache from getCache function for " <<
this << std::endl;
2333 cxcoutP(Caching) <<
"current storage has size " <<
_sampleMap.size() << std::endl;
2338 coutE(Caching) <<
"unable to create cache!" << std::endl;
2508 for (
auto itr : *list) {
2522 coutE(InputArguments) <<
"observable not available!" << std::endl;
2534 coutE(InputArguments) <<
"bin width not available!" << std::endl;
2553 auto mf = std::make_unique<RooRealSumFunc>(*(this->
getFunc()));
2556 const int nbins = observable->
getBins();
2558 auto hist = std::make_unique<TH1F>(
name.c_str(),
name.c_str(), nbins, observable->
getBinning().array());
2560 std::unique_ptr<RooArgSet> args{
mf->getComponents()};
2561 for (
int i = 0; i < nbins; ++i) {
2566 for (
auto itr : *args) {
2578 double weight = formula->
getVal();
2579 unc2 +=
dhist.weightSquared() * weight * weight;
2580 unc += sqrt(
dhist.weightSquared()) * weight;
2581 val +=
dhist.weight() * weight;
2586 return hist.release();
2595 auto mf = std::make_unique<RooRealSumFunc>(*(this->
getFunc()));
2597 coutE(InputArguments) <<
"unable to retrieve morphing function" << std::endl;
2598 std::unique_ptr<RooArgSet> args{
mf->getComponents()};
2599 for (
auto itr : *args) {
2601 if (prod->
getVal() != 0) {
2672 return cache->_formulas.size();
2680 auto mf = std::make_unique<RooRealSumFunc>(*(this->
getFunc()));
2682 std::cerr <<
"Error: unable to retrieve morphing function" << std::endl;
2685 std::unique_ptr<RooArgSet> args{
mf->getComponents()};
2690 name.Prepend(
"phys_");
2691 if (!args->find(
name.Data())) {
2694 double val = formula->getVal();
2696 std::cout << formula->GetName() <<
": " << val <<
" = " << formula->GetTitle() << std::endl;
2716 return &(cache->_couplings);
2730 double val = var->
getVal();
2731 couplings[
name] = val;
2758 auto func = std::make_unique<RooRealSumFunc>(*(cache->_sumFunc));
2761 return std::make_unique<RooWrapperPdf>(
Form(
"pdf_%s", func->GetName()),
Form(
"pdf of %s", func->GetTitle()), *func);
2770 return cache->_sumFunc.get();
2787 return this->
createPdf()->expectedEvents(nset);
2797 return this->
createPdf()->expectedEvents(set);
2806 return createPdf()->expectedEvents(&nset);
2822 coutE(InputArguments) <<
"unable to find object " +
weightName << std::endl;
2837 double w = weight->getVal();
2879 for (
auto c : couplings) {
2880 std::cout <<
c.first <<
": " <<
c.second << std::endl;
2914 std::cerr <<
"unable to acquire in-built function!" << std::endl;
2947 const char *rangeName)
const
2991 coutE(Caching) <<
"unable to retrieve cache!" << std::endl;
3002 coutE(Caching) <<
"unable to retrieve cache!" << std::endl;
3015 coutE(Caching) <<
"unable to retrieve cache!" << std::endl;
3016 return cache->_condition;
3022std::unique_ptr<RooRatio>
3027 for (
auto it :
nr) {
3030 for (
auto it :
dr) {
3042std::vector<std::string>
asStringV(std::string
const &arg)
3044 std::vector<std::string> out;
3046 for (std::string &
tok :
ROOT::Split(arg,
",{}",
true)) {
3047 if (
tok[0] ==
'\'') {
3048 out.emplace_back(
tok.substr(1,
tok.size() - 2));
3050 throw std::runtime_error(
"Strings in factory expressions need to be in single quotes!");
3064 std::vector<std::string> args)
3067 const std::array<std::string, 4>
funcArgs{{
"fileName",
"observableName",
"couplings",
"folders"}};
3070 for (
unsigned int i = 1; i < args.size(); i++) {
3071 if (args[i].find(
"$fileName(") != 0 && args[i].find(
"$observableName(") != 0 &&
3072 args[i].find(
"$couplings(") != 0 && args[i].find(
"$folders(") != 0 && args[i].find(
"$NewPhysics(") != 0) {
3073 throw std::string(
Form(
"%s::create() ERROR: unknown token %s encountered",
instanceName, args[i].c_str()));
3077 for (
unsigned int i = 0; i < args.size(); i++) {
3078 if (args[i].find(
"$NewPhysics(") == 0) {
3082 if (
parts.size() == 2) {
3083 ft.ws().arg(
parts[0])->setAttribute(
"NewPhysics", atoi(
parts[1].c_str()));
3085 throw std::string(
Form(
"%s::create() ERROR: unknown token %s encountered, check input provided for %s",
3090 std::vector<string>
subargs =
ft.splitFunctionArgs(args[i].c_str());
3093 for (
auto const ¶m :
funcArgs) {
3094 if (args[i].find(param) != string::npos)
3099 Form(
"Incorrect number of arguments in %s, have %d, expect 1", args[i].c_str(), (
Int_t)
subargs.size()));
RooCollectionProxy< RooArgList > RooListProxy
virtual RooAbsTestStatistic * create(const char *name, const char *title, RooAbsReal &real, RooAbsData &data, const RooArgSet &projDeps, Configuration const &cfg)=0
size_t size< TMatrixD >(const TMatrixD &mat)
void writeMatrixToStreamT(const MatrixT &matrix, std::ostream &stream)
write a matrix to a stream
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
static constexpr double morphUnityDeviation
Matrix makeSuperMatrix(const TMatrixD &in)
convert a TMatrixD into a Matrix
static constexpr double morphLargestWeight
void writeMatrixToFileT(const MatrixT &matrix, const char *fname)
write a matrix to a text file
double invertMatrix(const Matrix &matrix, Matrix &inverse)
TMatrixD makeRootMatrix(const Matrix &in)
convert a matrix into a TMatrixD
Matrix diagMatrix(size_t n)
create a new diagonal matrix of size n
void printMatrix(const TMatrixD &mat)
write a matrix
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void input
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 filename
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 r
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 cname
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char mode
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 Atom_t Time_t type
TMatrixT< Double_t > TMatrixD
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
std::string & operator+=(std::string &left, const TString &right)
TTime operator*(const TTime &t1, const TTime &t2)
const_iterator begin() const
const_iterator end() const
Common abstract base class for objects that represent a value and a "shape" in RooFit.
void Print(Option_t *options=nullptr) const override
Print the object to the defaultPrintStream().
bool isConstant() const
Check if the "Constant" attribute is set.
bool addOwnedComponents(const RooAbsCollection &comps)
Take ownership of the contents of 'comps'.
Abstract base class for objects to be stored in RooAbsCache cache manager objects.
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
Storage_t::size_type size() const
virtual bool addOwned(RooAbsArg &var, bool silent=false)
Add an argument and transfer the ownership to the collection.
RooAbsArg * find(const char *name) const
Find object with given name in list.
Abstract base class for objects that represent a real value that may appear on the left hand side of ...
Int_t numBins(const char *rangeName=nullptr) const override
virtual Int_t getBins(const char *name=nullptr) const
Get number of bins of currently defined range.
void setConstant(bool value=true)
virtual double getMax(const char *name=nullptr) const
Get maximum of currently defined range.
void setBin(Int_t ibin, const char *rangeName=nullptr) override
Set value to center of bin 'ibin' of binning 'rangeName' (or of default binning if no range is specif...
virtual double getMin(const char *name=nullptr) const
Get minimum of currently defined range.
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.
RooAbsArg * at(Int_t idx) const
Return object at given index, or nullptr if index is out of range.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Implements a RooAbsBinning in terms of an array of boundary values, posing no constraints on the choi...
Int_t setObj(const RooArgSet *nset, T *obj, const TNamed *isetRangeName=nullptr)
Setter function without integration set.
T * getObj(const RooArgSet *nset, Int_t *sterileIndex=nullptr, const TNamed *isetRangeName=nullptr)
Getter function without integration set.
bool addOwned(RooAbsArg &var, bool silent=false) override
Overloaded RooCollection_t::addOwned() method insert object into owning set and registers object as s...
bool add(const RooAbsArg &var, bool valueServer, bool shapeServer, bool silent)
Overloaded RooCollection_t::add() method insert object into set and registers object as server to own...
Container class to hold N-dimensional binned data.
double weightSquared(std::size_t i) const
Return squared weight sum of i-th bin.
const RooArgSet * get() const override
Get bin centre of current bin.
A real-valued function sampled from a multidimensional histogram.
static RooLagrangianMorphFunc::CacheElem * createCache(const RooLagrangianMorphFunc *func)
create all the temporary objects required by the class
void buildMatrix(const RooLagrangianMorphFunc::ParamMap &inputParameters, const RooLagrangianMorphFunc::FlagMap &inputFlags, const List &flags)
build and invert the morphing matrix
static RooLagrangianMorphFunc::CacheElem * createCache(const RooLagrangianMorphFunc *func, const Matrix &inverse)
create all the temporary objects required by the class function variant with precomputed inverse matr...
std::unique_ptr< RooRealSumFunc > _sumFunc
RooArgList containedArgs(Action) override
retrieve the list of contained args
void operModeHook(RooAbsArg::OperMode) override
Interface for changes of operation mode.
void createComponents(const RooLagrangianMorphFunc::ParamMap &inputParameters, const RooLagrangianMorphFunc::FlagMap &inputFlags, const char *funcname, const std::vector< std::vector< RooListProxy * > > &diagramProxyList, const std::vector< std::vector< std::string > > &nonInterfering, const RooArgList &flags)
create the basic objects required for the morphing
void buildMorphingFunction(const char *name, const RooLagrangianMorphFunc::ParamMap &inputParameters, const std::map< std::string, int > &storage, const RooArgList &physics, bool allowNegativeYields, RooRealVar *observable, RooRealVar *binWidth)
build the final morphing function
Class RooLagrangianMorphing is a implementation of the method of Effective Lagrangian Morphing,...
bool isParameterConstant(const char *paramname) const
return true if the parameter with the given name is set constant, false otherwise
bool isBinnedDistribution(const RooArgSet &obs) const override
check if this PDF is a binned distribution in the given observable
int nPolynomials() const
return the number of samples in this morphing function
void setParameter(const char *name, double value)
set one parameter to a specific value
RooArgSet createWeights(const ParamMap &inputs, const std::vector< RooArgList * > &vertices, RooArgList &couplings, const FlagMap &inputFlags, const RooArgList &flags, const std::vector< std::vector< std::string > > &nonInterfering)
create only the weight formulas. static function for external usage.
ParamSet getMorphParameters() const
retrieve the parameter set
double evaluate() const override
call getVal on the internal function
void disableInterference(const std::vector< const char * > &nonInterfering)
disable interference between terms
RooProduct * getSumElement(const char *name) const
return the RooProduct that is the element of the RooRealSumPdfi corresponding to the given sample nam...
RooRealVar * getBinWidth() const
retrieve the histogram observable
void writeMatrixToFile(const TMatrixD &matrix, const char *fname)
write a matrix to a file
RooRealVar * getParameter(const char *name) const
retrieve the RooRealVar object incorporating the parameter with the given name
bool useCoefficients(const TMatrixD &inverse)
setup the morphing function with a predefined inverse matrix call this function before any other afte...
const RooArgSet * getParameterSet() const
get the set of parameters
TMatrixD readMatrixFromStream(std::istream &stream)
read a matrix from a stream
std::vector< std::vector< std::string > > _nonInterfering
std::vector< std::string > getSamples() const
return the vector of sample names, used to build the morph func
int countSamples(std::vector< RooArgList * > &vertices)
calculate the number of samples needed to morph a certain physics process
void setCacheAndTrackHints(RooArgSet &) override
Retrieve the matrix of coefficients.
ParamSet getCouplings() const
retrieve a set of couplings (-?-)
void printSampleWeights() const
print the current sample weights
std::map< const std::string, double > ParamSet
void writeMatrixToStream(const TMatrixD &matrix, std::ostream &stream)
write a matrix to a stream
std::map< const std::string, ParamSet > ParamMap
bool updateCoefficients()
Retrieve the new physics objects and update the weights in the morphing function.
double _scale
The cache manager.
RooRealVar * getObservable() const
retrieve the histogram observable
int countContributingFormulas() const
count the number of formulas that correspond to the current parameter set
std::list< double > * plotSamplingHint(RooAbsRealLValue &, double, double) const override
retrieve the sample Hint
RooRealVar * getFlag(const char *name) const
retrieve the RooRealVar object incorporating the flag with the given name
void randomizeParameters(double z)
randomize the parameters a bit useful to test and debug fitting
bool isCouplingUsed(const char *couplname)
check if there is any morphing power provided for the given coupling morphing power is provided as so...
void readParameters(TDirectory *f)
read the parameters from the input file
double getScale()
get energy scale of the EFT expansion
double getCondition() const
Retrieve the condition of the coefficient matrix.
TMatrixD getMatrix() const
Retrieve the matrix of coefficients.
void printWeights() const
print the current sample weights
void printCouplings() const
print a set of couplings
TMatrixD readMatrixFromFile(const char *fname)
read a matrix from a text file
~RooLagrangianMorphFunc() override
default destructor
void printParameters() const
print the parameters and their current values
void printPhysics() const
print the current physics values
static std::unique_ptr< RooRatio > makeRatio(const char *name, const char *title, RooArgList &nr, RooArgList &dr)
Return the RooRatio form of products and denominators of morphing functions.
void setFlag(const char *name, double value)
set one flag to a specific value
TH1 * createTH1(const std::string &name)
retrieve a histogram output of the current morphing settings
double expectedUncertainty() const
return the expected uncertainty for the current parameter set
int nParameters() const
return the number of parameters in this morphing function
bool hasParameter(const char *paramname) const
check if a parameter of the given name is contained in the list of known parameters
bool checkObservables(const RooArgSet *nset) const override
check if observable exists in the RooArgSet (-?-)
bool hasCache() const
return true if a cache object is present, false otherwise
void printFlags() const
print the flags and their current values
void setScale(double val)
set energy scale of the EFT expansion
TMatrixD getInvertedMatrix() const
Retrieve the matrix of coefficients after inversion.
double analyticalIntegralWN(Int_t code, const RooArgSet *normSet, const char *rangeName=nullptr) const override
Retrieve the matrix of coefficients.
RooAbsArg::CacheMode canNodeBeCached() const override
Retrieve the matrix of coefficients.
void updateSampleWeights()
update sample weight (-?-)
void setParameters(const char *foldername)
set the morphing parameters to those supplied in the sample with the given name
RooObjCacheManager _cacheMgr
bool isParameterUsed(const char *paramname) const
check if there is any morphing power provided for the given parameter morphing power is provided as s...
RooListProxy _observables
RooAbsPdf::ExtendMode extendMode() const
return extended mored capabilities
std::map< const std::string, FlagSet > FlagMap
bool forceAnalyticalInt(const RooAbsArg &arg) const override
Force analytical integration for the given observable.
void setParameterConstant(const char *paramname, bool constant) const
call setConstant with the boolean argument provided on the parameter with the given name
void disableInterferences(const std::vector< std::vector< const char * > > &nonInterfering)
disable interference between terms
void printSamples() const
print all the known samples to the console
double getParameterValue(const char *name) const
set one parameter to a specific value
void setup(bool ownParams=true)
setup this instance with the given set of operators and vertices if own=true, the class will own the ...
void printMetaArgs(std::ostream &os) const override
Retrieve the matrix of coefficients.
std::unique_ptr< RooWrapperPdf > createPdf() const
(currently similar to cloning the Pdf
RooAbsReal * getSampleWeight(const char *name)
retrieve the weight (prefactor) of a sample with the given name
std::map< std::string, std::string > createWeightStrings(const ParamMap &inputs, const std::vector< std::vector< std::string > > &vertices)
create only the weight formulas. static function for external usage.
Int_t getAnalyticalIntegralWN(RooArgSet &allVars, RooArgSet &numVars, const RooArgSet *normSet, const char *rangeName=nullptr) const override
Retrieve the mat.
std::vector< std::vector< RooListProxy * > > _diagrams
double expectedEvents() const
return the number of expected events for the current parameter set
std::map< std::string, int > _sampleMap
RooLagrangianMorphFunc::CacheElem * getCache() const
retrieve the cache object
RooRealVar * setupObservable(const char *obsname, TClass *mode, TObject *inputExample)
setup observable, recycle existing observable if defined
const RooArgList * getCouplingSet() const
get the set of couplings
RooRealSumFunc * getFunc() const
get the func
std::list< double > * binBoundaries(RooAbsRealLValue &, double, double) const override
retrieve the list of bin boundaries
void printEvaluation() const
print the contributing samples and their respective weights
bool writeCoefficients(const char *filename)
write the inverse matrix to a file
void collectInputs(TDirectory *f)
retrieve the physics inputs
void init()
initialise inputs required for the morphing function
RooLinearCombination is a class that helps perform linear combination of floating point numbers and p...
A histogram function that assigns scale parameters to every bin.
Represents the product of a given set of RooAbsReal objects.
std::list< double > * binBoundaries(RooAbsRealLValue &, double, double) const override
Retrieve bin boundaries if this distribution is binned in obs.
void printMetaArgs(std::ostream &os) const override
Customized printing of arguments of a RooRealSumFunc to more intuitively reflect the contents of the ...
Int_t getAnalyticalIntegralWN(RooArgSet &allVars, RooArgSet &numVars, const RooArgSet *normSet, const char *rangeName=nullptr) const override
Variant of getAnalyticalIntegral that is also passed the normalization set that should be applied to ...
CacheMode canNodeBeCached() const override
double analyticalIntegralWN(Int_t code, const RooArgSet *normSet, const char *rangeName=nullptr) const override
Implements the actual analytical integral(s) advertised by getAnalyticalIntegral.
bool isBinnedDistribution(const RooArgSet &obs) const override
Tests if the distribution is binned. Unless overridden by derived classes, this always returns false.
bool checkObservables(const RooArgSet *nset) const override
Overloadable function in which derived classes can implement consistency checks of the variables.
void setCacheAndTrackHints(RooArgSet &) override
std::list< double > * plotSamplingHint(RooAbsRealLValue &, double, double) const override
Interface for returning an optional hint for initial sampling points when constructing a curve projec...
bool forceAnalyticalInt(const RooAbsArg &arg) const override
Variable that can be changed from the outside.
void setVal(double value) override
Set value of variable to 'value'.
void setError(double value)
void setMin(const char *name, double value)
Set minimum of name range to given value.
const RooAbsBinning & getBinning(const char *name=nullptr, bool verbose=true, bool createOnTheFly=false) const override
Return binning definition with name.
void setBinning(const RooAbsBinning &binning, const char *name=nullptr)
Add given binning under name 'name' with this variable.
void setBins(Int_t nBins, const char *name=nullptr)
Create a uniform binning under name 'name' for this variable.
void setMax(const char *name, double value)
Set maximum of name range to given value.
Class to manage histogram axis.
TClass instances represent classes, structs and namespaces in the ROOT type system.
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
Describe directory structure in memory.
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
virtual Bool_t IsOpen() const
Returns kTRUE in case file is open and kFALSE if file is not open.
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
void Close(Option_t *option="") override
Close a file.
<div class="legacybox"><h2>Legacy Code</h2> TFolder is a legacy interface: there will be no bug fixes...
TH1 is the base class of all histogram classes in ROOT.
virtual Int_t GetNbinsX() const
virtual void SetBinError(Int_t bin, Double_t error)
Set the bin Error Note that this resets the bin eror option to be of Normal Type and for the non-empt...
virtual Double_t Integral(Option_t *option="") const
Return integral of bin contents.
virtual void SetBinContent(Int_t bin, Double_t content)
Set bin content see convention for numbering bins in TH1::GetBin In case the bin number is greater th...
virtual Double_t GetBinLowEdge(Int_t bin) const
Return bin lower edge for 1D histogram.
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
virtual Double_t GetBinWidth(Int_t bin) const
Return bin width for 1D histogram.
virtual void Scale(Double_t c1=1, Option_t *option="")
Multiply this histogram by a constant c1.
TMatrixTBase< Element > & ResizeTo(Int_t nrows, Int_t ncols, Int_t=-1) override
Set size of the matrix to nrows x ncols New dynamic elements are created, the overlapping part of the...
const char * GetName() const override
Returns name of object.
Mother of all ROOT objects.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Class used by TMap to store (key,value) pairs.
Random number generator class based on M.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
RooCmdArg Silence(bool flag=true)
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
std::vector< std::string > Split(std::string_view str, std::string_view delims, bool skipEmpty=false)
Splits a string at each character in delims.
std::string observableName
std::vector< std::string > folderNames
std::vector< std::vector< const char * > > nonInterfering