hist calculation