-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdt
executable file
·49 lines (36 loc) · 1.03 KB
/
dt
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
#!/bin/bash
helpmessage() {
echo -e "usage: dt [input]\n"
echo -e " -k, --key group by event/module/label [0, 1, 2]"
echo -e " -t, --tag tag"
}
ARGS=()
while [ $# -gt 0 ]; do
case "$1" in
-h|--help) helpmessage; exit 0 ;;
-k|--key) key="$2"; shift 2 ;;
--key=*) key="${1#*=}"; shift ;;
-t|--tag) tag="$2"; shift 2 ;;
--tag=*) tag="${1#*=}"; shift ;;
-*) echo -e "invalid option: $1\n"; exit 1 ;;
*) ARGS+=("$1"); shift ;;
esac
done
set -- "${ARGS[@]}"
[ $# -ne 1 ] && { echo -e "check arguments\n"; exit 1; }
input=$1
[ $tag ] || tag=dt
file=$(basename $input)
timestamp=$(date +"%F-%H_%M_%S")
label=${tag}_${file%%.*}_${timestamp}
mkdir $label
cp $input $label/$label.py
pushd $label
cat >> $label.py << @EOF
process.Timing = cms.Service("Timing",
summaryOnly = cms.untracked.bool(False),
useJobReport = cms.untracked.bool(True))
@EOF
cmsRun $label.py &> $label.log
blame $label.log -k $key > $label.time
popd