NuModule Class Reference

#include <NuModule.h>

Inheritance diagram for NuModule:
JobCModule

List of all members.

Public Member Functions

 NuModule ()
virtual ~NuModule ()
virtual void BeginJob ()
virtual void Config (const Registry &r)
virtual const RegistryDefaultConfig () const
virtual void EndJob ()
virtual JobCResult Ana (const MomNavigator *mom)

Private Attributes

NuAnalysisfNuAnalysis
Int_t fUseOldMethod

Detailed Description

Definition at line 20 of file NuModule.h.


Constructor & Destructor Documentation

NuModule::NuModule (  ) 

Definition at line 31 of file NuModule.cxx.

References Msg::kDebug, and MSG.

00032 {
00033   MSG("NuModule", Msg::kDebug) 
00034    <<"Running NuModule constructor..."<<endl;
00035 
00036   //initialise data members
00037   fNuAnalysis=0;
00038   fUseOldMethod=0;
00039 
00040   MSG("NuModule", Msg::kDebug) 
00041    <<"Finished constructor"<<endl;
00042 }

NuModule::~NuModule (  )  [virtual]

Definition at line 46 of file NuModule.cxx.

References Msg::kDebug, and MSG.

00047 {
00048   MSG("NuModule", Msg::kDebug) 
00049    <<"Running destructor..."<<endl;
00050 
00051   MSG("NuModule", Msg::kDebug) 
00052    <<"Finished destructor"<<endl;
00053 }


Member Function Documentation

JobCResult NuModule::Ana ( const MomNavigator mom  )  [virtual]

Implement this for read only access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 57 of file NuModule.cxx.

References NuAnalysis::ChargeSeparationOneSnarl(), fNuAnalysis, fUseOldMethod, JobCModule::GetCurrentFile(), MomNavigator::GetFragment(), NuBase::InputFileName(), Msg::kInfo, JobCResult::kPassed, Msg::kWarning, NuAnalysis::MakeFullDST(), MAXMSG, and MSG.

00058 {
00059   //to test number of entries
00060   //static Int_t counter=0;
00061   //counter++;
00062   //cout<<"counter="<<counter<<endl;
00063 
00064   //set default result to kPassed
00065   JobCResult result(JobCResult::kPassed);
00066   
00067   //check that mom exists.
00068   assert(mom);
00069   
00070   const NtpStRecord* pntp=dynamic_cast<NtpStRecord*>
00071     (mom->GetFragment("NtpStRecord"));
00072   if (!pntp){
00073     MSG("NuModule",Msg::kWarning) 
00074       << "No NtpStRecord in Mom" << endl;
00075   }
00076   
00077   const NtpBDLiteRecord* pntpBD=dynamic_cast<NtpBDLiteRecord*>
00078     (mom->GetFragment("NtpBDLiteRecord"));
00079   if (!pntpBD){
00080     MAXMSG("NuModule",Msg::kInfo,1)
00081       <<"No NtpBDLiteRecord in Mom (note: not present for MC)"<<endl;
00082   }
00083 
00084   //NtpFitSARecord
00085   const NtpFitSARecord* pntpSA=dynamic_cast<NtpFitSARecord*>
00086     (mom->GetFragment("NtpFitSARecord"));
00087   if (!pntpSA){
00088     MAXMSG("NuModule",Msg::kInfo,1) 
00089       <<"No NtpFitSARecord in Mom (pntpSA="<<pntpSA<<")"<<endl;
00090     //mom->Print();
00091   }
00092   else {
00093     MAXMSG("NuModule",Msg::kInfo,1)
00094       << "Found NtpFitSARecord in Mom" << endl;
00095   }
00096 
00097   //set the file name
00098   static Bool_t firstTime=true;
00099   if (firstTime) {
00100     firstTime=false;
00101     NuBase::InputFileName(this->GetCurrentFile());
00102   }
00103   
00104   //run the code to calc the meu values for events in this snarl
00105   if (fUseOldMethod==1) {
00106     std::cout<<" use charge separtion one snarl"<<endl;
00107     fNuAnalysis->ChargeSeparationOneSnarl(pntp,pntpBD,pntpSA);
00108   }
00109   else {
00110     fNuAnalysis->MakeFullDST(pntp,pntpBD,pntpSA);
00111   }
00112   
00113   return result;
00114 }

