implementation of TPC logic in TPCMaster