Merge lp:~maddevelopers/mg5amcnlo/fix_new_gridpack into lp:~maddevelopers/mg5amcnlo/upgrade_pythia_compatibility

Proposed by Johan Alwall
Status: Merged
Merged at revision: 358
Proposed branch: lp:~maddevelopers/mg5amcnlo/fix_new_gridpack
Merge into: lp:~maddevelopers/mg5amcnlo/upgrade_pythia_compatibility
Diff against target: 921 lines (+122/-328)
10 files modified
Template/Source/dsample.f (+47/-267)
Template/Source/gen_ximprove.f (+21/-18)
Template/SubProcesses/unwgt.f (+13/-13)
UpdateNotes.txt (+8/-2)
madgraph/VERSION (+2/-2)
madgraph/interface/madevent_interface.py (+6/-6)
madgraph/iolibs/template_files/madevent_driver.f (+22/-12)
madgraph/iolibs/template_files/madevent_run_config.inc (+0/-5)
madgraph/iolibs/template_files/madevent_symmetry.f (+2/-2)
madgraph/various/sum_html.py (+1/-1)
To merge this branch: bzr merge lp:~maddevelopers/mg5amcnlo/fix_new_gridpack
Reviewer Review Type Date Requested Status
Olivier Mattelaer Approve
Rikkert Frederix Pending
Tim Stelzer Pending
Review via email: mp+90819@code.launchpad.net

Description of the change

Changed the way gridpacks work: Set granularity to 1 (so randomly select channels only if they should generate less than 1 event), but allowing channels to run down to a single iteration. This removes all old problems with the gridpacks, while giving even faster event generation.

To post a comment you must log in.
353. By Johan Alwall

Remove all compilations in gridrun mode, since make might not be implemented on nodes (and compilation is supposed to have been done before)

Revision history for this message
Johan Alwall (johan-alwall) wrote :

Hello Olivier,

Can you check that I correctly removed the compilation for gridruns in the latest revision? There should be no compilations during a gridrun, since everything should be compiled in advance.

Thanks,
Johan

354. By Johan Alwall

Fixed sum_html to make sure it works for all cases of results.dat files.

Revision history for this message
Olivier Mattelaer (olivier-mattelaer) wrote :

> Can you check that I correctly removed the compilation for gridruns in the
> latest revision? There should be no compilations during a gridrun, since
> everything should be compiled in advance.

Yes that's fine.

I've looked at the modification off the code, I think this is (almost) perfect.
I've only one not trivial comment and two quite stupid one.
I'm going to test it further (run test and make some generation) before the final approval.
But the results that you send by email make me quite confortable.

Stupid comment #1:
in dsample.f you modify the line:
 - 1892 c JA 8/17/2011 allow minimum 3 iterations instead of 5
 + 1667c JA 8/17/2011 allow minimum itmin iterations instead of 5
it should be better to update the date. (I said that the comment was stupid)

a second in the same style:
in dsample.f at line 1717
c Calculate chi2 for last three events (ja 03/11)
three should be replace by itsum

a less stupid one
in madevent_interface.py, you add:
3816 try:
3817 os.remove(pjoin(self.me_dir,'RunWeb'))
3818 except:
3819 pass

I don't agree with that, those lines should be added to the file gridrun and not here.
(I added those lines to that file in the 1.4.0 version in fact)

Revision history for this message
Olivier Mattelaer (olivier-mattelaer) wrote :

Ok all tests passes,

but i still have one comment:

 - 86 err_goal = 1.5*nreq ! extra factor to ensure works
 + 86 err_goal = 1.2*nreq ! extra factor to ensure works

are you sure that 1.2 is always enough?
shouldn't we put this ratio as an input in the run_card?
This will allow CMS to play with that for hard scenario.

What do you think?

In any case, I approve it right now.

review: Approve
355. By Johan Alwall

Improved comments as requested by Olivier

356. By Johan Alwall

Removed the RunWeb removal since Olivier said its in the wrong place

Revision history for this message
Johan Alwall (johan-alwall) wrote :

Thanks Olivier for your review!

> Stupid comment #1:
> in dsample.f you modify the line:
> - 1892 c JA 8/17/2011 allow minimum 3 iterations instead of 5
> + 1667c JA 8/17/2011 allow minimum itmin iterations instead of 5
> it should be better to update the date. (I said that the comment was stupid)

I have updated the comments to make them clearer and up-to-date.

> a less stupid one
> in madevent_interface.py, you add:
> 3816 try:
> 3817 os.remove(pjoin(self.me_dir,'RunWeb'))
> 3818 except:
> 3819 pass

Ok I removed those lines from madevent_interface.py.

> but i still have one comment:
>
> - 86 err_goal = 1.5*nreq ! extra factor to ensure works
> + 86 err_goal = 1.2*nreq ! extra factor to ensure works
>
> are you sure that 1.2 is always enough?

This is what we use in the regular refine, so there is no reason it wouldn't work here (and it makes a big difference in run time). We'll send this version to Alexis for testing, and if we hear from him that there are problems getting the events, then we can change it. For now, I'd prefer not to add yet another flag in the run_card.

> In any case, I approve it right now.

Thanks!

Revision history for this message
Johan Alwall (johan-alwall) wrote :

Since there has been no reaction from Tim or Rikkert, I'll perform the merge to v. 1.4 now. If you guys have comments, let us know before tomorrow and we can make the changes in v. 1.4.

