diff --git a/ChangeLog b/ChangeLog index 2c98d854..bcc8ab9b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,17 @@ # ChangeLog #--------------------------------------------------------------------- +changes since 0.13.0 +=================================== +NEW 2014-12-18 first implementation of a GLOBAL block which allows to shorten + a typical msr-file. Duplicate entries from the RUN blocks can be + added here. Furthermore, the 'lifetimecorrection' flag is + transferred from the RUN blocks to the PLOT block which allows + a quicker switching between asymmetry and histogram representation. + In order to make the code more readable a lot of setup collection + parameters (t0, data, fit) has been encapsulated into its own + functions. + changes since 0.12.0 =================================== NEW 2014-12-04 Fourier: added the unit 'Tesla' needed e.g. for HAL-9500 diff --git a/configure.ac b/configure.ac index b946e72f..3f0a04f6 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ AC_REVISION([m4_esyscmd_s([git describe --always])]) AC_PREREQ(2.63) -AC_INIT([musrfit],[0.12.0],[andreas.suter@psi.ch]) +AC_INIT([musrfit],[0.13.0],[andreas.suter@psi.ch]) AC_CONFIG_AUX_DIR(admin) AC_CANONICAL_HOST #AC_MSG_RESULT([${host} ${host_cpu} ${host_vendor} ${host_os}]) @@ -35,7 +35,7 @@ dnl ----------------------------------------------- #release versioning MUSR_MAJOR_VERSION=0 -MUSR_MINOR_VERSION=12 +MUSR_MINOR_VERSION=13 MUSR_MICRO_VERSION=0 #release versioning diff --git a/src/classes/PMsrHandler.cpp b/src/classes/PMsrHandler.cpp index 93984e17..0fbba55a 100644 --- a/src/classes/PMsrHandler.cpp +++ b/src/classes/PMsrHandler.cpp @@ -1589,7 +1589,9 @@ Int_t PMsrHandler::WriteMsrFile(const Char_t *filename, map *co fout << hline.Data() << endl; // write GLOBAL block - // STILL MISSING + if (fGlobal.IsPresent()) { + // not sure that anything needs to be done here ... + } // write RUN blocks for (i = 0; i < fRuns.size(); ++i) { @@ -2667,6 +2669,9 @@ Bool_t PMsrHandler::HandleGlobalEntry(PMsrLines &lines) Double_t dval; UInt_t addT0Counter = 0; + // since this routine is called, a GLOBAL block is present + global.SetGlobalPresent(true); + iter = lines.begin(); while ((iter != lines.end()) && !error) { // remove potential comment at the end of lines @@ -2844,6 +2849,7 @@ Bool_t PMsrHandler::HandleGlobalEntry(PMsrLines &lines) fGlobal = global; } +/* 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++) { @@ -2864,6 +2870,7 @@ Bool_t PMsrHandler::HandleGlobalEntry(PMsrLines &lines) 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; } diff --git a/src/classes/PMusr.cpp b/src/classes/PMusr.cpp index 9ce62938..ee618411 100644 --- a/src/classes/PMusr.cpp +++ b/src/classes/PMusr.cpp @@ -705,6 +705,7 @@ void PRawRunData::SetTempError(const UInt_t idx, const Double_t errTemp) */ PMsrGlobalBlock::PMsrGlobalBlock() { + fGlobalPresent = false; fFitType = -1; // undefined fit type for (UInt_t i=0; i<4; i++) { fDataRange[i] = -1; // undefined data bin range diff --git a/src/classes/PRunAsymmetry.cpp b/src/classes/PRunAsymmetry.cpp index aec7f54a..c04d2a73 100644 --- a/src/classes/PRunAsymmetry.cpp +++ b/src/classes/PRunAsymmetry.cpp @@ -546,86 +546,6 @@ Bool_t PRunAsymmetry::PrepareData() return false; } -/* - // feed all T0's - // first init T0's, T0's are stored as (forward T0, backward T0, etc.) - fT0s.clear(); - fT0s.resize(2*forwardHistoNo.size()); - for (UInt_t i=0; iGetT0BinSize(); i++) { - fT0s[i] = fRunInfo->GetT0Bin(i); - } - - // fill in the T0's from the GLOBAL block section (if present) - for (UInt_t i=0; iGetT0BinSize(); i++) { - if (fT0s[i] == -1) { // i.e. not given in the RUN block section - fT0s[i] = globalBlock->GetT0Bin(i); - } - } - - // fill in the T0's from the data file, if not already present in the msr-file - for (UInt_t i=0; iGetT0Bin(forwardHistoNo[i]) > 0.0) { - fT0s[2*i] = runData->GetT0Bin(forwardHistoNo[i]); - fRunInfo->SetT0Bin(fT0s[2*i], 2*i); - } - } - for (UInt_t i=0; iGetT0Bin(backwardHistoNo[i]) > 0.0) { - fT0s[2*i+1] = runData->GetT0Bin(backwardHistoNo[i]); - fRunInfo->SetT0Bin(fT0s[2*i+1], 2*i+1); - } - } - - // fill in the T0's gaps, i.e. in case the T0's are NOT in the msr-file and NOT in the data file - for (UInt_t i=0; iGetT0BinEstimated(forwardHistoNo[i]); - fRunInfo->SetT0Bin(fT0s[2*i], 2*i); - - cerr << endl << ">> PRunAsymmetry::PrepareData(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!"; - cerr << endl << ">> run: " << fRunInfo->GetRunName()->Data(); - cerr << endl << ">> will try the estimated one: forward t0 = " << runData->GetT0BinEstimated(forwardHistoNo[i]); - cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!"; - cerr << endl; - } - } - for (UInt_t i=0; iGetT0BinEstimated(backwardHistoNo[i]); - fRunInfo->SetT0Bin(fT0s[2*i+1], 2*i+1); - - cerr << endl << ">> PRunAsymmetry::PrepareData(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!"; - cerr << endl << ">> run: " << fRunInfo->GetRunName()->Data(); - cerr << endl << ">> will try the estimated one: backward t0 = " << runData->GetT0BinEstimated(backwardHistoNo[i]); - cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!"; - cerr << endl; - } - } - - // check if t0 is within proper bounds - for (UInt_t i=0; i (Int_t)runData->GetDataBin(forwardHistoNo[i])->size())) { - cerr << endl << ">> PRunAsymmetry::PrepareData(): **ERROR** t0 data bin (" << fT0s[2*i] << ") doesn't make any sense!"; - cerr << endl << ">> forwardHistoNo " << forwardHistoNo[i]; - cerr << endl; - return false; - } - if ((fT0s[2*i+1] < 0) || (fT0s[2*i+1] > (Int_t)runData->GetDataBin(backwardHistoNo[i])->size())) { - cerr << endl << ">> PRunAsymmetry::PrepareData(): **ERROR** t0 data bin (" << fT0s[2*i+1] << ") doesn't make any sense!"; - cerr << endl << ">> backwardHistoNo " << backwardHistoNo[i]; - cerr << endl; - return false; - } - } -*/ - // keep the histo of each group at this point (addruns handled below) vector forward, backward; forward.resize(forwardHistoNo.size()); // resize to number of groups @@ -650,65 +570,6 @@ Bool_t PRunAsymmetry::PrepareData() return false; } -/* - // get T0's of the to be added run - PDoubleVector t0Add; - - // feed all T0's - // first init T0's, T0's are stored as (forward T0, backward T0, etc.) - t0Add.clear(); - t0Add.resize(2*forwardHistoNo.size()); - for (UInt_t j=0; jGetAddT0BinSize(i); j++) { - t0Add[j] = fRunInfo->GetAddT0Bin(i, j); - } - - // fill in the T0's from the data file, if not already present in the msr-file - for (UInt_t j=0; jGetT0Bin(forwardHistoNo[j]) > 0.0) { - t0Add[2*j] = addRunData->GetT0Bin(forwardHistoNo[j]); - fRunInfo->SetAddT0Bin(t0Add[2*j], i-1, 2*j); - } - } - for (UInt_t j=0; jGetT0Bin(backwardHistoNo[j]) > 0.0) { - t0Add[2*j+1] = addRunData->GetT0Bin(backwardHistoNo[j]); - fRunInfo->SetAddT0Bin(t0Add[2*j+1], i-1, 2*j+1); - } - } - - // fill in the T0's gaps, i.e. in case the T0's are NOT in the msr-file and NOT in the data file - for (UInt_t j=0; jGetT0BinEstimated(forwardHistoNo[j]); - fRunInfo->SetAddT0Bin(t0Add[2*j], i-1, 2*j); - - cerr << endl << ">> PRunAsymmetry::PrepareData(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!"; - cerr << endl << ">> run: " << fRunInfo->GetRunName(i)->Data(); - cerr << endl << ">> will try the estimated one: forward t0 = " << addRunData->GetT0BinEstimated(forwardHistoNo[j]); - cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!"; - cerr << endl; - } - } - for (UInt_t j=0; jGetT0BinEstimated(backwardHistoNo[j]); - fRunInfo->SetAddT0Bin(t0Add[2*j+1], i-1, 2*j+1); - - cerr << endl << ">> PRunAsymmetry::PrepareData(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!"; - cerr << endl << ">> run: " << fRunInfo->GetRunName(i)->Data(); - cerr << endl << ">> will try the estimated one: backward t0 = " << runData->GetT0BinEstimated(backwardHistoNo[j]); - cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!"; - cerr << endl; - } - } -*/ // add forward run UInt_t addRunSize; for (UInt_t k=0; kGetDataRange(0), fRunInfo->GetDataRange(2)}; - Int_t end[2] = {fRunInfo->GetDataRange(1), fRunInfo->GetDataRange(3)}; - // check if data range has been provided in the RUN block. If not, try the GLOBAL block - if (start[0] == -1) { - start[0] = globalBlock->GetDataRange(0); - } - if (start[1] == -1) { - start[1] = globalBlock->GetDataRange(2); - } - if (end[0] == -1) { - end[0] = globalBlock->GetDataRange(1); - } - if (end[1] == -1) { - end[1] = globalBlock->GetDataRange(3); - } - - Double_t t0[2] = {fT0s[0], fT0s[1]}; - Int_t offset = (Int_t)(10.0e-3/fTimeResolution); // needed in case first good bin is not given, default = 10ns - UInt_t histoNo[2] = {forwardHistoNo[0], backwardHistoNo[0]}; - - // check if data range has been provided, and if not try to estimate them - if (start[0] < 0) { - start[0] = (Int_t)t0[0]+offset; - fRunInfo->SetDataRange(start[0], 0); - cerr << endl << ">> PRunAsymmetry::PrepareData(): **WARNING** data range (forward) was not provided, will try data range start = t0+" << offset << "(=10ns) = " << start[0] << "."; - cerr << endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; - cerr << endl; - } - if (start[1] < 0) { - start[1] = (Int_t)t0[1]+offset; - fRunInfo->SetDataRange(start[1], 2); - cerr << endl << ">> PRunAsymmetry::PrepareData(): **WARNING** data range (backward) was not provided, will try data range start = t0+" << offset << "(=10ns) = " << start[1] << "."; - cerr << endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; - cerr << endl; - } - if (end[0] < 0) { - end[0] = runData->GetDataBin(histoNo[0])->size(); - fRunInfo->SetDataRange(end[0], 1); - cerr << endl << ">> PRunAsymmetry::PrepareData(): **WARNING** data range (forward) was not provided, will try data range end = " << end[0] << "."; - cerr << endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; - cerr << endl; - } - if (end[1] < 0) { - end[1] = runData->GetDataBin(histoNo[1])->size(); - fRunInfo->SetDataRange(end[1], 3); - cerr << endl << ">> PRunAsymmetry::PrepareData(): **WARNING** data range (backward) was not provided, will try data range end = " << end[1] << "."; - cerr << endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; - cerr << endl; - } - // check if start, end, and t0 make any sense - // 1st check if start and end are in proper order - for (UInt_t i=0; i<2; i++) { - if (end[i] < start[i]) { // need to swap them - Int_t keep = end[i]; - end[i] = start[i]; - start[i] = keep; - } - // 2nd check if start is within proper bounds - if ((start[i] < 0) || (start[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) { - cerr << endl << ">> PRunAsymmetry::PrepareFitData(): **ERROR** start data bin doesn't make any sense!"; - cerr << endl; - return false; - } - // 3rd check if end is within proper bounds - if ((end[i] < 0) || (end[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) { - cerr << endl << ">> PRunAsymmetry::PrepareFitData(): **ERROR** end data bin doesn't make any sense!"; - cerr << endl; - return false; - } - // 4th check if t0 is within proper bounds - if ((t0[i] < 0) || (t0[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) { - cerr << endl << ">> PRunAsymmetry::PrepareFitData(): **ERROR** t0 data bin doesn't make any sense!"; - cerr << endl; - return false; - } - } - - // check that start-t0 is the same for forward as for backward, otherwise take max(start[i]-t0[i]) - if (fabs(static_cast(start[0])-t0[0]) > fabs(static_cast(start[1])-t0[1])){ - start[1] = static_cast(t0[1] + static_cast(start[0]) - t0[0]); - end[1] = static_cast(t0[1] + static_cast(end[0]) - t0[0]); - cerr << endl << ">> PRunAsymmetry::PrepareFitData **WARNING** needed to shift backward data range."; - cerr << endl << ">> given: " << fRunInfo->GetDataRange(2) << ", " << fRunInfo->GetDataRange(3); - cerr << endl << ">> used : " << start[1] << ", " << end[1]; - cerr << endl; - } - if (fabs(static_cast(start[0])-t0[0]) < fabs(static_cast(start[1])-t0[1])){ - start[0] = static_cast(t0[0] + static_cast(start[1]) - t0[1]); - end[0] = static_cast(t0[0] + static_cast(end[1]) - t0[1]); - cerr << endl << ">> PRunAsymmetry::PrepareFitData **WARNING** needed to shift forward data range."; - cerr << endl << ">> given: " << fRunInfo->GetDataRange(0) << ", " << fRunInfo->GetDataRange(1); - cerr << endl << ">> used : " << start[0] << ", " << end[0]; - cerr << endl; - } - - // keep good bins for potential latter use - fGoodBins[0] = start[0]; - fGoodBins[1] = end[0]; - fGoodBins[2] = start[1]; - fGoodBins[3] = end[1]; -*/ - -/* - // set fit start/end time; first check RUN Block - fFitStartTime = fRunInfo->GetFitRange(0); - fFitEndTime = fRunInfo->GetFitRange(1); - // if fit range is given in bins (and not time), the fit start/end time can be calculated at this point now - if (fRunInfo->IsFitRangeInBin()) { - fFitStartTime = (start[0] + fRunInfo->GetFitRangeOffset(0) - fT0s[0]) * fTimeResolution; // (fgb+n0-t0)*dt - fFitEndTime = (end[0] - fRunInfo->GetFitRangeOffset(1) - fT0s[0]) * fTimeResolution; // (lgb-n1-t0)*dt - // write these times back into the data structure. This way it is available when writting the log-file - fRunInfo->SetFitRange(fFitStartTime, 0); - fRunInfo->SetFitRange(fFitEndTime, 1); - } - if (fFitStartTime == PMUSR_UNDEFINED) { // fit start/end NOT found in the RUN block, check GLOBAL block - fFitStartTime = globalBlock->GetFitRange(0); - fFitEndTime = globalBlock->GetFitRange(1); - // if fit range is given in bins (and not time), the fit start/end time can be calculated at this point now - if (globalBlock->IsFitRangeInBin()) { - fFitStartTime = (start[0] + globalBlock->GetFitRangeOffset(0) - fT0s[0]) * fTimeResolution; // (fgb+n0-t0)*dt - fFitEndTime = (end[0] - globalBlock->GetFitRangeOffset(1) - fT0s[0]) * fTimeResolution; // (lgb-n1-t0)*dt - // write these times back into the data structure. This way it is available when writting the log-file - globalBlock->SetFitRange(fFitStartTime, 0); - globalBlock->SetFitRange(fFitEndTime, 1); - } - } - if ((fFitStartTime == PMUSR_UNDEFINED) || (fFitEndTime == PMUSR_UNDEFINED)) { - cerr << ">> PRunAsymmetry::PrepareData(): **ERROR** Couldn't get fit start/end time!" << endl; - return false; - } -cout << endl << "debug> PRunAsymmetry::PrepareData(): fFitStartTime=" << fFitStartTime << ", fFitEndTime=" << fFitEndTime << endl; -*/ - UInt_t histoNo[2] = {forwardHistoNo[0], backwardHistoNo[0]}; // get the data range (fgb/lgb) for the current RUN block @@ -1643,7 +1364,6 @@ Bool_t PRunAsymmetry::PrepareRRFViewData(PRawRunData* runData, UInt_t histoNo[2] default: break; } -//cout << endl << ">> alpha = " << alpha << ", beta = " << beta; for (UInt_t i=0; i> rebinRRF = " << rebinRRF; -cout << endl << ">> theory time start = " << fData.GetTheoryTimeStart(); -cout << endl << ">> theory time step = " << fData.GetTheoryTimeStep(); -cout << endl; -*/ - // calculate functions for (Int_t i=0; iGetNoOfFuncs(); i++) { fFuncValues[i] = fMsrInfo->EvalFunc(fMsrInfo->GetFuncNo(i), *fRunInfo->GetMap(), par); @@ -1772,7 +1485,6 @@ cout << endl; Double_t dval = 0.0; for (UInt_t i=0; isize(); i++) { if ((i % rebinRRF == 0) && (i != 0)) { -//cout << endl << "time = " << fData.GetTheoryTimeStart() + i * fData.GetTheoryTimeStep() << ", theory value = " << dval; theo.push_back(dval/rebinRRF); dval = 0.0; } @@ -2150,5 +1862,4 @@ void PRunAsymmetry::GetProperFitRange(PMsrGlobalBlock *globalBlock) cerr << ">> PRunSingleHisto::GetProperFitRange(): **WARNING** Couldn't get fit start/end time!" << endl; cerr << ">> Will set it to fgb/lgb which given in time is: " << fFitStartTime << "..." << fFitEndTime << " (usec)" << endl; } -cout << endl << "debug> PRunAsymmetry::GetProperFitRange(): fFitStartTime=" << fFitStartTime << ", fFitEndTime=" << fFitEndTime << endl; } diff --git a/src/classes/PRunListCollection.cpp b/src/classes/PRunListCollection.cpp index 6862533b..4082e91e 100644 --- a/src/classes/PRunListCollection.cpp +++ b/src/classes/PRunListCollection.cpp @@ -99,7 +99,6 @@ Bool_t PRunListCollection::Add(Int_t runNo, EPMusrHandleTag tag) if (fitType == -1) { // fit type NOT given in the RUN block, check the GLOBAL block fitType = (*fMsrInfo->GetMsrGlobal()).GetFitType(); } -cout << endl << "debug> PRunListCollection::Add(): fitType=" << fitType << endl; switch (fitType) { case PRUN_SINGLE_HISTO: diff --git a/src/classes/PRunMuMinus.cpp b/src/classes/PRunMuMinus.cpp index 30740eb6..a792f59b 100644 --- a/src/classes/PRunMuMinus.cpp +++ b/src/classes/PRunMuMinus.cpp @@ -503,59 +503,6 @@ Bool_t PRunMuMinus::PrepareData() return false; } -/* - // feed all T0's - // first init T0's, T0's are stored as (forward T0, backward T0, etc.) - fT0s.clear(); - fT0s.resize(histoNo.size()); - for (UInt_t i=0; iGetT0BinSize(); i++) { - fT0s[i] = fRunInfo->GetT0Bin(i); - } - - // fill in the T0's from the GLOBAL block section (if present) - for (UInt_t i=0; iGetT0BinSize(); i++) { - if (fT0s[i] == -1) { // i.e. not given in the RUN block section - fT0s[i] = globalBlock->GetT0Bin(i); - } - } - - // fill in the T0's from the data file, if not already present in the msr-file - for (UInt_t i=0; iGetT0Bin(histoNo[i]) > 0.0) { - fT0s[i] = runData->GetT0Bin(histoNo[i]); - fRunInfo->SetT0Bin(fT0s[i], i); // keep value for the msr-file - } - } - - // fill in the T0's gaps, i.e. in case the T0's are NOT in the msr-file and NOT in the data file - for (UInt_t i=0; iGetT0BinEstimated(histoNo[i]); - fRunInfo->SetT0Bin(fT0s[i], i); // keep value for the msr-file - - cerr << endl << ">> PRunMuMinus::PrepareData(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!"; - cerr << endl << ">> run: " << fRunInfo->GetRunName(); - cerr << endl << ">> will try the estimated one: forward t0 = " << runData->GetT0BinEstimated(histoNo[i]); - cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!"; - cerr << endl; - } - } - - // check if t0 is within proper bounds - for (UInt_t i=0; iGetForwardHistoNoSize(); i++) { - if ((fT0s[i] < 0) || (fT0s[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) { - cerr << endl << ">> PRunMuMinus::PrepareData(): **ERROR** t0 data bin (" << fT0s[i] << ") doesn't make any sense!"; - cerr << endl; - return false; - } - } -*/ // keep the histo of each group at this point (addruns handled below) vector forward; forward.resize(histoNo.size()); // resize to number of groups @@ -577,52 +524,6 @@ Bool_t PRunMuMinus::PrepareData() return false; } -/* - // feed all T0's - // first init T0's, T0's are stored as (forward T0, backward T0, etc.) - PDoubleVector t0Add; - t0Add.resize(histoNo.size()); - for (UInt_t j=0; jGetT0BinSize(); j++) { - t0Add[j] = fRunInfo->GetAddT0Bin(i-1,j); // addRunIdx starts at 0 - } - - // fill in the T0's from the data file, if not already present in the msr-file - for (UInt_t j=0; jGetT0Bin(histoNo[j]) > 0.0) { - t0Add[j] = addRunData->GetT0Bin(histoNo[j]); - fRunInfo->SetAddT0Bin(t0Add[j], i-1, j); // keep value for the msr-file - } - } - - // fill in the T0's gaps, i.e. in case the T0's are NOT in the msr-file and NOT in the data file - for (UInt_t j=0; jGetT0BinEstimated(histoNo[j]); - fRunInfo->SetAddT0Bin(t0Add[j], i-1, j); // keep value for the msr-file - - cerr << endl << ">> PRunMuMinus::PrepareData(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!"; - cerr << endl << ">> run: " << fRunInfo->GetRunName(); - cerr << endl << ">> will try the estimated one: forward t0 = " << addRunData->GetT0BinEstimated(histoNo[j]); - cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!"; - cerr << endl; - } - } - - // check if t0 is within proper bounds - for (UInt_t j=0; jGetForwardHistoNoSize(); j++) { - if ((t0Add[j] < 0) || (t0Add[j] > (Int_t)addRunData->GetDataBin(histoNo[j])->size())) { - cerr << endl << ">> PRunMuMinus::PrepareData(): **ERROR** addt0 data bin (" << t0Add[j] << ") doesn't make any sense!"; - cerr << endl; - return false; - } - } -*/ // add forward run UInt_t addRunSize; for (UInt_t k=0; kGetDataRange(0); - end = fRunInfo->GetDataRange(1); - - // check if data range has been given in the RUN block, if not try to get it from the GLOBAL block - if (start < 0) { - start = fMsrInfo->GetMsrGlobal()->GetDataRange(0); - } - if (end < 0) { - end = fMsrInfo->GetMsrGlobal()->GetDataRange(1); - } - - // check if data range has been provided, and if not try to estimate them - if (start < 0) { - Int_t offset = (Int_t)(10.0e-3/fTimeResolution); - start = (Int_t)fT0s[0]+offset; - fRunInfo->SetDataRange(start, 0); - cerr << endl << ">> PRunMuMinus::PrepareData(): **WARNING** data range was not provided, will try data range start = t0+" << offset << "(=10ns) = " << start << "."; - cerr << endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; - cerr << endl; - } - if (end < 0) { - end = fForward.size(); - fRunInfo->SetDataRange(end, 1); - cerr << endl << ">> PRunMuMinus::PrepareData(): **WARNING** data range was not provided, will try data range end = " << end << "."; - cerr << endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; - cerr << endl; - } - - // check if start and end make any sense - // 1st check if start and end are in proper order - if (end < start) { // need to swap them - Int_t keep = end; - end = start; - start = keep; - } - // 2nd check if start is within proper bounds - if ((start < 0) || (start > (Int_t)fForward.size())) { - cerr << endl << ">> PRunMuMinus::PrepareFitData(): **ERROR** start data bin doesn't make any sense!"; - cerr << endl; - return false; - } - // 3rd check if end is within proper bounds - if ((end < 0) || (end > (Int_t)fForward.size())) { - cerr << endl << ">> PRunMuMinus::PrepareFitData(): **ERROR** end data bin doesn't make any sense!"; - cerr << endl; - return false; - } - - // keep good bins for potential later use - fGoodBins[0] = start; - fGoodBins[1] = end; - - // set fit start/end time; first check RUN Block - fFitStartTime = fRunInfo->GetFitRange(0); - fFitEndTime = fRunInfo->GetFitRange(1); - // if fit range is given in bins (and not time), the fit start/end time can be calculated at this point now - if (fRunInfo->IsFitRangeInBin()) { - fFitStartTime = (start + fRunInfo->GetFitRangeOffset(0) - fT0s[0]) * fTimeResolution; // (fgb+n0-t0)*dt - fFitEndTime = (end - fRunInfo->GetFitRangeOffset(1) - fT0s[0]) * fTimeResolution; // (lgb-n1-t0)*dt - // write these times back into the data structure. This way it is available when writting the log-file - fRunInfo->SetFitRange(fFitStartTime, 0); - fRunInfo->SetFitRange(fFitEndTime, 1); - } - if (fFitStartTime == PMUSR_UNDEFINED) { // fit start/end NOT found in the RUN block, check GLOBAL block - fFitStartTime = globalBlock->GetFitRange(0); - fFitEndTime = globalBlock->GetFitRange(1); - // if fit range is given in bins (and not time), the fit start/end time can be calculated at this point now - if (globalBlock->IsFitRangeInBin()) { - fFitStartTime = (start + globalBlock->GetFitRangeOffset(0) - fT0s[0]) * fTimeResolution; // (fgb+n0-t0)*dt - fFitEndTime = (end - globalBlock->GetFitRangeOffset(1) - fT0s[0]) * fTimeResolution; // (lgb-n1-t0)*dt - // write these times back into the data structure. This way it is available when writting the log-file - globalBlock->SetFitRange(fFitStartTime, 0); - globalBlock->SetFitRange(fFitEndTime, 1); - } - } - if ((fFitStartTime == PMUSR_UNDEFINED) || (fFitEndTime == PMUSR_UNDEFINED)) { - cerr << "PRunMuMinus::PrepareData(): **ERROR** Couldn't get fit start/end time!" << endl; - return false; - } -cout << endl << "debug> PRunMuMinus::PrepareData(): fFitStartTime=" << fFitStartTime << ", fFitEndTime=" << fFitEndTime << endl; -*/ - // do the more fit/view specific stuff if (fHandleTag == kFit) success = PrepareFitData(runData, histoNo[0]); @@ -783,64 +598,7 @@ Bool_t PRunMuMinus::PrepareFitData(PRawRunData* runData, const UInt_t histoNo) // transform raw histo data. This is done the following way (for details see the manual): // for the single histo fit, just the rebinned raw data are copied -/* - // first get start data, end data, and t0 - Int_t start; - Int_t end; - start = fRunInfo->GetDataRange(0); - end = fRunInfo->GetDataRange(1); - // check if data range has been provided, and if not try to estimate them - if (start < 0) { - Int_t offset = (Int_t)(10.0e-3/fTimeResolution); - start = (Int_t)fT0s[0]+offset; - fRunInfo->SetDataRange(start, 0); - cerr << endl << ">> PRunMuMinus::PrepareData(): **WARNING** data range was not provided, will try data range start = t0+" << offset << "(=10ns) = " << start << "."; - cerr << endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; - cerr << endl; - } - if (end < 0) { - end = fForward.size(); - fRunInfo->SetDataRange(end, 1); - cerr << endl << ">> PRunMuMinus::PrepareData(): **WARNING** data range was not provided, will try data range end = " << end << "."; - cerr << endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; - cerr << endl; - } - - // check if start and end make any sense - // 1st check if start and end are in proper order - if (end < start) { // need to swap them - Int_t keep = end; - end = start; - start = keep; - } - // 2nd check if start is within proper bounds - if ((start < 0) || (start > (Int_t)fForward.size())) { - cerr << endl << ">> PRunMuMinus::PrepareFitData(): **ERROR** start data bin doesn't make any sense!"; - cerr << endl; - return false; - } - // 3rd check if end is within proper bounds - if ((end < 0) || (end > (Int_t)fForward.size())) { - cerr << endl << ">> PRunMuMinus::PrepareFitData(): **ERROR** end data bin doesn't make any sense!"; - cerr << endl; - return false; - } - - // if fit range is given in bins (and not time), the fit start/end time can be calculated at this point now - if (fRunInfo->IsFitRangeInBin()) { - fFitStartTime = (fRunInfo->GetDataRange(0) + fRunInfo->GetFitRangeOffset(0) - fT0s[0]) * fTimeResolution; // (fgb+n0-t0)*dt - fFitEndTime = (fRunInfo->GetDataRange(1) - fRunInfo->GetFitRangeOffset(1) - fT0s[0]) * fTimeResolution; // (lgb-n1-t0)*dt - // write these times back into the data structure. This way it is available when writting the log-file - fRunInfo->SetFitRange(fFitStartTime, 0); - fRunInfo->SetFitRange(fFitEndTime, 1); - } - - // keep good bins for potential latter use - fGoodBins[0] = start; - fGoodBins[1] = end; -*/ - - // everything looks fine, hence fill data set + // fill data set Int_t t0 = (Int_t)fT0s[0]; Double_t value = 0.0; // data start at data_start-t0 @@ -1263,5 +1021,4 @@ void PRunMuMinus::GetProperFitRange(PMsrGlobalBlock *globalBlock) cerr << ">> PRunMuMinus::GetProperFitRange(): **WARNING** Couldn't get fit start/end time!" << endl; cerr << ">> Will set it to fgb/lgb which given in time is: " << fFitStartTime << "..." << fFitEndTime << " (usec)" << endl; } -cout << endl << "debug> PRunMuMinus::GetProperFitRange(): fFitStartTime=" << fFitStartTime << ", fFitEndTime=" << fFitEndTime << endl; } diff --git a/src/classes/PRunSingleHisto.cpp b/src/classes/PRunSingleHisto.cpp index fe23ae90..66f46131 100644 --- a/src/classes/PRunSingleHisto.cpp +++ b/src/classes/PRunSingleHisto.cpp @@ -657,20 +657,6 @@ Bool_t PRunSingleHisto::PrepareData() return false; } -/* remove eventually as35 - cout << endl << "debug> PRunSingleHisto::PrepareData(): fT0s.size()=" << fT0s.size(); - cout << endl << "debug> PRunSingleHisto::PrepareData(): fT0s : "; - for (UInt_t i=0; i PRunSingleHisto::PrepareData(): fAddT0s.size()=" << fAddT0s.size(); - for (UInt_t i=0; i PRunSingleHisto::PrepareData(): fAddT0s[" << i << "].size()=" << fAddT0s[i].size(); - cout << endl << "debug> PRunSingleHisto::PrepareData(): fAddT0s : " << i << ": "; - for (UInt_t j=0; j forward; forward.resize(histoNo.size()); // resize to number of groups @@ -1553,7 +1539,6 @@ void PRunSingleHisto::GetProperFitRange(PMsrGlobalBlock *globalBlock) cerr << ">> PRunSingleHisto::GetProperFitRange(): **WARNING** Couldn't get fit start/end time!" << endl; cerr << ">> Will set it to fgb/lgb which given in time is: " << fFitStartTime << "..." << fFitEndTime << " (usec)" << endl; } -cout << endl << "debug> PRunSingleHisto::GetProperFitRange(): fFitStartTime=" << fFitStartTime << ", fFitEndTime=" << fFitEndTime << endl; } //-------------------------------------------------------------------------- diff --git a/src/include/PMusr.h b/src/include/PMusr.h index 3728aa29..f9826fbd 100644 --- a/src/include/PMusr.h +++ b/src/include/PMusr.h @@ -533,6 +533,7 @@ class PMsrGlobalBlock { PMsrGlobalBlock(); virtual ~PMsrGlobalBlock() {} + virtual Bool_t IsPresent() { return fGlobalPresent; } virtual Int_t GetFitType() { return fFitType; } virtual Int_t GetDataRange(UInt_t idx); virtual UInt_t GetT0BinSize() { return fT0.size(); } @@ -545,6 +546,7 @@ class PMsrGlobalBlock { virtual Int_t GetFitRangeOffset(UInt_t idx); virtual Int_t GetPacking() { return fPacking; } + virtual void SetGlobalPresent(Bool_t bval) { fGlobalPresent = bval; } virtual void SetFitType(Int_t ival) { fFitType = ival; } virtual void SetDataRange(Int_t ival, Int_t idx); virtual void SetT0Bin(Double_t dval, Int_t idx=-1); @@ -555,6 +557,7 @@ class PMsrGlobalBlock { virtual void SetPacking(Int_t ival) { fPacking = ival; } private: + Bool_t fGlobalPresent; ///< flag showing if a GLOBAL block is present at all. Int_t fFitType; ///< fit type: 0=single histo fit, 2=asymmetry fit, 4=mu^- single histo fit, 8=non muSR fit Int_t fDataRange[4]; ///< data bin range (fit type 0, 2, 4) PDoubleVector fT0; ///< t0 bins (fit type 0, 2, 4). if fit type 0 -> f0, f1, f2, ...; if fit type 2, 4 -> f0, b0, f1, b1, ...