-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathGENtoDelphes.sh
executable file
·141 lines (115 loc) · 4.21 KB
/
GENtoDelphes.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#!/bin/bash
#################################### Wrapper submit script for Upgrade production
#Written by Alexis Kalogeropoulos - July 2014
#Adapted by Julie Hogan - summer 2016, [email protected]
source /cvmfs/cms.cern.ch/cmsset_default.sh
export SCRAM_ARCH=slc6_amd64_gcc530
startTime=`date +%s`
# Condor arguments
# Arguments = %(FILEIN)s %(OUTPUTDIR)s/%(RELPATH)s_%(PILEUP)s %(FILEOUT)s.root %(PILEUP)s
FILEIN=$1
OUTPUT=$2
FILEOUT=$3
PILEUP=$4
SKIPEVT=$5
MAXEVT=$6
echo "Starting job on " `date`
echo "Running on " `uname -a`
echo "System release " `cat /etc/redhat-release`
if [[ $# -eq 4 ]] ; then
echo "Setting SkipEvents to 0, no argument given"
SKIPEVT=0
echo "Setting MaxEvents to -1, no argument given"
MAXEVT=-1
fi
# Set variables
detCard=CMS_PhaseII_${PILEUP}_v03_splitter.tcl
energy=14
DelphesVersion=tags/3.4.2pre15
nPU=`echo $detCard | cut -d '_' -f 2 | cut -d '.' -f 1`
process=`echo $FILEIN | cut -d '_' -f 1-2`
configuration=`echo $detCard | cut -d '_' -f 1-2`
DelphesOutput=CMSP2_${nPU}_`echo $FILEIN`.root
# make the CMSSW release, compile, and copy
scram project CMSSW_9_1_0_pre3
cd CMSSW_9_1_0_pre3/src
eval `scram runtime -sh`
cd -
echo "xrdcp source tarball and pileup file"
xrdcp -f root://cmseos.fnal.gov//store/user/snowmass/DelphesSubmissionLPCcondor/Delphes342pre15.tar . #CHECK ME!
XRDEXIT=$?
if [[ $XRDEXIT -ne 0 ]]; then
echo "exit code $XRDEXIT, failure in xrdcp of Delphes.tar"
exit $XRDEXIT
fi
tar -xf Delphes342pre15.tar
rm -f Delphes342pre15.tar
cd delphes
# Delphes is already compiled in the tarball
xrdcp -f root://cmseos.fnal.gov//store/user/snowmass/DelphesSubmissionLPCcondor/MinBias_100k.pileup .
XRDEXIT=$?
if [[ $XRDEXIT -ne 0 ]]; then
echo "exit code $XRDEXIT, failure in xrdcp of MinBias_100k.pileup"
exit $XRDEXIT
fi
# echo "xrdcp input miniAOD"
# filein should already be in root://eoscms.cern.ch//store/mc/... format
# xrdcp -f ${FILEIN} delphesinput.root
# XRDEXIT=$?
# if [[ $XRDEXIT -ne 0 ]]; then
# echo "exit code $XRDEXIT, failure in xrdcp of GEN file"
# exit $XRDEXIT
# fi
setupTime=`date +%s`
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#run MiniAOD through Delphes
sed -i "s|MAXEVENTS|${MAXEVT}|g" cards/CMS_PhaseII/$detCard
sed -i "s|SKIPEVENTS|${SKIPEVT}|g" cards/CMS_PhaseII/$detCard
./DelphesCMSFWLite cards/CMS_PhaseII/$detCard ${FILEOUT} ${FILEIN}
DELPHESEXIT=$?
if [[ $DELPHESEXIT -ne 0 ]]; then
echo "exit code $DELPHESEXIT, failure in DelphesCMSFWLite (maybe from xrootd)"
exit $DELPHESEXIT
fi
DelphesTime=`date +%s`
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#metadata
echo "User: " `eval whoami`
echo "Date: " `date`
echo
echo "Process: " $process
echo "Pileup Conditions: " $nPU
echo "Configuration: " $configuration
echo "Energy: " $energy
echo
echo "Input MiniAOD: " $FILEIN
echo "Skipped Events: " $SKIPEVT
echo "Run Events: " $MAXEVT
echo
echo "Delphes Output: " $FILEOUT
echo "Delphes Version: " $DelphesVersion
echo "Detector Card: " $detCard
echo
echo "Minutes spent setting up job: " `expr $setupTime / 60 - $startTime / 60`
echo "Minutes spent running Delphes: " `expr $DelphesTime / 60 - $setupTime / 60`
echo
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# copy output to eos
# Running @CERN this should be fine with the root://eoscms.cern.ch eosOutDir
# Running @DESY likely need to change this copy command!
echo "xrdcp -f ${FILEOUT} root://cmseos.fnal.gov/${OUTPUT}/${FILEOUT}"
xrdcp -f ${FILEOUT} root://cmseos.fnal.gov/${OUTPUT}/${FILEOUT} 2>&1
#xrdcp -f ${FILEOUT} root://eoscms.cern.ch/${OUTPUT}/${FILEOUT} 2>&1
#gfal-cp ${FILEOUT} srm://dcache-se-cms.desy.de/pnfs/desy.de/cms/tier2/${OUTPUT}/${FILEOUT} 2>&1 ## Maybe??
XRDEXIT=$?
if [[ $XRDEXIT -ne 0 ]]; then
echo "exit code $XRDEXIT, failure in xrdcp of ROOT"
exit $XRDEXIT
fi
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
endTime=`date +%s`
echo "Time spent copying output (s): " `expr $endTime - $DelphesTime`
echo "Total runtime (m): " `expr $endTime / 60 - $startTime / 60`
echo "removing inputs from condor"
rm -f ${FILEOUT}
rm -f *.root MinBias_100k.pileup