forked from lsoffi/egm_tnp_analysis
-
Notifications
You must be signed in to change notification settings - Fork 3
/
runSF.py
46 lines (39 loc) · 1.52 KB
/
runSF.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
import os
from multiprocessing import Pool
def GetCommand(command, den, tag):
return command%(den,tag)
def ex(command):
print 'Executing command: ', command
os.system(command)
def RunTnP(listOfArguments):
den, tag = listOfArguments
for c in commands: ex(GetCommand(c, den, tag))
return True
den = ['MID'] #['LID', 'MID', 'MPID', 'TID']
#num = ['passRelIsoL', 'passRelIsoT']
num = ['passMultiIsoL', 'passMultiIsoM', 'passMultiIsoM2017', 'passMultiIsoM2017v2', 'passMiniIsoL', 'passMiniIsoM', 'passMiniIsoT', 'passMiniIsoVT']
listInput = []
for d in den:
for n in num:
listInput.append([d,n])
njobs = len(listInput)
print 'List of inputs (%i):\n'%njobs, listInput
commands = [
'python tnpEGM_fitter.py etc/config/settings_muo_%s.py --flag %s --createBins',
'python tnpEGM_fitter.py etc/config/settings_muo_%s.py --flag %s --createHists',
'python tnpEGM_fitter.py etc/config/settings_muo_%s.py --flag %s --doFit',
'python tnpEGM_fitter.py etc/config/settings_muo_%s.py --flag %s --doFit --mcSig --altSig',
'python tnpEGM_fitter.py etc/config/settings_muo_%s.py --flag %s --doFit --altSig',
'python tnpEGM_fitter.py etc/config/settings_muo_%s.py --flag %s --doFit --altBkg',
# 'python tnpEGM_fitter.py etc/config/settings_muo_%s.py --flag %s --sumUp'
]
if njobs == 1:
print 'Secuential mode...'
RunTnP(listInput[0])
else:
print 'Multiprocess: calculating %i scale factors...'%njobs
pool = Pool(njobs)
retlist = pool.map(RunTnP, listInput)
pool.close()
pool.join()
#os.system("mv results results_data2017_MPID")