From f210bac8ce287b0ee8990ebc3a94ae09507b0db8 Mon Sep 17 00:00:00 2001 From: Ernesto Mainegra-Hing Date: Thu, 21 May 2020 14:09:45 -0400 Subject: [PATCH] Expand environment variables in egs++ applications --- HEN_HOUSE/user_codes/cavity/cavity.cpp | 1 + HEN_HOUSE/user_codes/egs_cbct/egs_cbct.cpp | 12 ++++++---- .../user_codes/egs_cbct/example_w5br.egsinp | 24 +++++++++---------- HEN_HOUSE/user_codes/egs_fac/egs_fac.cpp | 8 +++++++ .../examples/example_mees_250kV.egsinp | 7 +++--- .../examples/mxr-320-250kVp_tube.egsinp | 9 ++++++- HEN_HOUSE/user_codes/egs_kerma/egs_kerma.cpp | 10 ++++++++ .../egs_kerma/example_40keV_SDD_1m_FD.egsinp | 3 ++- 8 files changed, 52 insertions(+), 22 deletions(-) diff --git a/HEN_HOUSE/user_codes/cavity/cavity.cpp b/HEN_HOUSE/user_codes/cavity/cavity.cpp index 00eaa63ef..708127f90 100644 --- a/HEN_HOUSE/user_codes/cavity/cavity.cpp +++ b/HEN_HOUSE/user_codes/cavity/cavity.cpp @@ -2822,6 +2822,7 @@ int Cavity_Application::initScoring() { if( err3 ) egsFatal( "\n\n*** Wrong/missing 'muen file' input for a " "HVL calculation\n This is a fatal error\n\n"); + muen_file = egsExpandPath(muen_file); ifstream muen_data(muen_file.c_str()); if( !muen_data ){ egsFatal( diff --git a/HEN_HOUSE/user_codes/egs_cbct/egs_cbct.cpp b/HEN_HOUSE/user_codes/egs_cbct/egs_cbct.cpp index 0e389e6e0..c2bdd2739 100644 --- a/HEN_HOUSE/user_codes/egs_cbct/egs_cbct.cpp +++ b/HEN_HOUSE/user_codes/egs_cbct/egs_cbct.cpp @@ -1145,6 +1145,7 @@ int EGS_CBCT::initScoring() { if( err3 ) egsFatal( "\n\n*** Wrong/missing 'muen file' input for a " "kerma calculation\n This is a fatal error\n\n"); + muen_file = egsExpandPath(muen_file); ifstream muen_data(muen_file.c_str()); if( !muen_data.is_open() ){ egsFatal( @@ -1152,8 +1153,11 @@ int EGS_CBCT::initScoring() { " This is a fatal error\n",muen_file.c_str()); } else{ - egsInformation("\nUsing E*muen file %s for air-kerma calculation\n", - muen_file.c_str()); + egsInformation( + "\n\n=============== Kerma Scoring ===============\n" + "E*muen/rho file: %s\n" + "=============================================\n", + muen_file.c_str()); } int ndat; muen_data >> ndat; if( ndat < 2 || muen_data.fail() ) egsFatal( @@ -1403,7 +1407,7 @@ void EGS_CBCT::initOutput() { scan_type = blank; } else{ - blank_scan = b_scan; + blank_scan = egsExpandPath(b_scan); } /* If no scan file name entry, a warning is issued. @@ -1417,7 +1421,7 @@ void EGS_CBCT::initOutput() { " This is not a proper CBCT calculation.\n\n"); } else{ - real_scan = the_scan; + real_scan = egsExpandPath(the_scan); } /* check what scans are requested by the user real => real scan simulation diff --git a/HEN_HOUSE/user_codes/egs_cbct/example_w5br.egsinp b/HEN_HOUSE/user_codes/egs_cbct/example_w5br.egsinp index a20cf30cb..f059fd9d1 100644 --- a/HEN_HOUSE/user_codes/egs_cbct/example_w5br.egsinp +++ b/HEN_HOUSE/user_codes/egs_cbct/example_w5br.egsinp @@ -31,8 +31,8 @@ # # Projections at other angles can be obtained by modifying input block # :cbct setup: below. One can define the projection angle and angular -# :interval. Negative values of the latter indicate rotation is done -# :counter-clockwise around the indicated axis. +# interval. Negative values of the latter indicate rotation is done +# counter-clockwise around the indicated axis. # # BEWARE: # @@ -43,8 +43,6 @@ # - media information in PEGS4 data file 521icru.pegs4dat distributed # with EGSnrc. # -# - Replace $EGS_HOME string below with the actual value!!! -# # - If the detector resolution is changed, one must recalculate the blank # scan # @@ -183,7 +181,7 @@ rotation = 0 1.570796326794896619 0 :stop transformation: # Uses file provided in the distribution - muen file = /home/mainegra/egsnrc_mp/egs_fac/muen_air.data + muen file = $HEN_HOUSE/user_codes/egs_fac/examples/muen_air.data :stop planar scoring: :stop scoring options: @@ -197,13 +195,13 @@ ############################################### # Use the 2 lines below to produce a blank scan ############################################### - #scan file = /home/mainegra/egsnrc_mp/egs_cbct/blank_coll_64.scan + #scan file = $EGS_HOME/egs_cbct/blank_coll_64.scan #scan type = blank ############################################### # Use the 3 lines below to produce real scans ############################################### - scan file = /home/mainegra/egsnrc_mp/egs_cbct/scan_w5br_coll_64.scan - blank scan = /home/mainegra/egsnrc_mp/egs_cbct/blank_coll_64.scan + scan file = $EGS_HOME/egs_cbct/scan_w5br_coll_64.scan + blank scan = $EGS_HOME/egs_cbct/blank_coll_64.scan scan type = scatter ############################################### :stop scan output: @@ -286,18 +284,20 @@ ######## -# For fast computation one can use KN for Compton scattering. However, -# in realistic phantoms this may cause a 3% discrepancy. +# For fast computation one can assume scattering from free electrons. +# However, in realistic phantoms this may cause a 3% discrepancy. ######## :start MC transport parameter: Global ECUT = 1 - Photon cross sections = xcom # epdl (or xcom) + Photon cross sections = xcom # epdl (or xcom) Bound Compton scattering = off + + Rayleigh scattering = off - Rayleigh scattering= on + Atomic relaxations = off :stop MC transport parameter: diff --git a/HEN_HOUSE/user_codes/egs_fac/egs_fac.cpp b/HEN_HOUSE/user_codes/egs_fac/egs_fac.cpp index ffa8964d6..c32403d68 100644 --- a/HEN_HOUSE/user_codes/egs_fac/egs_fac.cpp +++ b/HEN_HOUSE/user_codes/egs_fac/egs_fac.cpp @@ -955,9 +955,17 @@ int EGS_FACApplication::initScoring() { int err3 = options->getInput("muen file",muen_file); if( err3 ) egsFatal("\n\n*** Wrong/missing 'muen file' input\n" " This is a fatal error\n\n"); + muen_file = egsExpandPath(muen_file); ifstream muen_data(muen_file.c_str()); if( !muen_data ) egsFatal("\n\n*** Failed to open muen file %s\n" " This is a fatal error\n",muen_file.c_str()); + else{ + egsInformation( + "\n\n=============== Kerma Scoring ===============\n" + "E*muen/rho file: %s\n" + "=============================================\n\n", + muen_file.c_str()); + } int ndat; muen_data >> ndat; if( ndat < 2 || muen_data.fail() ) egsFatal( "\n\n*** Failed to read muen dfata file\n"); diff --git a/HEN_HOUSE/user_codes/egs_fac/examples/example_mees_250kV.egsinp b/HEN_HOUSE/user_codes/egs_fac/examples/example_mees_250kV.egsinp index b6d97308a..42c173bf8 100644 --- a/HEN_HOUSE/user_codes/egs_fac/examples/example_mees_250kV.egsinp +++ b/HEN_HOUSE/user_codes/egs_fac/examples/example_mees_250kV.egsinp @@ -29,8 +29,7 @@ # # An example input file for egs_fac. # -# NOTE: Substitute every instance of $HEN_HOUSE for its actual value in this -# file! It is essential to use 'Bound Compton Scattering = norej'. See the MC +# NOTE: It is essential to use 'Bound Compton Scattering = norej'. See the MC # transport parameter input section for more info. See comments accompanying # the various inputs for more details. # @@ -803,7 +802,7 @@ # ignores them (except for the first and last energy, which define the # energy interval). # - muen file = $HEN_HOUSE/user_codes/egs_fac/muen_air.data + muen file = $HEN_HOUSE/user_codes/egs_fac/examples/muen_air.data :stop scoring options: @@ -852,4 +851,4 @@ Bound Compton Scattering = norej Photon cross sections = xcom # (could also be epdl or si) -:stop MC transport parameter: \ No newline at end of file +:stop MC transport parameter: diff --git a/HEN_HOUSE/user_codes/egs_fac/examples/mxr-320-250kVp_tube.egsinp b/HEN_HOUSE/user_codes/egs_fac/examples/mxr-320-250kVp_tube.egsinp index c38b9af5c..f0e5c21e5 100644 --- a/HEN_HOUSE/user_codes/egs_fac/examples/mxr-320-250kVp_tube.egsinp +++ b/HEN_HOUSE/user_codes/egs_fac/examples/mxr-320-250kVp_tube.egsinp @@ -163,9 +163,16 @@ AIRICRU512 :Stop MC Transport Parameter: ######################### + # + # User-defined entries + # + ######################### :Start user inputs: - # phsp output directory = /home/mainegra/egsnrc_mp/phsp/ + # Enter here a custom location for phase-space file output + # For instance users might want to direct the output to a + # device with enough disk space! + # phsp output directory = enter_user_defined_location :Stop user inputs: ######################### diff --git a/HEN_HOUSE/user_codes/egs_kerma/egs_kerma.cpp b/HEN_HOUSE/user_codes/egs_kerma/egs_kerma.cpp index e0f293e97..ae8059e27 100644 --- a/HEN_HOUSE/user_codes/egs_kerma/egs_kerma.cpp +++ b/HEN_HOUSE/user_codes/egs_kerma/egs_kerma.cpp @@ -1012,12 +1012,22 @@ int EGS_KermaApplication::initScoring() { "\n\n*** Wrong/missing 'emuen file' input for a " "Kerma calculation\n This is a fatal error\n\n"); } + + muen_file = egsExpandPath(muen_file); + ifstream muen_data(muen_file.c_str()); if (!muen_data) { egsFatal( "\n\n*** Failed to open emuen file %s\n" " This is a fatal error\n",muen_file.c_str()); } + else{ + egsInformation( + "\n\n=============== Kerma Scoring ===============\n" + "E*muen/rho file: %s\n" + "=============================================\n\n", + muen_file.c_str()); + } int ndat; muen_data >> ndat; if (ndat < 2 || muen_data.fail()) egsFatal( diff --git a/HEN_HOUSE/user_codes/egs_kerma/example_40keV_SDD_1m_FD.egsinp b/HEN_HOUSE/user_codes/egs_kerma/example_40keV_SDD_1m_FD.egsinp index 1d98ec738..9976021df 100644 --- a/HEN_HOUSE/user_codes/egs_kerma/example_40keV_SDD_1m_FD.egsinp +++ b/HEN_HOUSE/user_codes/egs_kerma/example_40keV_SDD_1m_FD.egsinp @@ -211,7 +211,8 @@ :stop fluence scoring: ### E*muen file (could also be E*mutr): absolute or relative file path - emuen file = emuen_icru90_1.5MeV.data + ### Use absolute path when submitting parallel jobs!!! + emuen file = $EGS_HOME/egs_kerma/emuen_icru90_1.5MeV.data ### geometry for forced-detection (if omitted, an analog scoring is used) cavity geometry = cavity