Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:18:28

0001 #!/bin/bash
0002 set -Eu # no pipefail to allow head to cut pipe
0003 trap 's=$?; echo "$0: Error on line "$LINENO": $BASH_COMMAND"; exit $s' ERR
0004 IFS=$'\n\t'
0005 
0006 out=${1?Specify output}
0007 file=${2?Specify filename}
0008 ext=${3?Specify extension}
0009 nevents=${4:-} # allow empty
0010 n_lines_per_event=${5:-} # allow empty
0011 
0012 xrootd="root://dtn-eic.jlab.org//work/eic2/EPIC/EVGEN"
0013 
0014 # if hepmc3.tree.root file
0015 if [[ "${ext}" =~ ^hepmc3\.tree.root$ ]] ; then
0016   # get entries from xrootd
0017   nevents=$(root -l -b -q ${xrootd}/${file}.${ext} -e 'cout << hepmc3_tree->GetEntries() << endl;' | tail -n1)
0018   n_lines_per_event=0
0019 elif [[ "${ext}" =~ ^steer$ ]] ; then 
0020   true
0021 else 
0022   echo "Error: Input extension is not recognized. Only '.hepmc3.tree.root' or '.steer' format is accepted. Please see the input pre-processing policy https://eic.github.io/epic-prod/documentation/input_preprocessing.html"
0023   exit -1
0024 fi
0025 
0026 # output
0027 echo "$file,$ext,$nevents,$n_lines_per_event" | tee -a "${out}"