diff --git a/v2.5/toolkit/fastnlotoolkit/fastNLOCreate.cc b/v2.5/toolkit/fastnlotoolkit/fastNLOCreate.cc index 885e3c831c347a74169556f5d779f137898b559d..6947f5fdd796aa4dd81c0178f29aa345166a79b0 100644 --- a/v2.5/toolkit/fastnlotoolkit/fastNLOCreate.cc +++ b/v2.5/toolkit/fastnlotoolkit/fastNLOCreate.cc @@ -2467,8 +2467,8 @@ void fastNLOCreate::FillAllSubprocesses(const vector<vector<fnloEvent> >& events fastNLOCoeffAddFix* c = (fastNLOCoeffAddFix*)GetTheCoeffTable(); int NSubProc = c->GetNSubproc(); // do interpolation - double xmin = GetTheCoeffTable()->GetNPDFDim() == 1 ? std::min(fEvent._x1,fEvent._x2) : fEvent._x1; - double xmax = GetTheCoeffTable()->GetNPDFDim() == 1 ? std::max(fEvent._x1,fEvent._x2) : fEvent._x2; + double xmin = c->GetNPDFDim() == 1 ? std::min(fEvent._x1,fEvent._x2) : fEvent._x1; + double xmax = c->GetNPDFDim() == 1 ? std::max(fEvent._x1,fEvent._x2) : fEvent._x2; vector<pair<int,double> > nxlo = fKernX1[ObsBin]->GetNodeValues(xmin); vector<pair<int,double> > nxup; if (c->NPDFDim > 1) { @@ -3262,23 +3262,6 @@ void fastNLOCreate::ExtendAllFlexSigmaTilde(fastNLOCoeffAddFlex* c, int ObsBin) } -// ___________________________________________________________________________________________________ -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' @@ -4579,10 +4562,10 @@ void fastNLOCreate::InitInterpolationKernels() { delete kernmin; } else if(fScenConsts.X_NNodeCounting == "NodeDensity") { logger.debug["InitInterpolationKernels"]<<"Setting x nodes as a density: "<<fScenConsts.X_NNodeCounting<<endl; - fKernX1[i] = new fastNLOInterpolLagrange(nxtot,fastNLOInterpolBase::TranslateGridType(fScenConsts.X_DistanceMeasure)); + fKernX1[i] = MakeInterpolationKernels(fScenConsts.X_Kernel,nxtot,fScenConsts.X_DistanceMeasure); // use 1 as upper x-value fKernX1[i]->MakeGrids(4,fReduceXmin); if (npdf == 2) { - fKernX2[i] = new fastNLOInterpolLagrange(nxtot,fastNLOInterpolBase::TranslateGridType(fScenConsts.X_DistanceMeasure)); + fKernX2[i] = MakeInterpolationKernels(fScenConsts.X_Kernel,nxtot,fScenConsts.X_DistanceMeasure); // use 1 as upper x-value fKernX2[i]->MakeGrids(4,fReduceXmin); } } else { @@ -4641,7 +4624,6 @@ std::vector<double> fastNLOCreate::GetColumnFromTable(const std::vector<std::vec } - // ___________________________________________________________________________________________________ fastNLOInterpolBase* fastNLOCreate::MakeInterpolationKernels(string KernelName, double xdn, double xup, const std::string& distancemeasure) { //! This function identifies the string-identifier @@ -4657,13 +4639,33 @@ fastNLOInterpolBase* fastNLOCreate::MakeInterpolationKernels(string KernelName, return new fastNLOInterpolLinear(xdn,xup,type); else if (KernelName == "OneNode") return new fastNLOInterpolOneNode(xdn,xup,type); - // else if ( KernelName == "...") // todo implement other kernels here! - // return ... else { - logger.warn["MakeInterpolationKernels"]<<"Cannot find kernel routine:" <<KernelName<<" or kernel not (yet) implemented. Exiting."<<endl; + logger.error["MakeInterpolationKernels"]<<"Cannot find kernel routine:" <<KernelName<<" or kernel not (yet) implemented. Exiting."<<endl; + exit(1); + } +} + + +// ___________________________________________________________________________________________________ +fastNLOInterpolBase* fastNLOCreate::MakeInterpolationKernels(string KernelName, double density, const std::string& distancemeasure) { + //! This function identifies the string-identifier + //! and creates the corresponding fastNLO Interpolation kernel + + fastNLOGrid::GridType type = fastNLOInterpolBase::TranslateGridType(distancemeasure); + + if (KernelName == "CatmullRom" || KernelName == "Catmull") + return new fastNLOInterpolCatmullRom(density,type); + else if (KernelName == "Lagrange") + return new fastNLOInterpolLagrange(density,type); + else if (KernelName == "Linear") + return new fastNLOInterpolLinear(density,type); + else if (KernelName == "OneNode") { + logger.error["MakeInterpolationKernels"]<<"Cannot create a OneNode kernel with a density. Exiting."<<endl; + exit(1); + } else { + logger.error["MakeInterpolationKernels"]<<"Cannot find kernel routine:" <<KernelName<<" or kernel not (yet) implemented. Exiting."<<endl; exit(1); } - return NULL; // default return } diff --git a/v2.5/toolkit/fastnlotoolkit/fastNLOInterpolBase.cc b/v2.5/toolkit/fastnlotoolkit/fastNLOInterpolBase.cc index 8b1ccadc8baeadbe12a727c89237655675b0bb89..9a593a0bc6e7d2aea6ea59ccf4a04db4110aa5db 100644 --- a/v2.5/toolkit/fastnlotoolkit/fastNLOInterpolBase.cc +++ b/v2.5/toolkit/fastnlotoolkit/fastNLOInterpolBase.cc @@ -29,6 +29,7 @@ fastNLOInterpolBase::fastNLOInterpolBase(double density, fastNLOGrid::GridType t debug["fastNLOInterpolBase"]<<"New fastNLOInterpolBase instance (density contructor)."<<endl; fLastGridPointWasRemoved=false; debug["fastNLOInterpolBase"]<<"Distance measure = "<<type<<endl; + debug["fastNLOInterpolBase"]<<"nMinNodes = "<<nMinNodes<<endl; fdm = type; fExtendLow = true; diff --git a/v2.5/toolkit/fastnlotoolkit/fastNLOInterpolCatmullRom.cc b/v2.5/toolkit/fastnlotoolkit/fastNLOInterpolCatmullRom.cc index db59a7acebfc7181b1b441296883cf96202fad9b..c31c4481131f72d302615683e847dd021281ac91 100644 --- a/v2.5/toolkit/fastnlotoolkit/fastNLOInterpolCatmullRom.cc +++ b/v2.5/toolkit/fastnlotoolkit/fastNLOInterpolCatmullRom.cc @@ -19,6 +19,12 @@ fastNLOInterpolCatmullRom::fastNLOInterpolCatmullRom(double min, double max, fas } +//______________________________________________________________________________ +fastNLOInterpolCatmullRom::fastNLOInterpolCatmullRom(double density, fastNLOGrid::GridType type) : fastNLOInterpolBase(density,type,4) { + debug["fastNLOInterpolLagrange"]<<"New fastNLOInterpolCatmullRom instance."<<endl; +} + + //______________________________________________________________________________ @@ -44,6 +50,8 @@ void fastNLOInterpolCatmullRom::CalcNodeValues(vector<pair<int,double> >& nodes, static const unsigned int nS = 4; // number of nodes that receive contributions from this interpolation + int nnode = FindLargestPossibleNode(x, true); + // --- relative distance delta - in function fdm H(x) // deltascale (Interpol(.,.,.delta,.): relative distance of value to node 'nnode' double delta = GetDelta(x); @@ -52,7 +60,6 @@ void fastNLOInterpolCatmullRom::CalcNodeValues(vector<pair<int,double> >& nodes, // --- get scale interpolation kernel and updated scalenode position: 1 <= nmu < ntot-2 int nmod = 0; // --- variable for final node - int nnode = FindLargestPossibleNode(x, true); int nmax = fgrid.size()-2; if (fLastGridPointWasRemoved) nmax=fgrid.size()-1; diff --git a/v2.5/toolkit/fastnlotoolkit/fastNLOInterpolLinear.cc b/v2.5/toolkit/fastnlotoolkit/fastNLOInterpolLinear.cc index 0ea9c793e4c43e388e39251363535c9931a035ca..2872ff6bcc88de3bc5544e4d6d2405c305e507f8 100644 --- a/v2.5/toolkit/fastnlotoolkit/fastNLOInterpolLinear.cc +++ b/v2.5/toolkit/fastnlotoolkit/fastNLOInterpolLinear.cc @@ -17,6 +17,12 @@ fastNLOInterpolLinear::fastNLOInterpolLinear(double min, double max, fastNLOGrid } +//______________________________________________________________________________ +fastNLOInterpolLinear::fastNLOInterpolLinear(double density, fastNLOGrid::GridType type) : fastNLOInterpolBase(density,type,4) { + debug["fastNLOInterpolLagrange"]<<"New fastNLOInterpolLinear instance."<<endl; +} + + //______________________________________________________________________________ fastNLOInterpolLinear::~fastNLOInterpolLinear(void) { } @@ -31,11 +37,12 @@ void fastNLOInterpolLinear::CalcNodeValues(vector<pair<int,double> >& nodes, dou //! - the value, which this node obtains. //! + // get scale interpolation kernel and updated scalenode position: 1 <= nmu < ntot-2 + int nnode = FindLargestPossibleNode(x, true); + // --- relative distance delta - in function fdm H(x) // deltascale (Interpol(.,.,.delta,.): relative distance of value to node 'nnode' double delta = GetDelta(x); - // --- get scale interpolation kernel and updated scalenode position: 1 <= nmu < ntot-2 - int nnode = FindLargestPossibleNode(x, true); // --- set nodes nodes.resize(2); nodes[0] = make_pair(nnode, 1.-delta); diff --git a/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOCreate.h b/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOCreate.h index 9856282afc1c88ccb44c165065f3802c9187c30f..c6dfe6908f19018ba64ccc489bab33d76ab6b63f 100644 --- a/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOCreate.h +++ b/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOCreate.h @@ -198,6 +198,7 @@ protected: void InitCoeffTable(); void InitInterpolationKernels(); fastNLOInterpolBase* MakeInterpolationKernels(std::string KernelName, double xdn, double xup, const std::string& distancemeasure); + fastNLOInterpolBase* MakeInterpolationKernels(std::string KernelName, double density, const std::string& distancemeasure); void InitGrids(); void GetWarmupValues(); bool CheckWarmupConsistency(); //!< Check consistency of warmup bin-grid and variables with steering values. @@ -269,7 +270,6 @@ protected: bool WarmupNeeded() const; void ExtendAllFlexSigmaTilde(fastNLOCoeffAddFlex* c, int ObsBin); - void ExtendFlexSigmaTilde(fastNLOCoeffAddFlex* c, int ObsBin, fastNLO::v5d &SigmaTilde); struct fnloStats { diff --git a/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOInterpolCatmullRom.h b/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOInterpolCatmullRom.h index 444224ddaf73bd8c0eac1fbf5c1ec7b6c40de4e2..0df406e253195691adadda613e7c3514f2157b1a 100644 --- a/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOInterpolCatmullRom.h +++ b/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOInterpolCatmullRom.h @@ -16,6 +16,7 @@ class fastNLOInterpolCatmullRom : public fastNLOInterpolBase { public: fastNLOInterpolCatmullRom(double min, double max, fastNLOGrid::GridType type); + fastNLOInterpolCatmullRom(double density, fastNLOGrid::GridType type); ~fastNLOInterpolCatmullRom(void); // vector<pair<int,double> > CalcNodeValues(double val); diff --git a/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOInterpolLinear.h b/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOInterpolLinear.h index 0bb2922cf825cf8f3444efdac3aae6231d8cd9d5..ceb174b1385fd30be25daf0fec5b4980a6d313e8 100644 --- a/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOInterpolLinear.h +++ b/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOInterpolLinear.h @@ -22,6 +22,7 @@ class fastNLOInterpolLinear : public fastNLOInterpolBase { public: fastNLOInterpolLinear(double min, double max, fastNLOGrid::GridType type); + fastNLOInterpolLinear(double density, fastNLOGrid::GridType type); ~fastNLOInterpolLinear(void); // vector<pair<int,double> > CalcNodeValues(double val);