|
||||
File indexing completed on 2025-01-18 10:18:27
0001 #!/bin/bash 0002 source strict-mode.sh 0003 0004 ## ============================================================================= 0005 ## Run a single instance of the DVMP generator (lAger) 0006 ## Runs in 5 steps: 0007 ## 1. Parse the command line and setup the environment 0008 ## 2. Check if we can load the requested file from the cache 0009 ## 3. Create our configuration fil 0010 ## 4. Run the actual generator 0011 ## 5. Finalize 0012 ## ============================================================================= 0013 0014 ## make sure we launch this script from the project root directory 0015 PROJECT_ROOT="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"/../.. 0016 pushd ${PROJECT_ROOT} 0017 0018 0019 ## ============================================================================= 0020 ## Step 1: Setup the environment variables 0021 ## 0022 ## First parse the command line flags. 0023 ## This sets the following environment variables: 0024 ## - CONFIG: The specific generator configuration 0025 ## - EBEAM: The electron beam energy 0026 ## - PBEAM: The ion beam energy 0027 ## - DECAY: The decay particle for the generator 0028 export REQUIRE_DECAY=1 0029 source parse_cmd.sh $@ 0030 0031 ## To run the generator, we need the following global variables: 0032 ## 0033 ## - LOCAL_PREFIX: Place to cache local packages and data 0034 ## - JUGGLER_N_EVENTS: Number of events to process 0035 ## - JUGGLER_RNG_SEED: Random seed for event generation. 0036 ## 0037 ## You can read common_bench repo for more in-depth explanations of the variables 0038 ## and how they can be controlled. 0039 0040 ## We also need the following benchmark-specific variables: 0041 ## 0042 ## - BENCHMARK_TAG: Unique identified for this benchmark process. 0043 ## - INPUT_PATH: Path for generator-level input to the benchmarks 0044 ## - TMP_PATH: Path for temporary data (not exported as artifacts) 0045 ## 0046 ## You can read dvmp/env.sh for more in-depth explanations of the variables. 0047 source benchmarks/Exclusive-Diffraction-Tagging/dvmp/env.sh 0048 0049 ## Get a unique file name prefix based on the configuration options 0050 GEN_TAG=gen-${CONFIG}_${DECAY}_${JUGGLER_N_EVENTS} ## Generic file prefix 0051 0052 ## ============================================================================= 0053 ## Step 2: Check if we really need to run, or can use the cache. 0054 if [ -f "${INPUT_PATH}/${GEN_TAG}.hepmc" ]; then 0055 echo "Found cached generator output for $GEN_TAG, no need to rerun" 0056 exit 0 0057 fi 0058 0059 echo "Generator output for $GEN_TAG not found in cache, need to run generator" 0060 0061 ## ============================================================================= 0062 ## Step 3: Create generator configuration file 0063 0064 ## process decay info 0065 BRANCHING= 0066 DECAY_PID= 0067 if [ $DECAY = "electron" ]; then 0068 BRANCHING="0.05971" 0069 DECAY_PID="11" 0070 elif [ $DECAY = "muon" ]; then 0071 BRANCHING="0.05961" 0072 DECAY_PID="13" 0073 fi 0074 0075 ## generate the config file for this generator setup 0076 CONFIG_IN="benchmarks/${BENCHMARK_TAG}/generator/${CONFIG}.json.in" 0077 echo "Creating generator configuration file ${GEN_TAG}.json" 0078 if [ ! -f ${CONFIG_IN} ]; then 0079 echo "ERROR: cannot find master config file ${CONFIG_IN}" 0080 exit 1 0081 fi 0082 sed "s/@TAG@/${GEN_TAG}/" $CONFIG_IN | \ 0083 sed "s/@EBEAM@/${EBEAM}/" | \ 0084 sed "s/@PBEAM@/${PBEAM}/" | \ 0085 sed "s/@DECAY_LEPTON@/${DECAY_PID}/" | \ 0086 sed "s/@BRANCHING@/${BRANCHING}/" > ${TMP_PATH}/${GEN_TAG}.json 0087 0088 ## ============================================================================= 0089 ## Step 4: Run the event generator 0090 echo "Running the generator" 0091 lager -r ${JUGGLER_RNG_SEED} \ 0092 -c ${TMP_PATH}/${GEN_TAG}.json \ 0093 -e ${JUGGLER_N_EVENTS} \ 0094 -o ${TMP_PATH} 0095 if [ "$?" -ne "0" ] ; then 0096 echo "ERROR running lAger" 0097 exit 1 0098 fi 0099 0100 ## ============================================================================= 0101 ## Step 5: Finally, move relevant output into the artifacts directory and clean up 0102 echo "Moving generator output into ${INPUT_PATH}" 0103 for ext in hepmc json log root ; do 0104 mv ${TMP_PATH}/*.${GEN_TAG}.*.${ext} ${INPUT_PATH}/${GEN_TAG}.${ext} 0105 done 0106 ## this step only matters for local execution 0107 echo "Cleaning up" 0108 rm ${TMP_PATH}/${GEN_TAG}.json 0109 0110 ## ============================================================================= 0111 ## All done! 0112 echo "$BENCHMARK_TAG event generation complete"
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |