#!/bin/sh # ______________________________________________________________________ # # Purpose: Run D0TrigSim_x # Created: 062001 Amber # ______________________________________________________________________ # ______________________________________________________________________ # # Configuration parameters # ______________________________________________________________________ SCRIPTNAME="runD0TrigSim" # Name of this script SCRIPTPATH="$D0TOOLS_BIN" # Location of this script RUNFRMWRK="rund0exe" # Script to run framework exe INITSCRIPT="initD0TrigSim.sh" # Script to initialize RECO RTE FORMAT="" # Default data format--none for SR TRGLIST="TRGLIST" TRGLISTPATH="./" #location of default triggerlist SIMFILE="level3.sim" #default sim file name SIMPATH="./" #default export COORSIM="Y" #default is to run CoorSim export SIMDIR="$PWD/trigsim" #location of coorsim output NAME="NONE" # Name of specific job MACH=`uname -s` # OS DATANAME="NONE" DEFNAME="NONE" FILELIST="NONE" # ______________________________________________________________________ # # Determine type of input, which specifies executable # ______________________________________________________________________ # Help mode for var in $*; do if [ $var = "-h" ]; then cat \ $D0TOOLS_DOC/runD0TrigSim.man1 \ $D0TOOLS_DOC/runD0TrigSim.man4 \ $D0TOOLS_DOC/rund0exe.man2 \ $D0TOOLS_DOC/rund0exe.man3 \ $D0TOOLS_DOC/rund0exe.man5 \ | more exit fi done PARAMS="" # This will hold command line options to pass to rund0exe for var in $*; do # If user specified -defname, must be SAM if [ `echo "$var" | grep -c "\-defname="` != 0 ]; then PARAMS="$PARAMS $var" EXE="D0TrigSim_x" RCP="runD0TrigSim_sam" DEFNAME=`echo $var | sed 's/\-defname=//'` # If user uses -filelist, need to look inside elif [ `echo "$var"| grep -c "\-filelist="` != 0 ]; then PARAMS="$PARAMS $var" FILELIST=`echo "$var"| sed 's/\-filelist=//'` # Support list of SAM dataset definitions in a filelist if [ `grep -c "SAMDEFNAME:" $FILELIST` != 0 ]; then EXE="D0TrigSim_x" RCP="runD0TrigSim_sam" # Must just be a list of files else EXE="D0TrigSim_x" RCP="runD0TrigSim" fi # Data format elif [ `echo "$var"| grep -c "\-format="` != 0 ]; then FORMAT=`echo "$var"| sed 's/\-format=//'` # Trigger list (2) elif [ `echo "$var"| grep -c "\-trglst="` != 0 ]; then TRGLIST=`echo "$var"| sed 's/\-trglst=//'` # Trigger list path (2) elif [ `echo "$var"| grep -c "\-trglstpath="` != 0 ]; then TRGLISTPATH=`echo "$var"| sed 's/\-trglstpath=//'` echo "$TRGLISTPATH" # Sim file path path (5) elif [ `echo "$var"| grep -c "\-simfilepath="` != 0 ]; then SIMPATH=`echo "$var"| sed 's/\-simfilepath=//'` export COORSIM="N" echo "$SIMPATH" # Run number (4) elif [ `echo "$var"| grep -c "\-runno"` != 0 ]; then RUNNO=`echo "$var"| sed 's/\-runno=//'` #for now, doesn't work echo "Sorry: Run number functionality not yet supported" exit # no coorsim (3) elif [ `echo "$var"| grep -c "\-nocoorsim"` != 0 ]; then export COORSIM="N" # Data format elif [ `echo "$var"| grep -c "\-format="` != 0 ]; then FORMAT=`echo "$var"| sed 's/\-format=//'` # -maxopt elif [ "$var" = "-maxopt" ]; then MAXOPT="-maxopt" else PARAMS="$PARAMS $var" fi done # ______________________________________________________________________ # # Trigger List # # There are five anticipated modes for using a triggerlist # 1) using a default xml file which is run through coorsim # 2) using a non default xml file which is run through coorsim # -trglist=filename [optionally -trigfilepath= to specify a # a different directory] # 3) using a local version of the .sim files because you already ran coorsim # -nocoor # 4) using a run number to get the online captured files as so to get the # bit numbers and prescales exactly right. # -runno= # 5) using a specific version of .sim files which are not tied to a runno # -simfilepath=pathname # You may also use -trigfilepath with -trglst to specify a triggerlist #At the moment 4) is not supported # ______________________________________________________________________ # ______________________________________________________________________ # # Create local directory to hold the sim files # ______________________________________________________________________ # If directory already there, wipe it if [ ! -r $SIMDIR ]; then mkdir $SIMDIR fi if [ $COORSIM = "Y" ]; then #Dealing with xml files if [ -r "$TRGLISTPATH$TRGLIST" ]; then coorsim $TRGLISTPATH$TRGLIST mv *.sim $SIMDIR else echo "ERROR: Requested Trigger not available." echo "ERROR: $TRGLISTPATH$TRGLIST" exit fi else # if [ -r "$SIMDIR/$SIMFILE" ] ; then echo "Using results from previous coorsim run" # elif [ -r "$SIMPATH$SIMFILE" ]; then # cp "$SIMPATH*.sim" ./$SIMDIR # else # echo "ERROR: Local Trigger configuration not available." # echo "ERROR: $SIMPATH$SIMFILE" # exit # fi fi # ______________________________________________________________________ # # Framework rcp # ______________________________________________________________________ RCP="$RCP$FORMAT.rcp" RCPPKG="d0trigsim" #_______________________________________________________________________ # #Name of directory should include the trigger list # #_______________________________________________________________________ if [ $FILELIST != "NONE" ]; then DATANAME=`echo $FILELIST | sed 's/\.dat//'` # Or is specified by a SAM data definition name. elif [ $DEFNAME != "NONE" ]; then DATANAME=$DEFNAME fi NAME="$EXE-$BFCURRENT$MAXOPT-$MACH-$DATANAME-$TRGLIST" # ______________________________________________________________________ # # Use general run framework script to run RECO # ______________________________________________________________________ $SCRIPTPATH/$RUNFRMWRK \ -exe=$EXE \ -rcp=$RCP \ -rcppkg=$RCPPKG \ -initscript=$SCRIPTPATH/$INITSCRIPT \ -name=$NAME \ $PARAMS