musrfit  1.9.2
msr2msr.cpp File Reference
#include <iostream>
#include <fstream>
#include <cctype>
#include <cstring>
#include <cstdlib>
#include <TString.h>
#include <TObjArray.h>
#include <TObjString.h>
Include dependency graph for msr2msr.cpp:

Go to the source code of this file.

Macros

#define MSR_TAG_TITLE   0
 
#define MSR_TAG_FITPARAMETER   1
 
#define MSR_TAG_THEORY   2
 
#define MSR_TAG_FUNCTIONS   3
 
#define MSR_TAG_RUN   4
 
#define MSR_TAG_COMMANDS   5
 
#define MSR_TAG_PLOT   6
 
#define MSR_TAG_STATISTIC   7
 
#define MSR_TAG_NO_BLOCK   8
 
#define MSR_THEORY_INTERN_FLD   0
 
#define MSR_THEORY_INTERN_BESSEL   1
 

Functions

void msr2msr_syntax ()
 
bool msr2msr_run (char *str, const std::size_t size)
 
bool msr2msr_param (char *str)
 
bool msr2msr_theory (char *str, int &tag, int &noOfAddionalParams)
 
bool msr2msr_is_comment (char *str)
 
bool msr2msr_is_whitespace (char *str)
 
void msr2msr_replace (char *str, int paramNo)
 
bool msr2msr_finalize_theory (char *fln, int theoryTag, int noOfAddionalParams)
 
bool msr2msr_statistic (char *str, const std::size_t size)
 
int main (int argc, char *argv[])
 

Macro Definition Documentation

◆ MSR_TAG_COMMANDS

#define MSR_TAG_COMMANDS   5

Definition at line 48 of file msr2msr.cpp.

◆ MSR_TAG_FITPARAMETER

#define MSR_TAG_FITPARAMETER   1

Definition at line 44 of file msr2msr.cpp.

Referenced by main(), and msr2msr_finalize_theory().

◆ MSR_TAG_FUNCTIONS

#define MSR_TAG_FUNCTIONS   3

Definition at line 46 of file msr2msr.cpp.

◆ MSR_TAG_NO_BLOCK

#define MSR_TAG_NO_BLOCK   8

Definition at line 51 of file msr2msr.cpp.

◆ MSR_TAG_PLOT

#define MSR_TAG_PLOT   6

Definition at line 49 of file msr2msr.cpp.

◆ MSR_TAG_RUN

#define MSR_TAG_RUN   4

Definition at line 47 of file msr2msr.cpp.

Referenced by main().

◆ MSR_TAG_STATISTIC

#define MSR_TAG_STATISTIC   7

Definition at line 50 of file msr2msr.cpp.

Referenced by main().

◆ MSR_TAG_THEORY

#define MSR_TAG_THEORY   2

Definition at line 45 of file msr2msr.cpp.

Referenced by main(), and msr2msr_finalize_theory().

◆ MSR_TAG_TITLE

#define MSR_TAG_TITLE   0

Definition at line 43 of file msr2msr.cpp.

◆ MSR_THEORY_INTERN_BESSEL

#define MSR_THEORY_INTERN_BESSEL   1

Definition at line 56 of file msr2msr.cpp.

Referenced by msr2msr_finalize_theory(), and msr2msr_theory().

◆ MSR_THEORY_INTERN_FLD

#define MSR_THEORY_INTERN_FLD   0

Definition at line 55 of file msr2msr.cpp.

Referenced by msr2msr_finalize_theory(), and msr2msr_theory().

Function Documentation

◆ main()

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

msr2msr is needed to convert old WKM msr-files to musrfit msr-files. Eventhough the syntax is very close, there are some shortcomings in the WKM msr-files, which forced me to slightly change the file format.

Parameters
argcnumber of arguments
argvlist of arguments

Definition at line 641 of file msr2msr.cpp.

