macros for simulation and reconstruction