diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e67d98..3ef9072 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ - Modified `subprocess.check_output()` in `examples/scripts/annz_qsub.py , fitsFuncs.py` for `Python 3.x`. +- Fixed bug which caused a segmentation fault in some cases during reweighting. + - Other minor modifications and bug fixes. ## ANNZ v2.2.0 (24/5/2016) diff --git a/src/CatFormat_wgtKNN.cpp b/src/CatFormat_wgtKNN.cpp index f2141a7..22e2a5d 100644 --- a/src/CatFormat_wgtKNN.cpp +++ b/src/CatFormat_wgtKNN.cpp @@ -574,6 +574,7 @@ void CatFormat::addWgtKNNtoTree(TChain * aChainInp, TChain * aChainRef, TChain * ,(knnErrMethod[nChainNow][nFracNow]->fScaleFrac < EPS)); nKnnFracsIn++; } + // final check on nKnnFracs - at least two knnErrModule need to be accepted VERIFY(LOCATION,(TString)"Could not find enough objects for the KNN search." +" Try to decrease the value of "+"minNobjInVol"+typePostfix+" ...",(nKnnFracsIn > 1)); @@ -659,7 +660,6 @@ void CatFormat::addWgtKNNtoTree(TChain * aChainInp, TChain * aChainRef, TChain * // find the same number of near neighbours for each chain, and derive the distance this requires int nObjKNN(minNobjInVol); for(int nChainNow=0; nChainNow<2; nChainNow++) { - knnErrModule[nChainNow][0]->Find(evtNow,nObjKNN); const TMVA::kNN::List & knnList = knnErrModule[nChainNow][0]->GetkNNList(); @@ -714,6 +714,7 @@ void CatFormat::addWgtKNNtoTree(TChain * aChainInp, TChain * aChainRef, TChain * } } } + if(foundDist) { var_0->IncCntr("Found good weight"); weightSum += weightKNN; } else { var_0->IncCntr("Did not find good weight"); } } @@ -744,6 +745,8 @@ void CatFormat::addWgtKNNtoTree(TChain * aChainInp, TChain * aChainRef, TChain * bool foundDist(false); double dist_Ref0_RefNear(0); for(int nFracNow=0; nFracNow