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

MeuCalModule.cxx

Go to the documentation of this file.
00001 
00002 
00003 // Coded by Jeff Hartnell Apr/2007 onwards
00004 //
00005 // Contact: j.j.hartnell@rl.ac.uk
00007 
00008 #include <cassert>
00009 
00010 #include "JobControl/JobCModuleRegistry.h"
00011 #include "JobControl/JobCommand.h"
00012 #include "MessageService/MsgService.h"
00013 #include "MinosObjectMap/MomNavigator.h"
00014 #include "BeamDataNtuple/NtpBDLiteRecord.h"
00015 #include "StandardNtuple/NtpStRecord.h"
00016 
00017 #include "MeuCal/MeuAnalysis.h"
00018 #include "MeuCal/MeuCalModule.h"
00019 
00020 JOBMODULE(MeuCalModule,
00021           "MeuCalModule",
00022           "A module to produce MeuSummary ntuples");
00023 
00024 CVSID("$Id: MeuCalModule.cxx,v 1.2 2007/04/04 09:08:57 hartnell Exp $");
00025 
00026 ClassImp(MeuCalModule)
00027 
00028 //......................................................................
00029 
00030 MeuCalModule::MeuCalModule() 
00031 {
00032   MSG("MeuCalModule", Msg::kDebug) 
00033    <<"Running MeuCalModule constructor..."<<endl;
00034 
00035   //initialise data members
00036   fMeuAnalysis=0;
00037 
00038   MSG("MeuCalModule", Msg::kDebug) 
00039    <<"Finished constructor"<<endl;
00040 }
00041 
00042 //......................................................................
00043 
00044 MeuCalModule::~MeuCalModule()
00045 {
00046   MSG("MeuCalModule", Msg::kDebug) 
00047    <<"Running destructor..."<<endl;
00048 
00049   MSG("MeuCalModule", Msg::kDebug) 
00050    <<"Finished destructor"<<endl;
00051 }
00052 
00053 //......................................................................
00054 
00055 JobCResult MeuCalModule::Ana(const MomNavigator *mom)
00056 {
00057   //to test number of entries
00058   //static Int_t counter=0;
00059   //counter++;
00060   //cout<<"counter="<<counter<<endl;
00061 
00062   //set default result to kPassed
00063   JobCResult result(JobCResult::kPassed);
00064   
00065   //check that mom exists.
00066   assert(mom);
00067   
00068   const NtpStRecord* pntp=dynamic_cast<NtpStRecord*>
00069     (mom->GetFragment("NtpStRecord"));
00070   if (!pntp){
00071     MSG("MeuCalModule",Msg::kWarning) 
00072       << "No NtpStRecord in Mom" << endl;
00073   }
00074   
00075   const NtpBDLiteRecord* pntpBD=dynamic_cast<NtpBDLiteRecord*>
00076     (mom->GetFragment("NtpBDLiteRecord"));
00077   if (!pntpBD){
00078     MAXMSG("MeuCalModule",Msg::kInfo,1)
00079       <<"No NtpBDLiteRecord in Mom (note: not present for MC)"<<endl;
00080   }
00081   
00082   //run the code to calc the meu values for events in this snarl
00083   fMeuAnalysis->MakeSummaryTreeWithNtpStOneSnarl(pntp,pntpBD);
00084   
00085   return result;
00086 }
00087 
00088 //......................................................................
00089 
00090 void MeuCalModule::BeginJob() 
00091 {
00092   MSG("MeuCalModule",Msg::kInfo)
00093     <<"Running MeuCalModule::BeginJob()..."<<endl;
00094 
00095   //construct the MeuAnalysis object
00096   fMeuAnalysis=new MeuAnalysis();
00097 
00098   MSG("MeuCalModule",Msg::kInfo)
00099     <<"Finished running MeuCalModule::BeginJob()"<<endl;
00100 }
00101 
00102 //......................................................................
00103 
00104 void MeuCalModule::EndJob() 
00105 {  
00106   MSG("MeuCalModule",Msg::kInfo)
00107     <<"Running MeuCalModule::EndJob()..."<<endl;
00108 
00109   //finish the job
00110   fMeuAnalysis->StoreOrFinishSummaryTree(NULL,NULL,1);
00111 
00112   //write out any histos if a file was opened
00113   fMeuAnalysis->WriteOutHistos();
00114   
00115   MSG("MeuCalModule",Msg::kInfo)
00116     <<"Finished running MeuCalModule::EndJob()"<<endl;
00117 }
00118 
00119 //......................................................................
00120 
00121 const Registry& MeuCalModule::DefaultConfig() const
00122 {
00124 
00125   MSG("MeuCalModule", Msg::kDebug)
00126     << "Running MeuCalModule::DefaultConfig..." << endl;
00127   
00128   static Registry r;
00129   
00130   string name=this->JobCModule::GetName();
00131   name+=".config.default";
00132   r.SetName(name.c_str());
00133   r.UnLockValues();
00134   
00135   //r.Set("LIRunSeqRequired",-1);
00136   //r.Set("WriteOnlyGainCurves",0);
00137   
00138   r.LockValues();
00139   
00140   return r;
00141 }
00142 
00143 //......................................................................
00144 
00145 void MeuCalModule::Config(const Registry& /*r*/)
00146 {
00148 
00149   MSG("MeuCalModule",Msg::kDebug)<<"MeuCalModule::Config"<<endl;
00150 
00151   /*
00152     Int_t runSeqReq=-1;
00153     if (r.Get("LIRunSeqRequired",runSeqReq)) fLIRunSeqReq=runSeqReq;
00154   
00155   Int_t writeOnlyGainCurves=0;
00156   if (r.Get("WriteOnlyGainCurves",
00157   writeOnlyGainCurves)) fWriteOnlyGainCurves=writeOnlyGainCurves;
00158   */
00159 }
00160 
00161 //......................................................................
00162 

Generated on Mon Jun 16 14:57:40 2008 for loon by  doxygen 1.3.9.1