musrfit  1.9.2
musrfit.cpp File Reference
#include <cstdio>
#include <cstdlib>
#include <sys/types.h>
#include <unistd.h>
#include <signal.h>
#include <iostream>
#include <fstream>
#include <memory>
#include <TSAXParser.h>
#include <TString.h>
#include <TFile.h>
#include <TCanvas.h>
#include <TH1.h>
#include <TSystem.h>
#include <TSystemFile.h>
#include <TThread.h>
#include "PMusr.h"
#include "PStartupHandler.h"
#include "PMsrHandler.h"
#include "PRunDataHandler.h"
#include "PRunListCollection.h"
#include "PFitter.h"
Include dependency graph for musrfit.cpp:

Go to the source code of this file.

Functions

void * musrfit_timeout (void *args)
 
void musrfit_syntax ()
 
void musrfit_write_ascii (TString fln, PRunData *data, int runCounter)
 
void musrfit_dump_ascii (char *fileName, PRunListCollection *runList)
 
void musrfit_write_root (TFile &f, TString fln, PRunData *data, int runCounter)
 
void musrfit_dump_root (char *fileName, PRunListCollection *runList)
 
int main (int argc, char *argv[])
 

Variables

static int timeout = 3600
 

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

The musrfit program is used to fit muSR data. For a detailed description/usage of the program, please see musrfit online help

return:

  • PMUSR_SUCCESS if everthing went smooth
  • PMUSR_WRONG_STARTUP_SYNTAX if syntax error is encountered
  • line number if an error in the msr-file was encountered which cannot be handled.
Parameters
argcnumber of input arguments
argvlist of input arguments

Definition at line 437 of file musrfit.cpp.

References PStartupOptions::estimateN0, PRawRunData::GetRunTitle(), kFit, musrfit_dump_ascii(), musrfit_dump_root(), musrfit_syntax(), musrfit_timeout(), parseXmlFile(), PMUSR_MSR_FILE_NOT_FOUND, PMUSR_MSR_LOG_FILE_WRITE_ERROR, PMUSR_MSR_SYNTAX_ERROR, PMUSR_SUCCESS, PMUSR_TOKENIZE_ERROR, PMUSR_WRONG_STARTUP_SYNTAX, startup_path_name, status, timeout, and PStartupOptions::writeExpectedChisq.

◆ musrfit_dump_ascii()

void musrfit_dump_ascii ( char *  fileName,
PRunListCollection runList 
)

Go through all msr-file runs and write each of them in ascii-format to disc (used for diagnostics). Be aware that this output is different to what you will get when using musrview!

Parameters
fileNamefile name
runListrun list collection handler

Definition at line 184 of file musrfit.cpp.

References PRunListCollection::GetAsymmetry(), PRunListCollection::GetAsymmetryRRF(), PRunListCollection::GetMuMinus(), PRunListCollection::GetNonMusr(), PRunListCollection::GetNoOfAsymmetry(), PRunListCollection::GetNoOfAsymmetryRRF(), PRunListCollection::GetNoOfMuMinus(), PRunListCollection::GetNoOfNonMusr(), PRunListCollection::GetNoOfSingleHisto(), PRunListCollection::GetNoOfSingleHistoRRF(), PRunListCollection::GetSingleHisto(), PRunListCollection::GetSingleHistoRRF(), and musrfit_write_ascii().

Referenced by main().

◆ musrfit_dump_root()

void musrfit_dump_root ( char *  fileName,
PRunListCollection runList 
)

Go through all msr-file runs and write each of them in root format to disc (used for diagnostics). Be aware that this output is different to what you will get when using musrview!

Parameters
fileNamefile name
runListrun list connection handler

Definition at line 327 of file musrfit.cpp.

References PRunListCollection::GetAsymmetry(), PRunListCollection::GetAsymmetryRRF(), PRunListCollection::GetMuMinus(), PRunListCollection::GetNonMusr(), PRunListCollection::GetNoOfAsymmetry(), PRunListCollection::GetNoOfAsymmetryRRF(), PRunListCollection::GetNoOfMuMinus(), PRunListCollection::GetNoOfNonMusr(), PRunListCollection::GetNoOfSingleHisto(), PRunListCollection::GetNoOfSingleHistoRRF(), PRunListCollection::GetSingleHisto(), PRunListCollection::GetSingleHistoRRF(), and musrfit_write_root().

Referenced by main().

◆ musrfit_syntax()

void musrfit_syntax ( )

Sends the usage description to the standard output.

Definition at line 95 of file musrfit.cpp.

References timeout.

Referenced by main().

◆ musrfit_timeout()

void* musrfit_timeout ( void *  args)

Sometimes musrfit is not terminating properly for reasons still not pinned down, hence this workaround. It should be removed asap. Especially since it is leading to memory leaks.

Definition at line 78 of file musrfit.cpp.

References timeout.

Referenced by main().

◆ musrfit_write_ascii()

void musrfit_write_ascii ( TString  fln,
PRunData data,
int  runCounter 
)

Writes the fitted data- and theory-set in ascii format to disc.

Parameters
flnoutput file name
dataprocessed-data handler
runCountermsr-file run counter needed to form the output file name

Definition at line 144 of file musrfit.cpp.

References PRunData::GetDataTimeStart(), PRunData::GetDataTimeStep(), PRunData::GetError(), PRunData::GetTheory(), and PRunData::GetValue().

Referenced by musrfit_dump_ascii().

◆ musrfit_write_root()

void musrfit_write_root ( TFile &  f,
TString  fln,
PRunData data,
int  runCounter 
)

Writes the fitted data- and theory-set in root format to disc.

Parameters
froot file object
flnfile name
dataprocessed-data handler
runCountermsr-file run counter needed to form the output file name

Definition at line 282 of file musrfit.cpp.

References PRunData::GetDataTimeStep(), PRunData::GetError(), PRunData::GetTheory(), and PRunData::GetValue().

Referenced by musrfit_dump_root().

Variable Documentation

◆ timeout