diff --git a/src/classes/PMsrHandler.cpp b/src/classes/PMsrHandler.cpp index e19c3348..708875e1 100644 --- a/src/classes/PMsrHandler.cpp +++ b/src/classes/PMsrHandler.cpp @@ -136,8 +136,10 @@ int PMsrHandler::ReadMsrFile() if (line.BeginsWith("#")) { // if the line is not a comment line keep it fComments.push_back(current); - } else if (!line.IsWhitespace()) { // if not an empty line, handle it + continue; + } + if (!line.IsWhitespace()) { // if not an empty line, handle it // check for a msr block if (line_no == 1) { // title fTitle = line; @@ -1502,7 +1504,7 @@ void PMsrHandler::InitRunParameterStructure(PMsrRunStructure ¶m) param.fBkgFitParamNo = -1; param.fPhaseParamNo = -1; param.fLifetimeParamNo = -1; - param.fLifetimeCorrection = true; + param.fLifetimeCorrection = false; param.fMap.clear(); // empty list param.fForwardHistoNo = -1; param.fBackwardHistoNo = -1; diff --git a/src/classes/PMusrCanvas.cpp b/src/classes/PMusrCanvas.cpp index 4362a34b..d4473aae 100644 --- a/src/classes/PMusrCanvas.cpp +++ b/src/classes/PMusrCanvas.cpp @@ -33,6 +33,7 @@ using namespace std; #include +#include #include "PMusrCanvas.h" @@ -118,6 +119,11 @@ cout << "~PMusrCanvas() called" << endl; delete fMainCanvas; fMainCanvas = 0; } + if (fData.size() > 0) { + for (unsigned int i=0; iGetAsymmetry(runNo, PRunListCollection::kRunNo); @@ -432,6 +440,7 @@ cout << endl; return; } // handle data + HandleAsymmetryDataSet(runNo, data); break; case MSR_FITTYPE_ASYM_RRF: data = fRunList->GetRRF(runNo, PRunListCollection::kRunNo); @@ -443,6 +452,7 @@ cout << endl; return; } // handle data + HandleRRFDataSet(runNo, data); break; case MSR_FITTYPE_NO_MUSR: data = fRunList->GetNonMusr(runNo, PRunListCollection::kRunNo); @@ -454,6 +464,7 @@ cout << endl; return; } // handle data + HandleNoneMusrDataSet(runNo, data); break; default: fValid = false; @@ -463,9 +474,27 @@ cout << endl; return; break; } - // get theory object and calculate a theory histogram - // generate the histo plot } + + // generate the histo plot + fDataTheoryPad->cd(); + if (fData.size() > 0) { + fData[0].data->Draw("pe1"); + // set time range + Double_t xmin = fMsrHandler->GetMsrPlotList()->at(fPlotNumber).fTmin; + Double_t xmax = fMsrHandler->GetMsrPlotList()->at(fPlotNumber).fTmax; + fData[0].data->GetXaxis()->SetRangeUser(xmin, xmax); + // check if it is necessary to set the y-axis range + // plot all remaining data + for (unsigned int i=1; iDraw("pe1same"); + } + // plot all the theory + for (unsigned int i=0; iDraw("csame"); + } + } + fMainCanvas->cd(); } //-------------------------------------------------------------------------- @@ -627,6 +656,97 @@ void PMusrCanvas::CleanupDataSet(PMusrCanvasDataSet &dataSet) */ void PMusrCanvas::HandleSingleHistoDataSet(unsigned int runNo, PRunData *data) { + PMusrCanvasDataSet dataSet; + TH1F *dataHisto; + TH1F *theoHisto; + + TString name; + double start; + double end; + + InitDataSet(dataSet); + + // dataHisto ------------------------------------------------------------- + // create histo specific infos + name = fMsrHandler->GetMsrRunList()->at(runNo).fRunName + "_DataRunNo"; + name += (int)runNo; + start = data->fDataTimeStart; + end = data->fDataTimeStart + (data->fValue.size()-1)*data->fDataTimeStep; + + // invoke histo + dataHisto = new TH1F(name, name, data->fValue.size(), start, end); + + // check if lifetimecorrection is set + if (fMsrHandler->GetMsrRunList()->at(runNo).fLifetimeCorrection) { + // get background + // get lifetime + // fill histogram + } else { // no lifetimecorrection + // fill histogram + int pack = fMsrHandler->GetMsrRunList()->at(runNo).fPacking; + for (unsigned int i=0; ifValue.size(); i++) { + dataHisto->SetBinContent(i, pack*data->fValue[i]); + dataHisto->SetBinError(i, TMath::Sqrt(pack)*data->fError[i]); + } + } + + // set marker and line color + if (runNo < fColorList.size()) { + dataHisto->SetMarkerColor(fColorList[runNo]); + dataHisto->SetLineColor(fColorList[runNo]); + } else { + TRandom rand(runNo); + Int_t color = TColor::GetColor((Int_t)rand.Integer(255), (Int_t)rand.Integer(255), (Int_t)rand.Integer(255)); + dataHisto->SetMarkerColor(color); + dataHisto->SetLineColor(color); + } + // set marker size + dataHisto->SetMarkerSize(1); + // set marker type + if (runNo < fMarkerList.size()) { + dataHisto->SetMarkerStyle(fMarkerList[runNo]); + } else { + TRandom rand(runNo); + dataHisto->SetMarkerStyle(20+(Int_t)rand.Integer(10)); + } + + // theoHisto ------------------------------------------------------------- + // create histo specific infos + name = fMsrHandler->GetMsrRunList()->at(runNo).fRunName + "_TheoRunNo"; + name += (int)runNo; + start = data->fTheoryTimeStart; + end = data->fTheoryTimeStart + (data->fTheory.size()-1)*data->fTheoryTimeStep; + + // invoke histo + theoHisto = new TH1F(name, name, data->fTheory.size(), start, end); + + // check if lifetimecorrection is set + if (fMsrHandler->GetMsrRunList()->at(runNo).fLifetimeCorrection) { + // get background + // get lifetime + // fill histogram + } else { // no lifetimecorrection + // fill histogram + int pack = fMsrHandler->GetMsrRunList()->at(runNo).fPacking; + for (unsigned int i=0; ifValue.size(); i++) { + theoHisto->SetBinContent(i, pack*data->fTheory[i]); + } + } + + // set the line color + if (runNo < fColorList.size()) { + theoHisto->SetLineColor(fColorList[runNo]); + } else { + TRandom rand(runNo); + Int_t color = TColor::GetColor((Int_t)rand.Integer(255), (Int_t)rand.Integer(255), (Int_t)rand.Integer(255)); + theoHisto->SetLineColor(color); + } + + // fill handler list ----------------------------------------------------- + dataSet.data = dataHisto; + dataSet.theory = theoHisto; + + fData.push_back(dataSet); } //-------------------------------------------------------------------------- diff --git a/src/classes/PRunSingleHisto.cpp b/src/classes/PRunSingleHisto.cpp index 7ad84387..cbaf5751 100644 --- a/src/classes/PRunSingleHisto.cpp +++ b/src/classes/PRunSingleHisto.cpp @@ -411,5 +411,30 @@ bool PRunSingleHisto::PrepareData() fNoOfFitBins++; } + // fill theory vector for kView + if (kView) { + // feed the parameter vector + std::vector par; + PMsrParamList *paramList = fMsrInfo->GetMsrParamList(); + for (unsigned int i=0; isize(); i++) + par.push_back((*paramList)[i].fValue); + + + fData.fTheoryTimeStart = -t0*fTimeResolution; + fData.fTheoryTimeStep = fTimeResolution; + for (unsigned int i=0; ifDataBin[histoNo].size(); i++) { + if ((int)i-(int)t0 < 0) { + fData.fTheory.push_back(0.0); + } else { + time = fData.fTheoryTimeStart + i*fTimeResolution; + value = fTheory->Func(time, par, fFuncValues); + fData.fTheory.push_back(value); + } + } + + // clean up + par.clear(); + } + return true; }