// $Id: CalADCtoPEs.h,v 1.1 2006/07/20 03:09:59 mskim Exp $

////////////////////////////////////////////////////////////////////////
//
// Purpose: Aggregated data type
// Origin : There is an example of non-aggregated data type, CalADCtoPE.h
//
// M.S. Kim 03/2006
////////////////////////////////////////////////////////////////////////

#ifndef CALADCTOPES_H
#define CALADCTOPES_H

#include "DatabaseInterface/DbiTableRow.h"
#include "LeakChecker/Lea.h"

class DbiValidityRec;

class CalADCtoPEs : public DbiTableRow
{

public:
   
   // Constructors and destructors.
   CalADCtoPEs() { LEA_CTOR; }
   CalADCtoPEs(Int_t agg, UInt_t sk, Float_t g, Float_t gerr, Float_t spew, Float_t spewerr) :
     fAggregate(agg),fSEIDkey(sk),fGain(g),fGainErr(gerr),fSPEWidth(spew),fSPEWidthErr(spewerr) { LEA_CTOR; }
   virtual ~CalADCtoPEs(){ LEA_DTOR; };
   
   // State testing member functions
   Bool_t CanL2Cache() const { return kTRUE; }
   UInt_t GetIndex(UInt_t /* defIndex */) const { return fSEIDkey; }
   UInt_t GetSEIDkey() const { return fSEIDkey; }
   Float_t GetGain() const { return fGain; }
   Float_t GetGainErr() const { return fGainErr; }
   Float_t GetSPEWidth() const { return fSPEWidth;}
   Float_t GetSPEWidthErr() const { return fSPEWidthErr;}
   Float_t GetPE(const Float_t rawcharge) const;  
   virtual Int_t    GetAggregateNo() const { return fAggregate; }
   virtual DbiTableRow* CreateTableRow() const { 
      return new CalADCtoPEs; }

   // State changing member functions
   virtual void Fill(DbiResultSet& rs,
                    const DbiValidityRec* vrec);
   virtual void Store(DbiOutRowStream& ors,
                     const DbiValidityRec* vrec) const;

   
private:  
   
  CalADCtoPEs(const CalADCtoPEs& from)
    : DbiTableRow(from) { LEA_CTOR; *this = from; }

   // Data members

    Int_t   fAggregate;
    Int_t   fSEIDkey;
   Float_t  fGain;
   Float_t  fGainErr;
   Float_t  fSPEWidth;
   Float_t  fSPEWidthErr;
   
   
   ClassDef(CalADCtoPEs,0)    // Example of aggregated data type. 
};


#endif  // CALADCTOPES_H





