fixed wrong data start time. Added slightly more flexibile startup path file handling

This commit is contained in:
nemu 2008-04-08 06:06:34 +00:00
parent a5d079d0a1
commit 5d363ce953
5 changed files with 42 additions and 12 deletions

View File

@ -55,6 +55,7 @@ short term:
* something is strange with the coordinate system in TPaveText! **CHECK**
* check problem with the mathmore implementation of 1F1(m;n;z)
2008-04-07 cannot reproduce Bastians problem!?!?!
---------------------
intermediate term:

View File

@ -609,7 +609,8 @@ bool PRunAsymmetry::PrepareFitData(PRawRunData* runData, unsigned int histoNo[2]
double asym;
double f, b, ef, eb;
// fill data time start, and step
fData.fDataTimeStart = fTimeResolution*((double)fRunInfo->fPacking/2.0);
// data start at data_start-t0
fData.fDataTimeStart = fTimeResolution*(((double)start[0]-t0[0])+(double)fRunInfo->fPacking/2.0);
fData.fDataTimeStep = fTimeResolution*(double)fRunInfo->fPacking;
for (unsigned int i=0; i<forwardPacked.fValue.size(); i++) {
// to make the formulae more readable

View File

@ -397,8 +397,9 @@ bool PRunSingleHisto::PrepareFitData(unsigned int start, unsigned int end, doubl
PRawRunData* runData, unsigned int histoNo)
{
double value = 0.0;
// data start at data_start-t0
// time shifted so that packing is included correctly, i.e. t0 == t0 after packing
fData.fDataTimeStart = fTimeResolution*((double)fRunInfo->fPacking/2.0);
fData.fDataTimeStart = fTimeResolution*(((double)start-t0)+(double)fRunInfo->fPacking/2.0);
fData.fDataTimeStep = fTimeResolution*fRunInfo->fPacking;
for (unsigned i=start; i<end; i++) {
if (((i-start) % fRunInfo->fPacking == 0) && (i != start)) { // fill data

View File

@ -29,6 +29,10 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <fstream>
using namespace std;
@ -503,11 +507,24 @@ int main(int argc, char *argv[])
return PMUSR_WRONG_STARTUP_SYNTAX;
}
// get default path (for the moment only linux like)
char *pmusrpath;
char musrpath[128];
pmusrpath = getenv("MUSRFITPATH");
if (pmusrpath == 0) { // not set, will try default one
strcpy(musrpath, "/home/nemu/analysis/bin");
cout << endl << "**WARNING** MUSRFITPATH environment variable not set will try " << musrpath << endl;
} else {
strncpy(musrpath, pmusrpath, sizeof(musrpath));
}
// read startup file
char startup_path_name[128];
sprintf(startup_path_name, "%s/musrfit_startup.xml", musrpath);
TSAXParser *saxParser = new TSAXParser();
PStartupHandler *startupHandler = new PStartupHandler();
saxParser->ConnectToHandler("PStartupHandler", startupHandler);
status = saxParser->ParseFile("musrfit_startup.xml");
status = saxParser->ParseFile(startup_path_name);
// check for parse errors
if (status) { // error
cout << endl << "**ERROR** reading/parsing musrfit_startup.xml. Fix it.";

View File

@ -29,6 +29,10 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
using namespace std;
@ -93,11 +97,24 @@ int main(int argc, char *argv[])
return PMUSR_WRONG_STARTUP_SYNTAX;
}
// get default path (for the moment only linux like)
char *pmusrpath;
char musrpath[128];
pmusrpath = getenv("MUSRFITPATH");
if (pmusrpath == 0) { // not set, will try default one
strcpy(musrpath, "/home/nemu/analysis/bin");
cout << endl << "**WARNING** MUSRFITPATH environment variable not set will try " << musrpath << endl;
} else {
strncpy(musrpath, pmusrpath, sizeof(musrpath));
}
// read startup file
char startup_path_name[128];
sprintf(startup_path_name, "%s/musrfit_startup.xml", musrpath);
TSAXParser *saxParser = new TSAXParser();
PStartupHandler *startupHandler = new PStartupHandler();
saxParser->ConnectToHandler("PStartupHandler", startupHandler);
status = saxParser->ParseFile("musrfit_startup.xml");
status = saxParser->ParseFile(startup_path_name);
// check for parse errors
if (status) { // error
cout << endl << "**ERROR** reading/parsing musrfit_startup.xml. Fix it.";
@ -144,7 +161,7 @@ int main(int argc, char *argv[])
// feed all the necessary histogramms for the view
runListCollection = new PRunListCollection(msrHandler, dataHandler);
for (unsigned int i=0; i < msrHandler->GetMsrRunList()->size(); i++) {
success = runListCollection->Add(i);
success = runListCollection->Add(i, kView);
if (!success) {
cout << endl << "**ERROR** Couldn't handle run no " << i << " ";
cout << (*msrHandler->GetMsrRunList())[i].fRunName.Data();
@ -174,13 +191,6 @@ int main(int argc, char *argv[])
break;
}
// ugly but rootcint cannot handle the spirit-parser framework
// musrCanvas->SetParamInfo(*msrHandler->GetMsrParamList());
// musrCanvas->SetTheoryInfo(*msrHandler->GetMsrTheory());
// musrCanvas->SetFunctionsInfo(*msrHandler->GetMsrFunctions());
// musrCanvas->SetRunsInfo(*msrHandler->GetMsrRunList());
// musrCanvas->SetPlotInfo(msrHandler->GetMsrPlotList()->at(i));
// musrCanvas->SetStatisticsInfo(*msrHandler->GetMsrStatistic());
musrCanvas->SetMsrHandler(msrHandler);
musrCanvas->SetRunListCollection(runListCollection);