add threshold.cpp