Thanks,
Johan

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 2011-08-19 00:06:00 +0000
3+++ Template/Source/dsample.f 2012-02-03 01:48:18 +0000
4@@ -1,4 +1,4 @@
5- subroutine sample_full(ndim,ncall,itmax,dsig,ninvar,nconfigs)
6+ subroutine sample_full(ndim,ncall,itmax,itmin,dsig,ninvar,nconfigs)
7 c**************************************************************************
8 c Driver for sample which does complete integration
9 c This is done in double precision, and should be told the
10@@ -6,7 +6,8 @@
11 c Arguments:
12 c ndim Number of dimensions for integral(number or random #'s/point)
13 c ncall Number of times to evaluate the function/iteration
14-c itmax Number of iterations
15+c itmax Max number of iterations
16+c itmin Min number of iterations
17 c ninvar Number of invarients to keep grids on (s,t,u, s',t' etc)
18 c nconfigs Number of different pole configurations
19 c dsig Function to be integrated
20@@ -16,7 +17,7 @@
21 c
22 c Arguments
23 c
24- integer ndim,ncall,itmax,ninvar,nconfigs
25+ integer ndim,ncall,itmax,itmin,ninvar,nconfigs
26 external dsig
27 double precision dsig
28 c
29@@ -24,7 +25,7 @@
30 c
31 double precision x(maxinvar),wgt,p(4*maxdim/3+14)
32 double precision tdem, chi2, dum
33- integer ievent,kevent,nwrite,iter,nun,luntmp
34+ integer ievent,kevent,nwrite,iter,nun,luntmp,itsum
35 integer jmax,i,j,ipole
36 integer itmax_adjust
37 c
38@@ -51,8 +52,8 @@
39 common /to_accuracy/accur
40
41 double precision twgt, maxwgt,swgt(maxevents)
42- integer lun, nw
43- common/to_unwgt/twgt, maxwgt, swgt, lun, nw
44+ integer lun, nw, itminx
45+ common/to_unwgt/twgt, maxwgt, swgt, lun, nw, itminx
46
47 integer nzoom
48 double precision tx(1:3,maxinvar)
49@@ -100,6 +101,7 @@
50 kevent = 0
51 nzoom = 0
52 xzoomfact = 1d0
53+ itminx = itmin
54 if (nsteps .lt. 1) nsteps=1
55 nwrite = itmax*ncall/nsteps
56 c open(unit=66,file='.sample_warn',status='unknown')
57@@ -140,7 +142,7 @@
58 wgt=0d0
59 endif
60 if (nzoom .le. 0) then
61- call sample_put_point(wgt,x(1),iter,ipole) !Store result
62+ call sample_put_point(wgt,x(1),iter,ipole,itmin) !Store result
63 else
64 nzoom = nzoom -1
65 ievent=ievent-1
66@@ -165,7 +167,9 @@
67 i=i+1
68 enddo
69 cur_it = i
70- i = cur_it - 3
71+c Use the last 3 iterations or cur_it-1 if cur_it-1 >= itmin but < 3
72+ itsum = min(max(itmin,cur_it-1),3)
73+ i = cur_it - itsum
74 if (i .gt. 0) then
75 tmean = 0d0
76 tsigma = 0d0
77@@ -183,13 +187,14 @@
78 nun = neventswritten
79
80 chi2 = 0d0
81- do i = cur_it-3,cur_it-1
82+ do i = cur_it-itsum,cur_it-1
83 chi2 = chi2+(xmean(i)-tmean)**2/xsigma(i)**2
84 enddo
85 chi2 = chi2/2d0 !Since using only last 3, n-1=2
86 write(*,'(a)') '-----------------------------------------------------'
87 write(*,'(a)') '---------------------------'
88- write(*,'(a,e12.4)') ' Results Last 3 iters: Integral = ',tmean
89+ write(*,'(a,i3,a,e12.4)') ' Results Last ',itsum,
90+ $ ' iters: Integral = ',tmean
91 write(*,'(25x,a,e12.4)') 'Std dev = ',tsigma
92 write(*,'(17x,a,f12.4)') 'Chi**2 per DoF. =',chi2
93 write(*,'(a)') '-----------------------------------------------------'
94@@ -198,14 +203,14 @@
95 if (nun .lt. 0) nun=-nun !Case when wrote maximun number allowed
96 if (chi2 .gt. 1) tsigma=tsigma*sqrt(chi2)
97 if (icor .eq. 0) then
98- write(66,'(3e12.5,2i9,i5,i9,e10.3)')tmean,tsigma,0.0,kevent,nw,
99- & cur_it-1,nun, nun/max(tmean,1d-99)
100+ write(66,'(3e12.5,2i9,i5,i9,e10.3,e12.5)')tmean,tsigma,0.0,
101+ & kevent, nw, cur_it-1, nun, nun/max(tmean,1d-99), twgt
102 else
103- write(66,'(3e12.5,2i9,i5,i9,e10.3)')tmean,0.0,tsigma,kevent,nw,
104- & cur_it-1,nun, nun/max(tmean,1d-99)
105+ write(66,'(3e12.5,2i9,i5,i9,e10.3,e12.5)')tmean,0.0,tsigma,
106+ & kevent, nw, cur_it-1, nun, nun/max(tmean,1d-99), twgt
107 endif
108 c do i=1,cur_it-1
109- do i=cur_it-3,cur_it-1
110+ do i=cur_it-itsum,cur_it-1
111 write(66,'(i4,4e15.5)') i,xmean(i),xsigma(i),xeff(i),xwmax(i)
112 enddo
113 close(66)
114@@ -297,7 +302,7 @@
115 wgt=0d0
116 endif
117 if (nzoom .le. 0) then
118- call sample_put_point(wgt,x(1),iter,ipole) !Store result
119+ call sample_put_point(wgt,x(1),iter,ipole,itmin) !Store result
120 else
121 nzoom = nzoom -1
122 ievent=ievent-1
123@@ -314,7 +319,9 @@
124 i=i+1
125 enddo
126 cur_it = i
127- i = cur_it - 3
128+c Use the last 3 iterations or cur_it-1 if cur_it-1 >= itmin
129+ itsum = min(max(itmin,cur_it-1),3)
130+ i = cur_it - itsum
131 if (i .gt. 0) then
132 tmean = 0d0
133 tsigma = 0d0
134@@ -334,13 +341,13 @@
135 nun = neventswritten
136
137 chi2 = 0d0
138- do i = cur_it-3,cur_it-1
139+ do i = cur_it-itsum,cur_it-1
140 chi2 = chi2+(xmean(i)-tmean)**2/xsigma(i)**2
141 enddo
142 chi2 = chi2/2d0 !Since using only last 3, n-1=2
143 write(*,'(a)') '-----------------------------------------------------'
144 write(*,'(a)') '---------------------------'
145- write(*,'(a,e12.4)') ' Results Last 3 iters: Integral = ',tmean
146+ write(*,'(a,i3,a,e12.4)') ' Results Last ',itsum,' iters: Integral = ',tmean
147 write(*,'(25x,a,e12.4)') 'Std dev = ',tsigma
148 write(*,'(17x,a,f12.4)') 'Chi**2 per DoF. =',chi2
149 write(*,'(a)') '-----------------------------------------------------'
150@@ -349,14 +356,14 @@
151 if (nun .lt. 0) nun=-nun !Case when wrote maximun number allowed
152 if (chi2 .gt. 1) tsigma=tsigma*sqrt(chi2)
153 if (icor .eq. 0) then
154- write(66,'(3e12.5,2i9,i5,i9,e10.3)')tmean,tsigma,0.0,kevent,nw,
155- & cur_it-1,nun, nun/max(tmean,1d-99)
156+ write(66,'(3e12.5,2i9,i5,i9,e10.3,e12.5)')tmean,tsigma,0.0,
157+ & kevent, nw, cur_it-1, nun, nun/max(tmean,1d-99), twgt
158 else
159- write(66,'(3e12.5,2i9,i5,i9,e10.3)')tmean,0.0,tsigma,kevent,nw,
160- & cur_it-1,nun, nun/max(tmean,1d-99)
161+ write(66,'(3e12.5,2i9,i5,i9,e10.3,e12.5)')tmean,0.0,tsigma,
162+ & kevent, nw, cur_it-1, nun, nun/max(tmean,1d-99), twgt
163 endif
164 c do i=1,cur_it-1
165- do i=cur_it-3,cur_it-1
166+ do i=cur_it-itsum,cur_it-1
167 write(66,'(i4,4e15.5)') i,xmean(i),xsigma(i),xeff(i),xwmax(i)
168 enddo
169 close(66)
170@@ -371,237 +378,6 @@
171
172 end
173
174- subroutine sample_fullx(ndim,ncall,itmax,dsig,ninvar,nconfigs)
175-c**************************************************************************
176-c Driver for sample which does complete integration
177-c This is done in double precision, and should be told the
178-c number of possible phasespace choices.
179-c Arguments:
180-c ndim Number of dimensions for integral(number or random #'s/point)
181-c ncall Number of times to evaluate the function/iteration
182-c itmax Number of iterations
183-c ninvar Number of invarients to keep grids on (s,t,u, s',t' etc)
184-c nconfigs Number of different pole configurations
185-c dsig Function to be integrated
186-c**************************************************************************
187- implicit none
188- include 'genps.inc'
189-c
190-c Arguments
191-c
192- integer ndim,ncall,itmax,ninvar,nconfigs
193- external dsig
194- double precision dsig
195-c
196-c Local
197-c
198- double precision x(maxinvar),wgt,p(4*maxdim/3+14)
199- double precision tdem, chi2
200- integer ievent,kevent,nwrite,iter,nun
201- integer jmax,i,j,ipole
202-c
203-c External
204-c
205- integer n_unwgted
206- external n_unwgted
207-c
208-c Global
209-c
210- integer nsteps
211- character*40 result_file,where_file
212- common /sample_status/result_file,where_file,nsteps
213- double precision fx
214- common /to_fx/ fx
215-
216- integer mincfig, maxcfig
217- common/to_configs/mincfig, maxcfig
218-
219- double precision xmean(99),xsigma(99),xwmax(99),xeff(99)
220- common/to_iterations/xmean, xsigma, xwmax, xeff
221-
222- double precision accur
223- common /to_accuracy/accur
224-
225- double precision twgt, maxwgt,swgt(maxevents)
226- integer lun, nw
227- common/to_unwgt/twgt, maxwgt, swgt, lun, nw
228-
229- integer nzoom
230- double precision tx(1:3,maxinvar)
231- common/to_xpoints/tx, nzoom
232-
233- double precision xzoomfact
234- common/to_zoom/ xzoomfact
235-
236- double precision tmean, tsigma
237- integer dim, events, itm, kn, cur_it, invar, configs
238- common /sample_common/
239- . tmean, tsigma, dim, events, itm, kn, cur_it, invar, configs
240-
241- integer icor
242- common/to_correlated/icor
243-c
244-c External
245-c
246- logical pass_point
247-c
248-c Data
249-c
250-c data result_file,where_file,nsteps/'SAMPLE','WHERE.AMI',100/
251-c data accur/-1d0/
252-c data mincfig /1/
253-c data maxcfig /1/
254-c data twgt/-1d0/ !Dont write out events
255-c data lun/27/ !Unit number for events
256-c data maxwgt/0d0/
257-c data nw/0/ !Number of events written
258-
259-
260-c-----
261-c Begin Code
262-c-----
263- ievent = 0
264- kevent = 0
265- nzoom = 0
266- xzoomfact = 1d0
267- if (nsteps .lt. 1) nsteps=1
268- nwrite = itmax*ncall/nsteps
269-c open(unit=66,file='.sample_warn',status='unknown')
270-c write(66,*) 'Warnings from sample run.',itmax,ncall
271-c close(66)
272- call sample_init(ndim,ncall,itmax,ninvar,nconfigs)
273- call graph_init
274- do i=1,itmax
275- xmean(i)=0d0
276- xsigma(i)=0d0
277- enddo
278-c mincfig=1
279-c maxcfig=nconfigs
280- wgt = 0d0
281-c
282-c Main Integration Loop
283-c
284- iter = 1
285- do while(iter .le. itmax)
286-c
287-c Get integration point
288-c
289- call sample_get_config(wgt,iter,ipole)
290- if (iter .le. itmax) then
291- ievent=ievent+1
292- call x_to_f_arg(ndim,ipole,mincfig,maxcfig,ninvar,wgt,x,p)
293- if (pass_point(p)) then
294- xzoomfact = 1d0
295- fx = dsig(p,wgt,0) !Evaluate function
296- if (xzoomfact .gt. 0d0) then
297- wgt = wgt*fx*xzoomfact
298- else
299- wgt = -xzoomfact
300- endif
301- if (wgt .gt. 0d0) call graph_point(p,wgt) !Update graphs
302- else
303- fx =0d0
304- wgt=0d0
305- endif
306- if (nzoom .le. 0) then
307- call sample_put_point(wgt,x(1),iter,ipole) !Store result
308- else
309- nzoom = nzoom -1
310- ievent=ievent-1
311- endif
312- endif
313- if (wgt .gt. 0d0) kevent=kevent+1
314-c
315-c Write out progress/histograms
316-c
317- if (kevent .ge. nwrite) then
318- nwrite = nwrite+ncall*itmax/nsteps
319- nwrite = min(nwrite,ncall*itmax)
320-c open(unit=22,file=where_file,status='old',
321-c & access='append',err=99)
322-c write(22,'(2i15)') ievent,kevent
323-c close(22)
324- call graph_store
325- endif
326- 99 enddo
327-c
328-c All done
329-c
330-c open(unit=66,file='.sample_warn',status='old',access='append')
331-c write(66,*) 'Finished sample',ievent,kevent,wgt
332-c if (wgt .ne. -1) then
333-c do j=1,5
334-c jmax = min(ndim,4*j)
335-c write(66,'(4e19.12)') (x(i),i=(j-1)*4+1,jmax)
336-c enddo
337-c endif
338-c close(66)
339-
340- open(unit=66,file='results.dat',status='unknown')
341- i=1
342- do while(xmean(i) .ne. 0 .and. i .lt. cur_it)
343- i=i+1
344- enddo
345- cur_it = i
346- i = cur_it - 3
347- if (i .gt. 0) then
348- tmean = 0d0
349- tsigma = 0d0
350- tdem = 0d0
351- do while (xmean(i) .ne. 0 .and. i .lt. cur_it)
352- tmean = tmean+xmean(i)*xmean(i)**2/xsigma(i)**2
353- tdem = tdem+xmean(i)**2/xsigma(i)**2
354- tsigma = tsigma + xmean(i)**2/ xsigma(i)**2
355- i=i+1
356- enddo
357-c tmean = tmean/dble(i-1)
358-c tsigma= sqrt(tsigma)/dble(i-1)
359- tmean = tmean/tsigma
360-c tsigma= sqrt(tsigma)/dble(3)
361- tsigma= tmean/sqrt(tsigma)
362- nun = n_unwgted()
363-
364- chi2 = 0d0
365- do i = cur_it-3,cur_it-1
366- chi2 = chi2+(xmean(i)-tmean)**2/xsigma(i)**2
367- enddo
368- chi2 = chi2/2d0 !Since using only last 3, n-1=2
369-c tsigma = tsigma*sqrt(chi2)
370-c write(*,*) "chi2 / dof=", chi2
371- write(*,'(a)') '-----------------------------------------------------'
372- write(*,'(a)') '---------------------------'
373- write(*,'(a,e12.4)') ' Results Last 3 iters: Integral = ',tmean
374- write(*,'(25x,a,e12.4)') 'Std dev = ',tsigma
375- write(*,'(17x,a,f12.4)') 'Chi**2 per DoF. =',chi2
376- write(*,'(a)') '-----------------------------------------------------'
377- write(*,'(a)') '---------------------------'
378-
379- if (nun .lt. 0) nun=-nun !Case when wrote maximun number allowed
380- if (chi2 .gt. 1) tsigma=tsigma*sqrt(chi2)
381- if (icor .eq. 0) then
382- write(66,'(3e12.5,2i9,i5,i9,e10.3)')tmean,tsigma,0.0,kevent,nw,
383- & cur_it-1,nun, nun/max(tmean,1d-99)
384- else
385- write(66,'(3e12.5,2i9,i5,i9,e10.3)')tmean,0.0,tsigma,kevent,nw,
386- & cur_it-1,nun, nun/max(tmean,1d-99)
387- endif
388-c do i=1,cur_it-1
389- do i=cur_it-3,cur_it-1
390- write(66,'(i4,4e15.5)') i,xmean(i),xsigma(i),xeff(i),xwmax(i)
391- enddo
392- close(66)
393- else
394- open(unit=66,file='results.dat',status='unknown')
395- write(66,'(3e12.5,2i9,i5,i9,e10.3)')0,0,0.0,kevent,nw,
396- & 1,0, 0
397- write(66,'(i4,4e15.5)') 1,0,0,0,0
398- close(66)
399-
400- endif
401-
402- end
403-
404-
405 subroutine sample_writehtm()
406 c***********************************************************************
407 c Writes out results of run in html format
408@@ -1336,10 +1112,10 @@
409 endif
410 end
411
412- subroutine sample_result(mean, sigma)
413+ subroutine sample_result(mean, sigma, itmin)
414 implicit none
415 double precision mean, sigma
416- integer i,cur_it
417+ integer i,cur_it,itmin,itsum
418 double precision tsigma,tmean,tsig,tdem
419
420 double precision xmean(99),xsigma(99),xwmax(99),xeff(99)
421@@ -1351,7 +1127,9 @@
422 i=i+1
423 enddo
424 cur_it = i
425- i = cur_it - 3
426+c Use the last 3 iterations or cur_it-1 if cur_it-1 >= itmin
427+ itsum = min(max(itmin,cur_it-1),3)
428+ i = cur_it - itsum
429 tmean = 0d0
430 tsigma = 0d0
431 if (i .gt. 0) then
432@@ -1393,7 +1171,7 @@
433 c
434 c Local
435 c
436- integer i, j, k, knt, non_zero, nun
437+ integer i, j, k, knt, non_zero, nun,itsum
438 double precision vol,xnmin,xnmax,tot,xdum,tmp1,chi2tmp
439 double precision rc, dr, xo, xn, x(maxinvar), dum(ng-1)
440 save vol,knt
441@@ -1447,8 +1225,8 @@
442 common /to_error/reliable
443
444 double precision twgt, maxwgt,swgt(maxevents)
445- integer lun, nw
446- common/to_unwgt/twgt, maxwgt, swgt, lun, nw
447+ integer lun, nw, itmin
448+ common/to_unwgt/twgt, maxwgt, swgt, lun, nw, itmin
449
450
451 real*8 wmax !This is redundant
452@@ -1889,9 +1667,9 @@
453 xdum=dsig(0,0,2)
454 c
455 c Add test to see if we have achieved desired accuracy
456-c JA 8/17/2011 allow minimum 3 iterations instead of 5
457+c Allow minimum itmin iterations instead of 5
458 c
459- if (tsigma .gt. 0d0 .and. cur_it .gt. 3 .and. accur .gt. 0d0) then
460+ if (tsigma .gt. 0d0 .and. cur_it .gt. itmin .and. accur .gt. 0d0) then
461
462 xmean = tmean/tsigma
463 xchi2 = (chi2/xmean/xmean-tsigma)/dble(cur_it-2)
464@@ -1930,7 +1708,7 @@
465 c
466 c New check to see if we need to keep integrating this one or not.
467 c
468- if (cur_it .gt. 3 .and. accur .lt. 0d0) then !Check luminocity
469+ if (cur_it .gt. itmin .and. accur .lt. 0d0) then !Check luminocity
470 c
471 c Lets get the actual number instead
472 c tjs 5/22/2007
473@@ -1941,16 +1719,18 @@
474 nun = neventswritten
475 c tmp1 = tmean / tsigma
476 c chi2tmp = (chi2/tmp1/tmp1-tsigma)/dble(cur_it-2)
477-c Calculate chi2 for last three events (ja 03/11)
478+c Calculate chi2 for last few iterations (ja 03/11)
479 tmeant = 0d0
480 tsigmat = 0d0
481- do i=cur_it-3,cur_it-1
482+c Use the last 3 iterations or cur_it-1 if cur_it-1 >= itmin but < 3
483+ itsum = min(max(itmin,cur_it-1),3)
484+ do i=cur_it-itsum,cur_it-1
485 tmeant = tmeant+ymean(i)*ymean(i)**2/ysigma(i)**2
486 tsigmat = tsigmat + ymean(i)**2/ ysigma(i)**2
487 enddo
488 tmeant = tmeant/tsigmat
489 chi2tmp = 0d0
490- do i = cur_it-3,cur_it-1
491+ do i = cur_it-itsum,cur_it-1
492 chi2tmp = chi2tmp+(ymean(i)-tmeant)**2/ysigma(i)**2
493 enddo
494 chi2tmp = chi2tmp/2d0 !Since using only last 3, n-1=2
495
496=== modified file 'Template/Source/gen_ximprove.f'
497--- Template/Source/gen_ximprove.f 2012-01-23 12:33:28 +0000
498+++ Template/Source/gen_ximprove.f 2012-02-03 01:48:18 +0000
499@@ -19,8 +19,8 @@
500 c
501 c global
502 c
503- integer max_np
504- common/max_np/max_np
505+ integer max_np,min_iter
506+ common/max_np/max_np,min_iter
507
508 c
509 c local
510@@ -62,6 +62,7 @@
511 & ', or number events (>1), max processes per job',
512 & ', and whether to split channels (T/F)'
513 read(*,*) err_goal, max_np, split_channels
514+ min_iter=3
515 parallel = .false.
516 if (err_goal .lt. 1) then
517 write(*,'(a,f8.2,a)') 'Running for accuracy of ',
518@@ -79,11 +80,13 @@
519 else
520 gen_events=.true.
521 split_channels=.false.
522+c Allow all the way down to a single iteration for gridruns
523+ min_iter=1
524 call get_integer(npara,param,value," gevents " ,nreq ,2000 )
525- err_goal = 1.5*nreq ! extra factor to ensure works
526+ err_goal = 1.2*nreq ! extra factor to ensure works
527 call get_integer(npara,param,value," gseed " ,iseed ,4321 )
528 call get_integer(npara,param,value," ngran " ,ngran , -1)
529- if (ngran.eq.-1) ngran = int(sqrt(real(nreq)))
530+ if (ngran.eq.-1) ngran = 1
531 write(*,*) "Running on Grid to generate ",nreq," additional events"
532 write(*,*) " with granularity equal to ",ngran
533 c
534@@ -229,8 +232,8 @@
535 c
536 c global
537 c
538- integer max_np
539- common/max_np/max_np
540+ integer max_np,min_iter
541+ common/max_np/max_np,min_iter
542 c
543 c Arguments
544 c
545@@ -329,7 +332,7 @@
546 write(26,20) 'rm -f $k'
547 c write(26,20) 'rm -f moffset.dat'
548
549- write(26,'(5x,a,2i8,a)') 'echo "',npoints,max_iter,
550+ write(26,'(5x,a,3i8,a)') 'echo "',npoints,max_iter,min_iter,
551 $ '" >& input_sg.txt'
552 write(26,'(5x,a,f8.3,a)') 'echo "',max(elimit/ysec,0.001d0),
553 $ '" >> input_sg.txt'
554@@ -476,8 +479,8 @@
555 c
556 c global
557 c
558- integer max_np
559- common/max_np/max_np
560+ integer max_np,min_iter
561+ common/max_np/max_np,min_iter
562 c integer max_np !now set in run_config.inc
563 c parameter (max_np = 5) !number of channels/job
564
565@@ -654,7 +657,7 @@
566 write(26,20) 'if [[ ! -e ftn25 ]]; then'
567
568
569- write(26,'(9x,a,2i8,a)') 'echo "',npoints,max_iter,
570+ write(26,'(9x,a,3i8,a)') 'echo "',npoints,max_iter,min_iter,
571 $ '" >& input_sg.txt'
572 c
573 c tjs 8/7/2007-JA 8/17/11 Allow stop when have enough luminocity
574@@ -677,7 +680,7 @@
575
576 write(26,25) 'rm -f $k'
577
578- write(26,'(9x,a,2i8,a)') 'echo "',npoints,max_iter,
579+ write(26,'(9x,a,3i8,a)') 'echo "',npoints,max_iter,min_iter,
580 $ '" >& input_sg.txt'
581 c
582 c tjs 8/7/2007-JA 8/17/11 Change to request luminocity not accuracy
583@@ -740,8 +743,8 @@
584 c
585 c global
586 c
587- integer max_np
588- common/max_np/max_np
589+ integer max_np,min_iter
590+ common/max_np/max_np,min_iter
591 c
592 c Arguments
593 c
594@@ -787,7 +790,7 @@
595 write(27,*) xtot*ngran/xsec(i)/goal_lum
596 endif
597 npoints = goal_lum * xsec(i) / xtot
598- if (npoints .lt. min_gevents_wu) npoints = min_gevents_wu
599+ if (npoints .lt. ngran) npoints = ngran
600 np = np+1
601 if (np .gt. max_np) then
602 if (fopened) then
603@@ -822,8 +825,8 @@
604 write(26,20) 'if [[ ! -e ftn25 ]]; then'
605
606
607- write(26,'(9x,a,2i8,a)') 'echo "',max(npoints,min_events),
608- $ max_iter,'" >& input_sg.txt'
609+ write(26,'(9x,a,3i8,a)') 'echo "',max(npoints,min_events),
610+ $ max_iter,min_iter,'" >& input_sg.txt'
611 c
612 c tjs 8/7/2007 Allow stop when have enough events
613 c
614@@ -845,8 +848,8 @@
615
616 write(26,25) 'rm -f $k'
617
618- write(26,'(9x,a,2i8,a)') 'echo "',max(npoints,min_events),
619- $ max_iter,'" >& input_sg.txt'
620+ write(26,'(9x,a,3i8,a)') 'echo "',max(npoints,min_events),
621+ $ max_iter,min_iter,'" >& input_sg.txt'
622 c
623 c tjs 8/7/2007 Change to request events not accuracy
624 c
625
626=== modified file 'Template/SubProcesses/unwgt.f'
627--- Template/SubProcesses/unwgt.f 2011-10-03 08:39:00 +0000
628+++ Template/SubProcesses/unwgt.f 2012-02-03 01:48:18 +0000
629@@ -27,8 +27,8 @@
630 C GLOBAL
631 C
632 double precision twgt, maxwgt,swgt(maxevents)
633- integer lun, nw
634- common/to_unwgt/twgt, maxwgt, swgt, lun, nw
635+ integer lun, nw, itmin
636+ common/to_unwgt/twgt, maxwgt, swgt, lun, nw, itmin
637 integer nzoom
638 double precision tx(1:3,maxinvar)
639 common/to_xpoints/tx, nzoom
640@@ -126,8 +126,8 @@
641 C GLOBAL
642 C
643 double precision twgt, maxwgt,swgt(maxevents)
644- integer lun, nw
645- common/to_unwgt/twgt, maxwgt, swgt, lun, nw
646+ integer lun, nw, itmin
647+ common/to_unwgt/twgt, maxwgt, swgt, lun, nw, itmin
648
649 c-----
650 c Begin Code
651@@ -163,8 +163,8 @@
652 C GLOBAL
653 C
654 double precision twgt, maxwgt,swgt(maxevents)
655- integer lun, nw
656- common/to_unwgt/twgt, maxwgt, swgt, lun, nw
657+ integer lun, nw, itmin
658+ common/to_unwgt/twgt, maxwgt, swgt, lun, nw, itmin
659
660 double precision matrix
661 common/to_maxmatrix/matrix
662@@ -245,8 +245,8 @@
663 C GLOBAL
664 C
665 double precision twgt, maxwgt,swgt(maxevents)
666- integer lun, nw
667- common/to_unwgt/twgt, maxwgt, swgt, lun, nw
668+ integer lun, nw, itmin
669+ common/to_unwgt/twgt, maxwgt, swgt, lun, nw, itmin
670
671 integer neventswritten
672 common /to_eventswritten/ neventswritten
673@@ -269,7 +269,7 @@
674 c First scale all of the events to the total cross section
675 c
676 if (nw .le. 0) return
677- call sample_result(xsec,xerr)
678+ call sample_result(xsec,xerr,itmin)
679 if (xsec .le. 0) return !Fix by TS 12/3/2010
680 xtot=0
681 call dsort(nw, swgt)
682@@ -403,8 +403,8 @@
683 C GLOBAL
684 C
685 double precision twgt, maxwgt,swgt(maxevents)
686- integer lun, nw
687- common/to_unwgt/twgt, maxwgt, swgt, lun, nw
688+ integer lun, nw, itmin
689+ common/to_unwgt/twgt, maxwgt, swgt, lun, nw, itmin
690
691 integer IPROC
692 DOUBLE PRECISION PD(0:MAXPROC)
693@@ -596,8 +596,8 @@
694 C GLOBAL
695 C
696 double precision twgt, maxwgt,swgt(maxevents)
697- integer lun, nw
698- common/to_unwgt/twgt, maxwgt, swgt, lun, nw
699+ integer lun, nw, itmin
700+ common/to_unwgt/twgt, maxwgt, swgt, lun, nw, itmin
701 c-----
702 c Begin Code
703 c-----
704
705=== modified file 'UpdateNotes.txt'
706--- UpdateNotes.txt 2012-02-01 19:52:37 +0000
707+++ UpdateNotes.txt 2012-02-03 01:48:18 +0000
708@@ -1,6 +1,6 @@
709 Update notes for MadGraph 5 (in reverse time order)
710
711-1.4.b10 (19/01/12): OM: New Interface to controll the madevent run.
712+1.4.b12 (31/01/12): OM: New Interface to controll the madevent run.
713 This one is accessible by
714 1) (from madevent output) ./bin/madevent
715 2) (from MG5 command line) launch [MADEVENT_PATH] -i
716@@ -82,7 +82,13 @@
717 OM: Improve the parralel suite and change the release script to run
718 some of the parralel suite. This ensures more stability of the
719 code for the future release.
720-
721+ JA: Changed the way gridpacks work: Set granularity
722+ to 1 (so randomly select channels only if they
723+ should generate less than 1 event), but
724+ allowing channels to run down to a single
725+ iteration. This removes all old problems with
726+ the gridpacks, while giving even faster event
727+ generation.
728
729 Thanks to Johan Alwall, Sho Iwamoto for all the important
730 testing/bug reports.
731
732=== modified file 'madgraph/VERSION'
733--- madgraph/VERSION 2012-02-01 19:53:45 +0000
734+++ madgraph/VERSION 2012-02-03 01:48:18 +0000
735@@ -1,3 +1,3 @@
736-version = 1.4.0.beta_11
737-date = 2012-01-30
738+version = 1.4.0.beta_12
739+date = 2012-01-31
740
741
742=== modified file 'madgraph/interface/madevent_interface.py'
743--- madgraph/interface/madevent_interface.py 2012-02-02 22:07:18 +0000
744+++ madgraph/interface/madevent_interface.py 2012-02-03 01:48:18 +0000
745@@ -3795,6 +3795,7 @@
746
747 MadEventCmd.__init__(self, me_dir, *completekey, **stdin)
748 self.run_mode = 0
749+ self.random = seed
750 self.configuration['automatic_html_opening'] = False
751 # Now it's time to run!
752 if me_dir and nb_event and seed:
753@@ -3827,17 +3828,14 @@
754 self.exec_cmd('store_events')
755 self.exec_cmd('pythia --no_default -f')
756
757-
758-
759-
760 def refine4grid(self, nb_event):
761- """Advanced commands: launch survey for the current process """
762+ """Special refine for gridpack run."""
763 self.nb_refine += 1
764
765 precision = nb_event
766
767 # initialize / remove lhapdf mode
768- self.configure_directory()
769+ # self.configure_directory() # All this has been done before
770 self.cluster_mode = 0 # force single machine
771
772 self.update_status('Refine results to %s' % precision, level=None)
773@@ -3858,13 +3856,15 @@
774 os.remove(pjoin(Pdir, match))
775
776 devnull = os.open(os.devnull, os.O_RDWR)
777+ logfile = pjoin(Pdir, 'gen_ximprove.log')
778 proc = subprocess.Popen([pjoin(bindir, 'gen_ximprove')],
779 stdin=subprocess.PIPE,
780+ stdout=open(logfile,'w'),
781 cwd=Pdir)
782 proc.communicate('%s 1 F\n' % (precision))
783
784 if os.path.exists(pjoin(Pdir, 'ajob1')):
785- misc.compile(['madevent'], cwd=Pdir)
786+ # misc.compile(['madevent'], cwd=Pdir) # Done before
787 #
788 os.system("chmod +x %s/ajob*" % Pdir)
789 alljobs = glob.glob(pjoin(Pdir,'ajob*'))
790
791=== modified file 'madgraph/iolibs/template_files/madevent_driver.f'
792--- madgraph/iolibs/template_files/madevent_driver.f 2011-11-13 10:33:10 +0000
793+++ madgraph/iolibs/template_files/madevent_driver.f 2012-02-03 01:48:18 +0000
794@@ -11,12 +11,12 @@
795 include 'genps.inc'
796 include 'maxconfigs.inc'
797 include 'nexternal.inc'
798- INTEGER ITMAX, NCALL
799+ INTEGER ITMAX, ITMIN, NCALL
800 C
801 C LOCAL
802 C
803- integer i,ninvar,nconfigs,j,l,l1,l2,ndim
804- double precision dsig,tot,mean,sigma
805+ integer i,ninvar,nconfigs,j,l,l1,l2,ndim,idum
806+ double precision dsig,tot,mean,sigma,xdum
807 integer npoints,lunsud
808 double precision x,y,jac,s1,s2,xmin
809 external dsig
810@@ -78,8 +78,18 @@
811 $ read(buf(l1+1:l2-1),*,err=11) ngroup
812 11 print *,'Process in group number ',ngroup
813
814+c Read weight from results.dat if present
815+ open (unit=lun+1,file='results.dat',status='unknown',err=13)
816+ read (lun+1,'(a130)',err=12,end=12) buf
817+ close (lun+1)
818+ read(buf,'(3e12.5,2i9,i5,i9,e10.3,e12.5)',err=13) xdum,xdum,xdum,
819+ $ idum,idum,idum,idum,xdum,twgt
820+ goto 14
821+ 12 close (lun+1)
822+ 13 twgt = -2d0 !determine wgt after first iteration
823+ 14 continue
824 lun = 27
825- twgt = -2d0 !determine wgt after first iteration
826+
827 open(unit=lun,status='scratch')
828 nsteps=2
829 param_card_name = '%(param_card_name)s'
830@@ -126,7 +136,7 @@
831 c Get user input
832 c
833 write(*,*) "getting user params"
834- call get_user_params(ncall,itmax,mincfig)
835+ call get_user_params(ncall,itmax,itmin,mincfig)
836 maxcfig=mincfig
837 minvar(1,1) = 0 !This tells it to map things invarients
838 write(*,*) 'Attempting mappinvarients',nconfigs,nexternal
839@@ -144,8 +154,8 @@
840 minvar(ndim,j) = ninvar
841 endif
842 enddo
843- write(*,*) "about to integrate ", ndim,ncall,itmax,ninvar,nconfigs
844- call sample_full(ndim,ncall,itmax,dsig,ninvar,nconfigs)
845+ write(*,*) "about to integrate ", ndim,ncall,itmax,itmin,ninvar,nconfigs
846+ call sample_full(ndim,ncall,itmax,itmin,dsig,ninvar,nconfigs)
847 c
848 c Now write out events to permanent file
849 c
850@@ -170,7 +180,7 @@
851 c $B$ get_user_params $B$ ! tag for MadWeight
852 c change this routine to read the input in a file
853 c
854- subroutine get_user_params(ncall,itmax,iconfig)
855+ subroutine get_user_params(ncall,itmax,itmin,iconfig)
856 c**********************************************************************
857 c Routine to get user specified parameters for run
858 c**********************************************************************
859@@ -183,7 +193,7 @@
860 c
861 c Arguments
862 c
863- integer ncall,itmax,iconfig
864+ integer ncall,itmax,itmin,iconfig
865 c
866 c Local
867 c
868@@ -206,9 +216,9 @@
869 c-----
870 c Begin Code
871 c-----
872- write(*,'(a)') 'Enter number of events and iterations: '
873- read(*,*) ncall,itmax
874- write(*,*) 'Number of events and iterations ',ncall,itmax
875+ write(*,'(a)') 'Enter number of events and max and min iterations: '
876+ read(*,*) ncall,itmax,itmin
877+ write(*,*) 'Number of events and iterations ',ncall,itmax,itmin
878 write(*,'(a)') 'Enter desired fractional accuracy: '
879 read(*,*) accur
880 write(*,*) 'Desired fractional accuracy: ',accur
881
882=== modified file 'madgraph/iolibs/template_files/madevent_run_config.inc'
883--- madgraph/iolibs/template_files/madevent_run_config.inc 2011-11-14 09:27:10 +0000
884+++ madgraph/iolibs/template_files/madevent_run_config.inc 2012-02-03 01:48:18 +0000
885@@ -38,8 +38,3 @@
886 c
887 double precision trunc_max
888 parameter (trunc_max=0.01)
889-c
890-c The following are used for grid type running
891-c
892- integer min_gevents_wu
893- parameter (min_gevents_wu=200) !Minumum # unweighted events to generate from channel
894
895=== modified file 'madgraph/iolibs/template_files/madevent_symmetry.f'
896--- madgraph/iolibs/template_files/madevent_symmetry.f 2012-01-29 23:45:37 +0000
897+++ madgraph/iolibs/template_files/madevent_symmetry.f 2012-02-03 01:48:18 +0000
898@@ -127,8 +127,8 @@
899
900 open (unit=26, file = 'input_app.txt', status='unknown',
901 $ err=99)
902- write(26,*) npoints,itmax,
903- & ' !Number of events and iterations'
904+ write(26,*) npoints,itmax,3,
905+ & ' !Number of events and max and min iterations'
906 write(26,'(f8.4,a)') acc, ' !Accuracy'
907 write(26,*) ' 2 !Grid Adjustment 0=none, 2=adjust'
908 write(26,*) ' 1 !Suppress Amplitude 1=yes'
909
910=== modified file 'madgraph/various/sum_html.py'
911--- madgraph/various/sum_html.py 2012-01-12 13:07:49 +0000
912+++ madgraph/various/sum_html.py 2012-02-03 01:48:18 +0000
913@@ -50,7 +50,7 @@
914 if i == 1:
915 data = [float(d) for d in line.split()]
916 self.xsec, self.xerru, self.xerrc, self.nevents, self.nw,\
917- self.maxit, self.nunwgt, self.luminosity = data
918+ self.maxit, self.nunwgt, self.luminosity = data[:8]
919 if self.mfactor > 1:
920 self.luminosity /= self.mfactor
921 #self.ysec_iter.append(self.xsec)

Subscribers

People subscribed via source and target branches

to all changes: