AtNuFindModule Class Reference

#include <AtNuFindModule.h>

Inheritance diagram for AtNuFindModule:
JobCModule

List of all members.

Public Member Functions

 AtNuFindModule ()
 ~AtNuFindModule ()
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
Int_t fMCTruthFlag

Detailed Description

Definition at line 9 of file AtNuFindModule.h.


Constructor & Destructor Documentation

AtNuFindModule::AtNuFindModule (  ) 

Definition at line 35 of file AtNuFindModule.cxx.

00035                                :
00036   fListIn("CandSliceListHandle"),
00037   fMCTruthFlag(0)
00038 {
00039   
00040 }

AtNuFindModule::~AtNuFindModule (  ) 

Definition at line 42 of file AtNuFindModule.cxx.

00043 {
00044  
00045 }


Member Function Documentation

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

Implement this for read only access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 107 of file AtNuFindModule.cxx.

References JobCResult::kPassed.

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

void AtNuFindModule::BeginJob ( void   )  [virtual]

Implement for notification of begin of job

Reimplemented from JobCModule.

Definition at line 47 of file AtNuFindModule.cxx.

References Msg::kInfo, and MSG.

00048 {
00049 
00050   MSG("AtNuFindModule", Msg::kInfo) << " *** AtNuFindModule::BeginJob() *** " << endl;
00051 
00052   /*
00053   AlgFactory &af = AlgFactory::GetInstance();
00054   af.Register("AlgAtNuReco","default","libAtNuReco.so","AlgConfig");
00055   af.Register("AlgAtNuRecoMCTruth","default","libAtNuReco.so","AlgConfig");
00056   af.Register("AlgTrackAtNuList", "default", "libAtNuReco.so", "AlgConfig");
00057   af.Register("AlgTrackAtNu", "default", "libAtNuReco.so", "AlgConfig");
00058   af.Register("AlgShowerAtNuList", "default", "libAtNuReco.so", "AlgConfig");
00059   af.Register("AlgShowerAtNu", "default", "libAtNuReco.so", "AlgConfig");
00060   */
00061 }

void AtNuFindModule::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 174 of file AtNuFindModule.cxx.

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

00175 {
00176 
00177   MSG("AtNuFindModule", Msg::kInfo) << " *** AtNuFindModule::Config() *** " << endl;
00178 
00179   Int_t tmpint; Double_t tmpdub; const char* tmpchar = 0;
00180 
00181   if(r.Get("ListIn",tmpchar)) fListIn = tmpchar;
00182   if(r.Get("MCTruthFlag",tmpint)) fMCTruthFlag = tmpint;
00183 
00184   AlgFactory &af = AlgFactory::GetInstance();
00185 
00186   AlgHandle ah_atnu = af.GetAlgHandle("AlgAtNuReco","default");
00187   AlgConfig &ac_atnu = ah_atnu.GetAlgConfig();
00188   ac_atnu.UnLockValues();
00189   if(r.Get("ListOutTrk",tmpchar)) ac_atnu.Set("ListOutTrk",tmpchar);
00190   if(r.Get("ListOutShw",tmpchar)) ac_atnu.Set("ListOutShw",tmpchar);
00191   if(r.Get("VtxFlag",tmpint)) ac_atnu.Set("VtxFlag",tmpint);
00192   if(r.Get("PeCut",tmpdub)) ac_atnu.Set("PeCut",tmpdub);
00193   ac_atnu.LockValues();
00194 
00195   AlgHandle ah_atnumc = af.GetAlgHandle("AlgAtNuRecoMCTruth","default");
00196   AlgConfig &ac_atnumc = ah_atnumc.GetAlgConfig();
00197   ac_atnumc.UnLockValues();
00198   if(r.Get("ListOutTrk",tmpchar)) ac_atnumc.Set("ListOutTrk",tmpchar);
00199   if(r.Get("ListOutShw",tmpchar)) ac_atnumc.Set("ListOutShw",tmpchar);
00200   ac_atnumc.LockValues();
00201 
00202   AlgHandle ah_trk = af.GetAlgHandle("AlgTrackAtNu","default");
00203   AlgConfig &ac_trk = ah_trk.GetAlgConfig();
00204   ac_trk.UnLockValues();
00205   if(r.Get("FibreIndex",tmpdub)) ac_trk.Set("FibreIndex",tmpdub);
00206   if(r.Get("AtNuAnaOnOff",tmpint)) ac_trk.Set("AtNuAnaOnOff",tmpint);
00207   ac_trk.LockValues();
00208 
00209   AlgHandle ah_shw = af.GetAlgHandle("AlgShowerAtNu","default");
00210   AlgConfig &ac_shw = ah_shw.GetAlgConfig();
00211   ac_shw.UnLockValues();
00212   if(r.Get("FibreIndex",tmpdub)) ac_shw.Set("FibreIndex",tmpdub);
00213   if(r.Get("AtNuAnaOnOff",tmpint)) ac_shw.Set("AtNuAnaOnOff",tmpint);
00214   ac_shw.LockValues();
00215 
00216   return;
00217 }

const Registry & AtNuFindModule::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; }

Reimplemented from JobCModule.

Definition at line 117 of file AtNuFindModule.cxx.

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

