00001 #include "ChannelNoiseRates.h"
00002 #include "DatabaseInterface/DbiOutRowStream.h"
00003 #include "DatabaseInterface/DbiResultPtr.h"
00004 #include "MessageService/MsgService.h"
00005
00006 #include <fstream>
00007
00008 ClassImp(ChannelNoiseRates)
00009
00010 CVSID("$Id: ChannelNoiseRates.cxx,v 1.2 2008/06/12 19:53:15 rhatcher Exp $");
00011
00012 #include "DatabaseInterface/DbiResultPtr.tpl"
00013 template class DbiResultPtr<ChannelNoiseRates>;
00014 #include "DatabaseInterface/DbiWriter.tpl"
00015 template class DbiWriter<ChannelNoiseRates>;
00016
00017 ChannelNoiseRates::ChannelNoiseRates()
00018 : fCrate(0), fChAdd(0), fNormRate(0)
00019 {
00020
00021 }
00022
00023 ChannelNoiseRates::ChannelNoiseRates(Int_t pCrate, Int_t pChAdd, Float_t pNormRate)
00024 : fCrate(pCrate), fChAdd(pChAdd), fNormRate(pNormRate)
00025 {
00026
00027 }
00028
00029 void ChannelNoiseRates::WriteRates()
00030 {
00031
00032 VldRange vr(Detector::kFar, SimFlag::kMC || SimFlag::kData,
00033 VldTimeStamp(2006, 8, 15, 12, 0, 0),
00034 VldTimeStamp::GetEOT(),
00035 "Testing");
00036
00037 VldTimeStamp now;
00038 DbiWriter<ChannelNoiseRates> writer(vr, -1, 0, now);
00039
00040 fstream chanhitsfile;
00041
00042 chanhitsfile.open("chanhits_norm");
00043 if ( !chanhitsfile ) {
00044 cout << "FastPhotonModel: No chanhits file!!!" << std::endl;
00045 }
00046
00047 Int_t _chanadd;
00048 Float_t _chanrate;
00049 Int_t _crate;
00050 while (!chanhitsfile.eof()) {
00051 chanhitsfile >> _crate >> _chanadd >> _chanrate;
00052 ChannelNoiseRates row(_crate, _chanadd, _chanrate);
00053 writer << row;
00054 }
00055
00056 writer.Close();
00057
00058 }
00059
00060 DbiTableRow* ChannelNoiseRates::CreateTableRow() const
00061 {
00062 return new ChannelNoiseRates;
00063 }
00064
00065 void ChannelNoiseRates::Fill(DbiResultSet& rs, const DbiValidityRec* ){
00066 rs >> fCrate >> fChAdd >> fNormRate;
00067 }
00068
00069
00070
00071 void ChannelNoiseRates::Store(DbiOutRowStream& ors, const DbiValidityRec* ) const {
00072 ors << fCrate << fChAdd << fNormRate;
00073 }