00001
00002
00003 #ifndef CALLINEARITY_H
00004 #define CALLINEARITY_H
00005
00010
00011 #include "Rtypes.h"
00012 #include "DatabaseInterface/DbiTableRow.h"
00013 #include "LeakChecker/Lea.h"
00014 #include <vector>
00015 #include "Plex/PlexStripEndId.h"
00016 using std::vector;
00017
00018 class DbiValidityRec;
00019
00020 class CalLinearity : public DbiTableRow
00021 {
00022
00023 public:
00024
00025
00026 CalLinearity() {
00027 LEA_CTOR; }
00028 virtual ~CalLinearity(){ LEA_DTOR; };
00029 CalLinearity(int aggno, PlexStripEndId &seid, int task);
00030 CalLinearity(int aggno, PlexStripEndId &seid,
00031 vector<float> &x, vector<float> &y,
00032 vector<float> &ex, vector<float> &ey,
00033 CalLinearity &lin, bool horizontal);
00034 CalLinearity(int aggno, PlexStripEndId &seid,
00035 vector<float> &x, vector<float> &y);
00036
00037 Int_t GetAggregateNo() const { return fAggregateNo; }
00038 UInt_t GetIndex(UInt_t ) const { return fStripEndKey; }
00039 Int_t GetStripEnd() const {return fStripEndId;}
00040 Int_t GetTask() const { return fTask; }
00041 Int_t GetNumXPoints() {return fNumXPoints;}
00042 Float_t GetLimit() const {
00043 if (fNsplines==1) {
00044 return fSplines[fNsplines-1].endy;
00045 }
00046 else {
00047
00048 return fSplines[fNsplines-2].endy;
00049 }
00050 };
00051
00052 virtual DbiTableRow* CreateTableRow() const {
00053 return new CalLinearity; }
00054
00055
00056 virtual void Fill(DbiResultSet& rs,
00057 const DbiValidityRec* vrec);
00058 virtual void Store(DbiOutRowStream& ors,
00059 const DbiValidityRec* vrec) const;
00060
00061 Float_t ADCtoLin(const Float_t charge) const ;
00062 Float_t LintoADC(const Float_t charge) const ;
00063
00064 private:
00065 CalLinearity(const CalLinearity& from)
00066 : DbiTableRow(from) { LEA_CTOR; *this = from; }
00067
00068 struct spline {
00069 float startx;
00070 float starty;
00071 float slope;
00072 float alpha;
00073 float endx;
00074 float endy;
00075 };
00076
00077
00078 Int_t fAggregateNo;
00079 Int_t fStripEndKey;
00080 Int_t fStripEndId;
00081 Int_t fTask;
00082 mutable Int_t fNumber;
00083 mutable Float_t fParam[40];
00084
00085 spline fSplines[8];
00086 int fNsplines;
00087 int fNumXPoints;
00088
00089 ClassDef(CalLinearity,0)
00090 };
00091
00092 #endif //CALLINEARITY_H