00118 {
00119 
00120   MSG("AtNuFindModule", Msg::kInfo) << " *** AtNuFindModule::DefaultConfig() *** " << endl;
00121 
00122   static Registry r;
00123   r.SetName("AtNuFindModule.config.default");
00124   r.UnLockValues();
00125   r.Set("ListIn",fListIn.Data());
00126   r.Set("MCTruthFlag",fMCTruthFlag);
00127   r.Set("ListOutTrk","CandTrackAtNuListHandle");
00128   r.Set("ListOutShw","CandShowerAtNuListHandle");
00129   r.Set("VtxFlag",1);
00130   r.Set("PeCut",1.0);
00131   r.Set("FibreIndex",1.77);
00132   r.Set("AtNuAnaOnOff",1);
00133   r.LockValues();
00134 
00135   AlgFactory &af = AlgFactory::GetInstance();
00136 
00137   af.Register("AlgAtNuReco","default");
00138   AlgHandle ah_atnu = af.GetAlgHandle("AlgAtNuReco","default");
00139   AlgConfig &ac_atnu = ah_atnu.GetAlgConfig();
00140   ac_atnu.UnLockValues();
00141   ac_atnu.Set("ListOutTrk","CandTrackAtNuListHandle");
00142   ac_atnu.Set("ListOutShw","CandShowerAtNuListHandle");
00143   ac_atnu.Set("VtxFlag",1);
00144   ac_atnu.Set("PeCut",1.0);
00145   ac_atnu.LockValues();
00146 
00147   af.Register("AlgAtNuRecoMCTruth","default");
00148   AlgHandle ah_atnumc = af.GetAlgHandle("AlgAtNuRecoMCTruth","default");
00149   AlgConfig &ac_atnumc = ah_atnumc.GetAlgConfig();
00150   ac_atnumc.UnLockValues();
00151   ac_atnumc.Set("ListOutTrk","CandMCTrackAtNuListHandle");
00152   ac_atnumc.Set("ListOutShw","CandMCShowerAtNuListHandle");
00153   ac_atnumc.LockValues();
00154 
00155   af.Register("AlgTrackAtNu", "default");
00156   AlgHandle ah_trk = af.GetAlgHandle("AlgTrackAtNu","default");
00157   AlgConfig &ac_trk = ah_trk.GetAlgConfig();
00158   ac_trk.UnLockValues();
00159   ac_trk.Set("FibreIndex",1.77);
00160   ac_trk.Set("AtNuAnaOnOff",1);
00161   ac_trk.LockValues();
00162 
00163   af.Register("AlgShowerAtNu", "default");
00164   AlgHandle ah_shw = af.GetAlgHandle("AlgShowerAtNu","default");
00165   AlgConfig &ac_shw = ah_shw.GetAlgConfig();
00166   ac_shw.UnLockValues();
00167   ac_shw.Set("FibreIndex",1.77);
00168   ac_shw.Set("AtNuAnaOnOff",1);
00169   ac_shw.LockValues();
00170 
00171   return r;
00172 }

void AtNuFindModule::EndJob (  )  [virtual]

Implement for notification of end of job

Reimplemented from JobCModule.

Definition at line 228 of file AtNuFindModule.cxx.

00229 {   
00230 
00231 }     

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

Implement to handle a JobCommand

Reimplemented from JobCModule.

Definition at line 219 of file AtNuFindModule.cxx.

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

00220 {
00221   TString cmd = command->PopCmd();
00222   if(cmd=="Set"){
00223     TString opt = command->PopOpt();
00224 
00225   }
00226 }

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

Implement this for read-write access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 63 of file AtNuFindModule.cxx.

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

00064 {
00065 
00066   // AtNuFindModule::Reco()
00067   MSG("AtNuFindModule", Msg::kInfo) << " *** AtNuFindModule::Reco() *** " << endl;
00068   JobCResult result(JobCResult::kPassed);
00069 
00070   // Find PrimaryCandidateRecord fragment in mom.
00071   CandRecord *candrec = dynamic_cast<CandRecord *> (mom->GetFragment("CandRecord", "PrimaryCandidateRecord"));
00072   if(!candrec){ 
00073     MSG("AtNuFindModule", Msg::kWarning) << " Failed to Find CandRecord " << endl;
00074     return result.SetFailed();
00075   }
00076 
00077   // Find CandSliceList in PrimaryCandidateRecord.   
00078   CandSliceListHandle *cslh = dynamic_cast<CandSliceListHandle*>(candrec->FindCandHandle("CandSliceListHandle",fListIn.Data()));
00079   if(!cslh){
00080     MSG("AtNuFindModule", Msg::kWarning) << " Failed to Find " << fListIn.Data() << endl;
00081     return result.SetFailed();
00082   }
00083 
00084   // Make CandAtNuRecoHandle
00085   MSG("AtNuFindModule", Msg::kDebug) << " Make CandAtNuRecoHandle " << endl;
00086   TString alg_atnu("AlgAtNuReco"); if(fMCTruthFlag) alg_atnu.Append("MCTruth");
00087   MSG("AtNuFindModule", Msg::kDebug) << "     ... using algorithm " << alg_atnu.Data() << endl;
00088 
00089   AlgFactory &af = AlgFactory::GetInstance();
00090   AlgHandle ah_atnu = af.GetAlgHandle(alg_atnu.Data(), "default");
00091   
00092   CandContext cx_atnu(this, mom);
00093   cx_atnu.SetCandRecord(candrec);
00094   cx_atnu.SetDataIn(cslh);
00095   CandAtNuRecoHandle candatnu = CandAtNuReco::MakeCandidate(ah_atnu, cx_atnu);
00096   candatnu.SetName("CandAtNuRecoHandle");
00097   candatnu.SetTitle(TString("Created by AtNuFindModule from ").Append(cslh->GetName()));
00098   
00099   candrec->SecureCandHandle(candatnu);
00100 
00101   MSG("AtNuFindModule", Msg::kInfo) << " *** AtNuFindModule::Reco() FINISHED *** " << endl;
00102 
00103   return result;
00104 
00105 }


Member Data Documentation

TString AtNuFindModule::fListIn [private]

Definition at line 25 of file AtNuFindModule.h.

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

Definition at line 26 of file AtNuFindModule.h.

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


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1