-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathrunLumiCalc
executable file
·81 lines (72 loc) · 2.72 KB
/
runLumiCalc
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
#!/bin/bash
if [ $# -lt 1 ]; then
echo "Usage: runLumiCalc normtag"
echo "Usage: runLumiCalc NORMTAG YOUR_LUMI_JSON_FILE"
exit 1
fi
BRILOPTS="-u /pb"
if [ -d /afs/cern.ch/cms -a -d /afs/cern.ch/user ]; then
BRILPATH=/afs/cern.ch/cms/lumi/brilconda-1.1.7/bin
TAGPATH=/afs/cern.ch/user/l/lumipro/public/Normtags
else
if [ ! -d ~/.lumiCalc/brilconda ]; then
echo "!!! Cannot find brilcalc executables. Install it"
[ -f Brilconda-1.1.7-Linux-x86_64.sh ] || wget https://cern.ch/cmslumisw/installers/linux-64/Brilconda-1.1.7-Linux-x86_64.sh
sh Brilconda-1.1.7-Linux-x86_64.sh -p ~/.lumiCalc/brilconda
[ -f Brilconda-1.1.7-Linux-x86_64.sh ] && rm -f Brilconda-1.1.7-Linux-x86_64.sh
fi
if [ ! -d ~/.lumiCalc/Normtags ]; then
echo "!!! Cannot find normtags. Copying files to ~/.lumiCalc"
mkdir -p ~/.lumiCalc/Normtags
scp lxplus.cern.ch:/afs/cern.ch/user/l/lumipro/public/Normtags/*.json ~/.lumiCalc/Normtags/
fi
BRILPATH=~/.lumiCalc/brilconda/bin
TAGPATH=~/.lumiCalc/Normtags
if [ -f /cvmfs/cms.cern.ch/SITECONF/local/JobConfig/site-local-config.xml ]; then
BRILOPTS="$BRILOPTS -c /cvmfs/cms.cern.ch/SITECONF/local/JobConfig/site-local-config.xml"
else
BRILOPTS="$BRILOPTS -c web"
fi
fi
OPT=$1
if [ $OPT == "normtag" ]; then
echo -e "@@@ Normtags under $TAGPATH\n"
ls $TAGPATH
exit
else
if [ $# -lt 2 ]; then
echo "!!! Please provide NORMTAG and your lumi json file"
exit 1
fi
TAGFILE=$1
[ -f $1 ] || TAGFILE=$TAGPATH/$TAGFILE
LUMIFILE=$2
if [ ! -f $LUMIFILE ]; then
echo "!!! Cannot find json file. Please check file path"
exit 3
fi
export PATH=$HOME/.local/bin:$BRILPATH:$PATH
if [ ! -f $HOME/.local/bin/brilcalc ]; then
echo "@@@ Installing brilcalc..."
pip install --install-option="--prefix=$HOME/.local" brilws
#pip install --install-option="--prefix=$HOME/.local" schema
#pip install --install-option="--prefix=$HOME/.local" numpy
#pip install --install-option="--prefix=$HOME/.local" pandas
fi
which brilcalc > /dev/null
if [ $? -ne 0 ]; then
echo "!!! Cannot find brilcalc"
exit 2
fi
echo "Running brilcalc"
if [ -f $TAGFILE ]; then
echo brilcalc lumi -b "STABLE BEAMS" --normtag $TAGFILE -i $LUMIFILE $BRILOPTS
brilcalc lumi -b "STABLE BEAMS" --normtag $TAGFILE -i $LUMIFILE $BRILOPTS
else
echo "!!! Cannot find normtag file. Please check spelling"
echo "!!! Computing lumi without normtag file"
echo brilcalc lumi -b "STABLE BEAMS" -i $LUMIFILE $BRILOPTS
brilcalc lumi -b "STABLE BEAMS" -i $LUMIFILE $BRILOPTS
fi
exit
fi