diff --git a/v2.5/toolkit/fastnlotoolkit/fastNLOCoeffAddBase.cc b/v2.5/toolkit/fastnlotoolkit/fastNLOCoeffAddBase.cc index 19aac25463065297717b8da7db3a612d930f72bb..57f3e334061a454e5e2857122c665d5555b7c681 100644 --- a/v2.5/toolkit/fastnlotoolkit/fastNLOCoeffAddBase.cc +++ b/v2.5/toolkit/fastnlotoolkit/fastNLOCoeffAddBase.cc @@ -374,6 +374,14 @@ void fastNLOCoeffAddBase::Add(const fastNLOCoeffAddBase& other, fastNLO::EMerge } } + for (int i = 0; i < fNObsBins; i++) { + fastNLO::v1d thisXNodes1i = GetXNodes1(i); + fastNLO::v1d otherXNodes1i = other.GetXNodes1(i); + for (int j = otherXNodes1i.size() - thisXNodes1i.size(); j > 0; j--) { + thisXNodes1i.insert(thisXNodes1i.begin(), otherXNodes1i[j - 1]); + } + XNode1[i] = thisXNodes1i; + } if ( moption==fastNLO::kAttach ) { //Nevt = Nevt;// stays! @@ -476,24 +484,33 @@ bool fastNLOCoeffAddBase::IsCompatible(const fastNLOCoeffAddBase& other) const { warn["IsCompatible"]<<"Different number of bins detected."<<endl; return false; } + // check x-nodes briefly for ( int i = 0 ; i< fNObsBins ;i++ ){ - if ( GetNxmax(i) != other.GetNxmax(i) ){ - error["IsCompatible"]<<"Different number of x-nodes detected: "<<GetNxmax(i)<<" <-> "<<other.GetNxmax(i)<<endl; - return false; - } - if ( GetNxtot1(i) != other.GetNxtot1(i) ){ - error["IsCompatible"]<<"Different number of x-nodes detected: "<<GetNxtot1(i)<<" <-> "<<other.GetNxtot1(i)<<endl; - return false; - } - if ( GetXNode1(i,0) != other.GetXNode1(i,0) ){ - warn["IsCompatible"]<<"Different values for x-nodes detected. Lowest x-node: "<<GetXNode1(i,0)<<" <-> "<<other.GetXNode1(i,0)<<endl; - return false; - } - // if ( GetXNode1(i,1) != other.GetXNode1(i,1) ){ - // warn["IsCompatible"]<<"Different values for x-nodes detected."<<endl; - // return false; - // } + int thisNxtot = GetNxtot1(i); + int otherNxtot = other.GetNxtot1(i); + int thisOffset; + int otherOffset; + int minNxtot; + if (thisNxtot > otherNxtot) { + thisOffset = thisNxtot - otherNxtot; + otherOffset = 0; + minNxtot = otherNxtot; + } else { + thisOffset = 0; + otherOffset = otherNxtot - thisNxtot; + minNxtot = thisNxtot; + } + fastNLO::v1d otherXNodes = other.GetXNodes1(i); + + for (int j = 0; j < minNxtot; j++) { + if (XNode1[i][j + thisOffset] != otherXNodes[j + otherOffset]) { + warn["IsCompatible"] << "Different values for ObsBin=" << i << " and XNode=" << j + << " detected:" << GetXNode1(i, j + thisOffset) << " <-> " + << other.GetXNode1(i, j + otherOffset) << endl; + return false; + } + } } // succesful! return true; diff --git a/v2.5/toolkit/fastnlotoolkit/fastNLOCoeffAddFix.cc b/v2.5/toolkit/fastnlotoolkit/fastNLOCoeffAddFix.cc index b9fcbc45c1d403cfee29f868236a9fe9525b69ec..fb589be55556396d86a6f6a20639482359d5cfae 100644 --- a/v2.5/toolkit/fastnlotoolkit/fastNLOCoeffAddFix.cc +++ b/v2.5/toolkit/fastnlotoolkit/fastNLOCoeffAddFix.cc @@ -194,8 +194,26 @@ void fastNLOCoeffAddFix::Add(const fastNLOCoeffAddBase& other, fastNLO::EMerge m return; } const fastNLOCoeffAddFix& othfix = (const fastNLOCoeffAddFix&)other; - if ( moption==fastNLO::kMerge ) fastNLOTools::AddVectors( SigmaTilde , othfix.SigmaTilde); - else if ( moption==fastNLO::kAttach ) { + if ( moption==fastNLO::kMerge ) { + fastNLO::v5d otherSigmaTilde = othfix.SigmaTilde; + for( int i=0 ; i<fNObsBins ; i++ ){ + for( int k=0 ; k<GetTotalScalevars() ; k++ ){ + for( int l=0 ; l<GetTotalScalenodes() ; l++ ){ + fastNLO::v2d thisX = SigmaTilde[i][k][l]; + fastNLO::v2d otherX = otherSigmaTilde[i][k][l]; + while (thisX.size() < otherX.size()) { + thisX.insert(thisX.begin(), fastNLO::v1d(GetNSubproc())); + } + while (otherX.size() < thisX.size()) { + otherX.insert(otherX.begin(), fastNLO::v1d(GetNSubproc())); + } + SigmaTilde[i][k][l] = thisX; + otherSigmaTilde[i][k][l] = otherX; + } + } + } + fastNLOTools::AddVectors(SigmaTilde, otherSigmaTilde); + } else if ( moption==fastNLO::kAttach ) { for( int i=0 ; i<fNObsBins ; i++ ){ int nxmax = GetNxmax(i); for( int k=0 ; k<GetTotalScalevars() ; k++ ){ diff --git a/v2.5/toolkit/fastnlotoolkit/fastNLOCreate.cc b/v2.5/toolkit/fastnlotoolkit/fastNLOCreate.cc index a1dbe806f1ecd70c2afe3b42ec049fcfd89c3e5e..a68e7574c387cdd3e19b00a86c163baeb85879d0 100644 --- a/v2.5/toolkit/fastnlotoolkit/fastNLOCreate.cc +++ b/v2.5/toolkit/fastnlotoolkit/fastNLOCreate.cc @@ -692,9 +692,11 @@ void fastNLOCreate::SetScenConstsDefaults() { fScenConsts.Mu1_Kernel = "Lagrange"; fScenConsts.Mu1_DistanceMeasure = "loglog025"; fScenConsts.Mu1_NNodes = 6; + fScenConsts.Mu1_NNodeCounting = "NodesPerWarmupRange"; fScenConsts.Mu2_Kernel = "Lagrange"; fScenConsts.Mu2_DistanceMeasure = "loglog025"; fScenConsts.Mu2_NNodes = 6; + fScenConsts.Mu2_NNodeCounting = "NodesPerWarmupRange"; } @@ -752,9 +754,11 @@ void fastNLOCreate::SetScenConstsFromSteering() { if (EXIST_NS(Mu1_Kernel,fSteerfile)) fScenConsts.Mu1_Kernel = STRING_NS(Mu1_Kernel,fSteerfile); if (EXIST_NS(Mu1_DistanceMeasure,fSteerfile)) fScenConsts.Mu1_DistanceMeasure = STRING_NS(Mu1_DistanceMeasure,fSteerfile); if (EXIST_NS(Mu1_NNodes,fSteerfile)) fScenConsts.Mu1_NNodes = INT_NS(Mu1_NNodes,fSteerfile); + if (EXIST_NS(Mu1_NNodeCounting,fSteerfile)) fScenConsts.Mu1_NNodeCounting = STRING_NS(Mu1_NNodeCounting,fSteerfile); if (EXIST_NS(Mu2_Kernel,fSteerfile)) fScenConsts.Mu2_Kernel = STRING_NS(Mu2_Kernel,fSteerfile); if (EXIST_NS(Mu2_DistanceMeasure,fSteerfile)) fScenConsts.Mu2_DistanceMeasure = STRING_NS(Mu2_DistanceMeasure,fSteerfile); if (EXIST_NS(Mu2_NNodes,fSteerfile)) fScenConsts.Mu2_NNodes = INT_NS(Mu2_NNodes,fSteerfile); + if (EXIST_NS(Mu2_NNodeCounting,fSteerfile)) fScenConsts.Mu2_NNodeCounting = STRING_NS(Mu2_NNodeCounting,fSteerfile); if (EXIST_NS(GeneratorName,fSteerfile)) fGenConsts.Name = STRING_NS(GeneratorName,fSteerfile); if (EXIST_NS(GeneratorReferences,fSteerfile)) fGenConsts.References = STRING_ARR_NS(GeneratorReferences,fSteerfile); @@ -819,9 +823,11 @@ void fastNLOCreate::PrintScenConsts() { logger.info["PrintScenConsts"] << "Interpolation kernel in mu1 space: " << fScenConsts.Mu1_Kernel << endl; logger.info["PrintScenConsts"] << "Distance measure in mu1 space: " << fScenConsts.Mu1_DistanceMeasure << endl; logger.info["PrintScenConsts"] << "No. of interpolation nodes in mu1 space: " << fScenConsts.Mu1_NNodes << endl; + logger.info["PrintScenConsts"] << "Distribution of node numbers in mu1 space: " << fScenConsts.Mu1_NNodeCounting << endl; logger.info["PrintScenConsts"] << "Interpolation kernel in mu2 space: " << fScenConsts.Mu2_Kernel << endl; logger.info["PrintScenConsts"] << "Distance measure in mu2 space: " << fScenConsts.Mu2_DistanceMeasure << endl; logger.info["PrintScenConsts"] << "No. of interpolation nodes in mu2 space: " << fScenConsts.Mu2_NNodes << endl; + logger.info["PrintScenConsts"] << "Distribution of node numbers in mu2 space: " << fScenConsts.Mu2_NNodeCounting << endl; logger.info["PrintScenConsts"] << "==================================================================" << endl; } @@ -969,6 +975,8 @@ void fastNLOCreate::Instantiate() { //! and prepare for filling logger.debug["Instantiate"]<<"Instantiate all internal members and prepare for filling " << endl; logger.debug["Instantiate"]<<"X_NNodeCounting is set to: "<<fScenConsts.X_NNodeCounting<<endl; + logger.debug["Instantiate"]<<"Mu1_NNodeCounting is set to: "<<fScenConsts.Mu1_NNodeCounting<<endl; + logger.debug["Instantiate"]<<"Mu2_NNodeCounting is set to: "<<fScenConsts.Mu2_NNodeCounting<<endl; // init member variables fReader = NULL; @@ -1932,7 +1940,7 @@ void fastNLOCreate::GetWarmupValues() { //! logger.debug["GetWarmupValues"]<<endl; - if (fScenConsts.X_NNodeCounting == "NodeDensity") { + if (!WarmupNeeded()) { logger.info["GetWarmupValues"]<<"Warmup not needed to determine bin edges."<<endl; fIsWarmup=false; } else if (!fWarmupConsts.Values.empty()) { @@ -2058,7 +2066,7 @@ bool fastNLOCreate::CheckWarmupConsistency() { vector<vector<double> > warmup = fWarmupConsts.Values;//DOUBLE_TAB_NS(Warmup.Values,fSteerfile); bool ret = true; - if (fScenConsts.X_NNodeCounting == "NodeDensity") { + if (!WarmupNeeded()) { return ret; } @@ -4438,7 +4446,6 @@ void fastNLOCreate::InitInterpolationKernels() { if (fScenConsts.X_NNodeCounting == "NodeDensity") { wrmMu1Dn = GetObsBinsLoBounds(1); wrmMu1Up = GetObsBinsUpBounds(1); - std::cout << wrmMu1Dn.size() << " " << wrmMu1Up.size() << endl; } 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); @@ -4682,7 +4689,9 @@ fastNLOReader* fastNLOCreate::SetIsReferenceTable(fastNLOReader* fnloread) { //fScenConsts.X_NoOfNodesPerMagnitude = false; fScenConsts.X_NNodeCounting = "NodesPerBin"; fScenConsts.Mu1_NNodes = 1; + fScenConsts.Mu1_NNodeCounting = "NodesPerWarmupRange"; fScenConsts.Mu2_NNodes = 1; + fScenConsts.Mu2_NNodeCounting = "NodesPerWarmupRange"; fScenConsts.X_Kernel = "OneNode"; fScenConsts.Mu1_Kernel = "OneNode"; fScenConsts.Mu2_Kernel = "OneNode"; @@ -4902,3 +4911,14 @@ bool fastNLOCreate::GetParameterFromSteering(const string& key, vector<vector<do val = read_steer::getdoubletable(key,fSteerfile); return exist; } + +// ___________________________________________________________________________________________________ +bool fastNLOCreate::WarmupNeeded() const { + if (fScenConsts.X_NNodeCounting != "NodeDensity") { + return true; + } + if (fScenConsts.Mu1_NNodeCounting == "NodesPerWarmupRange") { + return true; + } + return false; +} diff --git a/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOCreate.h b/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOCreate.h index 8744661e053720df84b770eb1ade2fff9935b6b4..e42ec93937861cad381e6de16b4b0151f83e6545 100644 --- a/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOCreate.h +++ b/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOCreate.h @@ -267,6 +267,8 @@ protected: void FillWeightCache(int scalevar); //!< Fill weight into cache, merge weights for identical phase space points void FlushCache(); //!< Fill weights from cache into table + bool WarmupNeeded() const; + struct fnloStats { //! structre to keep track of statisics. Just for fun and information. diff --git a/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOTableConstants.h b/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOTableConstants.h index 89e225a95412028797ac42828d72b270048eb908..be5ed6f8db3c0d9dc2486f62403f139b4b168e2b 100644 --- a/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOTableConstants.h +++ b/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOTableConstants.h @@ -139,10 +139,12 @@ namespace fastNLO { std::string Mu1_Kernel{"Lagrange"}; //!< "Lagrange" std::string Mu1_DistanceMeasure{"loglog025"}; //!< "loglog025" int Mu1_NNodes{6}; //!< 6 + std::string Mu1_NNodeCounting{"NodesPerWarmupRange"}; std::string Mu2_Kernel{"Lagrange"}; //!< "Lagrange"; Scale2 not used for fixed-scale tables std::string Mu2_DistanceMeasure{"loglog025"}; //!< "loglog025" int Mu2_NNodes{6}; //!< 6 + std::string Mu2_NNodeCounting{"NodesPerWarmupRange"}; // KR: Defaults can be set using SetScenConstsDefaults(). // If the struct is directly created within another project,