Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

BeamMonFillerHelpers.cxx

Go to the documentation of this file.
00001 
00002 #include "BeamMonFillerHelpers.h"
00003 #include <BeamDataUtil/BeamMonSwicRel.h>
00004 #include <Validity/VldTimeStamp.h>
00005 
00006 #include <MessageService/MsgService.h>
00007 CVSID("$Id: BeamMonFillerHelpers.cxx,v 1.2 2005/05/16 21:46:26 bv Exp $");
00008 
00009 #include <DatabaseInterface/DbiWriter.h>
00010 #include <DatabaseInterface/DbiWriter.tpl>
00011 
00012 
00013 
00014 class BMWriteHadMuRelImp {
00015 public:
00016     DbiWriter<BeamMonSwicRel> writer;
00017     BMWriteHadMuRelImp(VldRange r, const char* c)
00018         : writer(r,-1,0,VldTimeStamp())
00019     {
00020         writer.SetLogComment(c);
00021     }
00022 };
00023 
00024 BMWriteHadMuRel::BMWriteHadMuRel(VldRange range, const char* comment)
00025     : imp(new BMWriteHadMuRelImp(range,comment))
00026 {
00027 
00028 }
00029 BMWriteHadMuRel::~BMWriteHadMuRel()
00030 {
00031     MSG("BD",Msg::kInfo) << "Closing writer\n";
00032     imp->writer.Close();
00033     delete imp;
00034 }
00035 
00036 void BMWriteHadMuRel::Write(const char* device_name, 
00037                             float channel_rel_calibs[],
00038                             int nchan)
00039 {
00040     BeamMonSwicRel had_row(device_name);
00041     vector<float> &channel = had_row.GetChannels();
00042     MSG("BD",Msg::kInfo) << device_name << endl;
00043     for (int ch=0; ch<96; ++ch) {
00044         int ind = ch-48;
00045         if (ch<48) ind = ch+48;
00046         if (ch<nchan)
00047             channel[ind] = channel_rel_calibs[ch];
00048         else
00049             channel[ind] = 0;
00050         MSG("BD",Msg::kInfo) << "[" << channel[ind] << "] ";
00051     }
00052 
00053     MSG("BD",Msg::kInfo) << "\nWriting\n";
00054     imp->writer << had_row;
00055 }
00056 

Generated on Mon Feb 15 11:06:24 2010 for loon by  doxygen 1.3.9.1