File indexing completed on 2024-04-06 12:08:47
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 echo $0 $@;
0015 OPTERROR=11;
0016
0017 show_usage(){
0018 echo ""
0019 echo "Usage:"
0020 echo "`basename $0` -r mtcc_runnumber [ -w which_input_files -f first_file_of_run -l last_file_of_run -p mtcc_pedestal_runnr -o output_directory_in_castor -t input_file_ending (default dat) -h ]";
0021 echo ""
0022 echo " -h"
0023 echo " print out this message"
0024 echo " -r mtcc_runnumber"
0025 echo " run number you want to reconstruct"
0026 echo " -w which_input_files :"
0027 echo " 1 - copy files from castor (default option)"
0028 echo " 2 - run directly on castor files"
0029 echo " 3 - copy files from cmsdisk0"
0030 echo " 4 - run on local files in the subdirectory InputFiles/"
0031 echo " -o output_directory_in_castor :"
0032 echo " Set this for your output files to be copied to castor."
0033 echo " If DEFAULT_CASTOR_OUTPUT_DIRECTORY is set in the script, it will ignore this option"
0034 echo ""
0035 }
0036
0037 if [ -z $1 ]; then show_usage; exit $OPTERROR; fi
0038
0039
0040 while getopts ":r:p:f:l:w:o:t:h" Option
0041 do
0042 case $Option in
0043 r) RUNNR=$OPTARG; echo "will reconstruct RUNNR=$RUNNR" ;;
0044 p) PED_RUNNR=$OPTARG; echo "will create pedestals from PED_RUNNR=$PED_RUNNR" ;;
0045 f) FIRSTFILE=$OPTARG; echo "first file of run to be reconstructed FIRSTFILE=$FIRSTFILE" ;;
0046 l) LASTFILE=$OPTARG; echo "last file of run to be reconstructed LASTFILE=$LASTFILE" ;;
0047 w) WHICH_INPUT_FILES=$OPTARG; echo "WHICH_INPUT_FILES=$WHICH_INPUT_FILES" ;;
0048 o) WHERE_TO_COPY_OUTPUT=$OPTARG; echo "WHERE_TO_COPY_OUTPUT=$WHERE_TO_COPY_OUTPUT" ;;
0049 t) INPUT_FILE_ENDING=$OPTARG; echo "INPUT_FILE_ENDING=$INPUT_FILE_ENDING" ;;
0050 h) show_usage; exit 0;;
0051 *) echo "No such option -${Option}";;
0052 esac
0053 done
0054 shift $(($OPTIND - 1))
0055
0056
0057
0058
0059
0060
0061 set_shell_variables(){
0062
0063 DIR_WHERE_TO_EVAL="/afs/cern.ch/user/d/dkcira/scratch0/MTCC/2006_08_14_code_090/CMSSW_0_9_0"
0064
0065 PEDESTAL_DIR="/afs/cern.ch/user/d/dkcira/scratch0/MTCC/2006_08_14_code_090/pedestals";
0066
0067 MAX_PED_FILES_TO_RUN_OVER=1;
0068
0069 LOCAL_ORACLE_ADMINDIR="/afs/cern.ch/project/oracle/admin/"
0070
0071
0072 BATCH_USER_NAME=`whoami`
0073
0074 CASTOR_DIR="/castor/cern.ch/cms/MTCC/data/0000${RUNNR}/A"
0075 PED_CASTOR_DIR="/castor/cern.ch/cms/MTCC/data/0000${PED_RUNNR}/A"
0076
0077
0078 if [ "${LS_SUBCWD+set}" = set ]; then
0079 LK_WKDIR="${LS_SUBCWD}"
0080 WWDIR="${WORKDIR}"
0081 else
0082 LK_WKDIR=`pwd`
0083 WWDIR=`pwd`
0084 fi
0085
0086
0087 MTCC_OUTPUT_DIR="${WWDIR}/mtcc_${RUNNR}"
0088
0089 MTCC_INPUT_DIR="${WWDIR}/InputFiles"
0090 PED_MTCC_INPUT_DIR="${WWDIR}/InputFiles"
0091
0092 PED_CFG="${MTCC_OUTPUT_DIR}/${RUNNR}_mtccped.cfg";
0093 PED_LOG_FILE="${MTCC_OUTPUT_DIR}/${RUNNR}_mtcc_pedestals.log";
0094
0095 LIST_OF_CFG_FILES="";
0096 GENERAL_LOG_FILE="${MTCC_OUTPUT_DIR}/${RUNNR}_reco_${FIRSTFILE}.log"
0097 LOCAL_INPUT_DIRECTORY="${MTCC_OUTPUT_DIR}/InputFiles";
0098
0099 TEMPLATE_CMSSW_CFG="${LK_WKDIR}/template_mtccoffline.cfg"
0100 TEMPLATE_PED_CFG="${LK_WKDIR}/template_mtccped.cfg"
0101
0102
0103
0104 }
0105
0106
0107 inital_checks_and_settings(){
0108
0109 if [ "X$RUNNR" == "X" ]; then
0110 echo "You did not choose a run number. Stopping here!"
0111 exit $OPTERROR;
0112 fi
0113
0114
0115 if [ ! -f "$TEMPLATE_CMSSW_CFG" ]; then echo "file ${TEMPLATE_CMSSW_CFG} does not exist, stopping here"; exit $OPTERROR; fi
0116 if [ ! -f "$TEMPLATE_PED_CFG" ]; then echo "file ${TEMPLATE_PED_CFG} does not exist, stopping here"; exit $OPTERROR; fi
0117
0118
0119 if [ -z "$WHICH_INPUT_FILES" ] ; then WHICH_INPUT_FILES=1; fi
0120 case $WHICH_INPUT_FILES in
0121 1|2|3|4) echo "WHICH_INPUT_FILES=$WHICH_INPUT_FILES";;
0122 *) echo "no such WHICH_INPUT_FILES=$WHICH_INPUT_FILES . exit here!"; exit $OPTERROR;;
0123 esac
0124
0125
0126 if [ -z "$INPUT_FILE_ENDING" ] ; then
0127 INPUT_FILE_ENDING="dat";
0128 echo "Using default INPUT_FILE_ENDING=$INPUT_FILE_ENDING";
0129 fi
0130
0131
0132 if [ "X${DEFAULT_CASTOR_OUTPUT_DIRECTORY}" != "X" ]; then
0133 echo "Using castor directory from default variable DEFAULT_CASTOR_OUTPUT_DIRECTORY";
0134 WHERE_TO_COPY_OUTPUT="$DEFAULT_CASTOR_OUTPUT_DIRECTORY";
0135 elif [ -n "$WHERE_TO_COPY_OUTPUT" ]; then
0136 echo "Using castor directory from command line option";
0137 else
0138 echo "Output files will NOT be copied to castor.";
0139 CASTOROUTPUT="no"
0140 fi
0141
0142 if [ "$CASTOROUTPUT" != "no" ] ; then
0143 if nsls -d "$WHERE_TO_COPY_OUTPUT" > /dev/null
0144 then
0145 echo "Using $WHERE_TO_COPY_OUTPUT to copy files to castor";
0146 else
0147 echo "Directory WHERE_TO_COPY_OUTPUT=$WHERE_TO_COPY_OUTPUT does not exist on castor.";
0148 echo "Stopping here!"; exit $OPTERROR;
0149 fi
0150 fi
0151
0152
0153 echo "Using code from ${DIR_WHERE_TO_EVAL}";
0154 }
0155
0156
0157 create_output_directory(){
0158 if [ -d "$MTCC_OUTPUT_DIR" ]; then
0159 echo "directory ${MTCC_OUTPUT_DIR} already exists, stopping here"; exit $OPTERROR;
0160 else
0161 echo "creating directory ${MTCC_OUTPUT_DIR}"; mkdir $MTCC_OUTPUT_DIR;
0162 fi
0163 }
0164
0165
0166 get_list_of_local_files(){
0167 echo "Getting list of files to be reconstructed from local directory."
0168 if [ -z "$FIRSTFILE" ] ; then FIRSTFILE=1 ; fi
0169 if [ -z "$LASTFILE" ] ; then LASTFILE=`ls $LOCAL_INPUT_DIRECTORY | grep ${RUNNR} | grep "\.${INPUT_FILE_ENDING}" | wc -l | sed 's/[ ]*//g'`; fi
0170 let "HOWMANYFILES = $LASTFILE - $FIRSTFILE + 1";
0171 echo "FIRSTFILE=$FIRSTFILE LASTFILE=$LASTFILE HOWMANYFILES=$HOWMANYFILES"
0172
0173
0174 LIST_OF_DATA_FILES=`ls $LOCAL_INPUT_DIRECTORY | grep ${RUNNR} | grep "\.${INPUT_FILE_ENDING}" | sed 's/^.* //' | sort -n -t . +4 | head -${LASTFILE} | tail -${HOWMANYFILES}`
0175 if [ "$LIST_OF_DATA_FILES" == "" ] ; then echo "No input reco files found!!!!!! Stopping here"; exit $OPTERROR; fi
0176 }
0177
0178
0179 get_list_of_local_pedestal_files(){
0180 echo "Getting list of pedestal files from local directory."
0181 if [ $MAX_PED_FILES_TO_RUN_OVER -eq 0 ]
0182 then
0183 LIST_OF_PED_DATA_FILES=`ls $LOCAL_INPUT_DIRECTORY | grep "\.${INPUT_FILE_ENDING}" | sed 's/^.* //'`
0184 else
0185 echo " !!! Caution !!! limiting max. nr. of files per run to ${MAX_PED_FILES_TO_RUN_OVER}"
0186 LIST_OF_PED_DATA_FILES=`ls $LOCAL_INPUT_DIRECTORY | grep "\.${INPUT_FILE_ENDING}" | head -${MAX_PED_FILES_TO_RUN_OVER} | sed 's/^.* //'`
0187 fi
0188 if [ "$LIST_OF_PED_DATA_FILES" == "" ] ; then echo "No input pedestal files found!!!!!! Stopping here"; exit $OPTERROR; fi
0189 }
0190
0191
0192 get_list_of_castor_files(){
0193 echo "Getting list of files to be reconstructed from castor."
0194 if [ -z "$FIRSTFILE" ] ; then FIRSTFILE=1 ; fi
0195 if [ -z "$LASTFILE" ] ; then LASTFILE=`nsls $CASTOR_DIR | grep ${RUNNR} | grep "\.${INPUT_FILE_ENDING}" | wc -l | sed 's/[ ]*//g'`; fi
0196 let "HOWMANYFILES = $LASTFILE - $FIRSTFILE + 1";
0197 echo "FIRSTFILE=$FIRSTFILE LASTFILE=$LASTFILE HOWMANYFILES=$HOWMANYFILES"
0198 echo "getting from CASTOR the list of files corresponding to run ${RUNNR}";
0199 LIST_OF_DATA_FILES=`nsls $CASTOR_DIR | grep ${RUNNR} | grep "\.${INPUT_FILE_ENDING}" | sed 's/^.* //' | sort -n -t . +4 | head -${LASTFILE} | tail -${HOWMANYFILES}`
0200 if [ "$LIST_OF_DATA_FILES" == "" ] ; then echo "No input files found!!!!!! Stopping here"; exit $OPTERROR; fi
0201 }
0202
0203
0204 get_list_of_pedestal_castor_files(){
0205 echo "Getting list of pedestal files to be reconstructed from castor."
0206 if [ $MAX_PED_FILES_TO_RUN_OVER -eq 0 ]
0207 then
0208 LIST_OF_PED_DATA_FILES=`nsls $CASTOR_DIR | grep "\.${INPUT_FILE_ENDING}" | sed 's/^.* //'`
0209 else
0210 echo " !!! Caution !!! limiting nr. of files for calculating pedestals to ${MAX_PED_FILES_TO_RUN_OVER}"
0211 LIST_OF_PED_DATA_FILES=`nsls $CASTOR_DIR | grep "\.${INPUT_FILE_ENDING}" | head -${MAX_PED_FILES_TO_RUN_OVER} | sed 's/^.* //'`
0212 fi
0213 if [ "$LIST_OF_PED_DATA_FILES" == "" ] ; then echo "No input pedestal files found!!!!!! Stopping here"; exit $OPTERROR; fi
0214 }
0215
0216
0217 copy_castor_files_locally(){
0218 echo "LIST_OF_DATA_FILES="; echo "$LIST_OF_DATA_FILES";
0219 echo "Will copy locally the input files from castor.";
0220 if [ -d "$MTCC_INPUT_DIR" ]; then
0221 echo "directory ${MTCC_INPUT_DIR} already exists. copying files there";
0222 else
0223 echo "creating directory ${MTCC_INPUT_DIR}"; mkdir $MTCC_INPUT_DIR;
0224 fi
0225 for rfile in $LIST_OF_DATA_FILES
0226 do
0227 if [ -f ${MTCC_INPUT_DIR}/${rfile} ]; then
0228 echo " ${MTCC_INPUT_DIR}/${rfile} exists already, not copying."
0229 else
0230 echo "copying $CASTOR_DIR/${rfile} to ${MTCC_INPUT_DIR}/${rfile}"
0231 rfcp $CASTOR_DIR/${rfile} ${MTCC_INPUT_DIR}/${rfile}
0232 fi
0233 done
0234 }
0235
0236
0237 copy_castor_pedestal_files_locally(){
0238 echo "LIST_OF_PED_DATA_FILES="; echo "$LIST_OF_PED_DATA_FILES";
0239 echo "Will copy locally the pedestal files from castor.";
0240 if [ -d "$MTCC_INPUT_DIR" ]; then
0241 echo "directory ${MTCC_INPUT_DIR} already exists. copying files there";
0242 else
0243 echo "creating directory ${MTCC_INPUT_DIR}"
0244 mkdir $MTCC_INPUT_DIR;
0245 fi
0246 for rfile in $LIST_OF_PED_DATA_FILES
0247 do
0248 if [ -f ${MTCC_INPUT_DIR}/${rfile} ]; then
0249 echo " ${MTCC_INPUT_DIR}/${rfile} exists already, not copying."
0250 else
0251 echo "copying $CASTOR_DIR/${rfile} to ${MTCC_INPUT_DIR}/${rfile}"
0252 rfcp $CASTOR_DIR/${rfile} ${MTCC_INPUT_DIR}/${rfile}
0253 fi
0254 done
0255 }
0256
0257
0258 get_list_of_cmsdisk0_files(){
0259 echo "Getting list of files to be reconstructed from cmsdisk0."
0260 if [ -z "$FIRSTFILE" ] ; then FIRSTFILE=1 ; fi
0261 if [ -z "$LASTFILE" ] ; then LASTFILE=`ssh -n ${BATCH_USER_NAME}@cmsdisk0 'ls /data0/mtcc_0_9_0/' | grep ${RUNNR} | grep "\.${INPUT_FILE_ENDING}" | wc -l | sed 's/[ ]*//g'`; fi
0262 let "HOWMANYFILES = $LASTFILE - $FIRSTFILE + 1";
0263 echo "FIRSTFILE=$FIRSTFILE LASTFILE=$LASTFILE HOWMANYFILES=$HOWMANYFILES"
0264 LIST_OF_DATA_FILES=`ssh -n ${BATCH_USER_NAME}@cmsdisk0 'ls /data0/mtcc_0_9_0/' | grep ${RUNNR} | grep "\.${INPUT_FILE_ENDING}" | sort -n -t . +4 | head -${LASTFILE} | tail -${HOWMANYFILES}`
0265 if [ "$LIST_OF_DATA_FILES" == "" ] ; then
0266 echo "No input files found!!!!!! Stopping here"; exit $OPTERROR;
0267 fi
0268 }
0269
0270
0271 copy_cmsdisk0_files_locally(){
0272 echo "LIST_OF_DATA_FILES=$LIST_OF_DATA_FILES"
0273 echo "Will copy locally the input files from cmsdisk0.";
0274 if [ -d "$MTCC_INPUT_DIR" ]; then
0275 echo "directory ${MTCC_INPUT_DIR} already exists. copying files there";
0276 else
0277 echo "creating directory ${MTCC_INPUT_DIR}"; mkdir $MTCC_INPUT_DIR;
0278 fi
0279 for rfile in $LIST_OF_DATA_FILES
0280 do
0281 if [ -f ${MTCC_INPUT_DIR}/${rfile} ]; then
0282 echo " ${MTCC_INPUT_DIR}/${rfile} exists already, not copying."
0283 else
0284 echo "copying ${BATCH_USER_NAME}@cmsdisk0.cern.ch:/data0/mtcc_0_9_0/${rfile} to ${MTCC_INPUT_DIR}/${rfile}"
0285 scp -c blowfish ${BATCH_USER_NAME}@cmsdisk0.cern.ch:/data0/mtcc_0_9_0/${rfile} ${MTCC_INPUT_DIR}/${rfile}
0286 fi
0287 done
0288 }
0289
0290
0291 get_list_of_cmsdisk0_pedestal_files(){
0292 echo "Getting list of pedestal files from cmsdisk0."
0293 if [ $MAX_PED_FILES_TO_RUN_OVER -eq 0 ]
0294 then
0295 LIST_OF_PED_DATA_FILES=`ssh -n ${BATCH_USER_NAME}@cmsdisk0 'ls /data0/mtcc_0_9_0/' | grep ${PED_RUNNR} | grep "\.${INPUT_FILE_ENDING}"`
0296 else
0297 echo " !!! Caution !!! limiting max. nr. of pedestal files per run to ${MAX_PED_FILES_TO_RUN_OVER}"
0298 LIST_OF_PED_DATA_FILES=`ssh -n ${BATCH_USER_NAME}@cmsdisk0.cern.ch 'ls /data0/mtcc_0_9_0/' | grep ${PED_RUNNR} | grep "\.${INPUT_FILE_ENDING}" | head -${MAX_PED_FILES_TO_RUN_OVER}`
0299 fi
0300 if [ "$LIST_OF_PED_DATA_FILES" == "" ] ;
0301 then
0302 echo "No input files found!!!!!! Stopping here";
0303 exit $OPTERROR;
0304 fi
0305 }
0306
0307
0308 copy_cmsdisk0_pedestal_files_locally(){
0309 echo "LIST_OF_PED_DATA_FILES=$LIST_OF_PED_DATA_FILES"
0310 echo "Will copy locally the pedestal files from cmsdisk0.";
0311 if [ -d "$MTCC_INPUT_DIR" ]; then
0312 echo "directory ${MTCC_INPUT_DIR} already exists. copying files there";
0313 else
0314 echo "creating directory ${MTCC_INPUT_DIR}"
0315 mkdir $MTCC_INPUT_DIR;
0316 fi
0317 for rfile in $LIST_OF_PED_DATA_FILES
0318 do
0319 if [ -f ${MTCC_INPUT_DIR}/${rfile} ]; then
0320 echo " ${MTCC_INPUT_DIR}/${rfile} exists already, not copying."
0321 else
0322 echo "copying ${BATCH_USER_NAME}@cmsdisk0.cern.ch:/data0/mtcc_0_9_0/${rfile} to ${MTCC_INPUT_DIR}/${rfile}"
0323 scp -c blowfish ${BATCH_USER_NAME}@cmsdisk0.cern.ch:/data0/mtcc_0_9_0/${rfile} ${MTCC_INPUT_DIR}/${rfile}
0324 fi
0325 done
0326 }
0327
0328
0329 copy_example_pedestal_files(){
0330 echo "Copying example pedestals from ${PEDESTAL_DIR}";
0331 cp ${PEDESTAL_DIR}/insert_SiStripPedNoisesDB ${MTCC_OUTPUT_DIR}/.
0332 cp ${PEDESTAL_DIR}/insert_SiStripPedNoisesCatalog ${MTCC_OUTPUT_DIR}/.
0333 }
0334
0335
0336 create_cmssw_config_files(){
0337
0338 for rfile in $LIST_OF_DATA_FILES
0339 do
0340 if [ "$WHICH_INPUT_FILES" == "1" ]; then
0341 FILE_FULL_PATH="\"${MTCC_INPUT_DIR}/${rfile}\""
0342 elif [ "$WHICH_INPUT_FILES" == "3" ]; then
0343 FILE_FULL_PATH="\"${MTCC_INPUT_DIR}/${rfile}\""
0344 elif [ "$WHICH_INPUT_FILES" == "4" ]; then
0345 FILE_FULL_PATH="\"${MTCC_INPUT_DIR}/${rfile}\""
0346 elif [ "$WHICH_INPUT_FILES" == "2" ]; then
0347 FILE_FULL_PATH="\"rfio:${CASTOR_DIR}/${rfile}\""
0348 else
0349 echo "Do not know what to do WHICH_INPUT_FILES=${WHICH_INPUT_FILES}";
0350 echo "Stopping here!."; exit $OPTERROR;
0351 fi
0352
0353 CMSSW_CFG="${MTCC_OUTPUT_DIR}/${RUNNR}_mtccoffline_${rfile}.cfg"
0354 LOG_FILE="${MTCC_OUTPUT_DIR}/${RUNNR}_mtccoffline_${rfile}.log"
0355 POOL_OUTPUT_FILE="${MTCC_OUTPUT_DIR}/${RUNNR}_rec_${rfile}.root"
0356 DQM_OUTPUT_FILE="${MTCC_OUTPUT_DIR}/${RUNNR}_dqm_${rfile}.root"
0357
0358 LIST_OF_CFG_FILES="${LIST_OF_CFG_FILES} ${CMSSW_CFG}"
0359 echo "creating $CMSSW_CFG";
0360 touch $CMSSW_CFG;
0361 cat "$TEMPLATE_CMSSW_CFG" | sed "s@SCRIPT_POOL_OUTPUT_FILE@${POOL_OUTPUT_FILE}@" | sed "s@SCRIPT_DQM_OUTPUT_FILE@${DQM_OUTPUT_FILE}@" | sed "s@SCRIPT_LIST_OF_FILES@${FILE_FULL_PATH}@" >> ${CMSSW_CFG}
0362 done
0363 }
0364
0365
0366 create_pedestal_config_file(){
0367
0368 PED_LIST_WITH_PATH="";
0369 for rfile in $LIST_OF_PED_DATA_FILES
0370 do
0371 if [ "$WHICH_INPUT_FILES" == "1" ]; then
0372 PED_LIST_WITH_PATH="${PED_LIST_WITH_PATH},\"${PED_MTCC_INPUT_DIR}/${rfile}\""
0373 elif [ "$WHICH_INPUT_FILES" == "3" ]; then
0374 PED_LIST_WITH_PATH="${PED_LIST_WITH_PATH},\"${PED_MTCC_INPUT_DIR}/${rfile}\""
0375 elif [ "$WHICH_INPUT_FILES" == "4" ]; then
0376 PED_LIST_WITH_PATH="${PED_LIST_WITH_PATH},\"${PED_MTCC_INPUT_DIR}/${rfile}\""
0377 elif [ "$WHICH_INPUT_FILES" == "2" ]; then
0378 PED_LIST_WITH_PATH="${PED_LIST_WITH_PATH},\"rfio:${PED_CASTOR_DIR}/${rfile}\""
0379 else
0380 echo "Do not know what to do WHICH_INPUT_FILES=${WHICH_INPUT_FILES}";
0381 echo "Stopping here!."; exit $OPTERROR;
0382 fi
0383 done
0384
0385 PED_LIST_WITH_PATH=`echo $PED_LIST_WITH_PATH | sed 's/\,//'`;
0386 echo "creating $PED_CFG";
0387 touch $PED_CFG;
0388 cat "$TEMPLATE_PED_CFG" | sed "s@SCRIPT_LIST_OF_FILES@${PED_LIST_WITH_PATH}@" >> ${PED_CFG}
0389 }
0390
0391
0392 runped(){
0393 cd ${DIR_WHERE_TO_EVAL}; eval `scramv1 runtime -sh`;
0394 export TNS_ADMIN=${LOCAL_ORACLE_ADMINDIR}
0395 export ORACLE_ADMINDIR=${LOCAL_ORACLE_ADMINDIR}
0396 cd ${MTCC_OUTPUT_DIR};
0397 echo "# ************************************************* CALCULATING THE PEDESTALS USING THE CFG FILE ${PED_CFG}"
0398 cat ${PED_CFG};
0399 cmsRun ${PED_CFG};
0400 echo "pedestal jobstatus: $?";
0401 mv ${MTCC_OUTPUT_DIR}/Source_*${PED_RUNNR}.root ${PED_CFG}_pedestal_histograms.root
0402 }
0403
0404
0405 runcms(){
0406 cd ${DIR_WHERE_TO_EVAL}; eval `scramv1 runtime -sh`;
0407 export TNS_ADMIN=${LOCAL_ORACLE_ADMINDIR}
0408 export ORACLE_ADMINDIR=${LOCAL_ORACLE_ADMINDIR}
0409 cd ${MTCC_OUTPUT_DIR};
0410 for I_CFG in ${LIST_OF_CFG_FILES}
0411 do
0412 echo ""
0413 echo "########################################################################"
0414 echo "###### RUNNING THE RECONSTRUCTION USING THE CFG FILE ${I_CFG}"
0415 cmsRun ${I_CFG}
0416 echo "reconstruction jobstatus: $?";
0417 mv ${MTCC_OUTPUT_DIR}/monitor_cluster_summary.txt ${I_CFG}_cluster_summary.txt
0418 mv ${MTCC_OUTPUT_DIR}/monitor_digi_summary.txt ${I_CFG}_digi_summary.txt
0419 done
0420 cp ${MTCC_OUTPUT_DIR}/insert_SiStripPedNoisesDB ${MTCC_OUTPUT_DIR}/${RUNNR}_insert_SiStripPedNoisesDB
0421 cp ${MTCC_OUTPUT_DIR}/insert_SiStripPedNoisesCatalog ${MTCC_OUTPUT_DIR}/${RUNNR}_insert_SiStripPedNoisesCatalog
0422 }
0423
0424
0425 copy_output_to_castor(){
0426 case $
0427 1) OUTPUT_CASTOR_DIR="$1" ;;
0428 *) echo "No output castor directory given, not performing copy_output_to_castor." ;;
0429 esac
0430
0431 if [ "X$OUTPUT_CASTOR_DIR" != "X" ]; then
0432 echo "copying output files to $OUTPUT_CASTOR_DIR";
0433 for ifile in ${MTCC_OUTPUT_DIR}/${RUNNR}*
0434 do
0435 rfcp ${ifile} ${OUTPUT_CASTOR_DIR}/.
0436 done
0437 fi
0438 }
0439
0440
0441
0442
0443
0444 set_shell_variables;
0445 inital_checks_and_settings;
0446 create_output_directory;
0447 ls -lh;
0448
0449
0450 if [ -n "$PED_RUNNR" ]; then
0451 if [ "$WHICH_INPUT_FILES" == "1" ]; then
0452 get_list_of_pedestal_castor_files;
0453 copy_castor_pedestal_files_locally;
0454 elif [ "$WHICH_INPUT_FILES" == "2" ]; then
0455 get_list_of_pedestal_castor_files;
0456 elif [ "$WHICH_INPUT_FILES" == "3" ]; then
0457 get_list_of_cmsdisk0_pedestal_files;
0458 copy_cmsdisk0_pedestal_files_locally;
0459 elif [ "$WHICH_INPUT_FILES" == "4" ]; then
0460 get_list_of_local_pedestal_files;
0461 else
0462 echo "Not clear where to get files WHICH_INPUT_FILES=$WHICH_INPUT_FILES"; echo "Stopping here!"; exit $OPTERROR;
0463 fi
0464
0465 create_pedestal_config_file;
0466 echo "Running pedestals. Log file: ${PED_LOG_FILE}";
0467 time runped > ${PED_LOG_FILE} 2>&1;
0468 else
0469 copy_example_pedestal_files;
0470 fi
0471
0472
0473
0474
0475
0476
0477
0478 if [ "$WHICH_INPUT_FILES" == "1" ]; then
0479 get_list_of_castor_files;
0480 copy_castor_files_locally;
0481 elif [ "$WHICH_INPUT_FILES" == "2" ]; then
0482 get_list_of_castor_files;
0483 elif [ "$WHICH_INPUT_FILES" == "3" ]; then
0484 get_list_of_cmsdisk0_files;
0485 copy_cmsdisk0_files_locally;
0486 elif [ "$WHICH_INPUT_FILES" == "4" ]; then
0487 get_list_of_local_files;
0488 else
0489 echo "Not clear where to get files WHICH_INPUT_FILES=${WHICH_INPUT_FILES}"; echo "Stopping here!"; exit $OPTERROR;
0490 fi
0491
0492 create_cmssw_config_files;
0493 echo "Running reconstruction and monitoring. Log file: ${GENERAL_LOG_FILE}";
0494 time runcms > ${GENERAL_LOG_FILE} 2>&1;
0495 ls -lh . ${MTCC_OUTPUT_DIR}/ ;
0496
0497
0498 if [ -n "WHERE_TO_COPY_OUTPUT" ]; then
0499 copy_output_to_castor "$WHERE_TO_COPY_OUTPUT";
0500 fi
0501
0502
0503
0504