From 0d4d0573e1c47fc86bba617abc87972225848416 Mon Sep 17 00:00:00 2001 From: Suter Andreas Date: Wed, 17 Dec 2014 15:50:04 +0100 Subject: [PATCH] some more work towards a proper GLOBAL block handling. --- src/classes/PMsrHandler.cpp | 57 +++++++++++++++++++++++++++++++------ 1 file changed, 48 insertions(+), 9 deletions(-) diff --git a/src/classes/PMsrHandler.cpp b/src/classes/PMsrHandler.cpp index ae8fa4ba..93984e17 100644 --- a/src/classes/PMsrHandler.cpp +++ b/src/classes/PMsrHandler.cpp @@ -384,6 +384,7 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) // add some counters needed in connection to addruns Int_t addT0Counter = 0; + Int_t addT0GlobalCounter = 0; ifstream fin; ofstream fout; @@ -643,6 +644,17 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) fout << left << fGlobal.GetT0Bin(j); } fout << endl; + } else if (sstr.BeginsWith("addt0")) { + fout.width(16); + fout << left << "addt0"; + for (Int_t j=0; jData() << " "; pstr = fRuns[runNo].GetBeamline(); if (pstr == 0) { @@ -731,7 +744,6 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) pstr->ToUpper(); fout << pstr->Data() << " (name beamline institute data-file-format)" << endl; } else if (sstr.BeginsWith("fittype")) { - addRunNo = 0; fout.width(16); switch (fRuns[runNo].GetFitType()) { case MSR_FITTYPE_SINGLE_HISTO: @@ -2653,6 +2665,7 @@ Bool_t PMsrHandler::HandleGlobalEntry(PMsrLines &lines) TObjString *ostr = 0; Int_t ival; Double_t dval; + UInt_t addT0Counter = 0; iter = lines.begin(); while ((iter != lines.end()) && !error) { @@ -2727,6 +2740,25 @@ Bool_t PMsrHandler::HandleGlobalEntry(PMsrLines &lines) } } } + } else if (iter->fLine.BeginsWith("addt0", TString::kIgnoreCase)) { // addt0 + if (tokens->GetEntries() < 2) { + error = true; + } else { + for (Int_t i=1; iGetEntries(); i++) { + ostr = dynamic_cast(tokens->At(i)); + str = ostr->GetString(); + if (str.IsFloat()) { + dval = str.Atof(); + if (dval >= 0.0) + global.SetAddT0Bin(dval, addT0Counter, i-1); + else + error = true; + } else { + error = true; + } + } + } + addT0Counter++; } else if (iter->fLine.BeginsWith("fit", TString::kIgnoreCase)) { // fit range if (tokens->GetEntries() < 3) { error = true; @@ -2812,18 +2844,25 @@ Bool_t PMsrHandler::HandleGlobalEntry(PMsrLines &lines) fGlobal = global; } - cout << endl << "debug> Global: fittype : " << fGlobal.GetFitType(); - cout << endl << "debug> Global: data bin range: "; + cout << endl << "debug> PMsrHandler::HandleGlobalEntry: Global: fittype : " << fGlobal.GetFitType(); + cout << endl << "debug> PMsrHandler::HandleGlobalEntry: Global: data bin range: "; for (UInt_t i=0; i<4; i++) { cout << fGlobal.GetDataRange(i) << ", "; } - cout << endl << "debug> Global: t0's : "; + cout << endl << "debug> PMsrHandler::HandleGlobalEntry: Global: t0's : "; for (UInt_t i=0; i Global: fit in bin: " << fGlobal.IsFitRangeInBin(); - cout << endl << "debug> Global: fit offset: " << fGlobal.GetFitRangeOffset(0) << ", " << fGlobal.GetFitRangeOffset(1); - cout << endl << "debug> Global: fit : " << fGlobal.GetFitRange(0) << ", " << fGlobal.GetFitRange(1); - cout << endl << "debug> Global: packing : " << fGlobal.GetPacking(); + cout << endl << "debug> PMsrHandler::HandleGlobalEntry: Global: addt0's : "; + for (UInt_t i=0; i --> " << i << ": "; + for (UInt_t j=0; j<(UInt_t)fGlobal.GetAddT0BinSize(i); j++) { + cout << fGlobal.GetAddT0Bin(i,j) << ", "; + } + } + cout << endl << "debug> PMsrHandler::HandleGlobalEntry: Global: fit in bin: " << fGlobal.IsFitRangeInBin(); + cout << endl << "debug> PMsrHandler::HandleGlobalEntry: Global: fit offset: " << fGlobal.GetFitRangeOffset(0) << ", " << fGlobal.GetFitRangeOffset(1); + cout << endl << "debug> PMsrHandler::HandleGlobalEntry: Global: fit : " << fGlobal.GetFitRange(0) << ", " << fGlobal.GetFitRange(1); + cout << endl << "debug> PMsrHandler::HandleGlobalEntry: Global: packing : " << fGlobal.GetPacking(); cout << endl; return !error; @@ -3546,7 +3585,7 @@ Bool_t PMsrHandler::HandleFourierEntry(PMsrLines &lines) // tokenize line tokens = iter->fLine.Tokenize(" \t"); if (!tokens) { - cerr << endl << ">> PMsrHandler::HandleRunEntry: **SEVERE ERROR** Couldn't tokenize Parameters in line " << iter->fLineNo; + cerr << endl << ">> PMsrHandler::HandleFourierEntry: **SEVERE ERROR** Couldn't tokenize Parameters in line " << iter->fLineNo; cerr << endl << endl; return false; }