ra4_stats  0341147a0dc35f80f4e12c6003afb76a38e2ed6e
send_variations.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 import os, sys, subprocess
4 import pprint
5 import glob
6 import json
7 import string
8 import time
9 
10 
11 base_folder_name = "variations_05_10_redo/"
12 
13 resultfolder = base_folder_name+"results/"
14 model = "T1tttt"
15 
16 infolder = "/net/cms27/cms27r0/babymaker/2016_04_29/mc/T1tttt/skim_baseline/"
17 #fullsim: "/net/cms27/cms27r0/babymaker/2016_04_29/mc/merged_abcd/"
18 outfolder = base_folder_name+"wspaces/"
19 runfolder = base_folder_name+"run/"
20 
21 PATH = os.getcwd()
22 if not os.path.isdir(base_folder_name):
23  os.mkdir(base_folder_name)
24 if not os.path.isdir(outfolder):
25  os.mkdir(outfolder)
26 if not os.path.isdir(runfolder):
27  os.mkdir(runfolder)
28 if not os.path.isdir(resultfolder):
29  os.mkdir(resultfolder)
30 
31 #For all options, need to first ensure there is a systematics file that will be found by wspace_sig.exe
32 lumis = ["5","7","10","15","20"]
33 binnings = ["alternate"]
34 ["nominal","alternate"]
35 
36 
37 vetoes =["on"]
38  #,"off"]
39 mjthresholds =["350","400"]
40 mjvariables = ["mj","mj14"]
41 #["on","off"]
42 masspoints = ["mGluino-1600_mLSP-1000","mGluino-1400_mLSP-1000","mGluino-1800_mLSP-200"]
43 #["mGluino-1500_mLSP-100","mGluino-1200_mLSP-800"]
44 sig_strengths = ["0","1"]
45 
46 for lumi in lumis:
47  for binning in binnings:
48  for mjthres in mjthresholds:
49  for mjvar in mjvariables:
50  for veto in vetoes:
51  for mass in masspoints:
52  for sig_str in sig_strengths:
53  varname = "lumi"+lumi+"ifb__binning_"+binning+"__veto_"+veto+"_MJdef_"+mjvar+"_threshold_"+mjthres+"_"+mass+"_sig_str"+sig_str
54  exename = runfolder+"wspace_sig_"+varname+".sh"
55  fexe = open(exename,"w")
56  os.system("chmod u+x "+exename)
57  fexe.write("#!/bin/bash\n\n")
58  fexe.write("./run/wspace_sig.exe -l "+lumi+" -b "+binning+" -v "+veto+" -s "+mjthres+" -d "+mjvar+" -g "+sig_str +" -f "+infolder+"fullbaby_SMS-T1tttt_"+mass+"_TuneCUETP8M1_13TeV-madgraphMLM-pythia8_RunIISpring15MiniAODv2-FastAsympt25ns_74X_mcRun2_renorm_abcd.root -o "+outfolder+varname+"\n")
59  # fullsim fexe.write("./run/wspace_sig.exe -l "+lumi+" -b "+binning+" -v "+veto+" -g "+sig_str +" -f "+infolder+"mergedbaby__SMS-T1tttt_"+mass+"__abcd_nfiles_1.root -o "+outfolder+varname+"\n")
60  if sig_str == "1":
61  fexe.write("combine -M ProfileLikelihood --significance --expectSignal=1 "+outfolder+varname+"/wspace_"+model+"_"+mass+"_xsecNom.root | grep Significance | awk '{print $2}' | (read string; echo "+varname+ " $string) > "+resultfolder+varname+".txt \n")
62  if sig_str == "0":
63  fexe.write("combine -M Asymptotic "+outfolder+varname+"/wspace_"+model+"_"+mass+"_xsecNom.root | grep Limit | awk '{print $5}' | (read string; echo "+varname+ " $string) > "+resultfolder+varname+".txt \n")
64  fexe.close()
65  cmd = "JobSubmit.csh ./run/wrapper.sh "+exename
66  #print cmd
67  os.system(cmd)