#!/usr/local/bin/tcsh -vx # source /usr/local/etc/setups.csh # H. Schellman, script to run a sam job Version 2.999 set narg = $#argv pwd echo "start runsam " if ($narg < 3) then echo "there are " $narg " arguments, need 3 to 6" echo "Usage: [][]" echo " snapvers defaults to new" exit 1 endif if ("$4." == ".") then set NUM_EVENTS = "0" else set NUM_EVENTS = $4 endif if ("$5." == ".")then set SNAPVERS = "new" else set SNAPVERS = $5 endif if ("$6." == ".")then if($HOST == "d0mino.fnal.gov")then set SAM_STATION = "central-analysis" endif if($HOST == "d0lxbld1.fnal.gov")then set SAM_STATION = "d0small-01" endif else set SAM_STATION = $6 endif setenv APPLICATION $1 setenv RCP $2 setenv SAM_DEFINITION $3 setenv SAM_PROJECT $SAM_DEFINITION"-"`date '+%y%m%d-%H%M%S'` mkdir $SAM_PROJECT rm latestjob ln -s $SAM_PROJECT latestjob echo "This run of the project will be called " $SAM_PROJECT echo "using snapshot version "$SNAPVERS " on station $SAM_STATION" # tell sam to get going on it sam start project --defname=$SAM_DEFINITION --snapvers=$SNAPVERS --name=$SAM_PROJECT --station=$SAM_STATION --group=algo --verbose #>& $SAM_PROJECT/project.stderr if ($status != 0) then echo " could not start project" exit 1 endif # tell sam where to put your files # run your executable #setup orbacus v3_2_1 -q sam_station $APPLICATION -rcp $RCP -time -mem -out $SAM_PROJECT/$SAM_PROJECT.out -log $SAM_PROJECT/$SAM_PROJECT.errlog -num_events $NUM_EVENTS -input_file "SAMInput:" -project $SAM_PROJECT -station $SAM_STATION>& $SAM_PROJECT/$SAM_PROJECT.stderr set test = $status mv root_global.ntpl $SAM_PROJECT/$SAM_DEFINITION.rtpl mv root_RecoAnalyze.rtpl $SAM_PROJECT/$SAM_DEFINITION.rtpl # dump a summary echo $SAM_STATION sam dump project >> $SAM_PROJECT/$SAM_PROJECT.summary # tell sam you're done echo $SAM_STATION $SAM_PROJECT sam stop project # and give back the disk #$sam deallocate buffer --disk=/prj_root/762/dma_1/sam/buffer/ #-project=$SAM_PROJECT # return the executable's error code if( $test == 0 )then exit 0 endif exit 1