00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef TRKFITSTATUS_HH
00017 #define TRKFITSTATUS_HH
00018
00019 #include "TrkBase/TrkHistory.h"
00020 #include <vector>
00021 #include <utility>
00022 #include <functional>
00023 #include <iostream>
00024
00025
00026 class TrkFitStatus {
00027 typedef std::vector<TrkHistory>::const_iterator history_iterator;
00028 typedef std::vector<TrkHistory>::const_reverse_iterator history_riterator;
00029
00030 public:
00031 typedef std::unary_function<TrkFitStatus,bool> predicate_type;
00032 bool is2d() const {return _is2d;}
00033 bool fitCurrent() const {return _fitCurrent;}
00034 bool fitValid() const {return _fitValid;}
00035 bool multScat() const {return _multScat;}
00036 std::ostream& printStatus(std::ostream& os=std::cout) const;
00037
00038 void setValid(bool v);
00039 void setCurrent(bool c) { _fitCurrent = c; }
00040 void set2d(bool d) { _is2d = d; };
00041 void setMultScat(bool m) { _multScat = m; };
00042
00043 const TrkErrCode& fitStatus() const { return _history.back().status(); }
00044
00045
00046 history_iterator beginHistory() const { return _history.begin(); }
00047 history_iterator endHistory() const { return _history.end(); }
00048 history_riterator reverseBeginHistory() const { return _history.rbegin(); }
00049 history_riterator reverseEndHistory() const { return _history.rend(); }
00050 std::pair<history_iterator,history_iterator> history() const {
00051 return std::pair<history_iterator,history_iterator>(beginHistory(),endHistory());
00052 }
00053 const std::vector<TrkHistory>& historyVector() const { return _history; }
00054
00055 virtual void addHistory(const TrkErrCode& status,const char* modulename);
00056 template <class T>
00057 void addHistory(T begin, T end) { _history.insert(_history.end(),begin,end); }
00058 template <class T>
00059 void addHistory(std::pair<T,T> p) { addHistory(p.first,p.second); }
00060 std::ostream& printHistory(std::ostream& os=std::cout) const;
00061 protected:
00062 virtual ~TrkFitStatus();
00063 TrkFitStatus();
00064 TrkFitStatus& operator= (const TrkFitStatus&);
00065 TrkFitStatus(const TrkFitStatus &);
00066 private:
00067 std::vector<TrkHistory> _history;
00068 bool _fitValid;
00069 bool _fitCurrent;
00070 bool _is2d;
00071 bool _multScat;
00072 };
00073
00074 std::ostream& operator<<( std::ostream& os, const TrkFitStatus& s );
00075
00076
00077 #endif
00078