1954
1961
' have been saved in %s' % pjoin(self.me_dir, 'Events', self.run_name))
1957
def combine_plots_HwU(self,jobs):
1964
def combine_plots_HwU(self,jobs,out,normalisation=None):
1958
1965
"""Sums all the plots in the HwU format."""
1959
1966
logger.debug('Combining HwU plots.')
1969
command.append(pjoin(self.me_dir, 'bin', 'internal','histograms.py'))
1961
1970
for job in jobs:
1962
all_histo_paths.append(pjoin(job['dirname'],"MADatNLO.HwU"))
1963
histogram_list = histograms.HwUList(all_histo_paths[0])
1964
for histo_path in all_histo_paths[1:]:
1965
for i, histo in enumerate(histograms.HwUList(histo_path)):
1966
# First make sure the plots have the same weight labels and such
1967
histo.test_plot_compability(histogram_list[i])
1968
# Now let the histogram module do the magic and add them.
1969
histogram_list[i] += histo
1971
# And now output the finalized list
1972
histogram_list.output(pjoin(self.me_dir,'SubProcesses',"MADatNLO"),
1971
if job['dirname'].endswith('.HwU'):
1972
command.append(job['dirname'])
1974
command.append(pjoin(job['dirname'],'MADatNLO.HwU'))
1975
command.append("--out="+out)
1976
command.append("--gnuplot")
1977
command.append("--band=[]")
1978
command.append("--lhapdf-config="+self.options['lhapdf'])
1980
command.append("--multiply="+(','.join([str(n) for n in normalisation])))
1981
command.append("--sum")
1982
command.append("--no_open")
1984
p = misc.Popen(command, stdout = subprocess.PIPE, stderr = subprocess.STDOUT, cwd=self.me_dir)
1986
while p.poll() is None:
1987
line = p.stdout.readline()
1988
if any(t in line for t in ['INFO:','WARNING:','CRITICAL:','ERROR:','KEEP:']):
1990
elif __debug__ and line:
1991
logger.debug(line[:-1])
1975
1994
def applgrid_combine(self,cross,error,jobs):
1976
1995
"""Combines the APPLgrids in all the SubProcess/P*/all_G*/ directories"""
1977
1996
logger.debug('Combining APPLgrids \n')
2179
2198
self.cross_sect_dict['axsec_string']='(Partial) abs(decay width)'
2181
2200
self.cross_sect_dict['unit']='pb'
2182
self.cross_sect_dict['xsec_string']='Total cross-section'
2183
self.cross_sect_dict['axsec_string']='Total abs(cross-section)'
2184
# Gather some basic statistics for the run and extracted from the log files.
2185
if mode in ['aMC@NLO', 'aMC@LO', 'noshower', 'noshowerLO']:
2186
log_GV_files = glob.glob(pjoin(self.me_dir, \
2187
'SubProcesses', 'P*','G*','log_MINT*.txt'))
2188
all_log_files = log_GV_files
2190
log_GV_files = glob.glob(pjoin(self.me_dir, \
2191
'SubProcesses', 'P*','all_G*','log_MINT*.txt'))
2192
all_log_files = log_GV_files
2201
self.cross_sect_dict['xsec_string']='Total cross section'
2202
self.cross_sect_dict['axsec_string']='Total abs(cross section)'
2196
all_log_files = glob.glob(pjoin(self.me_dir, \
2197
'SubProcesses', 'P*','born_G*','log_MINT*.txt'))
2199
raise aMCatNLOError, 'Running mode %s not supported.'%mode
2202
2204
if mode in ['aMC@NLO', 'aMC@LO', 'noshower', 'noshowerLO']:
2203
2205
status = ['Determining the number of unweighted events per channel',
2204
2206
'Updating the number of unweighted events per channel',
2207
message = status[step] + '\n\n Intermediate results:' + \
2208
('\n Random seed: %(randinit)d' + \
2209
'\n %(xsec_string)s: %(xsect)8.3e +- %(errt)6.1e %(unit)s' + \
2210
'\n %(axsec_string)s: %(xseca)8.3e +- %(erra)6.1e %(unit)s \n') \
2211
% self.cross_sect_dict
2214
message = '\n ' + status[step] + proc_info + \
2215
'\n %(xsec_string)s: %(xsect)8.3e +- %(errt)6.1e %(unit)s' % \
2216
self.cross_sect_dict
2218
if self.run_card['nevents']>=10000 and self.run_card['reweight_scale']:
2219
message = message + \
2220
('\n Ren. and fac. scale uncertainty: +%0.1f%% -%0.1f%%') % \
2221
(scale_pdf_info['scale_upp'], scale_pdf_info['scale_low'])
2222
if self.run_card['nevents']>=10000 and self.run_card['reweight_PDF']:
2223
message = message + \
2224
('\n PDF uncertainty: +%0.1f%% -%0.1f%%') % \
2225
(scale_pdf_info['pdf_upp'], scale_pdf_info['pdf_low'])
2227
neg_frac = (self.cross_sect_dict['xseca'] - self.cross_sect_dict['xsect'])/\
2228
(2. * self.cross_sect_dict['xseca'])
2229
message = message + \
2230
('\n Number of events generated: %s' + \
2231
'\n Parton shower to be used: %s' + \
2232
'\n Fraction of negative weights: %4.2f' + \
2233
'\n Total running time : %s') % \
2234
(self.run_card['nevents'],
2235
self.run_card['parton_shower'].upper(),
2237
misc.format_timer(time.time()-self.start_time))
2208
computed='(computed from LHE events)'
2239
2209
elif mode in ['NLO', 'LO']:
2240
2210
status = ['Results after grid setup:','Current results:',
2241
2211
'Final results and run summary:']
2242
if (not done) and (step == 0):
2212
computed='(computed from histogram information)'
2214
if step != 2 and mode in ['aMC@NLO', 'aMC@LO', 'noshower', 'noshowerLO']:
2215
message = status[step] + '\n\n Intermediate results:' + \
2216
('\n Random seed: %(randinit)d' + \
2217
'\n %(xsec_string)s: %(xsect)8.3e +- %(errt)6.1e %(unit)s' + \
2218
'\n %(axsec_string)s: %(xseca)8.3e +- %(erra)6.1e %(unit)s \n') \
2219
% self.cross_sect_dict
2220
elif mode in ['NLO','LO'] and not done:
2243
2222
message = '\n ' + status[0] + \
2244
'\n %(xsec_string)s: %(xsect)8.3e +- %(errt)6.1e %(unit)s' % \
2245
self.cross_sect_dict
2223
'\n %(xsec_string)s: %(xsect)8.3e +- %(errt)6.1e %(unit)s' % \
2224
self.cross_sect_dict
2247
2226
message = '\n ' + status[1] + \
2248
'\n %(xsec_string)s: %(xsect)8.3e +- %(errt)6.1e %(unit)s' % \
2249
self.cross_sect_dict
2251
message = '\n ' + status[2] + proc_info + \
2252
'\n %(xsec_string)s: %(xsect)8.3e +- %(errt)6.1e %(unit)s' % \
2253
self.cross_sect_dict
2254
if self.run_card['reweight_scale']:
2255
if self.run_card['ickkw'] != -1:
2256
message = message + \
2257
('\n Ren. and fac. scale uncertainty: +%0.1f%% -%0.1f%%') % \
2258
(scale_pdf_info['scale_upp'], scale_pdf_info['scale_low'])
2260
message = message + \
2261
('\n Soft and hard scale dependence (added in quadrature): +%0.1f%% -%0.1f%%') % \
2262
(scale_pdf_info['scale_upp_quad'], scale_pdf_info['scale_low_quad'])
2263
if self.run_card['reweight_PDF']:
2264
message = message + \
2265
('\n PDF uncertainty: +%0.1f%% -%0.1f%%') % \
2266
(scale_pdf_info['pdf_upp'], scale_pdf_info['pdf_low'])
2227
'\n %(xsec_string)s: %(xsect)8.3e +- %(errt)6.1e %(unit)s' % \
2228
self.cross_sect_dict
2231
message = '\n --------------------------------------------------------------'
2232
message = message + \
2233
'\n ' + status[2] + proc_info + \
2234
'\n Number of events generated: %s' % self.run_card['nevents'] +\
2235
'\n %(xsec_string)s: %(xsect)8.3e +- %(errt)6.1e %(unit)s' % \
2236
self.cross_sect_dict
2237
message = message + \
2238
'\n --------------------------------------------------------------'
2239
if scale_pdf_info and (self.run_card['nevents']>=10000 or mode in ['NLO', 'LO']):
2240
if scale_pdf_info[0]:
2241
# scale uncertainties
2242
message = message + '\n Scale variation %s:' % computed
2243
for s in scale_pdf_info[0]:
2245
if self.run_card['ickkw'] != -1:
2246
message = message + \
2247
('\n Dynamical_scale_choice %(label)i (envelope of %(size)s values): '\
2248
'\n %(cen)8.3e pb +%(max)0.1f%% -%(min)0.1f%%') % s
2250
message = message + \
2251
('\n Soft and hard scale dependence (added in quadrature): '\
2252
'\n %(cen)8.3e pb +%(max_q)0.1f%% -%(min_q)0.1f%%') % s
2255
message = message + \
2256
('\n Dynamical_scale_choice %(label)i: '\
2257
'\n %(cen)8.3e pb') % s
2259
if scale_pdf_info[1]:
2260
message = message + '\n PDF variation %s:' % computed
2261
for p in scale_pdf_info[1]:
2262
if p['unc']=='none':
2263
message = message + \
2264
('\n %(name)s (central value only): '\
2265
'\n %(cen)8.3e pb') % p
2267
elif p['unc']=='unknown':
2268
message = message + \
2269
('\n %(name)s (%(size)s members; combination method unknown): '\
2270
'\n %(cen)8.3e pb') % p
2272
message = message + \
2273
('\n %(name)s (%(size)s members; using %(unc)s method): '\
2274
'\n %(cen)8.3e pb +%(max)0.1f%% -%(min)0.1f%%') % p
2276
message = message + \
2277
'\n --------------------------------------------------------------'
2268
2280
if (mode in ['NLO', 'LO'] and not done) or \
2269
2281
(mode in ['aMC@NLO', 'aMC@LO', 'noshower', 'noshowerLO'] and step!=2):
2273
2285
# Some advanced general statistics are shown in the debug message at the
2274
2286
# end of the run
2275
2287
# Make sure it never stops a run
2288
# Gather some basic statistics for the run and extracted from the log files.
2289
if mode in ['aMC@NLO', 'aMC@LO', 'noshower', 'noshowerLO']:
2290
log_GV_files = glob.glob(pjoin(self.me_dir, \
2291
'SubProcesses', 'P*','G*','log_MINT*.txt'))
2292
all_log_files = log_GV_files
2294
log_GV_files = glob.glob(pjoin(self.me_dir, \
2295
'SubProcesses', 'P*','all_G*','log_MINT*.txt'))
2296
all_log_files = log_GV_files
2300
all_log_files = glob.glob(pjoin(self.me_dir, \
2301
'SubProcesses', 'P*','born_G*','log_MINT*.txt'))
2303
raise aMCatNLOError, 'Running mode %s not supported.'%mode
2277
2306
message, debug_msg = \
2278
2307
self.compile_advanced_stats(log_GV_files, all_log_files, message)
2279
2308
except Exception as e:
2280
debug_msg = 'Advanced statistics collection failed with error "%s"'%str(e)
2309
debug_msg = 'Advanced statistics collection failed with error "%s"\n'%str(e)
2310
err_string = StringIO.StringIO()
2311
traceback.print_exc(limit=4, file=err_string)
2312
debug_msg += 'Please report this backtrace to a MadGraph developer:\n%s'\
2313
%err_string.getvalue()
2282
2315
logger.debug(debug_msg+'\n')
2283
2316
logger.info(message+'\n')
3143
3190
files.mv(pjoin(self.me_dir, 'Events', self.run_name, 'sum.top'),
3144
3191
pjoin(self.me_dir, 'Events', self.run_name, '%s%d.top' % (filename, i)))
3145
3192
elif out_id=='HWU':
3146
histogram_list=histograms.HwUList(plotfiles[0])
3147
for ii, histo in enumerate(histogram_list):
3148
histogram_list[ii] = histo*norm
3149
for histo_path in plotfiles[1:]:
3150
for ii, histo in enumerate(histograms.HwUList(histo_path)):
3151
# First make sure the plots have the same weight labels and such
3152
histo.test_plot_compability(histogram_list[ii])
3153
# Now let the histogram module do the magic and add them.
3154
histogram_list[ii] += histo*norm
3155
# And now output the finalized list
3156
histogram_list.output(pjoin(self.me_dir,'Events',self.run_name,'%s%d'% (filename, i)),
3193
out=pjoin(self.me_dir,'Events',
3194
self.run_name,'%s%d'% (filename,i))
3197
for plotfile in plotfiles:
3198
histos.append({'dirname':plotfile})
3200
self.combine_plots_HwU(histos,out,normalisation=norms)
3159
3202
misc.call(['gnuplot','%s%d.gnuplot' % (filename, i)],\
3160
3203
stdout=os.open(os.devnull, os.O_RDWR),\
3161
3204
stderr=os.open(os.devnull, os.O_RDWR),\
3162
cwd=pjoin(self.me_dir, 'Events', self.run_name))
3205
cwd=pjoin(self.me_dir, 'Events',self.run_name))
3163
3206
except Exception:
3555
3609
and returns it in percents. The expected format of the file
3556
3610
is: n_scales xsec_scale_central xsec_scale1 ... n_pdf
3557
3611
xsec_pdf0 xsec_pdf1 ...."""
3563
3614
for evt_file in evt_files:
3564
3615
path, evt=os.path.split(evt_file)
3565
data_file=open(pjoin(self.me_dir, 'SubProcesses', path, 'scale_pdf_dependence.dat')).read()
3566
lines = data_file.replace("D", "E").split("\n")
3568
numofscales = int(lines[0])
3570
numofpdf = int(lines[2])
3571
scales_this = [float(val) for val in lines[1].split()]
3572
pdfs_this = [float(val) for val in lines[3].split()]
3574
if numofscales != len(scales_this) or numofpdf !=len(pdfs_this):
3575
# the +1 takes the 0th (central) set into account
3576
logger.info(data_file)
3577
logger.info((' Expected # of scales: %d\n'+
3578
' Found # of scales: %d\n'+
3579
' Expected # of pdfs: %d\n'+
3580
' Found # of pdfs: %d\n') %
3581
(numofscales, len(scales_this), numofpdf, len(pdfs_this)))
3582
raise aMCatNLOError('inconsistent scale_pdf_dependence.dat')
3584
scales = [0.] * numofscales
3586
pdfs = [0.] * numofpdf
3588
scales = [a + b for a, b in zip(scales, scales_this)]
3589
pdfs = [a + b for a, b in zip(pdfs, pdfs_this)]
3591
# get the central value
3592
if numofscales>0 and numofpdf==0:
3594
elif numofpdf>0 and numofscales==0:
3596
elif numofpdf>0 and numofscales>0:
3597
if abs(1-scales[0]/pdfs[0])>0.0001:
3598
raise aMCatNLOError('Central values for scale and PDF variation not identical')
3616
with open(pjoin(self.me_dir, 'SubProcesses', path, 'scale_pdf_dependence.dat'),'r') as f:
3617
data_line=f.readline()
3618
if "scale variations:" in data_line:
3619
for i,scale in enumerate(self.run_card['dynamical_scale_choice']):
3620
data_line = f.readline().split()
3621
scales_this = [float(val) for val in f.readline().replace("D", "E").split()]
3623
scales[i] = [a + b for a, b in zip(scales[i], scales_this)]
3625
scales+=[scales_this]
3626
data_line=f.readline()
3627
if "pdf variations:" in data_line:
3628
for i,pdf in enumerate(self.run_card['lhaid']):
3629
data_line = f.readline().split()
3630
pdfs_this = [float(val) for val in f.readline().replace("D", "E").split()]
3632
pdfs[i] = [a + b for a, b in zip(pdfs[i], pdfs_this)]
3602
3636
# get the scale uncertainty in percent
3604
if cntrl_val != 0.0:
3605
# max and min of the full envelope
3606
scale_pdf_info['scale_upp'] = (max(scales)/cntrl_val-1)*100
3607
scale_pdf_info['scale_low'] = (1-min(scales)/cntrl_val)*100
3608
# ren and fac scale dependence added in quadrature
3609
scale_pdf_info['scale_upp_quad'] = ((cntrl_val+math.sqrt(math.pow(max(scales[0]-cntrl_val,scales[1]-cntrl_val,scales[2]-cntrl_val),2)+math.pow(max(scales[0]-cntrl_val,scales[3]-cntrl_val,scales[6]-cntrl_val),2)))/cntrl_val-1)*100
3610
scale_pdf_info['scale_low_quad'] = (1-(cntrl_val-math.sqrt(math.pow(min(scales[0]-cntrl_val,scales[1]-cntrl_val,scales[2]-cntrl_val),2)+math.pow(min(scales[0]-cntrl_val,scales[3]-cntrl_val,scales[6]-cntrl_val),2)))/cntrl_val)*100
3638
for j,scale in enumerate(scales):
3640
if s_cen != 0.0 and self.run_card['reweight_scale'][j]:
3641
# max and min of the full envelope
3642
s_max=(max(scale)/s_cen-1)*100
3643
s_min=(1-min(scale)/s_cen)*100
3644
# ren and fac scale dependence added in quadrature
3647
for i in range(len(self.run_card['rw_rscale'])):
3648
ren_var.append(scale[i]-s_cen) # central fac scale
3649
for i in range(len(self.run_card['rw_fscale'])):
3650
fac_var.append(scale[i*len(self.run_card['rw_rscale'])]-s_cen) # central ren scale
3651
s_max_q=((s_cen+math.sqrt(math.pow(max(ren_var),2)+math.pow(max(fac_var),2)))/s_cen-1)*100
3652
s_min_q=(1-(s_cen-math.sqrt(math.pow(min(ren_var),2)+math.pow(min(fac_var),2)))/s_cen)*100
3612
scale_pdf_info['scale_upp'] = 0.0
3613
scale_pdf_info['scale_low'] = 0.0
3615
# get the pdf uncertainty in percent (according to the Hessian method)
3616
lhaid=self.run_card['lhaid']
3620
# use Hessian method (CTEQ & MSTW)
3622
for i in range(int(numofpdf/2)):
3623
pdf_upp=pdf_upp+math.pow(max(0.0,pdfs[2*i+1]-cntrl_val,pdfs[2*i+2]-cntrl_val),2)
3624
pdf_low=pdf_low+math.pow(max(0.0,cntrl_val-pdfs[2*i+1],cntrl_val-pdfs[2*i+2]),2)
3625
if cntrl_val != 0.0:
3626
scale_pdf_info['pdf_upp'] = math.sqrt(pdf_upp)/cntrl_val*100
3627
scale_pdf_info['pdf_low'] = math.sqrt(pdf_low)/cntrl_val*100
3660
scale_info.append({'cen':s_cen, 'min':s_min, 'max':s_max, \
3661
'min_q':s_min_q, 'max_q':s_max_q, 'size':s_size, \
3662
'label':self.run_card['dynamical_scale_choice'][j], \
3663
'unc':self.run_card['reweight_scale'][j]})
3665
# check if we can use LHAPDF to compute the PDF uncertainty
3666
if any(self.run_card['reweight_pdf']):
3668
lhapdf_libdir=subprocess.Popen([self.options['lhapdf'],'--libdir'],\
3669
stdout=subprocess.PIPE).stdout.read().strip()
3672
candidates=[dirname for dirname in os.listdir(lhapdf_libdir) \
3673
if os.path.isdir(pjoin(lhapdf_libdir,dirname))]
3676
for candidate in candidates:
3677
if os.path.isfile(pjoin(lhapdf_libdir,candidate,'site-packages','lhapdf.so')):
3678
sys.path.insert(0,pjoin(lhapdf_libdir,candidate,'site-packages'))
3689
candidates=[dirname for dirname in os.listdir(lhapdf_libdir+'64') \
3690
if os.path.isdir(pjoin(lhapdf_libdir+'64',dirname))]
3693
for candidate in candidates:
3694
if os.path.isfile(pjoin(lhapdf_libdir+'64',candidate,'site-packages','lhapdf.so')):
3695
sys.path.insert(0,pjoin(lhapdf_libdir+'64',candidate,'site-packages'))
3709
logger.warning("Failed to access python version of LHAPDF: "\
3710
"cannot compute PDF uncertainty from the "\
3711
"weights in the events. The weights in the LHE " \
3712
"event files will still cover all PDF set members, "\
3713
"but there will be no PDF uncertainty printed in the run summary. \n "\
3714
"If the python interface to LHAPDF is available on your system, try "\
3715
"adding its location to the PYTHONPATH environment variable and the"\
3716
"LHAPDF library location to LD_LIBRARY_PATH (linux) or DYLD_LIBRARY_PATH (mac os x).")
3719
# turn off lhapdf printing any messages
3720
if any(self.run_card['reweight_pdf']) and use_lhapdf: lhapdf.setVerbosity(0)
3723
for j,pdfset in enumerate(pdfs):
3725
if p_cen != 0.0 and self.run_card['reweight_pdf'][j]:
3727
pdfsetname=self.run_card['lhapdfsetname'][j]
3729
p=lhapdf.getPDFSet(pdfsetname)
3730
ep=p.uncertainty(pdfset,-1)
3732
p_min=abs(ep.errminus/p_cen)*100
3733
p_max=abs(ep.errplus/p_cen)*100
3736
p_conf=p.errorConfLevel
3738
logger.warning("Could not access LHAPDF to compute uncertainties for %s" % pdfsetname)
3629
scale_pdf_info['pdf_upp'] = 0.0
3630
scale_pdf_info['pdf_low'] = 0.0
3632
# use Gaussian method (NNPDF)
3634
for i in range(int(numofpdf-1)):
3635
pdf_stdev = pdf_stdev + pow(pdfs[i+1] - cntrl_val,2)
3636
pdf_stdev = math.sqrt(pdf_stdev/int(numofpdf-2))
3637
if cntrl_val != 0.0:
3638
scale_pdf_info['pdf_upp'] = pdf_stdev/cntrl_val*100
3750
pdfsetname=self.run_card['lhaid'][j]
3640
scale_pdf_info['pdf_upp'] = 0.0
3641
scale_pdf_info['pdf_low'] = scale_pdf_info['pdf_upp']
3757
pdfsetname=self.run_card['lhaid'][j]
3758
pdf_info.append({'cen':p_cen, 'min':p_min, 'max':p_max, \
3759
'unc':p_type, 'name':pdfsetname, 'size':p_size, \
3760
'label':self.run_card['lhaid'][j], 'conf':p_conf})
3762
scale_pdf_info=[scale_info,pdf_info]
3642
3763
return scale_pdf_info
4694
4804
_shower_parser.add_option("-f", "--force", default=False, action='store_true',
4695
4805
help="Use the shower_card present in the directory for the launch, without editing")
4807
if '__main__' == __name__:
4808
# Launch the interface without any check if one code is already running.
4809
# This can ONLY run a single command !!
4811
if not sys.version_info[0] == 2 or sys.version_info[1] < 6:
4812
sys.exit('MadGraph/MadEvent 5 works only with python 2.6 or later (but not python 3.X).\n'+\
4813
'Please upgrate your version of python.')
4817
# Get the directory of the script real path (bin)
4818
# and add it to the current PYTHONPATH
4819
root_path = os.path.dirname(os.path.dirname(os.path.realpath( __file__ )))
4820
sys.path.insert(0, root_path)
4822
class MyOptParser(optparse.OptionParser):
4823
class InvalidOption(Exception): pass
4824
def error(self, msg=''):
4825
raise MyOptParser.InvalidOption(msg)
4826
# Write out nice usage message if called with -h or --help
4827
usage = "usage: %prog [options] [FILE] "
4828
parser = MyOptParser(usage=usage)
4829
parser.add_option("-l", "--logging", default='INFO',
4830
help="logging level (DEBUG|INFO|WARNING|ERROR|CRITICAL) [%default]")
4831
parser.add_option("","--web", action="store_true", default=False, dest='web', \
4832
help='force toce to be in secure mode')
4833
parser.add_option("","--debug", action="store_true", default=False, dest='debug', \
4834
help='force to launch debug mode')
4838
for i in range(len(sys.argv)-1):
4840
(options, args) = parser.parse_args(sys.argv[1:len(sys.argv)-i])
4842
except MyOptParser.InvalidOption, error:
4845
args += sys.argv[len(sys.argv)-i:]
4847
# raise correct error:
4849
(options, args) = parser.parse_args()
4850
except MyOptParser.InvalidOption, error:
4859
import logging.config
4860
# Set logging level according to the logging level given by options
4861
#logging.basicConfig(level=vars(logging)[options.logging])
4862
import internal.coloring_logging
4864
if __debug__ and options.logging == 'INFO':
4865
options.logging = 'DEBUG'
4866
if options.logging.isdigit():
4867
level = int(options.logging)
4869
level = eval('logging.' + options.logging)
4870
print os.path.join(root_path, 'internal', 'me5_logging.conf')
4871
logging.config.fileConfig(os.path.join(root_path, 'internal', 'me5_logging.conf'))
4872
logging.root.setLevel(level)
4873
logging.getLogger('madgraph').setLevel(level)
4878
# Call the cmd interface main loop
4881
# a single command is provided
4883
i = args.index('--web')
4885
cmd_line = aMCatNLOCmd(force_run=True)
4887
cmd_line = aMCatNLOCmdShell(force_run=True)
4889
if not hasattr(cmd_line, 'do_%s' % args[0]):
4892
print 'and %s can not be interpreted as a valid command.' % args[0]
4894
print 'ERROR: %s not a valid command. Please retry' % args[0]
4896
cmd_line.use_rawinput = False
4897
cmd_line.run_cmd(' '.join(args))
4898
cmd_line.run_cmd('quit')
4900
except KeyboardInterrupt:
4901
print 'quit on KeyboardInterrupt'