diff --git a/v2.5/toolkit/fastnlotoolkit/fastNLOCreate.cc b/v2.5/toolkit/fastnlotoolkit/fastNLOCreate.cc index f1dcbc9840687d76da9823b8867540ab43b70a5c..fc124a70fb67775f9f8f26686b64f09c8f38731a 100644 --- a/v2.5/toolkit/fastnlotoolkit/fastNLOCreate.cc +++ b/v2.5/toolkit/fastnlotoolkit/fastNLOCreate.cc @@ -2473,26 +2473,13 @@ void fastNLOCreate::FillAllSubprocesses(const vector<vector<fnloEvent> >& events vector<pair<int,double> > nxup; if (c->NPDFDim > 1) { nxup = fKernX2[ObsBin]->GetNodeValues(xmax); + fastNLOTools::ExtendHead(c->XNode1[ObsBin], fKernX1[ObsBin]->fgrid); + fastNLOTools::ExtendHead(c->XNode2[ObsBin], fKernX2[ObsBin]->fgrid); } else { nxup = fKernX1[ObsBin]->GetNodeValues(xmax); + fastNLOTools::ExtendHead(c->XNode1[ObsBin], fKernX1[ObsBin]->fgrid); } - 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; - } - unsigned int maxNumNodes = c->GetNxmax(ObsBin); - if (fApplyPDFReweight) { fKernX1[ObsBin]->CheckX(xmin); fKernX2[ObsBin]->CheckX(xmax); @@ -2504,61 +2491,13 @@ void fastNLOCreate::FillAllSubprocesses(const vector<vector<fnloEvent> >& events } } - - // for (unsigned int i = 0; i < fg1.size(); i++) { - // std::cout << fg1[i] << " "; - // } - // std::cout << endl; - // for (unsigned int i = 0; i < nxlo.size(); i++) { - // std::cout << nxlo[i].first << " "; - // } - // std::cout << endl; - // for (unsigned int i = 0; i < nxup.size(); i++) { - // std::cout << fg1[nxlo[i].first] << " "; - // } - // std::cout << endl; - // for (unsigned int i = 0; i < nxup.size(); i++) { - // std::cout << nxlo[i].second << " "; - // } - // std::cout << endl; - // fastNLO::v1d fg2 = fKernX2[ObsBin]->fgrid; - // for (unsigned int i = 0; i < fg2.size(); i++) { - // std::cout << fg2[i] << " "; - // } - // std::cout << endl; - // for (unsigned int i = 0; i < nxup.size(); i++) { - // std::cout << nxup[i].first << " "; - // } - // std::cout << endl; - // for (unsigned int i = 0; i < nxup.size(); i++) { - // std::cout << fg2[nxup[i].first] << " "; - // } - // std::cout << endl; - // for (unsigned int i = 0; i < nxup.size(); i++) { - // std::cout << nxup[i].second << " "; - // } - // std::cout << endl; fastNLO::v4d& st = c->SigmaTilde[ObsBin]; for (unsigned int is = 0 ; is<events.size() ; is++) { double mu = fScenario._m1 * fScaleFac[is]; const vector<pair<int,double> >& nmu = fKernMuS[ObsBin][is]->GetNodeValues(mu); for (unsigned int m1 = 0 ; m1<nmu.size() ; m1++) { fastNLO::v2d& stm1 = st[is][nmu[m1].first]; - unsigned int i = 0; - while (stm1.size() < maxNumNodes) { - if (i * (i + 1) / 2 > stm1.size()) { - for (unsigned int j = 0; j < i; j++) { - stm1.insert(stm1.begin() + (j * (j + 1) / 2), fastNLO::v1d(NSubProc)); - } - } - i++; - } - if (stm1.size() != maxNumNodes) { - logger.error["FillAllSubprocesses"] << "stm1 has size " << stm1.size() - << " when it should have size " << maxNumNodes << endl; - exit(1); - } - st[is][nmu[m1].first] = stm1; + fastNLOTools::ExtendSigmaTildeX(stm1, c->GetNxtot1(ObsBin), c->GetNxtot2(ObsBin), c->NPDFDim, NSubProc); for (unsigned int p = 0 ; p<events[is].size() ; p++) { double wgt = wgtfac * events[is][p]._w * nmu[m1].second / BinSize[ObsBin]; // ....................................................................................... diff --git a/v2.5/toolkit/fastnlotoolkit/fastNLOTools.cc b/v2.5/toolkit/fastnlotoolkit/fastNLOTools.cc index f9c551c23b28f361c6a59bb835ec7caf4cf33b7a..2093f9cf825cf7531d2212d60a156a23024ac5bb 100644 --- a/v2.5/toolkit/fastnlotoolkit/fastNLOTools.cc +++ b/v2.5/toolkit/fastnlotoolkit/fastNLOTools.cc @@ -571,4 +571,30 @@ namespace fastNLOTools { } return true; } + + //______________________________________________________________________________ + void ExtendHead(fastNLO::v1d& vector1, fastNLO::v1d& vector2) { + if (vector1.size() < vector2.size()) { + vector1.insert(vector1.begin(), vector2.begin(), vector2.begin() + (vector2.size() - vector1.size())); + } + } + + //______________________________________________________________________________ + void ExtendSigmaTildeX(fastNLO::v2d& SigmaTildeX, unsigned int DimSize1, unsigned int DimSize2, int NPDFDim, int NSubProc) { + if (NPDFDim == 1) { + unsigned int i = 1; + while (SigmaTildeX.size() < DimSize1 * (DimSize1 + 1) / 2) { + if (i * (i + 1) / 2 > SigmaTildeX.size()) { + for (unsigned int j = 0; j < i; j++) { + SigmaTildeX.insert(SigmaTildeX.begin() + (j * (j + 1) / 2), fastNLO::v1d(NSubProc)); + } + } + i++; + } + } else { + error["ExtendSigmaTildeX"] << "Unsupported NPdfDim: " << NPDFDim << endl; + exit(1); + } + } + } // end namespace fastNLO diff --git a/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOTools.h b/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOTools.h index 4d9abac8b04a11b489d6e98dd506ee89302ff7cf..a3d3f548a14c7b3f34da6706308cc389e8b7b837 100644 --- a/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOTools.h +++ b/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOTools.h @@ -93,6 +93,8 @@ namespace fastNLOTools { std::pair<fastNLO::v1d, fastNLO::v1d> GetTails(fastNLO::v1d& vector1, fastNLO::v1d& vector2); bool SameTails(fastNLO::v1d vector1, fastNLO::v1d vector2, double rtol=0.0); bool SameTails(fastNLO::v2d vector1, fastNLO::v2d vector2, double rtol=0.0); + void ExtendHead(fastNLO::v1d& vector1, fastNLO::v1d& vector2); + void ExtendSigmaTildeX(fastNLO::v2d& SigmaTildeX, unsigned int DimSize1, unsigned int DimSize2, int NPDFDim, int NSubProc); };