1 |
#!/bin/bash
|
2 |
#---------------------------------------------------------------------------------------------------
|
3 |
# Execute one job (works interactively and when executed in condor)
|
4 |
#---------------------------------------------------------------------------------------------------
|
5 |
runMacro=$1
|
6 |
catalogDir=$2
|
7 |
book=$3
|
8 |
dataset=$4
|
9 |
skim=$5
|
10 |
fileset=$6
|
11 |
outputName=$7
|
12 |
outputDir=$8
|
13 |
runTypeId=$9
|
14 |
nEvents=-1
|
15 |
if [ ".${10}" != "." ]
|
16 |
then
|
17 |
nEvents=${10}
|
18 |
fi
|
19 |
|
20 |
h=`basename $0`
|
21 |
echo "Script: $h"
|
22 |
echo "Arguments: $*"
|
23 |
|
24 |
# some basic printing
|
25 |
echo " "; echo "${h}: Show who and where we are"; echo " "
|
26 |
id; env | grep HOST; pwd;
|
27 |
|
28 |
# initialize the CMSSW environment
|
29 |
echo " "; echo "${h}: Initialize CMSSW"; echo " "
|
30 |
workDir=`pwd`
|
31 |
cd /home/$USER/cms/cmssw/017/CMSSW_3_9_5_patch1/src
|
32 |
eval `scram runtime -sh`
|
33 |
|
34 |
# make sure to copy what we need locally if we are not in the original area (when in condor)
|
35 |
pwd
|
36 |
cd $workDir
|
37 |
if [ "$workDir" != "/home/$USER/cms/root" ]
|
38 |
then
|
39 |
cp /home/$USER/cms/condor/.rootlogon.C ./
|
40 |
cp /home/$USER/cms/condor/${runMacro} ./
|
41 |
fi
|
42 |
|
43 |
# get ready to run
|
44 |
echo " "; echo "${h}: Starting root job now"; echo " ";
|
45 |
echo \
|
46 |
root -b -l -q .rootlogon.C \
|
47 |
${runMacro}+\(\"$fileset\",\"$skim\",\"$dataset\",\"$book\",\"$catalogDir\"\,\"$outputName\",$nEvents\)
|
48 |
|
49 |
root -b -l -q .rootlogon.C \
|
50 |
${runMacro}+\(\"$fileset\",\"$skim\",\"$dataset\",\"$book\",\"$catalogDir\"\,\"$outputName\",$nEvents\)
|
51 |
|
52 |
# get the return code from the root job
|
53 |
status=`echo $?`
|
54 |
echo "${h}: Status - $status"
|
55 |
|
56 |
# store the result
|
57 |
echo " "; echo "${h}: Checking the work area before copy"; echo " "
|
58 |
ls -lhrt ./
|
59 |
echo " "; echo "${h}: Checking the remote area before copy (only $dataset file)"; echo " "
|
60 |
mkdir -p $outputDir/$outputName/$book/$dataset
|
61 |
ls -lhrt $outputDir/$outputName/$book/$dataset
|
62 |
mv ${outputName}_${dataset}_${skim}_${fileset}*.root \
|
63 |
$outputDir/$outputName/$book/$dataset
|
64 |
|
65 |
echo " "; echo "${h}: Checking the work area after copy"; echo " "
|
66 |
ls -lhrt ./
|
67 |
echo " "; echo "${h}: Checking the remote area after copy (only $dataset file)"; echo " "
|
68 |
ls -lhrt $outputDir/$outputName/$book/$dataset
|
69 |
|
70 |
exit $status
|