msf_helper.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 #------------------------------------------------------------#
3 # warning! do not make *too many* in one go, or FTS will die
4 # usage: python msf_helper.py
5 # prod5, execute as novapro from /nova/app/home/novapro/PROD5_SHIFTERS/mcgen/fcls
6 # script to make make_sim_fcl less error-prone
7 # help: lasquith@fnal.gov, scalvez@fnal.gov
8 #------------------------------------------------------------#
9 from __future__ import print_function
10 import sys, shlex, subprocess, math, os
11 from subprocess import Popen, PIPE
12 debug = True
13 #** ND : [fhc,rhc][nonswap] make 65k, use 15k
14 #** FD : [fhc,rhc][nonswap,fluxswap] make 12k, use 6k
15 # systs = ["cherenkov","llup","lldown","detectoraging"]
16 systs = []#["mcnp"]#["detectoraging"]
17 dets = ["nd"]#,"fd"]
18 swaps = ["nonswap"]#, "swap"]
19 horns = ["0hc"]
20 pot = "2.5e16"
21 potper = "spill"
22 events = "1000"
23 lastrun = "1001999"
24 numsubruns = "64"
25 gainmode = "100"
26 generator = "genie"
27 genietune = "N1810j0211a"
28 
29 iteration = "1"
30 batchnumber = "1"
31 nppfx = "0"
32 timespec = "rocksingles"
33 nogenierw = True
34 rockonly = True
35 singlemod = True
36 geantonly = True
37 fts = True
38 tags = "--nogenierw --fts"
39 o ="/nova/app/home/novapro/PROD5_SHIFTERS/mcgen/fcls/"
40 
41 NOVAPRODUCTION_DIR = os.getenv('NOVAPRODUCTION_DIR')
42 
43 goodruns_fd_fhc = NOVAPRODUCTION_DIR + "/goodruns/fd_grl_v0_period12359.txt"
44 goodruns_nd_fhc = NOVAPRODUCTION_DIR + "/goodruns/nd_grl_v0_period12359.txt"
45 goodruns_fd_rhc = NOVAPRODUCTION_DIR + "/goodruns/fd_grl_v0_period4_6-8.txt"
46 goodruns_nd_rhc = NOVAPRODUCTION_DIR + "/goodruns/nd_grl_v0_period4_6-8.txt"
47 
48 mix_fd_fhc = "cosmic lasquith_fd_cosmics_p12359_goodruns_prod5"
49 mix_fd_rhc = "cosmic scalvez_artdaq_fd_cosmics_p4678_goodruns_prod5"
50 mix_nd_fhc = "rock prod5_nd_fhc_rock_g4"
51 mix_nd_rhc = "rock prod5_nd_rhc_rock_g4"
52 
53 plist_fhc="12359"
54 plist_rhc="4678"
55 
56 num_fd = "12000"
57 num_nd = "10000"
58 
59 mk_outdir_cmd="null"
60 
61 for syst in systs:
62  for det in dets:
63  for horn in horns:
64  if det=="fd":
65  swaps = ["nonswap", "swap"]
66  if horn=="fhc":
67  mix = mix_fd_fhc
68  num = num_fd
69  goodruns = goodruns_fd_fhc
70  plist = plist_fhc
71  elif horn=="rhc":
72  mix = mix_fd_rhc
73  num = num_fd
74  goodruns = goodruns_fd_rhc
75  plist = plist_rhc
76  elif det=="nd":
77  swaps = ["nonswap"]
78  if horn=="fhc":
79  mix = mix_nd_fhc
80  num = num_nd
81  goodruns = goodruns_nd_fhc
82  plist = plist_fhc
83  elif horn=="rhc":
84  mix = mix_nd_rhc
85  num = num_nd
86  goodruns = goodruns_nd_rhc
87  plist = plist_rhc
88 
89  for swap in swaps:
90  log = "new_"+syst+"_"+det+"_"+horn+"_"+swap+".log"
91  if not debug: log_file = open(log, 'w')
92  outdir = o+"new_"+syst+"_"+det+"_"+horn+"_"+swap
93  cmd = "make_sim_fcl --syst "+syst+" -det "+det+" -hp "+horn+" -fs "+swap+" -ts periods"+plist+" --mix "+mix+" -rsr "+num+" "+goodruns+" -gt "+genietune+" -bn "+batchnumber+" -i "+iteration+" -gen "+generator+" --nppfx "+nppfx+" "+tags+" --fts -o "+outdir
94  if det is "nd":
95  cmd += " --potper"+potper+ " --pot " + pot
96  else:
97  cmd += " --events " + events
98  mk_outdir_cmd = "mkdir "+outdir
99 
100  print("mk_outdir_cmd: ",mk_outdir_cmd)
101  print("cmd: ",cmd)
102  if not debug:
103  if not os.path.isdir(outdir):
104  p1=Popen( shlex.split(mk_outdir_cmd),stdout=PIPE, stderr=PIPE)
105  p2 = Popen( shlex.split(cmd) ,stdout=log_file ,stderr=subprocess.STDOUT )
106  # swaps
107  # horns
108  # detectors
109 #systematics
110 print("Fin.")
111 
112 
113 
114 
115 
116 
117 
118 
bool print
procfile open("FD_BRL_v0.txt")