Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

CalVaLinearity.h

Go to the documentation of this file.
00001 
00002 // $Id: CalVaLinearity.h,v 1.3 2004/08/27 09:54:40 tagg Exp $
00003 // CalVaLinearity
00004 //
00005 // DB Row class corresponding to a VA PIN linearity correction.
00006 //
00007 // Nathaniel Tagg n.tagg1@physics.ox.ac.uk
00008 // Giles Barr g.barr1@physics.ox.ac.uk
00010 
00011 #ifndef CALVALINEARITY_H
00012 #define CALVALINEARITY_H
00013 
00014 #include "DatabaseInterface/DbiTableRow.h"
00015 #include "DatabaseInterface/DbiValidityRec.h"
00016 #include "LeakChecker/Lea.h"
00017 #include "Plex/PlexStripEndId.h"
00018 #include "RawData/RawChannelId.h"
00019 
00020 class DbiValidityRec;
00021 
00022 class CalVaLinearity : public DbiTableRow
00023 {
00024  private:
00025   enum { kPMAX = 8 }; // Total number of parameters to fit function
00026 
00027  public:
00028   // Constructors and destructors.
00029   CalVaLinearity() { LEA_CTOR; }
00030   CalVaLinearity(const RawChannelId& rcid, Float_t param[kPMAX] ) {
00031     fVAChannel = Rcid2Index(rcid);
00032     for (int i=0; i<kPMAX; i++) fParam[i] = param[i];
00033 
00034     LEA_CTOR; 
00035   }
00036   CalVaLinearity(UInt_t index, Float_t param[kPMAX]) { 
00037     fVAChannel = index;
00038     for (int i=0; i<kPMAX; i++) fParam[i] = param[i];
00039     LEA_CTOR; 
00040   }
00041 
00042   CalVaLinearity(const RawChannelId& rcid, Double_t p0=0, Double_t p1=0, Double_t p2=0, Double_t p3=0, Double_t p4=0 ) {
00043     fVAChannel = Rcid2Index(rcid); 
00044     fParam[0]=p0; fParam[1]=p1; fParam[2]=p2; fParam[3]=p3; fParam[4]=p4;
00045     LEA_CTOR; 
00046   }
00047 
00048   
00049   virtual ~CalVaLinearity(){ LEA_DTOR; };
00050   
00051   // State testing member functions
00052   Bool_t       CanL2Cache()        const { return kTRUE; }
00053   UInt_t       GetIndex(UInt_t)    const { return fVAChannel; }
00054   void         GetParam(Double_t p[kPMAX]) const { 
00055     for (int i=0; i<kPMAX; i++) p[i] = fParam[i]; }
00056   RawChannelId GetRawChannelId() const { return Index2Rcid(fVAChannel); }
00057   UInt_t       GetVAChannel()      const { return fVAChannel; }
00058   Double_t     Linearize(const Double_t adc) const;
00059   Double_t     UnLinearize(const Double_t linearAdc) const;
00060   
00061   virtual DbiTableRow* CreateTableRow() const { return new CalVaLinearity; }
00062   
00063   // State changing member functions
00064   virtual void Fill(DbiResultSet& rs,
00065                     const DbiValidityRec* vrec);
00066   virtual void Store(DbiOutRowStream& ors,
00067                      const DbiValidityRec* vrec) const;
00068 
00069   // Static functions: Used when no object is created
00070   // FitFunction *MUST* follow the spec for TF1 as it is used by the fitter
00071   static Double_t     FitFunction(Double_t *arg, Double_t *par);
00072   static UInt_t       Rcid2Index(const RawChannelId& rcid);
00073   static RawChannelId Index2Rcid(Int_t index);
00074     
00075  private:  
00076   CalVaLinearity(const CalVaLinearity& from) // Hide copy constructor private
00077     : DbiTableRow(from) { LEA_CTOR; *this = from; }
00078   
00079   // Static function used by FitFunction
00080   static Int_t    CheckParameters(Double_t *par);
00081   static Double_t Pole(Double_t x, Double_t k1, Double_t k2, Double_t sign);
00082 
00083   // Data members
00084   Double_t fParam[kPMAX];
00085   UInt_t   fVAChannel;
00086 
00087   ClassDef(CalVaLinearity,0)    // Example of non-aggregated datadata type. 
00088 };
00089         
00090 #endif  // CALVALINEARITY_H

Generated on Mon Feb 15 11:06:27 2010 for loon by  doxygen 1.3.9.1