Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:14:58

0001 #!/bin/bash
0002 
0003 #List of source files
0004 #LIST=list_CRAFT_repro_TOTAL.txt
0005 LIST=source_list_test.txt
0006 
0007 #Number of events to be analyzed
0008 NEVENT=-1;
0009 
0010 #Directories used by the jobs
0011 WORK_DIR=$PWD;
0012 MY_TMP=$PWD"/tmp";
0013 MY_CASTOR_DIR="/castor/cern.ch/user/s/sfrosali/CRAFT_REPRO/CRAFT_REPRO_NEWAL/TEST_31X";
0014 mkdir $MY_TMP;
0015 
0016 #Name of the queue where the jobs will be submitted
0017 JOB_QUEUE="8nh";
0018 
0019 #Name of the templates used to create py and sh files for the jobs
0020 PY_TEMPLATE="template.py";
0021 JOB_TEMPLATE="job.sh";
0022 
0023 #Global tag used for reconstruction
0024 GLOBAL_TAG="GR09_31X_V3P";
0025 
0026 #Name of the outputs (histos, trees ...)
0027 MY_HISTOS="LA_Histos";
0028 MY_TREE="LA_Tree";
0029 MY_DEBUG="LAProfileDebug";
0030 MY_HISTOS_HARV="LA_Histos_Harv";
0031 
0032 cd $WORK_DIR;
0033 eval `scramv1 runtime -sh`
0034 
0035 NN=1;
0036 NUMBER=1;
0037 for i in `gawk '{print $1}' $LIST`; do
0038 
0039 echo $i >> Source_List_100J_$NUMBER.txt;
0040 NN=`expr $NN + 1`;
0041 
0042 if  [ $NN -eq 100 ] ;  then
0043 echo "List number "$NUMBER" compiled"
0044 NUMBER=`expr $NUMBER + 1`;
0045 NN=1;
0046 fi
0047 
0048 done;
0049 
0050 echo "List number "$NUMBER" compiled"
0051 
0052 mkdir Source_Lists;
0053 
0054 DIR=`grep $i $LIST | gawk -F / '{print $4}'`;
0055 rfmkdir $MY_CASTOR_DIR/$DIR;
0056 DIR=$DIR"/"`grep $i $LIST | gawk -F / '{print $5}'`;
0057 rfmkdir $MY_CASTOR_DIR/$DIR;
0058 DIR=$DIR"/"`grep $i $LIST | gawk -F / '{print $6}'`;
0059 rfmkdir $MY_CASTOR_DIR/$DIR;
0060 DIR=$DIR"/"`grep $i $LIST | gawk -F / '{print $7}'`;
0061 rfmkdir $MY_CASTOR_DIR/$DIR;
0062 FILETAG=`grep $i $LIST | gawk -F / '{print $7}'`;
0063 DIR_HISTOS=$DIR"/histos/";
0064 rfmkdir $MY_CASTOR_DIR/$DIR_HISTOS;
0065 echo $DIR_HISTOS;
0066 DIR_HISTOHARV=$DIR"/histos_Harv/";
0067 rfmkdir $MY_CASTOR_DIR/$DIR_HISTOHARV;
0068 echo $DIR_HISTOHARV;
0069 DIR_TREES=$DIR"/trees/";
0070 rfmkdir $MY_CASTOR_DIR/$DIR_TREES;
0071 echo $DIR_TREES;
0072 DIR_DEBUG=$DIR"/debug/";
0073 rfmkdir $MY_CASTOR_DIR/$DIR_DEBUG;
0074 echo $DIR_DEBUG;
0075 DIR_PY=$DIR"/py/";
0076 rfmkdir $MY_CASTOR_DIR/$DIR_PY;
0077 echo $DIR_PY;
0078 
0079 for (( i = 1; i <= $NUMBER; i++ )); do
0080 echo "Job n = "$i" submitted";
0081 
0082 PY="LA_PB_100J_"$i.py;
0083 
0084 JOB="Job_LA_100J_"$i.sh;
0085 
0086 JLIST=Source_List_100J_$i.txt;
0087 
0088 cat $PY_TEMPLATE     | sed -e "s#GLOBAL_TAG#$GLOBAL_TAG#" | sed -e "s#MY_TREE#$MY_TREE#" | sed -e "s#MY_DEBUG#$MY_DEBUG#" | sed -e "s#MY_HISTOS_HARV#$MY_HISTOS_HARV#" | sed -e "s#MY_HISTOS#$MY_HISTOS#" | sed -e "s#JLIST#$JLIST#" | sed -e "s#MY_TMP#$MY_TMP#" | sed -e "s#NEVENT#$NEVENT#"  | sed -e "s#NUMBER#$i#" > $PY
0089 
0090 cat $JOB_TEMPLATE    | sed -e "s#MY_TREE#$MY_TREE#" | sed -e "s#MY_DEBUG#$MY_DEBUG#" | sed -e "s#MY_HISTOS_HARV#$MY_HISTOS_HARV#" | sed -e "s#MY_HISTOS#$MY_HISTOS#" | sed -e "s#JLIST#$JLIST#" | sed -e "s#WORK_DIR#$WORK_DIR#" | sed -e "s#MY_CASTOR_DIR#$MY_CASTOR_DIR#" | sed -e "s#MY_TMP#$MY_TMP#" | sed -e "s#PY#$PY#" | sed -e "s#NUMBER#$i#" | sed -e "s#JOB#$JOB#" | sed -e"s#DIR_HISTOS#$DIR_HISTOS#" | sed -e"s#DIR_HISTOHARV#$DIR_HISTOHARV#" | sed -e "s#DIR_TREES#$DIR_TREES#" | sed -e"s#DIR_DEBUG#$DIR_DEBUG#" | sed -e "s#DIR_PY#$DIR_PY#" > $JOB
0091 
0092 chmod 755 $JOB;
0093 
0094 bsub -q $JOB_QUEUE $JOB -J LA_$i;
0095 
0096 done;
0097