1 |
guiducci |
1.1 |
# find number of events for req job
|
2 |
|
|
events=`dbs --search --query "find sum(file.numevents) where run=$1 and dataset=/SingleMu/Run2012A-PromptReco-v1/RECO" | tail -n 1`
|
3 |
|
|
# prepare list of files
|
4 |
|
|
dbs --search --query "find file, file.parent where run=$1 and dataset=/SingleMu/Run2012A-PromptReco-v1/RECO" | grep store > "$1""_files.txt"
|
5 |
|
|
cat $1_files.txt | awk '{print $1}' | sed "s|^|'|;s|$|',|" > $1_reco_files.txt
|
6 |
|
|
cat $1_files.txt | awk '{print $2}' | sed "s|^|'|;s|$|',|" > $1_raw_files.txt
|
7 |
|
|
streco=RECOFILES
|
8 |
|
|
straw=RAWFILES
|
9 |
|
|
stfile=FILENAME
|
10 |
|
|
# create python
|
11 |
|
|
sed -e "/$streco/r $1_reco_files.txt" -e "/$streco/d" $CMSSW_BASE/src/UserCode/DTDPGAnalysis/test/Skim_and_Ntuple_template_cfg.py | sed -e "/$straw/r $1_raw_files.txt" -e "/$straw/d" | sed -e "s/$stfile/DTNtuple_run$1.root/g" > Skim_and_Ntuple_$1_cfg.py
|
12 |
|
|
rm $1_*files*txt
|
13 |
|
|
echo "Python file for processing run $1 created. Job should be running on $events events..."
|
14 |
|
|
# create shell job
|
15 |
|
|
echo "#!/bin/csh" > job$1.csh
|
16 |
|
|
echo "setenv SCRAM_ARCH slc5_amd64_gcc462" >> job$1.csh
|
17 |
|
|
echo "cd $CMSSW_BASE/src" >> job$1.csh
|
18 |
|
|
echo "eval \`scram runtime -csh\`" >> job$1.csh
|
19 |
|
|
echo "cd -" >> job$1.csh
|
20 |
|
|
echo "cmsRun /afs/cern.ch/user/g/guiducci/scratch0/DPG/CMSSW_5_2_3_patch1/src/Skim_and_Ntuple_$1_cfg.py" >> job$1.csh
|
21 |
|
|
echo "rfcp DTNtuple_run$1.root /castor/cern.ch/user/g/guiducci/DTDPG/2012/DTNtuple/SingleMu/DTNtuple_run$1.root" >> job$1.csh
|
22 |
|
|
# submit
|
23 |
|
|
#nohup cmsRun Skim_and_Ntuple_$1_cfg.py > /tmp/guiducci/$1.out 2> /tmp/guiducci/$1.err < /dev/null &
|
24 |
|
|
bsub -R "pool>15000" -q 1nw -J dt$1 < job$1.csh
|
25 |
|
|
sleep 1
|
26 |
|
|
bjobs
|