AtNuFitModule Class Reference

#include <AtNuFitModule.h>

Inheritance diagram for AtNuFitModule:

JobCModule List of all members.

Public Member Functions

 AtNuFitModule ()
 ~AtNuFitModule ()
void BeginJob ()
JobCResult Reco (MomNavigator *mom)
JobCResult Ana (const MomNavigator *mom)
const RegistryDefaultConfig () const
void Config (const Registry &r)
void HandleCommand (JobCommand *command)
void EndJob ()

Private Attributes

TString fListIn
TString fListOut

Detailed Description

Definition at line 10 of file AtNuFitModule.h.


Constructor & Destructor Documentation

AtNuFitModule::AtNuFitModule (  ) 

Definition at line 31 of file AtNuFitModule.cxx.

00031                              :
00032   fListIn("CandTrackListHandle"),
00033   fListOut("CandFitTrackAtNuListHandle")
00034 {
00035   
00036 }

AtNuFitModule::~AtNuFitModule (  ) 

Definition at line 38 of file AtNuFitModule.cxx.

00039 {
00040  
00041 }


Member Function Documentation

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

Implement this for read only access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 109 of file AtNuFitModule.cxx.

References JobCResult::kPassed.

00110 {
00111 
00112   JobCResult result(JobCResult::kPassed);
00113 
00114 
00115   return result;
00116 
00117 }

void AtNuFitModule::BeginJob (  )  [virtual]

Implement for notification of begin of job

Reimplemented from JobCModule.

Definition at line 43 of file AtNuFitModule.cxx.

References Msg::kInfo, and MSG.

00044 {
00045 
00046   MSG("AtNuFitModule", Msg::kInfo) << " *** AtNuFitModule::BeginJob() *** " << endl;
00047 
00048   /*
00049   AlgFactory &af = AlgFactory::GetInstance();
00050   af.Register("AlgFitTrackAtNuList", "default", "libAtNuReco.so", "AlgConfig");
00051   af.Register("AlgFitTrackAtNu", "default", "libAtNuReco.so", "AlgConfig");
00052   */
00053 }

void AtNuFitModule::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.

Reimplemented from JobCModule.

Definition at line 144 of file AtNuFitModule.cxx.

References fListIn, fListOut, Registry::Get(), AlgHandle::GetAlgConfig(), AlgFactory::GetAlgHandle(), AlgFactory::GetInstance(), Msg::kInfo, Registry::LockValues(), MSG, Registry::Set(), and Registry::UnLockValues().

00145 {
00146 
00147   MSG("AtNuFitModule", Msg::kInfo) << " *** AtNuFitModule::Config() *** " << endl;
00148 
00149   Int_t tmpint=0;
00150   const char* tmpchar = 0;
00151   if(r.Get("ListIn",tmpchar)) fListIn = tmpchar;
00152   if(r.Get("ListOut",tmpchar)) fListOut = tmpchar;
00153   MSG("AtNuFitModule", Msg::kInfo) << "   ... input: " << fListIn.Data() << endl;
00154   MSG("AtNuFitModule", Msg::kInfo) << "   ... output: " << fListOut.Data() << endl;
00155 
00156   AlgFactory &af = AlgFactory::GetInstance();
00157     
00158   AlgHandle ah_atnu = af.GetAlgHandle("AlgFitTrackAtNu","default");
00159   AlgConfig &ac_atnu = ah_atnu.GetAlgConfig();
00160   ac_atnu.UnLockValues();
00161   if(r.Get("BFieldMap",tmpint)) ac_atnu.Set("BFieldMap",tmpint);
00162   ac_atnu.LockValues();
00163 
00164 
00165   return;
00166 }

const Registry & AtNuFitModule::DefaultConfig (  )  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; }

Reimplemented from JobCModule.

Definition at line 119 of file AtNuFitModule.cxx.

References fListIn, fListOut, AlgHandle::GetAlgConfig(), AlgFactory::GetAlgHandle(), AlgFactory::GetInstance(), Msg::kInfo, Registry::LockValues(), MSG, AlgFactory::Register(), Registry::Set(), and Registry::UnLockValues().

00120 {
00121 
00122   MSG("AtNuFitModule", Msg::kInfo) << " *** AtNuFitModule::DefaultConfig() *** " << endl;
00123 
00124   static Registry r;
00125   r.SetName("AtNuFitModule.config.default");
00126   r.UnLockValues();
00127   r.Set("ListIn",fListIn.Data());
00128   r.Set("ListOut",fListOut.Data());
00129   r.Set("BFieldMap",201);
00130   r.LockValues();
00131 
00132   AlgFactory &af = AlgFactory::GetInstance();
00133 
00134   af.Register("AlgFitTrackAtNu", "default");
00135   AlgHandle ah_atnu = af.GetAlgHandle("AlgFitTrackAtNu","default");
00136   AlgConfig &ac_atnu = ah_atnu.GetAlgConfig();
00137   ac_atnu.UnLockValues();
00138   ac_atnu.Set("BFieldMap",201);
00139   ac_atnu.LockValues();
00140 
00141   return r;
00142 }

