diff --git a/src/external/MuSRFitGUI/MSR.pm b/src/external/MuSRFitGUI/MSR.pm
index 0e0bf05c..b496f419 100755
--- a/src/external/MuSRFitGUI/MSR.pm
+++ b/src/external/MuSRFitGUI/MSR.pm
@@ -7,7 +7,7 @@ my $EMPTY="";
my $SPACE=" ";
my %DATADIRS = (
- "LEM", "/mnt/data/nemu/his",
+ "LEM", "/afs/psi.ch/project/bulkmusr/data/lem",
"GPS", "/afs/psi.ch/project/bulkmusr/data/gps",
"LTF", "/afs/psi.ch/project/bulkmusr/data/ltf",
"Dolly", "/afs/psi.ch/project/bulkmusr/data/dolly",
@@ -48,6 +48,7 @@ my $minadd = "_min";
my $maxadd = "_max";
+
##########################################################################
# CreateMSR
#
@@ -93,7 +94,7 @@ sub CreateMSR {
my @Hists = split( /,/, $All{"LRBF"} );
# TODO
- # : to separate twoo sets of asymmetries with same parameters
+ # : to separate two sets of asymmetries with same parameters
# Check the number of histograms
# should be 2 or 4 histograms
# should be checked in GUI
@@ -108,6 +109,7 @@ sub CreateMSR {
my $BeamLine = $All{"BeamLine"};
my $YEAR = $All{"YEAR"};
+ # Works for CGI script
my $Step = $All{"go"};
if ( $Step eq "PLOT" ) {
$FITMINTYPE = $EMPTY;
@@ -178,7 +180,8 @@ FUNCTIONS
}
}
- $shcount = 1;
+ # Initialise $shcount, a counter for shared parameters
+ my $shcount = 1;
my $RUN_Block = $EMPTY;
my $RUNS_Line = $EMPTY;
@@ -358,7 +361,10 @@ FUNCTIONS
# Start constructing all blocks
my $TitleLine = $All{"TITLE"}."\n# Run Numbers: ".$All{"RunNumbers"};
-# $TitleLine =~ s/,/:/g;
+# if ($All{"RUNSType"}) {
+# $TitleLine = $EMPTY;
+# }
+# $TitleLine =~ s/\n//g;
# Get parameter block from MSR::PrepParamTable(\%All);
my $FitParaBlk = "
@@ -368,6 +374,7 @@ FITPARAMETER
# No Name Value Err Min Max ";
my %PTable=MSR::PrepParamTable(\%All);
my $NParam=scalar keys( %PTable );
+
# Fill the table with labels and values of parametr
for (my $iP=0;$iP<$NParam;$iP++) {
my ($Param,$value,$error,$minvalue,$maxvalue,$RUNtmp) = split(/,/,$PTable{$iP});
@@ -461,11 +468,8 @@ STATISTIC --- 0000-00-00 00:00:00
# Empty line at the end of each block
my $FullMSRFile = "$TitleLine$FitParaBlk\n$Full_T_Block\n$FUNCTIONS_Block\n$RUN_Block\n$COMMANDS_Block\n$PLOT_Block\n$FOURIER_Block\n$STAT_Block\n";
-# Open output file FILENAME.msr
- open( OUTF,q{>},"$FILENAME.msr" );
- print OUTF ("$FullMSRFile");
- close(OUTF);
- return($Full_T_Block,\@Paramcomp);
+# Return information and file
+ return($Full_T_Block,\@Paramcomp,$FullMSRFile);
}
@@ -493,6 +497,7 @@ sub CreateMSRSingleHist {
my $BeamLine = $All{"BeamLine"};
my $YEAR = $All{"YEAR"};
+ # Works for CGI script
my $Step = $All{"go"};
if ( $Step eq "PLOT" ) {
$FITMINTYPE = $EMPTY;
@@ -514,6 +519,8 @@ sub CreateMSRSingleHist {
my ($Full_T_Block,$Paramcomp_ref)=MSR::CreateTheory(@FitTypes);
my @Paramcomp = @$Paramcomp_ref;
+ print "Paramcomp= $Paramcomp[0]";
+
# If we have a FUNCTIONS Block the Full_T_Block should be
# replaced by Func_T_Block
$FUNCTIONS_Block = $EMPTY;
@@ -569,6 +576,8 @@ FUNCTIONS
my $Range_Order = 1;
my $iHist = 0;
foreach my $RUN (@RUNS) {
+ # Until here identical to sub CreateMSR
+
#######################################################################
# For a single histogram fit we basically need to repeat this for each hist
# However, "physical" parameters such as Asymmetry, relaxation etc. should
@@ -599,6 +608,13 @@ FUNCTIONS
my @Params = split( /\s+/, $Parameters );
# Only the first histiograms has new physical parameters
# the others keep only Phi if they have it
+ if ($iHist != 0) {
+ # look for Phi
+# if ( grep( /^Phi$/, @Params ) ) {
+ # if it is there keep only that
+# @Params=("Phi");
+# }
+ }
# For the first component we need No and NBg for SingleHist fits
if ( $component == 1 ) {
@@ -648,9 +664,14 @@ FUNCTIONS
$NoBg_Line = $NoBg_Line . "backgr.fit $PCount\n";
}
}
-
# End of No and NBg Lines
+ # Now deal with physical parameters and phases
+ elsif ( $Param_ORG ne "Phi" && $Param_ORG ne "No" && $Param_ORG ne "NBg") {
+
+ }
####################################################################################################
+ print $Full_T_Block."\n";
+
# Start preparing the parameters block
if ($Shared) {
@@ -747,7 +768,7 @@ FUNCTIONS
# Start constructing all block
my $TitleLine = $All{"TITLE"}."\n# Run Numbers: ".$All{"RunNumbers"};
- $TitleLine =~ s/,/:/g;
+# $TitleLine =~ s/\n//g;
# Get parameter block from MSR::PrepParamTable(\%All);
my $FitParaBlk = "
@@ -845,11 +866,8 @@ STATISTIC --- 0000-00-00 00:00:00
# Empty line at the end of each block
my $FullMSRFile = "$TitleLine$FitParaBlk\n$Full_T_Block\n$FUNCTIONS_Block\n$RUN_Block\n$COMMANDS_Block\n$PLOT_Block\n$FOURIER_Block\n$STAT_Block\n";
-# Open output file FILENAME.msr
- open( OUTF,q{>},"$FILENAME.msr" );
- print OUTF ("$FullMSRFile");
- close(OUTF);
- return($Full_T_Block,\@Paramcomp);
+# Return information and file
+ return($Full_T_Block,\@Paramcomp,$FullMSRFile);
}
##########################################################################
@@ -914,7 +932,7 @@ sub CreateTheory {
"statExpKT", "Lam",
"statExpKTLF", "Frq Aa",
"dynExpKTLF", "Frq Aa Lam",
- "combiLGKT", "Lam Sgm",
+ "combiLGKT", "Del Sgm",
"spinGlass", "Lam gam q",
"rdAnisoHf", "Frq Lam",
"TFieldCos", "Phi Frq",
@@ -1039,6 +1057,11 @@ sub CreateTheory {
$Parameters = join( $SPACE, $Parameters, $THEORY{'dynGssKTLF'} );
}
+ elsif ( $FitType eq "LGKT" ) {
+ $T_Block = $T_Block . "\n" . "combiLGKT " . $THEORY{'combiLGKT'};
+ $Parameters = join( $SPACE, $Parameters, $THEORY{'combiLGKT'} );
+ }
+
# Now some more combined functions (multiplication).
# Lorentzian KT LF multiplied by exponential
@@ -1077,6 +1100,24 @@ sub CreateTheory {
$Parameters = join( $SPACE, $Parameters, $THEORY{'statGssKTLF'} );
}
+ # Lorentzian or Gaussian KT ZF multiplied by exponential
+ elsif ( $FitType eq "LGKTExp" ) {
+ $T_Block = $T_Block . "\n" . "simplExpo " . $THEORY{'simplExpo'};
+ $Parameters = join( $SPACE, $Parameters, $THEORY{'simplExpo'} );
+ $T_Block =
+ $T_Block . "\n" . "combiLGKT " . $THEORY{'combiLGKT'};
+ $Parameters = join( $SPACE, $Parameters, $THEORY{'combiLGKT'} );
+ }
+
+ # Lorentzian or Gaussian KT ZF multiplied by stretched exponential
+ elsif ( $FitType eq "LGKTSExp" ) {
+ $T_Block = $T_Block . "\n" . "generExpo " . $THEORY{'generExpo'};
+ $Parameters = join( $SPACE, $Parameters, $THEORY{'generExpo'} );
+ $T_Block =
+ $T_Block . "\n" . "combiLGKT " . $THEORY{'combiLGKT'};
+ $Parameters = join( $SPACE, $Parameters, $THEORY{'combiLGKT'} );
+ }
+
# Lorentzian or Gaussian KT LF multiplied by stretched exponential
elsif ( $FitType eq "MolMag" ) {
$T_Block = $T_Block . "\n" . "generExpo " . $THEORY{'generExpo'};
@@ -1241,6 +1282,10 @@ sub PrepParamTable {
"bgrlx_min", "0", "bgrlx_max", "0",
"Frq", "1.0", "dFrq", "1.",
"Frq_min", "0", "Frq_max", "0",
+ "Frql", "1.0", "dFrql", "1.",
+ "Frql_min", "0", "Frql_max", "0",
+ "Frqg", "1.0", "dFrqg", "1.",
+ "Frqg_min", "0", "Frqg_max", "0",
"Field", "100.0", "dField", "1.",
"Field_min", "0", "Field_max", "0",
"Energy", "14.1", "dEnergy", "0.",
@@ -1314,7 +1359,10 @@ sub PrepParamTable {
$Shared = $All{"Sh_$Param"};
if ( $Shared!=1 || $iRun == 1 ) {
# It there are multiple runs index the parameters accordingly
- my $RUNtmp=sprintf("%04d",$RUN);
+ my $RUNtmp = sprintf("%04d",$RUN);
+ if ($All{"RUNSType"}) {
+ $RUNtmp = $iRun;
+ }
if ($Shared!=1) {$Param=$Param."_".$RUNtmp;}
# Check if this parameter has been initialized befor. If not take from defaults
$value = $All{"$Param"};
@@ -1423,6 +1471,7 @@ sub ExportParams {
my $HEADER="RUN";
my %All = %{$_[0]};
+
my @RUNS = ();
if ($All{"RUNSType"}) {
@RUNS = split( /,/, $All{"RunFiles"} );
@@ -1674,51 +1723,57 @@ sub RUNFileNameAuto {
# Take this information as input arguments
(my $RUN) = @_;
- my @tmp = split(/\./,$RUN);
- my $EXT = @tmp[$#tmp];
+ my $EXT = $EMPTY;
+ my $key = $EMPTY;
+# Find out the type of file (possibilities are root, bin and msr).
+ foreach $key (keys %EXTs) {
+ if (index($RUN,$key) != -1) {
+ $EXT = $key;
+ }
+ }
$RUN =~ s/\.[^.]+$//;
$RUN_Line = join( $SPACE,
"RUN", $RUN, "MUE4", "PSI",$EXTs{$EXT});
} else {
- my $DATADIR = $DATADIRS{$BeamLine};
- my $RUNtmp=sprintf("%04d",$RUN);
+ my $DATADIR = $DATADIRS{$BeamLine};
+ my $RUNtmp=sprintf("%04d",$RUN);
- # Get current year
- my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) =
- localtime( time() );
- my $current_year = $year + 1900;
-
- if ( $BeamLine eq "LEM" || $BeamLine eq "LEM (PPC)") {
- $RUN_File_Name = "lem" . substr( $YEAR, 2 ) . "_his_" . $RUNtmp;
- $RUNFILE = "$DATADIR/$YEAR/$RUN_File_Name";
- }
- elsif ( $BeamLine eq "GPS" ) {
- $RUN_File_Name = "deltat_tdc_gps_" . $RUNtmp;
- $RUNFILE = "$DATADIR/d$YEAR/tdc/$RUN_File_Name";
- }
- elsif ( $BeamLine eq "LTF" ) {
- $RUN_File_Name = "deltat_tdc_ltf_" . $RUNtmp;
- $RUNFILE = "$DATADIR/d$YEAR/tdc/$RUN_File_Name";
- }
- elsif ( $BeamLine eq "Dolly" ) {
- $RUN_File_Name = "deltat_tdc_dolly_" . $RUNtmp;
- $RUNFILE = "$DATADIR/d$YEAR/tdc/$RUN_File_Name";
- }
- elsif ( $BeamLine eq "GPD" ) {
- $RUN_File_Name = "deltat_tdc_gpd_" . $RUNtmp;
- $RUNFILE = "$DATADIR/d$YEAR/tdc/$RUN_File_Name";
- }
- $RUN_Line = join( $SPACE,
- "RUN", $RUNFILE, $BeamLines{$BeamLine}, "PSI",
- $Def_Format{$BeamLine} );
+ # Get current year
+ my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) =
+ localtime( time() );
+ my $current_year = $year + 1900;
+
+ if ( $BeamLine eq "LEM" || $BeamLine eq "LEM (PPC)") {
+ $RUN_File_Name = "lem" . substr( $YEAR, 2 ) . "_his_" . $RUNtmp;
+ $RUNFILE = "$DATADIR/d$YEAR/tdc/$RUN_File_Name";
}
+ elsif ( $BeamLine eq "GPS" ) {
+ $RUN_File_Name = "deltat_tdc_gps_" . $RUNtmp;
+ $RUNFILE = "$DATADIR/d$YEAR/tdc/$RUN_File_Name";
+ }
+ elsif ( $BeamLine eq "LTF" ) {
+ $RUN_File_Name = "deltat_tdc_ltf_" . $RUNtmp;
+ $RUNFILE = "$DATADIR/d$YEAR/tdc/$RUN_File_Name";
+ }
+ elsif ( $BeamLine eq "Dolly" ) {
+ $RUN_File_Name = "deltat_tdc_dolly_" . $RUNtmp;
+ $RUNFILE = "$DATADIR/d$YEAR/tdc/$RUN_File_Name";
+ }
+ elsif ( $BeamLine eq "GPD" ) {
+ $RUN_File_Name = "deltat_tdc_gpd_" . $RUNtmp;
+ $RUNFILE = "$DATADIR/d$YEAR/tdc/$RUN_File_Name";
+ }
+ $RUN_Line = join( $SPACE,
+ "RUN", $RUNFILE, $BeamLines{$BeamLine}, "PSI",
+ $Def_Format{$BeamLine} );
+}
return $RUN_Line;
}
########################
-# ExtractInfoLEM
+# CreateRRFBlock
########################
# This creates the RRF related lines, these are the same always
sub CreateRRFBlock {
@@ -1745,6 +1800,7 @@ sub CreateRRFBlock {
# Uset to extract information from summary files
sub ExtractInfoLEM {
my ($RUN,$YEAR,$Arg) = @_;
+# Use file header
my $Summ_File_Name = "lem" . substr( $YEAR, 2 ) . "_" . $RUN . ".summ";
my $SummFile = "$SUMM_DIR/$YEAR/$Summ_File_Name";
@@ -1897,7 +1953,7 @@ sub CreateMSRSh {
my @Hists = split( /,/, $All{"LRBF"} );
# TODO
- # : to separate twoo sets of asymmetries with same parameters
+ # : to separate two sets of asymmetries with same parameters
# Check the number of histograms
# should be 2 or 4 histograms
# should be checked in GUI
@@ -2160,7 +2216,7 @@ FUNCTIONS
# Start constructing all blocks
my $TitleLine = $All{"TITLE"}."\n# Run Numbers: ".$All{"RunNumbers"};
-# $TitleLine =~ s/,/:/g;
+# $TitleLine =~ s/\n//g;
# Get parameter block from MSR::PrepParamTable(\%All);
my $FitParaBlk =
@@ -2263,11 +2319,8 @@ STATISTIC --- 0000-00-00 00:00:00
# Empty line at the end of each block
my $FullMSRFile = "$TitleLine$FitParaBlk\n$Full_T_Block\n$FUNCTIONS_Block\n$RUN_Block\n$COMMANDS_Block\n$PLOT_Block\n$FOURIER_Block\n$STAT_Block\n";
-# Open output file FILENAME.msr
- open( OUTF,q{>},"$FILENAME.msr" );
- print OUTF ("$FullMSRFile");
- close(OUTF);
- return($Full_T_Block,\@Paramcomp);
+# Return information and file
+ return($Full_T_Block,\@Paramcomp,$FullMSRFile);
}
########################
diff --git a/src/external/MuSRFitGUI/MuSRFit.pl b/src/external/MuSRFitGUI/MuSRFit.pl
index 5d81eb0e..9519ae5c 100755
--- a/src/external/MuSRFitGUI/MuSRFit.pl
+++ b/src/external/MuSRFitGUI/MuSRFit.pl
@@ -1,6 +1,6 @@
# Form implementation generated from reading ui file 'MuSRFit.ui'
#
-# Created: Thu Jun 14 14:52:06 2012
+# Created: Thu Sep 5 14:20:55 2013
# by: The PerlQt User Interface Compiler (puic)
#
# WARNING! All changes made in this file will be lost!
@@ -1708,7 +1708,7 @@ sub NEW
setName("MuSRFitform" );
}
setSizePolicy(Qt::SizePolicy(7, 7, 1, 1, this->sizePolicy()->hasHeightForWidth()) );
- setMinimumSize(Qt::Size(582, 502) );
+ setMinimumSize(Qt::Size(582, 505) );
setIcon($image0 );
setCentralWidget(Qt::Widget(this, "qt_central_widget"));
@@ -3068,7 +3068,7 @@ sub NEW
MenuBar->insertSeparator( 8 );
languageChange();
- my $resize = Qt::Size(582, 502);
+ my $resize = Qt::Size(611, 559);
$resize = $resize->expandedTo(minimumSizeHint());
resize( $resize );
clearWState( &Qt::WState_Polished );
@@ -3226,8 +3226,11 @@ sub languageChange
FitType2->insertItem( trUtf8("Gaussian Kubo-Toyabe LF x Str Exp") );
FitType2->insertItem( trUtf8("MolMag") );
FitType2->insertItem( trUtf8("Meissner State Model") );
+ FitType2->insertItem( trUtf8("Lor-Gss combi KT") );
+ FitType2->insertItem( trUtf8("Lor-Gss combi KT x Exp") );
+ FitType2->insertItem( trUtf8("Lor-Gss combi KT x SExp") );
FitType2->insertItem( trUtf8("None") );
- FitType2->setCurrentItem( int(15) );
+ FitType2->setCurrentItem( int(18) );
TfsLabel->setText( trUtf8("Final Time") );
FitType1->clear();
FitType1->insertItem( trUtf8("Exponential") );
@@ -3245,6 +3248,9 @@ sub languageChange
FitType1->insertItem( trUtf8("Gaussian Kubo-Toyabe LF x Str Exp") );
FitType1->insertItem( trUtf8("MolMag") );
FitType1->insertItem( trUtf8("Meissner State Model") );
+ FitType1->insertItem( trUtf8("Lor-Gss combi KT") );
+ FitType1->insertItem( trUtf8("Lor-Gss combi KT x Exp") );
+ FitType1->insertItem( trUtf8("Lor-Gss combi KT x SExp") );
BINS->setText( trUtf8("100") );
Comp3Label->setText( trUtf8("Third Component") );
Tis->setText( trUtf8("0") );
@@ -3268,8 +3274,11 @@ sub languageChange
FitType3->insertItem( trUtf8("Gaussian Kubo-Toyabe LF x Str Exp") );
FitType3->insertItem( trUtf8("MolMag") );
FitType3->insertItem( trUtf8("Meissner State Model") );
+ FitType3->insertItem( trUtf8("Lor-Gss combi KT") );
+ FitType3->insertItem( trUtf8("Lor-Gss combi KT x Exp") );
+ FitType3->insertItem( trUtf8("Lor-Gss combi KT x SExp") );
FitType3->insertItem( trUtf8("None") );
- FitType3->setCurrentItem( int(15) );
+ FitType3->setCurrentItem( int(18) );
Comp2Label->setText( trUtf8("Second Component") );
FitAsyTypeLabel->setText( trUtf8("Fit type") );
FitAsyType->clear();
@@ -3795,7 +3804,10 @@ sub CreateAllInput
12,"GLFSExp",
13,"MolMag",
14,"Meissner",
- 15,"None"
+ 15,"LGKT",
+ 16,"LGKTExp",
+ 17,"LGKTSExp",
+ 18,"None"
);
my $FT1=FitType1->currentItem;
@@ -3945,10 +3957,19 @@ sub CallMSRCreate
if ($Answer) {
if ( $All{"FitAsyType"} eq "Asymmetry" ) {
if ($All{"RUNSType"}) {
- my ($Full_T_Block,$Paramcomp_ref)= MSR::CreateMSR(\%All);
+ my ($Full_T_Block,$Paramcomp_ref,$FullMSRFile)= MSR::CreateMSR(\%All);
+# Open output file FILENAME.msr
+ open( OUTF,q{>},"$FILENAME" );
+ print OUTF ("$FullMSRFile");
+ close(OUTF);
} else {
-# my ($Full_T_Block,$Paramcomp_ref)= MSR::CreateMSRSh(\%All);
- my ($Full_T_Block,$Paramcomp_ref)= MSR::CreateMSR(\%All);
+# my ($Full_T_Block,$Paramcomp_ref,$FullMSRFile)= MSR::CreateMSRSh(\%All);
+ my ($Full_T_Block,$Paramcomp_ref,$FullMSRFile)= MSR::CreateMSR(\%All);
+# Open output file FILENAME.msr
+ open( OUTF,q{>},"$FILENAME" );
+ print OUTF ("$FullMSRFile");
+ close(OUTF);
+
# if it is multiple runs then the produced file is a template
my $FILENAME=$All{"FILENAME"}.".msr";
my $Extension = "_".$All{"BeamLine"}."_".$All{"YEAR"};
@@ -3972,10 +3993,13 @@ sub CallMSRCreate
close(FTO);
}
}
-
}
elsif ( $All{"FitAsyType"} eq "SingleHist" ) {
- my ($Full_T_Block,$Paramcomp_ref)= MSR::CreateMSRSingleHist(\%All);
+ my ($Full_T_Block,$Paramcomp_ref,$FullMSRFile)= MSR::CreateMSRSingleHist(\%All);
+# Open output file FILENAME.msr
+ open( OUTF,q{>},"$FILENAME" );
+ print OUTF ("$FullMSRFile");
+ close(OUTF);
}
UpdateMSRFileInitTable();
}
diff --git a/src/external/MuSRFitGUI/MuSRFit.ui b/src/external/MuSRFitGUI/MuSRFit.ui
index 5aaf27a2..6dfec48c 100755
--- a/src/external/MuSRFitGUI/MuSRFit.ui
+++ b/src/external/MuSRFitGUI/MuSRFit.ui
@@ -8,8 +8,8 @@
0
0
- 582
- 502
+ 611
+ 559
@@ -23,7 +23,7 @@
582
- 502
+ 505
@@ -770,6 +770,21 @@
Meissner State Model
+ -
+
+ Lor-Gss combi KT
+
+
+ -
+
+ Lor-Gss combi KT x Exp
+
+
+ -
+
+ Lor-Gss combi KT x SExp
+
+
-
None
@@ -787,7 +802,7 @@
- 15
+ 18
@@ -885,6 +900,21 @@
Meissner State Model
+ -
+
+ Lor-Gss combi KT
+
+
+ -
+
+ Lor-Gss combi KT x Exp
+
+
+ -
+
+ Lor-Gss combi KT x SExp
+
+
FitType1
@@ -1590,6 +1620,21 @@
Meissner State Model
+ -
+
+ Lor-Gss combi KT
+
+
+ -
+
+ Lor-Gss combi KT x Exp
+
+
+ -
+
+ Lor-Gss combi KT x SExp
+
+
-
None
@@ -1607,7 +1652,7 @@
- 15
+ 18
diff --git a/src/external/MuSRFitGUI/MuSRFit.ui.h b/src/external/MuSRFitGUI/MuSRFit.ui.h
index 0b416b8c..bbbb7446 100755
--- a/src/external/MuSRFitGUI/MuSRFit.ui.h
+++ b/src/external/MuSRFitGUI/MuSRFit.ui.h
@@ -328,7 +328,10 @@ void MuSRFitform::CreateAllInput()
12,"GLFSExp",
13,"MolMag",
14,"Meissner",
- 15,"None"
+ 15,"LGKT",
+ 16,"LGKTExp",
+ 17,"LGKTSExp",
+ 18,"None"
);
my $FT1=FitType1->currentItem;
@@ -476,10 +479,19 @@ void MuSRFitform::CallMSRCreate()
if ($Answer) {
if ( $All{"FitAsyType"} eq "Asymmetry" ) {
if ($All{"RUNSType"}) {
- my ($Full_T_Block,$Paramcomp_ref)= MSR::CreateMSR(\%All);
+ my ($Full_T_Block,$Paramcomp_ref,$FullMSRFile)= MSR::CreateMSR(\%All);
+# Open output file FILENAME.msr
+ open( OUTF,q{>},"$FILENAME" );
+ print OUTF ("$FullMSRFile");
+ close(OUTF);
} else {
-# my ($Full_T_Block,$Paramcomp_ref)= MSR::CreateMSRSh(\%All);
- my ($Full_T_Block,$Paramcomp_ref)= MSR::CreateMSR(\%All);
+# my ($Full_T_Block,$Paramcomp_ref,$FullMSRFile)= MSR::CreateMSRSh(\%All);
+ my ($Full_T_Block,$Paramcomp_ref,$FullMSRFile)= MSR::CreateMSR(\%All);
+# Open output file FILENAME.msr
+ open( OUTF,q{>},"$FILENAME" );
+ print OUTF ("$FullMSRFile");
+ close(OUTF);
+
# if it is multiple runs then the produced file is a template
my $FILENAME=$All{"FILENAME"}.".msr";
my $Extension = "_".$All{"BeamLine"}."_".$All{"YEAR"};
@@ -503,10 +515,13 @@ void MuSRFitform::CallMSRCreate()
close(FTO);
}
}
-
}
elsif ( $All{"FitAsyType"} eq "SingleHist" ) {
- my ($Full_T_Block,$Paramcomp_ref)= MSR::CreateMSRSingleHist(\%All);
+ my ($Full_T_Block,$Paramcomp_ref,$FullMSRFile)= MSR::CreateMSRSingleHist(\%All);
+# Open output file FILENAME.msr
+ open( OUTF,q{>},"$FILENAME" );
+ print OUTF ("$FullMSRFile");
+ close(OUTF);
}
UpdateMSRFileInitTable();
}
diff --git a/src/external/libBNMR/TBNMR.cpp b/src/external/libBNMR/TBNMR.cpp
index 5ab52d7f..bf139803 100644
--- a/src/external/libBNMR/TBNMR.cpp
+++ b/src/external/libBNMR/TBNMR.cpp
@@ -42,6 +42,7 @@
ClassImp(TBNMR) // for the ROOT-dictionary
ClassImp(ExpRlx)
ClassImp(SExpRlx)
+ClassImp(MLRes)
double TBNMR::operator()(double x, const vector &par) const {
assert(par.size()==1); // make sure the number of parameters handed to the function is correct
@@ -102,3 +103,31 @@ double SExpRlx::operator()(double x, const vector &par) const {
return y;
}
+double MLRes::operator()(double x, const vector &par) const {
+ assert(par.size()==3); // make sure the number of parameters handed to the function is correct
+
+ // par[0] time of beam off
+ // par[1] is the relaxation rate
+ // par[2] is the exponent
+ double tau_p;
+ double y;
+
+ tau_p = (tau_Li/(1.+par[1]*tau_Li));
+
+
+ if ( x >= 0 && x <= par[0] ) {
+ TF1 sexp("sexp", "exp(-([0]-x)/[3])*exp(-pow(([1]*([0]-x)),[2]))", 0.0, 10000.0);
+ sexp.SetParameters(x, par[1], par[2],tau_Li);
+ sexp.SetNpx(1000);
+ y=sexp.Integral(0.0,x)/(1-exp(-x/tau_Li))/tau_Li;
+ } else if ( x > par[0] ) {
+ TF1 sexp("sexp", "exp(-([3]-x)/[4])*exp(-pow(([1]*([0]-x)),[2]))", 0.0, 10000.0);
+ sexp.SetParameters(x, par[1], par[2], par[0],tau_Li);
+ sexp.SetNpx(1000);
+ y=sexp.Integral(0.0,par[0])/(1-exp(-x/tau_Li))/tau_Li;
+ } else {
+ y = 0;
+ }
+ return y;
+}
+
diff --git a/src/external/libBNMR/TBNMR.h b/src/external/libBNMR/TBNMR.h
index 38a6aa3d..2304ff99 100644
--- a/src/external/libBNMR/TBNMR.h
+++ b/src/external/libBNMR/TBNMR.h
@@ -90,3 +90,21 @@ public:
// definition of the class for the ROOT-dictionary
ClassDef(SExpRlx,1)
};
+
+class MLRes : public PUserFcnBase {
+
+public:
+ // default constructor and destructor
+ MLRes(){}
+ ~MLRes(){}
+
+ Bool_t NeedGlobalPart() const { return false; }
+ void SetGlobalPart(vector &globalPart, UInt_t idx) { }
+ Bool_t GlobalPartIsValid() const { return true; }
+
+ // function operator
+ double operator()(double, const vector&) const;
+
+ // definition of the class for the ROOT-dictionary
+ ClassDef(MLRes,1)
+};
diff --git a/src/external/libBNMR/TBNMRLinkDef.h b/src/external/libBNMR/TBNMRLinkDef.h
index ab6870bb..ab23c35f 100644
--- a/src/external/libBNMR/TBNMRLinkDef.h
+++ b/src/external/libBNMR/TBNMRLinkDef.h
@@ -38,5 +38,6 @@
#pragma link C++ class TBNMR+;
#pragma link C++ class ExpRlx+;
#pragma link C++ class SExpRlx+;
+#pragma link C++ class MLRes+;
#endif //__CINT__