JHUGen MELA  v2.4.1
Matrix element calculations as used in JHUGen. MELA is an important tool that was used for the Higgs boson discovery and for precise measurements of its structure and interactions. Please see the website https://spin.pha.jhu.edu/ and papers cited there for more details, and kindly cite those papers when using this code.
batch.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 import os
4 import sys
5 import commands
6 
7 from ROOT import TFile
8 
9 def processDirectory ( args, dirname, filenames ):
10  print "processing " + dirname
11  for filename in filenames:
12  fullname = dirname + "/" + filename
13 
14  flavor = 10
15  if ("4e" in dirname):
16  flavor = 1
17  if ("4mu" in dirname):
18  flavor = 2
19  if ("2mu2e" in dirname) or ("2e2mu" in dirname):
20  flavor = 3
21 
22  if ("data" in dirname) and ("DoubleEle" in filename):
23  flavor = 1
24  if ("data" in dirname) and ("DoubleMu" in filename):
25  flavor = 2
26  if ("data" in dirname) and ("DoubleOr" in filename):
27  flavor = 3
28 
29  if ("CR" in dirname) and ("DoubleEle" in filename):
30  flavor = 1
31  if ("CR" in dirname) and ("DoubleMu" in filename):
32  flavor = 2
33  if ("CR" in dirname) and ("DoubleOr" in filename):
34  flavor = 3
35 
36  if ("CR" in dirname) and ("EEEE" in filename):
37  flavor = 1
38  if ("CR" in dirname) and ("MMMM" in filename):
39  flavor = 2
40  if ("CR" in dirname) and ("EEMM" in filename):
41  flavor = 3
42  if ("CR" in dirname) and ("MMEE" in filename):
43  flavor = 3
44 
45 
46  if ("withProbabilities" in filename):
47  flavor = 10 # already processed
48 
49  if not(".root" in filename):
50  flavor = 10 # only process root files
51 
52  sqrts=7
53  if ("8TeV" in dirname):
54  sqrts = 8
55 
56 
57 
58  print " " * 4 + filename + " with flavor " + str(flavor) + " and sqrts = " + str(sqrts)
59 
60 
61 
62  if flavor!=10: # looks like a valid file, prepare string
63  command = "root -q -b addProbtoTree.C\\(\\\"" + fullname[:-5] + "\\\","+str(flavor)+",-1,"+str(sqrts)+"\\)\n"
64  #create batch script
65  commands.getstatusoutput("cp batchscript.csh batchscript_tmp.csh")
66  file = open('batchscript_tmp.csh', 'a')
67  file.write(command)
68  file.close()
69  commands.getstatusoutput("bsub -q 8nh < batchscript_tmp.csh" )
70  #exit(0)
71 
72 
73 def main():
74  base_dir = "."
75  if len(sys.argv) > 1:
76  base_dir = sys.argv[1]
77  file = open('./batchscript.csh', 'w')
78  file.write("cd " + sys.argv[2] + "\n")
79  file.write("pwd\n")
80  file.write("eval `scramv1 runtime -sh`\n")
81  file.write("cd - \n")
82  file.write("cp " + sys.argv[2] + "/addProbtoTree.C . \n")
83  file.close()
84 
85  os.path.walk( base_dir, processDirectory, None )
86 
87 if __name__ == "__main__":
88  main()
open
with open("/mnt/sda1/RandomRantings/JHU/Andrei_Research/DocumentingMELA/raw_couplings.txt") as f
Definition: write_bindings.txt:1
batch.processDirectory
def processDirectory(args, dirname, filenames)
Definition: batch.py:9
batch.main
def main()
Definition: batch.py:73