Merge lp:~maddevelopers/mg5amcnlo/1.5.12 into lp:~madteam/mg5amcnlo/trunk

Proposed by Olivier Mattelaer
Status: Merged
Merged at revision: 244
Proposed branch: lp:~maddevelopers/mg5amcnlo/1.5.12
Merge into: lp:~madteam/mg5amcnlo/trunk
Diff against target: 967 lines (+277/-107)
23 files modified
Template/Source/dsample.f (+4/-0)
Template/SubProcesses/genps.f (+3/-4)
Template/SubProcesses/myamp.f (+36/-1)
Template/SubProcesses/unwgt.f (+5/-1)
UpdateNotes.txt (+14/-0)
aloha/aloha_object.py (+8/-8)
aloha/aloha_writers.py (+5/-5)
aloha/create_aloha.py (+9/-9)
madgraph/__init__.py (+6/-0)
madgraph/interface/coloring_logging.py (+1/-1)
madgraph/interface/madevent_interface.py (+113/-11)
madgraph/interface/madgraph_interface.py (+17/-8)
madgraph/iolibs/export_v4.py (+2/-2)
madgraph/iolibs/template_files/madevent_makefile_source (+1/-1)
madgraph/iolibs/template_files/madevent_symmetry.f (+0/-2)
madgraph/various/banner.py (+12/-2)
madgraph/various/misc.py (+5/-1)
models/check_param_card.py (+5/-0)
models/import_ufo.py (+7/-4)
tests/acceptance_tests/test_cmd_madevent.py (+2/-1)
tests/input_files/sm_with_custom_propa/propagator.py (+0/-38)
tests/input_files/sm_with_custom_propa/propagators.py (+4/-4)
tests/unit_tests/various/test_aloha.py (+18/-4)
To merge this branch: bzr merge lp:~maddevelopers/mg5amcnlo/1.5.12
Reviewer Review Type Date Requested Status
Olivier Mattelaer Needs Fixing
Review via email: mp+180637@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Olivier Mattelaer (olivier-mattelaer) wrote :

This is my auto-review of the code:

- The (fortran) function is not use anywhere => need to remove it

- The function print_results should be display results (more coherent with other syntax)

- Need to remove those lines. (@@ -1583,6 +1588,23 @@ madevent_interface)
471 + #return valid tag_name
472 + #return valid run_name

- Not sure about:
581 @@ -3589,11 +3681,9 @@
582 mode = self.cluster_mode
583
584 # ensure that exe is executable
585 - if os.path.exists(exe) and not os.access(exe, os.X_OK):
586 + if os.path.exists(exe) and ReadWrite:
587 os.system('chmod +x %s ' % exe)
588 -
589 - elif (cwd and os.path.exists(pjoin(cwd, exe))) and not \
590 - os.access(pjoin(cwd, exe), os.X_OK):
591 + elif (cwd and os.path.exists(pjoin(cwd, exe))) and ReadWrite:
592 os.system('chmod +x %s ' % pjoin(cwd, exe))

review: Needs Fixing
lp:~maddevelopers/mg5amcnlo/1.5.12 updated
257. By Olivier Mattelaer

