diff --git a/src/msr2msr.cpp b/src/msr2msr.cpp index 5959dc97..e90d1505 100644 --- a/src/msr2msr.cpp +++ b/src/msr2msr.cpp @@ -54,6 +54,9 @@ using namespace std; #define MSR_TAG_NO_BLOCK 8 //-------------------------------------------------------------------------- +/** + *
+ */
void msr2msr_syntax()
{
cout << endl << "usage: msr2msr
+ *
+ * \param str
+ */
bool msr2msr_run(char *str)
{
+ // not the RUN line itself, hence nothing to be done
+ if (!strstr(str, "RUN"))
+ return true;
+
TString run(str);
TString line(str);
TObjArray *tokens;
@@ -90,7 +102,7 @@ bool msr2msr_run(char *str)
return false;
}
- if (tokens->GetEntries() == 5) { // alread new msr file, do only add the proper run comment
+ if (tokens->GetEntries() == 5) { // already a new msr file, do only add the proper run comment
sprintf(str, "%s (name beamline institute data-file-format)", line.Data());
return true;
}
@@ -114,7 +126,6 @@ bool msr2msr_run(char *str)
sprintf(str, "RUN %s %s RAL NEXUS (name beamline institute data-file-format)",
ostr[0]->GetString().Data(), ostr[1]->GetString().Data());
}
- cout << endl;
// clean up
if (tokens) {
@@ -126,12 +137,18 @@ bool msr2msr_run(char *str)
}
//--------------------------------------------------------------------------
-void msr2msr_param(char *str, int &tag)
+/**
+ *
+ *
+ * \param str
+ */
+//void msr2msr_param(char *str, int &tag)
+bool msr2msr_param(char *str)
{
// check for comment header which needs to be replaced
if (strstr(str, "Nr.")) {
strcpy(str, "# No Name Value Step Pos_Error Boundaries");
- return;
+ return true;
}
// handle parameter line
@@ -142,7 +159,7 @@ void msr2msr_param(char *str, int &tag)
char spaces[256];
tokens = line.Tokenize(" \t");
- unsigned int noTokens = tokens->GetEntries();
+ Int_t noTokens = tokens->GetEntries();
if (noTokens == 4) {
for (unsigned int i=0; i<4; i++)
ostr[i] = dynamic_cast
+ *
+ * \param argc
+ * \param argv
+ */
int main(int argc, char *argv[])
{
@@ -270,14 +355,29 @@ int main(int argc, char *argv[])
bool success = true;
while (!fin.eof() && success) {
fin.getline(str, sizeof(str));
+
if (strstr(str, "FITPARAMETER")) {
tag = MSR_TAG_FITPARAMETER;
} else if (strstr(str, "RUN")) { // analyze and change header
- success = msr2msr_run(str);
+ tag = MSR_TAG_RUN;
+ } else if (strstr(str, "THEORY")) {
+ tag = MSR_TAG_THEORY;
}
- if (tag == MSR_TAG_FITPARAMETER) {
- msr2msr_param(str, tag);
+
+ switch (tag) {
+ case MSR_TAG_FITPARAMETER:
+ success = msr2msr_param(str);
+ break;
+ case MSR_TAG_THEORY:
+ success = msr2msr_theory(str);
+ break;
+ case MSR_TAG_RUN:
+ success = msr2msr_run(str);
+ break;
+ default:
+ break;
}
+
fout << str << endl;
}
@@ -293,5 +393,7 @@ int main(int argc, char *argv[])
// clean up
+ cout << endl << "done ..." << endl;
+
return 1;
}