Apparatus, systems, and methods are provided for optimizing radiation therapy to a patient to treat cardiac arrhythmias. The system generally includes an ultrasound device placed within the esophagus to image and map cardiac structures in real-time. The system may also control the ventilation of the patient to optimize ultrasound monitoring and radiation delivery.The device in the esophagus is designed to position and monitor the esophagus and/or nearby structures to optimize radiation delivery to targets while minimizing radiation to other key structures. In addition, different ablation technologies may be delivered from within the esophagus to ablate certain tissues that cannot be safely ablated with radiation therapy. Finally, the esophageal device may have electrical or magnetic properties that can be used to guide the radiation therapy.