Merge lp:~maddevelopers/mg5amcnlo/2.3.4_fix_lhef_convention into lp:~maddevelopers/mg5amcnlo/2.3.4

Proposed by Olivier Mattelaer
Status: Merged
Merge reported by: Olivier Mattelaer
Merged at revision: not available
Proposed branch: lp:~maddevelopers/mg5amcnlo/2.3.4_fix_lhef_convention
Merge into: lp:~maddevelopers/mg5amcnlo/2.3.4
Diff against target: 221 lines (+35/-22)
8 files modified
Template/LO/Source/make_opts (+1/-1)
Template/NLO/MCatNLO/include/LHEFRead.h (+6/-3)
Template/NLO/MCatNLO/srcHerwig/madfks_hwlhin.f (+6/-3)
Template/NLO/MCatNLO/srcPythia/madfks_pylhin.f (+6/-3)
Template/NLO/SubProcesses/handling_lhe_events.f (+3/-3)
madgraph/interface/common_run_interface.py (+10/-6)
madgraph/interface/reweight_interface.py (+2/-2)
tests/input_files/madspin_event.lhe (+1/-1)
To merge this branch: bzr merge lp:~maddevelopers/mg5amcnlo/2.3.4_fix_lhef_convention
Reviewer Review Type Date Requested Status
marco zaro Pending
Paolo Torrielli Pending
Review via email: mp+287459@code.launchpad.net

Description of the change

Hi,

This fix two small problems:
1) the LHEF convention for the groupname that we did not follow
2) save the Cards file in hidden file instead of removing it.
   (and reuse those one instead of the default cards)

Cheers,

Olivier

To post a comment you must log in.
Revision history for this message
Olivier Mattelaer (olivier-mattelaer) wrote :

