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