layerWeightingMat function

Weighting scheme for preferential layer matching