00001 //-------------------------------------------------------------------------- 00002 // File and Version Information: 00003 // $Id: DifArray.h,v 1.4 2010/03/25 09:55:57 zhangy Exp $ 00004 // 00005 // Description: 00006 // Class Header for |DifArray| 00007 // What i do ? 00008 // 00009 // Environment: 00010 // Software developed for the BaBar Detector at the SLAC B-Factory. 00011 // 00012 // Author List: 00013 // A. Snyder 00014 // 00015 // Copyright Information: 00016 // Copyright (C) 1996 SLAC 00017 // 00018 // History: 00019 // Migration for BESIII MDC 00020 // Zhang Yao(zhangyao@ihep.ac.cn) Upgrade to CLHEP2.0.4.5 2010-03-25 00021 // 00022 //------------------------------------------------------------------------ 00023 00024 #ifndef DIFARRAY_H 00025 #define DIFARRAY_H 00026 00027 #include "CLHEP/Matrix/Matrix.h" 00028 #include "CLHEP/Matrix/Vector.h" 00029 #include <assert.h> 00030 #include <stdlib.h> 00031 00032 using namespace CLHEP; 00033 00034 class DifNumber; 00035 00036 class DifArray { 00037 00038 public: 00039 DifArray(int n,int npar=0); // make an array of n elements 00040 DifArray // copy from a vector 00041 (const HepVector& v,int npar=0); 00042 DifArray(const DifArray& a); // make a copy 00043 ~DifArray(); // destroy array 00044 DifNumber& operator[](int i); // subscripting (elem=i) 00045 DifNumber& operator()(int i); // subscripting (elem=i-1) 00046 DifNumber fetch(int i)const; // fetch elem=i 00047 int nElem()const {return _nElem;} // number of elements 00048 DifArray& operator=(const DifArray&); // assignment operator 00049 HepMatrix jacobian()const; // return matrix of derivatives 00050 void zero(int npar=0); // zero this array 00051 void print()const; // print this array 00052 00053 private: 00054 00055 //data 00056 int _nElem; // number of elements 00057 DifNumber* _pointer; // pointer to data 00058 00059 //private functions 00060 void copy(const DifArray& a); // copy a to *this 00061 void copy(const HepVector& a,int npar=0); //copy a clhep vector 00062 00063 00064 }; 00065 00066 #endif