Skip to content
Snippets Groups Projects
Commit b33300f8 authored by JohannesGaessler's avatar JohannesGaessler
Browse files

Fixed table merge segfault depending on file order

parent c1b9907b
Branches fix-merge
No related tags found
No related merge requests found
......@@ -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())));
......
......@@ -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))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment