00001 #include "CalDetPID/CalDetOverlapWin.h"
00002 #include "MessageService/MsgService.h"
00003 #include "DatabaseInterface/DbiOutRowStream.h"
00004 #include "DatabaseInterface/DbiResultSet.h"
00005 #include "DatabaseInterface/DbiValidityRec.h"
00006
00007 ClassImp(CalDetOverlapWin)
00008
00009 CVSID("$Id: CalDetOverlapWin.cxx,v 1.5 2005/03/11 16:17:48 west Exp $\n \
00010 CVSID_DBIRESULTPTR ");
00011
00012 #include "DatabaseInterface/DbiResultPtr.tpl"
00013 template class DbiResultPtr<CalDetOverlapWin>;
00014
00015 #include "DatabaseInterface/DbiWriter.tpl"
00016 template class DbiWriter<CalDetOverlapWin>;
00017
00018
00019 void CalDetOverlapWin::Fill(DbiResultSet& rs,
00020 const DbiValidityRec* ) {
00021
00022 if ( rs.TableName() == "CALDETOVERLAPWIN" ) {
00023
00024 rs>> fParticleType
00025 >> fWinLow
00026 >> fWinHigh;
00027 }
00028 else{
00029
00030 Int_t numCol = rs.NumCols();
00031
00032 for (Int_t curCol = rs.HasRowCounter() ? 3 : 2; curCol <= numCol; ++curCol) {
00033 string colName = rs.CurColName();
00034 if ( colName == "PARTICLETYPE" ) rs >> fParticleType;
00035 else if ( colName == "WINLOW" ) rs >> fWinLow;
00036 else if ( colName == "WINHIGH" ) rs >> fWinHigh;
00037 else {
00038 MSG("Dbi",Msg::kDebug) << "Ignoring column " << curCol
00039 << "(" << colName << ")"
00040 << "; not part of CalDetOverlapWin"
00041 << endl;
00042 rs.IncrementCurCol();
00043 }
00044 }
00045
00046 }
00047 }
00048
00049 void CalDetOverlapWin::Store(DbiOutRowStream& ors,
00050 const DbiValidityRec* ) const {
00051
00052 ors<< fParticleType
00053 << fWinLow
00054 << fWinHigh;
00055 }
00056
00057 std::ostream& CalDetOverlapWin::Print(std::ostream& os, Option_t*) const
00058 {
00059 os<< "-----------------------------------------------\n"
00060 << "PARTICLETYPE: "<<fParticleType<<"\n"
00061 << "WINLOW: "<<fWinLow<<"\n"
00062 << "WINHIGH: "<<fWinHigh<<"\n"
00063 << "-----------------------------------------------\n";
00064 return os;
00065 }
00066
00067 std::ostream& operator<<(std::ostream&os, const CalDetOverlapWin& cr)
00068 {
00069 return cr.Print(os);
00070 }
00071
00072 void CalDetOverlapWin::Print(Option_t* op) const
00073 {
00074 Print(std::cout,op);
00075 }
00076
00077
00078 std::string CalDetOverlapWin::GetTableDesc()
00079 {
00080 return std::string(
00081 "(SeqNo int, PARTICLETYPE int,"
00082 " WINLOW float, WINHIGH float)"
00083 );
00084 }
00085
00086