From 4a5dd91fcf3f933dfce1cf2eedbb603cf0ce95f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cgyangchung=E2=80=9D?= <“gyangchung13@gmail.com”> Date: Tue, 25 Nov 2025 10:20:30 -0500 Subject: [PATCH 1/9] tcs bh configuration file sample --- Generators/gen_tcs_bh/tcs_bh.cfg | 118 +++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 Generators/gen_tcs_bh/tcs_bh.cfg diff --git a/Generators/gen_tcs_bh/tcs_bh.cfg b/Generators/gen_tcs_bh/tcs_bh.cfg new file mode 100644 index 0000000..78ff855 --- /dev/null +++ b/Generators/gen_tcs_bh/tcs_bh.cfg @@ -0,0 +1,118 @@ +# reaction (1 -> TCS; 11-> TCS phase space) +# 1) tcs = TCS exclusive production of lepton pair from gamma or e beam"< recommended to let it at 0 +# Default = 0 for real photon. If set at 0, the beam is along axis without any dispersion. +# If set at 0 for quasi-real beam, no cut is applied. Average angles without cut: 5e-5 rad for bremsstrahlung, 1e-2 rad for quasi-real. +thetaphotoMax: 0.0 + +# --- Event generation ---------------------------------------------------- +# number of events to generate +nTotEvents: 10 +# run number +runNum: 9001 +# Outgoing particle to study: 1=electron, 2=muon +# Warning: mass correction is included only for kinematic variables, not in cross sections +outLepton: 1 + +# --- Target configuration ------------------------------------------------ +# target length (cm); Target lenght in cm and target atoms {A,N} or choose an element instead of A (for LH2 target, set (1,1) or (1001,1)) -> relevant only if use of quasi-real photon beam +# target type and code = LH2: 1001; He: 1002; LiH: 1003; Carbon: 1006; NH3: 1007; dry air: 1011; Al: 1013; Fe: 1016; Pb: 1082; lead-glas: 1083. +# or with atoms, use numbers H (1), He (2), Be (4), N-H3 (7) , Au (79). +targetLength: 10.0 +A_target: 1001 +Z_target: 1 + +# TCS on Proton (1) or TCS on Neutron (2) +protonOrNeutron: 1 + +# --- Polarization -------------------------------------------------------- +# Beam polarization: degree of linear e- or circular gamma polarization in lab frame (<1) +# If electron beam, will calculate P_circ as a function of the photon energy +# If circularly polarized photon beam from bremstrahlung: calculated as a function of energy +# If linearly polarized photon: set average polarization (energy dependence of P is not included) + +polBeamDeg: 1.0 + +# Real photon polarization type: set 0 if no polarizer used (circular polarization rate is calculated as a fonction of energy transfered to the photon, or it is fixed to beam polarization in case of fix photon energy) +# set 0 if a linearly polarized electron beam is used or a circularly polarized photon beam (default option) +# if a linear polarizer is used for photons: 1 = along x-axis, 2=along y-axis, 3=45^0 +beamPolarType: 1 +# Target nucleon polarization, incoherent scattering on proton +# 0=unpolarized, +1 or +2 = transverse (perp to beam: 1 = x-axis, 2 = y-axis), +3 = longitudinal (same orientation as beam) +targetPolDir: 0 + +#degree of target polarization in lab frame(between -1 and +1) +polTargetDeg: 0.0 + +# --- Kinematic limits ---------------------------------------------------- +# minimal -t and maximal -t; limits in -t (maximal range: 0.04 < -t < 2.02 GeV2) +mt_Min: 0.04 +mt_Max: 1.2 + +# minimal Q'² and maximal Q'²: limits in Q'2 (maximal range: 3.8 < Q'2 < 9.2 GeV2) +Qp2Min: 3.8 +Qp2Max: 9.2 + +# outgoing lepton CM theta_min (deg) and outgoing lepton CM theta_max (deg); outgoing lepton angle in CM frame (maximal range= 30 < th < 150 degree) +thetaCMMin: 30.0 +thetaCMMax: 150.0 + +# maximal allowed Q² in case of electron beam, maximal Q2 allowed (max=0.3 GeV2) +Q2Max: 0.3 + +# --- Radiative corrections ----------------------------------------------- +# LO (0) or include radiative corrections: +# (1) only external radiation of beam (2) + internal real corrections (3) + virtual corrections +radCorrType: 0 + +# if radiative corrections apply, set energy cut-off (max) . applied on electron beam and leptons out +# Warning: Ecut has to be less than Eelectron - 1.5 GeV +eCut: 0.0 + +# --- Output options ------------------------------------------------------ +# HDDM is default:-1 Print in HDDM format only +# Print in ROOT only: 0, ROOT+HEP: 1, HEP only: 2, input for SIMC only: 3, SIMC+ROOT:4 +# simc text only, angular and momentum cuts (below): 5 +# simc+root, angular and momentum cuts (below): 6 +outFormat: 0 + +# --- SIMC-specific parameters -------------------------------------------- +# If for SIMC, theta HMS vs beam axis (deg) only with option SIMC (opt 5 or 6) +-25% +# default=0 if not used +thetaHMS: 0.0 + +# If for SIMC, theta SHMS vs beam axis (deg) only with option SIMC (opt 5 or 6) +(25%) +# default=0 if not used +thetaSHMS: 0.0 + +# If for SIMC, momentum HMS (opt 5 or 6) +-25% +# default=0 if not used +pHMS: 0.0 + +# If for SIMC, momentum SHMS (opt 5 or 6) +-25% +# default=0 if not used +pSHMS: 0.0 + +# --- File configuration -------------------------------------------------- +# output filename +outFile: tcs_bh_output0.hddm +# index run for output filename +indexrun: 0 From 62b1eb6b62df4554bb58085de60619670ac2909b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cgyangchung=E2=80=9D?= <“gyangchung13@gmail.com”> Date: Wed, 26 Nov 2025 14:02:05 -0500 Subject: [PATCH 2/9] path to cross-section table added as in the configuration file --- Generators/gen_tcs_bh/tcs_bh.cfg | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Generators/gen_tcs_bh/tcs_bh.cfg b/Generators/gen_tcs_bh/tcs_bh.cfg index 78ff855..50bd2ca 100644 --- a/Generators/gen_tcs_bh/tcs_bh.cfg +++ b/Generators/gen_tcs_bh/tcs_bh.cfg @@ -1,3 +1,4 @@ +# --- Reaction ------------------------------------------------- # reaction (1 -> TCS; 11-> TCS phase space) # 1) tcs = TCS exclusive production of lepton pair from gamma or e beam"< Date: Tue, 2 Dec 2025 14:41:15 -0500 Subject: [PATCH 3/9] Path to xsection tables added --- Generators/gen_tcs_bh/tcs_bh.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Generators/gen_tcs_bh/tcs_bh.cfg b/Generators/gen_tcs_bh/tcs_bh.cfg index 50bd2ca..0ae5609 100644 --- a/Generators/gen_tcs_bh/tcs_bh.cfg +++ b/Generators/gen_tcs_bh/tcs_bh.cfg @@ -114,7 +114,7 @@ pSHMS: 0.0 # --- File configuration -------------------------------------------------- # Path to directory where input cross-sections tables are store e.g xsecpath: /w/halld-scshelf2101/home/u/leptons/20251104/Data -xsecpath: Data +xsecpath: /w/halld-scshelf2101/home/gchung/tcs_sim2/halld_sim/src/programs/Simulation/gen_tcs_bh/Data # output filename (for .hddm) outFile: tcs_bh_output.hddm # index run for output filename From 5cddd99a38d094189c3a6e392042963aab22d204 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cgyangchung=E2=80=9D?= <“gyangchung13@gmail.com”> Date: Tue, 2 Dec 2025 14:44:18 -0500 Subject: [PATCH 4/9] gen_tcs_bh added --- MakeMC.csh | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++-- MakeMC.sh | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 164 insertions(+), 4 deletions(-) diff --git a/MakeMC.csh b/MakeMC.csh index 8864869..1c4670d 100755 --- a/MakeMC.csh +++ b/MakeMC.csh @@ -791,9 +791,9 @@ if ( "$GENR" != "0" ) then #run generation set gen_pre=`echo $GENERATOR | cut -c1-4` - if ( "$gen_pre" != "file" && "$GENERATOR" != "genr8" && "$GENERATOR" != "bggen" && "$GENERATOR" != "genEtaRegge" && "$GENERATOR" != "genScalarRegge" && "$GENERATOR" != "gen_2pi_amp" && "$GENERATOR" != "gen_pi0" && "$GENERATOR" != "gen_2pi_primakoff" && "$GENERATOR" != "gen_2pi0_primakoff" && "$GENERATOR" != "gen_omega_3pi" && "$GENERATOR" != "gen_omegapi" && "$GENERATOR" != "gen_2k" && "$GENERATOR" != "bggen_jpsi" && "$GENERATOR" != "gen_ee" && "$GENERATOR" != "gen_ee_hb" && "$GENERATOR" != "particle_gun" && "$GENERATOR" != "geantBEAM" && "$GENERATOR" != "bggen_phi_ee" && "$GENERATOR" != "genBH" && "$GENERATOR" != "gen_omega_radiative" && "$GENERATOR" != "gen_amp" && "$GENERATOR" != "gen_amp_V2" && "$GENERATOR" != "genr8_new" && "$GENERATOR" != "gen_compton" && "$GENERATOR" != "gen_npi" && "$GENERATOR" != "gen_compton_simple" && "$GENERATOR" != "gen_primex_eta_he4" && "$GENERATOR" != "gen_generic_root" && "$GENERATOR" != "gen_whizard" && "$GENERATOR" != "mc_gen" && "$GENERATOR" != "gen_vec_ps" && "$GENERATOR" != "bggen_upd" && "$GENERATOR" != "python") then + if ( "$gen_pre" != "file" && "$GENERATOR" != "genr8" && "$GENERATOR" != "bggen" && "$GENERATOR" != "genEtaRegge" && "$GENERATOR" != "genScalarRegge" && "$GENERATOR" != "gen_2pi_amp" && "$GENERATOR" != "gen_pi0" && "$GENERATOR" != "gen_2pi_primakoff" && "$GENERATOR" != "gen_2pi0_primakoff" && "$GENERATOR" != "gen_omega_3pi" && "$GENERATOR" != "gen_omegapi" && "$GENERATOR" != "gen_2k" && "$GENERATOR" != "bggen_jpsi" && "$GENERATOR" != "gen_ee" && "$GENERATOR" != "gen_tcs_bh" && "$GENERATOR" != "gen_ee_hb" && "$GENERATOR" != "particle_gun" && "$GENERATOR" != "geantBEAM" && "$GENERATOR" != "bggen_phi_ee" && "$GENERATOR" != "genBH" && "$GENERATOR" != "gen_omega_radiative" && "$GENERATOR" != "gen_amp" && "$GENERATOR" != "gen_amp_V2" && "$GENERATOR" != "genr8_new" && "$GENERATOR" != "gen_compton" && "$GENERATOR" != "gen_npi" && "$GENERATOR" != "gen_compton_simple" && "$GENERATOR" != "gen_primex_eta_he4" && "$GENERATOR" != "gen_generic_root" && "$GENERATOR" != "gen_whizard" && "$GENERATOR" != "mc_gen" && "$GENERATOR" != "gen_vec_ps" && "$GENERATOR" != "cbggen_upd" && "$GENERATOR" != "python") then echo "NO VALID GENERATOR GIVEN" - echo "only [genr8, bggen, genEtaRegge, genScalarRegge, gen_2pi_amp, gen_pi0, gen_omega_3pi, gen_2k, bggen_jpsi, gen_ee , gen_ee_hb, bggen_phi_ee, particle_gun, geantBEAM, genBH, gen_omega_radiative, gen_amp, gen_amp_V2, gen_compton, gen_npi, gen_compton_simple, gen_primex_eta_he4, gen_generic_root, gen_whizard, gen_omegapi, mc_gen, gen_vec_ps, bggen_upd, python] are supported" + echo "only [genr8, bggen, genEtaRegge, genScalarRegge, gen_2pi_amp, gen_pi0, gen_omega_3pi, gen_2k, bggen_jpsi, gen_ee, gen_tcs_bh, gen_ee_hb, bggen_phi_ee, particle_gun, geantBEAM, genBH, gen_omega_radiative, gen_amp, gen_amp_V2, gen_compton, gen_npi, gen_compton_simple, gen_primex_eta_he4, gen_generic_root, gen_whizard, gen_omegapi, mc_gen, gen_vec_ps, bggen_upd, python] are supported" echo "something went wrong with initialization" exit 1 endif @@ -1047,6 +1047,15 @@ if ( "$GENR" != "0" ) then #run generation echo "configuring gen_ee" STANDARD_NAME="gen_ee_"$STANDARD_NAME cp $CONFIG_FILE ./$STANDARD_NAME.conf + else if ( "$GENERATOR" == "gen_tcs_bh" ) then + echo "configuring gen_tcs_bh" + set STANDARD_NAME="gen_tcs_bh_"$STANDARD_NAME + + #set MCWRAPPER_CENTRAL_CNTR=`$runGen printenv MCWRAPPER_CENTRAL | tail -n1` + set MCWRAPPER_CENTRAL_CNTR="/w/halld-scshelf2101/home/gchung/tcs_sim2/gluex_MCwrapper" # for testing purpose + $runGen cp $MCWRAPPER_CENTRAL_CNTR/Generators/gen_tcs_bh/run/tcs_bh_TEMPLATE.conf ./ + cp tcs_bh_TEMPLATE.conf ./$STANDARD_NAME.conf + else if ( "$GENERATOR" == "gen_ee_hb" ) then echo "configuring gen_ee_hb" set STANDARD_NAME="gen_ee_hb_"$STANDARD_NAME @@ -1471,6 +1480,76 @@ if ( "$GENR" != "0" ) then #run generation echo $runGen gen_ee -d$STANDARD_NAME.conf -c$STANDARD_NAME'_beam.conf' -o$STANDARD_NAME.hddm -n$EVT_TO_GEN -z$RUN_NUMBER -l$GEN_MIN_ENERGY -u$GEN_MAX_ENERGY -r$RANDOMnum $optionals_line $runGen gen_ee -d$STANDARD_NAME.conf -c$STANDARD_NAME'_beam.conf' -o$STANDARD_NAME.hddm -n$EVT_TO_GEN -z$RUN_NUMBER -l$GEN_MIN_ENERGY -u$GEN_MAX_ENERGY -r$RANDOMnum $optionals_line set generator_return_code=$status + else if ( "$GENERATOR" == "gen_tcs_bh" ) then + echo "RUNNING GEN_TCS_BH" + set RANDOMnum=`bash -c 'echo $RANDOM'` + echo "Random number used: "$RANDOMnum + echo "Using MakeMC.csh" + # Read config file + foreach line ("`grep ':' $CONFIG_FILE | grep -v '^[[:space:]]*#'`") + set key=`echo $line | cut -d':' -f1 | tr -d ' '` + set val=`echo $line | cut -d':' -f2- | sed 's/^[ \t]*//; s/[ \t]*$//'` + + if ("$val" == "") then + echo "WARNING: $key has no assigned value — skipped" + else + echo "Setting $key = $val" + set $key="$val" + endif + end + + sed -i "s|TEMPREACTION|$reaction|" $STANDARD_NAME.conf + + sed -i "s|TEMPRANDSEED|$seedentry|" $STANDARD_NAME.conf + + sed -i "s|TEMPBEAMTYPE|$beamtype|" $STANDARD_NAME.conf + sed -i "s|TEMPEMIN|$EphotonMin|" $STANDARD_NAME.conf + sed -i "s|TEMPEMAX|$EphotonMax|" $STANDARD_NAME.conf + #sed -i "s|TEMPEMIN|$GEN_MIN_ENERGY|" $STANDARD_NAME.conf + #sed -i "s|TEMPEMAX|$GEN_MAX_ENERGY|" $STANDARD_NAME.conf + sed -i "s|TEMPEELECTRON|$Eelectron|" $STANDARD_NAME.conf + sed -i "s|TEMPTHEMAX|$thetaphotoMax|" $STANDARD_NAME.conf + + sed -i "s|TEMPNEVENTS|$EVT_TO_GEN|" $STANDARD_NAME.conf + sed -i "s|TEMPRUNNUM|$RUN_NUMBER|" $STANDARD_NAME.conf + sed -i "s|TEMPARTICLE|$outLepton|" $STANDARD_NAME.conf + + sed -i "s|TEMPTGT_LEN|$targetLength|" $STANDARD_NAME.conf + sed -i "s|TEMPTGT_A|$A_target|" $STANDARD_NAME.conf + sed -i "s|TEMPTGT_Z|$Z_target|" $STANDARD_NAME.conf + sed -i "s|TEMPPROT_NEUT|$protonOrNeutron|" $STANDARD_NAME.conf + + sed -i "s|TEMPPOLBEAM|$polBeamDeg|" $STANDARD_NAME.conf + sed -i "s|TEMPPOLTYPE|$beamPolarType|" $STANDARD_NAME.conf + sed -i "s|TEMPTGTPOLDIR|$targetPolDir|" $STANDARD_NAME.conf + sed -i "s|TEMPTGTPOLDEG|$polTargetDeg|" $STANDARD_NAME.conf + + sed -i "s|TEMP_MTMIN|$mt_Min|" $STANDARD_NAME.conf + sed -i "s|TEMP_MTMAX|$mt_Max|" $STANDARD_NAME.conf + sed -i "s|TEMP_QPMIN|$Qp2Min|" $STANDARD_NAME.conf + sed -i "s|TEMP_QPMAX|$Qp2Max|" $STANDARD_NAME.conf + sed -i "s|TEMP_TCMMIN|$thetaCMMin|" $STANDARD_NAME.conf + sed -i "s|TEMP_TCMMAX|$thetaCMMax|" $STANDARD_NAME.conf + sed -i "s|TEMP_Q2MAX|$Q2Max|" $STANDARD_NAME.conf + + sed -i "s|TEMPRADTYPE|$radCorrType|" $STANDARD_NAME.conf + sed -i "s|TEMPECUT|$eCut|" $STANDARD_NAME.conf + + sed -i "s|TEMPOUTFORMAT|$outFormat|" $STANDARD_NAME.conf + + sed -i "s|TEMP_THMS|$thetaHMS|" $STANDARD_NAME.conf + sed -i "s|TEMP_SHMS|$thetaSHMS|" $STANDARD_NAME.conf + sed -i "s|TEMP_PHMS|$pHMS|" $STANDARD_NAME.conf + sed -i "s|TEMP_PSHMS|$pSHMS|" $STANDARD_NAME.conf + + sed -i "s|TEMPXSECPATH|$xsecpath|" $STANDARD_NAME.conf + sed -i "s|TEMPOUTFILE|$outFile|" $STANDARD_NAME.conf + sed -i "s|TEMPINDEX|$indexrun|" $STANDARD_NAME.conf + + echo $runGen gen_tcs_bh $STANDARD_NAME.conf + $runGen gen_tcs_bh $STANDARD_NAME.conf + set generator_return_code=$status + #mv $outFile $STANDARD_NAME.hddm else if ( "$GENERATOR" == "gen_ee_hb" ) then echo gen_ee_hb -N$RUN_NUMBER -n$EVT_TO_GEN echo $runGen gen_ee_hb -N$RUN_NUMBER -n$EVT_TO_GEN diff --git a/MakeMC.sh b/MakeMC.sh index dd90116..878c90b 100755 --- a/MakeMC.sh +++ b/MakeMC.sh @@ -852,9 +852,9 @@ if [[ "$GENR" != "0" ]]; then # run generation gen_pre=`echo $GENERATOR | cut -c1-4` - if [[ "$gen_pre" != "file" && "$GENERATOR" != "genr8" && "$GENERATOR" != "bggen" && "$GENERATOR" != "genEtaRegge" && "$GENERATOR" != "genScalarRegge" && "$GENERATOR" != "gen_2pi_amp" && "$GENERATOR" != "gen_pi0" && "$GENERATOR" != "gen_2pi_primakoff" && "$GENERATOR" != "gen_2pi0_primakoff" && "$GENERATOR" != "gen_omega_3pi" && "$GENERATOR" != "gen_omegapi" && "$GENERATOR" != "gen_2k" && "$GENERATOR" != "bggen_jpsi" && "$GENERATOR" != "gen_ee" && "$GENERATOR" != "gen_ee_hb" && "$GENERATOR" != "particle_gun" && "$GENERATOR" != "geantBEAM" && "$GENERATOR" != "bggen_phi_ee" && "$GENERATOR" != "genBH" && "$GENERATOR" != "gen_omega_radiative" && "$GENERATOR" != "gen_amp" && "$GENERATOR" != "gen_amp_V2" && "$GENERATOR" != "genr8_new" && "$GENERATOR" != "gen_compton" && "$GENERATOR" != "gen_npi" && "$GENERATOR" != "gen_compton_simple" && "$GENERATOR" != "gen_primex_eta_he4" && "$GENERATOR" != "gen_generic_root" && "$GENERATOR" != "gen_whizard" && "$GENERATOR" != "mc_gen" && "$GENERATOR" != "gen_vec_ps" && "$GENERATOR" != "bggen_upd" && "$GENERATOR" != "python" ]]; then + if [[ "$gen_pre" != "file" && "$GENERATOR" != "genr8" && "$GENERATOR" != "bggen" && "$GENERATOR" != "genEtaRegge" && "$GENERATOR" != "genScalarRegge" && "$GENERATOR" != "gen_2pi_amp" && "$GENERATOR" != "gen_pi0" && "$GENERATOR" != "gen_2pi_primakoff" && "$GENERATOR" != "gen_2pi0_primakoff" && "$GENERATOR" != "gen_omega_3pi" && "$GENERATOR" != "gen_omegapi" && "$GENERATOR" != "gen_2k" && "$GENERATOR" != "bggen_jpsi" && "$GENERATOR" != "gen_ee" && "$GENERATOR" != "gen_tcs_bh" && "$GENERATOR" != "gen_ee_hb" && "$GENERATOR" != "particle_gun" && "$GENERATOR" != "geantBEAM" && "$GENERATOR" != "bggen_phi_ee" && "$GENERATOR" != "genBH" && "$GENERATOR" != "gen_omega_radiative" && "$GENERATOR" != "gen_amp" && "$GENERATOR" != "gen_amp_V2" && "$GENERATOR" != "genr8_new" && "$GENERATOR" != "gen_compton" && "$GENERATOR" != "gen_npi" && "$GENERATOR" != "gen_compton_simple" && "$GENERATOR" != "gen_primex_eta_he4" && "$GENERATOR" != "gen_generic_root" && "$GENERATOR" != "gen_whizard" && "$GENERATOR" != "mc_gen" && "$GENERATOR" != "gen_vec_ps" && "$GENERATOR" != "bggen_upd" && "$GENERATOR" != "python" ]]; then echo "NO VALID GENERATOR GIVEN" - echo "only [genr8, bggen, genEtaRegge, genScalarRegge, gen_2pi_amp, gen_pi0, gen_omega_3pi, gen_2k, bggen_jpsi, gen_ee, gen_ee_hb, bggen_phi_ee, particle_gun, geantBEAM, genBH, gen_omega_radiative, gen_amp, gen_amp_V2, gen_compton, gen_npi, gen_compton_simple, gen_primex_eta_he4, gen_generic_root, gen_whizard, gen_omegapi, mc_gen, gen_vec_ps, bggen_upd, python] are supported" + echo "only [genr8, bggen, genEtaRegge, genScalarRegge, gen_2pi_amp, gen_pi0, gen_omega_3pi, gen_2k, bggen_jpsi, gen_ee, gen_tcs_bh, gen_ee_hb, bggen_phi_ee, particle_gun, geantBEAM, genBH, gen_omega_radiative, gen_amp, gen_amp_V2, gen_compton, gen_npi, gen_compton_simple, gen_primex_eta_he4, gen_generic_root, gen_whizard, gen_omegapi, mc_gen, gen_vec_ps, bggen_upd, python] are supported" exit 1 fi @@ -1107,6 +1107,14 @@ if [[ "$GENR" != "0" ]]; then # run generation echo "configuring gen_ee" STANDARD_NAME="gen_ee_"$STANDARD_NAME cp $CONFIG_FILE ./$STANDARD_NAME.conf + elif [[ "$GENERATOR" == "gen_tcs_bh" ]]; then + echo "configuring gen_tcs_bh" + STANDARD_NAME="gen_tcs_bh_"$STANDARD_NAME + #MCWRAPPER_CENTRAL_CNTR=`$runGen printenv MCWRAPPER_CENTRAL | tail -n1` + MCWRAPPER_CENTRAL_CNTR="/w/halld-scshelf2101/home/gchung/tcs_sim2/gluex_MCwrapper" # for testing purpose + $runGen cp $MCWRAPPER_CENTRAL_CNTR/Generators/gen_tcs_bh/run/tcs_bh_TEMPLATE.conf ./ + cp tcs_bh_TEMPLATE.conf ./$STANDARD_NAME.conf + elif [[ "$GENERATOR" == "gen_ee_hb" ]]; then echo "configuring gen_ee_hb" STANDARD_NAME="gen_ee_hb_"$STANDARD_NAME @@ -1510,6 +1518,79 @@ if [[ "$GENR" != "0" ]]; then # run generation echo $runGen gen_ee -d$STANDARD_NAME.conf -c$STANDARD_NAME'_beam.conf' -o$STANDARD_NAME.hddm -n$EVT_TO_GEN -z$RUN_NUMBER -l$GEN_MIN_ENERGY -u$GEN_MAX_ENERGY -r$RANDOMnum $optionals_line $runGen gen_ee -d$STANDARD_NAME.conf -c$STANDARD_NAME'_beam.conf' -o$STANDARD_NAME.hddm -n$EVT_TO_GEN -z$RUN_NUMBER -l$GEN_MIN_ENERGY -u$GEN_MAX_ENERGY -r$RANDOMnum $optionals_line generator_return_code=$? + elif [[ "$GENERATOR" == "gen_tcs_bh" ]]; then + echo "RUNNING GEN_TCS_BH" + RANDOMnum=`bash -c 'echo $RANDOM'` + + echo "Random number used: "$RANDOMnum + echo "Using MakeMC.sh" + # Read config file + while IFS= read -r line; do + key=$(echo "$line" | cut -d':' -f1 | tr -d ' ') + val=$(echo "$line" | cut -d':' -f2- | sed 's/^[ \t]*//; s/[ \t]*$//') + + if [[ -z "$val" ]]; then + echo "WARNING: $key has no assigned value — skipped" + else + echo "Setting $key = $val" + eval "$key=\"$val\"" + fi + done < <(grep ':' "$CONFIG_FILE" | grep -v '^[[:space:]]*#') + + sed -i "s|TEMPREACTION|$reaction|" $STANDARD_NAME.conf + + sed -i "s|TEMPRANDSEED|$seedentry|" $STANDARD_NAME.conf + + sed -i "s|TEMPBEAMTYPE|$beamtype|" $STANDARD_NAME.conf + sed -i "s|TEMPEMIN|$EphotonMin|" $STANDARD_NAME.conf + sed -i "s|TEMPEMAX|$EphotonMax|" $STANDARD_NAME.conf + #sed -i "s|TEMPEMIN|$GEN_MIN_ENERGY|" $STANDARD_NAME.conf + #sed -i "s|TEMPEMAX|$GEN_MAX_ENERGY|" $STANDARD_NAME.conf + sed -i "s|TEMPEELECTRON|$Eelectron|" $STANDARD_NAME.conf + sed -i "s|TEMPTHEMAX|$thetaphotoMax|" $STANDARD_NAME.conf + + sed -i "s|TEMPNEVENTS|$EVT_TO_GEN|" $STANDARD_NAME.conf + sed -i "s|TEMPRUNNUM|$RUN_NUMBER|" $STANDARD_NAME.conf + sed -i "s|TEMPARTICLE|$outLepton|" $STANDARD_NAME.conf + + sed -i "s|TEMPTGT_LEN|$targetLength|" $STANDARD_NAME.conf + sed -i "s|TEMPTGT_A|$A_target|" $STANDARD_NAME.conf + sed -i "s|TEMPTGT_Z|$Z_target|" $STANDARD_NAME.conf + sed -i "s|TEMPPROT_NEUT|$protonOrNeutron|" $STANDARD_NAME.conf + + sed -i "s|TEMPPOLBEAM|$polBeamDeg|" $STANDARD_NAME.conf + sed -i "s|TEMPPOLTYPE|$beamPolarType|" $STANDARD_NAME.conf + sed -i "s|TEMPTGTPOLDIR|$targetPolDir|" $STANDARD_NAME.conf + sed -i "s|TEMPTGTPOLDEG|$polTargetDeg|" $STANDARD_NAME.conf + + sed -i "s|TEMP_MTMIN|$mt_Min|" $STANDARD_NAME.conf + sed -i "s|TEMP_MTMAX|$mt_Max|" $STANDARD_NAME.conf + sed -i "s|TEMP_QPMIN|$Qp2Min|" $STANDARD_NAME.conf + sed -i "s|TEMP_QPMAX|$Qp2Max|" $STANDARD_NAME.conf + sed -i "s|TEMP_TCMMIN|$thetaCMMin|" $STANDARD_NAME.conf + sed -i "s|TEMP_TCMMAX|$thetaCMMax|" $STANDARD_NAME.conf + sed -i "s|TEMP_Q2MAX|$Q2Max|" $STANDARD_NAME.conf + + sed -i "s|TEMPRADTYPE|$radCorrType|" $STANDARD_NAME.conf + sed -i "s|TEMPECUT|$eCut|" $STANDARD_NAME.conf + + sed -i "s|TEMPOUTFORMAT|$outFormat|" $STANDARD_NAME.conf + + sed -i "s|TEMP_THMS|$thetaHMS|" $STANDARD_NAME.conf + sed -i "s|TEMP_SHMS|$thetaSHMS|" $STANDARD_NAME.conf + sed -i "s|TEMP_PHMS|$pHMS|" $STANDARD_NAME.conf + sed -i "s|TEMP_PSHMS|$pSHMS|" $STANDARD_NAME.conf + + sed -i "s|TEMPXSECPATH|$xsecpath|" $STANDARD_NAME.conf + sed -i "s|TEMPOUTFILE|$outFile|" $STANDARD_NAME.conf + sed -i "s|TEMPINDEX|$indexrun|" $STANDARD_NAME.conf + + echo $runGen gen_tcs_bh $STANDARD_NAME.conf + $runGen gen_tcs_bh $STANDARD_NAME.conf + + generator_return_code=$? + #mv $outFile $STANDARD_NAME.hddm + elif [[ "$GENERATOR" == "gen_ee_hb" ]]; then echo $runGen gen_ee_hb -N$RUN_NUMBER -n$EVT_TO_GEN $runGen gen_ee_hb -N$RUN_NUMBER -n$EVT_TO_GEN From 6a96054ffc377b884d184bce37297ec48002df28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cgyangchung=E2=80=9D?= <“gyangchung13@gmail.com”> Date: Tue, 2 Dec 2025 14:48:07 -0500 Subject: [PATCH 5/9] configuration file template --- .../gen_tcs_bh/run/tcs_bh_TEMPLATE.conf | 65 +++++++++++++++++++ Generators/gen_tcs_bh/tcs_bh_TEMPLATE.conf | 65 +++++++++++++++++++ 2 files changed, 130 insertions(+) create mode 100644 Generators/gen_tcs_bh/run/tcs_bh_TEMPLATE.conf create mode 100644 Generators/gen_tcs_bh/tcs_bh_TEMPLATE.conf diff --git a/Generators/gen_tcs_bh/run/tcs_bh_TEMPLATE.conf b/Generators/gen_tcs_bh/run/tcs_bh_TEMPLATE.conf new file mode 100644 index 0000000..7117583 --- /dev/null +++ b/Generators/gen_tcs_bh/run/tcs_bh_TEMPLATE.conf @@ -0,0 +1,65 @@ +# --- Reaction ------------------------------------------------- +# reaction (1 -> TCS; 11-> TCS phase space) +reaction: TEMPREACTION + +# seed for random number generator +seedentry: TEMPRANDSEED + +# --- Beam configuration ------------------------------------------------- +# Electron beam=1 or photon beam=0 +beamtype: TEMPBEAMTYPE + +# Energy range of the photon +EphotonMin: TEMPEMIN +EphotonMax: TEMPEMAX + +# Incoming electron energy or equivalent +Eelectron: TEMPEELECTRON + +# Beam angular dispersion +thetaphotoMax: TEMPTHEMAX + +# --- Event generation ---------------------------------------------------- +nTotEvents: TEMPNEVENTS +runNum: TEMPRUNNUM +outLepton: TEMPARTICLE + +# --- Target configuration ------------------------------------------------ +targetLength: TEMPTGT_LEN +A_target: TEMPTGT_A +Z_target: TEMPTGT_Z +protonOrNeutron: TEMPPROT_NEUT + +# --- Polarization -------------------------------------------------------- +polBeamDeg: TEMPPOLBEAM +beamPolarType: TEMPPOLTYPE +targetPolDir: TEMPTGTPOLDIR +polTargetDeg: TEMPTGTPOLDEG + +# --- Kinematic limits ---------------------------------------------------- +mt_Min: TEMP_MTMIN +mt_Max: TEMP_MTMAX +Qp2Min: TEMP_QPMIN +Qp2Max: TEMP_QPMAX +thetaCMMin: TEMP_TCMMIN +thetaCMMax: TEMP_TCMMAX +Q2Max: TEMP_Q2MAX + +# --- Radiative corrections ----------------------------------------------- +radCorrType: TEMPRADTYPE +eCut: TEMPECUT + +# --- Output options ------------------------------------------------------ +outFormat: TEMPOUTFORMAT + +# --- SIMC parameters ----------------------------------------------------- +thetaHMS: TEMP_THMS +thetaSHMS: TEMP_SHMS +pHMS: TEMP_PHMS +pSHMS: TEMP_PSHMS + +# --- File configuration -------------------------------------------------- +xsecpath: TEMPXSECPATH +outFile: TEMPOUTFILE +indexrun: TEMPINDEX + diff --git a/Generators/gen_tcs_bh/tcs_bh_TEMPLATE.conf b/Generators/gen_tcs_bh/tcs_bh_TEMPLATE.conf new file mode 100644 index 0000000..7117583 --- /dev/null +++ b/Generators/gen_tcs_bh/tcs_bh_TEMPLATE.conf @@ -0,0 +1,65 @@ +# --- Reaction ------------------------------------------------- +# reaction (1 -> TCS; 11-> TCS phase space) +reaction: TEMPREACTION + +# seed for random number generator +seedentry: TEMPRANDSEED + +# --- Beam configuration ------------------------------------------------- +# Electron beam=1 or photon beam=0 +beamtype: TEMPBEAMTYPE + +# Energy range of the photon +EphotonMin: TEMPEMIN +EphotonMax: TEMPEMAX + +# Incoming electron energy or equivalent +Eelectron: TEMPEELECTRON + +# Beam angular dispersion +thetaphotoMax: TEMPTHEMAX + +# --- Event generation ---------------------------------------------------- +nTotEvents: TEMPNEVENTS +runNum: TEMPRUNNUM +outLepton: TEMPARTICLE + +# --- Target configuration ------------------------------------------------ +targetLength: TEMPTGT_LEN +A_target: TEMPTGT_A +Z_target: TEMPTGT_Z +protonOrNeutron: TEMPPROT_NEUT + +# --- Polarization -------------------------------------------------------- +polBeamDeg: TEMPPOLBEAM +beamPolarType: TEMPPOLTYPE +targetPolDir: TEMPTGTPOLDIR +polTargetDeg: TEMPTGTPOLDEG + +# --- Kinematic limits ---------------------------------------------------- +mt_Min: TEMP_MTMIN +mt_Max: TEMP_MTMAX +Qp2Min: TEMP_QPMIN +Qp2Max: TEMP_QPMAX +thetaCMMin: TEMP_TCMMIN +thetaCMMax: TEMP_TCMMAX +Q2Max: TEMP_Q2MAX + +# --- Radiative corrections ----------------------------------------------- +radCorrType: TEMPRADTYPE +eCut: TEMPECUT + +# --- Output options ------------------------------------------------------ +outFormat: TEMPOUTFORMAT + +# --- SIMC parameters ----------------------------------------------------- +thetaHMS: TEMP_THMS +thetaSHMS: TEMP_SHMS +pHMS: TEMP_PHMS +pSHMS: TEMP_PSHMS + +# --- File configuration -------------------------------------------------- +xsecpath: TEMPXSECPATH +outFile: TEMPOUTFILE +indexrun: TEMPINDEX + From 1d0adf7fbe8e9ed8dea7de508bd5d506748ee2d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cgyangchung=E2=80=9D?= <“gyangchung13@gmail.com”> Date: Tue, 2 Dec 2025 14:50:27 -0500 Subject: [PATCH 6/9] A sample MC configuration file for testing --- .../gen_tcs_bh/run/MC_gen_tcs_bh.config | 89 +++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 Generators/gen_tcs_bh/run/MC_gen_tcs_bh.config diff --git a/Generators/gen_tcs_bh/run/MC_gen_tcs_bh.config b/Generators/gen_tcs_bh/run/MC_gen_tcs_bh.config new file mode 100644 index 0000000..2ee321e --- /dev/null +++ b/Generators/gen_tcs_bh/run/MC_gen_tcs_bh.config @@ -0,0 +1,89 @@ +#THESE TWO ARE OPTIONAL IF THE STANDARD RUNNING DOESN'T SUIT YOUR NEEDS +#CUSTOM_MAKEMC=use-this-script-instead +CUSTOM_MAKEMC=/w/halld-scshelf2101/home/gchung/tcs_sim2/gluex_MCwrapper/MakeMC.sh +#CUSTOM_GCONTROL=use-this-Gcontrol-instead +CUSTOM_GCONTROL=/w/halld-scshelf2101/home/gchung/tcs_sim2/gluex_MCwrapper/Generators/gen_tcs_bh/run/Gcontrol.in +#======================================================================== + +#VARIATION=mc calibtime=timegoeshere #set your jana calib context here with or without calibtime Default is variation=mc +#RECON_VERSION=versiongoeshere +#RECON_CALIBTIME=timegoeshere +#ANA_VERSION=versiongoeshere +#ANA_CALIBTIME=timegoeshere + +#RCDB_QUERY= + +#RUNNING_DIRECTORY=/run/in/this/directory #where the code should run. This is defaulted to ./. Use only when NEEDED +RUNNING_DIRECTORY=/w/halld-scshelf2101/home/gchung/tcs_sim2/gluex_MCwrapper + + +#ccdbSQLITEPATH=/your/sqlite/path/ccdb.sqlite #if you use SQLITE and it is not part of the environment file that gets sourced +#rcdbSQLITEPATH=/your/sqlite/path/rcdb.sqlite #if you use SQLITE and it is not part of the environment file that gets sourced + +#TAG=my-custom-prefix-tag + +#DATA_OUTPUT_BASE_DIR=OUTPUT-LOCATION #your desired output location +DATA_OUTPUT_BASE_DIR=/w/halld-scshelf2101/home/gchung/tcs_sim2/gluex_MCwrapper #your desired output location + +NCORES=4 # Number of CPU threads to use or nodes:node-id:ppn or nodes:ppn depending on your system + +#GENERATOR=generator-to-use #or you may specifile file:/.../file-to-use.hddm +GENERATOR=gen_tcs_bh #or you may specifile file:/.../file-to-use.hddm + +#GENERATOR_CONFIG=config file for generator +GENERATOR_CONFIG=/w/halld-scshelf2101/home/gchung/tcs_sim2/gluex_MCwrapper/Generators/gen_tcs_bh/tcs_bh.cfg +#GENERATOR_POSTPROCESS=decay_evtgen:pathToConfigFile:pathToEVT.PDL:pathToDECAY.DEC # last two are optional (set 2nd to default if only 3rd is used), eg evtgen:/u/home/evtgen.cfg:default:someOther.DEC + +#common parameters for generators +#FLUX_TO_GEN=/[full path]/flux.root:flux_hist +#POL_TO_GEN=/[full path]/tpol.root:pol_hist +#eBEAM_ENERGY=12 #either use rcdb or do not set to pull the value for the chosen run number from the rcdb +#eBEAM_CURRENT=0.01 #either use rcdb or do not set to pull the value for the chosen run number from the rcdb in uA +#RADIATOR_THICKNESS=50.e-06 #either use rcdb or do not set to pull the value for the chosen run number from the rcdb +#COHERENT_PEAK=9 #either use rcdb or do not set to pull the value for the chosen run number from the rcdb +GEN_MIN_ENERGY=4 +GEN_MAX_ENERGY=11.6 + +GEANT_VERSION=4 +#VERTEX_VOLUME=ccdb:29.5 #defines the VERTEX card in geant. The first value should be a comma seperated string x,y,z,var_xx,var_xy,var_yy,dxdz,dydz and the second part is the length (only the length need be given) + +BKG=None #[None, Random:[TAG], BeamPhotons, TagOnly, custom e.g bg.hddm:1.8] Can be stacked eg Random:[TAG]+TagOnly:.123 where the :[num] defines BGRATE + + +#GENERATOR_OS=centos7 #use only if code needs to run on special OS, either centos7 or alma9 container are supported +#POSTGEN_OS=centos7 #use only if code needs to run on special OS, either centos7 or alma9 container are supported +#SIMULATION_OS=centos7 #use only if code needs to run on special OS, either centos7 or alma9 container are supported +#MCSMEAR_OS=centos7 #use only if code needs to run on special OS, either centos7 or alma9 container are supported +#RECON_OS=centos7 #use only if code needs to run on special OS, either centos7 or alma9 container are supported +#ANA_OS=centos7 #use only if code needs to run on special OS, either centos7 or alma9 container are supported + + +#environment file location +#ENVIRONMENT_FILE=your-environment-files #change this to your own environment file +ENVIRONMENT_FILE=/u/home/gchung/version_hdsim.xml #change this to your own environment file +#ANA_ENVIRONMENT_FILE=your-analysis-environment-file #optional either a .(c)sh file to be sourced or .xml before the below plugins are run + +#optional additional plugins that will be run along side danarest and hd_root. This should be a comma separated list (e.g. plugin1,plugin2) +#CUSTOM_PLUGINS= #or file:/.../file-to-use which is a configuration file for jana/hd_root +#CUSTOM_ANA_PLUGINS= #or file:/.../file-to-use which is a configuration file for jana/hd_root, this is used in the analysis launch emulation. Don't include the mcthrown_tree plugin here! +#==================================================================================== +#EVERYTHING BELOW FOR BATCH ONLY + +#VERBOSE=True +BATCH_SYSTEM=swif2cont #can be swif or swif2 or swif2cont (to run in centos9 container) or condor or osg or qsub adding :[name] will pass -q [name] into PBS. + +WORKFLOW_NAME=WORKFLOW-NAME #SWIF WORKFLOW NAME + +# for swif +PROJECT = gluex # http://scicomp.jlab.org/scicomp/#/projects +TRACK= simulation # https://scicomp.jlab.org/docs/batch_job_tracks +# for swif2 +ACCOUNT = halld # https://scicomp.jlab.org/scicomp/slurmJob/slurmAccount +PARTITION = production # https://scicomp.jlab.org/scicomp/slurmJob/slurmInfo +EXPERIMENT = GlueX # GlueX (default) or CPP + +# RESOURCES for swif(2) jobs +DISK=5GB # Max Disk usage +RAM=5GB # Max RAM usage +TIMELIMIT=300minutes # Max walltime. This may be of the form xx:xx:xx depending on your system +OS=el9 # Specify CentOS65 machines From 568e9841deb4d4416e09784210c7c4b026bd89b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cgyangchung=E2=80=9D?= <“gyangchung13@gmail.com”> Date: Tue, 2 Dec 2025 14:55:33 -0500 Subject: [PATCH 7/9] instructions and geant4 test run file --- Generators/gen_tcs_bh/README.md | 7 + Generators/gen_tcs_bh/run/Gcontrol.in | 479 ++++++++++++++++++++++++++ 2 files changed, 486 insertions(+) create mode 100644 Generators/gen_tcs_bh/README.md create mode 100644 Generators/gen_tcs_bh/run/Gcontrol.in diff --git a/Generators/gen_tcs_bh/README.md b/Generators/gen_tcs_bh/README.md new file mode 100644 index 0000000..8c0b362 --- /dev/null +++ b/Generators/gen_tcs_bh/README.md @@ -0,0 +1,7 @@ +This directory contain the configuration file for running: gen_tcs_bh event generator. + +Make changes in the configuration file: "tcs_bh.cfg" with the +desire input or settings you want to run the event generator with. + +Do not edit the file: in run/"tcs_bh_TEMPLATE.conf" +It is the template use by MCWrapper during event generations run. diff --git a/Generators/gen_tcs_bh/run/Gcontrol.in b/Generators/gen_tcs_bh/run/Gcontrol.in new file mode 100644 index 0000000..fca5772 --- /dev/null +++ b/Generators/gen_tcs_bh/run/Gcontrol.in @@ -0,0 +1,479 @@ +c This is the control file for the GEANT simulation. Parameters defined +c in this file control the kind and extent of simulation that is performed. +c The full list of options is given in section BASE-40 of the GEANT manual. +c +c In addition, some new cards have been defined to set up the input source +c for the simulation. Three kinds of simulation runs are available, selected +c by which of the following three "cards" are present below. +c 1. Input from Monte Carlo generator (card INFILE) +c 2. Built-in coherent bremsstrahlung source (card BEAM) +c 3. Built-in single-track event generator (card KINE) +c The order of the list is significant, that is if INFILE is present then the +c BEAM and KINE cards are ignored, otherwise if BEAM is present then KINE is +c ignored. For example, the 3-card sequence: +c INFILE 'phi-1680.hddm' +c SKIP 25 +c TRIG 100 +c instructs HDGeant to open ./phi-1680.hddm, skip the first 25 events and then +c process the following 100 input events and stop. If the end of the file is +c reached before the event count specified in card TRIG is exhausted then the +c processing will stop at the end of file. +INFILE 'tcs_bh_output.hddm' +SKIP 0 +TRIG 10000 +RUNG 11566 + +c Normally the position of the primary event vertex is read from the input +c file that is produced by an external Monte Carlo generator. In the special +c case that the primary vertex is set to (0,0,0) by the generator, a random +c offset is added by the simulation, generated uniformely along a cylinder to +c represent the beam-target overlap volume. This 3d offset is added to the +c primary vertex position and all of the secondary vertices as well, so that +c the complete event is shifted to originate at the random assigned point. +c The vertex times are likewise shifted according to the shift in z, so +c that the time of the primary vertex coincides with the instant that one +c of the beam bunches is passing through the z-plane of the shifted vertex. +c By default, this cylinder is centered on the z axis extending from z=50.25 +c to 79.75 cm, with a uniform transverse density and a diameter of 0.5 cm. +c The VERTEX card allows this default behavior to be superseded by a +c Gaussian transverse beam spot specified in one of the following ways. +c 'beam_spot(x,y,z,var_xx,var_xy,var_yy,dxdz,dydz) * length' +c or +c 'beam_spot(ccdb) * length' +c where the symbols x,y,z,var_xx,var_xy,var_yy,dxdz,dydz and length are +c numerical values that specify the vertex distribution, as follows. +c x,y,z = center of random cylinder that defines the +c distribution of generated vertex points; +c var_xx, var_xy, var_yy = parameters of an ellipse in the xy +c plane that defines the transverse Gaussian distribution; +c dxdz = slope of the cylinder axis in the zx plane; +c dydz = slope of the cylinder axis in the zy plane; +c length = length of the target along z, assumed uniform. +c All spatial dimensions are given in cm, and variances in cm^2. The second +c form with beam_spot(ccdb) supports lookup of x,y,z,var_xx,var_xy,var_yy, +c dxdz,dydz in ccdb, according to the run number being simulated. The +c length parameter still needs to be specified independently because it is +c not included in the beam_spot table in ccdb. The beam_spot parameter +c list (x,y...) may be truncated at any point, in which case the remaining +c unstated values will be assigned to zero. Whatever values you assign, +c the entire string MUST BE ENCLOSED IN SINGLE QUOTES ''. +cVERTEX 'beam_spot(0.20,-0.02,65.,0.06,0.,0.06,-0.0007,0.0004) * 29.5' +VERTEX 'beam_spot(TEMPGEANTAREA) * TEMPGEANTLENGTH' + + +c The BEAM card configures the built-in coherent bremsstralung photon +c beam generator in HDGeant. If the INFILE card is not present and BEAM +c is specified, the internal coherent bremsstralung generator is the primary +c source of events for the simulation. If INFILE is specified, the primary +c event source is the external Monte Carlo generator that produced the file, +c but the BEAM card may still be present, and it is needed if beam-related +c backgrounds are being superimposed on top of the primary event signals, +c as requested with the BGRATE card (see below). The beam card accepts +c the following five parameters. +c Emax - end-point energy of the electron beam (GeV) +c Epeak - energy of the primary coherent peak edge (GeV) +c Emin - minimum energy of the coherent bremsstrahlung beam (GeV) +c collz - z position of collimator in m +c colld - diameter of collimator in m +c Eemit - electron beam emittance in m.rad +c radthick - dimaond radiator thickneess in m +c Omitting the final parameter Emin results in the default value being used. +c Setting Epeak to zero selects an amorphous radiator instead of diamond. +BEAM TEMPELECE TEMPCOHERENT TEMPMINE 76.00 TEMPCOLD 10.e-9 TEMPRADTHICK + +c The GENBEAM card configures the simulation program to act purely as a +c Monte Carlo event generator, and not to actually track any of the particles +c that it generates. The events are written to the output file with only the +c MC section filled out (reactions tag). This file can be fed back later to +c HDGeant using the INFILE card above to carry out the actual simulation. +c This provides access to the built-in photon beam generator of HDGeant to +c someone who wants to study the properties of the beam apart from its +c interactions in the target. Three keywords are currently supported. +c 'precol' - single-photon events starting upstream of the primary +c collimator, with correlated spatial and momentum +c distributions for the well-tuned GlueX beamline. +c 'postcol' - single-photon events starting downstream of the secondary +c collimator. Beam photons have been tracked through the +c system of collimators and sweep magnets but then stopped +c before entry into the pair spectrometer. +c 'postconv' - e+e- pair and e+e-/e-recoil events generated in the +c TPOL target. Beam photons have been tracked through +c the system of collimators and then pair-converted in +c the TPOL coverter using a custom polarization-sensitive +c pair/triplet production generator. They are saved as +c a single vertex within the PTAR target. +c The first two modes are supported by both HDGeant and HDGeant4, while +c postconv is only supported at present by HDGeant4. +cGENBEAM 'postconv' + +c Commenting out the following line will disable simulated hits output. +OUTFILE 'tcs_bh_output0.hddm' + +c The following are used to automatically invoke the mcsmear program +c to do the final stage digitization of hits after the simulation +c stage is complete. This simply invokes the mcsmear program passing +c it any optional arguments supplied here and then optionally deletes +c the OUTFILE specified above leaving only the smeared file. This stage +c can be invoked by hand afterwards, but having it done automatically +c here allows hdgeant and mcsmear to function as though it were a single +c program. The specific keys are as follows. +c +c POSTSMEAR - set this 1 to auto-invoke the mcsmear program and 0 to not +c DELETEUNSMEARED - set this to 1 to delete the OUTFILE after running mcsmear +c MCSMEAROPTS - String to specify additional arguments to pass to mcsmear +POSTSMEAR 0 +DELETEUNSMEARED 0 +c MCSMEAROPTS '-t1000 -d0' + +c The following card enables single-track generation (for testing). +c For a single-particle gun, set the momentum (GeV/c), direction +c theta,phi (degrees) and vertex position (cm), and for the particle +c type insert the Geant particle type code plus 100 (eg. 101=gamma, +c 103=electron, 107=pi0, 108=pi+, 109=pi-, 114=proton). If you use +c the particle code but do not add 100 then theta,phi are ignored +c and the particle direction is generated randomly over 4pi sr. +c For a listing of the Geant particle types, see the following URL. +c http://wwwasdoc.web.cern.ch/wwwasdoc/geant_html3/node72.html +c The meaning of the arguments to KINE are as follows. +c - particle = GEANT particle type of primary track + 100 +c - momentum = initial track momentum, central value (GeV/c) +c - theta = initial track polar angle, central value (degrees) +c - phi = initial track azimuthal angle, central value (degrees) +c - delta_momentum = spread in initial track momentum, full width (GeV/c) +c - delta_theta = spread in initial track polar angle, full width (degrees) +c - delta_phi = spread in initial track azimuthal angle, full width (degrees) +c +c If you do explicitly specify the momentum/angle (by adding 100 as +c described above, you may also choose to distibute tracks evenly in +c log(P) or log(theta) by setting the appropriate PLOG and TLOG flags +c to a non-zero value. +c PLOG 1 +c TLOG 1 +c +c particle momentum theta phi delta_momentum delta_theta delta_phi +cKINE 108 0.5 90. 180. 0. 180. 360. + +c The SCAP card determines the vertex position for the particle gun. It +c supports the following three arguments, all of which default to 0. +c +c vertex_x vertex_y vertex_z +cSCAP 0. 0. 65. + +c The TGTWIDTH card is used to determine an extended volume from +c which the particle gun will generate vertexes. The vertex position +c is sampled evenly from a cylindrical volume whose radius is given +c by the first parameter and whose full z-extent is given by the second. +c The volume is centered on the coordinates specified by SCAP above. +c If the card is not specified, then both the r and z extent default +c to zero meaning the vertex is always located at the point specified +c by SCAP. Note that this only affects the particle gun. Events read +c from a file contain their own vertex information. +c +c vertex_extent_r vertex_extent_z +cTGTWIDTH 0.5 15 + +c If you specify a non-zero value for vertex_x and/or vertex_y above then +c all tracks will emerge from the given point. If you leave them at zero, +c you have the option of specifying the HALO card which causes the simulation +c to generate events with a transverse profile modeled after the 12 GeV +c electron beam. The argument only argument to HALO is fhalo, the fraction +c of the beam that lies in the halo region surrounding the core gaussian. +c The nominal value taken from CASA technical note JLAB-TN-06-048 is 5e-5. +c This card is only effective for electron beam simulations with gxtwist. +c +c fhalo +HALO 5e-5 + +c The following lines control the rate (GHz) of background beam photons +c that are overlayed on each event in the simulation, in addition to the +c particles produced by the standard generation mechanism. BGGATE expects +c two values in ns, which define the window around the trigger time that +c background beam photons are overlaid on the simulation. The value you +c should enter for BGRATE depends on many details of the photon beam: the +c endpoint energy, the low-energy cutoff to be used in generating beam +c photons, the location of coherent edge, the electron beam spot size and +c emittance at the primary collimator, the electron beam current, etc. To +c find the setting that is right for you, follow these steps in order. +c 1) Check the BEAM card above that it has correct values for the electron +c beam energy (field 1) and the low-energy cutoff that you want to use +c in your simulation (field 3). Remember these values. +c 2) Open a new tab in a web browser and enter the following URL, +c http://zeus.phys.uconn.edu/halld/cobrems/ratetool.cgi which displays +c a form containing many fields describing the electron beam and the +c photon beamline. Enter the correct values in all fields in the +c left-most column of parameters. The right column of parameters +c defines the windows over which the tool will compute integrals of +c the beam rate. Set the "end-point" window to span the full range +c from your beamEmin (see step 1 above) to the electron beam endpoint, +c Then click the Plot Spectrum button. After a few seconds, the form will +c respond with a few plots and rate numbers in bold text. Record the +c value given for the "end-point rate". This is your BGRATE value. +c 3) Enter your BGRATE value found in step 2 after BGRATE in the line +c below, and remove any characters before the BGRATE keyword. You are +c now ready to go. If you ever change anything in the beamline geometry +c eg. the collimator diameter, the coherent edge position, or the value +c of beamEmin, do not forget to come back and change your BGRATE. +BGGATE -200. 200. +BGRATE TEMPBGRATE + +c The above cards BGRATE, BGGATE normally cause the simulation to add +c accidental tagger hits to the simulated output record, in addition to +c adding these beam photons to the list of particles to be tracked through +c the detector. If you want the accidental tagger hits to be added to the +c simulated output record but you do not want to track the background +c beam photons, remove the comment in front of BGTAGONLY below. +c NOTICE: If you turn on BGTAGONLY then you might as well raise the +c minimum energy of beam photons being generated to the lower bound of +c the tagger energy range you are interested in, which might be 3 GeV for +c low-intensity running, 7 GeV for high-intensity running, or even 8 GeV +c if you are only interested in the region of the coherent peak. This +c minimum is the third field of the BEAM card above. Remember that if +c you change beamEmin, you also need to change BGRATE to match, as +c described above. +BGTAGONLY TEMPBGTAGONLY + +c The following line controls the uncertainty of the event time reference +c relative to the RF structure of the beam. The event time reference is +c normally set by the level 1 trigger, whose transitions are synced to +c a clock in the trigger processor whose resolution is more coarse than +c the accelerator RF clock. Using a digitized copy of the RF clock signal, +c all times in the event can be synchronized offline to a nearby RF bucket, +c but the RF bucket closest to the trigger time will not in general be the +c one that contained the beam photon that produced the trigger. The spread +c of trigger RF buckets times relative to the interaction RF bucket is +c set by the TREFSIGMA card below, specified as a RMS value in ns. The +c the displacement of the (unknown) true RF bucket from the trigger RF +c bucket will be generated by the simulation in multiples of 2 ns. If +c this line is commented out, a default value of 10ns is assumed. The +c decimal point is significant. +TREFSIGMA 10. + +c The following card seeds the random number generator, though it may be +c overridden if seeds are found in the input file (see below). It must be +c unique for each run. There are two ways to specify the random seed here. +c 1. One argument, must be an integer in the range [1,215] +c 2. Two arguments, must be a pair of positive Integer*4 numbers +c In the first case, one of a limited set of prepared starting seeds is +c chosen from a list. These seeds have been certified to produce random +c sequences that do not repeat within the first 10^9 or so random numbers. +c For cases where more choices are needed, the two-argument form gives +c access to a total of 2^62 choices, with no guarantees about closed loops. +c +c NOTE: If one uses events read from an HDDM file and that file contains +c random number seeds for the event, those seeds will be used, overwriting +c any value(s) specified here. Most event generators do not include the +c seeds. The seeds are written to the output HDDM file though so if one +c uses the output file for input to another invocation of hdgeant(++) +c then the same seeds will be used. You may check for seeds in the input +c file using hddm-xml file.hddm | grep random . +RNDM TEMPRANDOM + +c The following line controls the cutoffs for tracking of particles. +c THIS CARD SHOULD NOT BE USED IN THE PRODUCTION OF MC AND ONLY IN TESTING AND DEVELOPMENT +c CUTS cutgam cutele cutneu cuthad cutmuo bcute bcutm dcute dcutm ppcutm tofmax +c - cutgam = Cut for gammas (0.001 GeV) +c - cutele = Cut for electrons (0.001 GeV) +c - cutneu = Cut for neutral hadrons (0.01 GeV) +c - cuthad = Cut for charged hadrons (0.01 GeV) +c - cutmuo = Cut for muons (0.01 GeV) +c - bcute = Cut for electron brems. (CUTGAM) +c - bcutm = Cut for muon brems. (CUTGAM) +c - dcute = Cut for electron delta-rays. (10 TeV) +c - dcutm = Cut for muon delta-rays. (10 TeV) +c - ppcutm = Cut for e+e- pairs by muons. (0.01 GeV) +c - tofmax = Time of flight cut (1.E+10 sec) +c - gcuts = 5 user words (0.) +c Only the first 5 fields (the ones that start with 'cut') +c are supported by hdgeant4. +cCUTS 1e-4 1e-4 1e-3 1e-3 1e-4 + +c Geant4 introduced the concept of ?a unique cut in range? which allows the user +c to specify the threshold for secondaries production in terms of the range that +c the secondary would have in the medium in which it is generated, rather than +c in terms of a threshold energy. The RANGECUT card below supports the same +c sequence as the first 5 arguments of the CUTS card above, except that the +c values are interpreted as threshold ranges (cm) instead of kinetic energies. +c This card is supported by hdgeant4 only. It is complementary to the CUTS card +c in that CUTS are applied to the corresponding particles when they are being +c tracked, whereas RANGECUTS are used to decide whether they should be +c generated (as secondaries) in the first place. + +cRANGECUTS 0.1 0.1 1.0 1.0 0.1 + +c Geant4 physics models are more comprehensive than the ones provided in G3, +c and one consequence of this is that some particles (eg. neutrons) seem to go +c on and on in Geant4 for lifetimes of many seconds in some cases. The following +c card tells the simulation to stop tracks that are still being followed after +c this much time (seconds) has gone by. This card is only supported by hdgeant4. +c There is an equivalent feature in hdgeant3 (see field 12 of CUTS card above) +c but normally it is not needed to get efficient operation, so it is almost +c never needed. + +TOFMAX 1e-5 + +c The following line controls a set of generic flags that are used to +c control aspects of the simulation generally related to debugging. +c For normal debugging runs these should be left at zero (or omitted). +c At present the following functionality is defined (assumes debug on). +c SWIT(2) = 0 turns off trajectory tracing +c = 2 turns on step-by-step trace during tracking (verbose!) +c = 3 turns on trajectory plotting after tracking is done +c = 4 turns on step-by-step plotting during tracking +c SWIT(3) = 1 stores track trajectories for plotting after tracking is done +c SWIT(4) = 0 trace trajectories of all particle types +c = 3 trace only charged particle trajectories +c This card is only supported by hdgeant3. +SWIT 0 0 0 0 0 0 0 0 0 0 + +c The following card enables the GelHad package (from BaBar) +c on/off ecut scale mode thresh +c This card is only supported by hdgeant3. +GELH 1 0.2 1.0 4 0.160 + +c The following card selects the hadronic physics package +c HADR 0 no hadronic interactions +c HADR 1 GHEISHA only (default) +c HADR 2 GHEISHA only, with no generation of secondaries +c HADR 3 FLUKA (with GHEISHA for neutrons below 20MeV) +c HADR 4 FLUKA (with MICAP for neutrons below 20MeV) +HADR 1 + +c The following cards are needed if optical photons are being +c being generated and tracked in the simulation. The CKOV directive +c enables Cerenkov generation in materials for which the refractive +c index table has been specified. The LABS card enables absorption +c of optical photons. The ABAN directive controls a special feature +c of Geant which allows it to "abandon" tracking of charged particles +c once their remaining range drops below the distance to the next +c discrete interaction or geometric boundary. Particles abandoned +c during tracking are stopped immediately and dump all remaining energy +c where they lie. The remaining energy is dumped in the correct volume +c so this is OK in most cases, but it can cut into the yield of +c Cerenkov photons (eg. in a lead glass calorimeter) at the end of +c a particle track. If this might be important, set ABAN to 0. +CKOV TEMPCKOV +LABS 1 + +c The following card prevents GEANT tracking code from abandoning the +c tracking of particles near the end of their range, once it determines +c that their fate is just to stop (i.e. electrons and protons). This +c behaviour is normal in most cases, but in the case of Cerenkov light +c generation it leads to an underestimate for the yields. +c ABAN 1 abandon stopping tracks (default) +c ABAN 0 do not abandon stopping tracks +c This card is only supported by hdgeant3. +ABAN 0 + +c The following card sets up the simulation to perform debugging on +c a subset of the simulated events. +c DEBUG first last step +c - first (int) = event number of first event to debug +c - last (int) = event number of last event to debug +c - step (int) = only debug one event every step events +DEBU 1 10 1000 + +c The following card can be used to turn off generation of secondary +c particles in the simulation, ordinarily it should be 0 (or omitted). +NOSECONDARIES TEMPNOSECONDARIES + +c The following card tells the simulation to store particle trajectories +c in the event output stream. This output can be verbose, use with caution. +c The value set here determines the amount of output recorded: +c +c TRAJECTORIES = 0 don't store trajectory info +c TRAJECTORIES = 1 store birth and death points of primary tracks +c TRAJECTORIES = 2 store birth and death points of all particles +c TRAJECTORIES = 3 store full trajectory of primary tracks +c TRAJECTORIES = 4 store full trajectory of primary tracks and birth/death points of secondaries +c TRAJECTORIES = 5 store full trajectory for all particles +c +TRAJECTORIES 0 + +c The following tracking parameters are defined for each tracking medium +c TMAXFD (REAL) maximum angular deviation due to the magnetic field +c permitted in one step (degrees) +c DEEMAX (REAL) maximum fractional energy loss in one step (0< DEEMAX <=0.1) +c STEMAX (REAL) maximum step permitted (cm) +c STMIN (REAL) minimum value for the maximum step imposed by energy loss, +c multiple scattering, Cerenkov or magnetic field effects (cm) +c Normally they are assigned appropriate values calculated automatically by +c Geant when the geometry is defined, overwriting the values declared by +c the user code in the GSTMED() call. Users who know what they are doing can +c force Geant to instead use the values passed in the arguments to GSTMED() +c by removing the comment in front of the following card. Any parameters with +c zero values are still assigned automatic values even when AUTO is turned off. +c This card is only supported by hdgeant3. +cAUTO 0 + +c The magnetic field map is accessed through the HDGEOMETRY library +c so that the same map can be used for both simulation and reconstruction. +c There are multiple map types and for each type, more than one map may +c exist. The map types consist of the default type of "CalibDB", the +c constant type of "Const", the spoiled field type of "Spoiled", or +c "NoField" if the simulation should be performed with the solenoid off. +c The type is set using the BFIELDTYPE card. If no BFIELDTYPE card is +c present, then no the default type "CalibDB" is used. +c The specific parameters used for the field can be specified using the +c BFIELDMAP card. If undefined, then the default that is hardcoded into +c the HDGEOMETRY library is used. Note that these correspond to the +c similarly named configuration parameters used in the reconstruction, +c the difference being that underscores are not allowed here. To +c specify the values to the reconstruction code used here, use the +c -PBFIELD_TYPE=CalibDB and -PBFIELD_MAP=Magnets/Solenoid/solenoid_1500 +cBFIELDMAP 'Magnets/Solenoid/solenoid_1200A_poisson_20140520' +cBFIELDTYPE 'NoField' + +c The pair spectrometer magnetic field map can also be accessed through the +c HDGGEOMTRY library in a similar fashion to the solenoid field. The cards +c PSBFIELDMAP and PSBFIELDTYPE correspond in form and meaning to BFIELDMAP +c and BFIELDTYPE, except that only "Const" and "CalibDB" (default) are +c supported values for PSBFIELDTYPE. To specify the values used here to +c the reconstruction code, use options -PPSBFIELD_TYPE=CalibDB and +c -PPSBFIELD_MAP=Magnets/PairSpectrometer/PS_1.8T_20150513_test +c on the jana command line. +cPSBFIELDMAP 'Magnets/PairSpectrometer/PS_1.8T_20150513_test' +cPSBFIELDTYPE 'Const' + +c Use this card to enable/disable ( SAVEHITS 1/0 ) writing events with no +c hits in the detector to the hddm output file. Default value is 0. + SAVEHITS 0 + +c This card is used to enable/disable ( SHOWERS_IN_COL 1/0 ) simulation of +c showers in the primary and secondary collimators placed in the collimator cave. +c The default value is set to 0. + SHOWERSINCOL 0 + +c This card enables/disables (DRIFTCLUSTERS 1/0) simulation of electron +c clusters within a drift cell in the FDC or the CDC +c The default value is 0. + DRIFTCLUSTERS 0 + +c The following cards allow one to switch on/off some physics processes in GEANT: +c MULS 0 no multiple scattering +c 1 Moliere or Coulomb scattering (default) +c +c BREM 0 no bremsstrahlung +c 1 bremsstrahlung (default) +c +c COMP 0 no Compton +c 1 Compton scattering (default) +c +c PAIR 0 no pair production +c 1 pair production (default) +c +c LOSS 0 (controls energy losses) no energy loss +c 1 delta-rays are produced above the threshold. Reduced fluctuations from +c delta-rays below the threshold are added to the energy losses. The threshold +c energies for delta-ray production can be set using the CUTS card (see above). +c The fields 'dcute' and 'dcutm' in the CUTS card correspond to energy thresholds +c for electron and muon delta-rays, respectively. The default energy threshold +c value is 100 keV (default see uginit.F 12/16/2011 DL). +c 2 no delta-rays are produced. Complete fluctuations are calculated . +c +c DCAY 0 no decay in flight +c 1 decay in flight with generation of secondaries (default) +c 2 decay in flight without generation of secondaries +c +c DRAY 0 no delta ray production +c 1 delta ray production with generation of secondaries (default) +c 2 delta ray production without generation of secondaries From 7de995744fc5f0349a89553c570e65f051be29a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cgyangchung=E2=80=9D?= <“gyangchung13@gmail.com”> Date: Tue, 2 Dec 2025 16:41:42 -0500 Subject: [PATCH 8/9] hddm file named with the standard name --- MakeMC.csh | 2 +- MakeMC.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/MakeMC.csh b/MakeMC.csh index 1c4670d..b298ef4 100755 --- a/MakeMC.csh +++ b/MakeMC.csh @@ -1549,7 +1549,7 @@ if ( "$GENR" != "0" ) then #run generation echo $runGen gen_tcs_bh $STANDARD_NAME.conf $runGen gen_tcs_bh $STANDARD_NAME.conf set generator_return_code=$status - #mv $outFile $STANDARD_NAME.hddm + mv $outFile $STANDARD_NAME.hddm else if ( "$GENERATOR" == "gen_ee_hb" ) then echo gen_ee_hb -N$RUN_NUMBER -n$EVT_TO_GEN echo $runGen gen_ee_hb -N$RUN_NUMBER -n$EVT_TO_GEN diff --git a/MakeMC.sh b/MakeMC.sh index 878c90b..06f75ca 100755 --- a/MakeMC.sh +++ b/MakeMC.sh @@ -1589,7 +1589,7 @@ if [[ "$GENR" != "0" ]]; then # run generation $runGen gen_tcs_bh $STANDARD_NAME.conf generator_return_code=$? - #mv $outFile $STANDARD_NAME.hddm + mv $outFile $STANDARD_NAME.hddm elif [[ "$GENERATOR" == "gen_ee_hb" ]]; then echo $runGen gen_ee_hb -N$RUN_NUMBER -n$EVT_TO_GEN From f86992cdba25ed5b00c84f77a9c5fd7e3e08aeea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cgyangchung=E2=80=9D?= <“gyangchung13@gmail.com”> Date: Tue, 2 Dec 2025 16:55:49 -0500 Subject: [PATCH 9/9] default GCONTROL was not use --- Generators/gen_tcs_bh/run/MC_gen_tcs_bh.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Generators/gen_tcs_bh/run/MC_gen_tcs_bh.config b/Generators/gen_tcs_bh/run/MC_gen_tcs_bh.config index 2ee321e..39d9b28 100644 --- a/Generators/gen_tcs_bh/run/MC_gen_tcs_bh.config +++ b/Generators/gen_tcs_bh/run/MC_gen_tcs_bh.config @@ -2,7 +2,7 @@ #CUSTOM_MAKEMC=use-this-script-instead CUSTOM_MAKEMC=/w/halld-scshelf2101/home/gchung/tcs_sim2/gluex_MCwrapper/MakeMC.sh #CUSTOM_GCONTROL=use-this-Gcontrol-instead -CUSTOM_GCONTROL=/w/halld-scshelf2101/home/gchung/tcs_sim2/gluex_MCwrapper/Generators/gen_tcs_bh/run/Gcontrol.in +#CUSTOM_GCONTROL=/w/halld-scshelf2101/home/gchung/tcs_sim2/gluex_MCwrapper/Generators/gen_tcs_bh/run/Gcontrol.in #======================================================================== #VARIATION=mc calibtime=timegoeshere #set your jana calib context here with or without calibtime Default is variation=mc