Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
#!/usr/bin/perl
#************************************************************************#
# #
# Copyright 2014 Bertram Kopf (bertram@ep1.rub.de) #
# Julian Pychy (julian@ep1.rub.de) #
# - Ruhr-Universität Bochum #
# #
# This file is part of Pawian. #
# #
# Pawian is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. #
# #
# Pawian is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with Pawian. If not, see <http:#www.gnu.org/licenses/>. #
# #
#************************************************************************#
#######################################################
## ##
## pawianfixparameters ##
## ##
## This script generated the mnParFix list to be ##
## used in the Pawian configuration file. ##
## ##
## - Julian Pychy julian@ep1.rub.de ##
## ##
#######################################################
use strict;
use warnings;
use Getopt::Long;
my $showHelp=0;
my $filename="";
my $prio="";
GetOptions ("help|h" => \$showHelp,
"file=s" => \$filename,
"prio=s" => \$prio) or die "Bad arguments!";
if($showHelp){
Help();
exit;
}
if($filename eq "" || !(-e $filename)){
die "File not found.";
}
# Read the parameter file
open FILE, "<", $filename or die $!;
my @linesInFile;
while (<FILE>) {
push(@linesInFile, $_);
}
close FILE;
my @fixedproddec = FixProductionsAndDecays(\@linesInFile);
my @fixedisos = FixIsos(\@linesInFile);
my @fixedphase = Fixpbarp(\@linesInFile);
my @fixedpipiswave = FixPiPiSWave(\@linesInFile);
my @fixedkpiswave = FixKPiSWaveI12(\@linesInFile);
push(@fixedkpiswave, FixKPiSWaveI32(\@linesInFile));
my @fixedgenerickmatrix = FixGenericKMatrix(\@linesInFile);
my $numfixedproddec = @fixedproddec;
my $numfixedphase = @fixedphase;
my $numfixedpipiswave = @fixedpipiswave;
my $numfixedkpiswave = @fixedkpiswave;
my $numfixedisos = @fixedisos;
my $numfixedgenerickmatrix = @fixedgenerickmatrix;
my $numfixed = $numfixedproddec + $numfixedphase + $numfixedgenerickmatrix +
$numfixedpipiswave + $numfixedkpiswave + $numfixedisos;
print "\n\n";
print "##################################################\n";
print "## ##\n";
print "## Output from the pawianfixparameters script ##\n";
print "## ##\n";
print "##################################################\n";
print "#\n";
print "# Fixing $numfixed parameters\n";
print "#\n";
print "# !! The following list is given without any !!\n";
print "# !! guarantee and has to be checked by the analyst !!\n";
print "#\n\n";
my $fixedline;
print "##################################################\n";
print "# Fixing one pbarp singlet and one triplet phase #\n";
print "##################################################\n";
foreach $fixedline (@fixedphase){
print "mnParFix = ".$fixedline."\n";
}
print "\n";
print "##################################################\n";
print "# Fixing $numfixedproddec production and decay parameters\n";
print "##################################################\n";
foreach $fixedline (@fixedproddec){
print "mnParFix = ".$fixedline."\n";
}
print "\n";
print "##################################################\n";
print "# Fixing $numfixedisos isospin parameters\n";
print "##################################################\n";
foreach $fixedline (@fixedisos){
print "mnParFix = ".$fixedline."\n";
}
print "\n";
print "##################################################\n";
print "# Fixing $numfixedpipiswave PiPiS-wave parameters\n";
print "##################################################\n";
foreach $fixedline (@fixedpipiswave){
print "mnParFix = ".$fixedline."\n";
}
print "\n";
print "##################################################\n";
print "# Fixing $numfixedkpiswave KPiS-wave parameters\n";
print "##################################################\n";
foreach $fixedline (@fixedkpiswave){
print "mnParFix = ".$fixedline."\n";
}
print "\n";
print "##################################################\n";
print "# Fixing $numfixedgenerickmatrix generic k-matrix parameters\n";
print "##################################################\n";
foreach $fixedline (@fixedgenerickmatrix){
print "mnParFix = ".$fixedline."\n";
}
sub FixProductionsAndDecays
{
my @linesInFile = @{$_[0]};
my @fixedParams;
my @fixedSources;
foreach my $currentLine (@linesInFile){
if($currentLine =~ /Matrix/){
next;
}
if($currentLine =~ /(.*_(.*)To(.*))Mag.*/ ){
my $currentSource = $2;
my $currentDest = $3;
my $found = 0;
if(grep $_ eq $currentSource, @fixedSources){
$found = 1;
}
# Fix the priority system instead of this one
elsif(!($currentDest eq $prio)){
foreach my $alternative(@linesInFile){
if( $alternative =~ /(.*_(.*)To(.*))Mag.*/ ){
if(($currentSource eq $2) && ($prio eq $3)){
$found = 1;
last;
}
}
}
}
if($found == 0){
push(@fixedSources, $currentSource);
push(@fixedParams, $1."Mag");
push(@fixedParams, $1."Phi");
}
}
}
return @fixedParams;
}
sub FixIsos
{
my @linesInFile = @{$_[0]};
my @fixedParams;
my @fixedSources;
foreach my $currentLine (@linesInFile){
if( $currentLine =~ /(Iso.+)\s+(\S+)\s+\S+/){
push(@fixedParams, $1);
}
}
return @fixedParams;
}
sub Fixpbarp
{
my @linesInFile = @{$_[0]};
my @fixedParams;
my @fixedSources;
my $pbarpSingletIsFixed=0;
my $pbarpTripletIsFixed=0;
foreach my $currentLine (@linesInFile){
# Fix pbarp phases
if($currentLine =~ /(J.+P(.+)C(.+)L.+S.+pbarpPhi).*/){
if((($2 eq "1" && $3 eq "1") || ($2 eq "-1" && $3 eq "-1")) && $pbarpTripletIsFixed == 0){
push(@fixedParams, $1);
$pbarpTripletIsFixed = 1;
}
elsif((($2 eq "1" && $3 eq "-1") || ($2 eq "-1" && $3 eq "1")) && $pbarpSingletIsFixed == 0){
push(@fixedParams, $1);
$pbarpSingletIsFixed = 1;
}
}
}
if(!$pbarpSingletIsFixed || !$pbarpTripletIsFixed){
die "Failed to fix pbarp phases.";
}
return @fixedParams;
}
sub FixPiPiSWave
{
my @linesInFile = @{$_[0]};
my @fixedParams;
my @fixedSources;
foreach my $currentLine (@linesInFile){
if( $currentLine =~ /(.*_(.*)TopipiS.*)Mag.*/ ){
my $currentSource = $2;
if(!(grep $_ eq $currentSource, @fixedSources)){
push(@fixedSources, $currentSource);
push(@fixedParams, $1."Mag");
push(@fixedParams, $1."Phi");
}
}
elsif( $currentLine =~ /(pipiS.*S0_PosNegOther).*/){
push(@fixedParams, $1);
}
}
return @fixedParams;
}
sub FixKPiSWaveI12
{
my @linesInFile = @{$_[0]};
my @fixedParams;
foreach my $currentLine (@linesInFile){
if( $currentLine =~ /(.*_(.*)ToKpiS12_.*)Mag.*/ ){
my $currentSource = $2;
push(@fixedParams, $1."Mag");
push(@fixedParams, $1."Phi");
}
}
return @fixedParams;
}
sub FixKPiSWaveI32
{
my @linesInFile = @{$_[0]};
my @fixedParams;
foreach my $currentLine (@linesInFile){
if($currentLine =~ /(.*_(.*)ToKpiS32_.*)Mag.*/ ){
my $currentSource = $2;
push(@fixedParams, $1."Mag");
push(@fixedParams, $1."Phi");
}
}
return @fixedParams;
}
sub FixGenericKMatrix
{
my @linesInFile = @{$_[0]};
my @fixedParams;
my @fixedJPCKMat;
foreach my $currentLine (@linesInFile){
if($currentLine =~ /(.*Matrix.*To.*)Mag/){
push(@fixedParams, $1."Mag");
push(@fixedParams, $1."Phi");
}
elsif($currentLine =~ /(.*_(.*To.*Matrix.*))Mag/){
if(grep $_ eq $2, @fixedJPCKMat){
next;
}
push(@fixedParams, $1."Mag");
push(@fixedParams, $1."Phi");
push(@fixedJPCKMat, $2);
}
}
return @fixedParams;
}
sub Help
{
print STDERR <<INLINE_LITERAL_TEXT;
NAME
pawianfixparameters - automatically fix parameters for PAWIAN Partial Wave Analyses
SYNOPSIS
pawianfixparameters -f <file> [-p <priority>]
OPTIONS
-h | --help Show this help
-f | --file Select the file containing the fit parameters
-p | --prio Set a priority production system that becomes fixed
rather than another system
EXAMPLES
pawianfixparameters -f defaultparams.dat
pawianfixparameters -f myparams.dat -prio "K*K"
#Fixes K*K amplitudes instead of K*(1430)K amplitudes
INLINE_LITERAL_TEXT
}