From a9ce85312a24dfc6210708b0b70a280569e14a17 Mon Sep 17 00:00:00 2001 From: Klaus Rabbertz <klaus.rabbertz@cern.ch> Date: Tue, 18 Jun 2024 03:15:08 +0200 Subject: [PATCH] Switch back to differenty named methods for now to return uncertainty vectors to Python numpy arrays --- v2.5/toolkit/fastnlotoolkit/fastNLOLHAPDF.cc | 36 ++++++++++++------- v2.5/toolkit/fastnlotoolkit/fastNLOReader.cc | 12 ++++--- .../include/fastnlotk/fastNLOLHAPDF.h | 26 +++++++++----- .../include/fastnlotk/fastNLOReader.h | 14 +++++--- 4 files changed, 58 insertions(+), 30 deletions(-) diff --git a/v2.5/toolkit/fastnlotoolkit/fastNLOLHAPDF.cc b/v2.5/toolkit/fastnlotoolkit/fastNLOLHAPDF.cc index 58f5578b..391ffe19 100644 --- a/v2.5/toolkit/fastnlotoolkit/fastNLOLHAPDF.cc +++ b/v2.5/toolkit/fastnlotoolkit/fastNLOLHAPDF.cc @@ -413,7 +413,8 @@ XsUncertainty fastNLOLHAPDF::GetXsUncertainty(const fastNLO::EAsUncertaintyStyle //______________________________________________________________________________ -std::vector< std::vector<double> > fastNLOLHAPDF::GetXsUncertaintyVec(const fastNLO::EAsUncertaintyStyle eAsUnc, bool lNorm, int iprint) { +// std::vector< std::vector<double> > fastNLOLHAPDF::GetXsUncertaintyVec(const fastNLO::EAsUncertaintyStyle eAsUnc, bool lNorm, int iprint) { +std::vector< std::vector<double> > fastNLOLHAPDF::GetAsUncertaintyVec(const fastNLO::EAsUncertaintyStyle eAsUnc, bool lNorm, int iprint) { XsUncertainty xsUnc = fastNLOLHAPDF::GetXsUncertainty(eAsUnc, lNorm); if (iprint > 0) { string style{AsUncertaintyStyle_to_string(eAsUnc)}; @@ -431,7 +432,8 @@ std::vector< std::vector<double> > fastNLOLHAPDF::GetXsUncertaintyVec(const fast //______________________________________________________________________________ -void fastNLOLHAPDF::PrintXsUncertaintyVec(fastNLO::EAsUncertaintyStyle eAsUnc, std::string UncName, bool lNorm) { +// void fastNLOLHAPDF::PrintXsUncertaintyVec(fastNLO::EAsUncertaintyStyle eAsUnc, std::string UncName, bool lNorm) { +void fastNLOLHAPDF::PrintAsUncertaintyVec(fastNLO::EAsUncertaintyStyle eAsUnc, std::string UncName, bool lNorm) { XsUncertainty xsUnc = GetXsUncertainty(eAsUnc, lNorm); fastNLOTools::PrintXSUncertainty(xsUnc, UncName); } @@ -622,7 +624,8 @@ XsUncertainty fastNLOLHAPDF::GetXsUncertainty(const fastNLO::EPDFUncertaintyStyl //______________________________________________________________________________ -std::vector< std::vector<double> > fastNLOLHAPDF::GetXsUncertaintyVec(const fastNLO::EPDFUncertaintyStyle ePDFUnc, bool lNorm, int iprint) { +// std::vector< std::vector<double> > fastNLOLHAPDF::GetXsUncertaintyVec(const fastNLO::EPDFUncertaintyStyle ePDFUnc, bool lNorm, int iprint) { +std::vector< std::vector<double> > fastNLOLHAPDF::GetPDFUncertaintyVec(const fastNLO::EPDFUncertaintyStyle ePDFUnc, bool lNorm, int iprint) { XsUncertainty xsUnc = GetXsUncertainty(ePDFUnc, lNorm); if (iprint > 0) { string style{PDFUncertaintyStyle_to_string(ePDFUnc)}; @@ -640,7 +643,8 @@ std::vector< std::vector<double> > fastNLOLHAPDF::GetXsUncertaintyVec(const fast //______________________________________________________________________________ -void fastNLOLHAPDF::PrintXsUncertaintyVec(fastNLO::EPDFUncertaintyStyle ePDFUnc, std::string UncName, bool lNorm) { +// void fastNLOLHAPDF::PrintXsUncertaintyVec(fastNLO::EPDFUncertaintyStyle ePDFUnc, std::string UncName, bool lNorm) { +void fastNLOLHAPDF::PrintPDFUncertaintyVec(fastNLO::EPDFUncertaintyStyle ePDFUnc, std::string UncName, bool lNorm) { XsUncertainty xsUnc = GetXsUncertainty(ePDFUnc, lNorm); fastNLOTools::PrintXSUncertainty(xsUnc, UncName); } @@ -652,12 +656,16 @@ XsUncertainty fastNLOLHAPDF::GetXsUncertainty(const fastNLO::EScaleUncertaintySt return fastNLOReader::GetXsUncertainty(eScaleUnc, lNorm, sclfac); } //______________________________________________________________________________ -std::vector< std::vector<double> > fastNLOLHAPDF::GetXsUncertaintyVec(const fastNLO::EScaleUncertaintyStyle eScaleUnc, bool lNorm, int iprint, double sclfac) { - return fastNLOReader::GetXsUncertaintyVec(eScaleUnc, lNorm, iprint, sclfac); +// std::vector< std::vector<double> > fastNLOLHAPDF::GetXsUncertaintyVec(const fastNLO::EScaleUncertaintyStyle eScaleUnc, bool lNorm, int iprint, double sclfac) { +// return fastNLOReader::GetXsUncertaintyVec(eScaleUnc, lNorm, iprint, sclfac); +std::vector< std::vector<double> > fastNLOLHAPDF::GetScaleUncertaintyVec(const fastNLO::EScaleUncertaintyStyle eScaleUnc, bool lNorm, int iprint, double sclfac) { + return fastNLOReader::GetScaleUncertaintyVec(eScaleUnc, lNorm, iprint, sclfac); } //______________________________________________________________________________ -void fastNLOLHAPDF::PrintXsUncertaintyVec(fastNLO::EScaleUncertaintyStyle eScaleUnc, std::string UncName, bool lNorm, double sclfac) { - fastNLOReader::PrintXsUncertaintyVec(eScaleUnc, UncName, lNorm, sclfac); +// void fastNLOLHAPDF::PrintXsUncertaintyVec(fastNLO::EScaleUncertaintyStyle eScaleUnc, std::string UncName, bool lNorm, double sclfac) { +// fastNLOReader::PrintXsUncertaintyVec(eScaleUnc, UncName, lNorm, sclfac); +void fastNLOLHAPDF::PrintScaleUncertaintyVec(fastNLO::EScaleUncertaintyStyle eScaleUnc, std::string UncName, bool lNorm, double sclfac) { + fastNLOReader::PrintScaleUncertaintyVec(eScaleUnc, UncName, lNorm, sclfac); } @@ -667,10 +675,14 @@ XsUncertainty fastNLOLHAPDF::GetXsUncertainty(const fastNLO::EStatUncertaintySty return fastNLOReader::GetXsUncertainty(eStatUnc, lNorm); } //______________________________________________________________________________ -std::vector< std::vector<double> > fastNLOLHAPDF::GetXsUncertaintyVec(const fastNLO::EStatUncertaintyStyle eStatUnc, bool lNorm, int iprint) { - return fastNLOReader::GetXsUncertaintyVec(eStatUnc, lNorm, iprint); +// std::vector< std::vector<double> > fastNLOLHAPDF::GetXsUncertaintyVec(const fastNLO::EStatUncertaintyStyle eStatUnc, bool lNorm, int iprint) { +// return fastNLOReader::GetXsUncertaintyVec(eStatUnc, lNorm, iprint); +std::vector< std::vector<double> > fastNLOLHAPDF::GetStatUncertaintyVec(const fastNLO::EStatUncertaintyStyle eStatUnc, bool lNorm, int iprint) { + return fastNLOReader::GetStatUncertaintyVec(eStatUnc, lNorm, iprint); } //______________________________________________________________________________ -void fastNLOLHAPDF::PrintXsUncertaintyVec(fastNLO::EStatUncertaintyStyle eStatUnc, std::string UncName, bool lNorm) { - fastNLOReader::PrintXsUncertaintyVec(eStatUnc, UncName, lNorm); +// void fastNLOLHAPDF::PrintXsUncertaintyVec(fastNLO::EStatUncertaintyStyle eStatUnc, std::string UncName, bool lNorm) { +// fastNLOReader::PrintXsUncertaintyVec(eStatUnc, UncName, lNorm); +void fastNLOLHAPDF::PrintStatUncertaintyVec(fastNLO::EStatUncertaintyStyle eStatUnc, std::string UncName, bool lNorm) { + fastNLOReader::PrintStatUncertaintyVec(eStatUnc, UncName, lNorm); } diff --git a/v2.5/toolkit/fastnlotoolkit/fastNLOReader.cc b/v2.5/toolkit/fastnlotoolkit/fastNLOReader.cc index dd139036..30456581 100644 --- a/v2.5/toolkit/fastnlotoolkit/fastNLOReader.cc +++ b/v2.5/toolkit/fastnlotoolkit/fastNLOReader.cc @@ -3514,7 +3514,8 @@ XsUncertainty fastNLOReader::GetXsUncertainty(const EScaleUncertaintyStyle eScal //______________________________________________________________________________ -std::vector< std::vector<double> > fastNLOReader::GetXsUncertaintyVec(const EScaleUncertaintyStyle eScaleUnc, bool lNorm, int iprint, double sclfac) { +// std::vector< std::vector<double> > fastNLOReader::GetXsUncertaintyVec(const EScaleUncertaintyStyle eScaleUnc, bool lNorm, int iprint, double sclfac) { +std::vector< std::vector<double> > fastNLOReader::GetScaleUncertaintyVec(const EScaleUncertaintyStyle eScaleUnc, bool lNorm, int iprint, double sclfac) { XsUncertainty xsUnc = fastNLOReader::GetXsUncertainty(eScaleUnc, lNorm, sclfac); if (iprint > 0) { string style{ScaleUncertaintyStyle_to_string(eScaleUnc)}; @@ -3532,7 +3533,8 @@ std::vector< std::vector<double> > fastNLOReader::GetXsUncertaintyVec(const ESca //______________________________________________________________________________ -void fastNLOReader::PrintXsUncertaintyVec(fastNLO::EScaleUncertaintyStyle eScaleUnc, std::string UncName, bool lNorm, double sclfac) { +// void fastNLOReader::PrintXsUncertaintyVec(fastNLO::EScaleUncertaintyStyle eScaleUnc, std::string UncName, bool lNorm, double sclfac) { +void fastNLOReader::PrintScaleUncertaintyVec(fastNLO::EScaleUncertaintyStyle eScaleUnc, std::string UncName, bool lNorm, double sclfac) { XsUncertainty xsUnc = GetXsUncertainty(eScaleUnc, lNorm, sclfac); fastNLOTools::PrintXSUncertainty(xsUnc, UncName); } @@ -3590,7 +3592,8 @@ XsUncertainty fastNLOReader::GetXsUncertainty(const EStatUncertaintyStyle eStatU //______________________________________________________________________________ -std::vector< std::vector<double> > fastNLOReader::GetXsUncertaintyVec(const EStatUncertaintyStyle eStatUnc, bool lNorm, int iprint) { +// std::vector< std::vector<double> > fastNLOReader::GetXsUncertaintyVec(const EStatUncertaintyStyle eStatUnc, bool lNorm, int iprint) { +std::vector< std::vector<double> > fastNLOReader::GetStatUncertaintyVec(const EStatUncertaintyStyle eStatUnc, bool lNorm, int iprint) { XsUncertainty xsUnc = fastNLOReader::GetXsUncertainty(eStatUnc, lNorm); if (iprint > 0) { string style{StatUncertaintyStyle_to_string(eStatUnc)}; @@ -3608,7 +3611,8 @@ std::vector< std::vector<double> > fastNLOReader::GetXsUncertaintyVec(const ESta //______________________________________________________________________________ -void fastNLOReader::PrintXsUncertaintyVec(fastNLO::EStatUncertaintyStyle eStatUnc, std::string UncName, bool lNorm) { +// void fastNLOReader::PrintXsUncertaintyVec(fastNLO::EStatUncertaintyStyle eStatUnc, std::string UncName, bool lNorm) { +void fastNLOReader::PrintStatUncertaintyVec(fastNLO::EStatUncertaintyStyle eStatUnc, std::string UncName, bool lNorm) { XsUncertainty xsUnc = GetXsUncertainty(eStatUnc, lNorm); fastNLOTools::PrintXSUncertainty(xsUnc, UncName); } diff --git a/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOLHAPDF.h b/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOLHAPDF.h index b6adee55..af931c3f 100644 --- a/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOLHAPDF.h +++ b/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOLHAPDF.h @@ -61,23 +61,31 @@ public: double GetAlphasMz() const; //! Return struct with vectors (for C++) or vector of vectors (for Python) containing the cross section values and the selected uncertainty - //! Enum of Uncertaintstyle decides on method to call + //! Enum of Uncertaintstyle decides on method to call, but does not work for Python extension --> switch back to use differently named UncertaintyVec methods // Use implementations in fastNLOReader for these XsUncertainty GetXsUncertainty(const fastNLO::EStatUncertaintyStyle eStatUnc, bool lNorm = false); - std::vector< std::vector<double> > GetXsUncertaintyVec(const fastNLO::EStatUncertaintyStyle eStatUnc, bool lNorm = false, int iprint = 0); - void PrintXsUncertaintyVec(fastNLO::EStatUncertaintyStyle, std::string UncName, bool lNorm = false); + // std::vector< std::vector<double> > GetXsUncertaintyVec(const fastNLO::EStatUncertaintyStyle eStatUnc, bool lNorm = false, int iprint = 0); + // void PrintXsUncertaintyVec(fastNLO::EStatUncertaintyStyle, std::string UncName, bool lNorm = false); + std::vector< std::vector<double> > GetStatUncertaintyVec(const fastNLO::EStatUncertaintyStyle eStatUnc, bool lNorm = false, int iprint = 0); + void PrintStatUncertaintyVec(fastNLO::EStatUncertaintyStyle, std::string UncName, bool lNorm = false); // XsUncertainty GetXsUncertainty(const fastNLO::EScaleUncertaintyStyle eScaleUnc, bool lNorm = false, double sclfac = 1.); - std::vector< std::vector<double> > GetXsUncertaintyVec(const fastNLO::EScaleUncertaintyStyle eScaleUnc, bool lNorm = false, int iprint = 0, double sclfac = 1.); - void PrintXsUncertaintyVec(fastNLO::EScaleUncertaintyStyle, std::string UncName, bool lNorm = false, double sclfac =1.); + // std::vector< std::vector<double> > GetXsUncertaintyVec(const fastNLO::EScaleUncertaintyStyle eScaleUnc, bool lNorm = false, int iprint = 0, double sclfac = 1.); + // void PrintXsUncertaintyVec(fastNLO::EScaleUncertaintyStyle, std::string UncName, bool lNorm = false, double sclfac =1.); + std::vector< std::vector<double> > GetScaleUncertaintyVec(const fastNLO::EScaleUncertaintyStyle eScaleUnc, bool lNorm = false, int iprint = 0, double sclfac = 1.); + void PrintScaleUncertaintyVec(fastNLO::EScaleUncertaintyStyle, std::string UncName, bool lNorm = false, double sclfac =1.); // Specific implementations in fastNLOLHAPDF XsUncertainty GetXsUncertainty(const fastNLO::EAsUncertaintyStyle eAsUnc, bool lNorm = false); - std::vector< std::vector<double> > GetXsUncertaintyVec(const fastNLO::EAsUncertaintyStyle eAsUnc, bool lNorm = false, int iprint = 0); - void PrintXsUncertaintyVec(fastNLO::EAsUncertaintyStyle, std::string UncName, bool lNorm = false); + // std::vector< std::vector<double> > GetXsUncertaintyVec(const fastNLO::EAsUncertaintyStyle eAsUnc, bool lNorm = false, int iprint = 0); + // void PrintXsUncertaintyVec(fastNLO::EAsUncertaintyStyle, std::string UncName, bool lNorm = false); + std::vector< std::vector<double> > GetAsUncertaintyVec(const fastNLO::EAsUncertaintyStyle eAsUnc, bool lNorm = false, int iprint = 0); + void PrintAsUncertaintyVec(fastNLO::EAsUncertaintyStyle, std::string UncName, bool lNorm = false); // XsUncertainty GetXsUncertainty(const fastNLO::EPDFUncertaintyStyle ePDFUnc, bool lNorm = false); - std::vector<std::vector<double> > GetXsUncertaintyVec(const fastNLO::EPDFUncertaintyStyle, bool lNorm = false, int iprint = 0); - void PrintXsUncertaintyVec(fastNLO::EPDFUncertaintyStyle, std::string UncName, bool lNorm = false); + // std::vector<std::vector<double> > GetXsUncertaintyVec(const fastNLO::EPDFUncertaintyStyle, bool lNorm = false, int iprint = 0); + // void PrintXsUncertaintyVec(fastNLO::EPDFUncertaintyStyle, std::string UncName, bool lNorm = false); + std::vector<std::vector<double> > GetPDFUncertaintyVec(const fastNLO::EPDFUncertaintyStyle, bool lNorm = false, int iprint = 0); + void PrintPDFUncertaintyVec(fastNLO::EPDFUncertaintyStyle, std::string UncName, bool lNorm = false); std::vector<LHAPDF::PDFUncertainty> GetPDFUncertaintyLHAPDF(double cl=100*erf(1/sqrt(2)), bool alternative=false); //!< return PDF uncertainty, formulae taken from LHAPDF6 std::vector<double> CalcPDFUncertaintyMinus(const std::vector<LHAPDF::PDFUncertainty>& ) const; //!<get vector<double> for PDF-minus uncertainty. Uncertainties are POSITIVE! diff --git a/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOReader.h b/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOReader.h index 23ac03c4..c491b5ce 100644 --- a/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOReader.h +++ b/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOReader.h @@ -98,14 +98,18 @@ public: std::vector < std::vector < double > > GetCrossSection2Dim(); //! Return struct with vectors (for C++) or vector of vectors (for Python) containing the cross section values and the selected uncertainty - //! Enum of Uncertaintstyle decides on method to call + //! Enum of Uncertaintstyle decides on method to call, but does not work for Python extension --> switch back to use differently named UncertaintyVec methods XsUncertainty GetXsUncertainty(const fastNLO::EScaleUncertaintyStyle eScaleUnc, bool lNorm = false, double sclfac = 1.); - std::vector< std::vector<double> > GetXsUncertaintyVec(const fastNLO::EScaleUncertaintyStyle eScaleUnc, bool lNorm = false, int iprint = 0, double sclfac = 1.); - void PrintXsUncertaintyVec(fastNLO::EScaleUncertaintyStyle, std::string UncName, bool lNorm = false, double sclfac =1.); + // std::vector< std::vector<double> > GetXsUncertaintyVec(const fastNLO::EScaleUncertaintyStyle eScaleUnc, bool lNorm = false, int iprint = 0, double sclfac = 1.); + // void PrintXsUncertaintyVec(fastNLO::EScaleUncertaintyStyle, std::string UncName, bool lNorm = false, double sclfac =1.); + std::vector< std::vector<double> > GetScaleUncertaintyVec(const fastNLO::EScaleUncertaintyStyle eScaleUnc, bool lNorm = false, int iprint = 0, double sclfac = 1.); + void PrintScaleUncertaintyVec(fastNLO::EScaleUncertaintyStyle, std::string UncName, bool lNorm = false, double sclfac =1.); // XsUncertainty GetXsUncertainty(const fastNLO::EStatUncertaintyStyle eStatUnc, bool lNorm = false); - std::vector< std::vector<double> > GetXsUncertaintyVec(const fastNLO::EStatUncertaintyStyle eStatUnc, bool lNorm = false, int iprint = 0); - void PrintXsUncertaintyVec(fastNLO::EStatUncertaintyStyle, std::string UncName, bool lNorm = false); + // std::vector< std::vector<double> > GetXsUncertaintyVec(const fastNLO::EStatUncertaintyStyle eStatUnc, bool lNorm = false, int iprint = 0); + // void PrintXsUncertaintyVec(fastNLO::EStatUncertaintyStyle, std::string UncName, bool lNorm = false); + std::vector< std::vector<double> > GetStatUncertaintyVec(const fastNLO::EStatUncertaintyStyle eStatUnc, bool lNorm = false, int iprint = 0); + void PrintStatUncertaintyVec(fastNLO::EStatUncertaintyStyle, std::string UncName, bool lNorm = false); // ---- Getters for fastNLOReader member variables ---- // fastNLO::EScaleFunctionalForm GetMuRFunctionalForm() const { return fMuRFunc; }; -- GitLab