Skip to content
Snippets Groups Projects
emcal_electrons.sh 1.54 KiB
Newer Older
  • Learn to ignore specific revisions
  • #!/bin/bash
    
    
    
    if [[ ! -n  "${JUGGLER_DETECTOR}" ]] ; then 
      export JUGGLER_DETECTOR="topside"
    fi
    
    if [[ ! -n  "${JUGGLER_N_EVENTS}" ]] ; then 
      export JUGGLER_N_EVENTS=1000
    fi
    
    
    export JUGGLER_FILE_NAME_TAG="emcal_uniform_electrons"
    export JUGGLER_GEN_FILE="${JUGGLER_FILE_NAME_TAG}.hepmc"
    
    export JUGGLER_SIM_FILE="sim_${JUGGLER_FILE_NAME_TAG}.root"
    export JUGGLER_REC_FILE="rec_${JUGGLER_FILE_NAME_TAG}.root"
    
    
    echo "JUGGLER_N_EVENTS = ${JUGGLER_N_EVENTS}"
    echo "JUGGLER_DETECTOR = ${JUGGLER_DETECTOR}"
    
    
    git clone https://eicweb.phy.anl.gov/EIC/datasets.git datasets
    
    root -b -q "datasets/emcal_electrons.cxx(${JUGGLER_N_EVENTS}, \"${JUGGLER_FILE_NAME_TAG}.hepmc\")"
    
    
    git clone https://eicweb.phy.anl.gov/EIC/detectors/${JUGGLER_DETECTOR}.git
    mkdir ${JUGGLER_DETECTOR}/build
    pushd ${JUGGLER_DETECTOR}/build
    cmake ../. -DCMAKE_INSTALL_PREFIX=/usr/local && make -j30 install
    popd
    
    pushd ${JUGGLER_DETECTOR}
    ls -l
    # run geant4 simulations
    npsim --runType batch \
    
          --numberOfEvents ${JUGGLER_N_EVENTS} \
          --compactFile ${JUGGLER_DETECTOR}.xml \
          --inputFiles ../${JUGGLER_FILE_NAME_TAG}.hepmc \
          --outputFile  ${JUGGLER_SIM_FILE}
    # Need to figure out how to pass file name to juggler from the commandline
    
    xenv -x /usr/local/Juggler.xenv gaudirun.py ../ecal/options/example_crystal.py
    
    
    pwd
    mkdir -p results
    
    root -b -q "./scripts/makeplot.C(\"${JUGGLER_DETECTOR}/${JUGGLER_REC_FILE}\")"
    
    mkdir -p sim_output
    cp "${JUGGLER_DETECTOR}/${JUGGLER_REC_FILE}" sim_output/.
    cp "${JUGGLER_DETECTOR}/${JUGGLER_SIM_FILE}" sim_output/.