Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:46:18

0001 #! /bin/bash
0002 
0003 # $1 : config file
0004 # $2 : output directory
0005 # $3 : output DQM directory (optional)
0006 
0007 source /afs/cern.ch/cms/caf/setup.sh
0008 
0009 curdir="$(pwd)"
0010 #workdir="/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN/HIP/bonato/DEVEL/HIPWorkflow/CMSSW_3_2_4/src/"
0011 workdir="<MYCMSSW>"
0012 dqmdir="MICKEY"
0013 
0014 
0015 if [ $# == 3 ]
0016 then 
0017 dqmdir="$3"
0018 else
0019 dqmdir="${curdir}/MONITORING/DQM/"
0020 fi
0021 
0022 
0023 # set up the CMS environment (choose your release and working area):
0024 echo Setting up CMSSW environment in $workdir
0025 cd $workdir
0026 eval `scram runtime -sh`
0027 #export STAGE_SVCCLASS=cmscafuser
0028 ###rehash ### useless in bash shell, only for tcsh
0029 
0030 
0031 
0032 echo Running in $curdir...
0033 cd $curdir
0034 
0035 rfcp $1 /castor/cern.ch/cms/$2/logfiles/
0036 #cp   $1 "/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN/HIP/bonato/DEVEL/HIPWorkflow/ALCARECOskim/v1.3/MONITORING/logfiles/"
0037 
0038 BASE_JOBNAME=$(basename "$1" .py)
0039 LOGFILE=$BASE_JOBNAME.log
0040 OUTFILE=$BASE_JOBNAME.out
0041 TRKFILE=$BASE_JOBNAME"_TrackStats.root"
0042 HITFILE=$BASE_JOBNAME"_HitMaps.root"
0043 
0044 time cmsRun $1 &> $LOGFILE
0045 
0046 echo
0047 echo "---------"
0048 echo "File list in $(pwd): "
0049 ls -lh
0050 echo "---------"
0051 
0052 #export STAGE_SVCCLASS=cmscafuser
0053 #rfcp *Skimmed*.root "$2"
0054 
0055 for dqmfile in $(ls  *TracksStatistics*.root)
0056 do
0057 #dqmbase=$(basename "$dqmfile" .root)
0058 if [[ "$dqmfile" =~ "CTF" ]]; then rfcp $dqmfile $dqmdir/CTF/$TRKFILE ; fi
0059 if [[ "$dqmfile" =~ "CosmicTF" ]]; then rfcp $dqmfile $dqmdir/CosmicTF/$TRKFILE ; fi
0060 done
0061 
0062 for dqmfile in $(ls  *HitMaps*.root)
0063 do
0064 #dqmbase=$(basename "$dqmfile" .root)
0065 #rfcp $dqmfile $dqmdir/$dqmbase"_HitMaps.root"
0066 
0067 if [[ "$dqmfile" =~ "CTF" ]]; then rfcp $dqmfile $dqmdir/CTF/$HITFILE ; fi
0068 if [[ "$dqmfile" =~ "CosmicTF" ]]; then rfcp $dqmfile $dqmdir/CosmicTF/$HITFILE ; fi
0069 done
0070 
0071 rm -f *TracksStatistics*.root  *HitMaps*.root
0072 
0073 for outROOT in $( ls  ALCA*kim*.root )
0074 do
0075 cmsStageOut $outROOT "$2/"
0076 
0077 if [ $? -ne 0 ]
0078 then
0079 echo "Error in copying the .root file to CASTOR !"
0080 fi
0081 let STATUScp=$STATUScp+$?
0082 done
0083 echo "Copying to /castor/cern.ch/cms/$2/logfiles/" 
0084 STATUScp=0
0085 for outLOG in $( ls  *.out )
0086 do
0087 cp $outLOG "${dqmdir}/../logfiles/"
0088 let STATUScp=$STATUScp+$?
0089 cmsStageOut $outLOG "$2/"
0090 let STATUScp=$STATUScp+$?
0091 done
0092 
0093 for outLOG in $( ls  *.log )
0094 do
0095 cmsStageOut $outLOG "$2/"
0096 let STATUScp=$STATUScp+$?
0097 cp $outLOG "${dqmdir}/../logfiles/"
0098 let STATUScp=$STATUScp+$?
0099 done
0100 
0101 #### # for skimfile in $( ls  ALCASkim*.root )
0102 #### # do
0103 #### # nsrename $skimfile $2/$skimfile
0104 #### # stager_get -S 'cmscafuser' -M $2/$skimfile
0105 #### # done
0106 
0107 
0108 rfcp *.log "${dqmdir}/../logfiles/"
0109 rfcp *.out "${dqmdir}/../$OUTFILE"
0110 
0111 
0112 ### Clean up
0113 rm -f  *.root
0114 rm -f *.log
0115 rm -f *.out
0116 
0117 for logfile in $( ls ${dqmdir}/../logfiles/*.log ) 
0118 do
0119 gzip  $logfile
0120 rm -f $logfile
0121 done