Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:33:21

0001 #!/bin/bash
0002 
0003 wregexp=$1
0004 if [ -z $wregexp ]; then
0005     echo Search pattern for datasets not specified. Defaulting...
0006     wregexp="/RelValSingleMuPt*/GEN*RECO"
0007 fi
0008 echo WREGEXP=$wregexp
0009 
0010 cmssw_release=$2
0011 if [ -z $cmssw_release ]; then
0012     echo CMSSW release not specified. Check \$CMSSW_VERSION...
0013     if [ -n $CMSSW_VERSION ]; then
0014         cmssw_release=$CMSSW_VERSION
0015         echo CMSSW_VERSION=$cmssw_release. Using this...
0016     else
0017         echo CMSSW_VERSION not set. Exiting...
0018     fi
0019 else
0020     echo Using CMSSW release $cmssw_release...
0021 fi
0022 
0023 cfgpysIndex=0
0024 
0025 cmd="dbsql \"find dataset where dataset like $wregexp and release = $cmssw_release\""
0026 #echo $cmd
0027 for line in `eval $cmd`; do
0028     if [[ $line =~ '^/' ]]; then
0029         dataset=$line
0030         echo Fetching dataset $dataset...
0031         field1=`echo $dataset | awk -F'/' '{print $2}'`
0032         field2=`echo $dataset | awk -F'/' '{print $3}'`
0033         field3=`echo $dataset | awk -F'/' '{print $4}'`
0034         workflow=$dataset
0035 
0036         # create cfg.py for this dataset
0037         cfgpy="MuonIdValToME__${field1}__${field2}__${field3}.py"
0038         cfgpys[$cfgpysIndex]=$cfgpy
0039         cat <<EOF >$cfgpy
0040 import FWCore.ParameterSet.Config as cms
0041 
0042 process = cms.Process("MUONIDVALtoME")
0043 process.load("DQMServices.Components.EDMtoMEConverter_cff")
0044 process.load("DQMServices.Components.MessageLogger_cfi")
0045 
0046 process.maxEvents = cms.untracked.PSet(
0047     input = cms.untracked.int32(-1)
0048 )
0049 process.dqmSaver.convention = "Offline" # "RelVal"
0050 process.dqmSaver.workflow = "$workflow"
0051 process.dqmSaver.saveAtJobEnd = cms.untracked.bool(True)
0052 process.dqmSaver.forceRunNumber = cms.untracked.int32(1)
0053 
0054 process.p = cms.Path(process.EDMtoMEConverter*process.dqmSaver)
0055 
0056 process.source = cms.Source("PoolSource",
0057     fileNames = cms.untracked.vstring(
0058 EOF
0059 
0060         cmd="dbsql \"find file where dataset = $dataset\""
0061         #echo $cmd
0062 
0063         for file in `eval $cmd`; do
0064             if [[ $file =~ '^/' ]]; then
0065                 echo "\"$file\"," >>$cfgpy
0066             fi
0067         done
0068 echo '    )' >>$cfgpy
0069 echo ')' >>$cfgpy
0070     fi
0071 
0072     cfgpysIndex=$cfgpysIndex+1
0073 done
0074 
0075 echo "Running ${#cfgpys[@]} cmsRun jobs..."
0076 for cfgpy in ${cfgpys[*]}
0077 do
0078     echo "cmsRun $cfgpy"
0079     cmsRun $cfgpy
0080 done