Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:08:34

0001 #!/bin/sh
0002 #
0003 #  $1 = run number
0004 #  $2 = whether to run injection (optional)
0005 #
0006 
0007 echo "Running conversion script ..."
0008 
0009 BASEDIR=/opt/cmssw
0010 echo "  CMSSW base directory     : "$BASEDIR
0011 SCRATCH=$BASEDIR/Data/$1
0012 echo "  Output storage directory : "$SCRATCH
0013 TEMPLATEPY=/opt/cmssw/scripts/conversion_template_cfg.py
0014 echo "  Conversion template      : "$TEMPLATEPY
0015 
0016 # set up CMSSW environment
0017 source $BASEDIR/scripts/setup.sh
0018 cd $BASEDIR/Stable/current/src
0019 eval `scram runtime -sh`
0020 
0021 # convert streamer files if they have not yet been converted
0022 echo -n "  Converting raw files ..."
0023 cd $SCRATCH
0024 RAWFILES=$(ls *.dat)
0025 count=0
0026 convertout="conversion_$1_`date +%s`"
0027 rm -f $convertout.log $convertout.cout
0028 touch $convertout.log $convertout.cout
0029 for file in $RAWFILES; do
0030   count=`expr $count + 1`
0031   ROFILE=${file%.*}.root
0032   if [ ! -e "$SCRATCH/$ROFILE" ] ; then    # convert only if non-existant
0033     echo -n "."
0034     sed 's,DATFILE,'$SCRATCH/$file',g' $TEMPLATEPY \
0035       | sed 's,ROOFILE,'$SCRATCH/$ROFILE'.tmp,g' > conversion_$1_cfg.py
0036     cmsRun conversion_$1_cfg.py >> $convertout.cout 2>&1
0037     mv $SCRATCH/$ROFILE.tmp $SCRATCH/$ROFILE
0038     cat info.log >> $convertout.log
0039     rm -f debug.log info.log warning.log error.log
0040     rm -f conversion_$1_cfg.py
0041   #else
0042   #  echo "$SCRATCH/$file already converted, so leaving it alone."
0043   fi
0044 done
0045 echo " done."
0046 
0047 
0048 # now we could remove unnecessary dat/ind files after conversion
0049 
0050 
0051 # inject root files
0052 if [ "$2" == "" ] ; then exit 0 ; fi
0053 echo "Running root file injection ..."
0054 
0055 injectout="inject_$1_`date +%s`.log"
0056 rm -f $injectout
0057 touch $injectout
0058 echo -n "  Injecting raw data ..."
0059 for file in `ls USC*.root`; do
0060   echo -n "."
0061   bash -c "exec -c /opt/cmssw/scripts/inject.sh $file $SCRATCH $1 SiStripCommissioning09-edm $CMSSW_VERSION" >> $injectout
0062 done
0063 echo " done."
0064 echo -n "  Injecting commissioning source files ..."
0065 for file in `ls SiStripCommissioningSource*root`; do
0066   echo -n "."
0067   bash -c "exec -c /opt/cmssw/scripts/inject.sh $file $SCRATCH $1 SiStripCommissioning09-source $CMSSW_VERSION" >> $injectout
0068 done
0069 echo " done."
0070 echo -n "  Injecting commissioning client files ..."
0071 for file in `ls SiStripCommissioningClient*root`; do
0072   echo -n "."
0073   bash -c "exec -c /opt/cmssw/scripts/inject.sh $file $SCRATCH $1 SiStripCommissioning09-client $CMSSW_VERSION" >> $injectout
0074 done
0075 echo " done."