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