Version 6 (modified by blyth, 14 years ago) |
---|
DbiTables
= Possible Issues ==
varchar/strings in DBI tables may prevent L2Cache
T varchar fields hdr CalibFeeSpec dybsvn:/dybgaudi/trunk/Database/DbiDataSvc/DbiDataSvc/CalibFeeSpec.h CalibPmtSpec PMTDESCRIB dybsvn:/dybgaudi/trunk/Database/DbiDataSvc/DbiDataSvc/CalibPmtSpec.h DaqCalibRunInfo dybsvn:/dybgaudi/trunk/Database/DaqRunInfoSvc/DaqRunInfoSvc/DaqCalibRunInfo.h DaqRawDataFileInfo streamType, stream, fileState, checksum , transferState dybsvn:/dybgaudi/trunk/Database/DbiRawDataFileSvc/DbiRawDataFileSvc/DaqRawDataFileInfo.h DaqRunInfo runType, partitionName dybsvn:/dybgaudi/trunk/Database/DaqRunInfoSvc/DaqRunInfoSvc/DaqRunInfo.h DcsAdTemp dybsvn:/dybgaudi/trunk/Database/DcsDataSvc/DcsDataSvc/DcsAdTemp.h DcsPmtHv dybsvn:/dybgaudi/trunk/Database/DcsDataSvc/DcsDataSvc/DcsPmtHv.h FeeCableMap CHANNELDESC, CHANHRDWDESC, SENSORDESC dybsvn:/dybgaudi/trunk/Database/DbiDataSvc/DbiDataSvc/FeeCableMap.h SimPmtSpec PMTDESCRIB dybsvn:/dybgaudi/trunk/Database/DbiDataSvc/DbiDataSvc/SimPmtSpec.h
Example of genDBI
SimPmtSpec .spec file
- Holds all info needed to generate .h,.cxx,.sql,.tex ...
meta , class , table , CanL2Cache 1 , SimPmtSpec , SimPmtSpec , kTRUE ; name , codetype , dbtype , description , code2db pmtId , DayaBay::DetectorSensor , int(11) , PMT sensor ID , .sensorId() describ , std::string , varchar(27) , String of decribing PMT position , gain , double , float , Relative gain for pmt with mean = 1 , sigmaGain , double , float , 1-sigma spread of S.P.E. response , timeOffset , double , float , Relative transit time offset , timeSpread , double , float , Transit time spread , efficiency , double , float , Absolute efficiency , prePulseProb , double , float , Probability of prepulsing , afterPulseProb , double , float , Probability of afterpulsing , darkRate , double , float , Dark Rate ,
gendbi generated documentation
name dbtype codetype description code2db pmtId int(11) DayaBay::DetectorSensor PMT sensor ID .sensorId() describ varchar(27) std::string String of decribing PMT position gain float double Relative gain for pmt with mean = 1 sigmaGain float double 1-sigma spread of S.P.E. response timeOffset float double Relative transit time offset timeSpread float double Transit time spread efficiency float double Absolute efficiency prePulseProb float double Probability of prepulsing afterPulseProb float double Probability of afterpulsing darkRate float double Dark Rate
gendbi generated sql
DROP TABLE IF EXISTS `SimPmtSpec`; CREATE TABLE `SimPmtSpec` ( `SEQNO` int(11) NOT NULL, `ROW_COUNTER` int(11) NOT NULL auto_increment, `pmtId` int(11) default NULL COMMENT 'PMT sensor ID', `describ` varchar(27) default NULL COMMENT 'String of decribing PMT position', `gain` float default NULL COMMENT 'Relative gain for pmt with mean = 1', `sigmaGain` float default NULL COMMENT '1-sigma spread of S.P.E. response', `timeOffset` float default NULL COMMENT 'Relative transit time offset', `timeSpread` float default NULL COMMENT 'Transit time spread', `efficiency` float default NULL COMMENT 'Absolute efficiency', `prePulseProb` float default NULL COMMENT 'Probability of prepulsing', `afterPulseProb` float default NULL COMMENT 'Probability of afterpulsing', `darkRate` float default NULL COMMENT 'Dark Rate', PRIMARY KEY (`SEQNO`,`ROW_COUNTER`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
gendbi generated header
#ifndef SIMPMTSPEC_H #define SIMPMTSPEC_H //////////////////////////////////////////////////////////////////////// // SimPmtSpec // // // // Package: Dbi (Database Interface). // // // // Concept: A concrete data type corresponding to a single row in // // the SimPmtSpec database table of non-aggregated data. // // // //////////////////////////////////////////////////////////////////////// #include "Rtypes.h" #include "DatabaseInterface/DbiTableRow.h" #include "DatabaseInterface/DbiLog.h" #include "DatabaseInterface/DbiOutRowStream.h" #include "DatabaseInterface/DbiResultSet.h" #include "DatabaseInterface/DbiValidityRec.h" #include "DatabaseInterface/DbiResultPtr.h" #include "DataSvc/ICalibDataSvc.h" #include "Conventions/Detectors.h" #include <string> using namespace std; class DbiValidityRec; class SimPmtSpec : public DbiTableRow { public: SimPmtSpec(){} SimPmtSpec(const SimPmtSpec& from) : DbiTableRow(from) { *this = from; } SimPmtSpec( DayaBay::DetectorSensor pmtId, // PMT sensor ID std::string describ, // String of decribing PMT position double gain, // Relative gain for pmt with mean = 1 double sigmaGain, // 1-sigma spread of S.P.E. response double timeOffset, // Relative transit time offset double timeSpread, // Transit time spread double efficiency, // Absolute efficiency double prePulseProb, // Probability of prepulsing double afterPulseProb, // Probability of afterpulsing double darkRate // Dark Rate ) { m_pmtId = pmtId; m_describ = describ; m_gain = gain; m_sigmaGain = sigmaGain; m_timeOffset = timeOffset; m_timeSpread = timeSpread; m_efficiency = efficiency; m_prePulseProb = prePulseProb; m_afterPulseProb = afterPulseProb; m_darkRate = darkRate; } virtual ~SimPmtSpec(){}; // State testing member functions Bool_t CanL2Cache() const { return kTRUE; } Bool_t Compare(const SimPmtSpec& that ) const { return m_pmtId == that.m_pmtId && m_describ == that.m_describ && m_gain == that.m_gain && m_sigmaGain == that.m_sigmaGain && m_timeOffset == that.m_timeOffset && m_timeSpread == that.m_timeSpread && m_efficiency == that.m_efficiency && m_prePulseProb == that.m_prePulseProb && m_afterPulseProb == that.m_afterPulseProb && m_darkRate == that.m_darkRate ;} // Getters DayaBay::DetectorSensor GetPmtId() const {return m_pmtId; } std::string GetDescrib() const {return m_describ; } double GetGain() const {return m_gain; } double GetSigmaGain() const {return m_sigmaGain; } double GetTimeOffset() const {return m_timeOffset; } double GetTimeSpread() const {return m_timeSpread; } double GetEfficiency() const {return m_efficiency; } double GetPrePulseProb() const {return m_prePulseProb; } double GetAfterPulseProb() const {return m_afterPulseProb; } double GetDarkRate() const {return m_darkRate; } virtual DbiTableRow* CreateTableRow() const { return new SimPmtSpec ; } // I/O member functions virtual void Fill(DbiResultSet& rs, const DbiValidityRec* vrec); virtual void Store(DbiOutRowStream& ors, const DbiValidityRec* vrec) const; private: // Data members DayaBay::DetectorSensor m_pmtId; // PMT sensor ID std::string m_describ; // String of decribing PMT position double m_gain; // Relative gain for pmt with mean = 1 double m_sigmaGain; // 1-sigma spread of S.P.E. response double m_timeOffset; // Relative transit time offset double m_timeSpread; // Transit time spread double m_efficiency; // Absolute efficiency double m_prePulseProb; // Probability of prepulsing double m_afterPulseProb; // Probability of afterpulsing double m_darkRate; // Dark Rate }; #endif // SIMPMTSPEC_H