From 9f3fb859280338eb5a8990182dbb13ee97b74f84 Mon Sep 17 00:00:00 2001 From: nemu Date: Fri, 13 Mar 2009 10:26:12 +0000 Subject: [PATCH] some more minor bug fixing leading towards ADDRUN --- src/classes/PRunAsymmetry.cpp | 40 +++++++++---------- src/classes/PRunDataHandler.cpp | 4 +- src/classes/PRunSingleHisto.cpp | 2 +- src/tests/skewedGaussianTest/skewedGaussian.C | 12 +++--- 4 files changed, 28 insertions(+), 30 deletions(-) diff --git a/src/classes/PRunAsymmetry.cpp b/src/classes/PRunAsymmetry.cpp index 02220837..09e693a2 100644 --- a/src/classes/PRunAsymmetry.cpp +++ b/src/classes/PRunAsymmetry.cpp @@ -371,7 +371,7 @@ bool PRunAsymmetry::PrepareData() // get T0's of the to be added run int t0Add[2] = {0, 0}; // check if the t0's are given in the msr-file - if (fRunInfo->fT0[0] == -1) { // t0's are NOT in the msr-file + if (i >= fRunInfo->fT0.size()) { // t0's are NOT in the msr-file // check if the t0's are in the data file if (addRunData->fT0s.size() != 0) { // t0's in the run data // keep the proper t0's. For asymmetry runs, forward/backward are holding the histo no @@ -384,25 +384,6 @@ bool PRunAsymmetry::PrepareData() } } else { // t0's in the msr-file // check if t0's are given in the data file - if (addRunData->fT0s.size() != 0) { - // compare t0's of the msr-file with the one in the data file - if (fabs(t0Add[0]-addRunData->fT0s[fRunInfo->fForwardHistoNo-1])>5.0) { // given in bins!! - cout << endl << "PRunAsymmetry::PrepareData(): **WARNING**: forward histo"; - cout << endl << " t0 from the msr-file is " << fRunInfo->fT0[0]; - cout << endl << " t0 from the data file is " << addRunData->fT0s[fRunInfo->fForwardHistoNo-1]; - cout << endl << " This is quite a deviation! Is this done intentionally??"; - cout << endl << " addrun: " << fRunInfo->fRunName[i].Data(); - cout << endl; - } - if (fabs(t0Add[1]-addRunData->fT0s[fRunInfo->fBackwardHistoNo-1])>5.0) { // given in bins!! - cout << endl << "PRunAsymmetry::PrepareData(): **WARNING**: backward histo"; - cout << endl << " t0 from the msr-file is " << fRunInfo->fT0[1]; - cout << endl << " t0 from the data file is " << addRunData->fT0s[fRunInfo->fBackwardHistoNo-1]; - cout << endl << " This is quite a deviation! Is this done intentionally??"; - cout << endl << " addrun: " << fRunInfo->fRunName[i].Data(); - cout << endl; - } - } if (2*i+1 < fRunInfo->fT0.size()) { t0Add[0] = fRunInfo->fT0[2*i]; t0Add[1] = fRunInfo->fT0[2*i+1]; @@ -415,6 +396,25 @@ bool PRunAsymmetry::PrepareData() t0Add[0] = fRunInfo->fT0[0]; t0Add[1] = fRunInfo->fT0[1]; } + if (addRunData->fT0s.size() != 0) { + // compare t0's of the msr-file with the one in the data file + if (fabs(t0Add[0]-addRunData->fT0s[fRunInfo->fForwardHistoNo-1])>5.0) { // given in bins!! + cout << endl << "PRunAsymmetry::PrepareData(): **WARNING**: forward histo"; + cout << endl << " t0 from the msr-file is " << fRunInfo->fT0[2*i]; + cout << endl << " t0 from the data file is " << addRunData->fT0s[fRunInfo->fForwardHistoNo-1]; + cout << endl << " This is quite a deviation! Is this done intentionally??"; + cout << endl << " addrun: " << fRunInfo->fRunName[i].Data(); + cout << endl; + } + if (fabs(t0Add[1]-addRunData->fT0s[fRunInfo->fBackwardHistoNo-1])>5.0) { // given in bins!! + cout << endl << "PRunAsymmetry::PrepareData(): **WARNING**: backward histo"; + cout << endl << " t0 from the msr-file is " << fRunInfo->fT0[2*i+1]; + cout << endl << " t0 from the data file is " << addRunData->fT0s[fRunInfo->fBackwardHistoNo-1]; + cout << endl << " This is quite a deviation! Is this done intentionally??"; + cout << endl << " addrun: " << fRunInfo->fRunName[i].Data(); + cout << endl; + } + } } // add forward run diff --git a/src/classes/PRunDataHandler.cpp b/src/classes/PRunDataHandler.cpp index db0abde3..843481f8 100644 --- a/src/classes/PRunDataHandler.cpp +++ b/src/classes/PRunDataHandler.cpp @@ -494,8 +494,6 @@ bool PRunDataHandler::ReadNexusFile() */ bool PRunDataHandler::ReadWkmFile() { -// cout << endl << "PRunDataHandler::ReadWkmFile(): Sorry, not yet implemented ..."; - PDoubleVector histoData; PRawRunData runData; @@ -511,7 +509,7 @@ bool PRunDataHandler::ReadWkmFile() // open file ifstream f; - // open dump-file + // open wkm-file f.open(fRunPathName.Data(), ifstream::in); if (!f.is_open()) { cout << endl << "Couldn't open run data (" << fRunPathName.Data() << ") file for reading, sorry ..."; diff --git a/src/classes/PRunSingleHisto.cpp b/src/classes/PRunSingleHisto.cpp index 1f20632d..a7709cef 100644 --- a/src/classes/PRunSingleHisto.cpp +++ b/src/classes/PRunSingleHisto.cpp @@ -379,7 +379,7 @@ bool PRunSingleHisto::PrepareData() // get T0's of the to be added run int t0Add; // check if the t0's are given in the msr-file - if (fRunInfo->fT0[i] == -1) { // t0's are NOT in the msr-file + if (i >= fRunInfo->fT0.size()) { // t0's are NOT in the msr-file // check if the t0's are in the data file if (addRunData->fT0s.size() != 0) { // t0's in the run data // keep the proper t0's. For single histo runs, forward is holding the histo no diff --git a/src/tests/skewedGaussianTest/skewedGaussian.C b/src/tests/skewedGaussianTest/skewedGaussian.C index 604b6483..e856c518 100644 --- a/src/tests/skewedGaussianTest/skewedGaussian.C +++ b/src/tests/skewedGaussianTest/skewedGaussian.C @@ -41,20 +41,20 @@ void skewedGaussian() FILE *fp; char fln[256]; - const Double_t w = 1.0; // weight of the skewed Gaussian - const Double_t B0 = 2500.0; // skewed Gaussian B0 (G) + const Double_t w = 0.8; // weight of the skewed Gaussian + const Double_t B0 = 130.0; // skewed Gaussian B0 (G) const Double_t sm = 4.5; // skewed Gaussian sigma- (G) const Double_t sp = 4.5; // skewed Gaussian sigma+ (G) - const Double_t B0ext = 110.0; // external field Gaussian B0 (G) + const Double_t B0ext = 30.0; // external field Gaussian B0 (G) const Double_t sext = 1.2; // external field Gaussian sigma (G) sprintf(fln, "skewedGauss-B%0.2lf-sm%0.2lf-sp%0.2lf-w%0.1lf-Bext%0.2lf-sext%0.2lf.dat", B0, sm, sp, w, B0ext, sext); - const Int_t noOfPoints = 1000; + const Int_t noOfPoints = 2000; - const Double_t res = 10.0*(sp+sm)/(Double_t)noOfPoints; + const Double_t res = 0.1; fp = fopen(fln, "w"); @@ -65,7 +65,7 @@ void skewedGaussian() fprintf(fp, "# B, pB\n"); Double_t b, pb; for (Int_t i=0; i