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

BeamMonBaseModule.cxx

Go to the documentation of this file.
00001 #include "BeamMonBaseModule.h"
00002 
00003 #include <MessageService/MsgService.h>
00004 
00005 #include <RawData/RawRecord.h>
00006 #include <RawData/RawBeamMonBlock.h>
00007 #include <RawData/RawBeamMonHeaderBlock.h>
00008 #include <RawData/RawBeamData.h>
00009 
00010 #include <DataUtil/GetRecords.h>
00011 #include <HistMan/HistMan.h>
00012 
00013 #include <Conventions/Munits.h>
00014 
00015 #include <TGraph.h>
00016 #include <TCanvas.h>
00017 
00018 #include <vector>
00019 
00020 //ClassImp(BeamMonBaseModule)
00021 
00022 using namespace std;
00023 
00024 CVSID("$Id: BeamMonBaseModule.cxx,v 1.6 2005/05/31 21:24:01 thosieck Exp $");
00025 
00026 BeamMonBaseModule::BeamMonBaseModule()
00027 {
00028 }
00029 
00030 BeamMonBaseModule::~BeamMonBaseModule()
00031 {
00032 }
00033 
00034 template<class BlockType>
00035 const BlockType* get_block(const RawRecord& rr)
00036 {
00037     TIter itr = rr.GetRawBlockIter();
00038     const RawDataBlock* rdb = 0;
00039 
00040     // loop over blocks in record
00041     while ((rdb = dynamic_cast<RawDataBlock*>(itr()))) {
00042         const BlockType *block =  dynamic_cast<const BlockType*>(rdb);
00043         if (block) return block;
00044     }
00045     return 0;
00046 }
00047 
00048 HistMan BeamMonBaseModule::GetHistMan()
00049 {
00050     const char* folder = "Monitoring";
00051     this->GetConfig().Get("folder",folder);
00052     return HistMan(folder);
00053 }
00054 
00055 JobCResult BeamMonBaseModule::Ana(const MomNavigator *mom)
00056 {
00057     vector<const RawRecord*> rrv = DataUtil::GetRecords<const RawRecord>(mom);
00058     const RawBeamMonBlock* block = 0;
00059     const RawBeamMonHeaderBlock* head = 0;
00060 
00061     for (size_t ind=0; ind<rrv.size(); ++ind) {
00062         const RawRecord* rr = rrv[ind];
00063         string stream_name = rr->GetTempTags().GetCharString("stream");
00064         MSG("BD",Msg::kVerbose)
00065             << "Found stream: " << stream_name << endl;
00066 
00067         const RawBeamMonBlock* b = get_block<RawBeamMonBlock>(*rr);
00068         if (b) block=b;
00069         const RawBeamMonHeaderBlock* h = get_block<RawBeamMonHeaderBlock>(*rr);
00070         if (h) head=h;
00071     }
00072     if (! (block && head)) {
00073         MSG("BD",Msg::kWarning)
00074             << "BeamMonBaseModule::Ana: failed to find both header and payload blocks\n";
00075         return JobCResult::kFailed;
00076     }
00077 
00078     this->Fill(*head,*block);
00079 
00080     return JobCResult::kAOK;
00081 }
00082 
00083 
00084 const Registry& BeamMonBaseModule::DefaultConfig() const
00085 {
00086     return DefaultConfigWritable();
00087 }
00088 
00089 Registry& BeamMonBaseModule::DefaultConfigWritable() const
00090 {
00091     if (fConfig.Size() == 0) {
00092         fConfig.Set("folder","Monitoring");
00093     }
00094     return fConfig;
00095 }
00096 

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