Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-22 08:40:52

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//volatile/eic/EPIC/EVGEN"
0013 
0014 # if hepmc3.tree.root file
0015 if [[ "${ext}" =~ ^hepmc3\.tree.root$ ]] ; then
0016   # if prescribed nevents > 0, use it; otherwise get actual entries from xrootd
0017   if [[ -n "${nevents}" ]] && [[ "${nevents}" -gt 0 ]] ; then
0018     # use prescribed value from CSV
0019     true
0020   else
0021     # get entries from xrootd
0022     nevents=$(root -l -b -q ${xrootd}/${file}.${ext} -e 'cout << hepmc3_tree->GetEntries() << endl;' | tail -n1)
0023   fi
0024   n_lines_per_event=0
0025 elif [[ "${ext}" =~ ^steer$ ]] ; then
0026   true
0027 else
0028   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"
0029   exit -1
0030 fi
0031 
0032 # output
0033 echo "$file,$ext,$nevents,$n_lines_per_event" | tee -a "${out}"