00001 00009 #ifndef __TrackConstraint_H 00010 #define __TrackConstraint_H 00011 00012 #include<vector> 00013 #include<cassert> 00014 #include "BaseConstraint.h" 00015 00016 class TrackFitObject; 00017 00018 // Class TrackConstraint: 00020 00057 class TrackConstraint: public BaseConstraint { 00058 public: 00060 inline TrackConstraint(); 00062 virtual ~TrackConstraint() {}; 00063 00065 virtual void setFOList(std::vector <TrackFitObject*> *fitobjects_ 00066 ){ 00067 for (int i = 0; i < (int) fitobjects_->size(); i++) { 00068 fitobjects.push_back ((*fitobjects_)[i]); 00069 flags.push_back (1); 00070 sign.push_back (i == 0 ? 1 : -1); 00071 } 00072 }; 00074 virtual void addToFOList(TrackFitObject& fitobject, int flag = 1 00075 ){ 00076 fitobjects.push_back (&fitobject); 00077 flags.push_back (flag); 00078 sign.push_back (sign.size() == 0 ? 1 : -1); 00079 }; 00081 virtual double getValue() const = 0; 00082 00085 virtual void getDerivatives(int idim, double der[]) const = 0; 00087 virtual void add1stDerivativesToMatrix(int idim, double *M) const {assert (false);}; 00089 virtual void add2ndDerivativesToMatrix(int idim, double *M, double lambda) const {assert (false);}; 00090 00092 virtual int getGlobalNum() const {return globalNum;} 00094 virtual void setGlobalNum(int iglobal) {globalNum = iglobal;} 00095 00097 virtual void invalidateCache() const {}; 00098 00099 protected: 00101 typedef std::vector <TrackFitObject *> FitObjectContainer; 00103 typedef FitObjectContainer::iterator FitObjectIterator; 00105 typedef FitObjectContainer::const_iterator ConstFitObjectIterator; 00107 FitObjectContainer fitobjects; 00109 std::vector <double> derivatives; 00112 std::vector <int> flags; 00113 std::vector <double> sign; 00114 00116 int globalNum; 00117 00118 }; 00119 00120 TrackConstraint::TrackConstraint() { 00121 invalidateCache(); 00122 } 00123 00124 #endif // __TrackConstraint_H