Code for calculating HIST done, but untested!!

I wrote code for calculting the modelquality of the HIST but didn't test
it yet.