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

NtpBDFullModule.cxx

Go to the documentation of this file.
00001 #include "BeamDataNtuple/Module/NtpBDFullModule.h"
00002 #include "BeamDataNtuple/NtpBDFullRecord.h"
00003 #include "BeamDataNtuple/BeamDataLiteHeader.h"
00004 #include "MessageService/MsgService.h"
00005 #include "MinosObjectMap/MomNavigator.h"
00006 #include "JobControl/JobCModuleRegistry.h" // For JOBMODULE macro
00007 
00008 #include <RawData/RawRecord.h>
00009 #include <RawData/RawBeamMonHeaderBlock.h>
00010 #include <RawData/RawBeamMonBlock.h>
00011 
00012 #include <Validity/VldContext.h>
00013 
00014 #include <DataUtil/GetRecords.h>
00015 #include <DataUtil/GetRawBlock.h>
00016 
00017 #include <BeamDataUtil/BDScalar.h>
00018 
00019 #include <vector>
00020 
00021 ClassImp(NtpBDFullModule)
00022 
00023 JOBMODULE(NtpBDFullModule, "NtpBDFull",
00024           "Fill the beam monitoring data ntuple");
00025 CVSID("$Id: NtpBDFullModule.cxx,v 1.2 2007/03/01 17:38:35 rhatcher Exp $");
00026 //......................................................................
00027 
00028 
00029 NtpBDFullModule::NtpBDFullModule()
00030 {}
00031 
00032 //......................................................................
00033 
00034 NtpBDFullModule::~NtpBDFullModule()
00035 {}
00036 
00037 //......................................................................
00038 
00039 void NtpBDFullModule::BeginJob()
00040 {
00041 //======================================================================
00042 // 
00043 //======================================================================
00044     MSG("NtpBDFull",Msg::kDebug)<<"In NtpBDFull::BeginJob"<<endl;
00045 }
00046 
00047 //......................................................................
00048 
00049 void NtpBDFullModule::BeginFile()
00050 {
00051 //======================================================================
00052 // Get the "run" and "subrun" number from the filename
00053 //======================================================================
00054     MSG("NtpBDFull",Msg::kDebug)<<"In NtpBDFull::BeginFile"<<endl;
00055 }
00056 
00057 //......................................................................
00058 
00059 void NtpBDFullModule::EndJob()
00060 {
00061 //======================================================================
00062 // Print out some summary at the end of the job
00063 //======================================================================
00064     MSG("NtpBDFull",Msg::kDebug)<<"In NtpBDFull::EndJob"<<endl;
00065 }
00066 
00067 //......................................................................
00068 
00069 
00070 JobCResult NtpBDFullModule::Reco(MomNavigator* mom)
00071 {
00072 //======================================================================
00073 // Read in the raw beam monitoring data files and fill the ntuples
00074 //======================================================================
00075     MSG("NtpBDFull",Msg::kDebug)<<"In NtpBDFull::Reco"<<endl;
00076 
00077     JobCResult result(JobCResult::kPassed); // kNoDecision, kFailed, etc.
00078 
00079     vector<const RawBeamMonBlock*> rbmbs = DataUtil::GetRawBlocks<RawBeamMonBlock>(mom);
00080     vector<const RawBeamMonHeaderBlock*> rbmhbs = DataUtil::GetRawBlocks<RawBeamMonHeaderBlock>(mom);
00081 
00082     if (rbmhbs.size() != 1 && rbmbs.size() != 1) {
00083         MSG("BDFull",Msg::kWarning)
00084             << "No beam monitoring data in mom\n";
00085         return JobCResult::kFailed;
00086     }
00087     
00088     const RawBeamMonHeaderBlock& rbmhb = *rbmhbs[0];
00089     const RawBeamMonBlock& rbmb = *rbmbs[0];
00090 
00091     VldContext vc = rbmhb.GetVldContext();
00092     
00093     // make a header
00094     BeamDataLiteHeader bdh(vc);
00095 
00096     // TODO: fill the other members of the BeamDataLiteHeader
00097     
00098     NtpBDFullRecord* ntpbdr = new NtpBDFullRecord(bdh);
00099 
00100     NtpBDFullRecord& ntpbdr_r = *(ntpbdr);
00101     
00102     this->FillToroids(ntpbdr_r,rbmhb, rbmb);
00103         
00104     //give the ntpbdr object to mom, she'll write it to the file
00105     mom->AdoptFragment(ntpbdr);
00106 
00107     return result;
00108 
00109 }
00110 
00111 //......................................................................
00112 
00113 
00114 void NtpBDFullModule::FillToroids(NtpBDFullRecord& ntpbdr_r,
00115                                   const RawBeamMonHeaderBlock& rbmhb,
00116                                   const RawBeamMonBlock& rbmb)
00117 {
00118     BDScalar bdpi1(5,10,"E:TRTGTD");
00119     bdpi1.SetSpill(rbmhb, rbmb);
00120     ntpbdr_r.protonIntensity = bdpi1.GetValue();
00121     MSG("NtpBDFull",Msg::kDebug) << "In NtpBDFullModule::FillToroids: PoT = "
00122                                  << ntpbdr_r.protonIntensity << endl;
00123 }
00124 
00125 //......................................................................
00126 
00127 
00128 
00129 

Generated on Mon Feb 15 11:07:05 2010 for loon by  doxygen 1.3.9.1