forked from cvernier/Vg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makeSigFits.py
49 lines (43 loc) · 1.69 KB
/
makeSigFits.py
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
import os
from time import sleep
from subprocess import call
import shlex
from optparse import OptionParser
from getMasses import getMasses
parser = OptionParser()
parser.add_option("-c", "--category" , dest="category",
help = "either 'btag' or 'antibtag'" )
parser.add_option("-s", "--step" , dest="step",
help = "either 'fullsim' or 'interpolated'" )
parser.add_option("-i", "--massIndex" , type=int, dest="massIndex",
help = "either 'fullsim' or 'interpolated'" )
(options, args) = parser.parse_args()
if not options.category in ["antibtag", "btag"]:
print "invalid category given, must be either 'btag' or 'antibtag'."
exit(1)
cmsenv = os.environ
dirName = "signalFitsHack650_%s_%s" % (options.category, options.step)
if not os.path.exists(dirName):
os.makedirs(dirName)
masses = []
inputDir = ""
if options.step == "interpolated":
masses=getMasses("all")
inputDir = "GenSignal"
elif options.step == "fullsim":
masses=getMasses("fullsim")
inputDir = "../vgHists_600"
else:
print "please use the -s option and pick step 'interpolated' or 'fullsim'"
exit(1)
if options.massIndex > len(masses) or options.massIndex < 0:
print "invalid mass index: it must be equal to or greater than 0 and less than %i" % len(masses)
exit(1)
mass=masses[options.massIndex]
incantation = shlex.split("root -x -b -l -q 'Display_SignalFits.cc(\"%s\",\"%s\",\"\",\"histos_sig_m\",%i,1,%s%s)'" %
(options.category, inputDir, mass, '"'+dirName+'"', ',"interpolated"' if options.step == "interpolated" else "")
)
print incantation
call(incantation, env=cmsenv)
sleep(.2)
mass += 10