// Read the documentation to learn more about C++ code generator // versioning. // %X% %Q% %Z% %W% // DataContainer #include // ModelContainer #include // PlotChiSq #include #include #include #include #include #include // Class PlotChiSq PlotChiSq::PlotChiSq (Plot* plot) :PlotCommand(plot,"chisq") { modelRequired(Plot::FOLDED); } void PlotChiSq::manipulate () { PlotGroupContainer::iterator g = plot()->groups().begin(); PlotGroupContainer::iterator gEnd = plot()->groups().end(); StatMethod* stat = XSContainer::fit->statMethod(); while ( g != gEnd ) { // first bin. int arraySize = (*g)->n; const std::vector& X = (*g)->xAxis.data; std::vector& yData = (*g)->yData.data; const std::vector& yError = (*g)->yData.errors[0]; const std::vector& model = (*g)->model[0].data; (*g)->yData.lineStep = true; for (int j = 0; j < arraySize; ++j) { if ( X[j] != Plot::NODATA()) { Real obs (yData[j]); Real mod (model[j]); Real err (yError[j]); Real areaTime = (*g)->saveData[j]; yData[j] = stat->plotChi(obs,mod,err,areaTime,Plot::NODATA() ); } } ++g; } } void PlotChiSq::primaryGraph (const string& value) { Plot* pPlot = plot(); StatMethod* stat = XSContainer::fit->statMethod(); if (stat->fullName() == string("C-Statistic") || stat->fullName() == string("L-statistic")) { tcout <<"Note: When using cstat or lstat, \"plot chisq\" is only valid\n" <<" for data sets with no background files." << std::endl; } pPlot->makeBinnedPlotArrays(); pPlot->xAxisLabel(); pPlot->setSelectedLabel(1,"ys",stat->scriptName()); pPlot->setSelectedLabel(2,"ts",stat->fullName()); pPlot->xLine(std::pair(true, 0.0)); pPlot->rangeDefaultFlags(12); manipulate(); fillDataAttributes(0,pPlot->modelStyle(),2); turnModelsOff(); pPlot->bundlePlotVectors(); pPlot->prepareTheGraph(); pPlot->makeTheGraph(); } // Additional Declarations