diff --git a/config/env.sh b/config/env.sh index 95b30d84b2897904d9e08990eb2cf3f13b396687..e2b34a2420a848ec149ba62300ea5ffe01151d08 100755 --- a/config/env.sh +++ b/config/env.sh @@ -23,3 +23,6 @@ export DETECTOR_PREFIX=`realpath ${DETECTOR_PREFIX}` ## setup detector paths export LD_LIBRARY_PATH=${DETECTOR_PREFIX}/lib:$LD_LIBRARY_PATH export DETECTOR_SOURCE_PATH=${DETECTOR_PREFIX}/src + +## setup root results artifact path +export RESULTS_PATH=`realpath results` diff --git a/dvmp/config.yml b/dvmp/config.yml index 056511c04317251aeeb45fe1077bd5ed795f948f..e36716efae00da362284d39af598a428429ddb89 100644 --- a/dvmp/config.yml +++ b/dvmp/config.yml @@ -1,4 +1,5 @@ dvmp:jpsi_central:generate: + image: eicweb.phy.anl.gov:4567/monte_carlo/lager/lager:unstable stage: generate needs: [] timeout: 1 hours @@ -6,6 +7,7 @@ dvmp:jpsi_central:generate: key: files: - dvmp/generator/jpsi_central.json + - dvmp/scripts/jpsi_central-generate.sh prefix: "$CI_COMMIT_REF_SLUG" paths: - results/dvmp @@ -13,9 +15,7 @@ dvmp:jpsi_central:generate: paths: - results script: - - echo "stub for generator" - - mkdir -p results/dvmp - - touch results/dvmp/event-stub + - ./dvmp/scripts/jpsi_central-generate.sh dvmp:jpsi_central:process: stage: process @@ -39,7 +39,7 @@ dvmp:jpsi_central:dummy_test: dependencies: - dvmp:jpsi_central:process script: - - dvmp/dummy_test.sh + - dvmp/scripts/dummy_test.sh dvmp:jpsi_central:dummy_test2: stage: analyze @@ -47,7 +47,7 @@ dvmp:jpsi_central:dummy_test2: dependencies: - dvmp:jpsi_central:process script: - - dvmp/dummy_test2.sh + - dvmp/scripts/dummy_test2.sh dvmp:jpsi_central:dummy_fail_test: stage: analyze @@ -56,7 +56,7 @@ dvmp:jpsi_central:dummy_fail_test: - dvmp:jpsi_central:process allow_failure: true script: - - dvmp/dummy_fail_test.sh + - dvmp/scripts/dummy_fail_test.sh dvmp:results: stage: collect diff --git a/dvmp/generator/config_jpsi_decay.sh b/dvmp/generator/config_jpsi_decay.sh new file mode 100755 index 0000000000000000000000000000000000000000..81016e726b3a12b6b03921d97197784a038ac616 --- /dev/null +++ b/dvmp/generator/config_jpsi_decay.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +## Generates different configurations from the master configuration +## for both electron and muon decay channels + +echo "Generating generator configuration files for J/psi -> e+e- and mu+mu-" + +CONFIG= + +POSITIONAL=() +while [[ $# -gt 0 ]] +do + key="$1" + + case $key in + -c|--config) + CONFIG="$2" + shift # past argument + shift # past value + ;; + *) # unknown option + echo "unknown option" + exit 1 + shift # past argument + ;; + esac +done +set -- "${POSITIONAL[@]}" # restore positional parameters + +if [[ -z ${CONFIG} ]] ; then + echo " ERROR: need argument -c/--config <config file> " + exit 1 +fi +if [[ ! -f ${CONFIG} ]] ; then + echo " ERROR: cannot find config input file ${CONFIG}" + exit 1 +fi + +CONFIG_BASE=`basename ${CONFIG} .json.in` + +echo "Generating ${CONFIG_BASE}_el.json" +sed "s/@TAG@/electron/" ${CONFIG} | \ + sed "s/@DECAY_LEPTON@/11/" | sed "s/@BRANCHING@/0.05971/" > ${CONFIG_BASE}_el.json +echo "Generating ${CONFIG_BASE}_mu.json" +sed "s/@TAG@/muon/" ${CONFIG} | \ + sed "s/@DECAY_LEPTON@/13/" | sed "s/@BRANCHING@/0.05961/" > ${CONFIG_BASE}_mu.json + +echo "Configuration generation finished." diff --git a/dvmp/generator/jpsi_central.json b/dvmp/generator/jpsi_central.json deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/dvmp/generator/jpsi_central.json.in b/dvmp/generator/jpsi_central.json.in new file mode 100644 index 0000000000000000000000000000000000000000..989bac5508f680ba16fb75ba6bcf61130f110313 --- /dev/null +++ b/dvmp/generator/jpsi_central.json.in @@ -0,0 +1,90 @@ +{ + "mc" : { + "type" : "eic", + "tag" : "@TAG@", + "events" : "10000", + "generator" : { + "type" : "ep-2gluon", + "vertex" : {"type" : "origin"}, + "beam": { + "lepton" : { + "type" : "constant", + "particle_type" : "e-", + "dir" : [ "0", "0", "-1" ], + "energy" : "10.0" + }, + "ion" : { + "type" : "constant", + "particle_type" : "proton", + "dir" : [ "0", "0", "1" ], + "energy" : "100" + } + }, + "target": {"type": "primary"}, + "photon" : { + "type" : "vphoton", + "y_range" : [ "0.01", "1" ], + "Q2_range": [ "1.0", "1000"] + }, + "process_0" : { + "type" : "brodsky_2vmX", + "vm_type" : "J/psi", + "recoil_type" : "proton", + "photo_b" : "4.50", + "photo_c2g" : "6.0e4", + "photo_c3g" : "0.0", + "R_vm_c" : "2.164", + "R_vm_n" : "2.131", + "dipole_n" : "2.575", + "note": "b from the H1 paper, c2g adjusted to fit HERA points" + } + }, + "detector" : { + "type" : "composite", + "components" : { + "barrel" : { + "id" : "1", + "name" : "barrel", + "type" : "cone", + "acceptance" : { + "acceptance" : "1.0", + "p" : [ "1", "1000" ], + "theta" : [ "45", "135" ], + "pid" : [ "e+", "e-", "mu+", "mu-" ] + }, + "smearing" : {"p" : "0.0", "theta" : "0.0", "phi" : "0.0"} + }, + "endcap_fw" : { + "id" : "2", + "name" : "endcap_fw", + "type" : "cone", + "acceptance" : { + "acceptance" : "1.0", + "p" : [ "1", "1000" ], + "theta" : [ "10", "45" ], + "pid" : [ "e+", "e-", "mu+", "mu-" ] + }, + "smearing" : {"p" : "0.0", "theta" : "0.0", "phi" : "0.0"} + }, + "endcap_bw" : { + "id" : "3", + "name" : "endcap_bw", + "type" : "cone", + "acceptance" : { + "acceptance" : "1.0", + "p" : [ "1", "1000" ], + "theta" : [ "135", "170" ], + "pid" : [ "e+", "e-", "mu+", "mu-" ] + }, + "smearing" : {"p" : "0.0", "theta" : "0.0", "phi" : "0.0"} + } + } + }, + "reconstruction" : {"require_leading" : "true"}, + "decay" : { + "vm_decay_lepton_type" : "@DECAY_LEPTON@", + "vm_branching_ratio" : "@BRANCHING@", + "do_radiative_decay_vm" : "true" + } + } +} diff --git a/dvmp/dummy_fail_test.sh b/dvmp/scripts/dummy_fail_test.sh similarity index 100% rename from dvmp/dummy_fail_test.sh rename to dvmp/scripts/dummy_fail_test.sh diff --git a/dvmp/dummy_test.sh b/dvmp/scripts/dummy_test.sh similarity index 100% rename from dvmp/dummy_test.sh rename to dvmp/scripts/dummy_test.sh diff --git a/dvmp/dummy_test2.sh b/dvmp/scripts/dummy_test2.sh similarity index 100% rename from dvmp/dummy_test2.sh rename to dvmp/scripts/dummy_test2.sh diff --git a/dvmp/scripts/jpsi_central-generate.sh b/dvmp/scripts/jpsi_central-generate.sh new file mode 100755 index 0000000000000000000000000000000000000000..47168ddb72b30cba1df79e94fc1a3ff4c5b9d331 --- /dev/null +++ b/dvmp/scripts/jpsi_central-generate.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +## Init the environment +source config/env.sh + +## Generator configuration +export NEVENTS=100 +export RNG_SEED=1 + +export DVMP_RESULTS_PATH=$RESULTS_PATH/dvmp + +export FNAME_EL="${DVMP_RESULTS_PATH}/jpsi_central_el-gen" +export FNAME_MU="${DVMP_RESULTS_PATH}/jpsi_central_mu-gen" + +## Check if we already have our MC files in the cache +if [ -f "${FNAME_EL}.hepmc" ] && [ -f "${FNAME_MU}.hepmc"]; then + echo "Found cached generator output, no need to rerun" +else + echo "Need to generate our event sample" + pushd dvmp + + ## First generate our actual configuration files. We run for both electron + ## and muon configurations + ./generator/config_jpsi_decay.sh -c generator/jpsi_central.json.in + ## This generates our jpsi_central_el.json and jpsi_central_mu.json files + + ## Now we can run the generator in parallel for both configurations + echo "Running the generator" + lager -r ${RNG_SEED} -c jpsi_central_el.json -e ${NEVENTS} -o . & + lager -r ${RNG_SEED} -c jpsi_central_mu.json -e ${NEVENTS} -o . & + wait + + ## Finally, we move our output into the artifacts directory + echo "Moving generator output into ${DVMP_RESULTS_PATH}" + mkdir -p ${DVMP_RESULTS_PATH} + mv *electron*.json ${FNAME_EL}.json + mv *electron*.root ${FNAME_EL}.root + mv *electron*.hepmc ${FNAME_EL}.hepmc + mv *electron*.log ${FNAME_EL}.log + mv *muon*.json ${FNAME_MU}.json + mv *muon*.root ${FNAME_MU}.root + mv *muon*.hepmc ${FNAME_MU}.hepmc + mv *muon*.log ${FNAME_MU}.log +fi