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

TempModule.cxx

Go to the documentation of this file.
00001 #include "TempModule.h"
00002 #include "StripHist.h"
00003 
00004 #include <JobControl/JobCModuleRegistry.h>
00005 #include <JobControl/JobCResult.h>
00006 #include <MessageService/MsgService.h>
00007 
00008 #include <RawData/RawRecord.h>
00009 #include <RawData/RawBeamMonBlock.h>
00010 #include <RawData/RawBeamData.h>
00011 
00012 #include <DataUtil/GetRecords.h>
00013 
00014 #include <Conventions/Munits.h>
00015 
00016 #include <TGraph.h>
00017 #include <TCanvas.h>
00018 #include <TStyle.h>
00019 
00020 #include <vector>
00021 #include <cassert>
00022 
00023 //ClassImp(TempModule)
00024 
00025 using namespace std;
00026 
00027 CVSID("$Id: TempModule.cxx,v 1.5 2005/05/31 21:24:01 thosieck Exp $");
00028 JOBMODULE(TempModule,"MonTemp","Temperature related for Monitoring");
00029 
00030 const char* temp_desc[][3] = {
00031     {"HadMonTemp","Hadron mon temp","E:HMRTD"},
00032     {"MuMon1Temp","Muon mon 1 temp","E:MM1RTD"},
00033     {"MuMon2Temp","Muon mon 2 temp","E:MM2RTD"},
00034     {"MuMon3Temp","Muon mon 3 temp","E:MM3RTD"},
00035     {"HadMonEnvTemp","Hadron Mon Area Temp","E:TTHADM"},
00036     {"MuMon1EnvTemp","Muon Alcove 1 Temp","E:TTMA1"},
00037     {"MuMon2EnvTemp","Muon Alcove 2 Temp","E:TTMA2"},
00038     {"MuMon3EnvTemp","Muon Alcove 3 Temp","E:TTMA3"},
00039     {0,0,0},
00040 };
00041 
00042 TempModule::TempModule()
00043 {
00044 
00045     for (int ind=0; temp_desc[ind][0]; ++ind) {
00046         StripHist* sh = new StripHist(temp_desc[ind][0],
00047                                       temp_desc[ind][1],
00048                                       100,0,100);
00049         fStripHist[temp_desc[ind][0]] = sh;
00050         sh->SetStripRange(1*Munits::day);
00051         MSG("BD",Msg::kVerbose)
00052             << "Creating:" << temp_desc[ind][1] << endl;
00053     }
00054 }
00055 
00056 TempModule::~TempModule()
00057 {
00058 }
00059 
00060 void TempModule::BeginJob()
00061 {
00062     HistMan hm = this->GetHistMan();
00063 
00064     for (int ind=0; temp_desc[ind][0]; ++ind) {
00065         const char* name = temp_desc[ind][0];
00066         const char* title = temp_desc[ind][1];
00067 
00068         TCanvas* canvas = new TCanvas(name,title,500,400);
00069 
00070         StripHist* sh = fStripHist[name];
00071         assert(sh);
00072 
00073         TH1D& hist = sh->GetHist();
00074         hist.SetXTitle("Temperature (degree C)");
00075 
00076         canvas->cd();
00077         sh->Draw("AL");
00078 
00079         hm.Adopt("Temperatures",canvas);
00080         MSG("BD",Msg::kVerbose)
00081             << "Adopting " << canvas->GetName() << endl;
00082     }
00083 }
00084 
00085 
00086 void TempModule::Fill(const RawBeamMonHeaderBlock& /*head*/, const RawBeamMonBlock& block)
00087 {
00088     
00089     for (int ind=0; temp_desc[ind][0]; ++ind) {
00090         const char* name = temp_desc[ind][0];
00091         const char* dev = temp_desc[ind][2];
00092 
00093         const RawBeamData* rbd = block[dev];
00094         if (!rbd) {
00095             MSG("BD",Msg::kWarning)
00096                 << "No " << dev << " in the data\n";
00097             continue;
00098         }
00099         if (! rbd->GetDataLength()) {
00100             MSG("BD",Msg::kWarning)
00101                 << dev << " exists but w/out data\n";
00102             continue;
00103         }
00104         
00105         double val = rbd->GetData()[0];
00106         double dae = 1.0*rbd->GetSeconds() + rbd->GetMsecs()*0.001;
00107         StripHist* sh = fStripHist[name];
00108         assert(sh);
00109         sh->Fill(dae,val);
00110         MSG("BD",Msg::kVerbose)
00111             << "Filled " << name << endl;
00112     }
00113 }
00114 

Generated on Sat Nov 7 01:27:41 2009 for loon by  doxygen 1.3.9.1