Added new functions invloving combiKT.

This commit is contained in:
2013-09-09 10:02:09 +00:00
parent bd551d13ac
commit e1d99a07cb
7 changed files with 265 additions and 80 deletions

View File

@ -7,7 +7,7 @@ my $EMPTY="";
my $SPACE=" "; my $SPACE=" ";
my %DATADIRS = ( my %DATADIRS = (
"LEM", "/mnt/data/nemu/his", "LEM", "/afs/psi.ch/project/bulkmusr/data/lem",
"GPS", "/afs/psi.ch/project/bulkmusr/data/gps", "GPS", "/afs/psi.ch/project/bulkmusr/data/gps",
"LTF", "/afs/psi.ch/project/bulkmusr/data/ltf", "LTF", "/afs/psi.ch/project/bulkmusr/data/ltf",
"Dolly", "/afs/psi.ch/project/bulkmusr/data/dolly", "Dolly", "/afs/psi.ch/project/bulkmusr/data/dolly",
@ -48,6 +48,7 @@ my $minadd = "_min";
my $maxadd = "_max"; my $maxadd = "_max";
########################################################################## ##########################################################################
# CreateMSR # CreateMSR
# #
@ -93,7 +94,7 @@ sub CreateMSR {
my @Hists = split( /,/, $All{"LRBF"} ); my @Hists = split( /,/, $All{"LRBF"} );
# TODO # TODO
# : to separate twoo sets of asymmetries with same parameters # : to separate two sets of asymmetries with same parameters
# Check the number of histograms # Check the number of histograms
# should be 2 or 4 histograms # should be 2 or 4 histograms
# should be checked in GUI # should be checked in GUI
@ -108,6 +109,7 @@ sub CreateMSR {
my $BeamLine = $All{"BeamLine"}; my $BeamLine = $All{"BeamLine"};
my $YEAR = $All{"YEAR"}; my $YEAR = $All{"YEAR"};
# Works for CGI script
my $Step = $All{"go"}; my $Step = $All{"go"};
if ( $Step eq "PLOT" ) { if ( $Step eq "PLOT" ) {
$FITMINTYPE = $EMPTY; $FITMINTYPE = $EMPTY;
@ -178,7 +180,8 @@ FUNCTIONS
} }
} }
$shcount = 1; # Initialise $shcount, a counter for shared parameters
my $shcount = 1;
my $RUN_Block = $EMPTY; my $RUN_Block = $EMPTY;
my $RUNS_Line = $EMPTY; my $RUNS_Line = $EMPTY;
@ -358,7 +361,10 @@ FUNCTIONS
# Start constructing all blocks # Start constructing all blocks
my $TitleLine = $All{"TITLE"}."\n# Run Numbers: ".$All{"RunNumbers"}; 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); # Get parameter block from MSR::PrepParamTable(\%All);
my $FitParaBlk = " my $FitParaBlk = "
@ -368,6 +374,7 @@ FITPARAMETER
# No Name Value Err Min Max "; # No Name Value Err Min Max ";
my %PTable=MSR::PrepParamTable(\%All); my %PTable=MSR::PrepParamTable(\%All);
my $NParam=scalar keys( %PTable ); my $NParam=scalar keys( %PTable );
# Fill the table with labels and values of parametr # Fill the table with labels and values of parametr
for (my $iP=0;$iP<$NParam;$iP++) { for (my $iP=0;$iP<$NParam;$iP++) {
my ($Param,$value,$error,$minvalue,$maxvalue,$RUNtmp) = split(/,/,$PTable{$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 # 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"; 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 # Return information and file
open( OUTF,q{>},"$FILENAME.msr" ); return($Full_T_Block,\@Paramcomp,$FullMSRFile);
print OUTF ("$FullMSRFile");
close(OUTF);
return($Full_T_Block,\@Paramcomp);
} }
@ -493,6 +497,7 @@ sub CreateMSRSingleHist {
my $BeamLine = $All{"BeamLine"}; my $BeamLine = $All{"BeamLine"};
my $YEAR = $All{"YEAR"}; my $YEAR = $All{"YEAR"};
# Works for CGI script
my $Step = $All{"go"}; my $Step = $All{"go"};
if ( $Step eq "PLOT" ) { if ( $Step eq "PLOT" ) {
$FITMINTYPE = $EMPTY; $FITMINTYPE = $EMPTY;
@ -514,6 +519,8 @@ sub CreateMSRSingleHist {
my ($Full_T_Block,$Paramcomp_ref)=MSR::CreateTheory(@FitTypes); my ($Full_T_Block,$Paramcomp_ref)=MSR::CreateTheory(@FitTypes);
my @Paramcomp = @$Paramcomp_ref; my @Paramcomp = @$Paramcomp_ref;
print "Paramcomp= $Paramcomp[0]";
# If we have a FUNCTIONS Block the Full_T_Block should be # If we have a FUNCTIONS Block the Full_T_Block should be
# replaced by Func_T_Block # replaced by Func_T_Block
$FUNCTIONS_Block = $EMPTY; $FUNCTIONS_Block = $EMPTY;
@ -569,6 +576,8 @@ FUNCTIONS
my $Range_Order = 1; my $Range_Order = 1;
my $iHist = 0; my $iHist = 0;
foreach my $RUN (@RUNS) { foreach my $RUN (@RUNS) {
# Until here identical to sub CreateMSR
####################################################################### #######################################################################
# For a single histogram fit we basically need to repeat this for each hist # For a single histogram fit we basically need to repeat this for each hist
# However, "physical" parameters such as Asymmetry, relaxation etc. should # However, "physical" parameters such as Asymmetry, relaxation etc. should
@ -599,6 +608,13 @@ FUNCTIONS
my @Params = split( /\s+/, $Parameters ); my @Params = split( /\s+/, $Parameters );
# Only the first histiograms has new physical parameters # Only the first histiograms has new physical parameters
# the others keep only Phi if they have it # 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 # For the first component we need No and NBg for SingleHist fits
if ( $component == 1 ) { if ( $component == 1 ) {
@ -648,9 +664,14 @@ FUNCTIONS
$NoBg_Line = $NoBg_Line . "backgr.fit $PCount\n"; $NoBg_Line = $NoBg_Line . "backgr.fit $PCount\n";
} }
} }
# End of No and NBg Lines # 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 # Start preparing the parameters block
if ($Shared) { if ($Shared) {
@ -747,7 +768,7 @@ FUNCTIONS
# Start constructing all block # Start constructing all block
my $TitleLine = $All{"TITLE"}."\n# Run Numbers: ".$All{"RunNumbers"}; my $TitleLine = $All{"TITLE"}."\n# Run Numbers: ".$All{"RunNumbers"};
$TitleLine =~ s/,/:/g; # $TitleLine =~ s/\n//g;
# Get parameter block from MSR::PrepParamTable(\%All); # Get parameter block from MSR::PrepParamTable(\%All);
my $FitParaBlk = " my $FitParaBlk = "
@ -845,11 +866,8 @@ STATISTIC --- 0000-00-00 00:00:00
# Empty line at the end of each block # 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"; 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 # Return information and file
open( OUTF,q{>},"$FILENAME.msr" ); return($Full_T_Block,\@Paramcomp,$FullMSRFile);
print OUTF ("$FullMSRFile");
close(OUTF);
return($Full_T_Block,\@Paramcomp);
} }
########################################################################## ##########################################################################
@ -914,7 +932,7 @@ sub CreateTheory {
"statExpKT", "Lam", "statExpKT", "Lam",
"statExpKTLF", "Frq Aa", "statExpKTLF", "Frq Aa",
"dynExpKTLF", "Frq Aa Lam", "dynExpKTLF", "Frq Aa Lam",
"combiLGKT", "Lam Sgm", "combiLGKT", "Del Sgm",
"spinGlass", "Lam gam q", "spinGlass", "Lam gam q",
"rdAnisoHf", "Frq Lam", "rdAnisoHf", "Frq Lam",
"TFieldCos", "Phi Frq", "TFieldCos", "Phi Frq",
@ -1039,6 +1057,11 @@ sub CreateTheory {
$Parameters = join( $SPACE, $Parameters, $THEORY{'dynGssKTLF'} ); $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). # Now some more combined functions (multiplication).
# Lorentzian KT LF multiplied by exponential # Lorentzian KT LF multiplied by exponential
@ -1077,6 +1100,24 @@ sub CreateTheory {
$Parameters = join( $SPACE, $Parameters, $THEORY{'statGssKTLF'} ); $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 # Lorentzian or Gaussian KT LF multiplied by stretched exponential
elsif ( $FitType eq "MolMag" ) { elsif ( $FitType eq "MolMag" ) {
$T_Block = $T_Block . "\n" . "generExpo " . $THEORY{'generExpo'}; $T_Block = $T_Block . "\n" . "generExpo " . $THEORY{'generExpo'};
@ -1241,6 +1282,10 @@ sub PrepParamTable {
"bgrlx_min", "0", "bgrlx_max", "0", "bgrlx_min", "0", "bgrlx_max", "0",
"Frq", "1.0", "dFrq", "1.", "Frq", "1.0", "dFrq", "1.",
"Frq_min", "0", "Frq_max", "0", "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", "100.0", "dField", "1.",
"Field_min", "0", "Field_max", "0", "Field_min", "0", "Field_max", "0",
"Energy", "14.1", "dEnergy", "0.", "Energy", "14.1", "dEnergy", "0.",
@ -1314,7 +1359,10 @@ sub PrepParamTable {
$Shared = $All{"Sh_$Param"}; $Shared = $All{"Sh_$Param"};
if ( $Shared!=1 || $iRun == 1 ) { if ( $Shared!=1 || $iRun == 1 ) {
# It there are multiple runs index the parameters accordingly # 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;} if ($Shared!=1) {$Param=$Param."_".$RUNtmp;}
# Check if this parameter has been initialized befor. If not take from defaults # Check if this parameter has been initialized befor. If not take from defaults
$value = $All{"$Param"}; $value = $All{"$Param"};
@ -1423,6 +1471,7 @@ sub ExportParams {
my $HEADER="RUN"; my $HEADER="RUN";
my %All = %{$_[0]}; my %All = %{$_[0]};
my @RUNS = (); my @RUNS = ();
if ($All{"RUNSType"}) { if ($All{"RUNSType"}) {
@RUNS = split( /,/, $All{"RunFiles"} ); @RUNS = split( /,/, $All{"RunFiles"} );
@ -1674,51 +1723,57 @@ sub RUNFileNameAuto {
# Take this information as input arguments # Take this information as input arguments
(my $RUN) = @_; (my $RUN) = @_;
my @tmp = split(/\./,$RUN); my $EXT = $EMPTY;
my $EXT = @tmp[$#tmp]; 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 =~ s/\.[^.]+$//;
$RUN_Line = join( $SPACE, $RUN_Line = join( $SPACE,
"RUN", $RUN, "MUE4", "PSI",$EXTs{$EXT}); "RUN", $RUN, "MUE4", "PSI",$EXTs{$EXT});
} else { } else {
my $DATADIR = $DATADIRS{$BeamLine}; my $DATADIR = $DATADIRS{$BeamLine};
my $RUNtmp=sprintf("%04d",$RUN); my $RUNtmp=sprintf("%04d",$RUN);
# Get current year # Get current year
my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) =
localtime( time() ); localtime( time() );
my $current_year = $year + 1900; my $current_year = $year + 1900;
if ( $BeamLine eq "LEM" || $BeamLine eq "LEM (PPC)") { if ( $BeamLine eq "LEM" || $BeamLine eq "LEM (PPC)") {
$RUN_File_Name = "lem" . substr( $YEAR, 2 ) . "_his_" . $RUNtmp; $RUN_File_Name = "lem" . substr( $YEAR, 2 ) . "_his_" . $RUNtmp;
$RUNFILE = "$DATADIR/$YEAR/$RUN_File_Name"; $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} );
} }
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; return $RUN_Line;
} }
######################## ########################
# ExtractInfoLEM # CreateRRFBlock
######################## ########################
# This creates the RRF related lines, these are the same always # This creates the RRF related lines, these are the same always
sub CreateRRFBlock { sub CreateRRFBlock {
@ -1745,6 +1800,7 @@ sub CreateRRFBlock {
# Uset to extract information from summary files # Uset to extract information from summary files
sub ExtractInfoLEM { sub ExtractInfoLEM {
my ($RUN,$YEAR,$Arg) = @_; my ($RUN,$YEAR,$Arg) = @_;
# Use file header
my $Summ_File_Name = "lem" . substr( $YEAR, 2 ) . "_" . $RUN . ".summ"; my $Summ_File_Name = "lem" . substr( $YEAR, 2 ) . "_" . $RUN . ".summ";
my $SummFile = "$SUMM_DIR/$YEAR/$Summ_File_Name"; my $SummFile = "$SUMM_DIR/$YEAR/$Summ_File_Name";
@ -1897,7 +1953,7 @@ sub CreateMSRSh {
my @Hists = split( /,/, $All{"LRBF"} ); my @Hists = split( /,/, $All{"LRBF"} );
# TODO # TODO
# : to separate twoo sets of asymmetries with same parameters # : to separate two sets of asymmetries with same parameters
# Check the number of histograms # Check the number of histograms
# should be 2 or 4 histograms # should be 2 or 4 histograms
# should be checked in GUI # should be checked in GUI
@ -2160,7 +2216,7 @@ FUNCTIONS
# Start constructing all blocks # Start constructing all blocks
my $TitleLine = $All{"TITLE"}."\n# Run Numbers: ".$All{"RunNumbers"}; my $TitleLine = $All{"TITLE"}."\n# Run Numbers: ".$All{"RunNumbers"};
# $TitleLine =~ s/,/:/g; # $TitleLine =~ s/\n//g;
# Get parameter block from MSR::PrepParamTable(\%All); # Get parameter block from MSR::PrepParamTable(\%All);
my $FitParaBlk = my $FitParaBlk =
@ -2263,11 +2319,8 @@ STATISTIC --- 0000-00-00 00:00:00
# Empty line at the end of each block # 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"; 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 # Return information and file
open( OUTF,q{>},"$FILENAME.msr" ); return($Full_T_Block,\@Paramcomp,$FullMSRFile);
print OUTF ("$FullMSRFile");
close(OUTF);
return($Full_T_Block,\@Paramcomp);
} }
######################## ########################

View File

@ -1,6 +1,6 @@
# Form implementation generated from reading ui file 'MuSRFit.ui' # 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) # by: The PerlQt User Interface Compiler (puic)
# #
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!
@ -1708,7 +1708,7 @@ sub NEW
setName("MuSRFitform" ); setName("MuSRFitform" );
} }
setSizePolicy(Qt::SizePolicy(7, 7, 1, 1, this->sizePolicy()->hasHeightForWidth()) ); setSizePolicy(Qt::SizePolicy(7, 7, 1, 1, this->sizePolicy()->hasHeightForWidth()) );
setMinimumSize(Qt::Size(582, 502) ); setMinimumSize(Qt::Size(582, 505) );
setIcon($image0 ); setIcon($image0 );
setCentralWidget(Qt::Widget(this, "qt_central_widget")); setCentralWidget(Qt::Widget(this, "qt_central_widget"));
@ -3068,7 +3068,7 @@ sub NEW
MenuBar->insertSeparator( 8 ); MenuBar->insertSeparator( 8 );
languageChange(); languageChange();
my $resize = Qt::Size(582, 502); my $resize = Qt::Size(611, 559);
$resize = $resize->expandedTo(minimumSizeHint()); $resize = $resize->expandedTo(minimumSizeHint());
resize( $resize ); resize( $resize );
clearWState( &Qt::WState_Polished ); clearWState( &Qt::WState_Polished );
@ -3226,8 +3226,11 @@ sub languageChange
FitType2->insertItem( trUtf8("Gaussian Kubo-Toyabe LF x Str Exp") ); FitType2->insertItem( trUtf8("Gaussian Kubo-Toyabe LF x Str Exp") );
FitType2->insertItem( trUtf8("MolMag") ); FitType2->insertItem( trUtf8("MolMag") );
FitType2->insertItem( trUtf8("Meissner State Model") ); 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->insertItem( trUtf8("None") );
FitType2->setCurrentItem( int(15) ); FitType2->setCurrentItem( int(18) );
TfsLabel->setText( trUtf8("Final Time") ); TfsLabel->setText( trUtf8("Final Time") );
FitType1->clear(); FitType1->clear();
FitType1->insertItem( trUtf8("Exponential") ); FitType1->insertItem( trUtf8("Exponential") );
@ -3245,6 +3248,9 @@ sub languageChange
FitType1->insertItem( trUtf8("Gaussian Kubo-Toyabe LF x Str Exp") ); FitType1->insertItem( trUtf8("Gaussian Kubo-Toyabe LF x Str Exp") );
FitType1->insertItem( trUtf8("MolMag") ); FitType1->insertItem( trUtf8("MolMag") );
FitType1->insertItem( trUtf8("Meissner State Model") ); 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") ); BINS->setText( trUtf8("100") );
Comp3Label->setText( trUtf8("Third Component") ); Comp3Label->setText( trUtf8("Third Component") );
Tis->setText( trUtf8("0") ); Tis->setText( trUtf8("0") );
@ -3268,8 +3274,11 @@ sub languageChange
FitType3->insertItem( trUtf8("Gaussian Kubo-Toyabe LF x Str Exp") ); FitType3->insertItem( trUtf8("Gaussian Kubo-Toyabe LF x Str Exp") );
FitType3->insertItem( trUtf8("MolMag") ); FitType3->insertItem( trUtf8("MolMag") );
FitType3->insertItem( trUtf8("Meissner State Model") ); 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->insertItem( trUtf8("None") );
FitType3->setCurrentItem( int(15) ); FitType3->setCurrentItem( int(18) );
Comp2Label->setText( trUtf8("Second Component") ); Comp2Label->setText( trUtf8("Second Component") );
FitAsyTypeLabel->setText( trUtf8("Fit type") ); FitAsyTypeLabel->setText( trUtf8("Fit type") );
FitAsyType->clear(); FitAsyType->clear();
@ -3795,7 +3804,10 @@ sub CreateAllInput
12,"GLFSExp", 12,"GLFSExp",
13,"MolMag", 13,"MolMag",
14,"Meissner", 14,"Meissner",
15,"None" 15,"LGKT",
16,"LGKTExp",
17,"LGKTSExp",
18,"None"
); );
my $FT1=FitType1->currentItem; my $FT1=FitType1->currentItem;
@ -3945,10 +3957,19 @@ sub CallMSRCreate
if ($Answer) { if ($Answer) {
if ( $All{"FitAsyType"} eq "Asymmetry" ) { if ( $All{"FitAsyType"} eq "Asymmetry" ) {
if ($All{"RUNSType"}) { 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 { } else {
# my ($Full_T_Block,$Paramcomp_ref)= MSR::CreateMSRSh(\%All); # my ($Full_T_Block,$Paramcomp_ref,$FullMSRFile)= MSR::CreateMSRSh(\%All);
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);
# if it is multiple runs then the produced file is a template # if it is multiple runs then the produced file is a template
my $FILENAME=$All{"FILENAME"}.".msr"; my $FILENAME=$All{"FILENAME"}.".msr";
my $Extension = "_".$All{"BeamLine"}."_".$All{"YEAR"}; my $Extension = "_".$All{"BeamLine"}."_".$All{"YEAR"};
@ -3972,10 +3993,13 @@ sub CallMSRCreate
close(FTO); close(FTO);
} }
} }
} }
elsif ( $All{"FitAsyType"} eq "SingleHist" ) { 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(); UpdateMSRFileInitTable();
} }

View File

@ -8,8 +8,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>582</width> <width>611</width>
<height>502</height> <height>559</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -23,7 +23,7 @@
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>582</width> <width>582</width>
<height>502</height> <height>505</height>
</size> </size>
</property> </property>
<property name="caption"> <property name="caption">
@ -770,6 +770,21 @@
<string>Meissner State Model</string> <string>Meissner State Model</string>
</property> </property>
</item> </item>
<item>
<property name="text">
<string>Lor-Gss combi KT</string>
</property>
</item>
<item>
<property name="text">
<string>Lor-Gss combi KT x Exp</string>
</property>
</item>
<item>
<property name="text">
<string>Lor-Gss combi KT x SExp</string>
</property>
</item>
<item> <item>
<property name="text"> <property name="text">
<string>None</string> <string>None</string>
@ -787,7 +802,7 @@
</sizepolicy> </sizepolicy>
</property> </property>
<property name="currentItem"> <property name="currentItem">
<number>15</number> <number>18</number>
</property> </property>
</widget> </widget>
<widget class="QLabel" row="2" column="1"> <widget class="QLabel" row="2" column="1">
@ -885,6 +900,21 @@
<string>Meissner State Model</string> <string>Meissner State Model</string>
</property> </property>
</item> </item>
<item>
<property name="text">
<string>Lor-Gss combi KT</string>
</property>
</item>
<item>
<property name="text">
<string>Lor-Gss combi KT x Exp</string>
</property>
</item>
<item>
<property name="text">
<string>Lor-Gss combi KT x SExp</string>
</property>
</item>
<property name="name"> <property name="name">
<cstring>FitType1</cstring> <cstring>FitType1</cstring>
</property> </property>
@ -1590,6 +1620,21 @@
<string>Meissner State Model</string> <string>Meissner State Model</string>
</property> </property>
</item> </item>
<item>
<property name="text">
<string>Lor-Gss combi KT</string>
</property>
</item>
<item>
<property name="text">
<string>Lor-Gss combi KT x Exp</string>
</property>
</item>
<item>
<property name="text">
<string>Lor-Gss combi KT x SExp</string>
</property>
</item>
<item> <item>
<property name="text"> <property name="text">
<string>None</string> <string>None</string>
@ -1607,7 +1652,7 @@
</sizepolicy> </sizepolicy>
</property> </property>
<property name="currentItem"> <property name="currentItem">
<number>15</number> <number>18</number>
</property> </property>
</widget> </widget>
<widget class="QLabel" row="0" column="1"> <widget class="QLabel" row="0" column="1">

View File

@ -328,7 +328,10 @@ void MuSRFitform::CreateAllInput()
12,"GLFSExp", 12,"GLFSExp",
13,"MolMag", 13,"MolMag",
14,"Meissner", 14,"Meissner",
15,"None" 15,"LGKT",
16,"LGKTExp",
17,"LGKTSExp",
18,"None"
); );
my $FT1=FitType1->currentItem; my $FT1=FitType1->currentItem;
@ -476,10 +479,19 @@ void MuSRFitform::CallMSRCreate()
if ($Answer) { if ($Answer) {
if ( $All{"FitAsyType"} eq "Asymmetry" ) { if ( $All{"FitAsyType"} eq "Asymmetry" ) {
if ($All{"RUNSType"}) { 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 { } else {
# my ($Full_T_Block,$Paramcomp_ref)= MSR::CreateMSRSh(\%All); # my ($Full_T_Block,$Paramcomp_ref,$FullMSRFile)= MSR::CreateMSRSh(\%All);
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);
# if it is multiple runs then the produced file is a template # if it is multiple runs then the produced file is a template
my $FILENAME=$All{"FILENAME"}.".msr"; my $FILENAME=$All{"FILENAME"}.".msr";
my $Extension = "_".$All{"BeamLine"}."_".$All{"YEAR"}; my $Extension = "_".$All{"BeamLine"}."_".$All{"YEAR"};
@ -503,10 +515,13 @@ void MuSRFitform::CallMSRCreate()
close(FTO); close(FTO);
} }
} }
} }
elsif ( $All{"FitAsyType"} eq "SingleHist" ) { 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(); UpdateMSRFileInitTable();
} }

View File

@ -42,6 +42,7 @@
ClassImp(TBNMR) // for the ROOT-dictionary ClassImp(TBNMR) // for the ROOT-dictionary
ClassImp(ExpRlx) ClassImp(ExpRlx)
ClassImp(SExpRlx) ClassImp(SExpRlx)
ClassImp(MLRes)
double TBNMR::operator()(double x, const vector<double> &par) const { double TBNMR::operator()(double x, const vector<double> &par) const {
assert(par.size()==1); // make sure the number of parameters handed to the function is correct 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<double> &par) const {
return y; return y;
} }
double MLRes::operator()(double x, const vector<double> &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;
}

View File

@ -90,3 +90,21 @@ public:
// definition of the class for the ROOT-dictionary // definition of the class for the ROOT-dictionary
ClassDef(SExpRlx,1) ClassDef(SExpRlx,1)
}; };
class MLRes : public PUserFcnBase {
public:
// default constructor and destructor
MLRes(){}
~MLRes(){}
Bool_t NeedGlobalPart() const { return false; }
void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
Bool_t GlobalPartIsValid() const { return true; }
// function operator
double operator()(double, const vector<double>&) const;
// definition of the class for the ROOT-dictionary
ClassDef(MLRes,1)
};

View File

@ -38,5 +38,6 @@
#pragma link C++ class TBNMR+; #pragma link C++ class TBNMR+;
#pragma link C++ class ExpRlx+; #pragma link C++ class ExpRlx+;
#pragma link C++ class SExpRlx+; #pragma link C++ class SExpRlx+;
#pragma link C++ class MLRes+;
#endif //__CINT__ #endif //__CINT__