#!/bin/bash # set variables INPUT=$1 OUTFILE="tree_${INPUT}.root" JOBDIR=$OUTFILE BASEDIR=$HOME/test OUTDIR=$BASEDIR/$JOBDIR TOPWORKDIR=/scratch/$USER WORKDIR=$TOPWORKDIR/$JOBDIR # set CMSSW environment for script source /afs/cern.ch/cms/cmsset_default.sh cd $BASEDIR/CMSSW_5_3_24/src eval `scram runtime -sh` # run script on working node's scratch mkdir -p $WORKDIR cd $WORKDIR python $BASEDIR/myAnalysis.py $INPUT # copy output back mkdir -p $OUTDIR cp $WORKDIR/$OUTFILE $OUTDIR/$OUTFILE rm -rf $WORKDIR exit 0