void AtNuFitModule::EndJob (  )  [virtual]

Implement for notification of end of job

Reimplemented from JobCModule.

Definition at line 177 of file AtNuFitModule.cxx.

00178 {   
00179 
00180 }     

void AtNuFitModule::HandleCommand ( JobCommand command  )  [virtual]

Implement to handle a JobCommand

Reimplemented from JobCModule.

Definition at line 168 of file AtNuFitModule.cxx.

References JobCommand::PopCmd(), and JobCommand::PopOpt().

00169 {
00170   TString cmd = command->PopCmd();
00171   if(cmd=="Set"){
00172     TString opt = command->PopOpt();
00173 
00174   }
00175 }

JobCResult AtNuFitModule::Reco ( MomNavigator mom  )  [virtual]

Implement this for read-write access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 55 of file AtNuFitModule.cxx.

References CandRecord::FindCandHandle(), fListIn, fListOut, AlgFactory::GetAlgHandle(), MomNavigator::GetFragment(), AlgFactory::GetInstance(), CandHandle::GetName(), Msg::kDebug, Msg::kInfo, JobCResult::kPassed, Msg::kWarning, CandFitTrackAtNuList::MakeCandidate(), MSG, CandRecord::SecureCandHandle(), JobCResult::SetAOK(), CandContext::SetCandRecord(), CandFitTrackAtNuListHandle::SetCPUTime(), CandContext::SetDataIn(), JobCResult::SetFailed(), CandHandle::SetName(), and CandHandle::SetTitle().

00056 {
00057 
00058   // AtNuFitModule::Reco()
00059   MSG("AtNuFitModule", Msg::kInfo) << " *** AtNuFitModule::Reco() *** " << endl;
00060   JobCResult result(JobCResult::kPassed);
00061 
00062   // Start Clock
00063   struct timeval tpbefore;
00064   gettimeofday(&tpbefore,0);
00065 
00066   // Get CandRecord
00067   CandRecord *candrec = dynamic_cast<CandRecord *> (mom->GetFragment("CandRecord", "PrimaryCandidateRecord"));
00068   if(!candrec){ 
00069     MSG("AtNuFitModule", Msg::kWarning) << " Failed to Fit CandRecord " << endl;
00070     return result.SetFailed();
00071   }
00072 
00073   // Get CandTrackListHandle
00074   CandTrackListHandle* track_list = dynamic_cast<CandTrackListHandle*>(candrec->FindCandHandle("CandTrackListHandle",fListIn.Data()));
00075   if(!track_list){
00076     MSG("AtNuFitModule", Msg::kWarning) << " Failed to Find " << fListIn.Data() << endl;
00077     return result.SetAOK();
00078   }
00079 
00080   // Make CandFitTrackAtNuHandle
00081   MSG("AtNuFitModule", Msg::kDebug) << " Make CandFitTrackAtNuHandle " << endl;
00082  
00083   AlgFactory &af = AlgFactory::GetInstance();
00084   AlgHandle ah_atnu = af.GetAlgHandle("AlgFitTrackAtNuList", "default");
00085   CandContext cx_atnu(this, mom);
00086   cx_atnu.SetCandRecord(candrec);
00087   cx_atnu.SetDataIn(track_list);
00088 
00089   CandFitTrackAtNuListHandle candfittrack = CandFitTrackAtNuList::MakeCandidate(ah_atnu, cx_atnu);
00090   candfittrack.SetName(fListOut.Data());
00091   candfittrack.SetTitle(TString("Created by AtNuFitModule from ").Append(track_list->GetName()));
00092 
00093   // Stop Clock
00094   struct timeval tpafter;
00095   gettimeofday(&tpafter,0);
00096 
00097   Double_t dtime;
00098   dtime = 1000.0*(tpafter.tv_sec-tpbefore.tv_sec)+0.001*(tpafter.tv_usec-tpbefore.tv_usec);
00099   candfittrack.SetCPUTime(dtime);
00100 
00101   candrec->SecureCandHandle(candfittrack);
00102 
00103   MSG("AtNuFitModule", Msg::kInfo) << " *** AtNuFitModule::Reco() FINISHED *** " << endl;
00104 
00105   return result;
00106 
00107 }


Member Data Documentation

TString AtNuFitModule::fListIn [private]

Definition at line 26 of file AtNuFitModule.h.

Referenced by Config(), DefaultConfig(), and Reco().

TString AtNuFitModule::fListOut [private]

Definition at line 27 of file AtNuFitModule.h.

Referenced by Config(), DefaultConfig(), and Reco().


The documentation for this class was generated from the following files:
Generated on Mon Sep 1 00:51:06 2014 for loon by  doxygen 1.4.7