00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #include "AIDA_Profile1DIterator.h"
00032 #include "AIDA_Function_FML/AIDA_RangeSet.h"
00033
00034 # include "AIDA/IAxis.h"
00035 # include "AIDA/IProfile1D.h"
00036
00037 # include "FML/debug.h"
00038
00039
00040 namespace Anaphe {
00041 namespace AIDA_Fitter_FML {
00042
00043
00044 AIDA_Profile1DIterator::AIDA_Profile1DIterator(const AIDA::IProfile1D& h) : m_hist(&h), m_dim(h.dimension())
00045 {
00046 }
00047
00048 AIDA_Profile1DIterator::~AIDA_Profile1DIterator()
00049 {
00050 }
00051
00052 AIDA_Profile1DIterator::AIDA_Profile1DIterator(const AIDA_Profile1DIterator &)
00053 {
00054 }
00055
00056 AIDA_Profile1DIterator & AIDA_Profile1DIterator::operator = (const AIDA_Profile1DIterator &rhs)
00057 {
00058 if (this == &rhs) return *this;
00059
00060 return *this;
00061 }
00062
00063
00064
00065 void AIDA_Profile1DIterator::fillData(const std::vector<Anaphe::AIDA_Function_FML::AIDA_RangeSet * > & ranges)
00066 {
00067 int n = ranges.size();
00068 if (n != m_dim) {
00069 INFO_MSG(" AIDA_Profile1DIterator::fillData invalid dimension for rangeset - cannot feed data in FNL");
00070 return;
00071 }
00072 if (!ranges[0]) {
00073 INFO_MSG(" AIDA_Profile1DIterator::fillData invalid rangeset - cannot feed data in FNL");
00074 return;
00075 }
00076
00077 std::auto_ptr<FML::DataVector> vptr (new FML::DataVector());
00078
00079 std::vector<double> x(1);
00080
00081 int nPoints = 0;
00082 for(int i = 0; i<m_hist->axis().bins(); ++i)
00083 {
00084 x[0] = m_hist->binMean(i);
00085 if (ranges[0]->isInRange(x[0]) ) {
00086
00087 vptr->push_back(x, m_hist->binHeight(i), m_hist->binError(i), m_hist->binError(i));
00088 nPoints++;
00089 }
00090
00091 }
00092
00093 vptr->setRange(FML::DataRange( nPoints ));
00094
00095 setVector(vptr);
00096
00097 }
00098 }
00099 }