#!/bin/bash

# This is a local wcdo rc file for project myproj.
# It was initally generated but is recomended for customizing by you, dear user.
# It is included at the end of the main RC files.
    
# These are optional but required if wcdo-mrb-* commands are to be used.
wcdo_mrb_project_name="larsoft"
wcdo_mrb_project_version="v09_25_00"
wcdo_mrb_project_quals="e20:prof"

source /cvmfs/dune.opensciencegrid.org/products/dune/setup_dune.sh

#export UPS_OVERRIDE='-H Linux64bit+5.0-2.17-sl7-6'
#export UPS_OVERRIDE='-H Linux64bit+5.4-2.17-sl7-6'
export UPS_OVERRIDE='-H Linux64bit+3.10-2.17'

setup dunetpc $wcdo_mrb_project_version -q $wcdo_mrb_project_quals
#setup hdf5 v1_10_5 -q e17
#setup h5cpp v1_10_4_1
#
wcdo-ups-init
path-prepend $wcdo_ups_products PRODUCTS


# this include setup larsoft
unsetup mrb
setup mrb -o
wcdo-mrb-init

# wire-cell toolkit
setup wirecell wctdev -q $wcdo_mrb_project_quals
export WIRECELL_PATH=/wcdo/src/wct/cfg:/home/yuhw/wc/larsoft855/share/wirecell/data/
#optional: wcdo-wirecell-path default
echo WIRECELL_PATH=$WIRECELL_PATH

# other local products, e.g. larwirecell
mrbsetenv
mrbslp # setup local products
export FHICL_FILE_PATH=$WIRECELL_PATH:$FHICL_FILE_PATH

export CETPKG_BUILD=$MRB_BUILDDIR
export CETPKG_SOURCE=$MRB_SOURCE

unsetup git
setup git v2_20_1
setup gojsonnet v0_17_0 -q e20
unsetup boost
setup boost v1_75_0 -q e20:prof
unsetup eigen
setup eigen v3_4_0

# pcbro
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/yuhw/sl7/pcbro/lib64
export WIRECELL_PATH=$WIRECELL_PATH:/home/yuhw/wc/VD/pcbro/cfg/

# jsonnet
export PATH=/home/yuhw/go/jsonnet/bin:$PATH
#export PATH=/home/yuhw/jsonnet/jsonnet:$PATH
#export LD_LIBRARY_PATH=/home/yuhw/jsonnet/jsonnet:$LD_LIBRARY_PATH

# nvidia, cuda, torch
export     LD_LIBRARY_PATH=/home/yuhw/jsonnet/jsonnet:$LD_LIBRARY_PATH
export     LD_LIBRARY_PATH=/.singularity.d/libs:$LD_LIBRARY_PATH
export     LD_LIBRARY_PATH=/usr/local/cuda-11.2/lib64:$LD_LIBRARY_PATH
#export     LD_LIBRARY_PATH=/home/yuhw/torch/libtorch/lib:$LD_LIBRARY_PATH
#export     LD_LIBRARY_PATH=/home/yuhw/torch/backup/libtorch-cxx11-abi-static-with-deps-1.3.1/lib:$LD_LIBRARY_PATH
#export     LD_LIBRARY_PATH=/home/yuhw/torch/backup/libtorch-cxx11-abi-shared-with-deps-1.3.1/lib:$LD_LIBRARY_PATH
export PATH=/usr/local/cuda-11.2/bin:$PATH

# go
export PATH=$PATH:/usr/local/go/bin

# x11
export DISPLAY=:1001
export XAUTHORITY=/home/yuhw/.Xauthority

# prompt
export PS1='[dune925]$(pwd)\n$'

# WCT tests
export SSL_CERT_FILE=/etc/ssl/certs/ca-bundle.crt
export PATH=/home/yuhw/wc/larsoft925/src/wct/test/bats/bin:$PATH
export BATS_LIB_PATH=/home/yuhw/wc/larsoft925/src/wct/test
source /home/yuhw/sl7/wire-cell-python/wcpy/bin/activate
unsetup numpy

# utilities
bind '"\e[A":history-search-backward' #PageUp
bind '"\e[B":history-search-forward' #PageDown
set autolist
set autoexpand
alias ls='ls --color=auto'
alias ll='ls -lh'
alias vi='vim'
find-fhicl(){
  fhicl_file=$1
  for path in `echo $FHICL_FILE_PATH  | sed -e 's/:/\n/g'`;do find $path -name "$fhicl_file"  2>/dev/null;done
}
list ()
{
    echo $1 | tr ':' '\n'
}