Merged in Rik's branch.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Template/LO/Source/make_opts'
2--- Template/LO/Source/make_opts 2016-02-23 22:55:27 +0000
3+++ Template/LO/Source/make_opts 2016-02-29 12:18:43 +0000
4@@ -28,7 +28,7 @@
5
6 UNAME := $(shell uname -s)
7 ifeq ($(origin LDFLAGS), undefined)
8-LDFLAGS=-lstdc++
9+LDFLAGS=-lc++ -mmacosx-version-min=10.7
10 endif
11
12 # Options: dynamic, lhapdf
13
14=== modified file 'Template/NLO/MCatNLO/include/LHEFRead.h'
15--- Template/NLO/MCatNLO/include/LHEFRead.h 2015-06-12 07:55:36 +0000
16+++ Template/NLO/MCatNLO/include/LHEFRead.h 2016-02-29 12:18:43 +0000
17@@ -29,7 +29,8 @@
18 if (hs.find("</header>") != std::string::npos) break;
19
20 // Read the scale block
21- if (hs.find("<weightgroup type='scale_variation'") != std::string::npos) {
22+ if (hs.find("<weightgroup type='scale_variation'") != std::string::npos ||
23+ hs.find("<weightgroup name='scale_variation'") != std::string::npos) {
24 while (true) {
25 std::getline(hss,hs,'\n');
26 if (hs.find("</weightgroup>") != std::string::npos) break;
27@@ -47,7 +48,8 @@
28 }
29
30 // Read the PDF block
31- if (hs.find("<weightgroup type='PDF_variation'") != std::string::npos) {
32+ if (hs.find("<weightgroup type='PDF_variation'") != std::string::npos ||
33+ hs.find("<weightgroup name='PDF_variation'") != std::string::npos ) {
34 while (true) {
35 std::getline(hss,hs,'\n');
36 if (hs.find("</weightgroup>") != std::string::npos) break;
37@@ -62,7 +64,8 @@
38 }
39
40 // Read the mg_reweighting block
41- if (hs.find("<weightgroup type='mg_reweighting'") != std::string::npos) {
42+ if (hs.find("<weightgroup type='mg_reweighting'") != std::string::npos ||
43+ hs.find("<weightgroup name='mg_reweighting'") != std::string::npos ) {
44 while (true) {
45 std::getline(hss,hs,'\n');
46 if (hs.find("</weightgroup>") != std::string::npos) break;
47
48=== modified file 'Template/NLO/MCatNLO/srcHerwig/madfks_hwlhin.f'
49--- Template/NLO/MCatNLO/srcHerwig/madfks_hwlhin.f 2015-06-12 07:34:40 +0000
50+++ Template/NLO/MCatNLO/srcHerwig/madfks_hwlhin.f 2016-02-29 12:18:43 +0000
51@@ -259,7 +259,8 @@
52 DO WHILE(.TRUE.)
53 READ(61,'(a)')STRING
54 c --> see if we have the new format for the weights
55- IF ( INDEX(STRING,"<weightgroup type='scale_variation'").ne.0
56+ IF ( (INDEX(STRING,"<weightgroup type='scale_variation'").ne.0
57+ $ .or.INDEX(STRING,"<weightgroup name='scale_variation'").ne.0)
58 $ .and.STRING(1:1).ne.'#') then
59 DO WHILE (.TRUE.)
60 READ(61,'(a)') STRING
61@@ -280,7 +281,8 @@
62 write (*,*) 'ERROR #1 in UPINIT:',numscales
63 stop
64 endif
65- ELSEIF( INDEX(STRING,"<weightgroup type='PDF_variation'").ne.0
66+ ELSEIF( (INDEX(STRING,"<weightgroup type='PDF_variation'").ne.0
67+ $ .or.INDEX(STRING,"<weightgroup name='PDF_variation'").ne.0)
68 $ .and.STRING(1:1).ne.'#') then
69 DO WHILE (.TRUE.)
70 READ(61,'(a)') STRING
71@@ -293,7 +295,8 @@
72 ENDDO
73 nwgt=nwgt+numPDFpairs
74 numPDFpairs=numPDFpairs/2
75- ELSEIF( INDEX(STRING,"<weightgroup type='mg_reweighting'").ne.0
76+ ELSEIF( (INDEX(STRING,"<weightgroup type='mg_reweighting'").ne.0
77+ $ .or.INDEX(STRING,"<weightgroup name='mg_reweighting'").ne.0)
78 $ .and.STRING(1:1).ne.'#') then
79 DO WHILE (.TRUE.)
80 READ(61,'(a)') STRING
81
82=== modified file 'Template/NLO/MCatNLO/srcPythia/madfks_pylhin.f'
83--- Template/NLO/MCatNLO/srcPythia/madfks_pylhin.f 2015-06-12 07:34:40 +0000
84+++ Template/NLO/MCatNLO/srcPythia/madfks_pylhin.f 2016-02-29 12:18:43 +0000
85@@ -261,7 +261,8 @@
86 DO WHILE(.TRUE.)
87 READ(61,'(a)')STRING
88 c --> see if we have the new format for the weights
89- IF ( INDEX(STRING,"<weightgroup type='scale_variation'").ne.0
90+ IF ( (INDEX(STRING,"<weightgroup type='scale_variation'").ne.0
91+ $ .or.INDEX(STRING,"<weightgroup name='scale_variation'").ne.0)
92 $ .and.STRING(1:1).ne.'#') then
93 DO WHILE (.TRUE.)
94 READ(61,'(a)') STRING
95@@ -282,7 +283,8 @@
96 write (*,*) 'ERROR #1 in UPINIT:',numscales
97 stop
98 endif
99- ELSEIF( INDEX(STRING,"<weightgroup type='PDF_variation'").ne.0
100+ ELSEIF( (INDEX(STRING,"<weightgroup type='PDF_variation'").ne.0
101+ $ .or.INDEX(STRING,"<weightgroup name='PDF_variation'").ne.0)
102 $ .and.STRING(1:1).ne.'#') then
103 DO WHILE (.TRUE.)
104 READ(61,'(a)') STRING
105@@ -295,7 +297,8 @@
106 ENDDO
107 nwgt=nwgt+numPDFpairs
108 numPDFpairs=numPDFpairs/2
109- ELSEIF( INDEX(STRING,"<weightgroup type='mg_reweighting'").ne.0
110+ ELSEIF( (INDEX(STRING,"<weightgroup type='mg_reweighting'").ne.0
111+ $ .or.INDEX(STRING,"<weightgroup name='mg_reweighting'").ne.0)
112 $ .and.STRING(1:1).ne.'#') then
113 DO WHILE (.TRUE.)
114 READ(61,'(a)') STRING
115
116=== modified file 'Template/NLO/SubProcesses/handling_lhe_events.f'
117--- Template/NLO/SubProcesses/handling_lhe_events.f 2015-03-03 10:11:02 +0000
118+++ Template/NLO/SubProcesses/handling_lhe_events.f 2016-02-29 12:18:43 +0000
119@@ -193,7 +193,7 @@
120 stop
121 endif
122 write(ifile,'(a)') " <weightgroup "/
123- & /"type='scale_variation' combine='envelope'>"
124+ & /"name='scale_variation' combine='envelope'>"
125 write(ifile,602) " <weight id='1001'>"/
126 $ /" muR=",1d0," muF=",1d0," </weight>"
127 write(ifile,602) " <weight id='1002'>"/
128@@ -217,10 +217,10 @@
129 if (numPDFpairs.ne.0) then
130 if (pdf_set_min.lt.90000) then ! MSTW & CTEQ
131 write(ifile,'(a)') " <weightgroup "/
132- & /"type='PDF_variation' combine='hessian'>"
133+ & /"name='PDF_variation' combine='hessian'>"
134 else ! NNPDF
135 write(ifile,'(a)') " <weightgroup "/
136- & /"type='PDF_variation' combine='gaussian'>"
137+ & /"name='PDF_variation' combine='gaussian'>"
138 endif
139 do i=1,numPDFpairs*2
140 idwgt=2000+i
141
142=== modified file 'madgraph/interface/common_run_interface.py'
143--- madgraph/interface/common_run_interface.py 2016-02-21 00:08:42 +0000
144+++ madgraph/interface/common_run_interface.py 2016-02-29 12:18:43 +0000
145@@ -1047,7 +1047,7 @@
146
147 self.to_store.append('event')
148 if not '-from_cards' in line:
149- self.keep_cards(['reweight_card.dat'])
150+ self.keep_cards(['reweight_card.dat'], ignore=['*'])
151 self.ask_edit_cards(['reweight_card.dat'], 'fixed', plot=False)
152
153 # forbid this function to create an empty item in results.
154@@ -1741,15 +1741,19 @@
155
156 cards_path = pjoin(self.me_dir,'Cards')
157 for card in check_card:
158- if card in ignore:
159+ if card in ignore or (ignore == ['*'] and card not in need_card) :
160 continue
161 if card not in need_card:
162 if os.path.exists(pjoin(cards_path, card)):
163- os.remove(pjoin(cards_path, card))
164+ files.mv(pjoin(cards_path, card), pjoin(cards_path, '.%s' % card))
165+ #os.remove(pjoin(cards_path, card))
166 else:
167 if not os.path.exists(pjoin(cards_path, card)):
168- default = card.replace('.dat', '_default.dat')
169- files.cp(pjoin(cards_path, default),pjoin(cards_path, card))
170+ if os.path.exists(pjoin(cards_path, '.%s' % card)):
171+ files.mv(pjoin(cards_path, '.%s' % card), pjoin(cards_path, card))
172+ else:
173+ default = card.replace('.dat', '_default.dat')
174+ files.cp(pjoin(cards_path, default),pjoin(cards_path, card))
175
176 ############################################################################
177 def set_configuration(self, config_path=None, final=True, initdir=None, amcatnlo=False):
178@@ -1906,7 +1910,7 @@
179
180 self.update_status('Running MadSpin', level='madspin')
181 if not '-from_cards' in line:
182- self.keep_cards(['madspin_card.dat'])
183+ self.keep_cards(['madspin_card.dat'], ignore=['*'])
184 self.ask_edit_cards(['madspin_card.dat'], 'fixed', plot=False)
185 self.help_decay_events(skip_syntax=True)
186
187
188=== modified file 'madgraph/interface/reweight_interface.py'
189--- madgraph/interface/reweight_interface.py 2016-01-12 14:46:58 +0000
190+++ madgraph/interface/reweight_interface.py 2016-02-29 12:18:43 +0000
191@@ -405,7 +405,7 @@
192 # Find new tag in the banner and add information if needed
193 if 'initrwgt' in self.banner:
194 if 'type=\'mg_reweighting\'' in self.banner['initrwgt']:
195- blockpat = re.compile(r'''<weightgroup type=\'mg_reweighting\'\s*>(?P<text>.*?)</weightgroup>''', re.I+re.M+re.S)
196+ blockpat = re.compile(r'''<weightgroup (?:type|name)=\'mg_reweighting\'\s*>(?P<text>.*?)</weightgroup>''', re.I+re.M+re.S)
197 before, content, after = blockpat.split(self.banner['initrwgt'])
198 header_rwgt_other = before + after
199 pattern = re.compile('<weight id=\'mg_reweight_(?P<id>\d+)\'>(?P<info>[^<]*)</weight>', re.S+re.I+re.M)
200@@ -459,7 +459,7 @@
201
202 # re-create the banner.
203 self.banner['initrwgt'] = header_rwgt_other
204- self.banner['initrwgt'] += '\n<weightgroup type=\'mg_reweighting\'>\n'
205+ self.banner['initrwgt'] += '\n<weightgroup name=\'mg_reweighting\' combine=off>\n'
206 for tag, diff in mg_rwgt_info:
207 self.banner['initrwgt'] += '<weight id=\'mg_reweight_%s\'>%s</weight>\n' % \
208 (tag, diff)
209
210=== modified file 'tests/input_files/madspin_event.lhe'
211--- tests/input_files/madspin_event.lhe 2013-12-10 13:43:28 +0000
212+++ tests/input_files/madspin_event.lhe 2016-02-29 12:18:43 +0000
213@@ -290,7 +290,7 @@
214 21 0.750000E+00
215 </MonteCarloMasses>
216 <initrwgt>
217- <weightgroup type='scale_variation' combine='envelope'>
218+ <weightgroup name='scale_variation' combine='envelope'>
219 <weight id='1001'> muR=0.10000E+01 muF=0.10000E+01 </weight>
220 <weight id='1002'> muR=0.10000E+01 muF=0.20000E+01 </weight>
221 <weight id='1003'> muR=0.10000E+01 muF=0.50000E+00 </weight>

Subscribers

People subscribed via source and target branches

to all changes: