Merge lp:~maddevelopers/mg5amcnlo/virtual_polyfit_EW into lp:~maddevelopers/mg5amcnlo/3.0.2
- virtual_polyfit_EW
- Merge into 3.0.2
Proposed by
Rikkert Frederix
Status: | Merged |
---|---|
Merged at revision: | 973 |
Proposed branch: | lp:~maddevelopers/mg5amcnlo/virtual_polyfit_EW |
Merge into: | lp:~maddevelopers/mg5amcnlo/3.0.2 |
Diff against target: |
1828 lines (+1113/-345) 15 files modified
Template/NLO/Cards/FKS_params.dat (+10/-6) Template/NLO/SubProcesses/BinothLHA.f (+1/-2) Template/NLO/SubProcesses/BinothLHA_OLP.f (+1/-1) Template/NLO/SubProcesses/FKSParamReader.f (+0/-252) Template/NLO/SubProcesses/FKSParams.f90 (+248/-0) Template/NLO/SubProcesses/FKSParams.inc (+0/-31) Template/NLO/SubProcesses/check_poles.f (+1/-1) Template/NLO/SubProcesses/driver_mintFO.f (+1/-3) Template/NLO/SubProcesses/driver_mintMC.f (+1/-3) Template/NLO/SubProcesses/fks_singular.f (+31/-12) Template/NLO/SubProcesses/makefile_fks_dir (+3/-3) Template/NLO/SubProcesses/mint_module.f90 (+58/-20) Template/NLO/SubProcesses/polfit.f (+720/-0) madgraph/interface/amcatnlo_run_interface.py (+27/-2) madgraph/iolibs/export_fks.py (+11/-9) |
To merge this branch: | bzr merge lp:~maddevelopers/mg5amcnlo/virtual_polyfit_EW |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
marco zaro | Approve | ||
Review via email: mp+372681@code.launchpad.net |
Commit message
Description of the change
Replaced the grids to determine the approximate virtual by a polynomial fit using the polfit.f code (by Shampine, Davenport and Huddleston). It's still based on doing this one dimension at a time, but the polynomial fit is smoother than the grids, since the latter required rather coarse binning and had fixed bins which could not be adjusted to follow the importance sampling.
Also needed to replace the FKSParamReader with a fortran90 module to be able to use it correctly in the mint_module.f90
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'Template/NLO/Cards/FKS_params.dat' | |||
2 | --- Template/NLO/Cards/FKS_params.dat 2017-08-04 19:52:15 +0000 | |||
3 | +++ Template/NLO/Cards/FKS_params.dat 2019-09-12 11:14:33 +0000 | |||
4 | @@ -153,6 +153,16 @@ | |||
5 | 153 | 0.005d0 | 153 | 0.005d0 |
6 | 154 | ! Default :: 0.005d0 | 154 | ! Default :: 0.005d0 |
7 | 155 | ! | 155 | ! |
8 | 156 | ! Use a polynomial fit for the virtual corrections. Gets a better accuracy, | ||
9 | 157 | ! but uses more memmory and disk space. | ||
10 | 158 | #UsePolyVirtual | ||
11 | 159 | .True. | ||
12 | 160 | ! Default :: .True. | ||
13 | 161 | ! | ||
14 | 162 | ! ========================================================================== | ||
15 | 163 | ! Combination of matrix elements | ||
16 | 164 | ! ========================================================================== | ||
17 | 165 | ! | ||
18 | 156 | ! For fixed order calculations only (ignored for (N)LO+PS runs): This | 166 | ! For fixed order calculations only (ignored for (N)LO+PS runs): This |
19 | 157 | ! parameter determines if parton flavour configurations with idential | 167 | ! parameter determines if parton flavour configurations with idential |
20 | 158 | ! matrix elements should be separated at the level of the analysis or | 168 | ! matrix elements should be separated at the level of the analysis or |
21 | @@ -170,11 +180,5 @@ | |||
22 | 170 | ! Default :: .false. | 180 | ! Default :: .false. |
23 | 171 | ! | 181 | ! |
24 | 172 | ! ========================================================================== | 182 | ! ========================================================================== |
25 | 173 | ! Arbitrary numerical parameters used in the FKS formalism | ||
26 | 174 | ! ========================================================================== | ||
27 | 175 | ! | ||
28 | 176 | ! To be implemented by the FKS authors | ||
29 | 177 | ! | ||
30 | 178 | ! ========================================================================== | ||
31 | 179 | ! End of FKS_params.dat file | 183 | ! End of FKS_params.dat file |
32 | 180 | ! ========================================================================== | 184 | ! ========================================================================== |
33 | 181 | 185 | ||
34 | === modified file 'Template/NLO/SubProcesses/BinothLHA.f' | |||
35 | --- Template/NLO/SubProcesses/BinothLHA.f 2017-06-23 14:14:03 +0000 | |||
36 | +++ Template/NLO/SubProcesses/BinothLHA.f 2019-09-12 11:14:33 +0000 | |||
37 | @@ -4,12 +4,11 @@ | |||
38 | 4 | c that calls the OLP and returns the virtual weights. For convenience | 4 | c that calls the OLP and returns the virtual weights. For convenience |
39 | 5 | c also the born_wgt is passed to this subroutine. | 5 | c also the born_wgt is passed to this subroutine. |
40 | 6 | c | 6 | c |
41 | 7 | use FKSParams | ||
42 | 7 | implicit none | 8 | implicit none |
43 | 8 | include "nexternal.inc" | 9 | include "nexternal.inc" |
44 | 9 | include "coupl.inc" | 10 | include "coupl.inc" |
45 | 10 | include 'born_nhel.inc' | 11 | include 'born_nhel.inc' |
46 | 11 | c general MadFKS parameters | ||
47 | 12 | include 'FKSParams.inc' | ||
48 | 13 | double precision pi, zero,mone | 12 | double precision pi, zero,mone |
49 | 14 | parameter (pi=3.1415926535897932385d0) | 13 | parameter (pi=3.1415926535897932385d0) |
50 | 15 | parameter (zero=0d0) | 14 | parameter (zero=0d0) |
51 | 16 | 15 | ||
52 | === modified file 'Template/NLO/SubProcesses/BinothLHA_OLP.f' | |||
53 | --- Template/NLO/SubProcesses/BinothLHA_OLP.f 2015-08-13 09:26:37 +0000 | |||
54 | +++ Template/NLO/SubProcesses/BinothLHA_OLP.f 2019-09-12 11:14:33 +0000 | |||
55 | @@ -6,11 +6,11 @@ | |||
56 | 6 | c | 6 | c |
57 | 7 | C************************************************************************ | 7 | C************************************************************************ |
58 | 8 | c | 8 | c |
59 | 9 | use FKSParams | ||
60 | 9 | implicit none | 10 | implicit none |
61 | 10 | include "nexternal.inc" | 11 | include "nexternal.inc" |
62 | 11 | include "coupl.inc" | 12 | include "coupl.inc" |
63 | 12 | include "Binoth_proc.inc" | 13 | include "Binoth_proc.inc" |
64 | 13 | include "FKSParams.inc" | ||
65 | 14 | double precision pi | 14 | double precision pi |
66 | 15 | parameter (pi=3.1415926535897932385d0) | 15 | parameter (pi=3.1415926535897932385d0) |
67 | 16 | double precision pin(0:3,nexternal-1),p(0:4,nexternal-1) | 16 | double precision pin(0:3,nexternal-1),p(0:4,nexternal-1) |
68 | 17 | 17 | ||
69 | === removed file 'Template/NLO/SubProcesses/FKSParamReader.f' | |||
70 | --- Template/NLO/SubProcesses/FKSParamReader.f 2017-09-01 10:34:24 +0000 | |||
71 | +++ Template/NLO/SubProcesses/FKSParamReader.f 1970-01-01 00:00:00 +0000 | |||
72 | @@ -1,252 +0,0 @@ | |||
73 | 1 | subroutine FKSParamReader(filename, printParam, force) | ||
74 | 2 | |||
75 | 3 | implicit none | ||
76 | 4 | |||
77 | 5 | logical HasReadOnce, force | ||
78 | 6 | data HasReadOnce/.FALSE./ | ||
79 | 7 | |||
80 | 8 | |||
81 | 9 | character(*) filename | ||
82 | 10 | CHARACTER*64 buff, buff2, mode | ||
83 | 11 | include "FKSParams.inc" | ||
84 | 12 | include "orders.inc" | ||
85 | 13 | |||
86 | 14 | integer i,j | ||
87 | 15 | |||
88 | 16 | logical printParam, couldRead, paramPrinted | ||
89 | 17 | data paramPrinted/.FALSE./ | ||
90 | 18 | couldRead=.False. | ||
91 | 19 | ! Default parameters | ||
92 | 20 | |||
93 | 21 | if (HasReadOnce.and..not.force) then | ||
94 | 22 | goto 901 | ||
95 | 23 | endif | ||
96 | 24 | |||
97 | 25 | ! Make sure to have default parameters if not set | ||
98 | 26 | ! in the FKSParams.dat card (if it is an old one for instance) | ||
99 | 27 | call DefaultFKSParam() | ||
100 | 28 | |||
101 | 29 | open(68, file=fileName, err=676, action='READ') | ||
102 | 30 | do | ||
103 | 31 | read(68,*,end=999) buff | ||
104 | 32 | if(index(buff,'#').eq.1) then | ||
105 | 33 | |||
106 | 34 | if (buff .eq. '#IRPoleCheckThreshold') then | ||
107 | 35 | read(68,*,end=999) IRPoleCheckThreshold | ||
108 | 36 | if (IRPoleCheckThreshold .lt. -1.01d0 ) then | ||
109 | 37 | stop 'IRPoleCheckThreshold must be >= -1.0d0.' | ||
110 | 38 | endif | ||
111 | 39 | |||
112 | 40 | elseif (buff .eq. '#PrecisionVirtualAtRunTime') then | ||
113 | 41 | read(68,*,end=999) PrecisionVirtualAtRunTime | ||
114 | 42 | if (IRPoleCheckThreshold .lt. -1.01d0 ) then | ||
115 | 43 | stop 'PrecisionVirtualAtRunTime must be >= -1.0d0.' | ||
116 | 44 | endif | ||
117 | 45 | |||
118 | 46 | else if (buff .eq. '#NHelForMCoverHels') then | ||
119 | 47 | read(68,*,end=999) NHelForMCoverHels | ||
120 | 48 | if (NHelForMCoverHels .lt. -1) then | ||
121 | 49 | stop 'NHelForMCoverHels must be >= -1.' | ||
122 | 50 | endif | ||
123 | 51 | else if (buff .eq. '#QCD^2==') then | ||
124 | 52 | read(68,*,end=999) QCD_squared_selected | ||
125 | 53 | if (QCD_squared_selected .lt. -1) then | ||
126 | 54 | stop 'QCD_squared_selected must be >= -1.' | ||
127 | 55 | endif | ||
128 | 56 | else if (buff .eq. '#QED^2==') then | ||
129 | 57 | read(68,*,end=999) QED_squared_selected | ||
130 | 58 | if (QED_squared_selected .lt. -1) then | ||
131 | 59 | stop 'QED_squared_selected must be >= -1.' | ||
132 | 60 | endif | ||
133 | 61 | else if (buff .eq. '#VirtualFraction') then | ||
134 | 62 | read(68,*,end=999) Virt_fraction | ||
135 | 63 | if (Virt_fraction .lt. 0 .or. virt_fraction .gt.1) then | ||
136 | 64 | stop 'VirtualFraction should be a fraction'/ | ||
137 | 65 | $ /' between 0 and 1' | ||
138 | 66 | endif | ||
139 | 67 | else if (buff .eq. '#MinVirtualFraction') then | ||
140 | 68 | read(68,*,end=999) Min_Virt_fraction | ||
141 | 69 | if (min_virt_fraction .lt. 0 .or. min_virt_fraction .gt.1) | ||
142 | 70 | $ then | ||
143 | 71 | stop 'VirtualFraction should be a fraction'/ | ||
144 | 72 | $ /' between 0 and 1' | ||
145 | 73 | endif | ||
146 | 74 | else if (buff .eq. '#SeparateFlavourConfigurations') then | ||
147 | 75 | read(68,*,end=999) separate_flavour_configs | ||
148 | 76 | |||
149 | 77 | else if (buff .eq. '#VetoedContributionTypes') then | ||
150 | 78 | read(68,*,end=999) VetoedContributionTypes(0) | ||
151 | 79 | if (VetoedContributionTypes(0) .lt. 0.or. | ||
152 | 80 | & VetoedContributionTypes(0) .gt. maxContribsSelected) then | ||
153 | 81 | write(*,*) 'VetoedContributionTypes length should be '/ | ||
154 | 82 | & /'>= 0 and <=',maxContribsSelected | ||
155 | 83 | stop 'Format error in FKS_params.dat.' | ||
156 | 84 | endif | ||
157 | 85 | read(68,*,end=999) (VetoedContributionTypes(I),I=1, | ||
158 | 86 | $ VetoedContributionTypes(0)) | ||
159 | 87 | do I=1,VetoedContributionTypes(0) | ||
160 | 88 | if (VetoedContributionTypes(I).lt.1.or. | ||
161 | 89 | $ VetoedContributionTypes(I).gt.maxContribType) then | ||
162 | 90 | write(*,*) 'VetoedContributionTypes must be >=1 and '/ | ||
163 | 91 | & /'<=',maxContribType | ||
164 | 92 | stop 'Format error in FKS_params.dat.' | ||
165 | 93 | endif | ||
166 | 94 | enddo | ||
167 | 95 | do I=VetoedContributionTypes(0)+1,maxContribsSelected | ||
168 | 96 | VetoedContributionTypes(I)=-1 | ||
169 | 97 | enddo | ||
170 | 98 | |||
171 | 99 | else if (buff .eq. '#SelectedContributionTypes') then | ||
172 | 100 | read(68,*,end=999) SelectedContributionTypes(0) | ||
173 | 101 | if (SelectedContributionTypes(0) .lt. 0 .or. | ||
174 | 102 | & SelectedContributionTypes(0) .gt. maxContribsSelected) then | ||
175 | 103 | write(*,*) 'SelectedContributionTypes length should be '/ | ||
176 | 104 | & /'>= 0 and <=',maxContribsSelected | ||
177 | 105 | stop 'Format error in FKS_params.dat.' | ||
178 | 106 | endif | ||
179 | 107 | read(68,*,end=999) (SelectedContributionTypes(I),I=1, | ||
180 | 108 | $ SelectedContributionTypes(0)) | ||
181 | 109 | do I=1,SelectedContributionTypes(0) | ||
182 | 110 | if (SelectedContributionTypes(I).lt.1.or. | ||
183 | 111 | $ SelectedContributionTypes(I).gt.maxContribType) then | ||
184 | 112 | write(*,*) 'SelectedContributionTypes must be >=1 and '/ | ||
185 | 113 | & /'<=',maxContribType | ||
186 | 114 | stop 'Format error in FKS_params.dat.' | ||
187 | 115 | endif | ||
188 | 116 | enddo | ||
189 | 117 | do I=SelectedContributionTypes(0)+1,maxContribsSelected | ||
190 | 118 | SelectedContributionTypes(I)=-1 | ||
191 | 119 | enddo | ||
192 | 120 | |||
193 | 121 | else if (buff .eq. '#SelectedCouplingOrders') then | ||
194 | 122 | read(68,*,end=999) SelectedCouplingOrders(1,0) | ||
195 | 123 | if (SelectedCouplingOrders(1,0) .lt. 0 .or. | ||
196 | 124 | & SelectedCouplingOrders(1,0) .gt. maxCouplingsSelected) then | ||
197 | 125 | write(*,*) 'SelectedCouplingOrders length should be >='/ | ||
198 | 126 | & /' 0 and <=',maxCouplingsSelected | ||
199 | 127 | stop 'Format error in FKS_params.dat.' | ||
200 | 128 | endif | ||
201 | 129 | do j = 2, maxCouplingTypes | ||
202 | 130 | SelectedCouplingOrders(j,0) = SelectedCouplingOrders(1,0) | ||
203 | 131 | enddo | ||
204 | 132 | do j = 1, SelectedCouplingOrders(1,0) | ||
205 | 133 | read(68,*,end=999) (SelectedCouplingOrders(i,j),i=1, | ||
206 | 134 | $ nsplitorders) | ||
207 | 135 | do i=nsplitorders+1,maxCouplingTypes | ||
208 | 136 | SelectedCouplingOrders(i,j)=-1 | ||
209 | 137 | enddo | ||
210 | 138 | enddo | ||
211 | 139 | |||
212 | 140 | else | ||
213 | 141 | write(*,*) 'The parameter name ',buff(2:), | ||
214 | 142 | &' is not reckognized.' | ||
215 | 143 | stop 'Format error in FKS_params.dat.' | ||
216 | 144 | endif | ||
217 | 145 | endif | ||
218 | 146 | enddo | ||
219 | 147 | 999 continue | ||
220 | 148 | couldRead=.True. | ||
221 | 149 | goto 998 | ||
222 | 150 | |||
223 | 151 | 676 continue | ||
224 | 152 | write(*,*) 'ERROR :: MadFKS parameter file ',fileName, | ||
225 | 153 | &' could not be found or is malformed. Please specify it.' | ||
226 | 154 | stop | ||
227 | 155 | C Below is the code if one desires to let the code continue with | ||
228 | 156 | C a non existing or malformed parameter file | ||
229 | 157 | write(*,*) 'WARNING :: The file ',fileName,' could not be ', | ||
230 | 158 | & ' open or did not contain the necessary information. The ', | ||
231 | 159 | & ' default MadFKS parameters will be used.' | ||
232 | 160 | call DefaultFKSParam() | ||
233 | 161 | goto 998 | ||
234 | 162 | |||
235 | 163 | 998 continue | ||
236 | 164 | |||
237 | 165 | if(printParam.and..not.paramPrinted) then | ||
238 | 166 | write(*,*) | ||
239 | 167 | & '===============================================================' | ||
240 | 168 | if (couldRead) then | ||
241 | 169 | write(*,*) 'INFO: MadFKS read these parameters from ' | ||
242 | 170 | &,filename | ||
243 | 171 | else | ||
244 | 172 | write(*,*) 'INFO: MadFKS used the default parameters.' | ||
245 | 173 | endif | ||
246 | 174 | write(*,*) | ||
247 | 175 | & '===============================================================' | ||
248 | 176 | write(*,*) ' > IRPoleCheckThreshold = ',IRPoleCheckThreshold | ||
249 | 177 | write(*,*) ' > PrecisionVirtualAtRunTime = ' | ||
250 | 178 | $ ,PrecisionVirtualAtRunTime | ||
251 | 179 | if (SelectedContributionTypes(0).gt.0) then | ||
252 | 180 | write(*,*) ' > SelectedContributionTypes = ', | ||
253 | 181 | & (SelectedContributionTypes(I),I=1,SelectedContributionTypes(0)) | ||
254 | 182 | else | ||
255 | 183 | write(*,*) ' > SelectedContributionTypes = All' | ||
256 | 184 | endif | ||
257 | 185 | if (VetoedContributionTypes(0).gt.0) then | ||
258 | 186 | write(*,*) ' > VetoedContributionTypes = ', | ||
259 | 187 | & (VetoedContributionTypes(I),I=1,VetoedContributionTypes(0)) | ||
260 | 188 | else | ||
261 | 189 | write(*,*) ' > VetoedContributionTypes = None' | ||
262 | 190 | endif | ||
263 | 191 | if (QCD_squared_selected.eq.-1) then | ||
264 | 192 | write(*,*) ' > QCD_squared_selected = All' | ||
265 | 193 | else | ||
266 | 194 | write(*,*) ' > QCD_squared_selected = ',QCD_squared_selected | ||
267 | 195 | endif | ||
268 | 196 | if (QED_squared_selected.eq.-1) then | ||
269 | 197 | write(*,*) ' > QED_squared_selected = All' | ||
270 | 198 | else | ||
271 | 199 | write(*,*) ' > QED_squared_selected = ',QED_squared_selected | ||
272 | 200 | endif | ||
273 | 201 | if (SelectedCouplingOrders(1,0).gt.0) then | ||
274 | 202 | do j=1,SelectedCouplingOrders(1,0) | ||
275 | 203 | write(*,*) ' > SelectedCouplingOrders(',j,') = ', | ||
276 | 204 | & (SelectedCouplingOrders(i,j),i=1,nsplitorders) | ||
277 | 205 | enddo | ||
278 | 206 | else | ||
279 | 207 | write(*,*) ' > SelectedCouplingOrders = All' | ||
280 | 208 | endif | ||
281 | 209 | write(*,*) ' > NHelForMCoverHels = ',NHelForMCoverHels | ||
282 | 210 | write(*,*) ' > VirtualFraction = ',Virt_fraction | ||
283 | 211 | write(*,*) ' > MinVirtualFraction = ',Min_virt_fraction | ||
284 | 212 | write(*,*) ' > SeparateFlavourConfigs = ',separate_flavour_configs | ||
285 | 213 | write(*,*) | ||
286 | 214 | & '===============================================================' | ||
287 | 215 | paramPrinted=.TRUE. | ||
288 | 216 | endif | ||
289 | 217 | |||
290 | 218 | close(68) | ||
291 | 219 | HasReadOnce=.TRUE. | ||
292 | 220 | 901 continue | ||
293 | 221 | end | ||
294 | 222 | |||
295 | 223 | subroutine DefaultFKSParam() | ||
296 | 224 | |||
297 | 225 | implicit none | ||
298 | 226 | integer i,j | ||
299 | 227 | include "FKSParams.inc" | ||
300 | 228 | |||
301 | 229 | IRPoleCheckThreshold=1.0d-5 | ||
302 | 230 | NHelForMCoverHels=5 | ||
303 | 231 | PrecisionVirtualAtRunTime=1d-3 | ||
304 | 232 | Virt_fraction=1d0 | ||
305 | 233 | QED_squared_selected=-1 | ||
306 | 234 | QCD_squared_selected=-1 | ||
307 | 235 | Min_virt_fraction=0.005d0 | ||
308 | 236 | separate_flavour_configs=.false. | ||
309 | 237 | IncludeBornContributions=.true. | ||
310 | 238 | SelectedContributionTypes(0)=0 | ||
311 | 239 | VetoedContributionTypes(0)=0 | ||
312 | 240 | do i=1, maxContribsSelected | ||
313 | 241 | SelectedContributionTypes(I)=-1 | ||
314 | 242 | VetoedContributionTypes(I)=-1 | ||
315 | 243 | enddo | ||
316 | 244 | do j=1,maxCouplingTypes | ||
317 | 245 | SelectedCouplingOrders(j,0) = 0 | ||
318 | 246 | enddo | ||
319 | 247 | do j=1,maxCouplingsSelected | ||
320 | 248 | do i=1,maxCouplingTypes | ||
321 | 249 | SelectedCouplingOrders(i,j) = -1 | ||
322 | 250 | enddo | ||
323 | 251 | enddo | ||
324 | 252 | end | ||
325 | 253 | 0 | ||
326 | === added file 'Template/NLO/SubProcesses/FKSParams.f90' | |||
327 | --- Template/NLO/SubProcesses/FKSParams.f90 1970-01-01 00:00:00 +0000 | |||
328 | +++ Template/NLO/SubProcesses/FKSParams.f90 2019-09-12 11:14:33 +0000 | |||
329 | @@ -0,0 +1,248 @@ | |||
330 | 1 | !==================================================================== | ||
331 | 2 | ! | ||
332 | 3 | ! Define common block with all general parameters used by MadFKS | ||
333 | 4 | ! See their definitions in the file FKS_params.dat. | ||
334 | 5 | ! | ||
335 | 6 | !==================================================================== | ||
336 | 7 | module FKSParams | ||
337 | 8 | character(len=64), parameter :: paramFileName='FKS_params.dat' | ||
338 | 9 | integer,parameter :: maxContribsSelected=100, & | ||
339 | 10 | maxCouplingsSelected=100, & | ||
340 | 11 | maxContribType=15, & | ||
341 | 12 | maxCouplingTypes=20 | ||
342 | 13 | real*8 :: IRPoleCheckThreshold,Virt_fraction, PrecisionVirtualAtRunTime,Min_virt_fraction | ||
343 | 14 | integer :: NHelForMCoverHels,VetoedContributionTypes(0:maxContribsSelected), & | ||
344 | 15 | SelectedContributionTypes(0:maxContribsSelected),QED_squared_selected, & | ||
345 | 16 | SelectedCouplingOrders(maxCouplingTypes,0:maxCouplingsSelected), & | ||
346 | 17 | QCD_squared_selected | ||
347 | 18 | logical :: separate_flavour_configs,IncludeBornContributions,use_poly_virtual | ||
348 | 19 | |||
349 | 20 | contains | ||
350 | 21 | |||
351 | 22 | subroutine FKSParamReader(filename, printParam, force) | ||
352 | 23 | ! Reads the file 'filename' and sets the parameters found in that file. | ||
353 | 24 | implicit none | ||
354 | 25 | logical, save :: HasReadOnce=.False.,paramPrinted=.false. | ||
355 | 26 | logical :: force,couldRead,printParam | ||
356 | 27 | character(*) :: filename | ||
357 | 28 | CHARACTER(len=64) :: buff, buff2, mode | ||
358 | 29 | include "orders.inc" | ||
359 | 30 | integer :: i,j | ||
360 | 31 | couldRead=.False. | ||
361 | 32 | if (HasReadOnce.and..not.force) then | ||
362 | 33 | goto 901 | ||
363 | 34 | endif | ||
364 | 35 | ! Make sure to have default parameters if not set in the FKSParams.dat card | ||
365 | 36 | ! (if it is an old one for instance) | ||
366 | 37 | call DefaultFKSParam() | ||
367 | 38 | ! Overwrite the default parameters from file: | ||
368 | 39 | open(68, file=fileName, err=676, action='READ') | ||
369 | 40 | do | ||
370 | 41 | read(68,*,end=999) buff | ||
371 | 42 | if(index(buff,'#').eq.1) then | ||
372 | 43 | if (buff .eq. '#IRPoleCheckThreshold') then | ||
373 | 44 | read(68,*,end=999) IRPoleCheckThreshold | ||
374 | 45 | if (IRPoleCheckThreshold .lt. -1.01d0 ) then | ||
375 | 46 | stop 'IRPoleCheckThreshold must be >= -1.0d0.' | ||
376 | 47 | endif | ||
377 | 48 | elseif (buff .eq. '#PrecisionVirtualAtRunTime') then | ||
378 | 49 | read(68,*,end=999) PrecisionVirtualAtRunTime | ||
379 | 50 | if (IRPoleCheckThreshold .lt. -1.01d0 ) then | ||
380 | 51 | stop 'PrecisionVirtualAtRunTime must be >= -1.0d0.' | ||
381 | 52 | endif | ||
382 | 53 | else if (buff .eq. '#NHelForMCoverHels') then | ||
383 | 54 | read(68,*,end=999) NHelForMCoverHels | ||
384 | 55 | if (NHelForMCoverHels .lt. -1) then | ||
385 | 56 | stop 'NHelForMCoverHels must be >= -1.' | ||
386 | 57 | endif | ||
387 | 58 | else if (buff .eq. '#QCD^2==') then | ||
388 | 59 | read(68,*,end=999) QCD_squared_selected | ||
389 | 60 | if (QCD_squared_selected .lt. -1) then | ||
390 | 61 | stop 'QCD_squared_selected must be >= -1.' | ||
391 | 62 | endif | ||
392 | 63 | else if (buff .eq. '#QED^2==') then | ||
393 | 64 | read(68,*,end=999) QED_squared_selected | ||
394 | 65 | if (QED_squared_selected .lt. -1) then | ||
395 | 66 | stop 'QED_squared_selected must be >= -1.' | ||
396 | 67 | endif | ||
397 | 68 | else if (buff .eq. '#VirtualFraction') then | ||
398 | 69 | read(68,*,end=999) Virt_fraction | ||
399 | 70 | if (Virt_fraction .lt. 0 .or. virt_fraction .gt.1) then | ||
400 | 71 | stop 'VirtualFraction should be a fraction between 0 and 1' | ||
401 | 72 | endif | ||
402 | 73 | else if (buff .eq. '#MinVirtualFraction') then | ||
403 | 74 | read(68,*,end=999) Min_Virt_fraction | ||
404 | 75 | if (min_virt_fraction .lt. 0 .or. min_virt_fraction .gt.1) then | ||
405 | 76 | stop 'VirtualFraction should be a fraction between 0 and 1' | ||
406 | 77 | endif | ||
407 | 78 | else if (buff .eq. '#SeparateFlavourConfigurations') then | ||
408 | 79 | read(68,*,end=999) separate_flavour_configs | ||
409 | 80 | else if (buff .eq. '#UsePolyVirtual') then | ||
410 | 81 | read(68,*,end=999) use_poly_virtual | ||
411 | 82 | else if (buff .eq. '#VetoedContributionTypes') then | ||
412 | 83 | read(68,*,end=999) VetoedContributionTypes(0) | ||
413 | 84 | if (VetoedContributionTypes(0) .lt. 0.or. & | ||
414 | 85 | VetoedContributionTypes(0) .gt. maxContribsSelected) then | ||
415 | 86 | write(*,*) 'VetoedContributionTypes length should be >= 0 and <=', & | ||
416 | 87 | maxContribsSelected | ||
417 | 88 | stop 'Format error in FKS_params.dat.' | ||
418 | 89 | endif | ||
419 | 90 | read(68,*,end=999) (VetoedContributionTypes(I),I=1,VetoedContributionTypes(0)) | ||
420 | 91 | do I=1,VetoedContributionTypes(0) | ||
421 | 92 | if (VetoedContributionTypes(I).lt.1.or. & | ||
422 | 93 | VetoedContributionTypes(I).gt.maxContribType) then | ||
423 | 94 | write(*,*) 'VetoedContributionTypes must be >=1 and <=',maxContribType | ||
424 | 95 | stop 'Format error in FKS_params.dat.' | ||
425 | 96 | endif | ||
426 | 97 | enddo | ||
427 | 98 | do I=VetoedContributionTypes(0)+1,maxContribsSelected | ||
428 | 99 | VetoedContributionTypes(I)=-1 | ||
429 | 100 | enddo | ||
430 | 101 | |||
431 | 102 | else if (buff .eq. '#SelectedContributionTypes') then | ||
432 | 103 | read(68,*,end=999) SelectedContributionTypes(0) | ||
433 | 104 | if (SelectedContributionTypes(0) .lt. 0 .or. & | ||
434 | 105 | SelectedContributionTypes(0) .gt. maxContribsSelected) then | ||
435 | 106 | write(*,*) 'SelectedContributionTypes length should be >= 0 and <=', & | ||
436 | 107 | maxContribsSelected | ||
437 | 108 | stop 'Format error in FKS_params.dat.' | ||
438 | 109 | endif | ||
439 | 110 | read(68,*,end=999) (SelectedContributionTypes(I),I=1,SelectedContributionTypes(0)) | ||
440 | 111 | do I=1,SelectedContributionTypes(0) | ||
441 | 112 | if (SelectedContributionTypes(I).lt.1.or. & | ||
442 | 113 | SelectedContributionTypes(I).gt.maxContribType) then | ||
443 | 114 | write(*,*) 'SelectedContributionTypes must be >=1 and <=',maxContribType | ||
444 | 115 | stop 'Format error in FKS_params.dat.' | ||
445 | 116 | endif | ||
446 | 117 | enddo | ||
447 | 118 | do I=SelectedContributionTypes(0)+1,maxContribsSelected | ||
448 | 119 | SelectedContributionTypes(I)=-1 | ||
449 | 120 | enddo | ||
450 | 121 | else if (buff .eq. '#SelectedCouplingOrders') then | ||
451 | 122 | read(68,*,end=999) SelectedCouplingOrders(1,0) | ||
452 | 123 | if (SelectedCouplingOrders(1,0) .lt. 0 .or. & | ||
453 | 124 | SelectedCouplingOrders(1,0) .gt. maxCouplingsSelected) then | ||
454 | 125 | write(*,*) 'SelectedCouplingOrders length should be >= 0 and <=', & | ||
455 | 126 | maxCouplingsSelected | ||
456 | 127 | stop 'Format error in FKS_params.dat.' | ||
457 | 128 | endif | ||
458 | 129 | do j = 2, maxCouplingTypes | ||
459 | 130 | SelectedCouplingOrders(j,0) = SelectedCouplingOrders(1,0) | ||
460 | 131 | enddo | ||
461 | 132 | do j = 1, SelectedCouplingOrders(1,0) | ||
462 | 133 | read(68,*,end=999) (SelectedCouplingOrders(i,j),i=1,nsplitorders) | ||
463 | 134 | do i=nsplitorders+1,maxCouplingTypes | ||
464 | 135 | SelectedCouplingOrders(i,j)=-1 | ||
465 | 136 | enddo | ||
466 | 137 | enddo | ||
467 | 138 | else | ||
468 | 139 | write(*,*) 'The parameter name ',buff(2:),'is not reckognized.' | ||
469 | 140 | stop 'Format error in FKS_params.dat.' | ||
470 | 141 | endif | ||
471 | 142 | endif | ||
472 | 143 | enddo | ||
473 | 144 | 999 continue | ||
474 | 145 | couldRead=.True. | ||
475 | 146 | goto 998 | ||
476 | 147 | |||
477 | 148 | 676 continue | ||
478 | 149 | write(*,*) 'ERROR :: MadFKS parameter file ',fileName, & | ||
479 | 150 | ' could not be found or is malformed. Please specify it.' | ||
480 | 151 | stop | ||
481 | 152 | ! Below is the code if one desires to let the code continue with | ||
482 | 153 | ! a non existing or malformed parameter file | ||
483 | 154 | write(*,*) 'WARNING :: The file ',fileName,' could not be ', & | ||
484 | 155 | ' open or did not contain the necessary information. The ', & | ||
485 | 156 | ' default MadFKS parameters will be used.' | ||
486 | 157 | call DefaultFKSParam() | ||
487 | 158 | goto 998 | ||
488 | 159 | 998 continue | ||
489 | 160 | |||
490 | 161 | if(printParam.and..not.paramPrinted) then | ||
491 | 162 | write(*,*) & | ||
492 | 163 | '===============================================================' | ||
493 | 164 | if (couldRead) then | ||
494 | 165 | write(*,*) 'INFO: MadFKS read these parameters from ',filename | ||
495 | 166 | else | ||
496 | 167 | write(*,*) 'INFO: MadFKS used the default parameters.' | ||
497 | 168 | endif | ||
498 | 169 | write(*,*) & | ||
499 | 170 | '===============================================================' | ||
500 | 171 | write(*,*) ' > IRPoleCheckThreshold = ',IRPoleCheckThreshold | ||
501 | 172 | write(*,*) ' > PrecisionVirtualAtRunTime = ',PrecisionVirtualAtRunTime | ||
502 | 173 | if (SelectedContributionTypes(0).gt.0) then | ||
503 | 174 | write(*,*) ' > SelectedContributionTypes = ', & | ||
504 | 175 | (SelectedContributionTypes(I),I=1,SelectedContributionTypes(0)) | ||
505 | 176 | else | ||
506 | 177 | write(*,*) ' > SelectedContributionTypes = All' | ||
507 | 178 | endif | ||
508 | 179 | if (VetoedContributionTypes(0).gt.0) then | ||
509 | 180 | write(*,*) ' > VetoedContributionTypes = ', & | ||
510 | 181 | (VetoedContributionTypes(I),I=1,VetoedContributionTypes(0)) | ||
511 | 182 | else | ||
512 | 183 | write(*,*) ' > VetoedContributionTypes = None' | ||
513 | 184 | endif | ||
514 | 185 | if (QCD_squared_selected.eq.-1) then | ||
515 | 186 | write(*,*) ' > QCD_squared_selected = All' | ||
516 | 187 | else | ||
517 | 188 | write(*,*) ' > QCD_squared_selected = ',QCD_squared_selected | ||
518 | 189 | endif | ||
519 | 190 | if (QED_squared_selected.eq.-1) then | ||
520 | 191 | write(*,*) ' > QED_squared_selected = All' | ||
521 | 192 | else | ||
522 | 193 | write(*,*) ' > QED_squared_selected = ',QED_squared_selected | ||
523 | 194 | endif | ||
524 | 195 | if (SelectedCouplingOrders(1,0).gt.0) then | ||
525 | 196 | do j=1,SelectedCouplingOrders(1,0) | ||
526 | 197 | write(*,*) ' > SelectedCouplingOrders(',j,') = ', & | ||
527 | 198 | (SelectedCouplingOrders(i,j),i=1,nsplitorders) | ||
528 | 199 | enddo | ||
529 | 200 | else | ||
530 | 201 | write(*,*) ' > SelectedCouplingOrders = All' | ||
531 | 202 | endif | ||
532 | 203 | write(*,*) ' > NHelForMCoverHels = ',NHelForMCoverHels | ||
533 | 204 | write(*,*) ' > VirtualFraction = ',Virt_fraction | ||
534 | 205 | write(*,*) ' > MinVirtualFraction = ',Min_virt_fraction | ||
535 | 206 | write(*,*) ' > SeparateFlavourConfigs = ',separate_flavour_configs | ||
536 | 207 | write(*,*) ' > UsePolyVirtual = ',use_poly_virtual | ||
537 | 208 | write(*,*) & | ||
538 | 209 | '===============================================================' | ||
539 | 210 | paramPrinted=.TRUE. | ||
540 | 211 | endif | ||
541 | 212 | |||
542 | 213 | close(68) | ||
543 | 214 | HasReadOnce=.TRUE. | ||
544 | 215 | 901 continue | ||
545 | 216 | end subroutine FKSParamReader | ||
546 | 217 | |||
547 | 218 | subroutine DefaultFKSParam() | ||
548 | 219 | ! Sets the default parameters | ||
549 | 220 | implicit none | ||
550 | 221 | integer i,j | ||
551 | 222 | IRPoleCheckThreshold=1.0d-5 | ||
552 | 223 | NHelForMCoverHels=5 | ||
553 | 224 | PrecisionVirtualAtRunTime=1d-3 | ||
554 | 225 | Virt_fraction=1d0 | ||
555 | 226 | QED_squared_selected=-1 | ||
556 | 227 | QCD_squared_selected=-1 | ||
557 | 228 | Min_virt_fraction=0.005d0 | ||
558 | 229 | separate_flavour_configs=.false. | ||
559 | 230 | use_poly_virtual=.true. | ||
560 | 231 | IncludeBornContributions=.true. | ||
561 | 232 | SelectedContributionTypes(0)=0 | ||
562 | 233 | VetoedContributionTypes(0)=0 | ||
563 | 234 | do i=1, maxContribsSelected | ||
564 | 235 | SelectedContributionTypes(I)=-1 | ||
565 | 236 | VetoedContributionTypes(I)=-1 | ||
566 | 237 | enddo | ||
567 | 238 | do j=1,maxCouplingTypes | ||
568 | 239 | SelectedCouplingOrders(j,0) = 0 | ||
569 | 240 | enddo | ||
570 | 241 | do j=1,maxCouplingsSelected | ||
571 | 242 | do i=1,maxCouplingTypes | ||
572 | 243 | SelectedCouplingOrders(i,j) = -1 | ||
573 | 244 | enddo | ||
574 | 245 | enddo | ||
575 | 246 | end subroutine DefaultFKSParam | ||
576 | 247 | |||
577 | 248 | end module FKSParams | ||
578 | 0 | 249 | ||
579 | === removed file 'Template/NLO/SubProcesses/FKSParams.inc' | |||
580 | --- Template/NLO/SubProcesses/FKSParams.inc 2017-08-04 19:52:15 +0000 | |||
581 | +++ Template/NLO/SubProcesses/FKSParams.inc 1970-01-01 00:00:00 +0000 | |||
582 | @@ -1,31 +0,0 @@ | |||
583 | 1 | !==================================================================== | ||
584 | 2 | ! | ||
585 | 3 | ! Define common block with all general parameters used by MadFKS | ||
586 | 4 | ! See their definitions in the file FKS_params.dat. | ||
587 | 5 | ! | ||
588 | 6 | !==================================================================== | ||
589 | 7 | |||
590 | 8 | character*64 paramFileName | ||
591 | 9 | parameter ( paramFileName='FKS_params.dat') | ||
592 | 10 | |||
593 | 11 | integer maxContribsSelected, maxCouplingsSelected | ||
594 | 12 | parameter( maxContribsSelected=100, maxCouplingsSelected=100 ) | ||
595 | 13 | integer maxContribType, maxCouplingTypes | ||
596 | 14 | parameter ( maxContribType=15, maxCouplingTypes=20 ) | ||
597 | 15 | |||
598 | 16 | real*8 IRPoleCheckThreshold,Virt_fraction, | ||
599 | 17 | & PrecisionVirtualAtRunTime,Min_virt_fraction | ||
600 | 18 | |||
601 | 19 | integer NHelForMCoverHels, VetoedContributionTypes(0:maxContribsSelected), | ||
602 | 20 | & SelectedContributionTypes(0:maxContribsSelected), | ||
603 | 21 | & QED_squared_selected, QCD_squared_selected, | ||
604 | 22 | & SelectedCouplingOrders(maxCouplingTypes,0:maxCouplingsSelected) | ||
605 | 23 | |||
606 | 24 | logical separate_flavour_configs, IncludeBornContributions | ||
607 | 25 | |||
608 | 26 | common /FKSPARAMS/IRPoleCheckThreshold,virt_fraction, | ||
609 | 27 | & PrecisionVirtualAtRunTime,min_virt_fraction, | ||
610 | 28 | & NHelForMCoverHels,separate_flavour_configs, | ||
611 | 29 | & QCD_squared_selected, QED_squared_selected, | ||
612 | 30 | & VetoedContributionTypes, SelectedContributionTypes, | ||
613 | 31 | & SelectedCouplingOrders | ||
614 | 32 | 0 | ||
615 | === modified file 'Template/NLO/SubProcesses/check_poles.f' | |||
616 | --- Template/NLO/SubProcesses/check_poles.f 2018-12-21 15:27:32 +0000 | |||
617 | +++ Template/NLO/SubProcesses/check_poles.f 2019-09-12 11:14:33 +0000 | |||
618 | @@ -3,6 +3,7 @@ | |||
619 | 3 | c This is the driver for the whole calulation | 3 | c This is the driver for the whole calulation |
620 | 4 | c************************************************************************** | 4 | c************************************************************************** |
621 | 5 | use mint_module | 5 | use mint_module |
622 | 6 | use FKSParams | ||
623 | 6 | implicit none | 7 | implicit none |
624 | 7 | C | 8 | C |
625 | 8 | C CONSTANTS | 9 | C CONSTANTS |
626 | @@ -64,7 +65,6 @@ | |||
627 | 64 | common /to_polecheck/force_polecheck, polecheck_passed | 65 | common /to_polecheck/force_polecheck, polecheck_passed |
628 | 65 | integer ret_code_ml | 66 | integer ret_code_ml |
629 | 66 | common /to_ret_code/ret_code_ml | 67 | common /to_ret_code/ret_code_ml |
630 | 67 | include 'FKSParams.inc' | ||
631 | 68 | 68 | ||
632 | 69 | C----- | 69 | C----- |
633 | 70 | C BEGIN CODE | 70 | C BEGIN CODE |
634 | 71 | 71 | ||
635 | === modified file 'Template/NLO/SubProcesses/driver_mintFO.f' | |||
636 | --- Template/NLO/SubProcesses/driver_mintFO.f 2019-09-12 09:03:04 +0000 | |||
637 | +++ Template/NLO/SubProcesses/driver_mintFO.f 2019-09-12 11:14:33 +0000 | |||
638 | @@ -4,6 +4,7 @@ | |||
639 | 4 | c************************************************************************** | 4 | c************************************************************************** |
640 | 5 | use extra_weights | 5 | use extra_weights |
641 | 6 | use mint_module | 6 | use mint_module |
642 | 7 | use FKSParams | ||
643 | 7 | implicit none | 8 | implicit none |
644 | 8 | C | 9 | C |
645 | 9 | C CONSTANTS | 10 | C CONSTANTS |
646 | @@ -66,9 +67,6 @@ | |||
647 | 66 | include "timing_variables.inc" | 67 | include "timing_variables.inc" |
648 | 67 | real*4 tOther, tTot | 68 | real*4 tOther, tTot |
649 | 68 | 69 | ||
650 | 69 | c general MadFKS parameters | ||
651 | 70 | include "FKSParams.inc" | ||
652 | 71 | |||
653 | 72 | c applgrid | 70 | c applgrid |
654 | 73 | integer iappl | 71 | integer iappl |
655 | 74 | common /for_applgrid/ iappl | 72 | common /for_applgrid/ iappl |
656 | 75 | 73 | ||
657 | === modified file 'Template/NLO/SubProcesses/driver_mintMC.f' | |||
658 | --- Template/NLO/SubProcesses/driver_mintMC.f 2019-09-12 09:03:04 +0000 | |||
659 | +++ Template/NLO/SubProcesses/driver_mintMC.f 2019-09-12 11:14:33 +0000 | |||
660 | @@ -4,6 +4,7 @@ | |||
661 | 4 | c************************************************************************** | 4 | c************************************************************************** |
662 | 5 | use extra_weights | 5 | use extra_weights |
663 | 6 | use mint_module | 6 | use mint_module |
664 | 7 | use FKSParams | ||
665 | 7 | implicit none | 8 | implicit none |
666 | 8 | C | 9 | C |
667 | 9 | C CONSTANTS | 10 | C CONSTANTS |
668 | @@ -74,9 +75,6 @@ | |||
669 | 74 | include "timing_variables.inc" | 75 | include "timing_variables.inc" |
670 | 75 | real*4 tOther, tTot | 76 | real*4 tOther, tTot |
671 | 76 | 77 | ||
672 | 77 | c general MadFKS parameters | ||
673 | 78 | include "FKSParams.inc" | ||
674 | 79 | |||
675 | 80 | double precision deravg,derstd,dermax,xi_i_fks_ev_der_max | 78 | double precision deravg,derstd,dermax,xi_i_fks_ev_der_max |
676 | 81 | & ,y_ij_fks_ev_der_max | 79 | & ,y_ij_fks_ev_der_max |
677 | 82 | integer ntot_granny,derntot,ncase(0:6) | 80 | integer ntot_granny,derntot,ncase(0:6) |
678 | 83 | 81 | ||
679 | === modified file 'Template/NLO/SubProcesses/fks_singular.f' | |||
680 | --- Template/NLO/SubProcesses/fks_singular.f 2019-09-12 09:03:04 +0000 | |||
681 | +++ Template/NLO/SubProcesses/fks_singular.f 2019-09-12 11:14:33 +0000 | |||
682 | @@ -1456,6 +1456,7 @@ | |||
683 | 1456 | c contribution | 1456 | c contribution |
684 | 1457 | use weight_lines | 1457 | use weight_lines |
685 | 1458 | use extra_weights | 1458 | use extra_weights |
686 | 1459 | use FKSParams | ||
687 | 1459 | implicit none | 1460 | implicit none |
688 | 1460 | include 'nexternal.inc' | 1461 | include 'nexternal.inc' |
689 | 1461 | include 'run.inc' | 1462 | include 'run.inc' |
690 | @@ -1463,7 +1464,6 @@ | |||
691 | 1463 | include 'coupl.inc' | 1464 | include 'coupl.inc' |
692 | 1464 | include 'fks_info.inc' | 1465 | include 'fks_info.inc' |
693 | 1465 | include 'q_es.inc' | 1466 | include 'q_es.inc' |
694 | 1466 | include 'FKSParams.inc' | ||
695 | 1467 | include 'orders.inc' | 1467 | include 'orders.inc' |
696 | 1468 | integer type,i,j | 1468 | integer type,i,j |
697 | 1469 | logical foundIt,foundOrders | 1469 | logical foundIt,foundOrders |
698 | @@ -1651,6 +1651,7 @@ | |||
699 | 1651 | use weight_lines | 1651 | use weight_lines |
700 | 1652 | use extra_weights | 1652 | use extra_weights |
701 | 1653 | use mint_module | 1653 | use mint_module |
702 | 1654 | use FKSParams | ||
703 | 1654 | implicit none | 1655 | implicit none |
704 | 1655 | include 'nexternal.inc' | 1656 | include 'nexternal.inc' |
705 | 1656 | include 'run.inc' | 1657 | include 'run.inc' |
706 | @@ -1658,7 +1659,6 @@ | |||
707 | 1658 | include 'timing_variables.inc' | 1659 | include 'timing_variables.inc' |
708 | 1659 | include 'genps.inc' | 1660 | include 'genps.inc' |
709 | 1660 | include 'orders.inc' | 1661 | include 'orders.inc' |
710 | 1661 | include 'FKSParams.inc' | ||
711 | 1662 | integer orders(nsplitorders) | 1662 | integer orders(nsplitorders) |
712 | 1663 | integer i,j,k,iamp,icontr_orig | 1663 | integer i,j,k,iamp,icontr_orig |
713 | 1664 | logical virt_found | 1664 | logical virt_found |
714 | @@ -2011,11 +2011,11 @@ | |||
715 | 2011 | c wgts() array to include the weights. | 2011 | c wgts() array to include the weights. |
716 | 2012 | use weight_lines | 2012 | use weight_lines |
717 | 2013 | use extra_weights | 2013 | use extra_weights |
718 | 2014 | use FKSParams | ||
719 | 2014 | implicit none | 2015 | implicit none |
720 | 2015 | include 'nexternal.inc' | 2016 | include 'nexternal.inc' |
721 | 2016 | include 'run.inc' | 2017 | include 'run.inc' |
722 | 2017 | include 'timing_variables.inc' | 2018 | include 'timing_variables.inc' |
723 | 2018 | include 'FKSParams.inc' | ||
724 | 2019 | include 'genps.inc' | 2019 | include 'genps.inc' |
725 | 2020 | integer i,kr,kf,iwgt_save,dd | 2020 | integer i,kr,kf,iwgt_save,dd |
726 | 2021 | double precision xlum(maxscales),dlum,pi,mu2_r(maxscales),c_mu2_r | 2021 | double precision xlum(maxscales),dlum,pi,mu2_r(maxscales),c_mu2_r |
727 | @@ -2094,11 +2094,11 @@ | |||
728 | 2094 | c computations (ickkw.eq.-1). | 2094 | c computations (ickkw.eq.-1). |
729 | 2095 | use weight_lines | 2095 | use weight_lines |
730 | 2096 | use extra_weights | 2096 | use extra_weights |
731 | 2097 | use FKSParams | ||
732 | 2097 | implicit none | 2098 | implicit none |
733 | 2098 | include 'nexternal.inc' | 2099 | include 'nexternal.inc' |
734 | 2099 | include 'run.inc' | 2100 | include 'run.inc' |
735 | 2100 | include 'timing_variables.inc' | 2101 | include 'timing_variables.inc' |
736 | 2101 | include 'FKSParams.inc' | ||
737 | 2102 | include 'genps.inc' | 2102 | include 'genps.inc' |
738 | 2103 | integer i,ks,kh,iwgt_save | 2103 | integer i,ks,kh,iwgt_save |
739 | 2104 | double precision xlum(maxscales),dlum,pi,mu2_r(maxscales) | 2104 | double precision xlum(maxscales),dlum,pi,mu2_r(maxscales) |
740 | @@ -2200,11 +2200,11 @@ | |||
741 | 2200 | c wgts() array to include the weights. | 2200 | c wgts() array to include the weights. |
742 | 2201 | use weight_lines | 2201 | use weight_lines |
743 | 2202 | use extra_weights | 2202 | use extra_weights |
744 | 2203 | use FKSParams | ||
745 | 2203 | implicit none | 2204 | implicit none |
746 | 2204 | include 'nexternal.inc' | 2205 | include 'nexternal.inc' |
747 | 2205 | include 'run.inc' | 2206 | include 'run.inc' |
748 | 2206 | include 'timing_variables.inc' | 2207 | include 'timing_variables.inc' |
749 | 2207 | include 'FKSParams.inc' | ||
750 | 2208 | include 'genps.inc' | 2208 | include 'genps.inc' |
751 | 2209 | integer n,izero,i,nn | 2209 | integer n,izero,i,nn |
752 | 2210 | parameter (izero=0) | 2210 | parameter (izero=0) |
753 | @@ -5877,12 +5877,22 @@ | |||
754 | 5877 | tOLP=tOLP+(tAfter-tBefore) | 5877 | tOLP=tOLP+(tAfter-tBefore) |
755 | 5878 | virtual_over_born=virt_wgt/born_wgt | 5878 | virtual_over_born=virt_wgt/born_wgt |
756 | 5879 | if (ickkw.ne.-1) then | 5879 | if (ickkw.ne.-1) then |
758 | 5880 | virt_wgt=virt_wgt-average_virtual(0,ichan)*born_wgt | 5880 | if (use_poly_virtual) then |
759 | 5881 | virt_wgt=virt_wgt-polyfit(0)*born_wgt | ||
760 | 5882 | else | ||
761 | 5883 | virt_wgt=virt_wgt-average_virtual(0,ichan)*born_wgt | ||
762 | 5884 | endif | ||
763 | 5881 | do iamp=1,amp_split_size | 5885 | do iamp=1,amp_split_size |
764 | 5882 | if (amp_split_virt(iamp).eq.0d0) cycle | 5886 | if (amp_split_virt(iamp).eq.0d0) cycle |
765 | 5887 | if (use_poly_virtual) then | ||
766 | 5888 | amp_split_virt(iamp)=amp_split_virt(iamp)- | ||
767 | 5889 | $ polyfit(iamp) | ||
768 | 5890 | $ *amp_split_born_for_virt(iamp) | ||
769 | 5891 | else | ||
770 | 5883 | amp_split_virt(iamp)=amp_split_virt(iamp)- | 5892 | amp_split_virt(iamp)=amp_split_virt(iamp)- |
771 | 5884 | $ average_virtual(iamp,ichan) | 5893 | $ average_virtual(iamp,ichan) |
772 | 5885 | $ *amp_split_born_for_virt(iamp) | 5894 | $ *amp_split_born_for_virt(iamp) |
773 | 5895 | endif | ||
774 | 5886 | enddo | 5896 | enddo |
775 | 5887 | endif | 5897 | endif |
776 | 5888 | if (abrv.ne.'virt') then | 5898 | if (abrv.ne.'virt') then |
777 | @@ -5902,12 +5912,21 @@ | |||
778 | 5902 | $ amp_split_virt_save(1:amp_split_size) | 5912 | $ amp_split_virt_save(1:amp_split_size) |
779 | 5903 | endif | 5913 | endif |
780 | 5904 | if (abrv(1:4).ne.'virt' .and. ickkw.ne.-1) then | 5914 | if (abrv(1:4).ne.'virt' .and. ickkw.ne.-1) then |
787 | 5905 | avv_wgt=average_virtual(0,ichan)*born_wgt | 5915 | if (use_poly_virtual) then |
788 | 5906 | do iamp=1, amp_split_size | 5916 | avv_wgt=polyfit(0)*born_wgt |
789 | 5907 | if (amp_split_born_for_virt(iamp).eq.0d0) cycle | 5917 | do iamp=1, amp_split_size |
790 | 5908 | amp_split_avv(iamp)= average_virtual(iamp,ichan) | 5918 | if (amp_split_born_for_virt(iamp).eq.0d0) cycle |
791 | 5909 | $ *amp_split_born_for_virt(iamp) | 5919 | amp_split_avv(iamp)= polyfit(iamp) |
792 | 5910 | enddo | 5920 | $ *amp_split_born_for_virt(iamp) |
793 | 5921 | enddo | ||
794 | 5922 | else | ||
795 | 5923 | avv_wgt=average_virtual(0,ichan)*born_wgt | ||
796 | 5924 | do iamp=1, amp_split_size | ||
797 | 5925 | if (amp_split_born_for_virt(iamp).eq.0d0) cycle | ||
798 | 5926 | amp_split_avv(iamp)= average_virtual(iamp,ichan) | ||
799 | 5927 | $ *amp_split_born_for_virt(iamp) | ||
800 | 5928 | enddo | ||
801 | 5929 | endif | ||
802 | 5911 | endif | 5930 | endif |
803 | 5912 | 5931 | ||
804 | 5913 | c eq.(MadFKS.C.13) | 5932 | c eq.(MadFKS.C.13) |
805 | 5914 | 5933 | ||
806 | === modified file 'Template/NLO/SubProcesses/makefile_fks_dir' | |||
807 | --- Template/NLO/SubProcesses/makefile_fks_dir 2018-12-21 15:27:32 +0000 | |||
808 | +++ Template/NLO/SubProcesses/makefile_fks_dir 2019-09-12 11:14:33 +0000 | |||
809 | @@ -26,16 +26,16 @@ | |||
810 | 26 | 26 | ||
811 | 27 | # Files for all executables | 27 | # Files for all executables |
812 | 28 | FILES= $(patsubst %.f,%.o,$(wildcard parton_lum_*.f)) $(patsubst \ | 28 | FILES= $(patsubst %.f,%.o,$(wildcard parton_lum_*.f)) $(patsubst \ |
814 | 29 | %.f,%.o,$(wildcard matrix_*.f)) real_me_chooser.o \ | 29 | %.f,%.o,$(wildcard matrix_*.f)) FKSParams.o real_me_chooser.o \ |
815 | 30 | chooser_functions.o genps_fks.o setcuts.o setscales.o \ | 30 | chooser_functions.o genps_fks.o setcuts.o setscales.o \ |
816 | 31 | veto_xsec.o $(patsubst %.f,%.o,$(wildcard b_sf_???.f)) \ | 31 | veto_xsec.o $(patsubst %.f,%.o,$(wildcard b_sf_???.f)) \ |
817 | 32 | born.o sborn_sf.o extra_cnt_wrapper.o $(patsubst \ | 32 | born.o sborn_sf.o extra_cnt_wrapper.o $(patsubst \ |
818 | 33 | %.f,%.o,$(wildcard born_cnt_*.f)) fks_Sij.o \ | 33 | %.f,%.o,$(wildcard born_cnt_*.f)) fks_Sij.o \ |
819 | 34 | $(fastjetfortran_madfks) fks_singular.o montecarlocounter.o \ | 34 | $(fastjetfortran_madfks) fks_singular.o montecarlocounter.o \ |
820 | 35 | reweight_xsec.o boostwdir2.o initcluster.o cluster.o \ | 35 | reweight_xsec.o boostwdir2.o initcluster.o cluster.o \ |
822 | 36 | splitorders_stuff.o reweight.o get_color.o FKSParamReader.o \ | 36 | splitorders_stuff.o reweight.o get_color.o \ |
823 | 37 | iproc_map.o MC_integer.o $(reweight_xsec_events_pdf_dummy) \ | 37 | iproc_map.o MC_integer.o $(reweight_xsec_events_pdf_dummy) \ |
825 | 38 | $(applgrid_interface) weight_lines.o mint_module.o | 38 | $(applgrid_interface) weight_lines.o mint_module.o polfit.o |
826 | 39 | 39 | ||
827 | 40 | # Files needed for mintFO & mintMC | 40 | # Files needed for mintFO & mintMC |
828 | 41 | RUN= $(FO_ANALYSE) $(FILES) cuts.o pythia_unlops.o recluster.o \ | 41 | RUN= $(FO_ANALYSE) $(FILES) cuts.o pythia_unlops.o recluster.o \ |
829 | 42 | 42 | ||
830 | === modified file 'Template/NLO/SubProcesses/mint_module.f90' | |||
831 | --- Template/NLO/SubProcesses/mint_module.f90 2019-08-15 13:57:46 +0000 | |||
832 | +++ Template/NLO/SubProcesses/mint_module.f90 2019-09-12 11:14:33 +0000 | |||
833 | @@ -64,8 +64,8 @@ | |||
834 | 64 | ! nintegrals>6 : virtual and born order by order | 64 | ! nintegrals>6 : virtual and born order by order |
835 | 65 | ! | 65 | ! |
836 | 66 | 66 | ||
837 | 67 | |||
838 | 68 | module mint_module | 67 | module mint_module |
839 | 68 | use FKSParams ! contains use_poly_virtual | ||
840 | 69 | implicit none | 69 | implicit none |
841 | 70 | integer, parameter, private :: nintervals=32 ! max number of intervals in the integration grids | 70 | integer, parameter, private :: nintervals=32 ! max number of intervals in the integration grids |
842 | 71 | integer, parameter, public :: ndimmax=60 ! max number of dimensions of the integral | 71 | integer, parameter, public :: ndimmax=60 ! max number of dimensions of the integral |
843 | @@ -92,7 +92,7 @@ | |||
844 | 92 | integer, dimension(maxchannels), public :: iconfigs | 92 | integer, dimension(maxchannels), public :: iconfigs |
845 | 93 | double precision, public :: accuracy,min_virt_fraction_mint,wgt_mult | 93 | double precision, public :: accuracy,min_virt_fraction_mint,wgt_mult |
846 | 94 | double precision, dimension(0:n_ave_virt,maxchannels), public :: average_virtual | 94 | double precision, dimension(0:n_ave_virt,maxchannels), public :: average_virtual |
848 | 95 | double precision, dimension(0:n_ave_virt), public :: virt_wgt_mint,born_wgt_mint | 95 | double precision, dimension(0:n_ave_virt), public :: virt_wgt_mint,born_wgt_mint,polyfit |
849 | 96 | double precision, dimension(maxchannels), public :: virtual_fraction | 96 | double precision, dimension(maxchannels), public :: virtual_fraction |
850 | 97 | double precision, dimension(nintegrals,0:maxchannels), public :: ans,unc | 97 | double precision, dimension(nintegrals,0:maxchannels), public :: ans,unc |
851 | 98 | logical :: only_virt,new_point,pass_cuts_check | 98 | logical :: only_virt,new_point,pass_cuts_check |
852 | @@ -340,9 +340,13 @@ | |||
853 | 340 | ! overwrite xgrid with the new xgrid | 340 | ! overwrite xgrid with the new xgrid |
854 | 341 | if (regridded(kchan)) xgrid(1:nint_used,1:ndim,kchan)=xgrid_new(1:nint_used,1:ndim) | 341 | if (regridded(kchan)) xgrid(1:nint_used,1:ndim,kchan)=xgrid_new(1:nint_used,1:ndim) |
855 | 342 | enddo | 342 | enddo |
859 | 343 | do k_ord_virt=0,n_ord_virt | 343 | if (use_poly_virtual) then |
860 | 344 | call regrid_ave_virt(k_ord_virt) | 344 | call do_polyfit() |
861 | 345 | enddo | 345 | else |
862 | 346 | do k_ord_virt=0,n_ord_virt | ||
863 | 347 | call regrid_ave_virt(k_ord_virt) | ||
864 | 348 | enddo | ||
865 | 349 | endif | ||
866 | 346 | ! Regrid the MC over integers (used for the MC over FKS dirs) | 350 | ! Regrid the MC over integers (used for the MC over FKS dirs) |
867 | 347 | call regrid_MC_integer | 351 | call regrid_MC_integer |
868 | 348 | end subroutine update_integration_grids | 352 | end subroutine update_integration_grids |
869 | @@ -664,10 +668,18 @@ | |||
870 | 664 | isix=2*k_ord_virt+6 | 668 | isix=2*k_ord_virt+6 |
871 | 665 | endif | 669 | endif |
872 | 666 | if (f(ithree).ne.0d0) then | 670 | if (f(ithree).ne.0d0) then |
877 | 667 | f(isix)=f(isix)/virtual_fraction(ichan) | 671 | born=f(isix) |
878 | 668 | virtual=(f(ithree)+average_virtual(k_ord_virt,ichan)*f(isix))*virtual_fraction(ichan) | 672 | ! virt_wgt_mint=(virtual-average_virtual*born)/virtual_fraction. Compensate: |
879 | 669 | born=f(isix)*virtual_fraction(ichan) | 673 | if (use_poly_virtual) then |
880 | 670 | call fill_ave_virt(x,k_ord_virt,virtual,born) | 674 | virtual=f(ithree)*virtual_fraction(ichan)+ & |
881 | 675 | polyfit(k_ord_virt)*f(isix) | ||
882 | 676 | call add_point_polyfit(ichan,k_ord_virt,x(1:ndim-3), & | ||
883 | 677 | virtual/born,born/wgt_mult) | ||
884 | 678 | else | ||
885 | 679 | virtual=f(ithree)*virtual_fraction(ichan)+ & | ||
886 | 680 | average_virtual(k_ord_virt,ichan)*f(isix) | ||
887 | 681 | call fill_ave_virt(x,k_ord_virt,virtual,born) | ||
888 | 682 | endif | ||
889 | 671 | else | 683 | else |
890 | 672 | f(isix)=0d0 | 684 | f(isix)=0d0 |
891 | 673 | endif | 685 | endif |
892 | @@ -801,7 +813,11 @@ | |||
893 | 801 | if(imode.eq.0) nhits(icell(kdim),kdim,ichan)=nhits(icell(kdim),kdim,ichan)+1 | 813 | if(imode.eq.0) nhits(icell(kdim),kdim,ichan)=nhits(icell(kdim),kdim,ichan)+1 |
894 | 802 | enddo | 814 | enddo |
895 | 803 | do k_ord_virt=0,n_ord_virt | 815 | do k_ord_virt=0,n_ord_virt |
897 | 804 | call get_ave_virt(x,k_ord_virt) | 816 | if (use_poly_virtual) then |
898 | 817 | call get_polyfit(ichan,k_ord_virt,x(1:ndim-3),polyfit(k_ord_virt)) | ||
899 | 818 | else | ||
900 | 819 | call get_ave_virt(x,k_ord_virt) | ||
901 | 820 | endif | ||
902 | 805 | enddo | 821 | enddo |
903 | 806 | end subroutine get_random_x | 822 | end subroutine get_random_x |
904 | 807 | 823 | ||
905 | @@ -988,14 +1004,18 @@ | |||
906 | 988 | 1004 | ||
907 | 989 | subroutine reset_mint_grids | 1005 | subroutine reset_mint_grids |
908 | 990 | implicit none | 1006 | implicit none |
910 | 991 | integer :: kdim,kchan,kint,k_ord_virt | 1007 | integer :: kdim,kchan,kint |
911 | 992 | do kint=0,nint_used | 1008 | do kint=0,nint_used |
912 | 993 | xgrid(kint,1:ndim,1:nchans)=dble(kint)/nint_used | 1009 | xgrid(kint,1:ndim,1:nchans)=dble(kint)/nint_used |
913 | 994 | enddo | 1010 | enddo |
914 | 995 | nhits(1:nint_used,1:ndim,1:nchans)=0 | 1011 | nhits(1:nint_used,1:ndim,1:nchans)=0 |
915 | 996 | regridded(1:nchans)=.true. | 1012 | regridded(1:nchans)=.true. |
916 | 997 | nhits_in_grids(1:nchans)=0 | 1013 | nhits_in_grids(1:nchans)=0 |
918 | 998 | call init_ave_virt | 1014 | if (use_poly_virtual) then |
919 | 1015 | call init_polyfit(ndim-3,nchans,n_ord_virt,1000) | ||
920 | 1016 | else | ||
921 | 1017 | call init_ave_virt | ||
922 | 1018 | endif | ||
923 | 999 | ans_chan(0:nchans)=0d0 | 1019 | ans_chan(0:nchans)=0d0 |
924 | 1000 | if (double_events) then | 1020 | if (double_events) then |
925 | 1001 | ! when double events, start with the very first channel only. For the | 1021 | ! when double events, start with the very first channel only. For the |
926 | @@ -1032,11 +1052,13 @@ | |||
927 | 1032 | write (12,*) 'MAX',(ymax(j,i,kchan),i=1,ndim) | 1052 | write (12,*) 'MAX',(ymax(j,i,kchan),i=1,ndim) |
928 | 1033 | enddo | 1053 | enddo |
929 | 1034 | endif | 1054 | endif |
933 | 1035 | do j=1,nintervals_virt | 1055 | if (.not.use_poly_virtual) then |
934 | 1036 | do k=0,n_ord_virt | 1056 | do j=1,nintervals_virt |
935 | 1037 | write (12,*) 'AVE',(ave_virt(j,i,k,kchan),i=1,ndim) | 1057 | do k=0,n_ord_virt |
936 | 1058 | write (12,*) 'AVE',(ave_virt(j,i,k,kchan),i=1,ndim) | ||
937 | 1059 | enddo | ||
938 | 1038 | enddo | 1060 | enddo |
940 | 1039 | enddo | 1061 | endif |
941 | 1040 | if (imode.ge.1) then | 1062 | if (imode.ge.1) then |
942 | 1041 | write (12,*) 'MAX',ymax_virt(kchan) | 1063 | write (12,*) 'MAX',ymax_virt(kchan) |
943 | 1042 | endif | 1064 | endif |
944 | @@ -1046,6 +1068,7 @@ | |||
945 | 1046 | write (12,*) 'AVE',virtual_fraction(kchan),average_virtual(0,kchan) | 1068 | write (12,*) 'AVE',virtual_fraction(kchan),average_virtual(0,kchan) |
946 | 1047 | enddo | 1069 | enddo |
947 | 1048 | write (12,*) 'IDE',(ifold(i),i=1,ndim) | 1070 | write (12,*) 'IDE',(ifold(i),i=1,ndim) |
948 | 1071 | if (use_poly_virtual) call save_polyfit(12) | ||
949 | 1049 | close (12) | 1072 | close (12) |
950 | 1050 | end subroutine write_grids_to_file | 1073 | end subroutine write_grids_to_file |
951 | 1051 | 1074 | ||
952 | @@ -1053,6 +1076,7 @@ | |||
953 | 1053 | ! Read the MINT integration grids from file | 1076 | ! Read the MINT integration grids from file |
954 | 1054 | implicit none | 1077 | implicit none |
955 | 1055 | integer :: i,j,k,kchan,idum | 1078 | integer :: i,j,k,kchan,idum |
956 | 1079 | integer,dimension(maxchannels) :: points | ||
957 | 1056 | character(len=3) :: dummy | 1080 | character(len=3) :: dummy |
958 | 1057 | open (unit=12, file='mint_grids',status='old') | 1081 | open (unit=12, file='mint_grids',status='old') |
959 | 1058 | ans(1,0)=0d0 | 1082 | ans(1,0)=0d0 |
960 | @@ -1066,11 +1090,13 @@ | |||
961 | 1066 | read (12,*) dummy,(ymax(j,i,kchan),i=1,ndim) | 1090 | read (12,*) dummy,(ymax(j,i,kchan),i=1,ndim) |
962 | 1067 | enddo | 1091 | enddo |
963 | 1068 | endif | 1092 | endif |
967 | 1069 | do j=1,nintervals_virt | 1093 | if (.not.use_poly_virtual) then |
968 | 1070 | do k=0,n_ord_virt | 1094 | do j=1,nintervals_virt |
969 | 1071 | read (12,*) dummy,(ave_virt(j,i,k,kchan),i=1,ndim) | 1095 | do k=0,n_ord_virt |
970 | 1096 | read (12,*) dummy,(ave_virt(j,i,k,kchan),i=1,ndim) | ||
971 | 1097 | enddo | ||
972 | 1072 | enddo | 1098 | enddo |
974 | 1073 | enddo | 1099 | endif |
975 | 1074 | if (imode.ge.2) then | 1100 | if (imode.ge.2) then |
976 | 1075 | read (12,*) dummy,ymax_virt(kchan) | 1101 | read (12,*) dummy,ymax_virt(kchan) |
977 | 1076 | endif | 1102 | endif |
978 | @@ -1083,6 +1109,18 @@ | |||
979 | 1083 | enddo | 1109 | enddo |
980 | 1084 | read (12,*) dummy,(ifold(i),i=1,ndim) | 1110 | read (12,*) dummy,(ifold(i),i=1,ndim) |
981 | 1085 | unc(1,0)=sqrt(unc(1,0)) | 1111 | unc(1,0)=sqrt(unc(1,0)) |
982 | 1112 | ! polyfit stuff: | ||
983 | 1113 | if (use_poly_virtual) then | ||
984 | 1114 | do kchan=1,nchans | ||
985 | 1115 | read (12,*) dummy,points(kchan) | ||
986 | 1116 | enddo | ||
987 | 1117 | do kchan=1,nchans | ||
988 | 1118 | backspace(12) | ||
989 | 1119 | enddo | ||
990 | 1120 | call init_polyfit(ndim-3,nchans,n_ord_virt,maxval(points(1:nchans))) | ||
991 | 1121 | call restore_polyfit(12) | ||
992 | 1122 | call do_polyfit() | ||
993 | 1123 | endif | ||
994 | 1086 | close (12) | 1124 | close (12) |
995 | 1087 | ! check for zero cross-section: if restoring grids corresponding to | 1125 | ! check for zero cross-section: if restoring grids corresponding to |
996 | 1088 | ! sigma=0, just terminate the run | 1126 | ! sigma=0, just terminate the run |
997 | 1089 | 1127 | ||
998 | === added file 'Template/NLO/SubProcesses/polfit.f' | |||
999 | --- Template/NLO/SubProcesses/polfit.f 1970-01-01 00:00:00 +0000 | |||
1000 | +++ Template/NLO/SubProcesses/polfit.f 2019-09-12 11:14:33 +0000 | |||
1001 | @@ -0,0 +1,720 @@ | |||
1002 | 1 | subroutine init_polyfit(ndims,nchans,k_ord_virt,npoints) | ||
1003 | 2 | ! wrapper subroutine that saves all information that's needed for calls | ||
1004 | 3 | ! to the polfit() and pvalue() subroutines. Since I was too lazy to | ||
1005 | 4 | ! write a proper module, use fortran entry statements to jump to the | ||
1006 | 5 | ! right locations in this subroutine. | ||
1007 | 6 | implicit none | ||
1008 | 7 | integer ndims,nchans,ndim,nchan,maxpoint,maxdeg,ierr,i,ichan,ic | ||
1009 | 8 | $ ,iunit,npoints,n_ord_virt,k_ord_virt,ko | ||
1010 | 9 | integer,allocatable,dimension(:) :: n | ||
1011 | 10 | integer,allocatable,dimension(:,:,:) :: ndeg | ||
1012 | 11 | real*8,allocatable,dimension(:) :: r,yp,a | ||
1013 | 12 | real*8,allocatable,dimension(:,:,:) :: y,w,x2d,temp3 | ||
1014 | 13 | real*8,allocatable,dimension(:,:,:,:) :: a2d | ||
1015 | 14 | logical,allocatable,dimension(:) :: valid_ord_virt | ||
1016 | 15 | parameter (maxdeg=20) | ||
1017 | 16 | real*8 absXS,virt,ave_fun,fun_at_x,eps,sum_w,yfit,x(*) | ||
1018 | 17 | logical fit_done,verbose | ||
1019 | 18 | parameter (verbose=.false.) | ||
1020 | 19 | character(len=3) :: dummy | ||
1021 | 20 | save | ||
1022 | 21 | maxpoint=npoints | ||
1023 | 22 | nchan=nchans | ||
1024 | 23 | ndim=ndims | ||
1025 | 24 | n_ord_virt=k_ord_virt | ||
1026 | 25 | if (allocated(ndeg)) deallocate(ndeg) | ||
1027 | 26 | allocate(ndeg(ndim,0:n_ord_virt,nchan)) | ||
1028 | 27 | if (allocated(n)) deallocate(n) | ||
1029 | 28 | allocate(n(nchan)) | ||
1030 | 29 | if (allocated(a)) deallocate(a) | ||
1031 | 30 | allocate(a(maxpoint*3+maxdeg*3+3)) | ||
1032 | 31 | if (allocated(y)) deallocate(y) | ||
1033 | 32 | allocate(y(maxpoint,0:n_ord_virt,nchan)) | ||
1034 | 33 | if (allocated(w)) deallocate(w) | ||
1035 | 34 | allocate(w(maxpoint,0:n_ord_virt,nchan)) | ||
1036 | 35 | if (allocated(r)) deallocate(r) | ||
1037 | 36 | allocate(r(maxpoint)) | ||
1038 | 37 | if (allocated(yp)) deallocate(yp) | ||
1039 | 38 | allocate(yp(maxdeg)) | ||
1040 | 39 | if (allocated(x2d)) deallocate(x2d) | ||
1041 | 40 | allocate(x2d(maxpoint,ndim,nchan)) | ||
1042 | 41 | if (allocated(a2d)) deallocate(a2d) | ||
1043 | 42 | allocate(a2d(maxdeg*3+3,ndim,0:n_ord_virt,nchan)) | ||
1044 | 43 | if (allocated(valid_ord_virt)) deallocate(valid_ord_virt) | ||
1045 | 44 | allocate(valid_ord_virt(0:n_ord_virt)) | ||
1046 | 45 | n(1:nchan)=0 | ||
1047 | 46 | fit_done=.false. | ||
1048 | 47 | valid_ord_virt(0:n_ord_virt)=.false. | ||
1049 | 48 | return | ||
1050 | 49 | |||
1051 | 50 | entry add_point_polyfit(ichan,k_ord_virt,x,virt,absXS) | ||
1052 | 51 | ! only increment 'n' and 'x2d' if it's the zeroth "order" in the | ||
1053 | 52 | ! virtual/born ratio | ||
1054 | 53 | valid_ord_virt(k_ord_virt)=.true. | ||
1055 | 54 | if (k_ord_virt.eq.0) then | ||
1056 | 55 | if (n(ichan).eq.maxpoint) then | ||
1057 | 56 | ! increase the size of the allocated variables: | ||
1058 | 57 | maxpoint=maxpoint+1000 | ||
1059 | 58 | allocate(temp3(maxpoint,0:n_ord_virt,nchan)) | ||
1060 | 59 | do i=1,nchan | ||
1061 | 60 | temp3(1:n(i),0:n_ord_virt,i)=y(1:n(i),0:n_ord_virt,i) | ||
1062 | 61 | enddo | ||
1063 | 62 | call move_alloc(temp3,y) | ||
1064 | 63 | allocate(temp3(maxpoint,0:n_ord_virt,nchan)) | ||
1065 | 64 | do i=1,nchan | ||
1066 | 65 | temp3(1:n(i),0:n_ord_virt,i)=w(1:n(i),0:n_ord_virt,i) | ||
1067 | 66 | enddo | ||
1068 | 67 | call move_alloc(temp3,w) | ||
1069 | 68 | deallocate(r) | ||
1070 | 69 | allocate(r(maxpoint)) | ||
1071 | 70 | allocate(temp3(maxpoint,ndim,nchan)) | ||
1072 | 71 | do i=1,nchan | ||
1073 | 72 | temp3(1:n(i),1:ndim,i)=x2d(1:n(i),1:ndim,i) | ||
1074 | 73 | enddo | ||
1075 | 74 | call move_alloc(temp3,x2d) | ||
1076 | 75 | deallocate(a) | ||
1077 | 76 | allocate(a(maxpoint*3+maxdeg*3+3)) | ||
1078 | 77 | endif | ||
1079 | 78 | n(ichan)=n(ichan)+1 | ||
1080 | 79 | ! add the point to the saved information | ||
1081 | 80 | do i=1,ndim | ||
1082 | 81 | x2d(n(ichan),i,ichan)=x(i) | ||
1083 | 82 | enddo | ||
1084 | 83 | ! initialise all to zero | ||
1085 | 84 | y(n(ichan),0:n_ord_virt,ichan)=0d0 | ||
1086 | 85 | w(n(ichan),0:n_ord_virt,ichan)=0d0 | ||
1087 | 86 | endif | ||
1088 | 87 | y(n(ichan),k_ord_virt,ichan)=virt | ||
1089 | 88 | w(n(ichan),k_ord_virt,ichan)=sqrt(abs(absXS)) | ||
1090 | 89 | return | ||
1091 | 90 | |||
1092 | 91 | entry do_polyfit() | ||
1093 | 92 | ! perform the fit for each dimension and each channel | ||
1094 | 93 | do ic=1,nchan | ||
1095 | 94 | do ko=0,n_ord_virt | ||
1096 | 95 | if (.not.valid_ord_virt(ko)) cycle | ||
1097 | 96 | do i=1,ndim | ||
1098 | 97 | eps=-1d0 | ||
1099 | 98 | call polfit(n(ic),x2d(1,i,ic),y(1,ko,ic),w(1,ko,ic) | ||
1100 | 99 | $ ,maxdeg,ndeg(i,ko,ic),eps,r,ierr,a) | ||
1101 | 100 | ! this is the information used by pvalue() to interpolate | ||
1102 | 101 | ! later: | ||
1103 | 102 | a2d(1:maxdeg*3+3,i,ko,ic)=a(1:maxdeg*3+3) | ||
1104 | 103 | ! print something in the logs: | ||
1105 | 104 | if (verbose) write (*,'(a,i3,i3,i3,i8,i3,i3,f10.4)') | ||
1106 | 105 | $ 'polyfit -',ic,ko,i,n(ic),ndeg(i,ko,ic),ierr,eps | ||
1107 | 106 | enddo | ||
1108 | 107 | enddo | ||
1109 | 108 | enddo | ||
1110 | 109 | fit_done=.true. | ||
1111 | 110 | return | ||
1112 | 111 | |||
1113 | 112 | entry get_polyfit(ichan,k_ord_virt,x,fun_at_x) | ||
1114 | 113 | ! if we haven't do a fit to the data, just return zero. This is | ||
1115 | 114 | ! typically the case only during the very first iteration. | ||
1116 | 115 | if ((.not.fit_done) .or. (.not.valid_ord_virt(k_ord_virt))) then | ||
1117 | 116 | fun_at_x=0d0 | ||
1118 | 117 | return | ||
1119 | 118 | endif | ||
1120 | 119 | ! Do the interpolation. Since we have several dimensions, we use | ||
1121 | 120 | ! the following: | ||
1122 | 121 | ! f(x) = average + sum_i (f_i(x_i)-average) | ||
1123 | 122 | ! where 'i' loops over all dimensions. In other words, the | ||
1124 | 123 | ! information from each of the separate dimensions should only add | ||
1125 | 124 | ! (or subtract) something from the average value. To obtain the | ||
1126 | 125 | ! average, simply call pvalue() to return the zeroth-order | ||
1127 | 126 | ! polynomial. | ||
1128 | 127 | fun_at_x=0d0 | ||
1129 | 128 | do i=1,ndim | ||
1130 | 129 | a(1:maxdeg*3+3)=a2d(1:maxdeg*3+3,i,k_ord_virt,ichan) | ||
1131 | 130 | call pvalue(ndeg(i,k_ord_virt,ichan),0,x(i),yfit,yp,a) | ||
1132 | 131 | call pvalue(0,0,x(i),ave_fun,yp,a) | ||
1133 | 132 | fun_at_x=fun_at_x+(yfit-ave_fun)+ave_fun/dble(ndim) | ||
1134 | 133 | enddo | ||
1135 | 134 | return | ||
1136 | 135 | |||
1137 | 136 | entry save_polyfit(iunit) | ||
1138 | 137 | do ic=1,nchan | ||
1139 | 138 | write (iunit,*) 'POL',n(ic) | ||
1140 | 139 | enddo | ||
1141 | 140 | do ic=1,nchan | ||
1142 | 141 | do i=1,n(ic) | ||
1143 | 142 | write (iunit,*) 'POL',x2d(i,1:ndim,ic), | ||
1144 | 143 | & y(i,0:n_ord_virt,ic),w(i,0:n_ord_virt,ic) | ||
1145 | 144 | enddo | ||
1146 | 145 | enddo | ||
1147 | 146 | return | ||
1148 | 147 | |||
1149 | 148 | entry restore_polyfit(iunit) | ||
1150 | 149 | do ic=1,nchan | ||
1151 | 150 | read (iunit,*) dummy,n(ic) | ||
1152 | 151 | enddo | ||
1153 | 152 | do ic=1,nchan | ||
1154 | 153 | do i=1,n(ic) | ||
1155 | 154 | read (iunit,*) dummy,x2d(i,1:ndim,ic) | ||
1156 | 155 | & ,y(i,0:n_ord_virt,ic),w(i,0:n_ord_virt,ic) | ||
1157 | 156 | enddo | ||
1158 | 157 | enddo | ||
1159 | 158 | do ic=1,nchan | ||
1160 | 159 | do ko=0,n_ord_virt | ||
1161 | 160 | do i=1,n(ic) | ||
1162 | 161 | if (y(i,ko,ic).ne.0d0) valid_ord_virt(ko)=.true. | ||
1163 | 162 | enddo | ||
1164 | 163 | enddo | ||
1165 | 164 | enddo | ||
1166 | 165 | if (verbose) write (*,*) 'polyfit - valid orders virt' | ||
1167 | 166 | $ ,valid_ord_virt(0:n_ord_virt) | ||
1168 | 167 | return | ||
1169 | 168 | end | ||
1170 | 169 | |||
1171 | 170 | |||
1172 | 171 | |||
1173 | 172 | |||
1174 | 173 | |||
1175 | 174 | *DECK POLFIT | ||
1176 | 175 | SUBROUTINE POLFIT (N, X, Y, W, MAXDEG, NDEG, EPS, R, IERR, A) | ||
1177 | 176 | c | ||
1178 | 177 | c!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
1179 | 178 | cRF: make double precision and replace DO-loops and arirthmic | ||
1180 | 179 | c IF-statements to comply more modern standards. Since we made it | ||
1181 | 180 | c double precision, the 'extended, partial-double' precision part has | ||
1182 | 181 | c become useless. Could remove it, but there is no real reason for | ||
1183 | 182 | c that (should only be marginally faster). | ||
1184 | 183 | c!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
1185 | 184 | c | ||
1186 | 185 | C***BEGIN PROLOGUE POLFIT | ||
1187 | 186 | C***PURPOSE Fit discrete data in a least squares sense by polynomials | ||
1188 | 187 | C in one variable. | ||
1189 | 188 | C***LIBRARY SLATEC | ||
1190 | 189 | C***CATEGORY K1A1A2 | ||
1191 | 190 | C***TYPE SINGLE PRECISION (POLFIT-S, DPOLFT-D) | ||
1192 | 191 | C***KEYWORDS CURVE FITTING, DATA FITTING, LEAST SQUARES, POLYNOMIAL FIT | ||
1193 | 192 | C***AUTHOR Shampine, L. F., (SNLA) | ||
1194 | 193 | C Davenport, S. M., (SNLA) | ||
1195 | 194 | C Huddleston, R. E., (SNLL) | ||
1196 | 195 | C***DESCRIPTION | ||
1197 | 196 | C | ||
1198 | 197 | C Abstract | ||
1199 | 198 | C | ||
1200 | 199 | C Given a collection of points X(I) and a set of values Y(I) which | ||
1201 | 200 | C correspond to some function or measurement at each of the X(I), | ||
1202 | 201 | C subroutine POLFIT computes the weighted least-squares polynomial | ||
1203 | 202 | C fits of all degrees up to some degree either specified by the user | ||
1204 | 203 | C or determined by the routine. The fits thus obtained are in | ||
1205 | 204 | C orthogonal polynomial form. Subroutine PVALUE may then be | ||
1206 | 205 | C called to evaluate the fitted polynomials and any of their | ||
1207 | 206 | C derivatives at any point. The subroutine PCOEF may be used to | ||
1208 | 207 | C express the polynomial fits as powers of (X-C) for any specified | ||
1209 | 208 | C point C. | ||
1210 | 209 | C | ||
1211 | 210 | C The parameters for POLFIT are | ||
1212 | 211 | C | ||
1213 | 212 | C Input -- | ||
1214 | 213 | C N - the number of data points. The arrays X, Y and W | ||
1215 | 214 | C must be dimensioned at least N (N .GE. 1). | ||
1216 | 215 | C X - array of values of the independent variable. These | ||
1217 | 216 | C values may appear in any order and need not all be | ||
1218 | 217 | C distinct. | ||
1219 | 218 | C Y - array of corresponding function values. | ||
1220 | 219 | C W - array of positive values to be used as weights. If | ||
1221 | 220 | C W(1) is negative, POLFIT will set all the weights | ||
1222 | 221 | C to 1.0, which means unweighted least squares error | ||
1223 | 222 | C will be minimized. To minimize relative error, the | ||
1224 | 223 | C user should set the weights to: W(I) = 1.0/Y(I)**2, | ||
1225 | 224 | C I = 1,...,N . | ||
1226 | 225 | C MAXDEG - maximum degree to be allowed for polynomial fit. | ||
1227 | 226 | C MAXDEG may be any non-negative integer less than N. | ||
1228 | 227 | C Note -- MAXDEG cannot be equal to N-1 when a | ||
1229 | 228 | C statistical test is to be used for degree selection, | ||
1230 | 229 | C i.e., when input value of EPS is negative. | ||
1231 | 230 | C EPS - specifies the criterion to be used in determining | ||
1232 | 231 | C the degree of fit to be computed. | ||
1233 | 232 | C (1) If EPS is input negative, POLFIT chooses the | ||
1234 | 233 | C degree based on a statistical F test of | ||
1235 | 234 | C significance. One of three possible | ||
1236 | 235 | C significance levels will be used: .01, .05 or | ||
1237 | 236 | C .10. If EPS=-1.0 , the routine will | ||
1238 | 237 | C automatically select one of these levels based | ||
1239 | 238 | C on the number of data points and the maximum | ||
1240 | 239 | C degree to be considered. If EPS is input as | ||
1241 | 240 | C -.01, -.05, or -.10, a significance level of | ||
1242 | 241 | C .01, .05, or .10, respectively, will be used. | ||
1243 | 242 | C (2) If EPS is set to 0., POLFIT computes the | ||
1244 | 243 | C polynomials of degrees 0 through MAXDEG . | ||
1245 | 244 | C (3) If EPS is input positive, EPS is the RMS | ||
1246 | 245 | C error tolerance which must be satisfied by the | ||
1247 | 246 | C fitted polynomial. POLFIT will increase the | ||
1248 | 247 | C degree of fit until this criterion is met or | ||
1249 | 248 | C until the maximum degree is reached. | ||
1250 | 249 | C | ||
1251 | 250 | C Output -- | ||
1252 | 251 | C NDEG - degree of the highest degree fit computed. | ||
1253 | 252 | C EPS - RMS error of the polynomial of degree NDEG . | ||
1254 | 253 | C R - vector of dimension at least NDEG containing values | ||
1255 | 254 | C of the fit of degree NDEG at each of the X(I) . | ||
1256 | 255 | C Except when the statistical test is used, these | ||
1257 | 256 | C values are more accurate than results from subroutine | ||
1258 | 257 | C PVALUE normally are. | ||
1259 | 258 | C IERR - error flag with the following possible values. | ||
1260 | 259 | C 1 -- indicates normal execution, i.e., either | ||
1261 | 260 | C (1) the input value of EPS was negative, and the | ||
1262 | 261 | C computed polynomial fit of degree NDEG | ||
1263 | 262 | C satisfies the specified F test, or | ||
1264 | 263 | C (2) the input value of EPS was 0., and the fits of | ||
1265 | 264 | C all degrees up to MAXDEG are complete, or | ||
1266 | 265 | C (3) the input value of EPS was positive, and the | ||
1267 | 266 | C polynomial of degree NDEG satisfies the RMS | ||
1268 | 267 | C error requirement. | ||
1269 | 268 | C 2 -- invalid input parameter. At least one of the input | ||
1270 | 269 | C parameters has an illegal value and must be corrected | ||
1271 | 270 | C before POLFIT can proceed. Valid input results | ||
1272 | 271 | C when the following restrictions are observed | ||
1273 | 272 | C N .GE. 1 | ||
1274 | 273 | C 0 .LE. MAXDEG .LE. N-1 for EPS .GE. 0. | ||
1275 | 274 | C 0 .LE. MAXDEG .LE. N-2 for EPS .LT. 0. | ||
1276 | 275 | C W(1)=-1.0 or W(I) .GT. 0., I=1,...,N . | ||
1277 | 276 | C 3 -- cannot satisfy the RMS error requirement with a | ||
1278 | 277 | C polynomial of degree no greater than MAXDEG . Best | ||
1279 | 278 | C fit found is of degree MAXDEG . | ||
1280 | 279 | C 4 -- cannot satisfy the test for significance using | ||
1281 | 280 | C current value of MAXDEG . Statistically, the | ||
1282 | 281 | C best fit found is of order NORD . (In this case, | ||
1283 | 282 | C NDEG will have one of the values: MAXDEG-2, | ||
1284 | 283 | C MAXDEG-1, or MAXDEG). Using a higher value of | ||
1285 | 284 | C MAXDEG may result in passing the test. | ||
1286 | 285 | C A - work and output array having at least 3N+3MAXDEG+3 | ||
1287 | 286 | C locations | ||
1288 | 287 | C | ||
1289 | 288 | C Note - POLFIT calculates all fits of degrees up to and including | ||
1290 | 289 | C NDEG . Any or all of these fits can be evaluated or | ||
1291 | 290 | C expressed as powers of (X-C) using PVALUE and PCOEF | ||
1292 | 291 | C after just one call to POLFIT . | ||
1293 | 292 | C | ||
1294 | 293 | C***REFERENCES L. F. Shampine, S. M. Davenport and R. E. Huddleston, | ||
1295 | 294 | C Curve fitting by polynomials in one variable, Report | ||
1296 | 295 | C SLA-74-0270, Sandia Laboratories, June 1974. | ||
1297 | 296 | C***ROUTINES CALLED PVALUE, XERMSG | ||
1298 | 297 | C***REVISION HISTORY (YYMMDD) | ||
1299 | 298 | C 740601 DATE WRITTEN | ||
1300 | 299 | C 890531 Changed all specific intrinsics to generic. (WRB) | ||
1301 | 300 | C 890531 REVISION DATE from Version 3.2 | ||
1302 | 301 | C 891214 Prologue converted to Version 4.0 format. (BAB) | ||
1303 | 302 | C 900315 CALLs to XERROR changed to CALLs to XERMSG. (THJ) | ||
1304 | 303 | C 920501 Reformatted the REFERENCES section. (WRB) | ||
1305 | 304 | C 920527 Corrected erroneous statements in DESCRIPTION. (WRB) | ||
1306 | 305 | C*** END PROLOGUE POLFIT | ||
1307 | 306 | IMPLICIT DOUBLE PRECISION (A-H, O-Z) | ||
1308 | 307 | DOUBLE PRECISION TEMD1,TEMD2 | ||
1309 | 308 | DIMENSION X(*), Y(*), W(*), R(*), A(*), YP(0) | ||
1310 | 309 | DIMENSION CO(4,3) | ||
1311 | 310 | SAVE CO | ||
1312 | 311 | DATA CO(1,1), CO(2,1), CO(3,1), CO(4,1), CO(1,2), CO(2,2), | ||
1313 | 312 | 1 CO(3,2), CO(4,2), CO(1,3), CO(2,3), CO(3,3), | ||
1314 | 313 | 2 CO(4,3)/-13.086850,-2.4648165,-3.3846535,-1.2973162, | ||
1315 | 314 | 3 -3.3381146,-1.7812271,-3.2578406,-1.6589279, | ||
1316 | 315 | 4 -1.6282703,-1.3152745,-3.2640179,-1.9829776/ | ||
1317 | 316 | C*** FIRST EXECUTABLE STATEMENT POLFIT | ||
1318 | 317 | M = ABS(N) | ||
1319 | 318 | IF (M .EQ. 0) GO TO 30 | ||
1320 | 319 | IF (MAXDEG .LT. 0) GO TO 30 | ||
1321 | 320 | A(1) = MAXDEG | ||
1322 | 321 | MOP1 = MAXDEG + 1 | ||
1323 | 322 | IF (M .LT. MOP1) GO TO 30 | ||
1324 | 323 | IF (EPS .LT. 0.0 .AND. M .EQ. MOP1) GO TO 30 | ||
1325 | 324 | XM = M | ||
1326 | 325 | ETST = EPS*EPS*XM | ||
1327 | 326 | IF (W(1) .LT. 0.0) GO TO 2 | ||
1328 | 327 | DO I = 1,M | ||
1329 | 328 | IF (W(I) .LE. 0.0) GO TO 30 | ||
1330 | 329 | enddo | ||
1331 | 330 | GO TO 4 | ||
1332 | 331 | 2 DO I = 1,M | ||
1333 | 332 | W(I) = 1.0 | ||
1334 | 333 | enddo | ||
1335 | 334 | 4 IF (EPS .GE. 0.0) GO TO 8 | ||
1336 | 335 | C | ||
1337 | 336 | C DETERMINE SIGNIFICANCE LEVEL INDEX TO BE USED IN STATISTICAL TEST FOR | ||
1338 | 337 | C CHOOSING DEGREE OF POLYNOMIAL FIT | ||
1339 | 338 | C | ||
1340 | 339 | IF (EPS .GT. (-.55)) GO TO 5 | ||
1341 | 340 | IDEGF = M - MAXDEG - 1 | ||
1342 | 341 | KSIG = 1 | ||
1343 | 342 | IF (IDEGF .LT. 10) KSIG = 2 | ||
1344 | 343 | IF (IDEGF .LT. 5) KSIG = 3 | ||
1345 | 344 | GO TO 8 | ||
1346 | 345 | 5 KSIG = 1 | ||
1347 | 346 | IF (EPS .LT. (-.03)) KSIG = 2 | ||
1348 | 347 | IF (EPS .LT. (-.07)) KSIG = 3 | ||
1349 | 348 | C | ||
1350 | 349 | C INITIALIZE INDEXES AND COEFFICIENTS FOR FITTING | ||
1351 | 350 | C | ||
1352 | 351 | 8 K1 = MAXDEG + 1 | ||
1353 | 352 | K2 = K1 + MAXDEG | ||
1354 | 353 | K3 = K2 + MAXDEG + 2 | ||
1355 | 354 | K4 = K3 + M | ||
1356 | 355 | K5 = K4 + M | ||
1357 | 356 | DO I = 2,K4 | ||
1358 | 357 | A(I) = 0.0 | ||
1359 | 358 | enddo | ||
1360 | 359 | W11 = 0.0 | ||
1361 | 360 | IF (N .LT. 0) GO TO 11 | ||
1362 | 361 | C | ||
1363 | 362 | C UNCONSTRAINED CASE | ||
1364 | 363 | C | ||
1365 | 364 | DO I = 1,M | ||
1366 | 365 | K4PI = K4 + I | ||
1367 | 366 | A(K4PI) = 1.0 | ||
1368 | 367 | W11 = W11 + W(I) | ||
1369 | 368 | enddo | ||
1370 | 369 | GO TO 13 | ||
1371 | 370 | C | ||
1372 | 371 | C CONSTRAINED CASE | ||
1373 | 372 | C | ||
1374 | 373 | 11 DO I = 1,M | ||
1375 | 374 | K4PI = K4 + I | ||
1376 | 375 | W11 = W11 + W(I)*A(K4PI)**2 | ||
1377 | 376 | enddo | ||
1378 | 377 | C | ||
1379 | 378 | C COMPUTE FIT OF DEGREE ZERO | ||
1380 | 379 | C | ||
1381 | 380 | 13 TEMD1 = 0.0D0 | ||
1382 | 381 | DO I = 1,M | ||
1383 | 382 | K4PI = K4 + I | ||
1384 | 383 | TEMD1 = TEMD1 + DBLE(W(I))*DBLE(Y(I))*DBLE(A(K4PI)) | ||
1385 | 384 | enddo | ||
1386 | 385 | TEMD1 = TEMD1/DBLE(W11) | ||
1387 | 386 | A(K2+1) = TEMD1 | ||
1388 | 387 | SIGJ = 0.0 | ||
1389 | 388 | DO I = 1,M | ||
1390 | 389 | K4PI = K4 + I | ||
1391 | 390 | K5PI = K5 + I | ||
1392 | 391 | TEMD2 = TEMD1*DBLE(A(K4PI)) | ||
1393 | 392 | R(I) = TEMD2 | ||
1394 | 393 | A(K5PI) = TEMD2 - DBLE(R(I)) | ||
1395 | 394 | SIGJ = SIGJ + W(I)*((Y(I)-R(I)) - A(K5PI))**2 | ||
1396 | 395 | enddo | ||
1397 | 396 | J = 0 | ||
1398 | 397 | C | ||
1399 | 398 | C SEE IF POLYNOMIAL OF DEGREE 0 SATISFIES THE DEGREE SELECTION CRITERION | ||
1400 | 399 | C | ||
1401 | 400 | if (eps.lt.0d0) then | ||
1402 | 401 | goto 24 | ||
1403 | 402 | elseif (eps.eq.0d0) then | ||
1404 | 403 | goto 26 | ||
1405 | 404 | else | ||
1406 | 405 | goto 27 | ||
1407 | 406 | endif | ||
1408 | 407 | |||
1409 | 408 | C | ||
1410 | 409 | C INCREMENT DEGREE | ||
1411 | 410 | C | ||
1412 | 411 | 16 J = J + 1 | ||
1413 | 412 | JP1 = J + 1 | ||
1414 | 413 | K1PJ = K1 + J | ||
1415 | 414 | K2PJ = K2 + J | ||
1416 | 415 | SIGJM1 = SIGJ | ||
1417 | 416 | C | ||
1418 | 417 | C COMPUTE NEW B COEFFICIENT EXCEPT WHEN J = 1 | ||
1419 | 418 | C | ||
1420 | 419 | IF (J .GT. 1) A(K1PJ) = W11/W1 | ||
1421 | 420 | C | ||
1422 | 421 | C COMPUTE NEW A COEFFICIENT | ||
1423 | 422 | C | ||
1424 | 423 | TEMD1 = 0.0D0 | ||
1425 | 424 | DO I = 1,M | ||
1426 | 425 | K4PI = K4 + I | ||
1427 | 426 | TEMD2 = A(K4PI) | ||
1428 | 427 | TEMD1 = TEMD1 + DBLE(X(I))*DBLE(W(I))*TEMD2*TEMD2 | ||
1429 | 428 | enddo | ||
1430 | 429 | A(JP1) = TEMD1/DBLE(W11) | ||
1431 | 430 | C | ||
1432 | 431 | C EVALUATE ORTHOGONAL POLYNOMIAL AT DATA POINTS | ||
1433 | 432 | C | ||
1434 | 433 | W1 = W11 | ||
1435 | 434 | W11 = 0.0 | ||
1436 | 435 | DO I = 1,M | ||
1437 | 436 | K3PI = K3 + I | ||
1438 | 437 | K4PI = K4 + I | ||
1439 | 438 | TEMP = A(K3PI) | ||
1440 | 439 | A(K3PI) = A(K4PI) | ||
1441 | 440 | A(K4PI) = (X(I)-A(JP1))*A(K3PI) - A(K1PJ)*TEMP | ||
1442 | 441 | W11 = W11 + W(I)*A(K4PI)**2 | ||
1443 | 442 | enddo | ||
1444 | 443 | C | ||
1445 | 444 | C GET NEW ORTHOGONAL POLYNOMIAL COEFFICIENT USING PARTIAL DOUBLE | ||
1446 | 445 | C PRECISION | ||
1447 | 446 | C | ||
1448 | 447 | TEMD1 = 0.0D0 | ||
1449 | 448 | DO I = 1,M | ||
1450 | 449 | K4PI = K4 + I | ||
1451 | 450 | K5PI = K5 + I | ||
1452 | 451 | TEMD2 = DBLE(W(I))*DBLE((Y(I)-R(I))-A(K5PI))*DBLE(A(K4PI)) | ||
1453 | 452 | TEMD1 = TEMD1 + TEMD2 | ||
1454 | 453 | enddo | ||
1455 | 454 | TEMD1 = TEMD1/DBLE(W11) | ||
1456 | 455 | A(K2PJ+1) = TEMD1 | ||
1457 | 456 | C | ||
1458 | 457 | C UPDATE POLYNOMIAL EVALUATIONS AT EACH OF THE DATA POINTS, AND | ||
1459 | 458 | C ACCUMULATE SUM OF SQUARES OF ERRORS. THE POLYNOMIAL EVALUATIONS ARE | ||
1460 | 459 | C COMPUTED AND STORED IN EXTENDED PRECISION. FOR THE I-TH DATA POINT, | ||
1461 | 460 | C THE MOST SIGNIFICANT BITS ARE STORED IN R(I) , AND THE LEAST | ||
1462 | 461 | C SIGNIFICANT BITS ARE IN A(K5PI) . | ||
1463 | 462 | C | ||
1464 | 463 | SIGJ = 0.0 | ||
1465 | 464 | DO I = 1,M | ||
1466 | 465 | K4PI = K4 + I | ||
1467 | 466 | K5PI = K5 + I | ||
1468 | 467 | TEMD2 = DBLE(R(I)) + DBLE(A(K5PI)) + TEMD1*DBLE(A(K4PI)) | ||
1469 | 468 | R(I) = TEMD2 | ||
1470 | 469 | A(K5PI) = TEMD2 - DBLE(R(I)) | ||
1471 | 470 | SIGJ = SIGJ + W(I)*((Y(I)-R(I)) - A(K5PI))**2 | ||
1472 | 471 | enddo | ||
1473 | 472 | C | ||
1474 | 473 | C SEE IF DEGREE SELECTION CRITERION HAS BEEN SATISFIED OR IF DEGREE | ||
1475 | 474 | C MAXDEG HAS BEEN REACHED | ||
1476 | 475 | C | ||
1477 | 476 | if (eps.lt.0d0) then | ||
1478 | 477 | goto 23 | ||
1479 | 478 | elseif (eps.eq.0d0) then | ||
1480 | 479 | goto 26 | ||
1481 | 480 | else | ||
1482 | 481 | goto 27 | ||
1483 | 482 | endif | ||
1484 | 483 | C | ||
1485 | 484 | C COMPUTE F STATISTICS (INPUT EPS .LT. 0.) | ||
1486 | 485 | C | ||
1487 | 486 | 23 IF (SIGJ .EQ. 0.0) GO TO 29 | ||
1488 | 487 | DEGF = M - J - 1 | ||
1489 | 488 | DEN = (CO(4,KSIG)*DEGF + 1.0)*DEGF | ||
1490 | 489 | FCRIT = (((CO(3,KSIG)*DEGF) + CO(2,KSIG))*DEGF + CO(1,KSIG))/DEN | ||
1491 | 490 | FCRIT = FCRIT*FCRIT | ||
1492 | 491 | F = (SIGJM1 - SIGJ)*DEGF/SIGJ | ||
1493 | 492 | IF (F .LT. FCRIT) GO TO 25 | ||
1494 | 493 | C | ||
1495 | 494 | C POLYNOMIAL OF DEGREE J SATISFIES F TEST | ||
1496 | 495 | C | ||
1497 | 496 | 24 SIGPAS = SIGJ | ||
1498 | 497 | JPAS = J | ||
1499 | 498 | NFAIL = 0 | ||
1500 | 499 | IF (MAXDEG .EQ. J) GO TO 32 | ||
1501 | 500 | GO TO 16 | ||
1502 | 501 | C | ||
1503 | 502 | C POLYNOMIAL OF DEGREE J FAILS F TEST. IF THERE HAVE BEEN THREE | ||
1504 | 503 | C SUCCESSIVE FAILURES, A STATISTICALLY BEST DEGREE HAS BEEN FOUND. | ||
1505 | 504 | C | ||
1506 | 505 | 25 NFAIL = NFAIL + 1 | ||
1507 | 506 | IF (NFAIL .GE. 3) GO TO 29 | ||
1508 | 507 | IF (MAXDEG .EQ. J) GO TO 32 | ||
1509 | 508 | GO TO 16 | ||
1510 | 509 | C | ||
1511 | 510 | C RAISE THE DEGREE IF DEGREE MAXDEG HAS NOT YET BEEN REACHED (INPUT | ||
1512 | 511 | C EPS = 0.) | ||
1513 | 512 | C | ||
1514 | 513 | 26 IF (MAXDEG .EQ. J) GO TO 28 | ||
1515 | 514 | GO TO 16 | ||
1516 | 515 | C | ||
1517 | 516 | C SEE IF RMS ERROR CRITERION IS SATISFIED (INPUT EPS .GT. 0.) | ||
1518 | 517 | C | ||
1519 | 518 | 27 IF (SIGJ .LE. ETST) GO TO 28 | ||
1520 | 519 | IF (MAXDEG .EQ. J) GO TO 31 | ||
1521 | 520 | GO TO 16 | ||
1522 | 521 | C | ||
1523 | 522 | C RETURNS | ||
1524 | 523 | C | ||
1525 | 524 | 28 IERR = 1 | ||
1526 | 525 | NDEG = J | ||
1527 | 526 | SIG = SIGJ | ||
1528 | 527 | GO TO 33 | ||
1529 | 528 | 29 IERR = 1 | ||
1530 | 529 | NDEG = JPAS | ||
1531 | 530 | SIG = SIGPAS | ||
1532 | 531 | GO TO 33 | ||
1533 | 532 | 30 IERR = 2 | ||
1534 | 533 | write (*,*) 'SLATEC', 'POLFIT', 'INVALID INPUT PARAMETER.', 2, | ||
1535 | 534 | + 1 | ||
1536 | 535 | stop 1 | ||
1537 | 536 | GO TO 37 | ||
1538 | 537 | 31 IERR = 3 | ||
1539 | 538 | NDEG = MAXDEG | ||
1540 | 539 | SIG = SIGJ | ||
1541 | 540 | GO TO 33 | ||
1542 | 541 | 32 IERR = 4 | ||
1543 | 542 | NDEG = JPAS | ||
1544 | 543 | SIG = SIGPAS | ||
1545 | 544 | C | ||
1546 | 545 | 33 A(K3) = NDEG | ||
1547 | 546 | C | ||
1548 | 547 | C WHEN STATISTICAL TEST HAS BEEN USED, EVALUATE THE BEST POLYNOMIAL AT | ||
1549 | 548 | C ALL THE DATA POINTS IF R DOES NOT ALREADY CONTAIN THESE VALUES | ||
1550 | 549 | C | ||
1551 | 550 | IF(EPS .GE. 0.0 .OR. NDEG .EQ. MAXDEG) GO TO 36 | ||
1552 | 551 | NDER = 0 | ||
1553 | 552 | DO I = 1,M | ||
1554 | 553 | CALL PVALUE (NDEG,NDER,X(I),R(I),YP,A) | ||
1555 | 554 | enddo | ||
1556 | 555 | 36 EPS = SQRT(SIG/XM) | ||
1557 | 556 | 37 RETURN | ||
1558 | 557 | END | ||
1559 | 558 | |||
1560 | 559 | |||
1561 | 560 | *DECK PVALUE | ||
1562 | 561 | SUBROUTINE PVALUE (L, NDER, X, YFIT, YP, A) | ||
1563 | 562 | c | ||
1564 | 563 | cRF: make double precision and replace DO-loops to comply with more | ||
1565 | 564 | c modern standards | ||
1566 | 565 | c | ||
1567 | 566 | C***BEGIN PROLOGUE PVALUE | ||
1568 | 567 | C***PURPOSE Use the coefficients generated by POLFIT to evaluate the | ||
1569 | 568 | C polynomial fit of degree L, along with the first NDER of | ||
1570 | 569 | C its derivatives, at a specified point. | ||
1571 | 570 | C***LIBRARY SLATEC | ||
1572 | 571 | C***CATEGORY K6 | ||
1573 | 572 | C***TYPE SINGLE PRECISION (PVALUE-S, DP1VLU-D) | ||
1574 | 573 | C***KEYWORDS CURVE FITTING, LEAST SQUARES, POLYNOMIAL APPROXIMATION | ||
1575 | 574 | C***AUTHOR Shampine, L. F., (SNLA) | ||
1576 | 575 | C Davenport, S. M., (SNLA) | ||
1577 | 576 | C***DESCRIPTION | ||
1578 | 577 | C | ||
1579 | 578 | C Written by L. F. Shampine and S. M. Davenport. | ||
1580 | 579 | C | ||
1581 | 580 | C Abstract | ||
1582 | 581 | C | ||
1583 | 582 | C The subroutine PVALUE uses the coefficients generated by POLFIT | ||
1584 | 583 | C to evaluate the polynomial fit of degree L , along with the first | ||
1585 | 584 | C NDER of its derivatives, at a specified point. Computationally | ||
1586 | 585 | C stable recurrence relations are used to perform this task. | ||
1587 | 586 | C | ||
1588 | 587 | C The parameters for PVALUE are | ||
1589 | 588 | C | ||
1590 | 589 | C Input -- | ||
1591 | 590 | C L - the degree of polynomial to be evaluated. L may be | ||
1592 | 591 | C any non-negative integer which is less than or equal | ||
1593 | 592 | C to NDEG , the highest degree polynomial provided | ||
1594 | 593 | C by POLFIT . | ||
1595 | 594 | C NDER - the number of derivatives to be evaluated. NDER | ||
1596 | 595 | C may be 0 or any positive value. If NDER is less | ||
1597 | 596 | C than 0, it will be treated as 0. | ||
1598 | 597 | C X - the argument at which the polynomial and its | ||
1599 | 598 | C derivatives are to be evaluated. | ||
1600 | 599 | C A - work and output array containing values from last | ||
1601 | 600 | C call to POLFIT . | ||
1602 | 601 | C | ||
1603 | 602 | C Output -- | ||
1604 | 603 | C YFIT - value of the fitting polynomial of degree L at X | ||
1605 | 604 | C YP - array containing the first through NDER derivatives | ||
1606 | 605 | C of the polynomial of degree L . YP must be | ||
1607 | 606 | C dimensioned at least NDER in the calling program. | ||
1608 | 607 | C | ||
1609 | 608 | C***REFERENCES L. F. Shampine, S. M. Davenport and R. E. Huddleston, | ||
1610 | 609 | C Curve fitting by polynomials in one variable, Report | ||
1611 | 610 | C SLA-74-0270, Sandia Laboratories, June 1974. | ||
1612 | 611 | C***ROUTINES CALLED XERMSG | ||
1613 | 612 | C***REVISION HISTORY (YYMMDD) | ||
1614 | 613 | C 740601 DATE WRITTEN | ||
1615 | 614 | C 890531 Changed all specific intrinsics to generic. (WRB) | ||
1616 | 615 | C 890531 REVISION DATE from Version 3.2 | ||
1617 | 616 | C 891214 Prologue converted to Version 4.0 format. (BAB) | ||
1618 | 617 | C 900315 CALLs to XERROR changed to CALLs to XERMSG. (THJ) | ||
1619 | 618 | C 900510 Convert XERRWV calls to XERMSG calls. (RWC) | ||
1620 | 619 | C 920501 Reformatted the REFERENCES section. (WRB) | ||
1621 | 620 | C*** END PROLOGUE PVALUE | ||
1622 | 621 | IMPLICIT DOUBLE PRECISION (A-H, O-Z) | ||
1623 | 622 | DIMENSION YP(*),A(*) | ||
1624 | 623 | CHARACTER*8 XERN1, XERN2 | ||
1625 | 624 | C***FIRST EXECUTABLE STATEMENT PVALUE | ||
1626 | 625 | IF (L .LT. 0) GO TO 12 | ||
1627 | 626 | NDO = MAX(NDER,0) | ||
1628 | 627 | NDO = MIN(NDO,L) | ||
1629 | 628 | MAXORD = A(1) + 0.5 | ||
1630 | 629 | K1 = MAXORD + 1 | ||
1631 | 630 | K2 = K1 + MAXORD | ||
1632 | 631 | K3 = K2 + MAXORD + 2 | ||
1633 | 632 | NORD = A(K3) + 0.5 | ||
1634 | 633 | IF (L .GT. NORD) GO TO 11 | ||
1635 | 634 | K4 = K3 + L + 1 | ||
1636 | 635 | IF (NDER .LT. 1) GO TO 2 | ||
1637 | 636 | DO I = 1,NDER | ||
1638 | 637 | YP(I) = 0.0 | ||
1639 | 638 | enddo | ||
1640 | 639 | 2 IF (L .GE. 2) GO TO 4 | ||
1641 | 640 | IF (L .EQ. 1) GO TO 3 | ||
1642 | 641 | C | ||
1643 | 642 | C L IS 0 | ||
1644 | 643 | C | ||
1645 | 644 | VAL = A(K2+1) | ||
1646 | 645 | GO TO 10 | ||
1647 | 646 | C | ||
1648 | 647 | C L IS 1 | ||
1649 | 648 | C | ||
1650 | 649 | 3 CC = A(K2+2) | ||
1651 | 650 | VAL = A(K2+1) + (X-A(2))*CC | ||
1652 | 651 | IF (NDER .GE. 1) YP(1) = CC | ||
1653 | 652 | GO TO 10 | ||
1654 | 653 | C | ||
1655 | 654 | C L IS GREATER THAN 1 | ||
1656 | 655 | C | ||
1657 | 656 | 4 NDP1 = NDO + 1 | ||
1658 | 657 | K3P1 = K3 + 1 | ||
1659 | 658 | K4P1 = K4 + 1 | ||
1660 | 659 | LP1 = L + 1 | ||
1661 | 660 | LM1 = L - 1 | ||
1662 | 661 | ILO = K3 + 3 | ||
1663 | 662 | IUP = K4 + NDP1 | ||
1664 | 663 | DO I = ILO,IUP | ||
1665 | 664 | A(I) = 0.0 | ||
1666 | 665 | enddo | ||
1667 | 666 | DIF = X - A(LP1) | ||
1668 | 667 | KC = K2 + LP1 | ||
1669 | 668 | A(K4P1) = A(KC) | ||
1670 | 669 | A(K3P1) = A(KC-1) + DIF*A(K4P1) | ||
1671 | 670 | A(K3+2) = A(K4P1) | ||
1672 | 671 | C | ||
1673 | 672 | C EVALUATE RECURRENCE RELATIONS FOR FUNCTION VALUE AND DERIVATIVES | ||
1674 | 673 | C | ||
1675 | 674 | DO I = 1,LM1 | ||
1676 | 675 | IN = L - I | ||
1677 | 676 | INP1 = IN + 1 | ||
1678 | 677 | K1I = K1 + INP1 | ||
1679 | 678 | IC = K2 + IN | ||
1680 | 679 | DIF = X - A(INP1) | ||
1681 | 680 | VAL = A(IC) + DIF*A(K3P1) - A(K1I)*A(K4P1) | ||
1682 | 681 | IF (NDO .LE. 0) GO TO 8 | ||
1683 | 682 | DO N = 1,NDO | ||
1684 | 683 | K3PN = K3P1 + N | ||
1685 | 684 | K4PN = K4P1 + N | ||
1686 | 685 | YP(N) = DIF*A(K3PN) + N*A(K3PN-1) - A(K1I)*A(K4PN) | ||
1687 | 686 | enddo | ||
1688 | 687 | C | ||
1689 | 688 | C SAVE VALUES NEEDED FOR NEXT EVALUATION OF RECURRENCE RELATIONS | ||
1690 | 689 | C | ||
1691 | 690 | DO N = 1,NDO | ||
1692 | 691 | K3PN = K3P1 + N | ||
1693 | 692 | K4PN = K4P1 + N | ||
1694 | 693 | A(K4PN) = A(K3PN) | ||
1695 | 694 | A(K3PN) = YP(N) | ||
1696 | 695 | enddo | ||
1697 | 696 | 8 A(K4P1) = A(K3P1) | ||
1698 | 697 | A(K3P1) = VAL | ||
1699 | 698 | enddo | ||
1700 | 699 | C | ||
1701 | 700 | C NORMAL RETURN OR ABORT DUE TO ERROR | ||
1702 | 701 | C | ||
1703 | 702 | 10 YFIT = VAL | ||
1704 | 703 | RETURN | ||
1705 | 704 | C | ||
1706 | 705 | 11 WRITE (XERN1, '(I8)') L | ||
1707 | 706 | WRITE (XERN2, '(I8)') NORD | ||
1708 | 707 | write (*,*) 'SLATEC', 'PVALUE', | ||
1709 | 708 | * 'THE ORDER OF POLYNOMIAL EVALUATION, L = ' // XERN1 // | ||
1710 | 709 | * ' REQUESTED EXCEEDS THE HIGHEST ORDER FIT, NORD = ' // XERN2 // | ||
1711 | 710 | * ', COMPUTED BY POLFIT -- EXECUTION TERMINATED.', 8, 2 | ||
1712 | 711 | stop 1 | ||
1713 | 712 | RETURN | ||
1714 | 713 | C | ||
1715 | 714 | 12 write (*,*) 'SLATEC', 'PVALUE', | ||
1716 | 715 | + 'INVALID INPUT PARAMETER. ORDER OF POLYNOMIAL EVALUATION ' // | ||
1717 | 716 | + 'REQUESTED IS NEGATIVE -- EXECUTION TERMINATED.', 2, 2 | ||
1718 | 717 | stop 1 | ||
1719 | 718 | RETURN | ||
1720 | 719 | END | ||
1721 | 720 | |||
1722 | 0 | 721 | ||
1723 | === modified file 'madgraph/interface/amcatnlo_run_interface.py' | |||
1724 | --- madgraph/interface/amcatnlo_run_interface.py 2019-08-28 08:02:11 +0000 | |||
1725 | +++ madgraph/interface/amcatnlo_run_interface.py 2019-09-12 11:14:33 +0000 | |||
1726 | @@ -2376,9 +2376,12 @@ | |||
1727 | 2376 | # latter is only the only line that contains integers. | 2376 | # latter is only the only line that contains integers. |
1728 | 2377 | for j,fs in enumerate([files_mint_grids,files_MC_integer]): | 2377 | for j,fs in enumerate([files_mint_grids,files_MC_integer]): |
1729 | 2378 | linesoffiles=[] | 2378 | linesoffiles=[] |
1730 | 2379 | polyfit_data=[] | ||
1731 | 2379 | for f in fs: | 2380 | for f in fs: |
1732 | 2380 | with open(f,'r+') as fi: | 2381 | with open(f,'r+') as fi: |
1734 | 2381 | linesoffiles.append(fi.readlines()) | 2382 | data=fi.readlines() |
1735 | 2383 | linesoffiles.append([ dat for dat in data if 'POL' not in dat.split()[0] ]) | ||
1736 | 2384 | polyfit_data.append([ dat for dat in data if 'POL' in dat.split()[0] ]) | ||
1737 | 2382 | to_write=[] | 2385 | to_write=[] |
1738 | 2383 | for rowgrp in zip(*linesoffiles): | 2386 | for rowgrp in zip(*linesoffiles): |
1739 | 2384 | action=list(set([row.strip().split()[0] for row in rowgrp])) # list(set()) structure to remove duplicants | 2387 | action=list(set([row.strip().split()[0] for row in rowgrp])) # list(set()) structure to remove duplicants |
1740 | @@ -2414,8 +2417,30 @@ | |||
1741 | 2414 | write_string.append(int(sum(floatgrp)/len(floatgrp))) | 2417 | write_string.append(int(sum(floatgrp)/len(floatgrp))) |
1742 | 2415 | else: | 2418 | else: |
1743 | 2416 | raise aMCatNLOError('Unknown action for combining grids: %s' % action[0]) | 2419 | raise aMCatNLOError('Unknown action for combining grids: %s' % action[0]) |
1744 | 2417 | |||
1745 | 2418 | to_write.append(action[0] + " " + (" ".join(str(ws) for ws in write_string)) + "\n") | 2420 | to_write.append(action[0] + " " + (" ".join(str(ws) for ws in write_string)) + "\n") |
1746 | 2421 | |||
1747 | 2422 | if polyfit_data: | ||
1748 | 2423 | # special for data regarding virtuals. Need to simply append | ||
1749 | 2424 | # all the data, but skipping doubles. | ||
1750 | 2425 | for i,onefile in enumerate(polyfit_data): | ||
1751 | 2426 | # Get the number of channels, and the number of PS points per channel | ||
1752 | 2427 | data_amount_in_file=[int(oneline.split()[1]) for oneline in onefile if len(oneline.split())==2] | ||
1753 | 2428 | if i==0: | ||
1754 | 2429 | filtered_list=[ [] for i in range(len(data_amount_in_file)) ] | ||
1755 | 2430 | start=len(data_amount_in_file) | ||
1756 | 2431 | for channel,channel_size in enumerate(data_amount_in_file): | ||
1757 | 2432 | end=start+channel_size | ||
1758 | 2433 | for data_channel in onefile[start:end]: | ||
1759 | 2434 | if data_channel not in filtered_list[channel]: | ||
1760 | 2435 | filtered_list[channel].append(data_channel) | ||
1761 | 2436 | start=end | ||
1762 | 2437 | # The amount of data in each file (per channel): | ||
1763 | 2438 | for channel in filtered_list: | ||
1764 | 2439 | to_write.append("POL " + str(len(channel)) + "\n") | ||
1765 | 2440 | # All the data: | ||
1766 | 2441 | for ch in filtered_list: | ||
1767 | 2442 | for dat in ch: | ||
1768 | 2443 | to_write.append(dat) | ||
1769 | 2419 | # write the data over the master location | 2444 | # write the data over the master location |
1770 | 2420 | if j==0: | 2445 | if j==0: |
1771 | 2421 | with open(pjoin(location,'mint_grids'),'w') as f: | 2446 | with open(pjoin(location,'mint_grids'),'w') as f: |
1772 | 2422 | 2447 | ||
1773 | === modified file 'madgraph/iolibs/export_fks.py' | |||
1774 | --- madgraph/iolibs/export_fks.py 2019-08-15 13:09:08 +0000 | |||
1775 | +++ madgraph/iolibs/export_fks.py 2019-09-12 11:14:33 +0000 | |||
1776 | @@ -624,8 +624,7 @@ | |||
1777 | 624 | 'FKS_params.dat', | 624 | 'FKS_params.dat', |
1778 | 625 | 'initial_states_map.dat', | 625 | 'initial_states_map.dat', |
1779 | 626 | 'OLE_order.olc', | 626 | 'OLE_order.olc', |
1782 | 627 | 'FKSParams.inc', | 627 | 'FKSParams.f90', |
1781 | 628 | 'FKSParamReader.f', | ||
1783 | 629 | 'cuts.inc', | 628 | 'cuts.inc', |
1784 | 630 | 'unlops.inc', | 629 | 'unlops.inc', |
1785 | 631 | 'pythia_unlops.f', | 630 | 'pythia_unlops.f', |
1786 | @@ -688,7 +687,8 @@ | |||
1787 | 688 | 'randinit', | 687 | 'randinit', |
1788 | 689 | 'sudakov.inc', | 688 | 'sudakov.inc', |
1789 | 690 | 'maxconfigs.inc', | 689 | 'maxconfigs.inc', |
1791 | 691 | 'timing_variables.inc'] | 690 | 'timing_variables.inc', |
1792 | 691 | 'polfit.f'] | ||
1793 | 692 | 692 | ||
1794 | 693 | for file in linkfiles: | 693 | for file in linkfiles: |
1795 | 694 | ln('../' + file , '.') | 694 | ln('../' + file , '.') |
1796 | @@ -1149,24 +1149,26 @@ | |||
1797 | 1149 | 1149 | ||
1798 | 1150 | amp_split_size=len(amp_split_orders) | 1150 | amp_split_size=len(amp_split_orders) |
1799 | 1151 | 1151 | ||
1801 | 1152 | text = 'C The orders to be integrated for the Born and at NLO\n' | 1152 | text = '! The orders to be integrated for the Born and at NLO\n' |
1802 | 1153 | text += 'integer nsplitorders\n' | 1153 | text += 'integer nsplitorders\n' |
1803 | 1154 | text += 'parameter (nsplitorders=%d)\n' % len(split_orders) | 1154 | text += 'parameter (nsplitorders=%d)\n' % len(split_orders) |
1804 | 1155 | text += 'character*3 ordernames(nsplitorders)\n' | 1155 | text += 'character*3 ordernames(nsplitorders)\n' |
1805 | 1156 | text += 'data ordernames / %s /\n' % ', '.join(['"%3s"' % o for o in split_orders]) | 1156 | text += 'data ordernames / %s /\n' % ', '.join(['"%3s"' % o for o in split_orders]) |
1806 | 1157 | text += 'integer born_orders(nsplitorders), nlo_orders(nsplitorders)\n' | 1157 | text += 'integer born_orders(nsplitorders), nlo_orders(nsplitorders)\n' |
1808 | 1158 | text += 'C the order of the coupling orders is %s\n' % ', '.join(split_orders) | 1158 | text += '! the order of the coupling orders is %s\n' % ', '.join(split_orders) |
1809 | 1159 | text += 'data born_orders / %s /\n' % ', '.join([str(max_born_orders[o]) for o in split_orders]) | 1159 | text += 'data born_orders / %s /\n' % ', '.join([str(max_born_orders[o]) for o in split_orders]) |
1810 | 1160 | text += 'data nlo_orders / %s /\n' % ', '.join([str(max_nlo_orders[o]) for o in split_orders]) | 1160 | text += 'data nlo_orders / %s /\n' % ', '.join([str(max_nlo_orders[o]) for o in split_orders]) |
1812 | 1161 | text += 'C The position of the QCD /QED orders in the array\n' | 1161 | text += '! The position of the QCD /QED orders in the array\n' |
1813 | 1162 | text += 'integer qcd_pos, qed_pos\n' | 1162 | text += 'integer qcd_pos, qed_pos\n' |
1815 | 1163 | text += 'C if = -1, then it is not in the split_orders\n' | 1163 | text += '! if = -1, then it is not in the split_orders\n' |
1816 | 1164 | text += 'parameter (qcd_pos = %d)\n' % qcd_pos | 1164 | text += 'parameter (qcd_pos = %d)\n' % qcd_pos |
1817 | 1165 | text += 'parameter (qed_pos = %d)\n' % qed_pos | 1165 | text += 'parameter (qed_pos = %d)\n' % qed_pos |
1819 | 1166 | text += 'C this is to keep track of the various coupling combinations entering each ME\n' | 1166 | text += '! this is to keep track of the various \n' |
1820 | 1167 | text += '! coupling combinations entering each ME\n' | ||
1821 | 1167 | text += 'integer amp_split_size, amp_split_size_born\n' | 1168 | text += 'integer amp_split_size, amp_split_size_born\n' |
1822 | 1168 | text += 'parameter (amp_split_size = %d)\n' % amp_split_size | 1169 | text += 'parameter (amp_split_size = %d)\n' % amp_split_size |
1824 | 1169 | text += 'parameter (amp_split_size_born = %d) ! the first entries in amp_split are for the born\n' % amp_split_size_born | 1170 | text += '! the first entries in the next line in amp_split are for the born \n' |
1825 | 1171 | text += 'parameter (amp_split_size_born = %d)\n' % amp_split_size_born | ||
1826 | 1170 | text += 'double precision amp_split(amp_split_size)\n' | 1172 | text += 'double precision amp_split(amp_split_size)\n' |
1827 | 1171 | text += 'double complex amp_split_cnt(amp_split_size,2,nsplitorders)\n' | 1173 | text += 'double complex amp_split_cnt(amp_split_size,2,nsplitorders)\n' |
1828 | 1172 | text += 'common /to_amp_split/amp_split, amp_split_cnt\n' | 1174 | text += 'common /to_amp_split/amp_split, amp_split_cnt\n' |
Thanks Rikkert,
the code changes look correct, for what I can understand of the polyfit module
I have tried p p > t t~ [QCD QED], results are compatible within the uncertainty (also split-order by split-order). The Polyfit run is generally (much) faster:
If I require 1 per mil accuracy for that process, without polyfit it took 18 minutes on my macbook, while with polyfit less than 8, so great job!!