merged root6

This commit is contained in:
2019-09-11 12:12:13 +02:00
99 changed files with 6983 additions and 19284 deletions

View File

@@ -4,10 +4,17 @@
set(MUSRFIT_INC ${CMAKE_SOURCE_DIR}/src/include)
set(CUBA_INC ${CMAKE_SOURCE_DIR}/src/external/libCuba/src)
# ROOT requires that the dictonary header files are found at configuration time.
# Hence, target_include_directories cannot be used here because, targets are
# setup only afterwards.
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
root_generate_dictionary(
BMWStartupHandlerDict
-I${MUSRFIT_INC}
BMWStartupHandler.h
OPTIONS
-I${MUSRFIT_INC}
-inlineInputHeader
LINKDEF BMWStartupHandlerLinkDef.h
MODULE BMWStartupHandler
)

View File

@@ -5,16 +5,22 @@ set(MUSRFIT_INC ${CMAKE_SOURCE_DIR}/src/include)
root_generate_dictionary(
PMagProximityFitterDict
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
PMagProximityFitter.h
OPTIONS
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
-I${CMAKE_CURRENT_SOURCE_DIR}
-inlineInputHeader
LINKDEF PMagProximityFitterLinkDef.h
MODULE PMagProximityFitter
)
root_generate_dictionary(
PMPStartupHandlerDict
-I${MUSRFIT_INC}
PMPStartupHandler.h
OPTIONS
-I${MUSRFIT_INC}
-I${CMAKE_CURRENT_SOURCE_DIR}
-inlineInputHeader
LINKDEF PMPStartupHandlerLinkDef.h
MODULE PMPStartupHandler
)
@@ -36,13 +42,6 @@ add_library(PMagProximityFitter SHARED
PMPStartupHandler.cpp
PMPStartupHandlerDict.cxx
)
#--- set target properties, e.g. version --------------------------------------
set_target_properties(PMagProximityFitter
PROPERTIES
VERSION ${P_MAG_PROXIMITY_FITTER_VERSION}
)
#--- make sure that the include directory is found ----------------------------
target_include_directories(
PMagProximityFitter BEFORE PRIVATE

2141
src/external/MuSRFitGUI/MSR.pm vendored Executable file → Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,991 +0,0 @@
/****************************************************************************
** ui.h extension file, included from the uic-generated form implementation.
**
** If you want to add, delete, or rename functions or slots, use
** Qt Designer to update this file, preserving your code.
**
** You should not define a constructor or destructor in this file.
** Instead, write your code in functions called init() and destroy().
** These will automatically be called by theform's constructor and
** destructor.
*****************************************************************************/
# This file is part of MuSRFitGUI.
#
# MuSRFitGUI 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.
#
# MuSRFitGUI 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 MuSRFitGUI. If not, see <http://www.gnu.org/licenses/>.
#
# Copyright 2009 by Zaher Salman and the LEM Group.
# <zaher.salman@psi.ch>
void MuSRFitMenu::fileOpen()
{
my $file=Qt::FileDialog::getOpenFileName(
".",
"MSR Files (*.msr *.mlog)",
this,
"open file dialog",
"Choose a MSR file");
print "Selected file: $file\n";
# TODO: Possibly decipher the MSR file and setup the GUI accordingly
# Find run numbers, beamlines etc.
# Get theory block and understand it
# Get parameters list and update table
}
void MuSRFitMenu::fileSave()
{
my %All=CreateAllInput();
my $FILENAME=$All{"FILENAME"}.".msr";
my $file=Qt::FileDialog::getSaveFileName(
"$FILENAME",
"MSR Files (*.msr *.mlog)",
this,
"save file dialog",
"Choose a filename to save under");
# If the user gave a filename the copy to it
if ($file ne "") {
# TODO: check if the extension is correct, or add it.
if (-e $FILENAME) {
my $cmd="cp $FILENAME $file";
my $pid=system($cmd);
} else {
if ($file ne "") {
my $Warning = "Warning: No MSR file found yet!";
my $WarningWindow = Qt::MessageBox::information( this, "Warning",$Warning);
}
}
}
}
void MuSRFitMenu::fileChangeDir()
{
my $newdir=Qt::FileDialog::getExistingDirectory(
"",
this,
"get existing directory",
"Choose a directory",
1);
chdir ("$newdir");
}
void MuSRFitMenu::filePrint()
{
}
void MuSRFitMenu::fileExit()
{
my $Ans = Qt::MessageBox::question( this, "Quit?","Are you sure you want to quit?","&Yes","&No","",0,1);
if ($Ans==0) {
# Then quit
Qt::Application::exit( 0 );
}
# Otherwize go back
}
void MuSRFitMenu::parametersExport()
{
my %All=CreateAllInput();
# Add also a flag for header
$All{"Header"}=1;
my $FILENAME=$All{"FILENAME"}.".dat";
my $file=Qt::FileDialog::getSaveFileName(
"$FILENAME",
"Data Files (*.dat)",
this,
"export file dialog",
"Choose a filename to export to");
# If the user gave a filename the copy to it
if ($file ne "") {
my $Text = MSR::ExportParams(\%All);
open( DATF,q{>},"$file" );
print DATF $Text;
close(DATF);
}
}
void MuSRFitMenu::parametersAppend()
{
my %All=CreateAllInput();
# Add also a flag for header
$All{"Header"}=0;
my $FILENAME=$All{"FILENAME"}.".dat";
my $file=Qt::FileDialog::getOpenFileName(
"./",
"Data Files (*.dat)",
this,
"append file dialog",
"Choose a filename to append to");
# If the user gave a filename the copy to it
if ($file ne "") {
my $Text = MSR::ExportParams(\%All);
open( DATF,q{>>},"$file" );
print DATF $Text;
close(DATF);
}
}
void MuSRFitMenu::editUndo()
{
}
void MuSRFitMenu::editRedo()
{
}
void MuSRFitMenu::editCut()
{
}
void MuSRFitMenu::editCopy()
{
}
void MuSRFitMenu::editPaste()
{
}
void MuSRFitMenu::helpIndex()
{
}
void MuSRFitMenu::helpContents()
{
}
void MuSRFitMenu::helpAbout()
{
my $AboutText="
This is a GUI that uses the musrfit binary, developed by Andreas Suter,
to fit muSR spectra.
MuSRFitGUI 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.
MuSRFitGUI 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 MuSRFitGUI. If not, see <http://www.gnu.org/licenses/>.
Copyright 2009 by Zaher Salman and the LEM Group.
<zaher.salman\@psi.ch>
";
my $AboutWindow = Qt::MessageBox::information( this, "About MuSRFit GUI",$AboutText);
}
void MuSRFitform::CreateAllInput()
{
my %All=();
# From RUNS Tab
# Run data file
$All{"RunNumbers"} = RunNumbers->text;
$All{"RunFiles"} = RunFiles->text;
$All{"BeamLine"} = BeamLine->currentText;
$All{"RUNSType"} = ManualFile->isOn();
$All{"optionsFourier"} = optionsFourier->isOn();
$All{"optionsT0"} = optionsT0->isOn();
$All{"YEAR"} =YEAR->currentText;
if ($All{"YEAR"} eq "") {
# If year combobox is empty fill it up from 2004 up to current year
my ($second, $minute, $hour, $dayOfMonth, $month, $yearOffset, $dayOfWeek, $dayOfYear, $daylightSavings) = localtime();
my $current_year = 1900 + $yearOffset;
for (my $i=$current_year;$i>=2004;$i--) {
YEAR->insertItem($i,-1);
}
}
# Time range and BINS
$All{"Tis"} = Tis->text;
$All{"Tfs"} = Tfs->text;
$All{"BINS"} = BINS->text;
$All{"FitAsyType"} = FitAsyType->currentText;
$All{"LRBF"} = LRBF->text;
my @Hists = split(/,/, $All{"LRBF"} );
# Lifetime corrections in enabled/visible only for SingleHis fits
if ( $All{"FitAsyType"} eq "Asymmetry" ) {
ltc->setHidden(1);
}
elsif ( $All{"FitAsyType"} eq "SingleHist" ) {
ltc->setHidden(0);
}
# From Fitting Tab
# Plot range
$All{"Xi"}=Xi->text;
$All{"Xf"}=Xf->text;
$All{"Yi"}=Yi->text;
$All{"Yf"}=Yf->text;
$All{"ViewBin"}=ViewBin->text;
# Life time correction
if (ltc->isChecked()) {
$All{"ltc"}="y";
} else {
$All{"ltc"}="n";
}
# Minuit commands
if ( $All{"go"} eq "" ) {
$All{"go"}="PLOT";
}
# Get minimization process
$All{"Minimization"} = Minimization->currentText();
$All{"go"}=$All{"Minimization"};
# Get Error calculation process
$All{"ErrorCalc"} = ErrorCalc->currentText();
$All{"go"}=$All{"ErrorCalc"};
RunSelectionToggle();
my @RUNS = ();
if ($All{"RUNSType"} ) {
@RUNS = split( /,/, $All{"RunFiles"});
} else {
$All{"RunNumbers"} =~ s/[\ \.\~\/\&\*\[\;\>\<\^\$\(\)\`\|\]\'\@]/,/g;
@RUNS = split( /,/, $All{"RunNumbers"} );
}
# From MSR File Tab
$All{"TITLE"}= TITLE->text;
$All{"FILENAME"}= FILENAME->text;
# From Fourier Tab
$All{"FUNITS"}= FUnits->currentText;
$All{"FAPODIZATION"}= FApodization->currentText;
$All{"FPLOT"}= FPlot->currentText;
$All{"FPHASE"}=FPHASE->text;
# Fourier range
$All{"FrqMin"}=FrqMin->text;
$All{"FrqMax"}=FrqMax->text;
# Rotating reference frame parameters
$All{"RRFFrq"}=RRFFrq->text;
$All{"RRFPack"}=RRFPack->text;
$All{"RRFPhase"}=RRFPhase->text;
$All{"RRFUnits"}=RRFUnits->currentText;
# Get values of t0 and Bg/Data bins if given
my $NHist = 1;
foreach my $Hist (@Hists) {
foreach ("t0","Bg1","Bg2","Data1","Data2") {
my $Name = "$_$NHist";
$All{$Name}=child($Name)->text;
# TODO: If empty fill with defaults
if ($All{$Name} eq "") {
$All{$Name}=MSR::T0BgData($_,$Hist,$All{"BeamLine"});
child($Name)->setText($All{$Name});
}
}
$NHist++;
}
# Construct fittypes that can be understood by MSR.pm
my %FTs=(0,"Exponential",
1,"Gaussian",
2,"Stretch",
3,"ExponentialCos",
4,"GaussianCos",
5,"StretchCos",
6,"LDKTLF",
7,"GDKTLF",
8,"Background",
9,"LLFExp",
10,"GLFExp",
11,"LLFSExp",
12,"GLFSExp",
13,"MolMag",
14,"Meissner",
15,"None"
);
my $FT1=FitType1->currentItem;
my $FT2=FitType2->currentItem;
my $FT3=FitType3->currentItem;
$All{"FitType1"} = $FTs{$FT1};
$All{"FitType2"} = $FTs{$FT2};
$All{"FitType3"} = $FTs{$FT3};
my @FitTypes =();
my $FitType="";
foreach $FitType ($All{"FitType1"}, $All{"FitType2"}, $All{"FitType3"}) {
if ( $FitType ne "None" ) {
push( @FitTypes, $FitType );
}
}
# Also theory block and paramets list
my ($Full_T_Block,$Paramcomp_ref)= MSR::CreateTheory(@FitTypes);
$All{"Full_T_Block"}=$Full_T_Block;
$All{"Paramcomp_ref"}=$Paramcomp_ref;
my @Paramcomp = @$Paramcomp_ref;
# Functions block
$All{"FunctionsBlock"}=FunctionsBlock->text;
# and the associated theory block
$All{"Func_T_Block"}=TheoryBlock->text;
# Shared settings are detected here
$All{"EnableSharing"} = buttonGroupSharing->isChecked();
my $Shared = 0;
my $PCount =0;
my $Component=1;
foreach $FitType (@FitTypes) {
my $Parameters=$Paramcomp[$Component-1];
my @Params = split( /\s+/, $Parameters );
if ( $Component == 1 && $All{"FitAsyType"} eq "Asymmetry" ) {
unshift( @Params, "Alpha" );
}
elsif ( $Component == 1 && $All{"FitAsyType"} eq "SingleHist" ) {
unshift( @Params, ( "No", "NBg" ) );
}
# This is the counter for parameters of this component
my $NP=1;
$Shared = 0;
# Change state/label of parameters
foreach my $Param (@Params) {
my $Param_ORG = $Param;
# TODO: I need to take care of single hist fits here
if ( $All{"FitAsyType"} eq "SingleHist" ) {
$Param=$Param.$Hists[0];
}
if ( $#FitTypes != 0 && ( $Param ne "Alpha" && $Param ne "No" && $Param ne "NBg" ) ){
$Param = join( "", $Param, "_", $Component);
}
# Is there any point of sharing, multiple runs?
if ( $#RUNS == 0 && $All{"FitAsyType"} eq "Asymmetry") {
$Shared = 1;
}
elsif ( $#RUNS == 0 && $#Hists == 0 && $All{"FitAsyType"} eq "SingleHist" ) {
$Shared = 1;
} else {
# Check if shared or not, construct name of checkbox, find its handle and then
# check if it is checked
my $ChkName="ShParam_".$Component."_".$NP;
my $ChkBx = child($ChkName);
$Shared = $ChkBx->isChecked();
}
$All{"Sh_$Param"}=$Shared;
$NP++;
}
#Loop on parameters
$Component++;
}
# Loop on components
# Done with shared parameters detecting
# Construct a default filename if empty
if ( $All{"FILENAME"} eq "" && !$All{"RUNSType"}) {
$All{"FILENAME"}=$RUNS[0]."_".$All{"BeamLine"}."_".$All{"YEAR"};
if ($All{"BeamLine"} eq "LEM (PPC)") {
$All{"FILENAME"}=$RUNS[0]."_LEM_".$All{"YEAR"};
}
} else {
$All{"FILENAME"}="TMP";
}
# This has to be at the end of CreateAll
my %PTable=MSR::PrepParamTable(\%All);
# Setup the table with the right size
my $NParam=scalar keys( %PTable );
# Read initial values of paramets from tabel
my $erradd = "d";
my $minadd = "_min";
my $maxadd = "_max";
my $Header=InitParamTable->verticalHeader();
# TODO: Should not go over all rows, only on parameters.
if ($NParam > 0) {
for (my $i=0;$i<$NParam;$i++) {
# Take label of row, i.e. name of parameter
my $Param=$Header->label($i);
# Then take the value, error, max and min (as numbers)
$All{"$Param"}=1.0*InitParamTable->text($i,0);
$All{"$erradd$Param"}=1.0*InitParamTable->text($i,1);
$All{"$Param$minadd"}=1.0*InitParamTable->text($i,2);
$All{"$Param$maxadd"}=1.0*InitParamTable->text($i,3);
}
}
# Return Hash with all important values
return %All;
}
void MuSRFitform::CallMSRCreate()
{
use MSR;
my %All=CreateAllInput();
# Check if the option for checking for existing files is selected
my $FileExistCheck= FileExistCheck->isOn();
my $FILENAME=$All{"FILENAME"}.".msr";
my $Answer=0;
if ($All{"RunNumbers"} ne "" || $All{"RunFiles"} ne "") {
if ( $FileExistCheck==1 ) {
if (-e $FILENAME) {
# Warning: MSR file exists
# my $Warning = "Warning: MSR file $FILENAME Already exists!\nIf you continue it will overwriten.";
my $Warning = "Warning: MSR file $FILENAME Already exists!\nDo you want to overwrite it?";
# my $WarningWindow = Qt::MessageBox::information( this, "Warning",$Warning);
# $Answer =1,0 for yes and no
$Answer= Qt::MessageBox::warning( this, "Warning",$Warning, "&No", "&Yes", undef, 1,1);
}
} else {
# Just overwrite file
$Answer=1;
}
if ($Answer) {
if ( $All{"FitAsyType"} eq "Asymmetry" ) {
my ($Full_T_Block,$Paramcomp_ref)= MSR::CreateMSR(\%All);
}
elsif ( $All{"FitAsyType"} eq "SingleHist" ) {
my ($Full_T_Block,$Paramcomp_ref)= MSR::CreateMSRSingleHist(\%All);
}
UpdateMSRFileInitTable();
}
}
return $Answer;
}
void MuSRFitform::UpdateMSRFileInitTable()
{
my %All=CreateAllInput();
my $FILENAME=$All{"FILENAME"};
open (MSRF,q{<},"$FILENAME.msr" );
my @lines = <MSRF>;
close(IFILE);
textMSROutput->setText("");
foreach my $line (@lines) {
textMSROutput->append("$line");
}
(my $TBlock_ref, my $FPBlock_ref)=MSR::ExtractBlks(@lines);
my @FPBloc = @$FPBlock_ref;
my $PCount=0;
foreach my $line (@FPBloc) {
$PCount++;
my @Param=split(/\s+/,$line);
# Depending on how many elements in @Param determine what they mean
# 0th element is empty (always)
# 1st element is the order (always)
# 2nd element is the name (always)
# 3rd element is the value (always)
# 4th element can be taken as step/error (always)
# 5th element can be
# if it is last element or there are two more = positive error, check $#Param=5/7
# if there is only one more = minimum, check $#Param=6
# To summarize, check the value of $#Param
my $value=1.0*$Param[3];
my $error = 1.0*$Param[4];
my $minvalue=0.0;
my $maxvalue=0.0;
if ($#Param == 4) {
$minvalue=0.0;
$maxvalue=0.0;
}
elsif ($#Param == 6) {
$minvalue=1.0*$Param[5];
$maxvalue=1.0*$Param[6];
}
elsif ($#Param == 5 || $#Param == 7) {
$minvalue=1.0*$Param[6];
$maxvalue=1.0*$Param[7];
}
# Now update the initialization tabel
InitParamTable->setText($PCount-1,0,$value);
InitParamTable->setText($PCount-1,1,$error);
InitParamTable->setText($PCount-1,2,$minvalue);
InitParamTable->setText($PCount-1,3,$maxvalue);
# Set bg color to mark different runs
}
return;
}
void MuSRFitform::ActivateT0Hists()
{
my %All=CreateAllInput();
my @Hists = split(/,/, $All{"LRBF"} );
my $HistBox = "";
for (my $iHist=1; $iHist<=4; $iHist++) {
$HistBox="groupHist$iHist";
my $HistBoxHandle = child($HistBox);
if ($iHist<=$#Hists+1) {
# Activate this histogram box
$HistBoxHandle->setHidden(0);
$HistBoxHandle->setEnabled(1);
$HistBoxHandle->setTitle("Hist # $Hists[$iHist-1]");
} else {
# Deactivate this histogram box
$HistBoxHandle->setHidden(1);
$HistBoxHandle->setEnabled(0);
}
}
# TODO: Set default values
}
void MuSRFitform::ActivateShComp()
{
my %All=CreateAllInput();
my @RUNS = split( /,/, $All{"RunNumbers"} );
# Hide all sharing components
SharingComp1->setHidden(1);
SharingComp2->setHidden(1);
SharingComp3->setHidden(1);
SharingComp1->setEnabled(0);
SharingComp2->setEnabled(0);
SharingComp3->setEnabled(0);
my @FitTypes =();
foreach my $FitType ($All{"FitType1"}, $All{"FitType2"}, $All{"FitType3"}) {
if ( $FitType ne "None" ) {
push( @FitTypes, $FitType );
}
}
# Get number of parameters to determine the size of the table
my ($Full_T_Block,$Paramcomp_ref)= MSR::CreateTheory(@FitTypes);
# For now the line below does not work. Why?
# my $Paramcomp_ref=$All{"Paramcomp_ref"};
my @Paramcomp = @$Paramcomp_ref;
my $Full_T_Block= $All{"Full_T_Block"};
# Possible to share only if sharing is enabled altogether
my $EnableSharing = $All{"EnableSharing"};
if ($EnableSharing) {
my $Component=1;
foreach my $FitType (@FitTypes) {
my $Parameters=$Paramcomp[$Component-1];
my @Params = split( /\s+/, $Parameters );
if ( $Component == 1 && $All{"FitAsyType"} eq "Asymmetry" ) {
unshift( @Params, "Alpha" );
}
elsif ( $Component == 1 && $All{"FitAsyType"} eq "SingleHist" ) {
unshift( @Params, ( "No", "NBg" ) );
}
# Make the component appear first (only if we have multiple runs)
my $ShCompG="SharingComp".$Component;
my $ShCG = child($ShCompG);
if ($#RUNS>0) {
$ShCG->setHidden(0);
$ShCG->setEnabled(1);
}
my $CompShLabel = "Comp".$Component."ShLabel";
my $CompShL = child($CompShLabel);
$CompShL->setText($All{"FitType$Component"});
# Change state/label of parameters
for (my $i=1; $i<=9;$i++) {
my $ParamChkBx="ShParam_".$Component."_".$i;
my $ChkBx = child($ParamChkBx);
if ($Params[$i-1] ne "") {
$ChkBx->setHidden(0);
$ChkBx->setEnabled(1);
$ChkBx ->setText($Params[$i-1]);
} else {
$ChkBx->setHidden(1);
}
}
$Component++;
}
}
}
void MuSRFitform::InitializeTab()
{
my %All=CreateAllInput();
InitParamTable->setLeftMargin(100);
my $NRows = InitParamTable->numRows();
# Remove any rows in table
if ($NRows > 0) {
for (my $i=0;$i<$NRows;$i++) {
# TODO: Better remove the row rather than hide it.
InitParamTable->hideRow($i);
# InitParamTable->removeRow($i);
}
}
my %PTable=MSR::PrepParamTable(\%All);
# Setup the table with the right size
my $NParam=scalar keys( %PTable );
if ($NParam>$NRows) {
InitParamTable->setNumRows($NParam);
}
# Fill the table with labels and values of parametr
for (my $PCount=0;$PCount<$NParam;$PCount++) {
my ($Param,$value,$error,$minvalue,$maxvalue,$RUN) = split(/,/,$PTable{$PCount});
# Now make sure we have no nans
if ($error eq "nan") { $error=0.1;}
# If you use this then reading the parameters from the table is a problem
# You need to extract the correct parameter name from the row label
# InitParamTable->verticalHeader()->setLabel( $PCount,"$RUN: $Param");
InitParamTable->verticalHeader()->setLabel( $PCount,"$Param");
InitParamTable->showRow($PCount);
InitParamTable->setText($PCount,0,$value);
InitParamTable->setText($PCount,1,$error);
InitParamTable->setText($PCount,2,$minvalue);
InitParamTable->setText($PCount,3,$maxvalue);
}
}
void MuSRFitform::TabChanged()
{
# TODO: First check if there are some runs given, otherwise disbale
my %All=CreateAllInput();
# First make sure we have sharing initialized
ActivateShComp();
# Here we need to apply sharing if selected...
InitializeTab();
UpdateMSRFileInitTable();
# And also setup T0 and Bg bins
ActivateT0Hists();
# Initialize FUNCTIONS block only if it has not been initialized yet
if ($All{"Func_T_Block"} eq "" ) {
InitializeFunctions();
}
}
void MuSRFitform::GoFit()
{
my %All=CreateAllInput();
# Check here is the number of histograms makes sense
# other wise give error.
my @Hists = split( /,/, $All{"LRBF"} );
if ($All{"FitAsyType"} eq "Asymmetry" && $#Hists != 1) {
# we have a problem here send error message
my $Warning = "Error: The number of histograms should be 2 for an asymmetry fit!";
my $WarningWindow = Qt::MessageBox::information( this, "Error",$Warning);
} else {
musrfit_tabs->setCurrentPage(1);
my $Answer=CallMSRCreate();
if ($Answer) {
my $FILENAME=$All{"FILENAME"}.".msr";
if (-e $FILENAME) {
my $cmd="musrfit -t $FILENAME";
my $pid = open(FTO,"$cmd 2>&1 |");
while (<FTO>) {
FitTextOutput->append("$_");
}
close(FTO);
$cmd="musrview $FILENAME &";
$pid = system($cmd);
} else {
FitTextOutput->append("Cannot find MSR file!");
}
FitTextOutput->append("-----------------------------------------------------------------------------------------------------------------------------");
# update MSR File tab and initialization table
UpdateMSRFileInitTable();
}
}
return;
}
void MuSRFitform::GoPlot()
{
my %All=CreateAllInput();
# Check here is the number of histograms makes sense
# other wise give error.
my @Hists = split( /,/, $All{"LRBF"} );
if ($All{"FitAsyType"} eq "Asymmetry" && $#Hists != 1) {
# we have a problem here send error message
my $Warning = "Error: The number of histograms should be 2 for an asymmetry fit!";
my $WarningWindow = Qt::MessageBox::information( this, "Error",$Warning);
} else {
my $Answer=CallMSRCreate();
my $FILENAME=$All{"FILENAME"}.".msr";
if ($Answer) {
if (-e $FILENAME) {
my $cmd="musrview $FILENAME &";
my $pid = system($cmd);
} else {
FitTextOutput->append("Cannot find MSR file!");
FitTextOutput->append("-----------------------------------------------------------------------------------------------------------------------------");
}
}
}
return;
}
void MuSRFitform::ShowMuSRT0()
{
my %All=CreateAllInput();
musrfit_tabs->setCurrentPage(6);
# Create MSR file and then run musrt0
my $Answer=CallMSRCreate();
if ($Answer) {
my $FILENAME=$All{"FILENAME"}.".msr";
if (-e $FILENAME) {
my $cmd="musrt0 $FILENAME &";
my $pid = system($cmd);
t0Update->setEnabled(1)
} else {
print STDERR "Cannot find MSR file!\n";
}
}
return;
}
void MuSRFitform::T0Update()
{
my %All = CreateAllInput();
my @Hists = split(/,/, $All{"LRBF"} );
# Get values of t0 and Bg/Data bins if given
my $NHist = 1;
foreach my $Hist (@Hists) {
foreach ("t0","Bg1","Bg2","Data1","Data2") {
my $Name = "$_$NHist";
my $tmp=MSR::T0BgData($_,$Hist,$All{"BeamLine"});
child($Name)->setText($tmp);
}
$NHist++
}
}
void MuSRFitform::RunSelectionToggle()
{
my $ManualFile= ManualFile->isOn();
if ($ManualFile) {
# Manual RUN selection
RUNSMan->setEnabled(1);
RUNSMan->setHidden(0);
RunNumbers->setText("");
RUNSAuto->setEnabled(0);
RUNSAuto->setHidden(1);
} else {
# Auto RUN selection
RUNSMan->setEnabled(0);
RUNSMan->setHidden(1);
RunFiles->setText("");
RUNSAuto->setEnabled(1);
RUNSAuto->setHidden(0);
}
# Also use this for other options
# Fourier toggle
my $Fourier=optionsFourier->isOn();
if ($Fourier) {
# Fourier tab visible
# musrfit_tabs->addTab(FourierPage,"Fourier");
# musrfit_tabs->showPage(FourierPage);
# FourierPage->hide();
} else {
# Fourier tab invisible
# musrfit_tabs->removePage(FourierPage);
# FourierPage->show();
}
}
void MuSRFitform::fileBrowse()
{
my $RunFiles=RunFiles->text();
print "Runs:$RunFiles\n";
my $files_ref=Qt::FileDialog::getOpenFileNames(
"Data files (*.root *.bin)",
"./",
this,
"open files dialog",
"Select one or more files to fit");
my @files = @$files_ref;
if ($RunFiles eq "") {
# We started with an empty list
$RunFiles=join(",",@files);
} else {
# Add files to existing list
$RunFiles=join(",",$RunFiles,@files);
}
RunFiles->setText($RunFiles);
}
void MuSRFitform::AppendToFunctions()
{
my $ParName=CParamsCombo->currentText();
my $Full_T_Block=TheoryBlock->text;
my $Constraint=ConstraintLine->text;
# Then clear the text
ConstraintLine->setText("");
# Check how many constraints (lines) in FUNCTIONS Block
my $i=FunctionsBlock->lines();
my $ConstLine="fun$i = $Constraint\n";
FunctionsBlock->append($ConstLine);
# Replace parameter in theory block with fun$i
$Full_T_Block=~ s/$ParName/fun$i/;
TheoryBlock->setText($Full_T_Block);
}
void MuSRFitform::InitializeFunctions()
{
my %All=CreateAllInput();
my @RUNS = split( /,/, $All{"RunNumbers"} );
my @FitTypes =();
foreach my $FitType ($All{"FitType1"}, $All{"FitType2"}, $All{"FitType3"}) {
if ( $FitType ne "None" ) {
push( @FitTypes, $FitType );
}
}
# Get number of parameters to determine the size of the table
my ($Full_T_Block,$Paramcomp_ref)= MSR::CreateTheory(@FitTypes);
my @Paramcomp = @$Paramcomp_ref;
my $Full_T_Block= $All{"Full_T_Block"};
# Initialize Parameters List in function block (constraints).
my $ParametersList="";
ParametersList->setText("");
# Counter for function block (with out Alpha etc.)
my $ParCount=0;
CParamsCombo->clear();
# Possibly use the parameters block to axtract names for the dropdown menu
# this makes sense if we can use fun in map line. Check!
my $Component=1;
foreach my $FitType (@FitTypes) {
my $Parameters=$Paramcomp[$Component-1];
my @Params = split( /\s+/, $Parameters );
# Alpha, No and NBg are counted in the parameters
if ( $Component == 1 && $All{"FitAsyType"} eq "Asymmetry" ) {
unshift( @Params, "Alpha" );
}
elsif ( $Component == 1 && $All{"FitAsyType"} eq "SingleHist" ) {
unshift( @Params, ( "No", "NBg" ) );
}
# Add list to the constraints drop down menu
for (my $i=1; $i<=9;$i++) {
my $CParam = $Params[$i-1]."_".$Component;
if ($Params[$i-1] ne "" ) {
if ($Params[$i-1] ne "Alpha" && $Params[$i-1] ne "No" && $Params[$i-1] ne "NBg") {
CParamsCombo->insertItem($CParam,-1);
$Full_T_Block=~ s/\b$Params[$i-1]\b/$CParam/;
}
# also enumerate the parameters as should be used in the FUNCTIONS Block
$ParCount++;
$ParametersList=$ParametersList."$CParam \t is \t par$ParCount\n";
ParametersList->setText($ParametersList);
}
}
$Component++;
}
# Set theory block in Constraints
TheoryBlock->setText($Full_T_Block);
# Then clear the text
ConstraintLine->setText("");
FunctionsBlock->setText("");
}
void MuSRFitform::optionConfigure()
{
use Customize;
my $Customize = Qt::Dialog(this);
my $w = Customize;
$w->setModal(1);
$w->exec();
# $Customize->setMainWidget($w);
# $w->show;
# exit $Customize->exec;
}
void MuSRFitform::t0UpdateClicked()
{
# Read MSR file and get new values of t0,Bg and Data
my %All=CreateAllInput();
my $FILENAME=$All{"FILENAME"};
open (MSRF,q{<},"$FILENAME.msr" );
my @lines = <MSRF>;
close(IFILE);
my @T0s = grep {/t0 /} @lines;
my @Bgs = grep {/background /} @lines;
my @Datas = grep {/data /} @lines;
my @Hists = split(/,/, $All{"LRBF"} );
my $NHist = $#Hists+1;
print "Histograms: $NHist\n";
my $FinHist = 1;
# First T0s
while ($FinHist) {
my $counter=0;
(my $tmp,my @SplitT0) = split( /\s+/, $T0s[$counter]);
(my $tmp,my @SplitBg) = split( /\s+/, $Bgs[$counter]);
(my $tmp,my @SplitData) = split( /\s+/, $Datas[$counter]);
if ($#SplitBg>0) {
foreach (@SplitBg) {
print $_."\n";
}
}
$counter++;
if ($counter>=$#Bgs) {$FinHist=0;}
}
# Finally, disable the update button
t0Update->setEnabled(0);
# t0Update->setText("musrt0")
}

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 46 KiB

View File

@@ -1,8 +1,19 @@
# - TMusrRunHeader library ----------------------------------------------------
#--- generate necessary dictionaries ------------------------------------------
set(MUSRROOT_INC ${CMAKE_SOURCE_DIR}/src/external/MusrRoot)
# ROOT requires that the dictonary header files are found at configuration time.
# Hence, target_include_directories cannot be used here because, targets are
# setup only afterwards.
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
root_generate_dictionary(
TMusrRunHeaderDict TMusrRunHeader.h LINKDEF TMusrRunHeaderLinkDef.h
TMusrRunHeaderDict
TMusrRunHeader.h
OPTIONS
-I${MUSRROOT_INC}
-inlineInputHeader
LINKDEF TMusrRunHeaderLinkDef.h
MODULE TMusrRunHeader
)
@@ -20,6 +31,10 @@ add_library(TMusrRunHeader SHARED
TMusrRunHeader.cpp
TMusrRunHeaderDict.cxx
)
#--- make sure that the include directory is found ----------------------------
target_include_directories(
TMusrRunHeader BEFORE PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
)
#--- set target properties, e.g. version --------------------------------------
set_target_properties(TMusrRunHeader
@@ -27,11 +42,6 @@ set_target_properties(TMusrRunHeader
VERSION ${MUSR_ROOT_VERSION}
)
#--- make sure that the include directory is found ----------------------------
target_include_directories(
TMusrRunHeader BEFORE PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
)
#--- add library dependencies -------------------------------------------------
target_link_libraries(TMusrRunHeader ${ROOT_LIBRARIES})

View File

@@ -2,17 +2,32 @@
#--- generate necessary dictionaries ------------------------------------------
set(MUSRFIT_INC ${CMAKE_SOURCE_DIR}/src/include)
set(NONLOCAL_INC ${CMAKE_SOURCE_DIR}/src/external/Nonlocal)
# ROOT requires that the dictonary header files are found at configuration time.
# Hence, target_include_directories cannot be used here because, targets are
# setup only afterwards.
include_directories(${MUSRFIT_INC} ${NONLOCAL_INC})
root_generate_dictionary(
PNL_PippardFitterDict
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
PNL_PippardFitter.h
OPTIONS
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
-I${NONLOCAL_INC}
-I${CMAKE_CURRENT_SOURCE_DIR}
-inlineInputHeader
LINKDEF PNL_PippardFitterLinkDef.h
MODULE PNL_PippardFitter
)
root_generate_dictionary(
PNL_StartupHandlerDict PNL_StartupHandler.h LINKDEF PNL_StartupHandlerLinkDef.h
PNL_StartupHandlerDict
PNL_StartupHandler.h
OPTIONS
-I${NONLOCAL_INC}
-I${CMAKE_CURRENT_SOURCE_DIR}
-inlineInputHeader
LINKDEF PNL_StartupHandlerLinkDef.h
MODULE PNL_StartupHandler
)
@@ -33,19 +48,13 @@ add_library(PNL_PippardFitter SHARED
PNL_StartupHandler.cpp
PNL_StartupHandlerDict.cxx
)
#--- set target properties, e.g. version --------------------------------------
set_target_properties(PNL_PippardFitter
PROPERTIES
VERSION ${PNL_PIPPARDFITTER_VERSION}
)
#--- make sure that the include directory is found ----------------------------
target_include_directories(
PNL_PippardFitter BEFORE PRIVATE
$<BUILD_INTERFACE:${FFTW3_INCLUDE_DIR}>
$<BUILD_INTERFACE:${MUSRFIT_INC}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}>
)
#--- set target properties, e.g. version --------------------------------------
@@ -71,7 +80,8 @@ install(
#--- install PNL_PippardFitter header -----------------------------------------
install(
FILES
FILES
PNonlocal.h
PNL_PippardFitter.h
PNL_RgeHandler.h
PNL_StartupHandler.h

View File

@@ -1,12 +1,27 @@
# -TLemRunHeader library ------------------------------------------------------
#--- generate necessary dictionaries ------------------------------------------
# ROOT requires that the dictonary header files are found at configuration time.
# Hence, target_include_directories cannot be used here because, targets are
# setup only afterwards.
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
root_generate_dictionary(
TLemRunHeaderDict TLemRunHeader.h LINKDEF TLemRunHeaderLinkDef.h
TLemRunHeaderDict
TLemRunHeader.h
OPTIONS
-I${CMAKE_CURRENT_SOURCE_DIR}
-inlineInputHeader
LINKDEF TLemRunHeaderLinkDef.h
MODULE TLemRunHeader
)
root_generate_dictionary(
TLemStatsDict TLemStats.h LINKDEF TLemStatsLinkDef.h
TLemStatsDict
TLemStats.h
OPTIONS
-I${CMAKE_CURRENT_SOURCE_DIR}
-inlineInputHeader
LINKDEF TLemStatsLinkDef.h
MODULE TLemStats
)

Binary file not shown.

View File

@@ -1,96 +0,0 @@
DATA
592.75 0.0466642055 0.00075601151
693.25 0.042699595 0.0007136273
793.75 0.03943051 0.000679583922
894.25 0.0366291886 0.000652378784
994.75 0.0355316716 0.000664640277
1095.25 0.033304272 0.000610910492
1195.75 0.0322397741 0.000595454518
1296.25 0.0308209315 0.000581648459
1396.75 0.0301227967 0.000569861788
1497.25 0.0289808195 0.000559611024
1597.75 0.0284020831 0.000550685264
1698.25 0.0272996592 0.000542785334
1798.75 0.0259033059 0.000536112979
1899.25 0.0257421462 0.000529928146
1999.75 0.0252476607 0.000524276201
2100.25 0.0252439822 0.00049508141
2200.75 0.0244494569 0.000514789454
2301.25 0.0248826473 0.000510792766
2401.75 0.0252364689 0.000507093213
2502.25 0.024077753 0.000503959631
2602.75 0.0239705744 0.000501170092
2703.25 0.023648613 0.000498351823
2803.75 0.0236132062 0.000496113677
2904.25 0.0232728359 0.000494038794
3004.75 0.0229806315 0.00049216698
3105.25 0.0226408705 0.000490122174
3205.75 0.022949639 0.000488517677
3306.25 0.0236152274 0.000487206227
3406.75 0.022514855 0.000485776619
3507.25 0.0232919509 0.000484617162
3607.75 0.0227762445 0.000483435077
3708.25 0.0225740091 0.000482352785
3808.75 0.0217810425 0.000481423643
3909.25 0.0210459719 0.000480488676
4009.75 0.0200829485 0.0004835672
4110.25 0.0144273479 0.000480165881
4210.75 0.0104726937 0.000526210282
4311.25 0.00977670745 0.000548717033
4411.75 0.00734786823 0.000572069626
4512.25 0.0071749696 0.000596458669
4612.75 0.0061713664 0.000621795033
4713.25 0.00457656715 0.000648552578
4813.75 0.00253947053 0.000676064828
4914.25 0.00298436429 0.000705158693
5014.75 0.00520775648 0.000735097152
5115.25 0.00372267868 0.000766213043
5215.75 0.00284020846 0.000798853062
5316.25 0.00158717036 0.000832862333
5416.75 0.00200819085 0.000868342561
5517.25 0.0044706107 0.000905327348
5617.75 0.00135523051 0.000943421323
5718.25 0.000261760966 0.000983714257
5818.75 0.000210009562 0.00102515713
5919.25 -0.000157024642 0.00106890614
6019.75 0.000611697915 0.00111378026
6120.25 0.000353532075 0.00111004546
6220.75 0.00120570511 0.00121565301
6321.25 -0.00126499964 0.00126730997
6421.75 0.0029594966 0.00132005144
6522.25 -0.00180278144 0.00137777581
6622.75 0.00154819637 0.00143478041
6723.25 0.00137296473 0.00149757271
6823.75 -0.000271202669 0.00155948172
6924.25 -0.00306837271 0.00162568622
7024.75 0.00346602562 0.00169188976
7125.25 -8.40576554E-05 0.00176525436
7225.75 0.00141055893 0.00183909095
7326.25 -0.00170315946 0.00191744238
7426.75 0.00399357243 0.00199844555
7527.25 0.00378603394 0.00208493839
7627.75 -0.0015303158 0.00216992033
7728.25 -0.000931658073 0.00226567509
7828.75 0.0011671311 0.00235924947
7929.25 0.00147725609 0.00245769641
8029.75 -0.00100983925 0.00256942322
8130.25 -0.00329542124 0.00255286858
8230.75 0.000636890228 0.00279597795
8331.25 -0.000814018633 0.00291290155
8431.75 0.000101912547 0.00303673191
8532.25 0.00311038784 0.0031603991
8632.75 0.000473049572 0.00329964113
8733.25 8.36732E-05 0.00343974064
8833.75 0.000275585165 0.00358184548
8934.25 0.0059381551 0.00373021006
9034.75 -0.0014588358 0.0038926573
9135.25 -0.00158156038 0.00405870998
9235.75 -0.00125287442 0.00422594705
9336.25 -0.00212622165 0.00439704849
9436.75 -0.00477056006 0.0045911195
9537.25 -0.00229735693 0.00479087708
9637.75 0.00575469607 0.00498561109
9738.25 -7.52893075E-05 0.00519483122
9838.75 -0.00368605583 0.0054198485
9939.25 -0.00862419517 0.00564201231
10039.75 -0.0323936833 0.0181186246

View File

@@ -5,12 +5,18 @@ add_subdirectory(libLineProfile)
#--- generate necessary dictionaries ------------------------------------------
set(MUSRFIT_INC ${CMAKE_SOURCE_DIR}/src/include)
# ROOT requires that the dictonary header files are found at configuration time.
# Hence, target_include_directories cannot be used here because, targets are
# setup only afterwards.
include_directories(${CMAKE_CURRENT_BINARY_DIR})
root_generate_dictionary(
TBNMRDict
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
TBNMR.h
OPTIONS
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
-inlineInputHeader
LINKDEF TBNMRLinkDef.h
MODULE TBNMR
)

View File

@@ -1,76 +0,0 @@
# Run Numbers: 1111
###############################################################
FITPARAMETER
###############################################################
# No Name Value Err Min Max
1 Alpha 1.11587 0.00038 none
2 Asy 0.0570 0.0011 none
3 T 1 0 none
4 Rlx 1.015 0.023 none
5 One 1 0 none
6 Bet -1.052 0.027 none
###############################################################
THEORY
###############################################################
asymmetry fun1
userFcn .libs/libBNMR.so ExpRlx 3 4
###############################################################
FUNCTIONS
###############################################################
fun1 = 0.5 * map1 * map2
###############################################################
RUN 045674 BNMR TRIUMF MUD (name beamline institute data-file-format)
fittype 2 (asymmetry fit)
alpha 1
forward 3
backward 4
data 11 800 11 800
#backgr.fix 0
background 1 9 1 9 # estimated bkg: 8.0000 / 9.6250
t0 10.0 10.0
map 2 5 0 0 0 0 0 0 0 0
fit 0.5 8
packing 5
RUN 045674 BNMR TRIUMF MUD (name beamline institute data-file-format)
fittype 2 (asymmetry fit)
alpha 1
forward 5
backward 6
data 11 800 11 800
#backgr.fix 0
background 1 9 1 9 # estimated bkg: 11.6250 / 15.6250
t0 10.0 10.0
map 2 6 0 0 0 0 0 0 0 0
fit 0.5 8
packing 5
###############################################################
COMMANDS
MINIMIZE
HESSE
SAVE
###############################################################
PLOT 2 (asymmetry plot)
runs 1 2
use_fit_ranges
view_packing 10
###############################################################
FOURIER
units MHz # units either 'Gauss', 'Tesla', 'MHz', or 'Mc/s'
fourier_power 12
apodization STRONG # NONE, WEAK, MEDIUM, STRONG
plot POWER # REAL, IMAG, REAL_AND_IMAG, POWER, PHASE
phase 8
#range FRQMIN FRQMAX
###############################################################
STATISTIC --- 2015-04-14 11:00:19
chisq = 399.5, NDF = 290, chisq/NDF = 1.377736

View File

@@ -1,45 +0,0 @@
Title
###############################################################
FITPARAMETER
# Nr. Name Value Step Pos_Error Boundaries
1 Asy1 0.0812706 0.00149848 none 0 none
2 T 4000 0 none 0 none
3 Lam1 0.00239816 6.05947e-05 none 0 none
###############################################################
THEORY
asymmetry 1
userFcn /usr/local/lib/libBNMR.so ExpRlx 2 3
###############################################################
RUN 45377 MUE4 PSI ASCII (name beamline institute data-file-format)
fittype 8 (non muSR fit)
map 0 0 0 0 0 0 0 0 0 0
xy-data 1 2
fit 0.00 8000.00
packing 1
###############################################################
COMMANDS
STRATEGY 1
MINIMIZE
#MINOS
SAVE
END RETURN
###############################################################
PLOT 8 (non muSR plot)
runs 1
range 0.00 8000.00
###############################################################
FOURIER
units MHz # units either 'Gauss', 'MHz', or 'Mc/s'
fourier_power 12
apodization STRONG # NONE, WEAK, MEDIUM, STRONG
plot POWER # REAL, IMAG, REAL_AND_IMAG, POWER, PHASE
phase 8.50
#range FRQMIN FRQMAX
###############################################################
STATISTIC --- 2010-09-02 17:44:20
chisq = 186.322493286053, NDF = 72, chisq/NDF = 2.5878124067507362

View File

@@ -1,46 +0,0 @@
Title
###############################################################
FITPARAMETER
# Nr. Name Value Step Pos_Error Boundaries
1 Asy1 0.262789 0.0465582 none 0 none
2 T 4000 0 none 0 none
3 Lam1 0.0233569 0.0094885 none 0 none
4 Bet1 0.399259 0.0353915 none 0 none
###############################################################
THEORY
asymmetry 1
userFcn /usr/local/lib/libBNMR.so SExpRlx 2 3 4
###############################################################
RUN 45377 MUE4 PSI ASCII (name beamline institute data-file-format)
fittype 8 (non muSR fit)
map 0 0 0 0 0 0 0 0 0 0
xy-data 1 2
fit 0.00 8000.00
packing 1
###############################################################
COMMANDS
STRATEGY 1
MINIMIZE
#MINOS
SAVE
END RETURN
###############################################################
PLOT 8 (non muSR plot)
runs 1
range 0.00 8000.00
###############################################################
FOURIER
units MHz # units either 'Gauss', 'MHz', or 'Mc/s'
fourier_power 12
apodization STRONG # NONE, WEAK, MEDIUM, STRONG
plot POWER # REAL, IMAG, REAL_AND_IMAG, POWER, PHASE
phase 8.50
#range FRQMIN FRQMAX
###############################################################
STATISTIC --- 2010-09-02 17:51:10
chisq = 93.71265965991455, NDF = 71, chisq/NDF = 1.319896614928374

View File

@@ -31,55 +31,50 @@
#include "TBNMR.h"
#define tau_Li 1210
#define gamma_Li 6.3018 // In units kHz/mT
#define PI 3.14159265358979323846
#define TWOPI 6.28318530717958647692
ClassImp(ExpRlx) // for the ROOT-dictionary
ClassImp(SExpRlx)
double ExpRlx::operator()(double x, const std::vector<double> &par) const {
assert(par.size()==2); // 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[0] time of beam on (pulse length) in seconds
// par[1] is the relaxation rate in 1/s
double tau_p;
double y;
tau_p = (tau_Li/(1.+par[1]*tau_Li));
// x should be in seconds, otherwise it should be rescaled here
if ( x <= par[0] && x >= 0) {
y=(tau_p/tau_Li)*(1-exp(-x/tau_p))/(1-exp(-x/tau_Li));
return (tau_p/tau_Li)*(1-exp(-x/tau_p))/(1-exp(-x/tau_Li));
} else if ( x > par[0] ){
y=(tau_p/tau_Li)*(1-exp(-par[0]/tau_p))/(1-exp(-par[0]/tau_Li))*exp(-par[1]*(x-par[0]));
} else {
y = 0;
}
return y;
return (tau_p/tau_Li)*(1-exp(-par[0]/tau_p))/(1-exp(-par[0]/tau_Li))*exp(-par[1]*(x-par[0]));
}
return 0;
}
//initialize Integrators
TF1 SExpRlx::sexp1=TF1("sexp", "exp(-([0]-x)/[3])*exp(-pow(([1]*([0]-x)),[2]))", 0.0, 20000.0);
TF1 SExpRlx::sexp2=TF1("sexp", "exp(-([3]-x)/[4])*exp(-pow(([1]*([0]-x)),[2]))", 0.0, 20000.0);
double SExpRlx::operator()(double x, const std::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[0] beam of beam on (pulse length) in seconds
// par[1] is the relaxation rate in 1/s
// par[2] is the exponent
// x should be in seconds, otherwise it should be rescaled here
if ( x >= 0 && x <= par[0] ) {
TF1 sexp1("sexp1", "exp(-([0]-x)/[3])*exp(-pow(([1]*([0]-x)),[2]))", 0.0, 20.0);
sexp1.SetParameters(x, par[1], par[2],tau_Li);
sexp1.SetNpx(1000);
return sexp1.Integral(0.0,x)/(1-exp(-x/tau_Li))/tau_Li;
} else if ( x > par[0] ) {
TF1 sexp2("sexp2", "exp(-([3]-x)/[4])*exp(-pow(([1]*([0]-x)),[2]))", 0.0, 20.0);
sexp2.SetParameters(x, par[1], par[2], par[0],tau_Li);
sexp2.SetNpx(1000);
return sexp2.Integral(0.0,par[0])/(1-exp(-par[0]/tau_Li))/tau_Li;
}
}
return 0;
}

View File

@@ -41,6 +41,10 @@
#ifndef LIBBNMRH
#define LIBBNMRH
#define tau_Li 1.210 // In seconds
#define PI 3.14159265358979323846
#define TWOPI 6.28318530717958647692
using namespace std;

View File

@@ -2,12 +2,17 @@
#--- generate necessary dictionaries ------------------------------------------
set(MUSRFIT_INC ${CMAKE_SOURCE_DIR}/src/include)
# ROOT requires that the dictonary header files are found at configuration time.
# Hence, target_include_directories cannot be used here because, targets are
# setup only afterwards.
include_directories(${CMAKE_CURRENT_BINARY_DIR})
root_generate_dictionary(
LineProfileDict
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
LineProfile.h
OPTIONS
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
LINKDEF LineProfileLinkDef.h
MODULE LineProfile
)

View File

@@ -4,14 +4,20 @@
set(MUSRFIT_INC ${CMAKE_SOURCE_DIR}/src/include)
set(BMW_TOOLS_INC ${CMAKE_SOURCE_DIR}/src/external/BMWtools)
set(POFB_INC ${CMAKE_SOURCE_DIR}/src/external/libFitPofB/include)
# ROOT requires that the dictonary header files are found at configuration time.
# Hence, target_include_directories cannot be used here because, targets are
# setup only afterwards.
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
root_generate_dictionary(
TCalcMeanFieldsLEMDict
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
-I${BMW_TOOLS_INC}
-I${POFB_INC}
TCalcMeanFieldsLEM.h
OPTIONS
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
-I${BMW_TOOLS_INC}
-I${POFB_INC}
-inlineInputHeader
LINKDEF TCalcMeanFieldsLEMLinkDef.h
MODULE TCalcMeanFieldsLEM
)

View File

@@ -3,39 +3,47 @@
#--- generate necessary dictionaries ------------------------------------------
set(MUSRFIT_INC ${CMAKE_SOURCE_DIR}/src/include)
set(BMW_TOOLS_INC ${CMAKE_SOURCE_DIR}/src/external/BMWtools)
set(POFB_INC ${CMAKE_SOURCE_DIR}/src/external/libFitPofB/include)
set(FIT_P_OF_B_INC ${CMAKE_CURRENT_SOURCE_DIR}/../include)
# ROOT requires that the dictonary header files are found at configuration time.
# Hence, target_include_directories cannot be used here because, targets are
# setup only afterwards.
include_directories(${FIT_P_OF_B_INC})
root_generate_dictionary(
TLondon1DDict
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
-I${BMW_TOOLS_INC}
-I${POFB_INC}
-I${CMAKE_CURRENT_SOURCE_DIR}/../include
TLondon1D.h
LINKDEF ${CMAKE_CURRENT_SOURCE_DIR}/../include/TLondon1DLinkDef.h
OPTIONS
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
-I${BMW_TOOLS_INC}
-I${FIT_P_OF_B_INC}
-inlineInputHeader
LINKDEF ${FIT_P_OF_B_INC}/TLondon1DLinkDef.h
MODULE TLondon1D
)
root_generate_dictionary(
TVortexDict
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
-I${BMW_TOOLS_INC}
-I${POFB_INC}
-I${CMAKE_CURRENT_SOURCE_DIR}/../include
TVortex.h
LINKDEF ${CMAKE_CURRENT_SOURCE_DIR}/../include/TVortexLinkDef.h
OPTIONS
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
-I${BMW_TOOLS_INC}
-I${FIT_P_OF_B_INC}
-inlineInputHeader
LINKDEF ${FIT_P_OF_B_INC}/TVortexLinkDef.h
MODULE TVortex
)
root_generate_dictionary(
TSkewedGssDict
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
-I${BMW_TOOLS_INC}
-I${POFB_INC}
-I${CMAKE_CURRENT_SOURCE_DIR}/../include
TSkewedGss.h
LINKDEF ${CMAKE_CURRENT_SOURCE_DIR}/../include/TSkewedGssLinkDef.h
OPTIONS
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
-I${BMW_TOOLS_INC}
-I${POFB_INC}
-I${FIT_P_OF_B_INC}
-inlineInputHeader
LINKDEF ${FIT_P_OF_B_INC}/TSkewedGssLinkDef.h
MODULE TSkewedGss
)

View File

@@ -3,13 +3,20 @@
#--- generate necessary dictionaries ------------------------------------------
set(MUSRFIT_INC ${CMAKE_SOURCE_DIR}/src/include)
set(BMW_TOOLS_INC ${CMAKE_SOURCE_DIR}/src/external/BMWtools)
# ROOT requires that the dictonary header files are found at configuration time.
# Hence, target_include_directories cannot be used here because, targets are
# setup only afterwards.
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
root_generate_dictionary(
TGapIntegralsDict
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
-I${BMW_TOOLS_INC}
TGapIntegrals.h
OPTIONS
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
-I${BMW_TOOLS_INC}
-I${CMAKE_CURRENT_SOURCE_DIR}
-inlineInputHeader
LINKDEF TGapIntegralsLinkDef.h
MODULE TGapIntegrals
)

View File

@@ -2,18 +2,20 @@
#--- generate necessary dictionaries ------------------------------------------
set(MUSRFIT_INC ${CMAKE_SOURCE_DIR}/src/include)
set(GBGLF_INC ${CMAKE_SOURCE_DIR}/src/external/libGbGLF)
set(PREFIX_INC ${CMAKE_INSTALL_PREFIX}/include)
# ROOT requires that the dictonary header files are found at configuration time.
# Hence, target_include_directories cannot be used here because, targets are
# setup only afterwards.
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
root_generate_dictionary(
PGbGLFDict
-I${GBGLF_INC}
-I${MUSRFIT_INC}
-I${CMAKE_CURRENT_SOURCE_DIR}
-I${PREFIX_INC}
PGbGLF.h
OPTIONS
-I${MUSRFIT_INC}
-I${CMAKE_CURRENT_SOURCE_DIR}
-inlineInputHeader
LINKDEF PGbGLFLinkDef.h
OPTIONS -inlineInputHeader
MODULE PGbGLF
)

View File

@@ -3,13 +3,19 @@
#--- generate necessary dictionaries ------------------------------------------
set(MUSRFIT_INC ${CMAKE_SOURCE_DIR}/src/include)
set(BMW_TOOLS_INC ${CMAKE_SOURCE_DIR}/src/external/BMWtools)
# ROOT requires that the dictonary header files are found at configuration time.
# Hence, target_include_directories cannot be used here because, targets are
# setup only afterwards.
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
root_generate_dictionary(
TLFRelaxationDict
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
-I${BMW_TOOLS_INC}
TLFRelaxation.h
OPTIONS
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
-I${BMW_TOOLS_INC}
-inlineInputHeader
LINKDEF TLFRelaxationLinkDef.h
MODULE TLFRelaxation
)

View File

@@ -2,24 +2,33 @@
#--- generate necessary dictionaries ------------------------------------------
set(MUSRFIT_INC ${CMAKE_SOURCE_DIR}/src/include)
set(PHOTO_MEISSNER_INC ${CMAKE_CURRENT_SOURCE_DIR}/../include)
# ROOT requires that the dictonary header files are found at configuration time.
# Hence, target_include_directories cannot be used here because, targets are
# setup only afterwards.
include_directories(${PHOTO_MEISSNER_INC})
root_generate_dictionary(
PPhotoMeissnerDict
-I${FFTW3_INCLUDE_DIR}
-I${GSL_INCLUDE_DIRS}
-I${ROOT_INCLUDE_DIRS}
-I${MUSRFIT_INC}
-I${CMAKE_CURRENT_SOURCE_DIR}/../include
PPhotoMeissner.h
LINKDEF ${CMAKE_CURRENT_SOURCE_DIR}/../include/PPhotoMeissnerLinkDef.h
OPTIONS
-I${FFTW3_INCLUDE_DIR}
-I${GSL_INCLUDE_DIRS}
-I${ROOT_INCLUDE_DIRS}
-I${MUSRFIT_INC}
-I${PHOTO_MEISSNER_INC}
-inlineInputHeader
LINKDEF ${PHOTO_MEISSNER_INC}/PPhotoMeissnerLinkDef.h
MODULE PPhotoMeissner
)
root_generate_dictionary(
PStartupHandler_PMDict
-I${MUSRFIT_INC}
-I${CMAKE_CURRENT_SOURCE_DIR}/../include
PStartupHandler_PM.h
LINKDEF ${CMAKE_CURRENT_SOURCE_DIR}/../include/PStartupHandler_PMLinkDef.h
OPTIONS
-I${MUSRFIT_INC}
-I${PHOTO_MEISSNER_INC}
-inlineInputHeader
LINKDEF ${PHOTO_MEISSNER_INC}/PStartupHandler_PMLinkDef.h
MODULE PStartupHandler_PM
)

View File

@@ -2,21 +2,30 @@
#--- generate necessary dictionaries ------------------------------------------
set(MUSRFIT_INC ${CMAKE_SOURCE_DIR}/src/include)
set(SPIN_VALVE_INC ${CMAKE_CURRENT_SOURCE_DIR}/../include)
# ROOT requires that the dictonary header files are found at configuration time.
# Hence, target_include_directories cannot be used here because, targets are
# setup only afterwards.
include_directories(${SPIN_VALVE_INC})
root_generate_dictionary(
PSkewedLorentzianDict
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
-I${CMAKE_CURRENT_SOURCE_DIR}/../include
PSkewedLorentzian.h
LINKDEF ${CMAKE_CURRENT_SOURCE_DIR}/../include/PSkewedLorentzianLinkDef.h
OPTIONS
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
-I${SPIN_VALVE_INC}
-inlineInputHeader
LINKDEF ${SPIN_VALVE_INC}/PSkewedLorentzianLinkDef.h
MODULE PSkewedLorentzian
)
root_generate_dictionary(
PStartupHandler_SVDict
-I${CMAKE_CURRENT_SOURCE_DIR}/../include
PStartupHandler_SV.h
LINKDEF ${CMAKE_CURRENT_SOURCE_DIR}/../include/PStartupHandler_SVLinkDef.h
OPTIONS
-I${SPIN_VALVE_INC}
-inlineInputHeader
LINKDEF ${SPIN_VALVE_INC}/PStartupHandler_SVLinkDef.h
MODULE PStartupHandler_SV
)

View File

@@ -3,13 +3,19 @@
#--- generate necessary dictionaries ------------------------------------------
set(MUSRFIT_INC ${CMAKE_SOURCE_DIR}/src/include)
set(BMW_TOOLS_INC ${CMAKE_SOURCE_DIR}/src/external/BMWtools)
# ROOT requires that the dictonary header files are found at configuration time.
# Hence, target_include_directories cannot be used here because, targets are
# setup only afterwards.
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
root_generate_dictionary(
ZFRelaxationDict
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
-I${BMW_TOOLS_INC}
ZFRelaxation.h
OPTIONS
-I${FFTW3_INCLUDE_DIR}
-I${MUSRFIT_INC}
-I${BMW_TOOLS_INC}
-inlineInputHeader
LINKDEF ZFRelaxationLinkDef.h
MODULE ZFRelaxation
)