diff --git a/v2.5/toolkit/fastnlotoolkit/fastNLOCoeffAddFlex.cc b/v2.5/toolkit/fastnlotoolkit/fastNLOCoeffAddFlex.cc index fea21182b224a8c7cff75747b4114f9b3e665326..aba00db22fb8f72f29a8debce677444427108076 100644 --- a/v2.5/toolkit/fastnlotoolkit/fastNLOCoeffAddFlex.cc +++ b/v2.5/toolkit/fastnlotoolkit/fastNLOCoeffAddFlex.cc @@ -217,7 +217,7 @@ void fastNLOCoeffAddFlex::Add(const fastNLOCoeffAddBase& other, fastNLO::EMerge if ( !ok ) { error["Add"]<<"Incompatible table."<<endl; } - const fastNLOCoeffAddFlex& othflex = (const fastNLOCoeffAddFlex&) other; + fastNLOCoeffAddFlex& othflex = (fastNLOCoeffAddFlex&) other; if ( moption==fastNLO::kMerge ) { ExtendSigmaTilde(othflex, SigmaTildeMuIndep, othflex.SigmaTildeMuIndep); fastNLOTools::AddVectors(SigmaTildeMuIndep, othflex.SigmaTildeMuIndep); @@ -251,7 +251,7 @@ void fastNLOCoeffAddFlex::Add(const fastNLOCoeffAddBase& other, fastNLO::EMerge } else if ( moption==fastNLO::kAttach ) { vector<fastNLO::v5d*> st1 = this->AccessSigmaTildes(); - vector<const fastNLO::v5d*> st2 = othflex.GetSigmaTildes(); + vector<fastNLO::v5d*> st2 = othflex.AccessSigmaTildes(); int cMax = st1.size(); for ( int ii = cMax-1 ; ii>= 0 ; ii-- ) { if ( st1[ii]->size()==0 ) cMax--; @@ -287,7 +287,7 @@ void fastNLOCoeffAddFlex::Add(const fastNLOCoeffAddBase& other, fastNLO::EMerge } else { vector<fastNLO::v5d*> st1 = this->AccessSigmaTildes(); - vector<const fastNLO::v5d*> st2 = othflex.GetSigmaTildes(); + vector<fastNLO::v5d*> st2 = othflex.AccessSigmaTildes(); int cMax = st1.size(); for ( int ii = cMax-1 ; ii>= 0 ; ii-- ) { if ( st1[ii]->size()==0 && st2[ii]->size()==0) cMax--; @@ -305,6 +305,26 @@ void fastNLOCoeffAddFlex::Add(const fastNLOCoeffAddBase& other, fastNLO::EMerge } info["add"]<<"Copied coefficients from other table."<<endl; */ + + // May need to extend other sigma tilde prior to copying dimensions. + // Cannot call ExtendSigmaTilde because st1[ii]->size() == 0 . + for(int obsBin=0 ; obsBin<fNObsBins ; obsBin++){ + fastNLO::v3d insertValue = fastNLO::v3d( + GetNScaleNode1(obsBin), fastNLO::v2d(GetNScaleNode2(obsBin), fastNLO::v1d(GetNSubproc()))); + int thisNxtot1 = GetNxtot1(obsBin); + int thisNxtot2 = GetNxtot2(obsBin); + int otherNxtot1 = othflex.GetNxtot1(obsBin); + int otherNxtot2 = othflex.GetNxtot2(obsBin); + if (thisNxtot1 > otherNxtot1) { + fastNLOTools::ExtendSigmaTildeX((*st2[ii])[obsBin], otherNxtot1, thisNxtot1, + otherNxtot2, otherNxtot2, NPDFDim, insertValue); + } + int maxNxtot1 = max(thisNxtot1, otherNxtot1); + if (thisNxtot2 > otherNxtot2) { + fastNLOTools::ExtendSigmaTildeX((*st2[ii])[obsBin], maxNxtot1, maxNxtot1, + otherNxtot2, thisNxtot2, NPDFDim, insertValue); + } + } fastNLOTools::ResizeFlexibleVector(*st1[ii],*st2[ii]); } else if ( st2[ii]->size() == 0 ) { @@ -368,7 +388,7 @@ void fastNLOCoeffAddFlex::Add(const fastNLOCoeffAddBase& other, fastNLO::EMerge //________________________________________________________________________________________________________________ // void fastNLOCoeffAddFlex::ExtendSigmaTilde( - const fastNLOCoeffAddFlex& othflex, fastNLO::v5d& ThisSigmaTilde, fastNLO::v5d OtherSigmaTilde) { + const fastNLOCoeffAddFlex& othflex, fastNLO::v5d& ThisSigmaTilde, fastNLO::v5d& OtherSigmaTilde) { for(int obsBin=0 ; obsBin<fNObsBins ; obsBin++){ fastNLO::v3d insertValue = fastNLO::v3d( GetNScaleNode1(obsBin), fastNLO::v2d(GetNScaleNode2(obsBin), fastNLO::v1d(GetNSubproc()))); diff --git a/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOCoeffAddFlex.h b/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOCoeffAddFlex.h index be8e61da97048dee7e68c3e49962b88df5c8aaf0..84761a5f96011ae0da00ed16794692348152430e 100644 --- a/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOCoeffAddFlex.h +++ b/v2.5/toolkit/fastnlotoolkit/include/fastnlotk/fastNLOCoeffAddFlex.h @@ -58,7 +58,7 @@ public: protected: void ReadCoeffAddFlex(std::istream& table, int ITabVersionRead); - void ExtendSigmaTilde(const fastNLOCoeffAddFlex& othflex, fastNLO::v5d& ThisSigmaTilde, fastNLO::v5d OtherSigmaTilde); + void ExtendSigmaTilde(const fastNLOCoeffAddFlex& othflex, fastNLO::v5d& ThisSigmaTilde, fastNLO::v5d& OtherSigmaTilde); int fILOord; // obtained from Scenario int fSTildeDISFormat = 1; // format of sigma-tilde coefficients (0: log(mu2/q2), 1: log(mu2))