Fix the point revealed by the review

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Template/Source/dsample.f'
2--- Template/Source/dsample.f 2012-10-12 13:42:23 +0000
3+++ Template/Source/dsample.f 2013-08-16 20:45:36 +0000
4@@ -151,6 +151,10 @@
5 c
6 c All done
7 c
8+ tmean = 0d0
9+ trmean = 0d0
10+ tsigma = 0d0
11+ tdem = 0d0
12 open(unit=66,file='results.dat',status='unknown')
13 i=1
14 do while(xmean(i) .ne. 0 .and. i .lt. cur_it)
15
16=== modified file 'Template/SubProcesses/genps.f'
17--- Template/SubProcesses/genps.f 2012-11-08 04:48:28 +0000
18+++ Template/SubProcesses/genps.f 2013-08-16 20:45:36 +0000
19@@ -614,7 +614,6 @@
20 if (nt_channel .eq. 0 .and. nincoming .eq. 2) then
21 ns_channel=ns_channel-1
22 endif
23-c write(*,*) 'Number of t_channels',nt_channel,ns_channel,nbranch
24
25 c
26 c Determine masses for all intermediate states. Starting
27@@ -709,10 +708,11 @@
28 totmass=totmass+m(itree(2,ibranch))
29 enddo
30 m(-ns_channel-1) = dsqrt(S(-nbranch))
31- do ibranch = -ns_channel-1,-nbranch+2,-1 !Choose invarient mass
32+ do ibranch = -ns_channel-1,-nbranch+2,-1 !Choose invarient mass
33 totmass=totmass-m(itree(2,ibranch)) !for remaining particles
34 smin = totmass**2 !This affects t_min/max
35 smax = (m(ibranch) - m(itree(2,ibranch)))**2
36+
37 if (smin .gt. smax) then
38 jac=-3d0
39 return
40@@ -722,7 +722,6 @@
41 & smin/stot,smax/stot)
42
43 m(ibranch-1)=dsqrt(max(stot*x(nbranch-1+(-ibranch)*2), 0d0))
44-
45 c write(*,*) 'Using s',nbranch-1+(-ibranch)*2
46
47 if (m(ibranch-1)**2.lt.smin.or.m(ibranch-1)**2.gt.smax
48@@ -962,7 +961,7 @@
49 if (pp .gt. 0) then
50 PP=SQRT(pp)*0.5d0
51 else
52- write(*,*) 'Error creating momentum in gentcms',pp
53+ write(*,*) 'Error gentcms',pp, M1,m2,MD2, ESUM
54 jac=-1
55 return
56 endif
57
58=== modified file 'Template/SubProcesses/myamp.f'
59--- Template/SubProcesses/myamp.f 2013-02-17 07:44:42 +0000
60+++ Template/SubProcesses/myamp.f 2013-08-16 20:45:36 +0000
61@@ -301,7 +301,7 @@
62 double precision x1,x2,xk(nexternal)
63 double precision dr,mtot,etot,xqfact
64 double precision spmass
65- integer i, iconfig, l1, l2, j, nt, nbw, iproc
66+ integer i, iconfig, l1, l2, j, nt, nbw, iproc, k
67 integer iden_part(-nexternal+1:nexternal)
68
69 double precision prmass(-nexternal:0,lmaxconfigs)
70@@ -354,6 +354,18 @@
71
72 include 'coupl.inc'
73 include 'cuts.inc'
74+C
75+C SPECIAL CUTS
76+C
77+ LOGICAL IS_A_J(NEXTERNAL),IS_A_L(NEXTERNAL)
78+ LOGICAL IS_A_B(NEXTERNAL),IS_A_A(NEXTERNAL),IS_A_ONIUM(NEXTERNAL)
79+ LOGICAL IS_A_NU(NEXTERNAL),IS_HEAVY(NEXTERNAL)
80+ COMMON /TO_SPECISA/IS_A_J,IS_A_A,IS_A_L,IS_A_B,IS_A_NU,IS_HEAVY,
81+ . IS_A_ONIUM
82+ integer njet
83+
84+
85+
86 c
87 c External
88 c
89@@ -489,6 +501,21 @@
90 a=prmass(i,iconfig)**2/stot
91 c JA 4/1/2011 always set grid
92 xo = min(xm(i)**2/stot, 1-1d-8)
93+
94+c OM 7/27/2013 use MMJJ in order to set the mass in a appropriate way
95+ if (xo.eq.0d0.and.MMJJ.gt.0d0) then
96+ njet = 0
97+ do k =1,2
98+ if (iforest(k,i,iconfig).gt.0)then
99+ if (is_a_j(iforest(k,i,iconfig))) njet = njet + 1
100+ endif
101+ enddo
102+ if (njet.eq.1) then
103+ xo = (MMJJ/1d2)**2/stot
104+ else if (njet.eq.2) then
105+ xo = (MMJJ * 0.8)**2/stot
106+ endif
107+ endif
108 if (xo.eq.0d0) xo=1d0/stot
109 c if (prwidth(i, iconfig) .eq. 0d0.or.iden_part(i).gt.0) then
110 call setgrid(-i,xo,a,1)
111@@ -572,6 +599,14 @@
112 xo = max(xo, (3*ptl3min)**2/stot)
113 xo = max(xo, (4*ptl4min)**2/stot)
114 xo = max(xo, mmnl**2/stot)
115+ if (mmjj.ne.0d0) then
116+ njet = 0
117+ do k=nincoming+1,nexternal
118+ if (is_a_j(k)) njet = njet + 1
119+ enddo
120+ xo = max(xo, njet*(njet -1)/2d0*mmjj**2/stot)
121+ endif
122+
123 c Include mass scale from BWs
124 xo = max(xo, spmass**2/stot)
125 if (swidth(i).eq.0.and.xo.eq.1d0/stot) then
126
127=== modified file 'Template/SubProcesses/unwgt.f'
128--- Template/SubProcesses/unwgt.f 2012-11-11 08:52:35 +0000
129+++ Template/SubProcesses/unwgt.f 2013-08-16 20:45:36 +0000
130@@ -432,7 +432,7 @@
131 include 'leshouche.inc'
132 data iseed /0/
133
134- double precision pmass(nexternal)
135+ double precision pmass(nexternal), tmp
136 common/to_mass/ pmass
137
138 c integer ncols,ncolflow(maxamps),ncolalt(maxamps)
139@@ -554,6 +554,10 @@
140 ptcltmp(1)=ptclus(1)
141 ptclus(1)=ptclus(2)
142 ptclus(2)=ptcltmp(1)
143+c flip mass of the initial state
144+ tmp = pb(4,1)
145+ pb(4,1) = pb(4,2)
146+ pb(4,2) = tmp
147 endif
148
149 c
150
151=== modified file 'UpdateNotes.txt'
152--- UpdateNotes.txt 2013-06-21 15:33:06 +0000
153+++ UpdateNotes.txt 2013-08-16 20:45:36 +0000
154@@ -1,5 +1,19 @@
155 Update notes for MadGraph 5 (in reverse time order)
156
157+1.5.12 (XX/07/13) OM: Improve phase-space integration for processes with strong MMJJ cut. Cases where
158+ the cross-section were slightly (~4%) under-evaluated due to such strong cut.
159+ OM: Add a command print_results in the madevent interface. This command print the
160+ cross-section/number of events/...
161+ OM: change the way prompt color is handle (no systematic reset). Which provides better
162+ result when the log is printed to a file. (thanks Bae Taegil)
163+ OM: Fix Bug #1199514: Wrong assignment of mass in the lhe events file if the initial
164+ state has one massive and one massless particles. (Thanks Wojciech Kotlarski)
165+ OM: Fix a compilation problem for SLC6 for the installation of pythia-pgs
166+ OM: Fix a crash linked to bug #1209113.
167+ OM: Fix a crash if python is not a valid executation (Bug #1211777)
168+ OM: Fix a bug in the edition of the run_card if some parameters were missing in the cards
169+ (Bug #1183334)
170+
171 1.5.11 (21/06/13) OM: Fix CRITICAL bug (returning wrong cross-section) for processes with more than
172 one W decaying leptonically. For such processes the lepton cuts were also used
173 on the neutrino particle reducing the cross-section. This bug was present only
174
175=== modified file 'aloha/aloha_object.py'
176--- aloha/aloha_object.py 2013-06-06 13:29:17 +0000
177+++ aloha/aloha_object.py 2013-08-16 20:45:36 +0000
178@@ -935,25 +935,25 @@
179 #===============================================================================
180
181
182-SpinorPropagatorout = lambda spin1, spin2, particle: complex(0,-1) * (Gamma('mu', spin1, spin2) * \
183+SpinorPropagatorout = lambda spin1, spin2, particle: -1 * (Gamma('mu', spin1, spin2) * \
184 P('mu', particle) - Mass(particle) * Identity(spin1, spin2))
185
186-SpinorPropagatorin = lambda spin1, spin2, particle: complex(0,+1) * (Gamma('mu', spin1, spin2) * \
187+SpinorPropagatorin = lambda spin1, spin2, particle: (Gamma('mu', spin1, spin2) * \
188 P('mu', particle) + Mass(particle) * Identity(spin1, spin2))
189
190-VectorPropagator = lambda l1, l2, part: complex(0,1) * (-1 * Metric(l1, l2) + OverMass2(part) * \
191+VectorPropagator = lambda l1, l2, part: complex(0,1)*(-1 * Metric(l1, l2) + OverMass2(part) * \
192 Metric(l1,'I3')* P('I3', part) * P(l2, part))
193
194 VectorPropagatorMassless= lambda l1, l2, part: complex(0,-1) * Metric(l1, l2)
195
196-Spin3halfPropagatorin = lambda mu, nu, s1, s2, part: complex(0,1) * (\
197+Spin3halfPropagatorin = lambda mu, nu, s1, s2, part: (\
198 -1/3 * (Gamma(mu,s1,-2) + Identity(s1, -2) * P(mu, part) * Mass(part) * OverMass2(part))* \
199 (PSlash(-2,-3, part) - Identity(-2,-3) * Mass(part)) * \
200 ( Gamma(nu, -3, s2)+ Mass(part) * OverMass2(part) * Identity(-3, s2) * P(nu, part) ) - \
201 (PSlash(s1,s2, part) + Mass(part) * Identity(s1,s2)) * (Metric(mu, nu) - OverMass2(part) * P(mu, part) * P(nu,part)))
202
203
204-Spin3halfPropagatorout = lambda mu, nu, s1, s2, part: complex(0,1) * ( \
205+Spin3halfPropagatorout = lambda mu, nu, s1, s2, part: ( \
206 -1/3 * (Gamma(mu,s1,-2) - Identity(s1, -2) * P(mu, part) * Mass(part) * OverMass2(part))* \
207 (-1*PSlash(-2,-3, part) - Identity(-2,-3) * Mass(part)) * \
208 ( Gamma(nu, -3, s2)- Mass(part) * OverMass2(part) * Identity(-3, s2) * P(nu, part) ) - \
209@@ -965,17 +965,17 @@
210 Spin3halfPropagatorMasslessIn = lambda mu, nu, s1, s2, part: -1 * Gamma(mu, s1,-1) * PSlash(-1,-2, part) * Gamma(nu,-2, s2)
211
212
213-Spin2masslessPropagator = lambda mu, nu, alpha, beta: complex(0,1/2)*( Metric(mu, alpha)* Metric(nu, beta) +\
214+Spin2masslessPropagator = lambda mu, nu, alpha, beta: 1/2 *( Metric(mu, alpha)* Metric(nu, beta) +\
215 Metric(mu, beta) * Metric(nu, alpha) - Metric(mu, nu) * Metric(alpha, beta))
216
217
218
219 Spin2Propagator = lambda mu, nu, alpha, beta, part: Spin2masslessPropagator(mu, nu, alpha, beta) + \
220- -complex(0, 1/2) * OverMass2(part) * (Metric(mu,alpha)* P(nu, part) * P(beta, part) + \
221+ - 1/2 * OverMass2(part) * (Metric(mu,alpha)* P(nu, part) * P(beta, part) + \
222 Metric(nu, beta) * P(mu, part) * P(alpha, part) + \
223 Metric(mu, beta) * P(nu, part) * P(alpha, part) + \
224 Metric(nu, alpha) * P(mu, part) * P(beta , part) )+ \
225- complex(0, 1/6) * (Metric(mu,nu) + 2 * OverMass2(part) * P(mu, part) * P(nu, part)) * \
226+ 1/6 * (Metric(mu,nu) + 2 * OverMass2(part) * P(mu, part) * P(nu, part)) * \
227 (Metric(alpha,beta) + 2 * OverMass2(part) * P(alpha, part) * P(beta, part))
228
229
230
231=== modified file 'aloha/aloha_writers.py'
232--- aloha/aloha_writers.py 2013-03-20 08:46:54 +0000
233+++ aloha/aloha_writers.py 2013-08-16 20:45:36 +0000
234@@ -1121,25 +1121,25 @@
235 else:
236 tag=list(tag)
237
238-
239-
240-
241 if name is None:
242 prefix=''
243 if 'MP' in tag:
244 prefix = 'MP_'
245 tag.remove('MP')
246+ if any(t.startswith('P') for t in tag):
247+ #put the propagator tag at the end
248+ propa = [t for t in tag if t.startswith('P')][0]
249+ tag.remove(propa)
250+ tag.append(propa)
251 name = prefix + abstract.name + ''.join(tag)
252
253 if outgoing is None:
254 outgoing = abstract.outgoing
255-
256
257 return '%s_%s' % (name, outgoing)
258
259 def combine_name(name, other_names, outgoing, tag=None, unknown_propa=False):
260 """ build the name for combined aloha function """
261-
262
263 # Two possible scheme FFV1C1_2_X or FFV1__FFV2C1_X
264 # If they are all in FFVX scheme then use the first
265
266=== modified file 'aloha/create_aloha.py'
267--- aloha/create_aloha.py 2013-06-02 22:21:03 +0000
268+++ aloha/create_aloha.py 2013-08-16 20:45:36 +0000
269@@ -271,7 +271,7 @@
270 elif propa == []:
271 massless = False
272 else:
273- lorentz *= self.get_custom_propa(propa[0], spin, id)
274+ lorentz *= complex(0,1) * self.get_custom_propa(propa[0], spin, id)
275 continue
276
277
278@@ -284,10 +284,10 @@
279 id += _conjugate_gap + id % 2 - (id +1) % 2
280 if (id % 2):
281 #propagator outcoming
282- lorentz *= SpinorPropagatorout(id, 'I2', outgoing)
283+ lorentz *= complex(0,1) * SpinorPropagatorout(id, 'I2', outgoing)
284 else:
285 # #propagator incoming
286- lorentz *= SpinorPropagatorin('I2', id, outgoing)
287+ lorentz *= complex(0,1) * SpinorPropagatorin('I2', id, outgoing)
288 elif spin == 3 :
289 if massless or not aloha.unitary_gauge:
290 lorentz *= VectorPropagatorMassless(id, 'I2', id)
291@@ -301,21 +301,21 @@
292 spin_id = id
293 nb_spinor += 1
294 if not massless and (spin_id % 2):
295- lorentz *= Spin3halfPropagatorout(id, 'I2', spin_id,'I3', outgoing)
296+ lorentz *= complex(0,1) * Spin3halfPropagatorout(id, 'I2', spin_id,'I3', outgoing)
297 elif not massless and not (spin_id % 2):
298- lorentz *= Spin3halfPropagatorin('I2', id , 'I3', spin_id, outgoing)
299+ lorentz *= complex(0,1) * Spin3halfPropagatorin('I2', id , 'I3', spin_id, outgoing)
300 elif spin_id %2:
301- lorentz *= Spin3halfPropagatorMasslessOut(id, 'I2', spin_id,'I3', outgoing)
302+ lorentz *= complex(0,1) * Spin3halfPropagatorMasslessOut(id, 'I2', spin_id,'I3', outgoing)
303 else :
304- lorentz *= Spin3halfPropagatorMasslessIn('I2', id, 'I3', spin_id, outgoing)
305+ lorentz *= complex(0,1) * Spin3halfPropagatorMasslessIn('I2', id, 'I3', spin_id, outgoing)
306
307 elif spin == 5 :
308 #lorentz *= 1 # delayed evaluation (fastenize the code)
309 if massless:
310- lorentz *= Spin2masslessPropagator(_spin2_mult + id, \
311+ lorentz *= complex(0,1) * Spin2masslessPropagator(_spin2_mult + id, \
312 2 * _spin2_mult + id,'I2','I3')
313 else:
314- lorentz *= Spin2Propagator(_spin2_mult + id, \
315+ lorentz *= complex(0,1) * Spin2Propagator(_spin2_mult + id, \
316 2 * _spin2_mult + id,'I2','I3', id)
317 else:
318 raise self.AbstractALOHAError(
319
320=== modified file 'madgraph/__init__.py'
321--- madgraph/__init__.py 2011-04-21 22:02:22 +0000
322+++ madgraph/__init__.py 2013-08-16 20:45:36 +0000
323@@ -25,3 +25,9 @@
324 MG5DIR = os.path.realpath(os.path.join(os.path.dirname(__file__),
325 os.path.pardir))
326 MG4DIR = MG5DIR
327+ReadWrite = True
328+try:
329+ open(os.path.join(MG5DIR,'.test'),'w').write('test')
330+ os.remove(os.path.join(MG5DIR,'.test'))
331+except IOError:
332+ ReadWrite = False
333\ No newline at end of file
334
335=== modified file 'madgraph/interface/coloring_logging.py'
336--- madgraph/interface/coloring_logging.py 2012-02-17 06:01:41 +0000
337+++ madgraph/interface/coloring_logging.py 2013-08-16 20:45:36 +0000
338@@ -29,7 +29,7 @@
339
340 def format(self, record):
341 levelname = record.levelname
342- message = logging.Formatter.format(self, record) + RESET_SEQ
343+ message = logging.Formatter.format(self, record) + '$RESET'
344 for k,v in COLORS.items():
345 message = message.replace("$" + k, COLOR_SEQ % (v+30))\
346 .replace("$BG" + k, COLOR_SEQ % (v+40))\
347
348=== modified file 'madgraph/interface/madevent_interface.py'
349--- madgraph/interface/madevent_interface.py 2013-06-21 05:03:28 +0000
350+++ madgraph/interface/madevent_interface.py 2013-08-16 20:45:36 +0000
351@@ -65,7 +65,7 @@
352 import madgraph.various.combine_runs as combine_runs
353
354 import models.check_param_card as check_param_card
355- from madgraph import InvalidCmd, MadGraph5Error, MG5DIR
356+ from madgraph import InvalidCmd, MadGraph5Error, MG5DIR, ReadWrite
357 MADEVENT = False
358 except Exception, error:
359 if __debug__:
360@@ -74,7 +74,7 @@
361 import internal.extended_cmd as cmd
362 import internal.banner as banner_mod
363 import internal.misc as misc
364- from internal import InvalidCmd, MadGraph5Error
365+ from internal import InvalidCmd, MadGraph5Error, ReadWrite
366 import internal.files as files
367 import internal.gen_crossxhtml as gen_crossxhtml
368 import internal.save_load_object as save_load_object
369@@ -499,7 +499,12 @@
370 logger.info("-- run pythia on RUN (current one by default)")
371 self.run_options_help([('-f','answer all question by default'),
372 ('--tag=', 'define the tag for the pythia run'),
373- ('--no_default', 'not run if pythia_card not present')])
374+ ('--no_default', 'not run if pythia_card not present')])
375+
376+ def help_print_result(self):
377+ logger.info("syntax: print_result [RUN] [TAG]")
378+ logger.info("-- show in text format the status of the run (cross-section/nb-event/...)")
379+
380
381 def help_pgs(self):
382 logger.info("syntax: pgs [RUN] [--run_options]")
383@@ -1485,6 +1490,15 @@
384
385 opts = self._run_options + self._calculate_decay_options
386 return self.list_completion(text, opts, line)
387+
388+ def complete_display(self, text, line, begidx, endidx):
389+ """ Complete the display command"""
390+
391+ args = self.split_arg(line[0:begidx], error=False)
392+ if len(args) >= 2 and args[1] =='results':
393+ start = line.find('results')
394+ return self.complete_print_results(text, 'print_results '+line[start+7:], begidx+2+start, endidx+2+start)
395+ return super(CompleteForCmd, self).complete_display(text, line, begidx, endidx)
396
397 def complete_multi_run(self, text, line, begidx, endidx):
398 """complete multi run command"""
399@@ -1583,6 +1597,21 @@
400
401 complete_delphes = complete_pgs
402
403+ def complete_print_results(self,text, line, begidx, endidx):
404+ "Complete the print results command"
405+ args = self.split_arg(line[0:begidx], error=False)
406+ if len(args) == 1:
407+ #return valid run_name
408+ data = glob.glob(pjoin(self.me_dir, 'Events', '*','unweighted_events.lhe.gz'))
409+ data = [n.rsplit('/',2)[1] for n in data]
410+ tmp1 = self.list_completion(text, data)
411+ return tmp1
412+ else:
413+ data = glob.glob(pjoin(self.me_dir, 'Events', args[0], '*_pythia_events.hep.gz'))
414+ data = [os.path.basename(p).rsplit('_',1)[0] for p in data]
415+ tmp1 = self.list_completion(text, data)
416+ return tmp1
417+
418
419 class MadEventAlreadyRunning(InvalidCmd):
420 pass
421@@ -1590,7 +1619,7 @@
422 #===============================================================================
423 # MadEventCmd
424 #===============================================================================
425-class MadEventCmd(CmdExtended, HelpToCmd, CompleteForCmd):
426+class MadEventCmd(CompleteForCmd, CmdExtended, HelpToCmd):
427 """The command line processor of MadGraph"""
428
429 # Truth values
430@@ -1602,7 +1631,7 @@
431 _set_options = ['stdout_level','fortran_compiler','timeout']
432 _plot_mode = ['all', 'parton','pythia','pgs','delphes','channel', 'banner']
433 _clean_mode = _plot_mode
434- _display_opts = ['run_name', 'options', 'variable']
435+ _display_opts = ['run_name', 'options', 'variable', 'results']
436 # survey options, dict from name to type, default value, and help text
437 _survey_options = {'points':('int', 1000,'Number of points for first iteration'),
438 'iterations':('int', 5, 'Number of iterations'),
439@@ -2030,6 +2059,8 @@
440 else:
441 outstr += " %25s \t:\t%s (user set)\n" % (key,value)
442 output.write(outstr)
443+ elif args[0] == 'results':
444+ self.do_print_results(' '.join(args[1:]))
445 else:
446 super(MadEventCmd, self).do_display(line, output)
447
448@@ -2096,6 +2127,37 @@
449
450 misc.open_file(file_path)
451
452+ ############################################################################
453+ def do_print_results(self, line):
454+ """Not in help:Print the cross-section/ number of events for a given run"""
455+
456+ args = self.split_arg(line)
457+ if len(args) > 0:
458+ run_name = args[0]
459+ else:
460+ if not self.results.current:
461+ raise self.InvalidCmd('no run currently defined. Please specify one.')
462+ else:
463+ run_name = self.results.current['run_name']
464+ if run_name not in self.results:
465+ raise self.InvalidCmd('%s is not a valid run_name or it doesn\'t have any information' \
466+ % run_name)
467+ if len(args) == 2:
468+ tag = args[1]
469+ if tag.isdigit():
470+ tag = int(tag) - 1
471+ if len(self.results[run_name]) < tag:
472+ raise self.InvalidCmd('Only %s different tag available' % \
473+ len(self.results[run_name]))
474+ data = self.results[run_name][tag]
475+ else:
476+ data = self.results[run_name].return_tag(tag)
477+ else:
478+ data = self.results[run_name].return_tag(None) # return the last
479+
480+ self.print_results_in_shell(data)
481+
482+
483 ############################################################################
484 def do_set(self, line, log=True):
485 """Set an option, which will be default for coming generations/outputs
486@@ -2531,7 +2593,7 @@
487 fsock.close()
488 return
489 else:
490- subprocess.call(['python', 'write_param_card.py'],
491+ subprocess.call([sys.executable, 'write_param_card.py'],
492 cwd=pjoin(self.me_dir,'bin','internal','ufomodel'))
493 default = pjoin(self.me_dir,'bin','internal','ufomodel','param_card.dat')
494 param_card.write_inc_file(outfile, ident_card, default)
495@@ -2567,6 +2629,11 @@
496 subproc = [l.strip() for l in open(pjoin(self.me_dir,'SubProcesses',
497 'subproc.mg'))]
498
499+ #check difficult PS case
500+ if float(self.run_card['mmjj']) > 150:
501+ self.pass_in_difficult_integration_mode()
502+
503+
504 P_zero_result = [] # check the number of times where they are no phase-space
505 for nb_proc,subdir in enumerate(subproc):
506 subdir = subdir.strip()
507@@ -2630,6 +2697,40 @@
508 self.results.add_detail('error', error)
509 self.update_status('End survey', 'parton', makehtml=False)
510
511+ ############################################################################
512+ def pass_in_difficult_integration_mode(self):
513+ """be more secure for the integration to not miss it due to strong cut"""
514+
515+ # improve survey options if default
516+ if self.opts['points'] == self._survey_options['points'][1]:
517+ self.opts['points'] = 3 * self._survey_options['points'][1]
518+ if self.opts['iterations'] == self._survey_options['iterations'][1]:
519+ self.opts['iterations'] = 2 + self._survey_options['iterations'][1]
520+ if self.opts['accuracy'] == self._survey_options['accuracy'][1]:
521+ self.opts['accuracy'] = self._survey_options['accuracy'][1]/3
522+
523+ # Modify run_config.inc in order to improve the refine
524+ conf_path = pjoin(self.me_dir, 'Source','run_config.inc')
525+ files.cp(conf_path, conf_path + '.bk')
526+
527+ text = open(conf_path).read()
528+ text = re.sub('''\(min_events = \d+\)''', '''(min_events = 10000 )''', text)
529+ text = re.sub('''\(max_events = \d+\)''', '''(max_events = 25000 )''', text)
530+ fsock = open(conf_path, 'w')
531+ fsock.write(text)
532+ fsock.close()
533+
534+ # Compile
535+ for name in ['../bin/internal/gen_ximprove', 'all',
536+ '../bin/internal/combine_events']:
537+ self.compile(arg=[name], cwd=os.path.join(self.me_dir, 'Source'))
538+
539+
540+
541+
542+
543+
544+
545 ############################################################################
546 def do_refine(self, line):
547 """Advanced commands: launch survey for the current process """
548@@ -3591,7 +3692,6 @@
549 # ensure that exe is executable
550 if os.path.exists(exe) and not os.access(exe, os.X_OK):
551 os.system('chmod +x %s ' % exe)
552-
553 elif (cwd and os.path.exists(pjoin(cwd, exe))) and not \
554 os.access(pjoin(cwd, exe), os.X_OK):
555 os.system('chmod +x %s ' % pjoin(cwd, exe))
556@@ -4886,6 +4986,7 @@
557 cmd.OneLinePathCompletion.__init__(self, *args, **opt)
558 self.me_dir = self.mother_interface.me_dir
559 self.run_card = banner_mod.RunCard(pjoin(self.me_dir,'Cards','run_card.dat'))
560+ run_card_def = banner_mod.RunCard(pjoin(self.me_dir,'Cards','run_card_default.dat'))
561 try:
562 self.param_card = check_param_card.ParamCard(pjoin(self.me_dir,'Cards','param_card.dat'))
563 except check_param_card.InvalidParamCard:
564@@ -4932,10 +5033,10 @@
565 else:
566 self.pname2block[var] = [(bname, lha_id)]
567
568-
569+ self.run_set = run_card_def.keys() + self.run_card.hidden_param
570 # check for conflict with run_card
571 for var in self.pname2block:
572- if var in self.run_card:
573+ if var in self.run_set:
574 self.conflict.append(var)
575
576
577@@ -4983,7 +5084,7 @@
578 self.list_completion(text, ['run_card', 'param_card'])
579
580 if 'run_card' in allowed.keys():
581- opts = self.run_card.keys()
582+ opts = self.run_set
583 if allowed['run_card'] == 'default':
584 opts.append('default')
585
586@@ -5064,7 +5165,7 @@
587 return
588
589 #### RUN CARD
590- if args[start] in self.run_card.keys() and card != 'param_card':
591+ if (args[start] in self.run_set) and card != 'param_card':
592 if args[start+1] in self.conflict and card == '':
593 text = 'ambiguous name (present in both param_card and run_card. Please specify'
594 logger.warning(text)
595@@ -5075,6 +5176,7 @@
596 if args[start] in default.keys():
597 self.setR(args[start],default[args[start]])
598 else:
599+ logger.info('remove information %s from the run_card' % args[start])
600 del self.run_card[args[start]]
601 elif args[start+1] in ['t','.true.']:
602 self.setR(args[start], '.true.')
603
604=== modified file 'madgraph/interface/madgraph_interface.py'
605--- madgraph/interface/madgraph_interface.py 2013-06-21 05:22:57 +0000
606+++ madgraph/interface/madgraph_interface.py 2013-08-16 20:45:36 +0000
607@@ -1820,7 +1820,7 @@
608 """Initializing before starting the main loop"""
609
610 self.prompt = 'mg5>'
611- if os.access(MG5DIR, os.W_OK): # prevent on read-only disk
612+ if madgraph.ReadWrite: # prevent on read-only disk
613 self.do_install('update --mode=mg5_start')
614
615 # By default, load the UFO Standard Model
616@@ -1868,7 +1868,7 @@
617 os.remove(pjoin(self._done_export[0],'RunWeb'))
618
619 value = super(MadGraphCmd, self).do_quit(line)
620- if os.access(MG5DIR, os.W_OK): #prevent to run on Read Only disk
621+ if madgraph.ReadWrite: #prevent to run on Read Only disk
622 self.do_install('update --mode=mg5_end')
623 print
624
625@@ -3109,12 +3109,15 @@
626 logger.info('compile %s. This might takes a while.' % name)
627
628 # Modify Makefile for pythia-pgs on Mac 64 bit
629- if args[0] == "pythia-pgs" and sys.maxsize > 2**32:
630- path = os.path.join(MG5DIR, 'pythia-pgs', 'src', 'make_opts')
631- text = open(path).read()
632- text = text.replace('MBITS=32','MBITS=64')
633- open(path, 'w').writelines(text)
634-
635+ if args[0] == "pythia-pgs":
636+ if sys.maxsize > 2**32:
637+ path = os.path.join(MG5DIR, 'pythia-pgs', 'src', 'make_opts')
638+ text = open(path).read()
639+ text = text.replace('MBITS=32','MBITS=64')
640+ open(path, 'w').writelines(text)
641+ if not os.path.exists(pjoin(MG5DIR, 'pythia-pgs', 'libraries','pylib','lib')):
642+ os.mkdir(pjoin(MG5DIR, 'pythia-pgs', 'libraries','pylib','lib'))
643+
644 # Compile the file
645 # Check for F77 compiler
646 if 'FC' not in os.environ or not os.environ['FC']:
647@@ -3140,9 +3143,15 @@
648 if logger.level <= logging.INFO:
649 devnull = open(os.devnull,'w')
650 misc.call(['make', 'clean'], stdout=devnull, stderr=-2)
651+ if name == 'pythia-pgs':
652+ #SLC6 needs to have this first (don't ask why)
653+ status = misc.call(['make'], cwd = pjoin(MG5DIR, name, 'libraries', 'pylib'))
654 status = misc.call(['make'], cwd = os.path.join(MG5DIR, name))
655 else:
656 self.compile(['clean'], mode='', cwd = os.path.join(MG5DIR, name))
657+ if name == 'pythia-pgs':
658+ #SLC6 needs to have this first (don't ask why)
659+ status = self.compile(mode='', cwd = pjoin(MG5DIR, name, 'libraries', 'pylib'))
660 status = self.compile(mode='', cwd = os.path.join(MG5DIR, name))
661 if not status:
662 logger.info('compilation succeeded')
663
664=== modified file 'madgraph/iolibs/export_v4.py'
665--- madgraph/iolibs/export_v4.py 2013-06-21 05:03:28 +0000
666+++ madgraph/iolibs/export_v4.py 2013-08-16 20:45:36 +0000
667@@ -50,7 +50,7 @@
668 import models.write_param_card as param_writer
669 import models.check_param_card as check_param_card
670
671-from madgraph import MadGraph5Error, MG5DIR
672+from madgraph import MadGraph5Error, MG5DIR, ReadWrite
673 from madgraph.iolibs.files import cp, ln, mv
674
675 pjoin = os.path.join
676@@ -780,7 +780,7 @@
677 logger.info('Use Fortran compiler ' + compiler)
678 self.replace_make_opt_compiler(compiler)
679 # Replace also for Template but not for cluster
680- if not os.environ.has_key('MADGRAPH_DATA') and os.access(MG5DIR, os.W_OK):
681+ if not os.environ.has_key('MADGRAPH_DATA') and ReadWrite:
682 self.replace_make_opt_compiler(compiler, pjoin(MG5DIR, 'Template'))
683
684 def replace_make_opt_compiler(self, compiler, root_dir = ""):
685
686=== modified file 'madgraph/iolibs/template_files/madevent_makefile_source'
687--- madgraph/iolibs/template_files/madevent_makefile_source 2013-03-14 06:18:43 +0000
688+++ madgraph/iolibs/template_files/madevent_makefile_source 2013-08-16 20:45:36 +0000
689@@ -63,7 +63,7 @@
690 select_events.o: select_events.f run_config.inc
691 setrun.o: setrun.f nexternal.inc leshouche.inc run_card.inc
692
693-run_card.inc:
694+run_card.inc: ../Cards/run_card.dat
695 ../bin/madevent treatcards run
696
697 clean_lhapdf:
698
699=== modified file 'madgraph/iolibs/template_files/madevent_symmetry.f'
700--- madgraph/iolibs/template_files/madevent_symmetry.f 2013-05-29 06:45:00 +0000
701+++ madgraph/iolibs/template_files/madevent_symmetry.f 2013-08-16 20:45:36 +0000
702@@ -667,8 +667,6 @@
703 write(lun,20) 'cp $k log.txt'
704 write(lun,20) 'cd ../'
705 write(lun,15) 'done'
706- write(lun,15) 'rm -f run.$script'
707- write(lun,15) 'touch done.$script'
708 15 format(a)
709 20 format(5x,a)
710 25 format(10x,a)
711
712=== modified file 'madgraph/various/banner.py'
713--- madgraph/various/banner.py 2013-03-27 22:47:55 +0000
714+++ madgraph/various/banner.py 2013-08-16 20:45:36 +0000
715@@ -257,6 +257,9 @@
716 class RunCard(dict):
717 """A class object for the run_card"""
718
719+ #list of paramater which are allowed BUT not present in the _default file.
720+ hidden_param = ['lhaid', 'gridrun', 'fixed_couplings']
721+
722 def __init__(self, run_card):
723 """ """
724
725@@ -315,16 +318,23 @@
726 (a path to a valid run_card)"""
727
728 text = ""
729- for line in file(template,'r'):
730+ for line in file(template,'r'):
731 nline = line.split('#')[0]
732 nline = nline.split('!')[0]
733 comment = line[len(nline):]
734 nline = nline.split('=')
735 if len(nline) != 2:
736 text += line
737- else:
738+ elif nline[1].strip() in self:
739 text += ' %s\t= %s %s' % (self[nline[1].strip()],nline[1], comment)
740+ else:
741+ logger.info('Adding missing parameter %s to current run_card (with default value)' % nline[1].strip())
742+ text += line
743
744+ for param in self.hidden_param:
745+ if param in self:
746+ text += ' %s\t= %s \n' % (self[param],param)
747+
748 fsock = open(output_file,'w')
749 fsock.write(text)
750 fsock.close()
751
752=== modified file 'madgraph/various/misc.py'
753--- madgraph/various/misc.py 2013-06-21 05:03:28 +0000
754+++ madgraph/various/misc.py 2013-08-16 20:45:36 +0000
755@@ -175,8 +175,12 @@
756 def compile(arg=[], cwd=None, mode='fortran', nb_core=1, **opt):
757 """compile a given directory"""
758
759+ cmd = ['make']
760 try:
761- p = subprocess.Popen(['make','-j%s' % nb_core] + arg, stdout=subprocess.PIPE,
762+ if nb_core > 1:
763+ cmd.append('-j%s' % nb_core)
764+ cmd += arg
765+ p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
766 stderr=subprocess.STDOUT, cwd=cwd, **opt)
767 (out, err) = p.communicate()
768 except OSError, error:
769
770=== modified file 'models/check_param_card.py'
771--- models/check_param_card.py 2013-02-28 23:52:38 +0000
772+++ models/check_param_card.py 2013-08-16 20:45:36 +0000
773@@ -332,8 +332,13 @@
774 value = self[block].get(tuple(lhaid)).value
775 except KeyError:
776 value =defaultcard[block].get(tuple(lhaid)).value
777+ logger.warning('information about \"%s %s" is missing using default value: %s.' %\
778+ (block, lhaid, value))
779+
780 else:
781 value =defaultcard[block].get(tuple(lhaid)).value
782+ logger.warning('information about \"%s %s" is missing (full block missing) using default value: %s.' %\
783+ (block, lhaid, value))
784 value = str(value).lower()
785 fout.writelines(' %s = %s' % (variable, str(value).replace('e','d')))
786
787
788=== modified file 'models/import_ufo.py'
789--- models/import_ufo.py 2013-06-21 05:03:28 +0000
790+++ models/import_ufo.py 2013-08-16 20:45:36 +0000
791@@ -21,7 +21,8 @@
792 import re
793 import sys
794
795-from madgraph import MadGraph5Error, MG5DIR
796+
797+from madgraph import MadGraph5Error, MG5DIR, ReadWrite
798 import madgraph.core.base_objects as base_objects
799 import madgraph.core.color_algebra as color
800 import madgraph.iolibs.files as files
801@@ -191,8 +192,9 @@
802 # might be None for ghost
803
804 # save in a pickle files to fasten future usage
805- save_load_object.save_to_file(os.path.join(model_path, pickle_name), model,
806- log=False)
807+ if ReadWrite:
808+ save_load_object.save_to_file(os.path.join(model_path, pickle_name),
809+ model, log=False)
810
811 #if default and os.path.exists(os.path.join(model_path, 'restrict_default.dat')):
812 # restrict_file = os.path.join(model_path, 'restrict_default.dat')
813@@ -342,7 +344,8 @@
814 particle.set(key, str(value[1]))
815 else:
816 particle.set(key, value)
817- elif key.lower() not in ('ghostnumber','selfconjugate','goldstoneboson','partial_widths'):
818+ elif key.lower() not in ('ghostnumber','selfconjugate','goldstone',
819+ 'goldstoneboson','partial_widths'):
820 # add charge -we will check later if those are conserve
821 self.conservecharge.add(key)
822 particle.set(key,value, force=True)
823
824=== modified file 'tests/acceptance_tests/test_cmd_madevent.py'
825--- tests/acceptance_tests/test_cmd_madevent.py 2013-03-27 22:47:55 +0000
826+++ tests/acceptance_tests/test_cmd_madevent.py 2013-08-16 20:45:36 +0000
827@@ -223,7 +223,8 @@
828 err1 = self.cmd_line.results.current['error']
829
830 target = 3864.0
831- self.assertTrue(abs(val1 - target) / err1 < 1.)
832+ self.assertTrue(abs(val1 - target) / err1 < 1., 'large diference between %s and %s +- %s'%
833+ (target, val1, err1))
834
835 def test_e_e_collision(self):
836 """check that e+ e- > t t~ gives the correct result"""
837
838=== removed file 'tests/input_files/sm_with_custom_propa/propagator.py'
839--- tests/input_files/sm_with_custom_propa/propagator.py 2013-03-18 23:03:14 +0000
840+++ tests/input_files/sm_with_custom_propa/propagator.py 1970-01-01 00:00:00 +0000
841@@ -1,38 +0,0 @@
842-# This file was automatically created by FeynRules 1.7.69
843-# Mathematica version: 8.0 for Mac OS X x86 (64-bit) (November 6, 2010)
844-# Date: Mon 1 Oct 2012 14:58:26
845-
846-from object_library import all_propagator, Propagator
847-
848-# define only once the denominator since this is always the same
849-denominator = "P('mu', id) * P('mu', id) - Mass(id) * Mass(id) + complex(0,1) * Mass(id) * Width(id)"
850-
851-# propagator for the scalar
852-S = Propagator(name = "S",
853- spin = 1,
854- numerator = "complex(0,1)",
855- denominator = denominator
856- )
857-
858-# propagator for the incoming fermion # the one for the outcomming is computed on the flight
859-F = Propagator(name = "F",
860- spin = 2,
861- numerator = "complex(0,1) * (Gamma('mu', s1, s2) * P('mu', id) + Mass(id) * Identity(s1, s2))",
862- denominator = denominator
863- )
864-
865-# massive vector in the unitary gauge, can't be use for massless particles
866-V1 = Propagator(name = "V1",
867- spin = 3,
868- numerator = "complex(0,1) * (-1 * Metric(l1, l2) + Metric(l1,'mu')* P('mu', id) * P(l2, id) / Mass(id)**2 ",
869- denominator = denominator
870- )
871-
872-# massless vector and massive vector in unitary gauge
873-V2 = Propagator(name = "V2",
874- spin = 3,
875- expression = "complex(0,-1) * Metric(l1, l2)",
876- denominator = denominator
877- )
878-
879-
880
881=== modified file 'tests/input_files/sm_with_custom_propa/propagators.py'
882--- tests/input_files/sm_with_custom_propa/propagators.py 2013-03-18 23:03:14 +0000
883+++ tests/input_files/sm_with_custom_propa/propagators.py 2013-08-16 20:45:36 +0000
884@@ -10,25 +10,25 @@
885
886 # propagator for the scalar
887 S = Propagator(name = "S",
888- numerator = "complex(0,1)",
889+ numerator = "1",
890 denominator = denominator
891 )
892
893 # propagator for the incoming fermion # the one for the outcomming is computed on the flight
894 F = Propagator(name = "F",
895- numerator = "complex(0,1) * (Gamma('mu', s1, s2) * P('mu', id) + Mass(id) * Identity(s1, s2))",
896+ numerator = "(Gamma('mu', s1, s2) * P('mu', id) + Mass(id) * Identity(s1, s2))",
897 denominator = denominator
898 )
899
900 # massive vector in the unitary gauge, can't be use for massless particles
901 V1 = Propagator(name = "V1",
902- numerator = "complex(0,1) * (-1 * Metric(l1, l2) + Metric(l1,'mu')* P('mu', id) * P(l2, id) / Mass(id)**2 ",
903+ numerator = "(-1 * Metric(l1, l2) + Metric(l1,'mu')* P('mu', id) * P(l2, id) / Mass(id)**2 ",
904 denominator = denominator
905 )
906
907 # massless vector and massive vector in unitary gauge
908 V2 = Propagator(name = "V2",
909- numerator = "complex(0,-1) * Metric(l1, l2)",
910+ numerator = "-1 * Metric(l1, l2)",
911 denominator = "P('mu', id) * P('mu', id)"
912 )
913
914
915=== modified file 'tests/unit_tests/various/test_aloha.py'
916--- tests/unit_tests/various/test_aloha.py 2013-06-06 13:29:17 +0000
917+++ tests/unit_tests/various/test_aloha.py 2013-08-16 20:45:36 +0000
918@@ -1253,7 +1253,7 @@
919 (obj.Metric(rho,sigma) - obj.OverMass2(t) * obj.P(rho,t) *obj.P(sigma,t) )
920
921 prop = aloha_obj.Spin2Propagator(mu,nu,rho,sigma, t)
922- zero = 1j * propa - 2 * prop
923+ zero = propa - 2 * prop
924
925
926 zero = zero.expand().simplify()
927@@ -1291,7 +1291,7 @@
928 propa = propa + 2/6 * OM(t) * Metric(alpha, beta) * P(mu,t) * P(nu,t)
929
930
931- zero = 1j*propa - aloha_obj.Spin2Propagator(mu,nu,alpha,beta, t)
932+ zero = propa - aloha_obj.Spin2Propagator(mu,nu,alpha,beta, t)
933
934 zero = zero.expand().simplify()
935
936@@ -1339,7 +1339,7 @@
937 t = 1
938 mu, nu, alpha, beta = 1,2,3,4
939
940- aloha = Metric(mu,nu) * aloha_obj.Spin2Propagator(mu,nu,alpha,beta, t)
941+ aloha = complex(0,1)*Metric(mu,nu) * aloha_obj.Spin2Propagator(mu,nu,alpha,beta, t)
942 analytical = complex(0, 1/3) * (OM(t) * P(-1, t)* P(-1,t) - 1) * (Metric(alpha, beta) + 2 * OM(t) * P(alpha,t)*P(beta,t))
943
944
945@@ -4337,7 +4337,21 @@
946 """
947 self.assertEqual(text.split('\n'), target.split('\n'))
948
949-
950+ @set_global(loop=False, unitary=True, mp=True, cms=False)
951+ def test_aloha_get_name(self):
952+
953+ FFV_M = UFOLorentz(name = 'FFVM',
954+ spins = [ 2, 2, 3 ],
955+ structure = 'Gamma(3,1,\'s1\')*ProjM(\'s1\',2)')
956+ abstract = create_aloha.AbstractRoutineBuilder(FFV_M).compute_routine(3)
957+
958+ name = aloha_writers.get_routine_name(abstract=abstract, tag=['P0','C1'])
959+
960+ self.assertEqual(name, 'FFVMC1P0_3')
961+
962+ name = aloha_writers.get_routine_name(abstract=abstract, tag=['C1','P0'])
963+
964+ self.assertEqual(name, 'FFVMC1P0_3')
965
966 @set_global(loop=True, unitary=True, mp=True, cms=False)
967 def test_aloha_MP_mode(self):

Subscribers

People subscribed via source and target branches