1 |
+ |
if [ $# -lt 2 ]; then |
2 |
+ |
dataset="/SingleMu/Run2012B-PromptReco-v1/RECO" |
3 |
+ |
else |
4 |
+ |
dataset=$2 |
5 |
+ |
fi |
6 |
+ |
if [ $# -lt 3 ]; then |
7 |
+ |
template=Skim_and_Ntuple_template_cfg.py |
8 |
+ |
name=Skim_and_Ntuple_$1_cfg.py |
9 |
+ |
castor=DTDPG/2012/DTNtuple/SingleMu/ |
10 |
+ |
jobid=dt |
11 |
+ |
else |
12 |
+ |
template=Skim_and_Ntuple_UncT0_template_cfg.py |
13 |
+ |
name=Skim_and_Ntuple_UncT0_$1_cfg.py |
14 |
+ |
castor=DTDPG/2012/DTNtuple_UncT0/SingleMu/ |
15 |
+ |
jobid=du |
16 |
+ |
fi |
17 |
+ |
|
18 |
|
# find number of events for req job |
19 |
< |
events=`dbs --search --query "find sum(file.numevents) where run=$1 and dataset=/SingleMu/Run2012A-PromptReco-v1/RECO" | tail -n 1` |
19 |
> |
events=`dbs --search --query "find sum(file.numevents) where run=$1 and dataset=$dataset" | tail -n 1` |
20 |
|
# prepare list of files |
21 |
< |
dbs --search --query "find file, file.parent where run=$1 and dataset=/SingleMu/Run2012A-PromptReco-v1/RECO" | grep store > "$1""_files.txt" |
21 |
> |
dbs --search --query "find file, file.parent where run=$1 and dataset=$dataset" | grep store > "$1""_files.txt" |
22 |
|
cat $1_files.txt | awk '{print $1}' | sed "s|^|'|;s|$|',|" > $1_reco_files.txt |
23 |
|
cat $1_files.txt | awk '{print $2}' | sed "s|^|'|;s|$|',|" > $1_raw_files.txt |
24 |
|
streco=RECOFILES |
25 |
|
straw=RAWFILES |
26 |
|
stfile=FILENAME |
27 |
|
# create python |
28 |
< |
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 |
28 |
> |
sed -e "/$streco/r $1_reco_files.txt" -e "/$streco/d" $CMSSW_BASE/src/UserCode/DTDPGAnalysis/test/$template | sed -e "/$straw/r $1_raw_files.txt" -e "/$straw/d" | sed -e "s/$stfile/DTNtuple_run$1.root/g" > $CMSSW_BASE/src/$name |
29 |
|
rm $1_*files*txt |
30 |
|
echo "Python file for processing run $1 created. Job should be running on $events events..." |
31 |
|
# create shell job |
32 |
< |
echo "#!/bin/csh" > job$1.csh |
33 |
< |
echo "setenv SCRAM_ARCH slc5_amd64_gcc462" >> job$1.csh |
34 |
< |
echo "cd $CMSSW_BASE/src" >> job$1.csh |
35 |
< |
echo "eval \`scram runtime -csh\`" >> job$1.csh |
36 |
< |
echo "cd -" >> job$1.csh |
37 |
< |
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 |
38 |
< |
echo "rfcp DTNtuple_run$1.root /castor/cern.ch/user/g/guiducci/DTDPG/2012/DTNtuple/SingleMu/DTNtuple_run$1.root" >> job$1.csh |
32 |
> |
echo "#!/bin/csh" > $CMSSW_BASE/src/job$1.csh |
33 |
> |
echo "setenv SCRAM_ARCH slc5_amd64_gcc462" >> $CMSSW_BASE/src/job$1.csh |
34 |
> |
echo "cd $CMSSW_BASE/src" >> $CMSSW_BASE/src/job$1.csh |
35 |
> |
echo "eval \`scram runtime -csh\`" >> $CMSSW_BASE/src/job$1.csh |
36 |
> |
echo "cd -" >> $CMSSW_BASE/src/job$1.csh |
37 |
> |
echo "cmsRun $CMSSW_BASE/src/$name" >> $CMSSW_BASE/src/job$1.csh |
38 |
> |
echo "rfcp DTNtuple_run$1.root /castor/cern.ch/user/g/guiducci/$castor/DTNtuple_run$1.root" >> $CMSSW_BASE/src/job$1.csh |
39 |
|
# submit |
40 |
< |
#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 |
40 |
> |
bsub -R "pool>15000" -q 1nw -J $jobid$1 < $CMSSW_BASE/src/job$1.csh |
41 |
|
sleep 1 |
42 |
|
bjobs |
43 |
+ |
#nohup cmsRun Skim_and_Ntuple_$1_cfg.py > /tmp/guiducci/$1.out 2> /tmp/guiducci/$1.err < /dev/null & |