Ultrashort electron bunch trains can be used for plasma wake field acceleration (PWFA) to overcome the limit of transformer ratio of a single electron bunch, or high-power terahertz (Thz) radiation production by various radiation mechanisms. Basic facility for high-power THz radiation development based on ultrashort electron beam has been set up at accelerator lab of TUB. Using birefringent crystal serials, ultraviolet (UV) pulse shaping for photocathode radio frequency gun to produce THz-repetition-rate pulse train was realized. Driven by such pulses, ultrashort electron bunch train with picosecond (ps) spacing was obtained for THz production. Measurement of the stacked UV pulse trains was done by difference frequency generation (DFG), and the measured group velocity mismatch of α-BBO crystal at 266.7-nm wavelength was 0.8 ps/mm. This method may also be applied to form ramped electron bunch trains for PWFA.