Objective. A retrospective study on secondary cancer risk on carbon ion radiotherapy (CIRT) is ongoing at the Heavy Ion Medical Accelerator in Chiba (HIMAC). The reconstruction of the whole-body patient dose distribution is the key issue in the study because dose distribution only around the planning target volume was evaluated in the treatment planning system. Approach. We therefore developed a new dose reconstruction system based on the Particle and Heavy Ion Transport code System (PHITS) coupled with the treatment plan DICOM data set by extending the functionalities of RadioTherapy package based on PHITS (RT-PHITS). In the system, the geometry of patient-specific beam devices such as the range shifter, range compensator, and collimators as well as the individual patient’s body are automatically reconstructed. Various functions useful for retrospective analysis on the CIRT are implemented in the system, such as those for separately deducing dose contributions from different secondary particles and their origins. Main results. The accuracy of the developed system was validated by comparing the dose distribution to the experimental data measured in a water tank and using a treatment plan on an anthropomorphic phantom. Significance. The extended RT-PHITS will be used in epidemiological studies based on clinical data from HIMAC.