Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-05-18 07:43:06

0001 #!/bin/bash
0002 set -e
0003 
0004 # check environment
0005 if [ -z "$DETECTOR_PATH" ]; then
0006   echo "ERROR: source environ.sh first"
0007   exit 1
0008 fi
0009 
0010 # default output file
0011 geoDir=geo
0012 outputFile=$geoDir/detector_geometry.root
0013 mkdir -p $geoDir
0014 
0015 # usage
0016 function usage {
0017   echo """
0018 USAGE:
0019   $0 [MODE] [OPTIONS]...
0020 
0021   MODES: (one required)
0022     -d  dRICH only
0023     -p  pfRICH only
0024     -m  mRICH only
0025     -e  full EPIC detector
0026     -a  full EPIC detector, arches configuration
0027     -b  full EPIC detector, brycecanyon configuration
0028     -c <compact_file>
0029         custom compact file
0030      
0031     For -e,-d,-p, compact files are assumed to be at
0032      \$DETECTOR_PATH = $DETECTOR_PATH
0033      (rendered by build.sh epic)
0034 
0035   OPTIONS
0036     -o <output_root_file>
0037         Output ROOT file with TGeo geometry (view with jsroot)
0038         [ default = $outputFile ]
0039 
0040   """
0041   exit 2
0042 }
0043 if [ $# -eq 0 ]; then usage; fi
0044 
0045 # parse options
0046 while getopts "hdpmeabc:o:" opt; do
0047   case $opt in
0048     h|\?) usage ;;
0049     d) compactFile="${DETECTOR_PATH}/${DETECTOR}_drich_only.xml" ;;
0050     p) compactFile="${DETECTOR_PATH}/${DETECTOR}_pfrich_only.xml" ;;
0051     m) compactFile="${DETECTOR_PATH}/${DETECTOR}_mrich_only.xml" ;;
0052     e) compactFile="${DETECTOR_PATH}/${DETECTOR}.xml" ;;
0053     a) compactFile="${DETECTOR_PATH}/${DETECTOR}_arches.xml" ;;
0054     b) compactFile="${DETECTOR_PATH}/${DETECTOR}_brycecanyon.xml" ;;
0055     c) compactFile=$OPTARG ;;
0056     o) outputFile=$OPTARG ;;
0057   esac
0058 done
0059 echo """
0060 compactFile = $compactFile
0061 outputFile  = $outputFile
0062 """
0063 if [ -z "$compactFile" ]; then
0064   echo "ERROR: specify MODE"
0065   usage
0066   exit 1
0067 fi
0068 
0069 # produce geometry root file
0070 geoConverter -compact2tgeo -input $compactFile -output $outputFile
0071 echo ""
0072 echo "produced $outputFile"
0073 echo " -> open it with jsroot to view the geometry"
0074 echo ""