diff --git a/v2.5/toolkit/fastnlotoolkit/fastNLOCoeffAddFix.cc b/v2.5/toolkit/fastnlotoolkit/fastNLOCoeffAddFix.cc index fb589be55556396d86a6f6a20639482359d5cfae..1995a7ea5d9208382bf1f21850c2317ce01bccfb 100644 --- a/v2.5/toolkit/fastnlotoolkit/fastNLOCoeffAddFix.cc +++ b/v2.5/toolkit/fastnlotoolkit/fastNLOCoeffAddFix.cc @@ -373,7 +373,7 @@ bool fastNLOCoeffAddFix::IsEquivalent(const fastNLOCoeffBase& other, double rtol double rdiff = std::abs((txn1 - oxn1) / txn1); if (rdiff > rtol) { debug["IsEquivalent"] << "rdiff too high: obsBin=" << obsBin << " xNode=" << xNode << - " txn1=" << txn1 << " oxn1" << oxn1 << " rdiff=" << rdiff << endl; + " txn1=" << txn1 << " oxn1=" << oxn1 << " rdiff=" << rdiff << endl; return false; } } diff --git a/v2.5/toolkit/fastnlotoolkit/fastNLOCoeffAddFlex.cc b/v2.5/toolkit/fastnlotoolkit/fastNLOCoeffAddFlex.cc index 758b8cb11334842b38352e322de9a10e561b17ff..a8b03397c5f79f969007e8a7ef08ec4cf0ea73db 100644 --- a/v2.5/toolkit/fastnlotoolkit/fastNLOCoeffAddFlex.cc +++ b/v2.5/toolkit/fastnlotoolkit/fastNLOCoeffAddFlex.cc @@ -577,3 +577,102 @@ void fastNLOCoeffAddFlex::CatBin(const fastNLOCoeffAddFlex& other, unsigned int } fastNLOCoeffAddBase::CatBin(other, iObsIdx, ITabVersionRead); } + + +//________________________________________________________________________________________________________________ // +bool fastNLOCoeffAddFlex::IsEquivalent(const fastNLOCoeffBase& other, double rtol) const { + const fastNLOCoeffAddFlex* op = dynamic_cast<const fastNLOCoeffAddFlex*>(&other); + if (op == nullptr) { + return false; + } + + for (unsigned int obsBin = 0; obsBin < SigmaTildeMuIndep.size(); obsBin++) { + unsigned int tOffsetXN1; + unsigned int oOffsetXN1; + int tnb1 = GetNxtot1(obsBin); + int onb1 = op->GetNxtot1(obsBin); + if (tnb1 > onb1) { + tOffsetXN1 = tnb1 - onb1; + oOffsetXN1 = 0; + } else { + tOffsetXN1 = 0; + oOffsetXN1 = onb1 - tnb1; + } + for (int xNode = 0; xNode < std::min(tnb1, onb1); xNode++) { + double txn1 = GetXNode1(obsBin, xNode + tOffsetXN1); + double oxn1 = op->GetXNode1(obsBin, xNode + oOffsetXN1); + double rdiff = std::abs((txn1 - oxn1) / txn1); + if (rdiff > rtol) { + debug["IsEquivalent"] << "rdiff too high: obsBin=" << obsBin << " xNode=" << xNode << + " txn1=" << txn1 << " oxn1=" << oxn1 << " rdiff=" << rdiff << endl; + return false; + } + } + } + std::vector<const fastNLO::v5d*> tst6 = GetSigmaTildes(); + std::vector<const fastNLO::v5d*> ost6 = op->GetSigmaTildes(); + std::vector<std::string> names = {"MuIndep", "MuRDep", "MuFDep", "MuRRDep", "MuFFDep", "MuRFDep"}; + for (unsigned int i = 0; i < tst6.size(); i++) { + const fastNLO::v5d* tst5 = tst6[i]; + const fastNLO::v5d* ost5 = ost6[i]; + if (!IsSigmaTildeEquivalent(tst5, ost5, rtol, names[i])) { + return false; + } + } + return true; +} + + +//________________________________________________________________________________________________________________ // +bool fastNLOCoeffAddFlex::IsSigmaTildeEquivalent(const fastNLO::v5d *tst5, const fastNLO::v5d *ost5, double rtol, std::string name) const { + if (tst5->size() != ost5->size()) { + return false; + } + for (unsigned int obsBin = 0; obsBin < tst5->size(); obsBin++) { + + fastNLO::v4d tst4 = tst5->at(obsBin); + fastNLO::v4d ost4 = ost5->at(obsBin); + if (tst4.size() != ost4.size()) { + return false; + } + for (unsigned int scaleVar = 0; scaleVar < tst4.size(); scaleVar++) { + fastNLO::v3d tst3 = tst4[scaleVar]; + fastNLO::v3d ost3 = ost4[scaleVar]; + if (tst3.size() != ost3.size()) { + return false; + } + for (unsigned int scaleNode = 0; scaleNode < tst3.size(); scaleNode++) { + fastNLO::v2d tst2 = tst3[scaleNode]; + fastNLO::v2d ost2 = ost3[scaleNode]; + unsigned int tOffset2; + unsigned int oOffset2; + if (tst2.size() > ost2.size()) { + tOffset2 = tst2.size() - ost2.size(); + oOffset2 = 0; + } else { + tOffset2 = 0; + oOffset2 = ost2.size() - tst2.size(); + } + for (unsigned int xNode = 0; xNode < std::min(tst2.size(), ost2.size()); xNode++) { + fastNLO::v1d tst1 = tst2[xNode + tOffset2]; + fastNLO::v1d ost1 = ost2[xNode + oOffset2]; + if (tst1.size() != ost1.size()) { + return false; + } + for (unsigned int subProcess = 0; subProcess < tst1.size(); subProcess++) { + double rdiff = std::abs((tst1[subProcess] - ost1[subProcess]) / tst1[subProcess]); + if (rdiff > rtol) { + debug["IsEquivalent"] << name << ": rdiff too high: obsBin=" << obsBin << " scaleVar=" << scaleVar + << " scaleNode=" << scaleNode << " xNode=" << xNode << " subProcess=" << subProcess << + " t=" << tst1[subProcess] << " o=" << ost1[subProcess] << " rdiff=" << rdiff << endl; + return false; + } + } + + } + + } + } + } + return true; +} diff --git a/v2.5/toolkit/fastnlotoolkit/fastNLOCreate.cc b/v2.5/toolkit/fastnlotoolkit/fastNLOCreate.cc index a68e7574c387cdd3e19b00a86c163baeb85879d0..1af1246c573cdd8bb35522edf7a0bfd959eeea33 100644 --- a/v2.5/toolkit/fastnlotoolkit/fastNLOCreate.cc +++ b/v2.5/toolkit/fastnlotoolkit/fastNLOCreate.cc @@ -3036,6 +3036,21 @@ void fastNLOCreate::FillContributionFlexHHC(fastNLOCoeffAddFlex* c, int ObsBin, HalfMatrixCheck(fEvent._x1,fEvent._x2,xminbin,xmaxbin,p); //HalfMatrixCheck(xminbin,xmaxbin,p); int ixHM = GetXIndex(ObsBin,xminbin,xmaxbin); + fastNLO::v1d fg1 = fKernX1[ObsBin]->fgrid; + fastNLO::v1d xn1 = c->XNode1[ObsBin]; + for (unsigned int i = fg1.size() - xn1.size(); i > 0; i--) { + xn1.insert(xn1.begin(), fg1[i - 1]); + } + c->XNode1[ObsBin] = xn1; + if (c->NPDFDim > 1) { + fastNLO::v1d fg2 = fKernX2[ObsBin]->fgrid; + fastNLO::v1d xn2 = c->XNode2[ObsBin]; + for (unsigned int i = fg2.size() - xn2.size(); i > 0; i--) { + xn2.insert(xn2.begin(), fg2[i - 1]); + } + c->XNode2[ObsBin] = xn2; + } + ExtendAllFlexSigmaTilde(c, ObsBin); for (unsigned int m1 = 0 ; m1<nmu1.size() ; m1++) { for (unsigned int mu2 = 0 ; mu2<nmu2.size() ; mu2++) { @@ -3235,6 +3250,34 @@ void fastNLOCreate::FillContributionFlexDIS(fastNLOCoeffAddFlex* c, int ObsBin, } +// ___________________________________________________________________________________________________ +void fastNLOCreate::ExtendAllFlexSigmaTilde(fastNLOCoeffAddFlex* c, int ObsBin) { + ExtendFlexSigmaTilde(c, ObsBin, c->SigmaTildeMuIndep); + ExtendFlexSigmaTilde(c, ObsBin, c->SigmaTildeMuFDep); + ExtendFlexSigmaTilde(c, ObsBin, c->SigmaTildeMuRDep); + ExtendFlexSigmaTilde(c, ObsBin, c->SigmaTildeMuRRDep); + ExtendFlexSigmaTilde(c, ObsBin, c->SigmaTildeMuFFDep); + ExtendFlexSigmaTilde(c, ObsBin, c->SigmaTildeMuRFDep); +} + + +// ___________________________________________________________________________________________________ +void fastNLOCreate::ExtendFlexSigmaTilde(fastNLOCoeffAddFlex* c, int ObsBin, fastNLO::v5d &SigmaTilde) { + fastNLO::v4d st_ob = SigmaTilde[ObsBin]; + unsigned int numXNodes = c->GetNxmax(ObsBin); + while (st_ob.size() < numXNodes) { + st_ob.insert( + st_ob.begin(), + fastNLO::v3d( + c->GetNScaleNode1(ObsBin), + fastNLO::v2d( + c->GetNScaleNode2(ObsBin), + fastNLO::v1d(c->GetNSubproc())))); + } + SigmaTilde[ObsBin] = st_ob; +} + + // ___________________________________________________________________________________________________ void fastNLOCreate::FillContributionFixDIS(fastNLOCoeffAddFix* c, int ObsBin, int scalevar, const double wgtfac) { //! read information from 'Event' and 'Scenario' @@ -4443,9 +4486,11 @@ void fastNLOCreate::InitInterpolationKernels() { vector<double> wrmMu1Up, wrmMu1Dn; vector<double> wrmMu2Up, wrmMu2Dn; if (GetTheCoeffTable()->GetIRef() == 0) { - if (fScenConsts.X_NNodeCounting == "NodeDensity") { + if (!WarmupNeeded()) { wrmMu1Dn = GetObsBinsLoBounds(1); wrmMu1Up = GetObsBinsUpBounds(1); + wrmMu2Dn = GetObsBinsLoBounds(1); + wrmMu2Up = GetObsBinsUpBounds(1); } else { wrmX = GetColumnFromTable(fWarmupConsts.Values, 1) ;// DOUBLE_COL_NS(Warmup.Values,x_min,fSteerfile); wrmMu1Dn = GetColumnFromTable(fWarmupConsts.Values, 3) ;//read_steer::getdoublecolumn("Warmup.Values",GetWarmupHeader(0,"min"),fSteerfile); diff --git a/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOCoeffAddFlex.h b/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOCoeffAddFlex.h index 51f8cd6c669b78347f070eb173ef6fc3da529116..9326c03cee2e5e15c025288d4d685c6dc514ce69 100644 --- a/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOCoeffAddFlex.h +++ b/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOCoeffAddFlex.h @@ -48,6 +48,8 @@ public: std::vector<const fastNLO::v5d*> GetSigmaTildes() const { return {&SigmaTildeMuIndep,&SigmaTildeMuRDep,&SigmaTildeMuFDep,&SigmaTildeMuRRDep,&SigmaTildeMuFFDep,&SigmaTildeMuRFDep}; };//!< Get access to sigma tilde + bool IsEquivalent(const fastNLOCoeffBase& other, double rtol) const; + bool IsSigmaTildeEquivalent(const fastNLO::v5d *tst5, const fastNLO::v5d *ost5, double rtol, std::string name) const; protected: diff --git a/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOCreate.h b/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOCreate.h index e42ec93937861cad381e6de16b4b0151f83e6545..9856282afc1c88ccb44c165065f3802c9187c30f 100644 --- a/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOCreate.h +++ b/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOCreate.h @@ -268,6 +268,8 @@ protected: void FlushCache(); //!< Fill weights from cache into table bool WarmupNeeded() const; + void ExtendAllFlexSigmaTilde(fastNLOCoeffAddFlex* c, int ObsBin); + void ExtendFlexSigmaTilde(fastNLOCoeffAddFlex* c, int ObsBin, fastNLO::v5d &SigmaTilde); struct fnloStats {