References msr2msr_finalize_theory(), msr2msr_param(), msr2msr_run(), msr2msr_statistic(), msr2msr_syntax(), msr2msr_theory(), MSR_TAG_FITPARAMETER, MSR_TAG_RUN, MSR_TAG_STATISTIC, and MSR_TAG_THEORY.

◆ msr2msr_finalize_theory()

bool msr2msr_finalize_theory ( char *  fln,
int  theoryTag,
int  noOfAddionalParams 
)

If a theory function was found which has newly a different number of parameters, this function will finalize the msr-file, i.e. replacing all temporarily set tags.

Parameters
flnfile name
theoryTagtheory tag if the changed function
noOfAddionalParamsnumber of additional fit parameters

Definition at line 511 of file msr2msr.cpp.

References msr2msr_is_comment(), msr2msr_is_whitespace(), msr2msr_replace(), MSR_TAG_FITPARAMETER, MSR_TAG_THEORY, MSR_THEORY_INTERN_BESSEL, and MSR_THEORY_INTERN_FLD.

Referenced by main().

◆ msr2msr_is_comment()

bool msr2msr_is_comment ( char *  str)

Checks if a msr-line is a comment line

return:

  • true if line is a comment line
  • false otherwise
Parameters
strmsr-file line

Definition at line 425 of file msr2msr.cpp.

Referenced by msr2msr_finalize_theory().

◆ msr2msr_is_whitespace()

bool msr2msr_is_whitespace ( char *  str)

Checks if a msr-line consists only out of whitespaces.

return:

  • true if line is a whitespace
  • false otherwise
Parameters
strmsr-file line

Definition at line 454 of file msr2msr.cpp.

Referenced by msr2msr_finalize_theory().

◆ msr2msr_param()

bool msr2msr_param ( char *  str)

Changes the fit parameter lines to the new msr-file format. In the new msr-file format there is an additional column "Pos_Error". Before a fit takes place the value is set to "none".

return:

  • true if everything went smooth
  • false otherwise
Parameters
strmsr-file fit parameter line

Definition at line 158 of file msr2msr.cpp.

Referenced by main().

◆ msr2msr_replace()

void msr2msr_replace ( char *  str,
int  paramNo 
)

Replaces temporarily set labels by the proper parameter number.

Parameters
strmsr-file line
paramNoparameter number

Definition at line 477 of file msr2msr.cpp.

Referenced by msr2msr_finalize_theory().

◆ msr2msr_run()

bool msr2msr_run ( char *  str,
const std::size_t  size 
)

If the msr-file line is the RUN line, change it to the new format.

return:

  • true if everything went smooth
  • false otherwise
Parameters
strmsr-file line
sizesize of str

Definition at line 83 of file msr2msr.cpp.

Referenced by main().

◆ msr2msr_statistic()

bool msr2msr_statistic ( char *  str,
const std::size_t  size 
)

Filters out the old chi-square related informations. And sets them according to the new scheme.

return:

  • true if everything went smooth
  • false otherwise
Parameters
strmsr-file statistic block line
sizesize of str

Definition at line 604 of file msr2msr.cpp.

References status.

Referenced by main().

◆ msr2msr_syntax()

void msr2msr_syntax ( )

Sends the usage description to the standard output.

Definition at line 62 of file msr2msr.cpp.

Referenced by main().

◆ msr2msr_theory()

bool msr2msr_theory ( char *  str,
int &  tag,
int &  noOfAddionalParams 
)

In the theory the table functions needs to be replaced by the numerical ones, and some functions have new a different parameterization.

return:

  • true if everything went smooth
  • false otherwise
Parameters
strmsr-file theory line
tagif a function has new some additional parameters, this flag will be set, such that these new parameters can be added to the fit parameter block
noOfAddionalParamscounts the number of additional parameters needed.

Definition at line 273 of file msr2msr.cpp.

References MSR_THEORY_INTERN_BESSEL, and MSR_THEORY_INTERN_FLD.

Referenced by main().