void NuModule::BeginJob ( void   )  [virtual]

Implement for notification of begin of job

Reimplemented from JobCModule.

Definition at line 118 of file NuModule.cxx.

References fNuAnalysis, Msg::kInfo, and MSG.

00119 {
00120   MSG("NuModule",Msg::kInfo)
00121     <<"Running NuModule::BeginJob()..."<<endl;
00122 
00123   //construct the NuAnalysis object
00124   fNuAnalysis=new NuAnalysis();
00125 
00126   MSG("NuModule",Msg::kInfo)
00127     <<"Finished running NuModule::BeginJob()"<<endl;
00128 }

void NuModule::Config ( const Registry r  )  [virtual]

Return the actual configuration. If your module directly pulls its configuration from the fConfig Registry, you don't need to override this. Override if you have local config variables.

Purpose: Configure the module given a registry.

Reimplemented from JobCModule.

Definition at line 171 of file NuModule.cxx.

References fUseOldMethod, Registry::Get(), Msg::kDebug, and MSG.

00172 {
00174 
00175   MSG("NuModule",Msg::kDebug)<<"NuModule::Config"<<endl;
00176 
00177   Int_t useOldMethod=0;
00178   if (r.Get("UseOldMethod",useOldMethod)) fUseOldMethod=useOldMethod;
00179   
00180   /*
00181     Int_t runSeqReq=-1;
00182     if (r.Get("LIRunSeqRequired",runSeqReq)) fLIRunSeqReq=runSeqReq;
00183   
00184     Int_t writeOnlyGainCurves=0;
00185     if (r.Get("WriteOnlyGainCurves",
00186     writeOnlyGainCurves)) fWriteOnlyGainCurves=writeOnlyGainCurves;
00187   */
00188 }

const Registry & NuModule::DefaultConfig ( void   )  const [virtual]

Get the default configuration registry. This should normally be overridden. One useful idiom is to implement it like:

const Registry& MyModule::DefaultConfig() const { static Registry cfg; // never is destroyed if (cfg.Size()) return cfg; // already filled it // set defaults: cfg.Set("TheAnswer",42); cfg.Set("Units","unknown"); return cfg; }

Purpose: Method to return default configuration.

Reimplemented from JobCModule.

Definition at line 146 of file NuModule.cxx.

References JobCModule::GetName(), Msg::kDebug, Registry::LockValues(), MSG, Registry::Set(), and Registry::UnLockValues().

00147 {
00149   
00150   MSG("NuModule", Msg::kDebug)
00151     << "Running NuModule::DefaultConfig..." << endl;
00152   
00153   static Registry r;
00154   
00155   string name=this->JobCModule::GetName();
00156   name+=".config.default";
00157   r.SetName(name.c_str());
00158   r.UnLockValues();
00159   
00160   r.Set("UseOldMethod",0);  
00161   //r.Set("LIRunSeqRequired",-1);
00162   //r.Set("WriteOnlyGainCurves",0);
00163 
00164   r.LockValues();
00165   
00166   return r;
00167 }

void NuModule::EndJob (  )  [virtual]

Implement for notification of end of job

Reimplemented from JobCModule.

Definition at line 132 of file NuModule.cxx.

References NuAnalysis::EndJob(), fNuAnalysis, Msg::kInfo, and MSG.

00133 {  
00134   MSG("NuModule",Msg::kInfo)
00135     <<"Running NuModule::EndJob()..."<<endl;
00136 
00137   //finish the job
00138   fNuAnalysis->EndJob();
00139   
00140   MSG("NuModule",Msg::kInfo)
00141     <<"Finished running NuModule::EndJob()"<<endl;
00142 }


Member Data Documentation

Definition at line 35 of file NuModule.h.

Referenced by Ana(), BeginJob(), and EndJob().

Int_t NuModule::fUseOldMethod [private]

Definition at line 36 of file NuModule.h.

Referenced by Ana(), and Config().


The documentation for this class was generated from the following files:

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1