# Run mu mcaros in virtual gate

**URL:** <https://root-forum.cern.ch/t/run-mu-mcaros-in-virtual-gate/36947>\
**Category:** Newbie\
**Created:** [November 25, 2019, 10:32pm UTC](https://root-forum.cern.ch/t/run-mu-mcaros-in-virtual-gate/36947 "2019-11-25T22:32:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![omrghad](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/omrghad/32/24991_2.png) [@omrghad](https://root-forum.cern.ch/u/omrghad)\
**Post date:** [November 25, 2019, 10:32pm UTC](https://root-forum.cern.ch/t/run-mu-mcaros-in-virtual-gate/36947/1 "2019-11-25T22:32:15Z")

</div>

please,when running my macro i have this error!:

[G4-cerr] \*\*\*\*\* Illegal application state \</gate/source/addSource xraygun\> \*\*\*\*\*  
[Gate] Sorry, error in a macro command : abort.  
can you help me please

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [November 26, 2019, 7:11am UTC](https://root-forum.cern.ch/t/run-mu-mcaros-in-virtual-gate/36947/2 "2019-11-26T07:11:19Z")

</div>

[Geant4 User Forum](https://geant4-forum.web.cern.ch/)

---

<div class="post-metadata">

**Author:** ![gaborlegradi](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/g/3ab097/32.png) [@gaborlegradi](https://root-forum.cern.ch/u/gaborlegradi)\
**Post date:** [September 23, 2020, 2:44pm UTC](https://root-forum.cern.ch/t/run-mu-mcaros-in-virtual-gate/36947/3 "2020-09-23T14:44:04Z")

</div>

Hi!

Move initialization from behind the source definition to above it:

benchmarkFastCT.mac original:  
[…]  
##############

# SOURCE GPS

##############  
/control/execute source.mac

[…]

##################

# INITIALIZATION

##################  
/gate/run/initialize  
[…]

benchmarkFastCT.mac corrected:  
[…]  
##################

# INITIALIZATION

##################  
/gate/run/initialize

##############

# SOURCE GPS

##############  
/control/execute source.mac  
[…]
